Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 69af7d1c3763903e2b8dedffbaa3f7cc594af9fe
      
https://github.com/WebKit/WebKit/commit/69af7d1c3763903e2b8dedffbaa3f7cc594af9fe
  Author: Sammy Gill <[email protected]>
  Date:   2025-06-26 (Thu, 26 Jun 2025)

  Changed paths:
    M LayoutTests/TestExpectations
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-align-baseline-line-clamp-002.tentative-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-align-baseline-line-clamp-003.tentative-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-self-baseline-not-applied-if-sizing-cyclic-dependency-002-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-self-baseline-not-applied-if-sizing-cyclic-dependency-003-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/self-baseline/grid-self-baseline-two-dimensional-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/baseline-alignment-affects-intrinsic-size-001-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/baseline-alignment-affects-intrinsic-size-003-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/baseline-alignment-affects-intrinsic-size-004-expected.txt
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp

  Log Message:
  -----------
  [Grid][Baseline Alignment] Expand baseline alignment participation to items 
with automatic logical width in alignment axis
https://bugs.webkit.org/show_bug.cgi?id=294985
rdar://154311395

Reviewed by Alan Baradlay.

The grid spec calls out some scenarios in which an item that has a
baseline computed alignment value should not actually participate in
baseline alignment.

"If baseline alignment is specified on a grid item whose size in
that axis depends on the size of an intrinsically sized track (whose
size is therefore dependent on both the item’s size and baseline
alignment, creating a cyclic dependency), that item does not participate
in baseline alignment, and instead uses its fallback alignment as
if that were originally specified."

This participation is controlled by a method in GridTrackSizingAlgorithm
named canParticipateInBaselineAlignment. The overall flow of this
function seems to be (ignoring the subgrid exception):

1.) Is the item's block direction parallel to the axis it is being
aligned in and does it have a valid baseline? If so, it can participate.
2.) Is the item being placed in a grid area that is intrinsically sized?
If *not*, then the item can also be baseline aligned since there will be
no dependency on its size and the sizes of the tracks it’s placed in.
3.) Does the item's size depend in that direction depend on its track
sizes (i.e. is it extrinsically sized and depends on the space)? If so,
then it should not participate in baseline alignment due to the
specified cycle.

3 needs to check the item's logical width or logical height depending on
which one is in the same direction as the axis it is being aligned in.
For the logical height case, we just check whether it has a relative
logical height, but for the width case, we add an extra restriction in
that it cannot be auto as well. This seems to be a bit too restrictive
since having an automatic logical width does not depend on an
intrinsically sized track. The intrinsically sized track will ask for
the item's size contributions and would be cyclic if any of those values
were relative just like the logical height case.

For example:

<div style="display: grid; grid-template-columns: min-content;">
  <div style="width: 50%;">foo</div>
  <div>bar</div>
</div>

The first item's size contributions are dependent on the available space,
but the second item's is not.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to