Ignore:
Timestamp:
Apr 26, 2018, 9:37:26 AM (7 years ago)
Author:
[email protected]
Message:

[INTL] Implement Intl.PluralRules
https://bugs.webkit.org/show_bug.cgi?id=184312

Patch by Andy VanWagoner <[email protected]> on 2018-04-26
Reviewed by JF Bastien.

.:

Added Intl.PluralRules feature flag.

  • Source/cmake/WebKitFeatures.cmake:

Source/JavaScriptCore:

Use UNumberFormat to enforce formatting, and then UPluralRules to find
the correct plural rule for the given number. Relies on ICU v59+ for
resolvedOptions().pluralCategories and trailing 0 detection.
Behind the useIntlPluralRules option and INTL_PLURAL_RULES flag.

  • CMakeLists.txt:
  • Configurations/FeatureDefines.xcconfig:
  • DerivedSources.make:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Sources.txt:
  • builtins/BuiltinNames.h:
  • runtime/BigIntObject.cpp:

(JSC::BigIntObject::create): Moved to ensure complete JSGlobalObject definition.

  • runtime/BigIntObject.h:
  • runtime/CommonIdentifiers.h:
  • runtime/IntlObject.cpp:

(JSC::IntlObject::finishCreation):

  • runtime/IntlObject.h:
  • runtime/IntlPluralRules.cpp: Added.

(JSC::IntlPluralRules::UPluralRulesDeleter::operator() const):
(JSC::IntlPluralRules::UNumberFormatDeleter::operator() const):
(JSC::UEnumerationDeleter::operator() const):
(JSC::IntlPluralRules::create):
(JSC::IntlPluralRules::createStructure):
(JSC::IntlPluralRules::IntlPluralRules):
(JSC::IntlPluralRules::finishCreation):
(JSC::IntlPluralRules::destroy):
(JSC::IntlPluralRules::visitChildren):
(JSC::IntlPRInternal::localeData):
(JSC::IntlPluralRules::initializePluralRules):
(JSC::IntlPluralRules::resolvedOptions):
(JSC::IntlPluralRules::select):

  • runtime/IntlPluralRules.h: Added.
  • runtime/IntlPluralRulesConstructor.cpp: Added.

(JSC::IntlPluralRulesConstructor::create):
(JSC::IntlPluralRulesConstructor::createStructure):
(JSC::IntlPluralRulesConstructor::IntlPluralRulesConstructor):
(JSC::IntlPluralRulesConstructor::finishCreation):
(JSC::constructIntlPluralRules):
(JSC::callIntlPluralRules):
(JSC::IntlPluralRulesConstructorFuncSupportedLocalesOf):
(JSC::IntlPluralRulesConstructor::visitChildren):

  • runtime/IntlPluralRulesConstructor.h: Added.
  • runtime/IntlPluralRulesPrototype.cpp: Added.

(JSC::IntlPluralRulesPrototype::create):
(JSC::IntlPluralRulesPrototype::createStructure):
(JSC::IntlPluralRulesPrototype::IntlPluralRulesPrototype):
(JSC::IntlPluralRulesPrototype::finishCreation):
(JSC::IntlPluralRulesPrototypeFuncSelect):
(JSC::IntlPluralRulesPrototypeFuncResolvedOptions):

  • runtime/IntlPluralRulesPrototype.h: Added.
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::intlPluralRulesAvailableLocales):

  • runtime/JSGlobalObject.h:
  • runtime/Options.h:
  • runtime/RegExpPrototype.cpp: Added inlines header.
  • runtime/VM.cpp:

(JSC::VM::VM):

  • runtime/VM.h:

Source/WebCore:

Added Intl.PluralRules feature flag.

Test: js/intl-pluralrules.html

  • Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

Added Intl.PluralRules feature flag.

  • Configurations/FeatureDefines.xcconfig:

Source/WebKit:

Added Intl.PluralRules feature flag.

  • Configurations/FeatureDefines.xcconfig:

Source/WebKitLegacy/mac:

Added Intl.PluralRules feature flag.

  • Configurations/FeatureDefines.xcconfig:

Source/WTF:

Added Intl.PluralRules feature flag.

  • wtf/FeatureDefines.h:

Tools:

Added Intl.PluralRules feature flag.

  • Scripts/webkitperl/FeatureList.pm:
  • TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

LayoutTests:

  • js/intl-pluralrules-expected.txt: Added.
  • js/intl-pluralrules.html: Added.
  • js/script-tests/intl-pluralrules.js: Added.
  • platform/win/TestExpectations: Disabled Intl.PluralRules tests on win.
File:
1 edited

Legend:

Unmodified
Added
Removed
Note: See TracChangeset for help on using the changeset viewer.