Commit Graph

5496 Commits

Author SHA1 Message Date
Ting-Yu Lin
653f4b3694 Bug 1745113 Part 5 - Make grapheme cluster break iterators implement SegmentIteratorUtf16, and adapt the callers. r=necko-reviewers,jfkthame,kershaw
This is the main patch for the bug. It aims to change the grapheme cluster
break's `Next()` API by implementing SegmentIteratorUtf16 interface, and adapt
the callers. It shouldn't change the behavior.

While rewriting the caller, one caveat worth mentioning is the loop termination
condition. If the old code relies on `!AtEnd()` as the loop termination
condition, and it advances the iterator at the end of the loop, it meant
to *skip* its logic when the break position is at the end of the string. For
example, see the `mozTXTToHTMLConv::NumberOfMatches`.

This patch also hooks grapheme cluster break iterator into
Segmenter::TryCreate() interface.

Existing test coverage for the file changed:
- netwerk/test/unit/test_mozTXTToHTMLConv.js
- layout/reftests/forms/input/file/dynamic-max-width.html

Differential Revision: https://phabricator.services.mozilla.com/D135643
2022-01-13 18:36:04 +00:00
Ting-Yu Lin
e418a257b5 Bug 1745113 Part 3 - Change CountGraphemeClusters() to take a Span parameter. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D135641
2022-01-13 18:36:04 +00:00
Ting-Yu Lin
948b11a2dc Bug 1745113 Part 2 - Move ClusterReverseIterator into Segmenter.h, and rename it. r=necko-reviewers,kershaw
Include "nsLayoutUtils.h" in nsFileControlFrame to get rid of warnings in my
editor because it uses utilities such as `nsLayoutUtils::AppUnitWidthOfString`.
We compile it without issues because of unified build.

Differential Revision: https://phabricator.services.mozilla.com/D135640
2022-01-13 18:36:03 +00:00
Ting-Yu Lin
e522533f4e Bug 1745113 Part 1 - Move ClusterIterator into Segmenter.h, and rename it. r=necko-reviewers,kershaw
This patch doesn't change the behavior. Just move the code around.

Differential Revision: https://phabricator.services.mozilla.com/D135639
2022-01-13 18:36:03 +00:00
Nika Layzell
e8f83d2043 Bug 1748718 - Part 3: Remove now-unnecessary xpidl constant casts, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D135166
2022-01-07 20:35:15 +00:00
Erik Nordin
20f8e5c93a Bug 1743657 - Link to DOM L10n Tutorial in Firefox Source Docs r=kpatenio?
Differential Revision: https://phabricator.services.mozilla.com/D134998
2022-01-04 21:51:38 +00:00
Masatoshi Kimura
a41588c2f6 Bug 1680139 - Add the ability for unEscapeURIForUI to disable re-escaping IDN blocklisted characters. r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D134401
2021-12-23 03:34:13 +00:00
Erik Nordin
d9a63c9302 Bug 1743659 - Part 2: Update Gecko's Localization to use the new l10nregistry-rs API r=zbraniecki,dminor,eemeli,smaug,emilio?,eemeli?,zbraniecki
- Updates Gecko's Fluent class to use the new ResourceId type,
  which can be either optional or required regarding a particular resource.
- Adds JS tests verifying the new behavior.

Differential Revision: https://phabricator.services.mozilla.com/D133579
2021-12-22 19:08:38 +00:00
Erik Nordin
5a5e1c57ed Bug 1743659 - Part 1: Update Gecko's L10nRegistry to use the new l10nregistry-rs API r=zbraniecki,dminor,eemeli,fluent-reviewers,webidl,smaug?,eemeli?,zbraniecki
- Updates Gecko's L10nRegistry class to use the new ResourceId type,
  which can be either optional or required regarding a particular resource.
- Adds JS tests verifying the new behavior.

Differential Revision: https://phabricator.services.mozilla.com/D133578
2021-12-22 19:08:38 +00:00
Yoshi Cheng-Hao Huang
04e160dc7d Bug 1746837 - Part 1: Include "mozilla/intl/MeasureUnitGenerated.h" in Spidermonkey. r=platform-i18n-reviewers,tcampbell,dminor
Differential Revision: https://phabricator.services.mozilla.com/D134303
2021-12-21 08:43:10 +00:00
Zibi Braniecki
7ec3a677e7 Bug 1746124 - Use nsIRunnablePriority::PRIORITY_RENDER_BLOCKING for Fluent async API calls. r=nordzilla,nika
Differential Revision: https://phabricator.services.mozilla.com/D133845
2021-12-15 20:30:34 +00:00
Eemeli Aro
51b1f5c4fd Bug 1596726 - Update documentation for legacy migration tools. r=flod
Differential Revision: https://phabricator.services.mozilla.com/D133640
2021-12-14 10:10:18 +00:00
Nika Layzell
7b2e6d4996 Bug 1741665 - Align nsCString's public size_type better with other C++ APIs, r=mccr8,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D131422
2021-12-13 21:47:56 +00:00
Greg Tatum
a35948080a Bug 1745564 - Change the location of the calendar Span in DisplayNames; r=dminor
Differential Revision: https://phabricator.services.mozilla.com/D133656
2021-12-13 21:43:15 +00:00
Jonathan Kew
f80018a6b5 Bug 1240277 - Add hyphenation patterns for Indic languages. r=platform-i18n-reviewers,dminor
Using hyphenation patterns from https://github.com/santhoshtr/hyphenation.

The tests here are implemented as Mozilla reftests rather than added to WPT because I don't think
we can reasonably have such tests in WPT. The specific set of languages for which the UA supports
auto-hyphenation is not a normative requirement, and nor is the particular dictionary or algorithm
that will be used for any specific language. As such, the exact results are not defined by the
spec. (They may also change over time, if the hyphenation rules we use are updated, in which case
the tests will have to change accordingly.)

Differential Revision: https://phabricator.services.mozilla.com/D133558
2021-12-13 14:20:06 +00:00
Greg Tatum
463b6931f2 Bug 1719751 - Clean up final ICU details in CommonFunctions; r=anba,platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D131019
2021-12-09 15:52:43 +00:00
Greg Tatum
104d5e6ccd Bug 1719735 - Create a unified DisplayNames API; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D130799
2021-12-09 15:52:42 +00:00
Dan Minor
0917d1c699 Bug 1734932 - Use NumberParser for ParseNumber; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D133125
2021-12-09 15:26:20 +00:00
Dan Minor
8e4b11994a Bug 1734932 - Add intl::NumberParser; r=platform-i18n-reviewers,gregtatum
Awkwardly, this relies upon a different ICU4C NumberFormat API than
the existing intl::NumberFormat implementation, so it seems best to
have this live in a separate class.

Differential Revision: https://phabricator.services.mozilla.com/D133124
2021-12-09 15:26:20 +00:00
Dan Minor
179adccae9 Bug 1734932 - Use intl::NumberFormat for LocalizeNumber; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D133123
2021-12-09 15:26:20 +00:00
Dan Minor
ca115b92ef Bug 1734932 - Remove unused BCP47CodeToLocale implementation; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D133122
2021-12-09 15:26:19 +00:00
Henri Sivonen
649a5b63d8 Bug 1701828 - meta charset rewrite. r=smaug
Implements https://github.com/whatwg/html/issues/6962 . Improves performance
when <meta charset> occurs in head but after the first kilobyte and aligns
behavior better with WebKit and Blink.

The main change is to avoid reloads when meta appears within head but
after the first kilobyte. Prior to this change, Gecko reloaded in that
case (in compliance with the spec!) even though WebKit and Blink did not.

Differences from WebKit and Blink:

* WebKit and Blink honor <meta charset> in <noscript>. This implementation
  does not.
* WebKit and Blink look for meta as if the tree builder was unaware of
  foreign content. This implementation is foreign content-aware. This
  makes a difference for CDATA sections that contain a > before the meta
  as well as style and script elements within foreign content. This could
  happen if the CDATA section that has mysteriously been introduced around
  a what looks like a meta tag also contains another prior tag-looking
  run of text.
* This implementation processes rel=preload and speculative loads that are
  seen before <meta charset> has been seen. WebKit and Blink instead first
  look for the meta and rewind before starting speculative parsing.
* Unlike WebKit, if there is neither an honored meta nor syntax resembling
  an XML declaration, detection from content takes place (as in Blink).
* Unlike Blink, if there is neither an honored meta nor syntax resembling
  an XML declaration, the detection from content is not dependent of network
  buffer boundaries.
* Unlike Blink, detection from content can trigger a reload at the end of
  the stream if the guess made at that point differs from the first guess.
  (See below for the definition of the input to the first guess.)

Differences from the old spec and Gecko previously:

* Meta inside script and RCDATA elements is no longer honored.
* Late meta is now ignored and no longer triggers a reload.
* Later meta counts as early enough meta: In addition to the previous
  meta within the first 1024 bytes, now a meta that started within the first
  1024 bytes counts as early enough. Additionally, if by then there hasn't
  been a template start tag and head hasn't ended, meta occurring before the
  earlier of the end of the head or a template start tag counts as early
  enough.
* Meta now counts as not-late even if the encoding label has numeric
  character reference escapes.
* Syntax resembling an XML declaration longer than a kilobyte is honored if
  there is no honored meta.
* If there is neither an honored meta nor syntax resembling an XML declaration,
  the initial chardetng scan is potentially longer than before: the first 1024
  bytes, the token spanning the 1024-byte boundary if there is such a token,
  and, if by then head hasn't ended and there hasn't been a template start tag
  until the end of the template start tag or the end of the token that causes
  head to end, ever comes first. However, if the token implying the end of the
  head is a text token, bytes only to the end of the previous non-text token is
  considered. (This definition avoids depending on network buffer boundaries.)
* XML View Source now uses the code for syntax resembling an XML declaration
  instead of expat for extracting the internal encoding label.

Reftest are added as both WPT and Gecko reftests in order to test both http:
and file: URL scenarios. The Gecko tests retain the WPT <link> tags in order
to use the exact same bytes.

An encoding declaration has been added to a number of old tests that didn't
intend to test the new speculation behavior especially in the context of
https://bugzilla.mozilla.org/show_bug.cgi?id=1727750 .

Differential Revision: https://phabricator.services.mozilla.com/D125808
2021-12-08 11:34:20 +00:00
Yoshi Cheng-Hao Huang
786de2c41a Bug 1719543 - Part 1: Add Bidi::GetBaseDirection. r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D133066
2021-12-08 11:10:35 +00:00
Yoshi Cheng-Hao Huang
686f8bd23e Bug 1719548 - Part 2: Unify nsIDNService with IDNA. r=necko-reviewers,platform-i18n-reviewers,dragana,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D132572
2021-12-08 11:07:41 +00:00
Yoshi Cheng-Hao Huang
d364302084 Bug 1719548 - Part 1: Add a mozilla::intl::IDNA class. r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D132571
2021-12-08 11:07:41 +00:00
Nika Layzell
3e323b7d7a Bug 1739727 - Part 2: Improve rust async support in moz_task, r=emilio
This patch contains changes to moz_task to improve it's support for
async execution on multiple threads. Unlike the previous executor
implementation, this new implementation reduces the amount of unsafe
code substantially by depending on the async-task crate
(https://crates.io/crates/async-task) for the core task implementation.
This adds a few additional features:

 * Both local (no Send bound) and non-local (with Send bound) execution support,
 * Support for spawning on arbitrary nsIEventTargets or the background task pool,
 * Returned Task objects from runnables which may be .await-ed on or detach()-ed,
 * Support for spawning with the NS_DISPATCH_EVENT_MAY_BLOCK flag set,
 * Automatic use of NS_DISPATCH_AT_END when required,
 * Support for specifying the runnable priority for runnables.

There are also some correctness improvements, and exposed a better API
for dispatching normal runnable functions to background threads.

After these changes the TaskRunnable API should no longer be necessary.
It is re-implemented on top of the executor and kept in-place to avoid
rewriting all consumers.

Differential Revision: https://phabricator.services.mozilla.com/D130705
2021-12-07 20:01:41 +00:00
Norisz Fay
1d6984bc21 Backed out changeset 3dfd3c94a105 (bug 1701828) for causing mochitest failures on browser_hsts_host.js CLOSED TREE 2021-12-07 12:05:44 +02:00
Henri Sivonen
58476d7f17 Bug 1701828 - meta charset rewrite. r=smaug
Implements https://github.com/whatwg/html/issues/6962 . Improves performance
when <meta charset> occurs in head but after the first kilobyte and aligns
behavior better with WebKit and Blink.

The main change is to avoid reloads when meta appears within head but
after the first kilobyte. Prior to this change, Gecko reloaded in that
case (in compliance with the spec!) even though WebKit and Blink did not.

Differences from WebKit and Blink:

* WebKit and Blink honor <meta charset> in <noscript>. This implementation
  does not.
* WebKit and Blink look for meta as if the tree builder was unaware of
  foreign content. This implementation is foreign content-aware. This
  makes a difference for CDATA sections that contain a > before the meta
  as well as style and script elements within foreign content. This could
  happen if the CDATA section that has mysteriously been introduced around
  a what looks like a meta tag also contains another prior tag-looking
  run of text.
* This implementation processes rel=preload and speculative loads that are
  seen before <meta charset> has been seen. WebKit and Blink instead first
  look for the meta and rewind before starting speculative parsing.
* Unlike WebKit, if there is neither an honored meta nor syntax resembling
  an XML declaration, detection from content takes place (as in Blink).
* Unlike Blink, if there is neither an honored meta nor syntax resembling
  an XML declaration, the detection from content is not dependent of network
  buffer boundaries.
* Unlike Blink, detection from content can trigger a reload at the end of
  the stream if the guess made at that point differs from the first guess.
  (See below for the definition of the input to the first guess.)

Differences from the old spec and Gecko previously:

* Meta inside script and RCDATA elements is no longer honored.
* Late meta is now ignored and no longer triggers a reload.
* Later meta counts as early enough meta: In addition to the previous
  meta within the first 1024 bytes, now a meta that started within the first
  1024 bytes counts as early enough. Additionally, if by then there hasn't
  been a template start tag and head hasn't ended, meta occurring before the
  earlier of the end of the head or a template start tag counts as early
  enough.
* Meta now counts as not-late even if the encoding label has numeric
  character reference escapes.
* Syntax resembling an XML declaration longer than a kilobyte is honored if
  there is no honored meta.
* If there is neither an honored meta nor syntax resembling an XML declaration,
  the initial chardetng scan is potentially longer than before: the first 1024
  bytes, the token spanning the 1024-byte boundary if there is such a token,
  and, if by then head hasn't ended and there hasn't been a template start tag
  until the end of the template start tag or the end of the token that causes
  head to end, ever comes first. However, if the token implying the end of the
  head is a text token, bytes only to the end of the previous non-text token is
  considered. (This definition avoids depending on network buffer boundaries.)
* XML View Source now uses the code for syntax resembling an XML declaration
  instead of expat for extracting the internal encoding label.

Reftest are added as both WPT and Gecko reftests in order to test both http:
and file: URL scenarios. The Gecko tests retain the WPT <link> tags in order
to use the exact same bytes.

An encoding declaration has been added to a number of old tests that didn't
intend to test the new speculation behavior especially in the context of
https://bugzilla.mozilla.org/show_bug.cgi?id=1727750 .

Differential Revision: https://phabricator.services.mozilla.com/D125808
2021-12-07 07:35:32 +00:00
Dan Minor
522eefbe31 Bug 1719554 - Unify unicode::Script as intl::Script; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D132278
2021-12-06 18:15:50 +00:00
Dan Minor
d7fc551211 Bug 1719554 - Unify nsCharType as intl::BidiClass; r=platform-i18n-reviewers,jfkthame,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D132275
2021-12-06 18:15:49 +00:00
Dan Minor
e12c3387e8 Bug 1719554 - Unify most of nsUnicodeProperties.h; r=platform-i18n-reviewers,jfkthame,gregtatum,necko-reviewers,valentin
This unifies most of the calls in nsUnicodeProperties.h. CharType and Script
will be handled in subsequent patches on this bug.

Differential Revision: https://phabricator.services.mozilla.com/D132273
2021-12-06 18:15:49 +00:00
Butkovits Atila
56c46d06a1 Backed out 3 changesets (bug 1719554) for causing bustages complaining about gfxTextRun.cpp.
Backed out changeset 6181e40d4da1 (bug 1719554)
Backed out changeset c261ede6ae81 (bug 1719554)
Backed out changeset 221ec418475c (bug 1719554)
2021-12-04 00:58:15 +02:00
Dan Minor
30ad309163 Bug 1719554 - Unify unicode::Script as intl::Script; r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D132278
2021-12-03 20:49:32 +00:00
Dan Minor
8d9076933e Bug 1719554 - Unify nsCharType as intl::BidiClass; r=platform-i18n-reviewers,jfkthame,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D132275
2021-12-03 20:49:31 +00:00
Dan Minor
c0ebed22d3 Bug 1719554 - Unify most of nsUnicodeProperties.h; r=platform-i18n-reviewers,jfkthame,gregtatum,necko-reviewers,valentin
This unifies most of the calls in nsUnicodeProperties.h. CharType and Script
will be handled in subsequent patches on this bug.

Differential Revision: https://phabricator.services.mozilla.com/D132273
2021-12-03 20:49:31 +00:00
Greg Tatum
3839eb0a11 Bug 1715892 - Add thread safety notice and asserts for AppDateTimeFormat; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D131672
2021-12-01 17:41:38 +00:00
Greg Tatum
d642b72ac3 Bug 1715892 - Unify locale/DateTimeFormat to mozilla::intl::AppDateTimeFormat; r=platform-i18n-reviewers,dminor
I considered removing this class initially, but it's actually a pretty
useful abstraction over the DateTimeFormat interface when used
specifically with Gecko. It applies the OS preferences and provides some
caching behavior.

Differential Revision: https://phabricator.services.mozilla.com/D131671
2021-12-01 17:41:37 +00:00
Greg Tatum
7562365f64 Bug 1715892 - Naively rename intl/locale/DateTimeFormat to AppDateTimeFormat; r=platform-i18n-reviewers,dminor
This will not build, but will provide a better diff for the changes.

Differential Revision: https://phabricator.services.mozilla.com/D131670
2021-12-01 17:41:37 +00:00
Greg Tatum
af49045026 Bug 1715892 - Add a buffer adapter for nsTString; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D131668
2021-12-01 17:41:36 +00:00
Greg Tatum
2ca88d17d8 Bug 1719735 - Add a UTF-16 span overload for FillBuffer; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D130798
2021-12-01 17:41:36 +00:00
Greg Tatum
8a56f3b16b Bug 1719735 - Have IcuLocale take a null-terminated Span; r=platform-i18n-reviewers,dminor
This simplifies the call sites that take Span locale, and ensures null
termination.

Differential Revision: https://phabricator.services.mozilla.com/D131534
2021-12-01 17:41:36 +00:00
Chris Peterson
f6fdbf028a Bug 1738401 - Remove -Wno-shadow warning suppressions. r=firefox-build-system-reviewers,glandium
-Wshadow warnings are not enabled globally, so these -Wno-shadow suppressions have no effect. I had intended to enable -Wshadow globally along with these suppressions in some directories (in bug 1272513), but that was blocked by other issues.

There are too many -Wshadow warnings (now over 2000) to realistically fix them all. We should remove all these unnecessary -Wno-shadow flags cluttering many moz.build files.

Differential Revision: https://phabricator.services.mozilla.com/D132289
2021-12-01 06:40:04 +00:00
Marian-Vasile Laza
3bfa529b3e Backed out 6 changesets (bug 1715892, bug 1719735) for causing bc test failures. CLOSED TREE
Backed out changeset 196952bd8c9c (bug 1715892)
Backed out changeset 9105fe01c025 (bug 1715892)
Backed out changeset 4c15d1a24ccd (bug 1715892)
Backed out changeset 2c328b84285f (bug 1715892)
Backed out changeset 8fcdcdf44b62 (bug 1719735)
Backed out changeset c48f398e301f (bug 1719735)
2021-11-30 23:30:59 +02:00
Greg Tatum
ca46c4a669 Bug 1715892 - Add thread safety notice and asserts for AppDateTimeFormat; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D131672
2021-11-30 19:05:58 +00:00
Greg Tatum
9b5497020e Bug 1715892 - Unify locale/DateTimeFormat to mozilla::intl::AppDateTimeFormat; r=platform-i18n-reviewers,dminor
I considered removing this class initially, but it's actually a pretty
useful abstraction over the DateTimeFormat interface when used
specifically with Gecko. It applies the OS preferences and provides some
caching behavior.

Differential Revision: https://phabricator.services.mozilla.com/D131671
2021-11-30 19:05:58 +00:00
Greg Tatum
8589e5b393 Bug 1715892 - Naively rename intl/locale/DateTimeFormat to AppDateTimeFormat; r=platform-i18n-reviewers,dminor
This will not build, but will provide a better diff for the changes.

Differential Revision: https://phabricator.services.mozilla.com/D131670
2021-11-30 19:05:58 +00:00
Greg Tatum
775f78734d Bug 1715892 - Add a buffer adapter for nsTString; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D131668
2021-11-30 19:05:57 +00:00
Greg Tatum
5bff5f16b2 Bug 1719735 - Add a UTF-16 span overload for FillBuffer; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D130798
2021-11-30 19:05:57 +00:00
Greg Tatum
072e80dc1d Bug 1719735 - Have IcuLocale take a null-terminated Span; r=platform-i18n-reviewers,dminor
This simplifies the call sites that take Span locale, and ensures null
termination.

Differential Revision: https://phabricator.services.mozilla.com/D131534
2021-11-30 19:05:56 +00:00
Greg Tatum
e61871c813 Bug 1719553 - Use unified Intl API in OSPreferences_gtk.cpp; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D132038
2021-11-29 20:43:07 +00:00