[Mac] Spending too much time mapping desired font families to available ones
https://bugs.webkit.org/show_bug.cgi?id=137539

Reviewed by Darin Adler.

While profiling the load of weather.com, I noticed that we are spending
quite a bit of time trying to map the font family requested to a font
that is available on the system. The process involves:
1. Doing a linear search of all the installed font families and do a
   case-insensitive string comparison for each of them until we find a
   match,
2. Then, if we don't find a match, do another linear search of the
   fonts' postscript names this time and do again a case-insensitive
   string comparison for each of them.

This process is costly and the fonts requested by weather.com are not
available, causing us to do 2 linear searches and a lot of string
comparisons (accounting for ~2% of the WebProcess CPU time for the page
load). As a result, we end up spending ~90ms in
internalFontWithFamily() when loading weather.com.

This patch introduces a cache for the mapping between desired font
families and available font families. This cuts the time spent in
internalFontWithFamily() in half (~45ms). The cache gets invalidated
when fonts are installed / uninstalled on the system so we don't break
that scenario. The cache is also limited in size to avoid using too
much memory.

No new tests, but manual testing making sure the cache gets invalidated
when installing a font on the system.

* platform/graphics/mac/FontCacheMac.mm:
(WebCore::invalidateFontCache):
* platform/mac/WebFontCache.h:
* platform/mac/WebFontCache.mm:
(desiredFamilyToAvailableFamilyDictionary):
(rememberDesiredFamilyToAvailableFamilyMapping):
(+[WebFontCache internalFontWithFamily:traits:weight:size:]):
(+[WebFontCache invalidate]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174516 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove second-to-last client of WebFontCache
https://bugs.webkit.org/show_bug.cgi?id=137550

Reviewed by Darin Adler.

Source/WebCore:

No new tests because no behavior change.

* WebCore.exp.in:
* platform/graphics/FontCache.h: Allow migration of client to getCachedFontData()

Source/WebKit/mac:

Use FontCache::getCachedFontData() instead of WebFontCache.

* WebView/WebHTMLView.mm:
(-[WebHTMLView _addToStyle:fontA:fontB:]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174517 268f45cc-cd09-0410-ab3c-d52691b4dbfc
iOS Simulator results for fonts tests.

* platform/ios-simulator/fonts/*: Added

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174518 268f45cc-cd09-0410-ab3c-d52691b4dbfc
iOS Simulator results for ietestcenter tests.
Skip fullscreen and gamepad tests.

* platform/ios-simulator/ietestcenter/*: Added

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174519 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Disable tests for more unsupported features in iOS Simulator.

* platform/ios-simulator/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174520 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Get the patch scripts running on Haiku
https://bugs.webkit.org/show_bug.cgi?id=137559

Patch by Adrien Destugues <pulkomandy@gmail.com> on 2014-10-09
Reviewed by Benjamin Poulain.

Use /usr/bin/env instead of hardcoding path to perl.
Declare haiku platform in platforminfo.py to avoid check-webkit-style
failure.

* Scripts/commit-log-editor:
* Scripts/num-cpus:
* Scripts/prepare-ChangeLog:
* Scripts/run-launcher:
* Scripts/svn-create-patch:
* Scripts/webkitpy/common/system/platforminfo.py:
(PlatformInfo._determine_os_name):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174521 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed GTK build fix after r174504.

Missing header include.

* rendering/svg/SVGTextQuery.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Win] Unreviewed build fix: Revert r174378

Roll back this change, as it didn't fix the EWS builders, and has only
served to make Windows builds take forever.

* WebCore.vcxproj/WebCoreGenerated.make: Don't delete all generated content
every time we build.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174523 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move ServicesOverlayController to WebCore
https://bugs.webkit.org/show_bug.cgi?id=137416
<rdar://problem/18546283>

Reviewed by Anders Carlsson.

Move ServicesOverlayController from WebKit2 to WebCore, as it can be used by both Legacy WebKit and WebKit2.

* Platform/Logging.h:
Move Services logging channel to WebCore.

* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::handleTelephoneNumberClick):
(WebKit::WebChromeClient::handleSelectionServiceClick):
(WebKit::WebChromeClient::hasRelevantSelectionServices):
Implement services-related ChromeClient callbacks.
Clicks are forwarded to WebPageMac where they do what they used to;
hasRelevantSelectionServices is implemented as it was when it lived
inside ServicesOverlayController.

* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::selectedTelephoneNumberRangesChanged): Deleted.
(WebKit::WebEditorClient::selectionRectsDidChange): Deleted.
* WebProcess/WebCoreSupport/WebEditorClient.h:
Remove WebEditorClient overrides for now-removed functions.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::updatePreferences):
Forward serviceControlsEnabled setting to WebCore.

(WebKit::WebPage::servicesOverlayController): Deleted.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::serviceControlsEnabled): Deleted.

* WebCore.xcodeproj/project.pbxproj:
* editing/Editor.cpp:
(WebCore::Editor::scanSelectionForTelephoneNumbers):
* editing/SelectionRectGatherer.cpp:
(WebCore::SelectionRectGatherer::Notifier::~Notifier):
Notify ServicesOverlayController of changes via Page instead of EditorClient.

* page/ChromeClient.h:
(WebCore::ChromeClient::handleTelephoneNumberClick):
(WebCore::ChromeClient::handleSelectionServiceClick):
(WebCore::ChromeClient::hasRelevantSelectionServices):
Add ChromeClient functions for services actions.

* page/EditorClient.h:
(WebCore::EditorClient::selectedTelephoneNumberRangesChanged): Deleted.
(WebCore::EditorClient::selectionRectsDidChange): Deleted.
Remove EditorClient functions for notifying ServicesOverlayController of changes,
because it lives in WebCore proper now.

* page/Page.cpp:
(WebCore::Page::Page):
* page/Page.h:
(WebCore::Page::servicesOverlayController):
Keep a ServicesOverlayController on Page.

* page/PageOverlay.cpp:
(WebCore::PageOverlay::mouseEvent):
Use windowToContents instead of rootViewToContents; events come in in window coordinates.

* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::updateSettingsForLayer):
Get Settings from MainFrame, not Page.

* page/Settings.in:
Add servicesControlsEnabled setting.

* page/mac/ServicesOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h.
* page/mac/ServicesOverlayController.mm: Renamed from Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm.
Moved from WebKit2. Mostly mechanical changes, plus:
    - Use windowToContents instead of rootViewToContents; events come in in window coordinates.
    - Cut off rebuild* if serviceControlsEnabled setting is false
    - Don't create the overlay if serviceControlsEnabled setting is false
    - Send click events via ChromeClient.
    - Tie our lifetime to MainFrame instead of Page, and get lots of things from MainFrame instead.

* platform/Logging.h:
Add Services logging channel (moved from WebKit2).


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174524 268f45cc-cd09-0410-ab3c-d52691b4dbfc