Ignore:
Timestamp:
Sep 7, 2017, 4:11:21 PM (8 years ago)
Author:
[email protected]
Message:

[PAL] Unify PlatformUserPreferredLanguages.h with Language.h
https://bugs.webkit.org/show_bug.cgi?id=176561

Reviewed by Brent Fulgham.

Source/JavaScriptCore:

  • runtime/IntlObject.cpp:

(JSC::defaultLocale):

Source/WebCore:

No new tests because there is no behavior change.

  • CMakeLists.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • accessibility/AccessibilitySVGElement.cpp:
  • bindings/js/JSDOMWindowBase.cpp:
  • bindings/js/JSWorkerGlobalScopeBase.cpp:
  • dom/Document.cpp:
  • html/HTMLInputElement.cpp:
  • html/HTMLMediaElement.cpp:
  • html/shadow/MediaControlElements.cpp:
  • html/track/TrackBase.cpp:
  • page/CaptionUserPreferences.cpp:
  • page/CaptionUserPreferencesMediaAF.cpp:
  • page/DOMWindow.cpp:
  • page/Navigator.cpp:
  • page/NavigatorBase.cpp:
  • platform/graphics/FontGenericFamilies.cpp:
  • platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm:
  • platform/network/HTTPParsers.cpp:
  • platform/text/PlatformLocale.h:
  • platform/text/cf/HyphenationCF.cpp:
  • platform/text/mac/LocaleMac.mm:
  • svg/SVGTests.cpp:
  • testing/InternalSettings.cpp:
  • testing/Internals.cpp:

(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::userPreferredLanguages const):
(WebCore::Internals::setUserPreferredLanguages):

Source/WebKit:

  • UIProcess/WebProcessPool.cpp:
  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::userPreferredLanguagesChanged const):

Source/WebKitLegacy/mac:

  • Misc/WebNSUserDefaultsExtras.mm:

Source/WTF:

WebCore/platform/Language was the only* user of PlatformUserPreferredLanguages (with 1 exception).
That exception is that JavaScriptCore needed the functionality of WebCore/platform/Language, but it
couldn't get it because of the layering violation, so instead it erroneously called into
PlatformUserPreferredLanguages instead. This patch merges these two files into WTF so JSC gets the
right function and the PAL effort has one less file to move from WebCore/platform into PAL.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/CMakeLists.txt:
  • wtf/Language.cpp: Renamed from Source/WebCore/platform/Language.cpp.

(WTF::addLanguageChangeObserver):
(WTF::userPreferredLanguages):

  • wtf/Language.h: Renamed from Source/WebCore/platform/Language.h.
  • wtf/PlatformGTK.cmake:
  • wtf/PlatformJSCOnly.cmake:
  • wtf/PlatformMac.cmake:
  • wtf/PlatformUserPreferredLanguages.h: Removed.
  • wtf/PlatformWPE.cmake:
  • wtf/PlatformWin.cmake:
  • wtf/cf/LanguageCF.cpp: Renamed from Source/WTF/wtf/PlatformUserPreferredLanguagesMac.mm.

(WTF::httpStyleLanguageCode):
(WTF::languagePreferencesDidChange):
(WTF::platformUserPreferredLanguages):

  • wtf/unix/LanguageUnix.cpp: Renamed from Source/WTF/wtf/PlatformUserPreferredLanguagesUnix.cpp.
  • wtf/win/LanguageWin.cpp: Renamed from Source/WTF/wtf/PlatformUserPreferredLanguagesWin.cpp.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/IntlObject.cpp

    r217108 r221768  
    4949#include <unicode/unumsys.h>
    5050#include <wtf/Assertions.h>
     51#include <wtf/Language.h>
    5152#include <wtf/NeverDestroyed.h>
    52 #include <wtf/PlatformUserPreferredLanguages.h>
    5353#include <wtf/text/StringBuilder.h>
    5454
     
    577577    // WebCore's global objects will have their own ideas of how to determine the language. It may
    578578    // be determined by WebCore-specific logic like some WK settings. Usually this will return the
    579     // same thing as platformUserPreferredLanguages()[0].
     579    // same thing as userPreferredLanguages()[0].
    580580    if (auto defaultLanguage = state.jsCallee()->globalObject()->globalObjectMethodTable()->defaultLanguage) {
    581581        String locale = defaultLanguage();
     
    583583            return canonicalizeLanguageTag(locale);
    584584    }
    585    
    586     // If WebCore isn't around to tell us how to get the language then fall back to our own way of
    587     // doing it, which mostly follows what WebCore would have done.
    588     Vector<String> languages = platformUserPreferredLanguages();
     585
     586    Vector<String> languages = userPreferredLanguages();
    589587    if (!languages.isEmpty() && !languages[0].isEmpty())
    590588        return canonicalizeLanguageTag(languages[0]);
Note: See TracChangeset for help on using the changeset viewer.