Граф коммитов

156 Коммитов

Автор SHA1 Сообщение Дата
Marian-Vasile Laza fca6bc6241 Backed out 3 changesets (bug 1733963) for causing build bustages on SyncedContext.h. CLOSED TREE
Backed out changeset de5c7a16378c (bug 1733963)
Backed out changeset f5f3a27abf60 (bug 1733963)
Backed out changeset cc3a0603f88a (bug 1733963)
2021-11-05 20:54:33 +02:00
Andreas Farre 694649bec3 Bug 1733963 - Part 2: Add BitSet tests. r=glandium
Depends on D127447

Differential Revision: https://phabricator.services.mozilla.com/D127448
2021-11-05 17:23:02 +00:00
Yoshi Cheng-Hao Huang b4c3f94c5f Bug 1737814 - Part 3: Simplify parts data structure. r=platform-i18n-reviewers,anba,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D129563
2021-11-01 14:23:23 +00:00
Yoshi Cheng-Hao Huang 2349231e66 Bug 1737814 - Part 2: ListFormat.FormatToParts doesn't take a callback. r=platform-i18n-reviewers,anba,gregtatum
The caller now will provide a buffer, which owns the memory pointed by the span.

Differential Revision: https://phabricator.services.mozilla.com/D129562
2021-11-01 14:23:22 +00:00
Yoshi Cheng-Hao Huang 24dcdf0726 Bug 1737814 - Part 1: Add a AutoFormatResult class. r=platform-i18n-reviewers,anba,gregtatum
This AutoFormatResult class could be shared later by ListFormat.

Differential Revision: https://phabricator.services.mozilla.com/D129561
2021-11-01 14:23:22 +00:00
André Bargull 4037b90f13 Bug 1736805: Register written normalised length. r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D129428
2021-10-26 07:21:13 +00:00
Yoshi Cheng-Hao Huang 4d0b49fcd3 Bug 1737107 - Add documentation for Collator::GetSortKey. r=platform-i18n-reviewers,anba,dminor
Differential Revision: https://phabricator.services.mozilla.com/D129177
2021-10-25 18:24:07 +00:00
Yoshi Cheng-Hao Huang 817bdf1566 Bug 1719542 - Part 4: Make calling nsTArray::SetCapacity fallible. r=platform-i18n-reviewers,dminor
Originally nsCollation::AllocateRawSortKey used an infallible nsTArray[1],
however, for IndexedDB it used a fallible nsTArray instead[2], so making
SetCapacity fallible.

[1]: https://hg.mozilla.org/mozilla-central/rev/1a74809df6b9#l3.150
[2]: https://searchfox.org/mozilla-central/rev/ff5309e67b20a9976ea762f9ec5f657da0801490/dom/indexedDB/Key.cpp#673

Differential Revision: https://phabricator.services.mozilla.com/D129378
2021-10-25 18:23:12 +00:00
Yoshi Cheng-Hao Huang ba3ef137f3 Bug 1719542 - Part 2: Add an overloading of FillBufferWithICUCall takes nsTArray. r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D128999
2021-10-25 18:23:11 +00:00
Yoshi Cheng-Hao Huang 2a45093834 Bug 1719542 - Part 1: Collator::GetSortKey calls FillBufferWithICUCall. r=platform-i18n-reviewers,anba,gregtatum
Make GetSortKey call FillBufferWithICUCall so we have the same behavior
when resizeing the buffer.

Differential Revision: https://phabricator.services.mozilla.com/D128998
2021-10-25 18:23:11 +00:00
André Bargull 1d976b3b13 Bug 1736834 - Part 9: Expose Locale::{variants_,extension_} as an iterable structure. r=platform-i18n-reviewers,dminor
Expose both members only as an iterable structure to hide implementation details
like the `UniqueChars` storage.

Differential Revision: https://phabricator.services.mozilla.com/D129045
2021-10-22 08:41:14 +00:00
André Bargull a701a254af Bug 1736834 - Part 8: Use direct member access for Locale::{variants_, extensions_}. r=platform-i18n-reviewers,dminor
Use direct member access in preparation for the next part.

Differential Revision: https://phabricator.services.mozilla.com/D129044
2021-10-22 08:41:14 +00:00
André Bargull dd199665f6 Bug 1736834 - Part 7: Use Maybe instead of nullptr to represent absent private-use subtags. r=platform-i18n-reviewers,dminor
Use `Maybe` and return `Span` instead of raw `const char*`.

Differential Revision: https://phabricator.services.mozilla.com/D129043
2021-10-22 08:41:13 +00:00
André Bargull 9e6104f1a2 Bug 1736834 - Part 6: Use Maybe instead of nullptr to represent absent Unicode extensions. r=platform-i18n-reviewers,dminor
Use `Maybe` and return `Span` instead of raw `const char*`.

Differential Revision: https://phabricator.services.mozilla.com/D129042
2021-10-22 08:41:13 +00:00
André Bargull d5261e082c Bug 1736834 - Part 5: Use the existing ICUResult typedef for Locale::toString(). r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D129041
2021-10-22 08:41:13 +00:00
André Bargull 09e2d151a7 Bug 1736834 - Part 4: Change Locale::setUnicodeExtension() to accept a Span. r=platform-i18n-reviewers,dminor
This avoids unnecessary null-termination for the callers.

Differential Revision: https://phabricator.services.mozilla.com/D129040
2021-10-22 08:41:12 +00:00
André Bargull 9a63cb041d Bug 1736834 - Part 3: Resultify Locale::setUnicodeExtension(). r=platform-i18n-reviewers,dminor
Return `ICUResult` from `Locale::setUnicodeExtension()` instead of using `bool`.

Differential Revision: https://phabricator.services.mozilla.com/D129039
2021-10-22 08:41:12 +00:00
André Bargull 2853848369 Bug 1736834 - Part 2: Resultify Locale::{add,remove}LikelySubtags(). r=platform-i18n-reviewers,dminor
Return `ICUResult` from `Locale::{add,remove}LikelySubtags()` instead of using `bool`.

Depends on D129037

Differential Revision: https://phabricator.services.mozilla.com/D129038
2021-10-22 08:41:11 +00:00
André Bargull 7b21811d28 Bug 1736834 - Part 1: Replace manual string comparisons with Span comparisons. r=platform-i18n-reviewers,dminor
The original code was created before bug 1583953 and at that point of time, the
`Span` operators where still costly to call due to release-assertions overhead.

With the release assertions removed, the `Span` operators are now just as efficient
as manually calling `std::char_traits`. (Both will compile down to plain `memcmp`
calls.) But compared to using `std::char_traits`, the `Span` operators are more
ergonomic to use and result in less written code.

Depends on D129036

Differential Revision: https://phabricator.services.mozilla.com/D129037
2021-10-22 08:41:11 +00:00
André Bargull d1f12a9bd7 Bug 1734838: Remove null termination in CallLikelySubtags. r=platform-i18n-reviewers,dminor
We no longer need to null-terminate the result of `CallLikelySubtags`, because
the computed string isn't passed back to ICU anymore. Also update `AssignFromLocaleId`
now that the string isn't null-terminated anymore.

Differential Revision: https://phabricator.services.mozilla.com/D129036
2021-10-22 08:41:11 +00:00
Yoshi Cheng-Hao Huang a3c54356eb Bug 1719678 - Part 2: Unify FormatDateTimeToParts and FormatDateTimeRangeToParts. r=platform-i18n-reviewers,anba,gregtatum,tcampbell
Add DateTimeFormat::TryFormatToParts and
DateIntervalFormat::TryFormattedToParts methods.

Differential Revision: https://phabricator.services.mozilla.com/D126342
2021-10-21 06:55:57 +00:00
Yoshi Cheng-Hao Huang 166ac0c418 Bug 1719678 - Part 1: Add a mozilla::intl::DateIntervalFormat. r=platform-i18n-reviewers,anba,gregtatum,tcampbell
Add a mozilla::intl::DateIntervalFormat class, with two methods:
- TryFormatCalendar
- TryFormatDateTime

and a mozilla::intl::AutoFormattedDateInterval class, which is a RAII
class calling udtitvfmt_openResult and udtitvfmt_closeResult for
DateIntervalFormat operations.

Differential Revision: https://phabricator.services.mozilla.com/D125642
2021-10-21 06:55:57 +00:00
Greg Tatum e732101746 Bug 1719546 - Create a unified bidi component; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D128792
2021-10-20 14:01:21 +00:00
Butkovits Atila 01c5e2aed8 Backed out 3 changesets (bug 1719546) for causing SM bustages at Bidi.h. CLOSED TREE
Backed out changeset c4d6ffc7e445 (bug 1719546)
Backed out changeset a1f7ed6c4251 (bug 1719546)
Backed out changeset e69fc596f2c3 (bug 1719546)
2021-10-19 21:09:47 +03:00
Greg Tatum 4411a88775 Bug 1719546 - Create a unified bidi component; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D128792
2021-10-19 16:55:36 +00:00
Yoshi Cheng-Hao Huang e08bac2c1d Bug 1719551 - Part 1: Add DateTimePatternGenerator::GetPlaceholderPattern. r=platform-i18n-reviewers,anba,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D128460
2021-10-19 07:34:00 +00:00
Dan Minor 2aec3f881c Bug 1719746 - Add gtest for Locale; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D126985
2021-10-18 13:38:21 +00:00
Dan Minor 19bec7878b Bug 1719746 - Rework SpiderMonkey specific code in unified Locale; r=platform-i18n-reviewers,gregtatum,anba
Differential Revision: https://phabricator.services.mozilla.com/D126984
2021-10-18 13:38:21 +00:00
Dan Minor 6de738dee6 Bug 1719746 - Add Locale to moz.build; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D126983
2021-10-18 13:38:20 +00:00
Dan Minor 9c7bff2c25 Bug 1719746 - Copy LanguageTag to intl/components as Locale; r=platform-i18n-reviewers,gregtatum
This moves the LanguageTag implementation from js/src/builtin/intl to
intl/components and renames them to Locale. The next commit will add
them to the build system.

Differential Revision: https://phabricator.services.mozilla.com/D126982
2021-10-18 13:38:20 +00:00
André Bargull af633f0f36 Bug 1733352 - Part 2: Move IcuLocale calls from SpiderMonkey to mozilla::intl. r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D127097
2021-10-16 12:43:21 +00:00
André Bargull a500a53471 Bug 1733352 - Part 1: Fix IcuLocale to test exactly for the string "und". r=platform-i18n-reviewers,gregtatum
Inputs like `IcuLocale("undef")` were also incorrectly changed to `""`.

Differential Revision: https://phabricator.services.mozilla.com/D127096
2021-10-16 12:43:21 +00:00
André Bargull c473b3dcaf Bug 1733353 - Part 2: Remove additional ToICUError declaration. r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D127095
2021-10-16 12:43:20 +00:00
André Bargull 441a8fd850 Bug 1733353 - Part 1: Remove unused includes and using statements. r=platform-i18n-reviewers,gregtatum
Remove includes and `using` statements no longer used after the unified Intl
work.

Differential Revision: https://phabricator.services.mozilla.com/D127094
2021-10-16 12:43:20 +00:00
André Bargull a41fa71881 Bug 1733350: Return a Span from mozilla::intl::Calendar::GetBcp47Type(). r=platform-i18n-reviewers,gregtatum
Return a Span instead of `const char*` for consistency with the rest of the
unified Intl API.

Differential Revision: https://phabricator.services.mozilla.com/D127092
2021-10-16 12:43:19 +00:00
André Bargull 6297258cd3 Bug 1733349: Assert Spans are null-terminated when passed as `const char*` to ICU. r=platform-i18n-reviewers,gregtatum
Some functions are accepting `Span<const char>` and expect that the underlying
`const char*` is null-terminated. Add an assertion that the string is really
null-terminated before passing it to ICU.

And then fix-up any issues where the string span is including the null
terminator. Also see bug 1660161.

Differential Revision: https://phabricator.services.mozilla.com/D127091
2021-10-16 12:43:19 +00:00
Yoshi Cheng-Hao Huang 63e26820be Bug 1735341 : Rename FillVectorWithICUCall to FillBufferWithICUCall. r=platform-i18n-reviewers,anba,dminor
So with this patch FillVectorWithICUCall could become an overload of FillBufferWithICUCall,
with the buffer type is mozilla::Vector.

The callers of mozilla::intl could provide a mozilla::Vector as the
buffer, instead of creating some buffer adapter like nsTArrayU8Buffer,
TestBuffer, or FormatBuffer.

Differential Revision: https://phabricator.services.mozilla.com/D128240
2021-10-15 12:29:03 +00:00
Butkovits Atila 7495be3566 Backed out 9 changesets (bug 1719746, bug 1735341) as requested by dev. CLOSED TREE
Backed out changeset f1b3e7dec7e2 (bug 1735341)
Backed out changeset e7675e3524da (bug 1719746)
Backed out changeset 05109157a4b5 (bug 1719746)
Backed out changeset b98f10477f44 (bug 1719746)
Backed out changeset dce9c0d6c79c (bug 1719746)
Backed out changeset 472767f43cad (bug 1719746)
Backed out changeset 4fa55bded471 (bug 1719746)
Backed out changeset 391c305dce1f (bug 1719746)
Backed out changeset 5f20632de2be (bug 1719746)
2021-10-15 02:02:25 +03:00
Yoshi Cheng-Hao Huang e50fc2c267 Bug 1735341 : Rename FillVectorWithICUCall to FillBufferWithICUCall. r=platform-i18n-reviewers,anba,dminor
So with this patch FillVectorWithICUCall could become an overload of FillBufferWithICUCall,
with the buffer type is mozilla::Vector.

The callers of mozilla::intl could provide a mozilla::Vector as the
buffer, instead of creating some buffer adapter like nsTArrayU8Buffer,
TestBuffer, or FormatBuffer.

Differential Revision: https://phabricator.services.mozilla.com/D128240
2021-10-14 06:54:26 +00:00
criss cccc71399f Backed out changeset 517b566a350a (bug 1735341) for causing build bustages on Locale.cpp. CLOSED TREE 2021-10-13 23:48:18 +03:00
Yoshi Cheng-Hao Huang 1abdd0a388 Bug 1735341 : Rename FillVectorWithICUCall to FillBufferWithICUCall. r=platform-i18n-reviewers,anba,dminor
So with this patch FillVectorWithICUCall could become an overload of FillBufferWithICUCall,
with the buffer type is mozilla::Vector.

The callers of mozilla::intl could provide a mozilla::Vector as the
buffer, instead of creating some buffer adapter like nsTArrayU8Buffer,
TestBuffer, or FormatBuffer.

Differential Revision: https://phabricator.services.mozilla.com/D128240
2021-10-13 20:34:39 +00:00
Dan Minor fb0eb1a018 Bug 1719746 - Add gtest for Locale; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D126985
2021-10-13 12:07:02 +00:00
Dan Minor e2c6f7fdff Bug 1719746 - Rework SpiderMonkey specific code in unified Locale; r=platform-i18n-reviewers,gregtatum,anba
Differential Revision: https://phabricator.services.mozilla.com/D126984
2021-10-13 12:07:01 +00:00
Dan Minor bef53f7ede Bug 1719746 - Add Locale to moz.build; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D126983
2021-10-13 12:07:01 +00:00
Dan Minor 3289f9681a Bug 1719746 - Copy LanguageTag to intl/components as Locale; r=platform-i18n-reviewers,gregtatum
This moves the LanguageTag implementation from js/src/builtin/intl to
intl/components and renames them to Locale. The next commit will add
them to the build system.

Differential Revision: https://phabricator.services.mozilla.com/D126982
2021-10-13 12:07:00 +00:00
André Bargull 2c8cb57da2 Bug 1735352 - Part 3: Add wrapper for ICU4C specific library functions. r=platform-i18n-reviewers,gregtatum
Adds abstractions for `u_init()`, `u_cleanup()`, and `u_setMemoryFunctions()`,
and additionally a method to retrieve `U_ICU_VERSION`.

Because these methods are unlikely to replaceable with ICU4X, the class was
named "ICU4CLibrary" to make clear that the functionality is specific to ICU4C.

Differential Revision: https://phabricator.services.mozilla.com/D128228
2021-10-12 17:09:04 +00:00
André Bargull e5bef00d2b Bug 1735352 - Part 2: Add String::GetUnicodeVersion(). r=platform-i18n-reviewers,gregtatum
Adds a method to retrieve `U_UNICODE_VERSION` to `mozilla::intl::String`.

Depends on D128226

Differential Revision: https://phabricator.services.mozilla.com/D128227
2021-10-12 17:09:04 +00:00
André Bargull d65723b692 Bug 1735352 - Part 1: Add TimeZone::GetTZDataVersion(). r=platform-i18n-reviewers,gregtatum
Adds a method for `ucal_getTZDataVersion()` to `mozilla::intl::TimeZone`.

Differential Revision: https://phabricator.services.mozilla.com/D128226
2021-10-12 17:09:03 +00:00
Yoshi Cheng-Hao Huang a19f20891a Bug 1734108 - Fix typo in LocaleCanonicalizer. r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D127530
2021-10-05 12:42:15 +00:00
Yoshi Cheng-Hao Huang 7d3aeae349 Bug 1734106 - include FloatPoint.h in NumberFormatFields. r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D127529
2021-10-05 12:42:15 +00:00