We'll ship this new behavior in all channels starting with 139.
According to the reported bugs, this will fix a lot of web-compat issues
on Office 365.
Note that once this is shipped in the release channel, I'll delete the
legacy normalizer soon because it wastes the binary size and makes the
code harder to read.
On 3/18/2025 5:43 PM, Masayuki Nakano wrote:
Summary: |HTMLEditor| normalizes collapsible white-spaces which user
typed to make all of them visible, i.e., as not collapsed.
Currently, our builtin editor keeps traditional behavior since it's
initially implemented. That is, allow to puts an ASCII white-space at
last of the white-space sequence and convert its previous one as an
NBSP. If it's the last white-space immediately before a block
boundary, |HTMLEditor| puts a |<br>| element to make it visible (this
rendering result is also incompatible with the other browsers
<https://bugzilla.mozilla.org/show_bug.cgi?id=1951041>).
On the other hand, the other browsers puts an NBSP to the last
white-space of a white-space sequence and always normalizes the
white-space sequence with pairs of an NBSP and an ASCII white-space
(the order is opposite between Chrome and Safari, though). This
behavior is more stable and simpler than ours because web apps may
delete following things of typed white-space without maintaining that
it stays visible (This actually happens in Gmail
<https://bugzilla.mozilla.org/show_bug.cgi?id=1938110>).
Therefore, we should follow their behavior, and I think it's
reasonable to make us behave as Chrome and actually I implemented the
new normalizer which is almost compatible with Chrome. (Unfortunately,
in some edge cases, we get different result whether normalize or does
not do that for surrounding white-spaces at editing range.)
In the following bug, I'll enable the new behavior for the nightly
builds and early beta builds. Then, I'll enable them in all builds
after watching regressions reports in a couple of releases.
(The legacy paths will be deleted once it's shipped in all channels
soon. <https://bugzilla.mozilla.org/show_bug.cgi?id=1951038>)
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1951832
Specification: N/A
Platform coverage: All
Preference: |editor.white_space_normalization.blink_compatible|
web-platform-tests:
https://wpt.fyi/results/editing/whitespaces/chrome-compat?label=master&label=experimental&aligned
<https://wpt.fyi/results/editing/whitespaces/chrome-compat?label=master&label=experimental&aligned>
NOTE: For web developers, I strongly recommend you to use
`|white-space: pre-wrap|` or something to prevent the white-space
normalization since users cannot get same result as they typed if they
typed NBSPs because NBSPs are treated as ASCII white-spaces if
white-spaces are collapsible (e.g., when `|white-space: normal|`,
`|white-space: pre-line|` and `|white-space: nowrap|`).
--
Masayuki Nakano<masay...@d-toybox.com>
Working on DOM, Events, editor and IME handling for Gecko
--
You received this message because you are subscribed to the Google
Groups "dev-platform@mozilla.org" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to dev-platform+unsubscr...@mozilla.org.
To view this discussion visit
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/1a99cde7-2ada-4dc2-ae66-5a4568a20929%40d-toybox.com
<https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/1a99cde7-2ada-4dc2-ae66-5a4568a20929%40d-toybox.com?utm_medium=email&utm_source=footer>.
--
Masayuki Nakano<masay...@d-toybox.com>
Working on DOM, Events, editor and IME handling for Gecko
--
You received this message because you are subscribed to the Google Groups
"dev-platform@mozilla.org" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to dev-platform+unsubscr...@mozilla.org.
To view this discussion visit
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/c38adf30-9494-4a1c-8964-4e824ffd7e39%40d-toybox.com.