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

69 Коммитов

Автор SHA1 Сообщение Дата
Makoto Kato 67fd68d1c6 Bug 1719535 - Part 9. Trim ASCII space at the tail for content serializer. r=TYLin
XML/Plain text Serializer uses line break segmenter to wrap text. New
segmenter that is compatible with UAX#14 has different rules for old segmenter.

Old segmenter have break opportunity before ASCII space, but UAX#14 doesn't
have it (https://www.unicode.org/reports/tr14/#LB7).

So we have to trim ASCII space at the tail for text wrap.

Depends on D167677

Differential Revision: https://phabricator.services.mozilla.com/D180773
2023-08-07 06:23:59 +00:00
Sandor Molnar 13c7e4a350 Backed out 14 changesets (bug 1719535) for causing mochitest failures in accessible/tests/browser/mac/browser_text_basics.js CLOSED TREE
Backed out changeset 338c2c8d91af (bug 1719535)
Backed out changeset 3fdb2e999aba (bug 1719535)
Backed out changeset 63b9d2064827 (bug 1719535)
Backed out changeset 09c216cdbbc8 (bug 1719535)
Backed out changeset 29977dc00fb3 (bug 1719535)
Backed out changeset d3f8850a343b (bug 1719535)
Backed out changeset 90f1f621031f (bug 1719535)
Backed out changeset 52ca9bdc5bd4 (bug 1719535)
Backed out changeset 94536f0d5a1f (bug 1719535)
Backed out changeset d615264f9f5f (bug 1719535)
Backed out changeset f16f9e583378 (bug 1719535)
Backed out changeset e1abdee07587 (bug 1719535)
Backed out changeset 45f9ad406428 (bug 1719535)
Backed out changeset caa2b8a731dc (bug 1719535)
2023-08-02 14:55:26 +03:00
Makoto Kato c6a86744bb Bug 1719535 - Part 9. Trim ASCII space at the tail for content serializer. r=TYLin
XML/Plain text Serializer uses line break segmenter to wrap text. New
segmenter that is compatible with UAX#14 has different rules for old segmenter.

Old segmenter have break opportunity before ASCII space, but UAX#14 doesn't
have it (https://www.unicode.org/reports/tr14/#LB7).

So we have to trim ASCII space at the tail for text wrap.

Depends on D167677

Differential Revision: https://phabricator.services.mozilla.com/D180773
2023-08-02 10:32:56 +00:00
Emilio Cobos Álvarez 4cc6758558 Bug 1839922 - Remove usage of {Has,Get}Attr(kNameSpaceID_None, ..). r=edgar
We have more readable and faster versions (that just omit the namespace
arg).

Mostly done via sed, with a couple helpers to use the faster lookups
where possible.

Differential Revision: https://phabricator.services.mozilla.com/D181795
2023-06-23 10:01:32 +00:00
Sean Burke 987ac54be3 Bug 1827267 - prevent encoding head attributes with raw plus body-only. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D175275
2023-04-19 16:13:13 +00:00
Masayuki Nakano 9f3a55f73d Bug 1818128 - Add logging code for Selection API calls r=smaug
It's hard to check Selection API calls from both JS and internals when we debug
web apps which has complicated `contenteditable` editor.  Therefore, I'd like to
add an ability to log Selection API calls.

This patch needs to stop some methods inlined.  Therefore, this could affect to
the performance in release builds, though.  If so, I need to work on some
optimization later.

For minimizing the impact for performance, this patch also makes them to check
the logging level before calling logging methods.  It's currently redundant
for `LogLevel::Info` case.  However, this avoids any performance impact from
changes of `MOZ_LOG` implementation and in the blocks.

Differential Revision: https://phabricator.services.mozilla.com/D170585
2023-03-05 22:38:05 +00:00
serge-sans-paille f7c02b37e6 Bug 1817314 - Make dom/serializers buildable outside of a unified build environment r=andi
Differential Revision: https://phabricator.services.mozilla.com/D170123
2023-02-19 21:40:36 +00:00
Norisz Fay d85572c196 Backed out 11 changesets (bug 1817309, bug 1817315, bug 1817313, bug 1817317, bug 1817310, bug 1817314, bug 1817308, bug 1817312, bug 1817311, bug 1817316, bug 1817318) for causing build bustages on nss_secutil.h CLOSED TREE
Backed out changeset 288b4848b023 (bug 1817308)
Backed out changeset 6ac5107e1c81 (bug 1817309)
Backed out changeset 6f6e7a258930 (bug 1817310)
Backed out changeset 32cadd62fec3 (bug 1817311)
Backed out changeset 5bfcee2bfb8b (bug 1817312)
Backed out changeset bfd59ae03c4f (bug 1817313)
Backed out changeset 0080bdd6ab3f (bug 1817314)
Backed out changeset e1e81a3a933d (bug 1817315)
Backed out changeset 151d9b5d1883 (bug 1817316)
Backed out changeset 1b03cabc6e5a (bug 1817317)
Backed out changeset 52b44c5d4b08 (bug 1817318)
2023-02-19 18:37:26 +02:00
serge-sans-paille 0cd5d3317e Bug 1817314 - Make dom/serializers buildable outside of a unified build environment r=andi
Differential Revision: https://phabricator.services.mozilla.com/D170123
2023-02-19 15:33:54 +00:00
Csoregi Natalia 41e332d499 Backed out 11 changesets (bug 1817308, bug 1817311, bug 1817317, bug 1817310, bug 1817309, bug 1817314, bug 1817316, bug 1817318, bug 1817313, bug 1817312, bug 1817315) for causing hybrid bustage on WrapperFactory.cpp. CLOSED TREE
Backed out changeset 1fb2fdbeecec (bug 1817308)
Backed out changeset 7153cb681119 (bug 1817309)
Backed out changeset 44e4198e2cdc (bug 1817310)
Backed out changeset ef9b097a07c4 (bug 1817311)
Backed out changeset e6f4e9a4cfc6 (bug 1817312)
Backed out changeset 4fa0b794c1e1 (bug 1817313)
Backed out changeset 13841a7b93a6 (bug 1817314)
Backed out changeset af16df862459 (bug 1817315)
Backed out changeset a157a7c3146f (bug 1817316)
Backed out changeset f9048fa7e1d9 (bug 1817317)
Backed out changeset 10219437a634 (bug 1817318)
2023-02-18 01:58:57 +02:00
serge-sans-paille ad39aea8b2 Bug 1817314 - Make dom/serializers buildable outside of a unified build environment r=andi
Depends on D170122

Differential Revision: https://phabricator.services.mozilla.com/D170123
2023-02-17 22:17:43 +00:00
Neil Deakin 9c2e7458ba Bug 1776879, replace text/unicode for clipboard and drag and drop and use text/plain directly, r=edgar,mak,stransky,geckoview-reviewers,extension-reviewers,zombie,m_kato
Most usage is a straight replacement but gtk needs extra changes as it transfers plain text in UTF8 natively and needs to be converted into UTF16, and Windows uses single-byte characters for RTF and CF_HTML formats so we preserve this.

Differential Revision: https://phabricator.services.mozilla.com/D158587
2023-02-01 23:30:55 +00:00
Ryan VanderMeulen 3bfc7ebe13 Backed out changeset 34c1c9be027d (bug 1769534) for causing bug 1801186. 2023-01-12 08:50:27 -05:00
Henri Sivonen 773bf4bc9a Bug 1687303 - Make nsHTMLContentSerializer handle noscript depending on the scripting enabled state of the document. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D124892
2022-12-20 11:11:41 +00:00
Ben Campbell 9d6eb60049 Bug 1563452 - Don't break attributes when serializing with nsXMLContentSerializer. r=mbrodesser,m_kato
Based on work by JMM <jose@bmo.anonaddy.com>.

Differential Revision: https://phabricator.services.mozilla.com/D143447
2022-11-30 05:16:13 +00:00
Masayuki Nakano 994759243f Bug 1793694 - part 5: Move `EditorUtils::MaskString` to `TextEditor` r=m_kato
It's the only method which is used outside of the editor module.  Therefore,
we can stop exposing `EditorUtils.h` later.

Depends on D158634

Differential Revision: https://phabricator.services.mozilla.com/D158635
2022-10-12 02:44:19 +00:00
Pierre de La Morinerie b3c78f36f0 Bug 1769534 - preserve NBSP when copying HTML content. r=hsivonen
To workaround the historical lack of 'white-space: pre', when an user
wants to compose HTML text with several consecutive spaces, WYSIWYG
HTML editors insert an alternating pattern of SPACE and NBSP to avoid
spaces being collapsed.

This is why browsers, when copying HTML content, usually strip all NBSP
from the copied text.

This commit changes the copying behavior, to strip only NBSP that were
potentially generated by an editor (and preserve the others).

The heuristic used is "An NBSP adjacent to a regular space doesn't make
sense, and can be replaced by a regular space". This detects the
alternating pattern of SPACE/NBSP, but also a space followed by a long
sequence of NBSP (because a line break would occur anyway in that case).

NB: included is a change that makes devtools use regular spaces
(rather than NBSPs) to indent stacktrace frames. This prevent NBSPs from
appearing in the clipboard when copying a stacktrace.

Attribution: the actual nsPlainTextSerializer changes were written by
Rachel Martin <rachel@betterbird.eu>, as a part of Betterbird.

Differential Revision: https://phabricator.services.mozilla.com/D149644
2022-10-10 06:41:41 +00:00
Marian-Vasile Laza e8b90ffd2f Backed out changeset a50d707b3bbc (bug 1769534) for causing debugger frame failures. CLOSED TREE 2022-09-14 17:05:11 +03:00
Pierre de La Morinerie 5211456a86 Bug 1769534 - preserve NBSP when copying HTML content. r=hsivonen
To workaround the historical lack of 'white-space: pre', when an user
wants to compose HTML text with several consecutive spaces, WYSIWYG
HTML editors insert an alternating pattern of SPACE and NBSP to avoid
spaces being collapsed.

This is why browsers, when copying HTML content, usually strip all NBSP
from the copied text.

This commit changes the copying behavior, to strip only NBSP that were
potentially generated by an editor (and preserve the others).

The heuristic used is "An NBSP adjacent to a regular space doesn't make
sense, and can be replaced by a regular space". This detects the
alternating pattern of SPACE/NBSP, but also a space followed by a long
sequence of NBSP (because a line break would occur anyway in that case).

NB: included is a change that makes devtools use regular spaces
(rather than NBSPs) to indent stacktrace frames. This prevent NBSPs from
appearing in the clipboard when copying a stacktrace.

Attribution: the actual nsPlainTextSerializer changes were written by
Rachel Martin <rachel@betterbird.eu>, as a part of Betterbird.

Differential Revision: https://phabricator.services.mozilla.com/D149644
2022-09-14 13:13:51 +00:00
Nika Layzell c15823d075 Bug 1772006 - Part 5: Simplify and move the string searching APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,eeejay,dragana,barret
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.

In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.

These patches do the following major changes to the searching APIs:

1. The ASCII case-insensitive search method was split out as
   LowerCaseFindASCII, rather than using a boolean. This should be less
   error-prone and more explicit, and allows the method to continue to use
   narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
   matching character types. I considered adding a FindASCII method which would
   use narrow string literals for both wide and narrow strings but it would've
   been the same amount of work as changing all of the literals to unicode
   literals.
   This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
   algorithm or stl algorithms to reduce code complexity, and avoid the need to
   carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
   called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
   to booleans normally implicitly coercing to `index_type`. This should
   probably be removed at some point, but may be useful during the transition.

Differential Revision: https://phabricator.services.mozilla.com/D148300
2022-07-30 00:12:48 +00:00
Nika Layzell 997047e2a4 Bug 1772006 - Part 4: Simplify and move the string comparison APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,dragana,barret
This patch moves EqualsIgnoreCase to ns[T]StringObsolete, and removes
the aCount argument, instead migrating callers to use `StringBeginsWith`
with a case-insensitive comparator.

In addition, nsTStringRepr::Compare was removed and replaced with either
calls to methods like `StringBeginsWith` or the global `Compare` method.

These changes required some modifications at call-sites but should make
the behaviour less surprising and more consistent.

Differential Revision: https://phabricator.services.mozilla.com/D148299
2022-07-30 00:12:48 +00:00
criss c6b2c5db61 Backed out 9 changesets (bug 1772006) causing build bustages on nsTString.cpp. CLOSED TREE
Backed out changeset f17c7565707b (bug 1772006)
Backed out changeset c725fe1f5882 (bug 1772006)
Backed out changeset d19663161261 (bug 1772006)
Backed out changeset b6611ab002d9 (bug 1772006)
Backed out changeset 790f42b64af9 (bug 1772006)
Backed out changeset 79a734b4e4d9 (bug 1772006)
Backed out changeset 42730aae16ea (bug 1772006)
Backed out changeset b2542aef3054 (bug 1772006)
Backed out changeset 962bfea4a309 (bug 1772006)
2022-06-11 01:13:42 +03:00
Nika Layzell b3c13bf114 Bug 1772006 - Part 6: Simplify and move the string searching APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,eeejay,dragana,barret
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.

In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.

These patches do the following major changes to the searching APIs:

1. The ASCII case-insensitive search method was split out as
   LowerCaseFindASCII, rather than using a boolean. This should be less
   error-prone and more explicit, and allows the method to continue to use
   narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
   matching character types. I considered adding a FindASCII method which would
   use narrow string literals for both wide and narrow strings but it would've
   been the same amount of work as changing all of the literals to unicode
   literals.
   This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
   algorithm or stl algorithms to reduce code complexity, and avoid the need to
   carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
   called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
   to booleans normally implicitly coercing to `index_type`. This should
   probably be removed at some point, but may be useful during the transition.

Differential Revision: https://phabricator.services.mozilla.com/D148300
2022-06-10 21:12:08 +00:00
Emilio Cobos Álvarez 9c190fff4b Bug 1771564 - Constify ComputedStyle usage in nsComputedDOMStyle. r=dholbert
None of the consumer need to mutate styles, and this saves some ugly
const_casting on the next patch.

Doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D147555
2022-05-28 01:04:24 +00:00
Kagami Sascha Rosylight 28d21e6fce Bug 1768189 - Part 27: Apply modernize-concat-nested-namespaces to dom/security/featurepolicy/FeaturePolicy.h ... r=andi
Depends on D145760

Differential Revision: https://phabricator.services.mozilla.com/D145761
2022-05-09 20:41:13 +00:00
Jonathan Kew 6da0fb652b Bug 1747114 - Test correctly for end-of-span before attempting to decode surrogate pair. r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D134625
2021-12-24 09:29:20 +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
Masayuki Nakano 25adcd81f5 Bug 1741148 - part 6: Make `nsContentUtils::GetInclusiveAncestorsAndOffsets()` return array of `Maybe<uint32_t>` as offsets in DOM nodes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D131339
2021-12-09 13:18:24 +00:00
Masayuki Nakano f2baf0d9ab Bug 1741148 - part 1: Rename `nsINode::ComputeIndexOf` to `ComputeIndexOf_Deprecated` r=smaug
It's hard to fix some callers.  Therefore, in this bug, we should fix only
simple cases.  Therefore, we should rename existing API first.

Differential Revision: https://phabricator.services.mozilla.com/D131334
2021-12-09 08:32:30 +00:00
Masayuki Nakano 82e2013683 Bug 1735446 - part 4: Make `Selection::GetRangeAt()` take `uint32_t` instead of `int32_t` r=smaug
It's an internal API corresponding to `Selection.getRangeAt` DOM API.
I think that it should use `uint32_t` rather than `size_t` because of the
consistency with the DOM API and `Selection::RangeCount()`.

This patch fixes all callers of `GetRangeAt()`, and rewrites it with ranged-
loops unless original ones do not refer `RangeCount()` every time and may run
script in the loop.

Differential Revision: https://phabricator.services.mozilla.com/D128848
2021-12-09 07:35:09 +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 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
Ting-Yu Lin f32eaad379 Bug 1722484 Part 2 - Replace LineBreaker::Next() and WordBreaker::Next() with the new iterators. r=m_kato
With the rewrite, we reduce the dependency of lwbrk LineBreaker::Next(),
WordBreaker::Next(), and their `int32_t` sentinel values
NS_LINEBREAKER_NEED_MORE_TEXT and NS_WORDBREAKER_NEED_MORE_TEXT.

Differential Revision: https://phabricator.services.mozilla.com/D130392
2021-11-09 01:14:15 +00:00
Iulian Moraru 36283a9a3b Backed out 2 changesets (bug 1722484) for causing multiple build bustages. CLOSED TREE
Backed out changeset bef547b588ff (bug 1722484)
Backed out changeset e676fa1a0cb7 (bug 1722484)
2021-11-09 01:42:20 +02:00
Ting-Yu Lin 7310c93473 Bug 1722484 Part 2 - Replace LineBreaker::Next() and WordBreaker::Next() with the new iterators. r=m_kato
With the rewrite, we reduce the dependency of lwbrk LineBreaker::Next(),
WordBreaker::Next(), and their `int32_t` sentinel values
NS_LINEBREAKER_NEED_MORE_TEXT and NS_WORDBREAKER_NEED_MORE_TEXT.

Differential Revision: https://phabricator.services.mozilla.com/D130392
2021-11-08 22:24:19 +00:00
ssummar 0992acc367 Bug 1603127 - Replaced mozilla::Tuple with std::tuple and applied structured bindings in mozilla/Encoding.h. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D129920
2021-11-08 08:14:00 +00:00
Cristian Tuns 71486b8924 Backed out changeset 7e8e3747c3f8 (bug 1603127) for causing toolchains build bustages (Bug 1739589). CLOSED TREE 2021-11-05 07:23:45 -04:00
ssummar 508562cc85 Bug 1603127 - Replaced mozilla::Tuple with std::tuple and applied structured bindings in mozilla/Encoding.h. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D129920
2021-11-05 05:33:58 +00:00
Ting-Yu Lin 427cc27771 Bug 1736938 Part 2 - Make all LineBreaker's methods static, and adapt the callers. r=jfkthame
LineBreaker has no member variables and acts like "namespaces" with
utility functions. Therefore, its methods can be static and called
directly without needing a LineBreaker instance.

Rename GetJISx4051Breaks() to ComputeBreakPositions() per review
feedbacks.

Differential Revision: https://phabricator.services.mozilla.com/D129107
2021-10-25 19:00:22 +00:00
ssummar 51c0ff21e5 Bug 1626517 - Replaced mozilla::Unused with mozilla::Ignore in mozilla::Decoder/mozilla::Encoder calls. r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D129022
2021-10-25 12:31:41 +00:00
Andrew McCreight 8c5d7e5ee8 Bug 1736707, part 1 - Get rid of nsContentUtils::NameSpaceManager(). r=peterv
Call nsNameSpaceManager::GetInstance() instead.

Differential Revision: https://phabricator.services.mozilla.com/D129033
2021-10-22 16:15:57 +00:00
Ting-Yu Lin bf848531df Bug 1733877 - Remove LineBreaker::Prev() in nsXMLContentSerializer. r=jfkthame,m_kato
`dom/base/test/unit/test_xmlserializer.js` exercises this part of the
code.

Differential Revision: https://phabricator.services.mozilla.com/D128557
2021-10-15 18:10:08 +00:00
Ting-Yu Lin 1b1a72c742 Bug 1735251 - Apply clang-format to nsXMLContentSerializer.cpp. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D128152
2021-10-12 17:51:12 +00:00
Masayuki Nakano fc532efa09 Bug 1734771 - part 3: Make `AppendString()` and `AppendSubString()` take `const Text&` instead of `Text*` r=m_kato
Depends on D128139

Differential Revision: https://phabricator.services.mozilla.com/D128140
2021-10-12 15:02:38 +00:00
Ting-Yu Lin 7a46b7baf7 Bug 1734792 Part 2 - Remove NS_LINEBREAKER_NEED_MORE_TEXT from the logic where break only at ascii spaces. r=m_kato
The logic has nothing to do with LineBreaker, and it shouldn't rely on
`NS_LINEBREAKER_NEED_MORE_TEXT == -1`.

Differential Revision: https://phabricator.services.mozilla.com/D128003
2021-10-11 21:23:15 +00:00
Ting-Yu Lin 7d5bad097c Bug 1734792 Part 1 - Fix the logic where we break only at ascii spaces in FindWrapIndexForContent(). r=m_kato
Bug 1733876 Part 3 wrongly changed the behavior because it failed to
consider that goodSpace may equals to -1 in the following forward search
while loop, which coincidentally is NS_LINEBREAKER_NEED_MORE_TEXT.

```
    while (goodSpace >= 0 && !nsCRT::IsAsciiSpace(mContent.CharAt(goodSpace))) {
      goodSpace--;
    }
```

Thus, when `goodSpace == -1`, we need to run the original forward search logic here.
https://searchfox.org/mozilla-central/rev/afe1ba25ee057a6118b5b990f994bdf9eb5ffb43/dom/serializers/nsPlainTextSerializer.cpp#180-185

The gtest is adapted from
https://searchfox.org/comm-central/rev/c77102402f9ddb2742f6782aa5b73362be39d5f5/mailnews/compose/test/unit/test_longLines.js#134-145

Differential Revision: https://phabricator.services.mozilla.com/D128002
2021-10-11 21:23:14 +00:00
Jonathan Kew 16d134b89d Bug 1734590 - Eliminate use of LineBreaker::DeprecatedNext in nsXMLContentSerializer.cpp. r=TYLin
The behavior change of Next() vs DeprecatedNext() here is OK, because if DeprecatedNext()
failed to find a break position then we'd end up reaching the "simple fallback logic"
below, which will just advance to the next space or end-of-text anyhow.

The only case, then, where this results in a change of behavior would be if there's a
space that the line-breaker does *not* consider a valid break, so that instead it
advances to end-of-text, where previously we'd have reached the fallback code and
used the (invalid) space as a break. So (a) this is a really obscure edge-case, and
(b) the new behavior would be more correct anyhow.

Differential Revision: https://phabricator.services.mozilla.com/D127805
2021-10-11 12:20:41 +00:00
Jonathan Kew 5b12c5262b Bug 1310559 - Update GetUnicharStringWidth implementation to handle surrogate pairs. r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D127815
2021-10-08 13:14:45 +00:00
Jonathan Kew a2361076d9 Bug 1310559 - Modernize (and simplify) GetUnicharWidth implementation. r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D127814
2021-10-08 13:14:45 +00:00