Changeset 285497 in webkit
- Timestamp:
- Nov 9, 2021 6:48:01 AM (8 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/aspect-ratio-005-expected.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/aspect-ratio-005.html (added)
-
LayoutTests/platform/ios-wk2/TestExpectations (modified) (1 diff)
-
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/RenderGrid.cpp (modified) (5 diffs)
-
Source/WebCore/rendering/RenderGrid.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r285495 r285497 1 2021-11-09 Ziran Sun <zsun@igalia.com> 2 3 [css-grid] update the content-sized grid width before laying out a grid item with block constraints and aspect-ratio 4 https://bugs.webkit.org/show_bug.cgi?id=231802 5 6 Reviewed by Javier Fernandez. 7 8 Unskip the tests that are now passing and add a new test to check track size updates. 9 10 * imported/w3c/web-platform-tests/css/css-grid/grid-items/aspect-ratio-005-expected.html: Added. 11 * imported/w3c/web-platform-tests/css/css-grid/grid-items/aspect-ratio-005.html: Added. 12 * TestExpectations: 13 * platform/ios-wk2/TestExpectations: 14 1 15 2021-11-09 Alan Bujtas <zalan@apple.com> 2 16 -
trunk/LayoutTests/TestExpectations
r285493 r285497 1400 1400 imported/w3c/web-platform-tests/css/css-grid/grid-model/grid-areas-overflowing-grid-container-009.html [ ImageOnlyFailure ] 1401 1401 imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/flex-sizing-rows-indefinite-height.html [ ImageOnlyFailure ] 1402 webkit.org/b/231021 imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-intrinsic-size-dynamic-block-size.html [ ImageOnlyFailure ]1403 1402 webkit.org/b/231021 imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-template-flexible-rerun-track-sizing.html [ ImageOnlyFailure ] 1404 1403 imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/masonry-align-content-001.html [ ImageOnlyFailure ] -
trunk/LayoutTests/platform/ios-wk2/TestExpectations
r285394 r285497 1994 1994 webkit.org/b/209461 imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-item-dynamic-min-contribution-001.html [ Failure ] 1995 1995 1996 webkit.org/b/227283 imported/w3c/web-platform-tests/css/css-grid/grid-items/aspect-ratio-001.html [ ImageOnlyFailure ]1997 webkit.org/b/227283 imported/w3c/web-platform-tests/css/css-grid/grid-items/aspect-ratio-002.html [ ImageOnlyFailure ]1998 webkit.org/b/227283 imported/w3c/web-platform-tests/css/css-grid/grid-items/aspect-ratio-003.html [ ImageOnlyFailure ]1999 1996 webkit.org/b/227283 imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-item-inline-contribution-001.html [ ImageOnlyFailure ] 2000 1997 webkit.org/b/227283 imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-item-inline-contribution-002.html [ ImageOnlyFailure ] 2001 webkit.org/b/227283 imported/w3c/web-platform-tests/css/css-grid/grid-items/replaced-element-011.html [ ImageOnlyFailure ]2002 webkit.org/b/227283 imported/w3c/web-platform-tests/css/css-grid/grid-items/replaced-element-012.html [ ImageOnlyFailure ]2003 webkit.org/b/227283 imported/w3c/web-platform-tests/css/css-grid/grid-items/replaced-element-013.html [ ImageOnlyFailure ]2004 1998 2005 1999 webkit.org/b/215929 compositing/video/poster.html [ Pass Timeout ] -
trunk/Source/WebCore/ChangeLog
r285495 r285497 1 2021-11-09 Ziran Sun <zsun@igalia.com> 2 3 [css-grid] update the content-sized grid width before laying out a grid item with block constraints and aspect-ratio 4 https://bugs.webkit.org/show_bug.cgi?id=231802 5 6 Reviewed by Javier Fernandez. 7 8 For a grid item with an aspect-ratio, if it has block-constraints such as the relative logical height 9 case we consider in this CL, it should try and resolve it if possible and transfer this size into 10 the inline direction for the min/max content size. For the case that the grid width is content sized, 11 we need to update the width before laying out the grid items. Since the min-content contribution of 12 the grid item has changed based on the row sizes calculated in step 2 of sizing algorithm, we also 13 need to repeat the sizing algorithm steps to update the width of the track sizes. 14 15 * rendering/GridLayoutFunctions.cpp: 16 (WebCore::GridLayoutFunctions::isAspectRatioBlockSizeDependentChild): 17 * rendering/GridLayoutFunctions.h: 18 * rendering/RenderGrid.cpp: 19 (WebCore::RenderGrid::layoutBlock): 20 (WebCore::RenderGrid::updateGridAreaForAspectRatioItems): 21 * rendering/RenderGrid.h: 22 1 23 2021-11-09 Alan Bujtas <zalan@apple.com> 2 24 -
trunk/Source/WebCore/rendering/GridLayoutFunctions.cpp
r278253 r285497 83 83 } 84 84 85 bool isAspectRatioBlockSizeDependentChild(const RenderBox& child) 86 { 87 return (child.style().hasAspectRatio() || child.hasIntrinsicAspectRatio()) && child.hasRelativeLogicalHeight(); 88 } 89 85 90 GridTrackSizingDirection flowAwareDirectionForChild(const RenderGrid& grid, const RenderBox& child, GridTrackSizingDirection direction) 86 91 { -
trunk/Source/WebCore/rendering/GridLayoutFunctions.h
r278253 r285497 41 41 LayoutUnit marginLogicalSizeForChild(const RenderGrid&, GridTrackSizingDirection, const RenderBox&); 42 42 bool isOrthogonalChild(const RenderGrid&, const RenderBox&); 43 bool isAspectRatioBlockSizeDependentChild(const RenderBox&); 43 44 GridTrackSizingDirection flowAwareDirectionForChild(const RenderGrid&, const RenderBox&, GridTrackSizingDirection); 44 45 bool hasOverridingContainingBlockContentSizeForChild(const RenderBox&, GridTrackSizingDirection); -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r283321 r285497 162 162 // cases with orthogonal flows require this extra cycle; we need a more specific 163 163 // condition to detect whether child's min-content contribution has changed or not. 164 if (m_hasAnyOrthogonalItem || m_trackSizingAlgorithm.hasAnyPercentSizedRowsIndefiniteHeight() ) {164 if (m_hasAnyOrthogonalItem || m_trackSizingAlgorithm.hasAnyPercentSizedRowsIndefiniteHeight() || m_hasAspectRatioBlockSizeDependentItem) { 165 165 computeTrackSizesForDefiniteSize(ForColumns, availableSpaceForColumns); 166 166 computeContentPositionAndDistributionOffset(ForColumns, m_trackSizingAlgorithm.freeSpace(ForColumns).value(), nonCollapsedTracks(ForColumns)); … … 200 200 bool hasDefiniteLogicalHeight = RenderBlock::hasDefiniteLogicalHeight() || hasOverridingLogicalHeight() || computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), std::nullopt); 201 201 m_hasAnyOrthogonalItem = false; 202 m_hasAspectRatioBlockSizeDependentItem = false; 203 Vector<RenderBox*> aspectRatioBlockSizeDependentGridItems; 202 204 for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) { 203 205 if (child->isOutOfFlowPositioned()) … … 211 213 if (GridLayoutFunctions::isOrthogonalChild(*this, *child)) 212 214 m_hasAnyOrthogonalItem = true; 213 215 216 // For a grid item that has an aspect-ratio and block-constraints such as the relative logical height, 217 // when the grid width is auto, we may need get the real grid width before laying out the item. 218 if (GridLayoutFunctions::isAspectRatioBlockSizeDependentChild(*child) && (style().logicalWidth().isAuto() || style().logicalWidth().isMinContent() || style().logicalWidth().isMaxContent())) { 219 aspectRatioBlockSizeDependentGridItems.append(child); 220 m_hasAspectRatioBlockSizeDependentItem = true; 221 } 214 222 // We keep a cache of items with baseline as alignment values so 215 223 // that we only compute the baseline shims for such items. This … … 274 282 computeContentPositionAndDistributionOffset(ForRows, m_trackSizingAlgorithm.freeSpace(ForRows).value(), nonCollapsedTracks(ForRows)); 275 283 284 if (!aspectRatioBlockSizeDependentGridItems.isEmpty()) { 285 updateGridAreaForAspectRatioItems(aspectRatioBlockSizeDependentGridItems); 286 updateLogicalWidth(); 287 } 288 276 289 // 3- If the min-content contribution of any grid items have changed based on the row 277 290 // sizes calculated in step 2, steps 1 and 2 are repeated with the new min-content … … 941 954 child.setOverridingContainingBlockContentLogicalWidth(width); 942 955 child.setOverridingContainingBlockContentLogicalHeight(height); 956 } 957 958 void RenderGrid::updateGridAreaForAspectRatioItems(const Vector<RenderBox*>& autoGridItems) 959 { 960 populateGridPositionsForDirection(ForColumns); 961 populateGridPositionsForDirection(ForRows); 962 963 for (auto& autoGridItem : autoGridItems) 964 updateGridAreaLogicalSize(*autoGridItem, gridAreaBreadthForChildIncludingAlignmentOffsets(*autoGridItem, ForColumns), gridAreaBreadthForChildIncludingAlignmentOffsets(*autoGridItem, ForRows)); 943 965 } 944 966 -
trunk/Source/WebCore/rendering/RenderGrid.h
r280075 r285497 131 131 void repeatTracksSizingIfNeeded(LayoutUnit availableSpaceForColumns, LayoutUnit availableSpaceForRows); 132 132 133 void updateGridAreaForAspectRatioItems(const Vector<RenderBox*>&); 133 134 void layoutGridItems(); 134 135 void populateGridPositionsForDirection(GridTrackSizingDirection); … … 205 206 206 207 bool m_hasAnyOrthogonalItem {false}; 208 bool m_hasAspectRatioBlockSizeDependentItem { false }; 207 209 bool m_baselineItemsCached {false}; 208 210 };
Note: See TracChangeset
for help on using the changeset viewer.