Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b3db1071742474d5876270a3f5bd3d7c391dc083
      
https://github.com/WebKit/WebKit/commit/b3db1071742474d5876270a3f5bd3d7c391dc083
  Author: Sammy Gill <[email protected]>
  Date:   2023-10-25 (Wed, 25 Oct 2023)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-005-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-006-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-007-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-008-expected.txt
    M Source/WebCore/rendering/GridBaselineAlignment.cpp
    M Source/WebCore/rendering/GridBaselineAlignment.h
    M Source/WebCore/rendering/GridLayoutFunctions.cpp
    M Source/WebCore/rendering/GridLayoutFunctions.h
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp

  Log Message:
  -----------
  [css-grid] align-items/align-self: last baseline should take into 
consideration the extra margin from non-orthogonal ancestor subgrids
https://bugs.webkit.org/show_bug.cgi?id=262646
rdar://problem/116484865

Reviewed by Matt Woodrow.

Grid performs last baseline alignment by using the "descent," value of
grid items, which is the distance from the under side of the grid item's
margin box to its ascent value. For subgridded items, this can include
extra margins imposed by ancestor subgrids. In order to properly
support subgridded items for last baseline alignment we need the extra
layer of margin on the under side of the grid item so that we can
properly compute its descent value. This patch is a first step at that
by focusing on the scenario in which we are aligning in the grid's
column axis (align-self/align-items) and there are no orthogonal
ancestor subgrids or orthogonal "root," grid.

This requires 3 main changes:
1.) Start using extraMarginForSubgridAncestors() to compute the margins
imposed by the ancestor subgrids. Previously, for first baseline
alignment, we were walking up the ancestor subgrid chain and collecting
the extra layer of margin. extraMarginForSubgridAncestors() already did
this (and includes the subgrids' gutters), so we should be using this
instead of duplicating code.

2.) Refactor extraMarginForSubgrid and extraMarginForSubgridAncestors
to return a new type: ExtraMarginsFromSubgrids. Instead of returning the
sum of the extra layer of margins both both sides of the track, this
struct keeps them separate and allows the caller to choose whether they
want the sum or the margins on a specific side.

3.) Pass extraTotalMargin() to descentForChild(). Since the descent
value is computed by finding the distance from the grid item's under
side of the margin box, extraTotalMargin() is needed to find the correct
side of the item's margin box with the extra layer of margins.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-005-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-006-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-007-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-008-expected.txt:
* Source/WebCore/rendering/GridBaselineAlignment.cpp:
(WebCore::GridBaselineAlignment::logicalAscentForChild const):
(WebCore::GridBaselineAlignment::ascentForChild const):
(WebCore::GridBaselineAlignment::descentForChild const):
* Source/WebCore/rendering/GridBaselineAlignment.h:
* Source/WebCore/rendering/GridLayoutFunctions.cpp:
(WebCore::GridLayoutFunctions::extraMarginForSubgrid):
(WebCore::GridLayoutFunctions::extraMarginForSubgridAncestors):
(WebCore::GridLayoutFunctions::marginLogicalSizeForChild):
* Source/WebCore/rendering/GridLayoutFunctions.h:
(WebCore::ExtraMarginsFromSubgrids::extraTrackStartMargin const):
(WebCore::ExtraMarginsFromSubgrids::extraTrackEndMargin const):
(WebCore::ExtraMarginsFromSubgrids::extraTotalMargin const):
(WebCore::ExtraMarginsFromSubgrids::operator+=):
(WebCore::ExtraMarginsFromSubgrids::addTrackStartMargin):
(WebCore::ExtraMarginsFromSubgrids::addTrackEndMargin):
* Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithmStrategy::updateOverridingContainingBlockContentSizeForChild
 const):

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to