Changeset 290577 in webkit
- Timestamp:
- Feb 27, 2022 7:03:39 PM (5 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/auto-track-sizing-002-expected.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/auto-track-sizing-002.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/GridLayoutFunctions.cpp (modified) (1 diff)
-
Source/WebCore/rendering/GridLayoutFunctions.h (modified) (1 diff)
-
Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderGrid.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderGrid.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r290576 r290577 1 2022-02-27 Matt Woodrow <mattwoodrow@apple.com> 2 3 Compute correct containing block override size for items that are subgridden in one dimension only. 4 https://bugs.webkit.org/show_bug.cgi?id=236951 5 6 Reviewed by Dean Jackson. 7 8 * TestExpectations: 9 10 Marked existing WPT as passing. 11 1 12 2022-02-27 Matt Woodrow <mattwoodrow@apple.com> 2 13 -
trunk/LayoutTests/TestExpectations
r290576 r290577 1395 1395 imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/masonry-subgrid-002.html [ ImageOnlyFailure ] 1396 1396 1397 webkit.org/b/236951 imported/w3c/web-platform-tests/css/css-grid/subgrid/auto-track-sizing-001.html [ ImageOnlyFailure ]1398 1397 webkit.org/b/236959 imported/w3c/web-platform-tests/css/css-grid/subgrid/baseline-001.html [ ImageOnlyFailure ] 1399 1398 webkit.org/b/236956 imported/w3c/web-platform-tests/css/css-grid/subgrid/grid-gap-003.html [ ImageOnlyFailure ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r290573 r290577 1 2022-02-27 Matt Woodrow <mattwoodrow@apple.com> 2 3 Compute correct containing block override size for items that are subgridden in one dimension only. 4 https://bugs.webkit.org/show_bug.cgi?id=236951 5 6 Reviewed by Dean Jackson. 7 8 Added new WPT similar to auto-track-sizing-001 which adds new variations 9 with nested subgrids and varying whether the other axis is subgridded. 10 11 * web-platform-tests/css/css-grid/subgrid/auto-track-sizing-002-expected.html: Added. 12 * web-platform-tests/css/css-grid/subgrid/auto-track-sizing-002.html: Added. 13 1 14 2022-02-27 Antoine Quint <graouts@webkit.org> 2 15 -
trunk/Source/WebCore/ChangeLog
r290576 r290577 1 2022-02-27 Matt Woodrow <mattwoodrow@apple.com> 2 3 Compute correct containing block override size for items that are subgridden in one dimension only. 4 https://bugs.webkit.org/show_bug.cgi?id=236951 5 6 Reviewed by Dean Jackson. 7 8 Items that are subgridded in one dimension will be included in the track sizing algorithm of the 9 outer grid for that dimension. When measuring their size in the subgridded dimension, we need to 10 set their containing block size in the other (non-subgridded) dimension, which is only available 11 from the subgrid's track sizing, not the outer track sizes. 12 13 This recurses up to set the override size on the subgrid element instead, and forces a layout 14 there, which should copy down subgrid track sizes and compute the other dimension, making it 15 available on the inner item we need. 16 17 Test: imported/w3c/web-platform-tests/css/css-grid/subgrid/auto-track-sizing-002.html 18 19 * rendering/GridLayoutFunctions.cpp: 20 (WebCore::GridLayoutFunctions::extraMarginForSubgridAncestors): 21 * rendering/GridLayoutFunctions.h: 22 * rendering/GridTrackSizingAlgorithm.cpp: 23 (WebCore::GridTrackSizingAlgorithmStrategy::updateOverridingContainingBlockContentSizeForChild const): 24 * rendering/RenderGrid.cpp: 25 (WebCore::RenderGrid::isSubgridOf): 26 * rendering/RenderGrid.h: 27 1 28 2022-02-27 Matt Woodrow <mattwoodrow@apple.com> 2 29 -
trunk/Source/WebCore/rendering/GridLayoutFunctions.cpp
r290576 r290577 104 104 } 105 105 106 staticLayoutUnit extraMarginForSubgridAncestors(GridTrackSizingDirection direction, const RenderBox& child)106 LayoutUnit extraMarginForSubgridAncestors(GridTrackSizingDirection direction, const RenderBox& child) 107 107 { 108 108 const RenderGrid* grid = downcast<RenderGrid>(child.parent()); -
trunk/Source/WebCore/rendering/GridLayoutFunctions.h
r290007 r290577 51 51 bool isFlippedDirection(const RenderGrid&, GridTrackSizingDirection); 52 52 bool isSubgridReversedDirection(const RenderGrid&, GridTrackSizingDirection outerDirection, const RenderGrid& subgrid); 53 LayoutUnit extraMarginForSubgridAncestors(GridTrackSizingDirection, const RenderBox& child); 53 54 54 55 } -
trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
r290096 r290577 966 966 overrideSize = m_algorithm.gridAreaBreadthForChild(child, direction); 967 967 968 if (renderGrid() != child.parent()) { 969 RenderGrid* grid = downcast<RenderGrid>(child.parent()); 970 971 GridTrackSizingDirection subgridDirection = GridLayoutFunctions::flowAwareDirectionForChild(*renderGrid(), *grid, direction); 972 973 if (grid->isSubgridOf(subgridDirection, *renderGrid())) { 974 // If the item is subgridded in this direction (and thus the tracks it covers are tracks 975 // owned by this sizing algorithm), then we want to take the breadth of the tracks we occupy, 976 // and subtract any space occupied by the subgrid itself (and any ancestor subgrids). 977 *overrideSize -= GridLayoutFunctions::extraMarginForSubgridAncestors(subgridDirection, child); 978 } else { 979 // Otherwise the tracks that this item covers (in this non-subgridded axis) are owned 980 // by one of the intermediate RenderGrids (which are subgrids in the other axis). Recurse 981 // until we find an element this is directly part of this grid and set the override size 982 // for that, and then layout that item so that it computes the track sizes and sets the 983 // override size we need. 984 bool overrideSizeHasChanged = 985 updateOverridingContainingBlockContentSizeForChild(*grid, direction); 986 layoutGridItemForMinSizeComputation(*grid, overrideSizeHasChanged); 987 return overrideSizeHasChanged; 988 } 989 } 990 968 991 if (GridLayoutFunctions::hasOverridingContainingBlockContentSizeForChild(child, direction) && GridLayoutFunctions::overridingContainingBlockContentSizeForChild(child, direction) == overrideSize) 969 992 return false; -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r290491 r290577 1627 1627 GridTrackSizingDirection direction = GridLayoutFunctions::flowAwareDirectionForChild(*downcast<RenderGrid>(parent()), *this, parentDirection); 1628 1628 return isSubgrid(direction); 1629 } 1630 1631 bool RenderGrid::isSubgridOf(GridTrackSizingDirection direction, const RenderGrid& ancestor) 1632 { 1633 if (!isSubgrid(direction)) 1634 return false; 1635 if (parent() == &ancestor) 1636 return true; 1637 1638 auto& parentGrid = *downcast<RenderGrid>(parent()); 1639 GridTrackSizingDirection parentDirection = GridLayoutFunctions::flowAwareDirectionForParent(parentGrid, *this, direction); 1640 return parentGrid.isSubgridOf(parentDirection, ancestor); 1629 1641 } 1630 1642 -
trunk/Source/WebCore/rendering/RenderGrid.h
r290491 r290577 97 97 } 98 98 bool isSubgridInParentDirection(GridTrackSizingDirection parentDirection) const; 99 100 // Returns true if this grid is inheriting subgridded tracks for 101 // the given direction from the specified ancestor. This handles 102 // nested subgrids, where ancestor may not be our direct parent. 103 bool isSubgridOf(GridTrackSizingDirection, const RenderGrid& ancestor); 104 99 105 bool mayBeSubgridExcludingAbsPos(GridTrackSizingDirection) const; 100 106
Note: See TracChangeset
for help on using the changeset viewer.