WTF should know about Language
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 May 2016 19:38:51 +0000 (19:38 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 May 2016 19:38:51 +0000 (19:38 +0000)
commite2416b6bd90956b6571a278bcd9f76312023b262
tree06166bd94ac8133b3e7ff94b636d936a9d39c8ff
parenta43e24148d30f4d7b7ebabf7ba5fb50dab75735e
WTF should know about Language
https://bugs.webkit.org/show_bug.cgi?id=157756

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Teach our scripts that a ObjC class beginning with WTF is totally cool.

* JavaScriptCore.xcodeproj/project.pbxproj:

Source/WebCore:

Reviewed by Geoffrey Garen.

No new tests because this does not change behavior.

This change is all about moving some language functionality to WTF. Quoting the WTF
ChangeLog, this contains two changes:

- Move everything that WebCore's logic for getting the platform user preferred language
  depended on into WTF. This means CFBundleSPI.h and BlockObjCExceptions.h|cpp.

- Move WebCore::platformUserPreferredLanguages() to WTF::platformUserPreferredLanguages().
  This is needed by https://bugs.webkit.org/show_bug.cgi?id=157755, which will make JSC
  use this to detect the platform user preferred language when running standalone.

The changes in WebCore are mostly about rewiring #includes and #imports and removing the
code that we moved to WTF. But there is one logic change: previously,
platformUserPreferredLanguages() would call WebCore::languageDidChange(). It can't do that
directly anymore, but WTF gives WebCore some API for registering the callback. So in
Language.cpp we now register languageDidChange anytime we do something that would
necessitate it, like calling platformUserPreferredLanguages(). This also registers the
callback inside addLanguageChangeObserver(), since it's possible for that to be called
after JSC had called platformUserPreferredLanguages() but before WebCore does so.

* PlatformEfl.cmake:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* PlatformWin.cmake:
* WebCore.xcodeproj/project.pbxproj:
* bindings/objc/DOMCustomXPathNSResolver.mm:
* editing/ios/EditorIOS.mm:
* editing/mac/DictionaryLookup.mm:
* editing/mac/EditorMac.mm:
* page/CaptionUserPreferencesMediaAF.cpp:
* page/ios/EventHandlerIOS.mm:
* page/ios/FrameIOS.mm:
* page/mac/ChromeMac.mm:
* page/mac/EventHandlerMac.mm:
* platform/Language.cpp:
(WebCore::registerLanguageDidChangeCallbackIfNecessary):
(WebCore::observerMap):
(WebCore::addLanguageChangeObserver):
(WebCore::overrideUserPreferredLanguages):
(WebCore::userPreferredLanguages):
* platform/Language.h:
* platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
* platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
* platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
* platform/graphics/cocoa/FontCocoa.mm:
* platform/graphics/mac/ColorMac.mm:
* platform/graphics/mac/GraphicsContext3DMac.mm:
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
* platform/ios/PlatformSpeechSynthesizerIOS.mm:
* platform/ios/ScrollViewIOS.mm:
* platform/ios/WidgetIOS.mm:
* platform/mac/BlockExceptions.h: Removed.
* platform/mac/BlockExceptions.mm: Removed.
* platform/mac/CursorMac.mm:
* platform/mac/Language.mm: Removed.
* platform/mac/ScrollAnimatorMac.mm:
* platform/mac/ScrollViewMac.mm:
* platform/mac/ScrollbarThemeMac.mm:
* platform/mac/ThemeMac.mm:
* platform/mac/WidgetMac.mm:
* platform/mediastream/mac/AVVideoCaptureSource.mm:
* platform/network/mac/CookieJarMac.mm:
* platform/network/mac/ResourceErrorMac.mm:
* platform/network/mac/ResourceHandleMac.mm:
* platform/spi/cf/CFBundleSPI.h: Removed.
* platform/unix/LanguageUnix.cpp: Removed.
* platform/win/LanguageWin.cpp: Removed.

Source/WebKit/mac:

Reviewed by Geoffrey Garen.

Rewires a bunch of includes/imports.

* WebCoreSupport/PopupMenuMac.mm:
* WebCoreSupport/WebChromeClient.mm:
* WebCoreSupport/WebFrameLoaderClient.mm:
* WebCoreSupport/WebGeolocationClient.mm:
* WebCoreSupport/WebNotificationClient.mm:
* WebCoreSupport/WebPlatformStrategies.mm:
* WebCoreSupport/WebUserMediaClient.mm:
* WebCoreSupport/WebVisitedLinkStore.mm:
* WebView/WebHTMLView.mm:

Source/WebKit2:

Reviewed by Geoffrey Garen and Alexey Proskuryakov.

Rewires a bunch of includes/imports.

* Shared/mac/RemoteLayerTreePropertyApplier.mm:
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
* WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm:

Source/WTF:

Reviewed by Geoffrey Garen.

This contains two changes:

- Move everything that WebCore's logic for getting the platform user preferred language
  depended on into WTF. This means CFBundleSPI.h and BlockObjCExceptions.h|cpp.

- Move WebCore::platformUserPreferredLanguages() to WTF::platformUserPreferredLanguages().
  This is needed by https://bugs.webkit.org/show_bug.cgi?id=157755, which will make JSC
  use this to detect the platform user preferred language when running standalone.

Moving the dependencies accounts for a huge chunk of this change, since we have to rewire
all of the references to those headers in all of WebKit.

Moving platformUserPreferredLanguages() is mostly easy except for the weird callback.
That function would call languageDidChange(), which needs to stay in WebCore. So, this
gives WebCore the ability to register a languageDidChange callback. Other than this new
logic, the code being added to WTF is just being lifted out of WebCore.

* WTF.xcodeproj/project.pbxproj:
* wtf/BlockObjCExceptions.h: Added.
* wtf/BlockObjCExceptions.mm: Added.
(ReportBlockedObjCException):
* wtf/PlatformEfl.cmake:
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/PlatformMac.cmake:
* wtf/PlatformUserPreferredLanguages.h: Added.
* wtf/PlatformUserPreferredLanguagesMac.mm: Added.
(WTF::setPlatformUserPreferredLanguagesChangedCallback):
(WTF::preferredLanguages):
(+[WTFLanguageChangeObserver languagePreferencesDidChange:]):
(WTF::httpStyleLanguageCode):
(WTF::isValidICUCountryCode):
(WTF::platformUserPreferredLanguages):
* wtf/PlatformUserPreferredLanguagesUnix.cpp: Added.
(WTF::setPlatformUserPreferredLanguagesChangedCallback):
(WTF::platformLanguage):
(WTF::platformUserPreferredLanguages):
* wtf/PlatformUserPreferredLanguagesWin.cpp: Added.
(WTF::setPlatformUserPreferredLanguagesChangedCallback):
(WTF::localeInfo):
(WTF::platformLanguage):
(WTF::platformUserPreferredLanguages):
* wtf/PlatformWin.cmake:
* wtf/spi/cf: Added.
* wtf/spi/cf/CFBundleSPI.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201038 268f45cc-cd09-0410-ab3c-d52691b4dbfc
71 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/BlockObjCExceptions.h [moved from Source/WebCore/platform/mac/BlockExceptions.h with 90% similarity]
Source/WTF/wtf/BlockObjCExceptions.mm [moved from Source/WebCore/platform/mac/BlockExceptions.mm with 83% similarity]
Source/WTF/wtf/PlatformEfl.cmake
Source/WTF/wtf/PlatformGTK.cmake
Source/WTF/wtf/PlatformJSCOnly.cmake
Source/WTF/wtf/PlatformMac.cmake
Source/WTF/wtf/PlatformUserPreferredLanguages.h [new file with mode: 0644]
Source/WTF/wtf/PlatformUserPreferredLanguagesMac.mm [moved from Source/WebCore/platform/mac/Language.mm with 91% similarity]
Source/WTF/wtf/PlatformUserPreferredLanguagesUnix.cpp [moved from Source/WebCore/platform/unix/LanguageUnix.cpp with 88% similarity]
Source/WTF/wtf/PlatformUserPreferredLanguagesWin.cpp [moved from Source/WebCore/platform/win/LanguageWin.cpp with 92% similarity]
Source/WTF/wtf/PlatformWin.cmake
Source/WTF/wtf/spi/cf/CFBundleSPI.h [moved from Source/WebCore/platform/spi/cf/CFBundleSPI.h with 100% similarity]
Source/WebCore/ChangeLog
Source/WebCore/PlatformEfl.cmake
Source/WebCore/PlatformGTK.cmake
Source/WebCore/PlatformMac.cmake
Source/WebCore/PlatformWin.cmake
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/objc/DOMCustomXPathNSResolver.mm
Source/WebCore/editing/ios/EditorIOS.mm
Source/WebCore/editing/mac/DictionaryLookup.mm
Source/WebCore/editing/mac/EditorMac.mm
Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
Source/WebCore/page/ios/EventHandlerIOS.mm
Source/WebCore/page/ios/FrameIOS.mm
Source/WebCore/page/mac/ChromeMac.mm
Source/WebCore/page/mac/EventHandlerMac.mm
Source/WebCore/platform/Language.cpp
Source/WebCore/platform/Language.h
Source/WebCore/platform/cocoa/ContentFilterUnblockHandlerCocoa.mm
Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
Source/WebCore/platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm
Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
Source/WebCore/platform/graphics/cocoa/FontCocoa.mm
Source/WebCore/platform/graphics/mac/ColorMac.mm
Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
Source/WebCore/platform/ios/PlatformSpeechSynthesizerIOS.mm
Source/WebCore/platform/ios/ScrollViewIOS.mm
Source/WebCore/platform/ios/WidgetIOS.mm
Source/WebCore/platform/mac/CursorMac.mm
Source/WebCore/platform/mac/ScrollAnimatorMac.mm
Source/WebCore/platform/mac/ScrollViewMac.mm
Source/WebCore/platform/mac/ScrollbarThemeMac.mm
Source/WebCore/platform/mac/ThemeMac.mm
Source/WebCore/platform/mac/WidgetMac.mm
Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
Source/WebCore/platform/network/mac/CookieJarMac.mm
Source/WebCore/platform/network/mac/ResourceErrorMac.mm
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit/mac/WebCoreSupport/WebGeolocationClient.mm
Source/WebKit/mac/WebCoreSupport/WebNotificationClient.mm
Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
Source/WebKit/mac/WebCoreSupport/WebUserMediaClient.mm
Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.mm
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm
Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm
Source/WebKit2/WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm