Closed Bug 1861379 Opened 2 years ago Closed 1 years ago

[wpt-sync] Sync PR 42778 - Avoid duplicate block-in-inline break tokens.

Categories

(Core :: Layout, task, P4)

task

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox121 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Morten Stenshorne <mstensho@chromium.org> wrote:

Avoid duplicate block-in-inline break tokens.

Regardless of whether the break inside a block-in-inline was to be
resumed in a parallel flow or not, we'd also include it as a break token
in the same flow.

This was usually harmless, since any next line in the same fragmentainer
would typically not be a block-in-inline, since all consecutive blocks
inside inlines are put inside the same block-in-inline wrapper during
box generation.

However, there are ways to end up with adjacent block-in-inline
wrappers: If a block that previously wasn't inflow becomes inflow
(change from float:left to float:none, for instance), a new wrapper is
created around the now-inflow block, even if there's already an adjacent
wrapper there for an adjacent block.

\<span>
\<div id="first" style="float:left;">\</div>
\<div id="second">\</div>
\</span>

This generates a box tree like this:

LayoutInline SPAN
LayoutNGBlockFlow (floating) DIV #first
LayoutNGBlockFlow (anonymous)
LayoutNGBlockFlow DIV #second

If we (after initial layout) change #first to float:none, we end up with
this:

LayoutInline SPAN
LayoutNGBlockFlow (anonymous)
LayoutNGBlockFlow DIV #first
LayoutNGBlockFlow (anonymous)
LayoutNGBlockFlow DIV #second

The fix is to make sure that we only create one break token for a
fragmented block wrapper. Move the code that examines the outgoing
block-in-inline break token a bit further up, to eliminate the need for
LineInfo::BlockInInlineBreakToken(), and to keep things a bit more
tightly together. Add a DCHECK to LineBreaker::HandleBlockInInline(),
which would have failed without this fix.

Bug: 1495515
Change-Id: I6d019b8c2e6c03046e122fecce76e044f3aeabb3
Reviewed-on: https://chromium-review.googlesource.com/4973967
WPT-Export-Revision: 4d006c47809fb0a9f377912b41deb3c77ae66b20

Component: web-platform-tests → Layout
Product: Testing → Core
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]

CI Results

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

Total 2 tests

Status Summary

Firefox

PASS: 1[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 2[Gecko-android-em-7.0-x86_64-lite-qr-opt-geckoview, Gecko-android-em-7.0-x86_64-qr-debug-geckoview, Gecko-android-em-7.0-x86_64-qr-opt-geckoview, Gecko-linux1804-64-qr-debug, Gecko-linux1804-64-qr-opt, Gecko-windows11-32-2009-qr-debug, Gecko-windows11-32-2009-qr-opt, Gecko-windows11-64-2009-qr-debug, Gecko-windows11-64-2009-qr-opt, GitHub]

Safari

PASS: 1
FAIL: 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3af41f1d5d13 [wpt PR 42778] - Avoid duplicate block-in-inline break tokens., a=testonly
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dfd0f0076674 [wpt PR 42778] - Avoid duplicate block-in-inline break tokens., a=testonly
Status: NEW → RESOLVED
Closed: 1 years ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
You need to log in before you can comment on or make changes to this bug.