Closed Bug 2056651 Opened 4 months ago Closed

[wpt-sync] Sync PR 61447 - [gap-decorations]: Preserve flex rule pattern across fragmentation

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
155 Branch
Tracking Status
firefox155 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Javier Contreras <javiercon@microsoft.com> wrote:

[gap-decorations]: Preserve flex rule pattern across fragmentation

This CL is a continuation of crrev.com/c/7899276, which landed the
scaffolding and grid implementation for preserving rule patterns across
fragmentation. This CL does the implementation for flex.

The convention for rule pattern continuity is that, for each fragment we
need:

  • the total count of row gaps across all fragments
  • the first unprocessed row gap

This allows us a gap's stitched (unfragmented) index to access the
correct rule from the iterator.

The flex case is a bit tricky, as row flexboxes and column flexboxes
fragment row gaps quite differently. The interesting case comes up with
column flex, where the row gaps exist between items within a line,
hence, there isn't a trivial way to determine the first unprocessed row
gap without storing the number of gaps per line.

This births the FlexRowGapInfo struct that stores a row gap's start
index and the row gap count (including suppressed ones). The flex break
token carries a list of these, which is then consumed at paint for rule
pattern preservation across fragments.

For row flex, we store just one element, since only one row gap can get
fragmented. For column flex, we store one element per line, since we
need to continue the pattern across each item in a line, and any line
may or may not have a suprressed gap.

On the paint side, we move the mutable main_gap_running_index_ state
that wrongly lived in GapGeometry up to the paint code (a longstanding
todo) and use it to compute the cross gap ends and to obtain the
stitched index of cross gaps for column flex.

Finally, since the last fragment has no break token data, we derive its
row gap info using the previous break token and gap geometry info. This
is possible because the last fragment can't have any suppressed gap.

This CL makes an additional change to Pre initialize main gaps in a
fragmented column flex. This is because a test that was added recently
started failing in this CL, and this CL then makes this small change to
ensure that the test no longer fails.

We need this initialization because we want to make sure that flex lines
that don't span all fragments (they get finished in an earlier fragment)
still have corresponding gaps/gap decorations in all fragments, which is
what we need.

Bug: 505387221
Change-Id: If3b2a04ff48a8bb9093c59f1f1fedd9b4fec59e6

Reviewed-on: https://chromium-review.googlesource.com/7898244
WPT-Export-Revision: 430c3cbeb8c11110e52aad757f82e5d7abd6c234

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core

CI Results

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

Total 31 tests

Status Summary

Firefox

PASS: 2
FAIL: 6[GitHub] 29[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]

Chrome

FAIL: 6

Safari

FAIL: 6

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Status: NEW → RESOLVED
Closed: 4 months ago
Closed: 2026-07-23 16:19:50 2026-07-23 16:19:50
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch
You need to log in before you can comment on or make changes to this bug.