Closed Bug 2089307 Opened 15 days ago Closed 6 days ago

[wpt-sync] Sync PR 64366 - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=326939

Categories

(Core :: Layout: Grid, task, P4)

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Sammy Gill <sammy.gill@apple.com> wrote:

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=326939

WebKit export from bug: Container height isn'<!---->t recalculated when resizing,<!----> when using grid with min-<!---->block-<!---->size

<pre>
[css-grid] Grid item with a non-auto min-block-size overflows the grid when the grid shrinks and its content wraps

When a grid item in an auto row has a min-block-size other than auto, its minimum
contribution is computed by GridTrackSizingAlgorithmStrategy::minLogicalSizeForGridItem()
instead of going through the min-content contribution. This function ends up setting the
grid item's grid area content logical width and calls layout on it. The problem is that
RenderGrid keeps track of the grid item's intrinsic logical height for each item so that
it can reuse it in subsequent layouts and in this case we were getting back a stale
value. The min/max-content contribution paths already invalidated this cache when
we recompute the height of the grid item with a different containing block size but
this path for the minimum contribution did not.

What happens is basically:
1.) Run one pass of grid layout at some width -> when computing the minimum
contribution run layout on the item with the computed grid area width when we
sized the columns -> compute the max-content height of the grid item and cache the
value

2.) Run subsequent pass of grid layout with different set of constraints due to the
width change -> when computing the minimum contribution update the grid area
content width (note this does not invalidate the cache) -> when recomputing
the max-content height see that there is an entry in the cache and use it

Since we update the grid area for the item when we are computing the minimum
contribution but do not invalidate the cache we have no way of knowing that
we need to invalidate the entry by the time we need to compute the max-content
height since we think it did not end up changing.

Move the cache invalidation into updateOverridingContainingBlockContentSizeForGridItem()
so that it happens whenever that function changes the override size, instead of being
repeated by each contribution path. This removes the two existing copies in the
min-content and max-content contribution paths.

The test lays out a grid containing an item with min-block-size: 0, shrinks the grid's
containing block so that the item's text wraps, and checks that the grid's height grew.
It fails without this change.

WebKit-Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=326939">https://bugs.webkit.org/show_bug.cgi?id=326939</a>
WebKit-Canonical-Link: <a href="https://commits.webkit.org/324127@main">https://commits.webkit.org/324127@main</a>
</pre>

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

CI Results

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

Total 238 tests

Status Summary

Firefox

OK : 1[GitHub] 49[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-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 1[GitHub] 980[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 1168[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]
FAIL: 2[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-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 3[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]

Chrome

OK : 1
PASS: 1

Safari

OK : 1
FAIL: 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Tests Disabled in Gecko Infrastructure

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