Changeset 286148 in webkit
- Timestamp:
- Nov 24, 2021, 7:04:31 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp (modified) (4 diffs)
-
Source/WebCore/rendering/GridTrackSizingAlgorithm.h (modified) (2 diffs)
-
Source/WebCore/rendering/RenderGrid.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderGrid.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r286146 r286148 1 2021-11-24 Ziran Sun <zsun@igalia.com> 2 3 [css-grid] Track sizing algorithm not repeated even if used flex fraction would change 4 https://bugs.webkit.org/show_bug.cgi?id=232617 5 6 Reviewed by Javier Fernandez. 7 8 Unskip two tests that are passing. 9 10 * TestExpectations: 11 1 12 2021-11-24 Manuel Rego Casasnovas <rego@igalia.com> 2 13 -
trunk/LayoutTests/TestExpectations
r286136 r286148 1397 1397 1398 1398 imported/w3c/web-platform-tests/css/css-grid/grid-model/grid-areas-overflowing-grid-container-009.html [ ImageOnlyFailure ] 1399 imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/flex-sizing-rows-indefinite-height.html [ ImageOnlyFailure ]1400 webkit.org/b/231021 imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-template-flexible-rerun-track-sizing.html [ ImageOnlyFailure ]1401 1399 imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/masonry-align-content-001.html [ ImageOnlyFailure ] 1402 1400 imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/masonry-align-content-002.html [ ImageOnlyFailure ] -
trunk/Source/WebCore/ChangeLog
r286147 r286148 1 2021-11-24 Ziran Sun <zsun@igalia.com> 2 3 [css-grid] Track sizing algorithm not repeated even if used flex fraction would change 4 https://bugs.webkit.org/show_bug.cgi?id=232617 5 6 Reviewed by Javier Fernandez. 7 8 According to https://drafts.csswg.org/css-grid/#algo-flex-tracks, when row height is 9 indefinite, for each grid item that crosses a flexible track, we run the track sizing 10 algorithm under a max-content constraint to find the flex fraction. Then we work out 11 the grid container height as definite, which may cause the flex fraction change. At this 12 point, we need to repeat the track sizing algorithm for row and layout the grid for real. 13 The current implementation doesn't repeat the track sizing algorithm for row. 14 15 The complication with calling RenderGrid::repeatTracksSizingIfNeeded() for flex max-sizing 16 is that it might change a grid item's status of participating in Baseline Alignment for 17 a cyclic sizing dependncy case, which should be definitively excluded. See 18 https://github.com/w3c/csswg-drafts/issues/3046 for more details. This issue should be handled 19 in a seperate bug. This CL only handle test cases that don't have baseline alignment specified. 20 21 * rendering/GridTrackSizingAlgorithm.cpp: 22 (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes): 23 (WebCore::GridTrackSizingAlgorithm::setup): 24 (WebCore::GridTrackSizingAlgorithm::reset): 25 * rendering/GridTrackSizingAlgorithm.h: 26 * rendering/RenderGrid.cpp: 27 (WebCore::RenderGrid::repeatTracksSizingIfNeeded): 28 (WebCore::RenderGrid::layoutBlock): 29 * rendering/RenderGrid.h: 30 1 31 2021-11-24 Alan Bujtas <zalan@apple.com> 2 32 -
trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
r285885 r286148 1166 1166 ASSERT(m_autoSizedTracksForStretchIndex.isEmpty()); 1167 1167 ASSERT(!m_hasPercentSizedRowsIndefiniteHeight); 1168 ASSERT(!m_hasFlexibleMaxTrackBreadth); 1168 1169 1169 1170 Vector<GridTrack>& allTracks = tracks(m_direction); … … 1188 1189 m_autoSizedTracksForStretchIndex.append(i); 1189 1190 1190 if ( !m_hasPercentSizedRowsIndefiniteHeight &&indefiniteHeight) {1191 if (indefiniteHeight) { 1191 1192 auto& rawTrackSize = rawGridTrackSize(m_direction, i); 1192 if (rawTrackSize.minTrackBreadth().isPercentage() || rawTrackSize.maxTrackBreadth().isPercentage()) 1193 // Set the flag for repeating the track sizing algorithm. For flexible tracks, as per spec https://drafts.csswg.org/css-grid/#algo-flex-tracks, 1194 // in clause "if the free space is an indefinite length:", it states that "If using this flex fraction would cause the grid to be smaller than 1195 // the grid container’s min-width/height (or larger than the grid container’s max-width/height), then redo this step". 1196 if (!m_hasFlexibleMaxTrackBreadth && rawTrackSize.maxTrackBreadth().isFlex()) 1197 m_hasFlexibleMaxTrackBreadth = true; 1198 if (!m_hasPercentSizedRowsIndefiniteHeight && (rawTrackSize.minTrackBreadth().isPercentage() || rawTrackSize.maxTrackBreadth().isPercentage())) 1193 1199 m_hasPercentSizedRowsIndefiniteHeight = true; 1194 1200 } … … 1362 1368 m_needsSetup = false; 1363 1369 m_hasPercentSizedRowsIndefiniteHeight = false; 1370 m_hasFlexibleMaxTrackBreadth = false; 1364 1371 1365 1372 computeBaselineAlignmentContext(); … … 1433 1440 setAvailableSpace(ForColumns, std::nullopt); 1434 1441 m_hasPercentSizedRowsIndefiniteHeight = false; 1442 m_hasFlexibleMaxTrackBreadth = false; 1435 1443 } 1436 1444 -
trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.h
r283439 r286148 144 144 145 145 bool hasAnyPercentSizedRowsIndefiniteHeight() const { return m_hasPercentSizedRowsIndefiniteHeight; } 146 bool hasAnyFlexibleMaxTrackBreadth() const { return m_hasFlexibleMaxTrackBreadth; } 147 bool hasAnyBaselineAlignmentItem() const { return !m_columnBaselineItemsMap.isEmpty() || !m_rowBaselineItemsMap.isEmpty(); } 146 148 147 149 #if ASSERT_ENABLED … … 200 202 bool m_needsSetup { true }; 201 203 bool m_hasPercentSizedRowsIndefiniteHeight { false }; 204 bool m_hasFlexibleMaxTrackBreadth { false }; 202 205 std::optional<LayoutUnit> m_availableSpaceRows; 203 206 std::optional<LayoutUnit> m_availableSpaceColumns; -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r285998 r286148 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() || m_hasAspectRatioBlockSizeDependentItem) { 164 // The complication with repeating the track sizing algorithm for flex max-sizing is that 165 // it might change a grid item's status of participating in Baseline Alignment for 166 // a cyclic sizing dependncy case, which should be definitively excluded. See 167 // https://github.com/w3c/csswg-drafts/issues/3046 for details. 168 // FIXME: we are avoiding repeating the track sizing algorithm for grid item with baseline alignment 169 // here in the case of using flex max-sizing functions. We probably also need to investigate whether 170 // it is applicable for the case of percent-sized rows with indefinite height as well. 171 if (m_hasAnyOrthogonalItem || m_trackSizingAlgorithm.hasAnyPercentSizedRowsIndefiniteHeight() || (m_trackSizingAlgorithm.hasAnyFlexibleMaxTrackBreadth() && !m_trackSizingAlgorithm.hasAnyBaselineAlignmentItem()) || m_hasAspectRatioBlockSizeDependentItem) { 165 172 computeTrackSizesForDefiniteSize(ForColumns, availableSpaceForColumns); 166 173 computeContentPositionAndDistributionOffset(ForColumns, m_trackSizingAlgorithm.freeSpace(ForColumns).value(), nonCollapsedTracks(ForColumns)); -
trunk/Source/WebCore/rendering/RenderGrid.h
r285497 r286148 208 208 bool m_hasAspectRatioBlockSizeDependentItem { false }; 209 209 bool m_baselineItemsCached {false}; 210 bool m_hasAnyBaselineAlignmentItem { false }; 210 211 }; 211 212
Note:
See TracChangeset
for help on using the changeset viewer.