Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 352ccb3b04ce2e03b9e62f1b4578162cd5dd73ea
      
https://github.com/WebKit/WebKit/commit/352ccb3b04ce2e03b9e62f1b4578162cd5dd73ea
  Author: Sammy Gill <[email protected]>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-fit-content-width-percent-height-aspect-ratio-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-fit-content-width-percent-height-aspect-ratio-001.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-float-intrinsic-width-percent-height-aspect-ratio-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-float-intrinsic-width-percent-height-aspect-ratio-001.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-inline-grid-intrinsic-width-percent-height-aspect-ratio-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-inline-grid-intrinsic-width-percent-height-aspect-ratio-001.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-max-content-width-percent-height-aspect-ratio-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-max-content-width-percent-height-aspect-ratio-001.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-min-content-width-percent-height-aspect-ratio-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-min-content-width-percent-height-aspect-ratio-001.html
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.h

  Log Message:
  -----------
  [CSS Grid] Resolve grid item percent block-size against definite row tracks 
during column intrinsic sizing
https://bugs.webkit.org/show_bug.cgi?id=227283
rdar://79955935

Reviewed by Alan Baradlay.

According the the track sizing algorithm, when we are doing the first
iteration of column sizing we are supposed to use the sum of the
definite max track sizing functions for the available block axis space
for items that need it:
https://drafts.csswg.org/css-grid-2/#algo-track-sizing

For example
<div style="width: 400px;">
  <div style="display: grid; width: min-content; background: green; height: 
100px; grid-template-rows: 50px;">
    <div style="height: 100%;">
      <canvas width="20" height="10" style="height: 100%;"></canvas>
    </div>
  </div>
</div>
Here the size of the columns depends on the available block space since
the replaced element will resolve the % height against any definite
space in that axis and then compute the width from that and the aspect
ratio.

To fix this we can make sure that the grid area's height for the grid
item is set to the sum of the max track sizing functions if that is a
definite value. The track sizing algorithm already keeps track of which
step of the algorithm we are in along with if we are computing the
intrinsic sizes of the grid so we can reuse that logic as well.

I also added a couple of RAII helper classes to make sure that these
sizes are scoped properly to avoid keeping them around to longer than
they need to (similar to what RenderFlexibleBox does).

Canonical link: https://commits.webkit.org/313927@main



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

Reply via email to