Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e4856c6696f58bae6f5cf1e864d0550f9eff09f8
      
https://github.com/WebKit/WebKit/commit/e4856c6696f58bae6f5cf1e864d0550f9eff09f8
  Author: Alan Baradlay <[email protected]>
  Date:   2026-08-30 (Sun, 30 Aug 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/aspect-ratio-grid-item-dynamic-container-shrink-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/aspect-ratio-grid-item-dynamic-container-shrink-001-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/aspect-ratio-grid-item-dynamic-container-shrink-001.html
    M Source/WebCore/rendering/RenderBox.cpp

  Log Message:
  -----------
  [Grid] Grid item with an aspect ratio keeps its stale inline contribution 
when the grid container shrinks
https://bugs.webkit.org/show_bug.cgi?id=322714
rdar://problem/186101273

Reviewed by Antti Koivisto.

  <div id=grid style="display: grid; grid-template-columns: 1fr 1fr; width: 
200px">
    <div style="aspect-ratio: 1.5"></div>
    <div></div>
  </div>
  <script>grid.style.width = "150px"</script>

After the shrink both 1fr columns should be 75px wide. Instead the first one
stayed 100px and the second got the leftover 50px.

Grid runs a second column sizing pass for items whose inline size depends on
their block size, and it measures them with the row size installed as an
overriding block size. The aspect ratio then transfers that row size into the
item's inline size, and the 100px result gets cached as the item's min-content
contribution. shouldInvalidateContentWidths(), which tells the next layout to
measure again, only covered flex items, so the 100px stayed cached and floored
the flexible track. Growing the container hid this because the larger fr share
was already above the stale value.

Add grid items next to the flex item case, which 241542@main added for the same
reason.

* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::shouldInvalidateContentWidths const):
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/aspect-ratio-grid-item-dynamic-container-shrink-001{,-ref,-expected}.html:
 Added.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Canonical link: https://commits.webkit.org/320117@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to