Ignore:
Timestamp:
Dec 17, 2015, 5:35:53 PM (10 years ago)
Author:
Sukolsak Sakshuwong
Message:

[INTL] Implement Collator Compare Functions
https://bugs.webkit.org/show_bug.cgi?id=147604

Reviewed by Darin Adler.

Source/JavaScriptCore:

This patch implements Intl.Collator.prototype.compare() according
to the ECMAScript 2015 Internationalization API spec (ECMA-402 2nd edition.)

  • runtime/IntlCollator.cpp:

(JSC::IntlCollator::~IntlCollator):
(JSC::sortLocaleData):
(JSC::searchLocaleData):
(JSC::IntlCollator::initializeCollator):
(JSC::IntlCollator::createCollator):
(JSC::IntlCollator::compareStrings):
(JSC::IntlCollator::usageString):
(JSC::IntlCollator::sensitivityString):
(JSC::IntlCollator::resolvedOptions):
(JSC::IntlCollator::setBoundCompare):
(JSC::IntlCollatorFuncCompare): Deleted.

  • runtime/IntlCollator.h:

(JSC::IntlCollator::usage): Deleted.
(JSC::IntlCollator::setUsage): Deleted.
(JSC::IntlCollator::locale): Deleted.
(JSC::IntlCollator::setLocale): Deleted.
(JSC::IntlCollator::collation): Deleted.
(JSC::IntlCollator::setCollation): Deleted.
(JSC::IntlCollator::numeric): Deleted.
(JSC::IntlCollator::setNumeric): Deleted.
(JSC::IntlCollator::sensitivity): Deleted.
(JSC::IntlCollator::setSensitivity): Deleted.
(JSC::IntlCollator::ignorePunctuation): Deleted.
(JSC::IntlCollator::setIgnorePunctuation): Deleted.

  • runtime/IntlCollatorConstructor.cpp:

(JSC::constructIntlCollator):
(JSC::callIntlCollator):
(JSC::sortLocaleData): Deleted.
(JSC::searchLocaleData): Deleted.
(JSC::initializeCollator): Deleted.

  • runtime/IntlCollatorPrototype.cpp:

(JSC::IntlCollatorFuncCompare):
(JSC::IntlCollatorPrototypeFuncResolvedOptions):

  • runtime/IntlObject.cpp:

(JSC::defaultLocale):
(JSC::convertICULocaleToBCP47LanguageTag):
(JSC::intlStringOption):
(JSC::resolveLocale):
(JSC::supportedLocales):

  • runtime/IntlObject.h:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::intlCollatorAvailableLocales):
(JSC::JSGlobalObject::intlDateTimeFormatAvailableLocales):
(JSC::JSGlobalObject::intlNumberFormatAvailableLocales):

Source/WTF:

  • wtf/unicode/Collator.h:

LayoutTests:

  • js/intl-collator-expected.txt:
  • js/intl-collator.html:
  • js/script-tests/intl-collator.js:

(testCollator):

File:
1 edited

Legend:

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

    r194248 r194253  
    10811081        for (int32_t i = 0; i < count; ++i) {
    10821082            String locale(ucol_getAvailable(i));
    1083             // Change from ICU format to BCP47.
    1084             locale.replace('_', '-');
     1083            convertICULocaleToBCP47LanguageTag(locale);
    10851084            m_intlCollatorAvailableLocales.add(locale);
    10861085        }
     
    10951094        for (int32_t i = 0; i < count; ++i) {
    10961095            String locale(udat_getAvailable(i));
    1097             // Change from ICU format to BCP47.
    1098             locale.replace('_', '-');
     1096            convertICULocaleToBCP47LanguageTag(locale);
    10991097            m_intlDateTimeFormatAvailableLocales.add(locale);
    11001098        }
     
    11091107        for (int32_t i = 0; i < count; ++i) {
    11101108            String locale(unum_getAvailable(i));
    1111             // Change from ICU format to BCP47.
    1112             locale.replace('_', '-');
     1109            convertICULocaleToBCP47LanguageTag(locale);
    11131110            m_intlNumberFormatAvailableLocales.add(locale);
    11141111        }
Note: See TracChangeset for help on using the changeset viewer.