Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutGrid.cpp

Issue 2339983002: [css-grid] Remove the 2x computation of row sizes w/ indefinite heights (Closed)
Patch Set: Now with perf test Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/PerformanceTests/Layout/nested-grid.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutGrid.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
index a34960d16c5496f9514bb0a222be58472a526579..a4a1cb96327215aeaa545ba88d61001c9e98a5b6 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -453,7 +453,6 @@ void LayoutGrid::layoutBlock(bool relayoutChildren)
LayoutSize previousSize = size();
updateLogicalWidth();
- bool logicalHeightWasIndefinite = !hasDefiniteLogicalHeight();
TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope);
@@ -475,7 +474,7 @@ void LayoutGrid::layoutBlock(bool relayoutChildren)
// 2- Next, the track sizing algorithm resolves the sizes of the grid rows, using the
// grid column sizes calculated in the previous step.
- if (logicalHeightWasIndefinite)
+ if (!hasDefiniteLogicalHeight())
computeIntrinsicLogicalHeight(sizingData);
else
computeTrackSizesForDirection(ForRows, sizingData, availableLogicalHeight(ExcludeMarginBorderPadding));
@@ -484,16 +483,10 @@ void LayoutGrid::layoutBlock(bool relayoutChildren)
LayoutUnit oldClientAfterEdge = clientLogicalBottom();
updateLogicalHeight();
- // The above call might have changed the grid's logical height depending on min|max height restrictions.
- // Update the sizes of the rows whose size depends on the logical height (also on definite|indefinite sizes).
- LayoutUnit availableSpaceForRows = contentLogicalHeight();
- if (logicalHeightWasIndefinite)
- computeTrackSizesForDirection(ForRows, sizingData, availableSpaceForRows);
-
// 3- If the min-content contribution of any grid items have changed based on the row
// sizes calculated in step 2, steps 1 and 2 are repeated with the new min-content
// contribution (once only).
- repeatTracksSizingIfNeeded(sizingData, availableSpaceForColumns, availableSpaceForRows);
+ repeatTracksSizingIfNeeded(sizingData, availableSpaceForColumns, contentLogicalHeight());
// Grid container should have the minimum height of a line if it's editable. That doesn't affect track sizing though.
if (hasLineIfEmpty())
@@ -623,6 +616,7 @@ void LayoutGrid::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
void LayoutGrid::computeIntrinsicLogicalHeight(GridSizingData& sizingData)
{
+ DCHECK(sizingData.isValidTransition(ForRows));
ASSERT(tracksAreWiderThanMinTrackBreadth(ForColumns, sizingData));
sizingData.setAvailableSpace(LayoutUnit());
sizingData.freeSpace(ForRows) = LayoutUnit();
@@ -634,6 +628,7 @@ void LayoutGrid::computeIntrinsicLogicalHeight(GridSizingData& sizingData)
m_maxContentHeight += totalGuttersSize;
ASSERT(tracksAreWiderThanMinTrackBreadth(ForRows, sizingData));
+ sizingData.nextState();
jfernandez 2016/09/14 21:54:46 It's a bit confusing/peculiar that intrinsic size
}
LayoutUnit LayoutGrid::computeIntrinsicLogicalContentHeightUsing(const Length& logicalHeightLength, LayoutUnit intrinsicContentHeight, LayoutUnit borderAndPadding) const
@@ -1895,6 +1890,7 @@ void LayoutGrid::applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection
void LayoutGrid::layoutGridItems(GridSizingData& sizingData)
{
+ sizingData.sizingOperation = TrackSizing;
jfernandez 2016/09/14 21:54:46 Why we need to do this ? Wouldn't be better place
svillar 2016/09/15 10:04:34 We need this because the layout of the items invol
populateGridPositionsForDirection(sizingData, ForColumns);
populateGridPositionsForDirection(sizingData, ForRows);
m_gridItemsOverflowingGridArea.resize(0);
« no previous file with comments | « third_party/WebKit/PerformanceTests/Layout/nested-grid.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698