[webkit-changes] [WebKit/WebKit] 15f5b0: Allow subgrids to participate in masonry layout.

Sammy Gill noreply at github.com
Thu Dec 15 07:46:34 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 15f5b0f32da7334c055e80173df8078ba2598262
      https://github.com/WebKit/WebKit/commit/15f5b0f32da7334c055e80173df8078ba2598262
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2022-12-15 (Thu, 15 Dec 2022)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-columns-subgrid-named-lines-001-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-columns-subgrid-named-lines-001.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-columns-subgrid-named-lines-002-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-columns-subgrid-named-lines-002.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-columns-subgrid-named-lines-003-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-columns-subgrid-named-lines-003.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-rows-subgrid-named-lines-001-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-rows-subgrid-named-lines-001.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-rows-subgrid-named-lines-002-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-rows-subgrid-named-lines-002.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-rows-subgrid-named-lines-003-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-rows-subgrid-named-lines-003.html
    M LayoutTests/platform/gtk/TestExpectations
    M Source/WebCore/rendering/GridMasonryLayout.cpp
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.h
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderGrid.cpp
    M Source/WebCore/rendering/RenderGrid.h
    M Source/WebCore/rendering/style/GridPositionsResolver.cpp

  Log Message:
  -----------
  Allow subgrids to participate in masonry layout.
https://bugs.webkit.org/show_bug.cgi?id=248403
rdar://102720861

Reviewed by Brent Fulgham.

Subgrids should be able to participate in masonry layout in the same
axis as their parent grids. This patch allows this to happen by'
modifying isMasonryRows/Columns to return true when the parent grid is
participating in masonry in the appropriate axis and if the same axis is
being subgridded. In these scenarios, isSubgrid(ForRows/ForColumns) will
need to return false because the axis cannot be subgridded in the same
sense. However, the grid axis can still be subgridded normally.

Also, if a subgrid is being auto-placed, then it cannot inherit any of
its parent grid's line names. NamedLineCollection has been modified to
check if a subgrid is participating in masonry layout via isMasonryRows
and isMasonryColumns. It then checks to see if the grid axis is being
automatically positioned. If both of these are true, then it will exit
early and not inherit any line names.

Spec reference: https://drafts.csswg.org/css-grid-3/#subgrids

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-columns-subgrid-named-lines-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-columns-subgrid-named-lines-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-columns-subgrid-named-lines-002-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-columns-subgrid-named-lines-002.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-columns-subgrid-named-lines-003-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-columns-subgrid-named-lines-003.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-rows-subgrid-named-lines-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-rows-subgrid-named-lines-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-rows-subgrid-named-lines-002-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-rows-subgrid-named-lines-002.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-rows-subgrid-named-lines-003-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-rows-subgrid-named-lines-003.html: Added.
* LayoutTests/platform/gtk/TestExpectations:
* Source/WebCore/rendering/GridMasonryLayout.cpp:
(WebCore::GridMasonryLayout::placeItemsWithDefiniteGridAxisPosition):
(WebCore::GridMasonryLayout::setItemGridAxisContainingBlockToGridArea):
* Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithm::computeTrackBasedSize const):
(WebCore::GridTrackSizingAlgorithm::isDirectionInMasonryDirection const):
* Source/WebCore/rendering/GridTrackSizingAlgorithm.h:
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::sizesLogicalWidthToFitContent const):
* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutBlock):
(WebCore::RenderGrid::isMasonryRows const):
(WebCore::RenderGrid::isMasonryColumns const):
(WebCore::RenderGrid::isSubgrid const):
* Source/WebCore/rendering/RenderGrid.h:
* Source/WebCore/rendering/style/GridPositionsResolver.cpp:
(WebCore::NamedLineCollection::NamedLineCollection):

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




More information about the webkit-changes mailing list