Changeset 273470 in webkit
- Timestamp:
- Feb 24, 2021 9:59:46 PM (17 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/css-grid-layout/zero-height-crash-expected.txt (added)
-
LayoutTests/fast/css-grid-layout/zero-height-crash.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderBox.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderGrid.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r273467 r273470 1 2021-02-24 Rob Buis <rbuis@igalia.com> 2 3 [css-grid] Do not allow negative heights 4 https://bugs.webkit.org/show_bug.cgi?id=221439 5 6 Reviewed by Darin Adler. 7 8 Add test for this. 9 10 * fast/css-grid-layout/zero-height-crash-expected.txt: Added. 11 * fast/css-grid-layout/zero-height-crash.html: Added. 12 1 13 2021-02-24 Imanol Fernandez <ifernandez@igalia.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r273468 r273470 1 2021-02-24 Rob Buis <rbuis@igalia.com> 2 3 [css-grid] Do not allow negative heights 4 https://bugs.webkit.org/show_bug.cgi?id=221439 5 6 Reviewed by Darin Adler. 7 8 Do not allow negative heights in calculations, instead 9 use Optional to indicate that the heights are not existing. 10 11 Test: fast/css-grid-layout/zero-height-crash.html 12 13 * rendering/GridTrackSizingAlgorithm.cpp: 14 (WebCore::DefiniteSizeStrategy::minLogicalSizeForChild const): 15 * rendering/RenderBox.cpp: 16 (WebCore::RenderBox::replacedMinMaxLogicalHeightComputesAsNone const): 17 * rendering/RenderGrid.cpp: 18 (WebCore::RenderGrid::layoutBlock): 19 (WebCore::RenderGrid::gridGap const): 20 (WebCore::RenderGrid::placeItemsOnGrid const): 21 (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded): 22 1 23 2021-02-24 Julian Gonzalez <julian_a_gonzalez@apple.com> 2 24 -
trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
r272805 r273470 1053 1053 { 1054 1054 GridTrackSizingDirection childInlineDirection = GridLayoutFunctions::flowAwareDirectionForChild(*renderGrid(), child, ForColumns); 1055 LayoutUnit indefiniteSize = direction() == childInlineDirection ? LayoutUnit() : LayoutUnit(-1);1056 1055 GridTrackSizingDirection flowAwareDirection = GridLayoutFunctions::flowAwareDirectionForChild(*renderGrid(), child, direction()); 1057 if (hasRelativeMarginOrPaddingForChild(child, flowAwareDirection) || (direction() != childInlineDirection && hasRelativeOrIntrinsicSizeForChild(child, flowAwareDirection))) 1058 setOverridingContainingBlockContentSizeForChild(child, direction(), indefiniteSize); 1056 if (hasRelativeMarginOrPaddingForChild(child, flowAwareDirection) || (direction() != childInlineDirection && hasRelativeOrIntrinsicSizeForChild(child, flowAwareDirection))) { 1057 Optional<LayoutUnit> overridingSize; 1058 if (direction() == childInlineDirection) 1059 overridingSize = 0_lu; 1060 setOverridingContainingBlockContentSizeForChild(child, direction(), overridingSize); 1061 } 1059 1062 return GridTrackSizingAlgorithmStrategy::minLogicalSizeForChild(child, childMinSize, availableSize); 1060 1063 } -
trunk/Source/WebCore/rendering/RenderBox.cpp
r273435 r273470 3280 3280 3281 3281 if (logicalHeight.isPercentOrCalculated() && hasOverridingContainingBlockContentLogicalHeight()) 3282 return overridingContainingBlockContentLogicalHeight() == LayoutUnit(-1);3282 return false; 3283 3283 3284 3284 // Make sure % min-height and % max-height resolve to none if the containing block has auto height. -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r272307 r273470 251 251 computeTrackSizesForIndefiniteSize(m_trackSizingAlgorithm, ForRows); 252 252 else 253 computeTrackSizesForDefiniteSize(ForRows, availableLogicalHeight(ExcludeMarginBorderPadding));253 computeTrackSizesForDefiniteSize(ForRows, std::max<LayoutUnit>(0_lu, availableLogicalHeight(ExcludeMarginBorderPadding))); 254 254 LayoutUnit trackBasedLogicalHeight = m_trackSizingAlgorithm.computeTrackBasedSize() + borderAndPaddingLogicalHeight() + scrollbarLogicalHeight(); 255 255 setLogicalHeight(trackBasedLogicalHeight); … … 311 311 LayoutUnit RenderGrid::gridGap(GridTrackSizingDirection direction, Optional<LayoutUnit> availableSize) const 312 312 { 313 ASSERT(!availableSize || *availableSize >= 0); 313 314 const GapLength& gapLength = direction == ForColumns? style().columnGap() : style().rowGap(); 314 315 if (gapLength.isNormal()) … … 614 615 child->setOverridingContainingBlockContentLogicalWidth(LayoutUnit()); 615 616 if (!child->hasOverridingContainingBlockContentLogicalHeight()) 616 child->setOverridingContainingBlockContentLogicalHeight( LayoutUnit(-1));617 child->setOverridingContainingBlockContentLogicalHeight(WTF::nullopt); 617 618 618 619 GridArea area = grid.gridItemArea(*child); … … 1137 1138 if (allowedToStretchChildBlockSize) { 1138 1139 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildBeforeStretching(GridLayoutFunctions::overridingContainingBlockContentSizeForChild(child, childBlockDirection).value(), child); 1139 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(stretchedLogicalHeight, -1_lu);1140 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(stretchedLogicalHeight, WTF::nullopt); 1140 1141 child.setOverridingLogicalHeight(desiredLogicalHeight); 1141 1142
Note: See TracChangeset
for help on using the changeset viewer.