Changeset 210211 in webkit
- Timestamp:
- Dec 30, 2016 2:53:58 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r210200 r210211 1 2016-12-28 Sergio Villar Senin <svillar@igalia.com> 2 3 [css-grid] Isolate instrinsic size computation from layout 4 https://bugs.webkit.org/show_bug.cgi?id=166530 5 6 Reviewed by Darin Adler. 7 8 * fast/css-grid-layout/grid-auto-repeat-intrinsic-expected.txt: Added. 9 * fast/css-grid-layout/grid-auto-repeat-intrinsic.html: Added. 10 * fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks-expected.txt: Added. 11 * fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks.html: Added. 12 1 13 2016-12-28 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r210207 r210211 1 2016-12-28 Sergio Villar Senin <svillar@igalia.com> 2 3 [css-grid] Isolate instrinsic size computation from layout 4 https://bugs.webkit.org/show_bug.cgi?id=166530 5 6 Reviewed by Darin Adler. 7 8 This is the last patch of the items placement data refactoring. By using a different Grid 9 instance in computeIntrinsicLogicalWidths we effectively isolate the intrinsic size 10 computation from the layout. They are now using different data structures so they don't 11 interfere each other. 12 13 This also means that we no longer reuse the placement of items done in the intrinsic size 14 computation. That shouldn't be a big issue once we make m_grid persistent on RenderGrid. 15 16 Last but not least, this patch finally removes the ugly const_cast's we had in 17 computeIntrinsicLogicalWidths() as we no longer modify the internal state of RenderGrid. 18 19 Tests: fast/css-grid-layout/grid-auto-repeat-intrinsic.html 20 fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks.html 21 22 * rendering/RenderGrid.cpp: 23 (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Use a new instance of Grid. 24 (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat): Fixed a missing m_grid -> grid 25 rename. 26 (WebCore::RenderGrid::placeItemsOnGrid): Constify it. It nows repositions the items if the 27 number of auto repeat tracks has changed. 28 * rendering/RenderGrid.h: 29 1 30 2016-12-30 Michael Catanzaro <mcatanzaro@igalia.com> 2 31 -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r210197 r210211 736 736 void RenderGrid::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const 737 737 { 738 bool wasPopulated = !m_grid.needsItemsPlacement(); 739 if (!wasPopulated) 740 const_cast<RenderGrid*>(this)->placeItemsOnGrid(const_cast<Grid&>(m_grid), IntrinsicSizeComputation); 741 742 GridSizingData sizingData(numTracks(ForColumns, m_grid), numTracks(ForRows, m_grid), const_cast<Grid&>(m_grid)); 738 Grid grid(const_cast<RenderGrid&>(*this)); 739 placeItemsOnGrid(grid, IntrinsicSizeComputation); 740 741 GridSizingData sizingData(numTracks(ForColumns, grid), numTracks(ForRows, grid), grid); 743 742 sizingData.setAvailableSpace(std::nullopt); 744 743 sizingData.setFreeSpace(ForColumns, std::nullopt); … … 753 752 minLogicalWidth += scrollbarWidth; 754 753 maxLogicalWidth += scrollbarWidth; 755 756 if (!wasPopulated)757 const_cast<RenderGrid*>(this)->clearGrid();758 754 } 759 755 … … 1709 1705 unsigned lastAutoRepeatTrack = firstAutoRepeatTrack + grid.autoRepeatTracks(direction); 1710 1706 1711 if (! m_grid.hasGridItems()) {1707 if (!grid.hasGridItems()) { 1712 1708 emptyTrackIndexes = std::make_unique<OrderedTrackIndexSet>(); 1713 1709 for (unsigned trackIndex = firstAutoRepeatTrack; trackIndex < lastAutoRepeatTrack; ++trackIndex) … … 1726 1722 } 1727 1723 1728 void RenderGrid::placeItemsOnGrid(Grid& grid, SizingOperation sizingOperation) 1729 { 1730 ASSERT(grid.needsItemsPlacement()); 1731 ASSERT(!grid.hasGridItems()); 1732 1724 void RenderGrid::placeItemsOnGrid(Grid& grid, SizingOperation sizingOperation) const 1725 { 1733 1726 unsigned autoRepeatColumns = computeAutoRepeatTracksCount(ForColumns, sizingOperation); 1734 1727 unsigned autoRepeatRows = computeAutoRepeatTracksCount(ForRows, sizingOperation); 1735 grid.setAutoRepeatTracks(autoRepeatRows, autoRepeatColumns); 1736 1728 if (autoRepeatColumns != grid.autoRepeatTracks(ForColumns) || autoRepeatRows != grid.autoRepeatTracks(ForRows)) { 1729 grid.setNeedsItemsPlacement(true); 1730 grid.setAutoRepeatTracks(autoRepeatRows, autoRepeatColumns); 1731 } 1732 1733 if (!grid.needsItemsPlacement()) 1734 return; 1735 1736 ASSERT(!grid.hasGridItems()); 1737 1737 populateExplicitGridAndOrderIterator(grid); 1738 1738 … … 2794 2794 // because not having rows implies that there are no "normal" children (out-of-flow children are 2795 2795 // not stored in m_grid). 2796 ASSERT(! m_grid.needsItemsPlacement());2796 ASSERT(!grid.needsItemsPlacement()); 2797 2797 if (direction == ForRows) 2798 2798 return grid.numTracks(ForRows); -
trunk/Source/WebCore/rendering/RenderGrid.h
r210197 r210211 95 95 std::unique_ptr<OrderedTrackIndexSet> computeEmptyTracksForAutoRepeat(Grid&, GridTrackSizingDirection) const; 96 96 97 void placeItemsOnGrid(Grid&, SizingOperation) ;97 void placeItemsOnGrid(Grid&, SizingOperation) const; 98 98 void populateExplicitGridAndOrderIterator(Grid&) const; 99 99 std::unique_ptr<GridArea> createEmptyGridAreaAtSpecifiedPositionsOutsideGrid(Grid&, const RenderBox&, GridTrackSizingDirection, const GridSpan&) const;
Note: See TracChangeset
for help on using the changeset viewer.