Closed Bug 2083906 Opened 1 month ago Closed 18 days ago

[wpt-sync] Sync PR 63870 - Skip HTML interchange and style markup inside foreign content on copy

Categories

(Core :: DOM: Editor, task, P4)

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

Attachments

(1 file)

Sync web-platform-tests PR 63870 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/63870
Details from upstream follow.

Kent Tamura <tkent@chromium.org> wrote:

Skip HTML interchange and style markup inside foreign content on copy

Prevent StyledMarkupSerializer and StyledMarkupAccumulator from emitting
HTML interchange markup (\<span> \</span> and
\<br class="Apple-interchange-newline">) or inline style wrappers
(\<span style="...">) inside foreign content such as \<math> and \<svg>.

When the HTML parser parses a serialized \<math> or \<svg> fragment,
encountering \<span> or \<br> inside a non-integration-point foreign
element triggers a foreign-content breakout that pops \<math> or \<svg>
off the open element stack and parses subsequent siblings in the HTML
namespace.

Specifically:

  • Add IsInForeignContentForSerialization() to detect when a node or any
    of its DOM or flat-tree ancestors is a non-HTML element or has a
    "math" or "svg" tag name.
  • Skip inline style \<span> wrapping and
    ConvertHtmlTextToInterchangeFormat() in
    StyledMarkupAccumulator::AppendTextWithInlineStyle() and
    StyledMarkupTraverser::ShouldApplyWrappingStyle() when inside foreign
    content.
  • Avoid emitting leading or trailing interchange newlines inside foreign
    content in StyledMarkupSerializer::CreateMarkup(), and advance
    first_node to the highest \<math> ancestor when a leading interchange
    newline precedes a \<math> subtree.
  • Do not abort the ancestor wrapping loop in CreateMarkup() when
    traversing block or table ancestors (such as \<mtd> or \<mtr>) inside a
    \<math> ancestor that must be serialized.

Guard the behavior behind the SkipHtmlInterchangeInForeignContent
runtime enabled feature.

Bug: 573244957
Change-Id: Icd9a20e2b79839c29f5930a107838c57322e8214
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8609866
Reviewed-by: Koji Ishii \<kojii@chromium.org>
Auto-Submit: Kent Tamura \<tkent@chromium.org>
Commit-Queue: Koji Ishii \<kojii@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1721647}

Component: web-platform-tests → DOM: Editor
Product: Testing → Core
Attached file Notable wpt changes —

CI Results

Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 510 tests and 4 subtests

Status Summary

Firefox

OK : 1[GitHub] 504[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-linux2404-64-debug, Gecko-windows11-32-25h2-debug, Gecko-windows11-64-25h2-debug] 509[Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-opt]
PASS : 14610[Gecko-windows11-64-25h2-debug] 14612[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-linux2404-64-debug, Gecko-windows11-32-25h2-debug] 14650[Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-windows11-32-25h2-opt] 14652[Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-opt]
FAIL : 4[GitHub] 1672[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-linux2404-64-debug, Gecko-windows11-32-25h2-debug] 1674[Gecko-windows11-64-25h2-debug] 1687[Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-opt] 1689[Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-windows11-32-25h2-opt]
ERROR: 1

Chrome

OK : 1
PASS : 1
FAIL : 3

Safari

OK : 1
FAIL : 4

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

(See attachment for full changes)

Status: NEW → RESOLVED
Closed: 18 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: