[webkit-changes] [WebKit/WebKit] d28a4d: [css-grid] Resolve and set the row start, non-auto...

Sammy Gill noreply at github.com
Tue Oct 17 13:37:14 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d28a4da714e84e52e8c59db1b828d7f601c34036
      https://github.com/WebKit/WebKit/commit/d28a4da714e84e52e8c59db1b828d7f601c34036
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2023-10-17 (Tue, 17 Oct 2023)

  Changed paths:
    M LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-grid/subgrid/align-self-baseline-with-subgrid-mbp-expected.txt
    M LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-005-expected.txt
    M LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-006-expected.txt
    M LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-007-expected.txt
    M LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-008-expected.txt
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.h
    M Source/WebCore/rendering/RenderGrid.cpp
    M Source/WebCore/rendering/RenderGrid.h

  Log Message:
  -----------
  [css-grid] Resolve and set the row start, non-auto margins for subgrids with baseline aligned items.
https://bugs.webkit.org/show_bug.cgi?id=262508
rdar://problem/116369419

Reviewed by Matt Woodrow.

Note: This patch focuses on when we are performing baseline alignment
in the block direction of a grid (i.e. align-self/align-items).

When subgrids baseline align their items as part of alignment in the
outer grid, the sum of the subgrid's margin, border, and padding are
treated as an extra layer of margin for the grid item. Since an item's
margin is part of what determines the ascent value for the purposes of
baseline alignment, we must have that information when it gets added
into a baseline alignment context.

This process occurs at the end of the GridTrackSizingAlgorithm's setup
phase by the call to computeBaselineAlignmentContext, but the issue is
that by the time we call computeBaselineAlignmentContext none of the
subgrids have their margins resolved as part of their m_marginBox. This
information gets set during the actual grid track sizing algorithm when
the subgrid goes through layout as we attempt to compute the min content
size of the subgridded item.

When we call cacheBaselineAlignedChildren on the "root" grid (the grid
that subgrids will share tracks with), we can keep track of a bool that
is initially set to true to represent this state in which we want to
cache row subgrids. After we cache a baseline aligned item in
cacheBaselineAlignedItem we can then check to see if this flag is true
and also cache the item's grid if it is a row subgrid of the root grid.

Later on we will go through these subgrids and resolve their
margins just before we start creating the baseline alignment context
for the GridColumnAxis. We will only do this as part of the first/second
iteration of the row track sizing since we will just have determined the
size of the columns in the previous step. The sizes of the columns are
needed so that we can get the available width from the grid area the
subgrid is contained in, which may be needed to resolve its margins in
certain cases.

The affected tests below are brought more in like with their non-iOS
counterparts which share the same expected results. The discrepancy
between the two platforms is because on macOS, for example, an
additional layout occurs via a call to LocalFrameView::adjustViewSize
that does not occur when running the tests on iOS. The second layout
then uses the margin box information for the subgrids that was set
previously.

* LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-grid/subgrid/align-self-baseline-with-subgrid-mbp-expected.txt:
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-005-expected.txt:
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-006-expected.txt:
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-007-expected.txt:
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-grid/subgrid/subgrid-baseline-008-expected.txt:
* Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::computeGridSpanSize):
(WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild const):
(WebCore::GridTrackSizingAlgorithm::cacheBaselineAlignedItem):
(WebCore::GridTrackSizingAlgorithm::setup):
* Source/WebCore/rendering/GridTrackSizingAlgorithm.h:
* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::cacheBaselineAlignedChildren):
(WebCore::RenderGrid::computeIntrinsicLogicalWidths const):
(WebCore::RenderGrid::isSubgridOf const):
(WebCore::RenderGrid::isSubgridOf): Deleted.
* Source/WebCore/rendering/RenderGrid.h:

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




More information about the webkit-changes mailing list