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

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

Issue 2334133002: [css-grid] Cache definite height detection (Closed)
Patch Set: New version applying suggested changes 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/Source/core/layout/LayoutGrid.h ('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 ea4d9ff9a84367692c6ed0672561fcf4c7a4521a..f351588ef69d870e539f86b2391e8d8e7f63daf9 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -453,7 +453,7 @@ void LayoutGrid::layoutBlock(bool relayoutChildren)
LayoutSize previousSize = size();
updateLogicalWidth();
- bool logicalHeightWasIndefinite = !hasDefiniteLogicalHeight();
+ m_hasDefiniteLogicalHeight = hasDefiniteLogicalHeight();
TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope);
@@ -475,10 +475,10 @@ 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)
- computeIntrinsicLogicalHeight(sizingData);
- else
+ if (cachedHasDefiniteLogicalHeight())
computeTrackSizesForDirection(ForRows, sizingData, availableLogicalHeight(ExcludeMarginBorderPadding));
+ else
+ computeIntrinsicLogicalHeight(sizingData);
setLogicalHeight(computeTrackBasedLogicalHeight(sizingData) + borderAndPaddingLogicalHeight() + scrollbarLogicalHeight());
LayoutUnit oldClientAfterEdge = clientLogicalBottom();
@@ -487,7 +487,7 @@ void LayoutGrid::layoutBlock(bool relayoutChildren)
// 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)
+ if (!cachedHasDefiniteLogicalHeight())
computeTrackSizesForDirection(ForRows, sizingData, availableSpaceForRows);
// 3- If the min-content contribution of any grid items have changed based on the row
@@ -924,7 +924,7 @@ GridTrackSize LayoutGrid::gridTrackSize(GridTrackSizingDirection direction, size
// If the logical width/height of the grid container is indefinite, percentage values are treated as <auto>.
if (minTrackBreadth.hasPercentage() || maxTrackBreadth.hasPercentage()) {
// For the inline axis this only happens when we're computing the intrinsic sizes (AvailableSpaceIndefinite).
- if ((sizingOperation == IntrinsicSizeComputation) || (direction == ForRows && !hasDefiniteLogicalHeight())) {
+ if ((sizingOperation == IntrinsicSizeComputation) || (direction == ForRows && !cachedHasDefiniteLogicalHeight())) {
if (minTrackBreadth.hasPercentage())
minTrackBreadth = Length(Auto);
if (maxTrackBreadth.hasPercentage())
@@ -2667,4 +2667,10 @@ void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
GridPainter(*this).paintChildren(paintInfo, paintOffset);
}
+bool LayoutGrid::cachedHasDefiniteLogicalHeight() const
+{
+ SECURITY_DCHECK(m_hasDefiniteLogicalHeight);
+ return m_hasDefiniteLogicalHeight.value();
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutGrid.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698