Changeset 274933 in webkit
- Timestamp:
- Mar 24, 2021 12:44:20 AM (16 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) (2 diffs)
-
Source/WebCore/rendering/GridTrackSizingAlgorithm.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderGrid.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r274932 r274933 1 2021-03-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 Javier Fernandez. 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-03-23 Lauro Moura <lmoura@igalia.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r274931 r274933 1 2021-03-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 Javier Fernandez. 7 8 Do not allow negative heights in calculations. 9 10 Test: fast/css-grid-layout/zero-height-crash.html 11 12 * rendering/GridTrackSizingAlgorithm.cpp: 13 (WebCore::GridTrackSizingAlgorithm::setup): 14 * rendering/GridTrackSizingAlgorithm.h: 15 * rendering/RenderGrid.cpp: 16 (WebCore::RenderGrid::computeTrackSizesForDefiniteSize): 17 (WebCore::RenderGrid::gridGap const): 18 (WebCore::RenderGrid::computeTrackSizesForIndefiniteSize const): 19 (WebCore::RenderGrid::availableAlignmentSpaceForChildBeforeStretching const): 20 1 21 2021-03-23 Tim Horton <timothy_horton@apple.com> 2 22 -
trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
r274477 r274933 1269 1269 // GridTrackSizingAlgorithm API. 1270 1270 1271 void GridTrackSizingAlgorithm::setup(GridTrackSizingDirection direction, unsigned numTracks, SizingOperation sizingOperation, Optional<LayoutUnit> availableSpace , Optional<LayoutUnit> freeSpace)1271 void GridTrackSizingAlgorithm::setup(GridTrackSizingDirection direction, unsigned numTracks, SizingOperation sizingOperation, Optional<LayoutUnit> availableSpace) 1272 1272 { 1273 1273 ASSERT(m_needsSetup); 1274 1274 m_direction = direction; 1275 setAvailableSpace(direction, availableSpace );1275 setAvailableSpace(direction, availableSpace ? std::max(0_lu, *availableSpace) : availableSpace); 1276 1276 1277 1277 m_sizingOperation = sizingOperation; … … 1289 1289 m_autoSizedTracksForStretchIndex.shrink(0); 1290 1290 1291 setFreeSpace(direction, freeSpace); 1291 if (availableSpace) { 1292 LayoutUnit guttersSize = m_renderGrid->guttersSize(m_grid, direction, 0, m_grid.numTracks(direction), this->availableSpace(direction)); 1293 setFreeSpace(direction, *availableSpace - guttersSize); 1294 } else 1295 setFreeSpace(direction, WTF::nullopt); 1292 1296 tracks(direction).resize(numTracks); 1293 1297 -
trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.h
r274477 r274933 106 106 } 107 107 108 void setup(GridTrackSizingDirection, unsigned numTracks, SizingOperation, Optional<LayoutUnit> availableSpace , Optional<LayoutUnit> freeSpace);108 void setup(GridTrackSizingDirection, unsigned numTracks, SizingOperation, Optional<LayoutUnit> availableSpace); 109 109 void run(); 110 110 void reset(); -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r274818 r274933 146 146 void RenderGrid::computeTrackSizesForDefiniteSize(GridTrackSizingDirection direction, LayoutUnit availableSpace) 147 147 { 148 LayoutUnit totalGuttersSize = guttersSize(m_grid, direction, 0, m_grid.numTracks(direction), availableSpace); 149 LayoutUnit freeSpace = availableSpace - totalGuttersSize; 150 151 m_trackSizingAlgorithm.setup(direction, numTracks(direction, m_grid), TrackSizing, availableSpace, freeSpace); 148 m_trackSizingAlgorithm.setup(direction, numTracks(direction, m_grid), TrackSizing, availableSpace); 152 149 m_trackSizingAlgorithm.run(); 153 150 … … 317 314 LayoutUnit RenderGrid::gridGap(GridTrackSizingDirection direction, Optional<LayoutUnit> availableSize) const 318 315 { 316 ASSERT(!availableSize || *availableSize >= 0); 319 317 const GapLength& gapLength = direction == ForColumns? style().columnGap() : style().rowGap(); 320 318 if (gapLength.isNormal()) … … 440 438 { 441 439 const Grid& grid = algorithm.grid(); 442 algorithm.setup(direction, numTracks(direction, grid), IntrinsicSizeComputation, WTF::nullopt , WTF::nullopt);440 algorithm.setup(direction, numTracks(direction, grid), IntrinsicSizeComputation, WTF::nullopt); 443 441 algorithm.run(); 444 442 … … 1112 1110 // compute margins in order to determine the available height before stretching. 1113 1111 GridTrackSizingDirection childBlockFlowDirection = GridLayoutFunctions::flowAwareDirectionForChild(*this, child, ForRows); 1114 return gridAreaBreadthForChild - GridLayoutFunctions::marginLogicalSizeForChild(*this, childBlockFlowDirection, child);1112 return std::max(0_lu, gridAreaBreadthForChild - GridLayoutFunctions::marginLogicalSizeForChild(*this, childBlockFlowDirection, child)); 1115 1113 } 1116 1114
Note: See TracChangeset
for help on using the changeset viewer.