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

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

Issue 2361373002: [css-grid] Clearing override sizes before running grid's layout logic. (Closed)
Patch Set: Getting back the initial approach, adding some constraints to avoid unneeded relayouts. 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 ec13d1934a0da3df498bbfaa44792491e7bfb277..de7fb5176c2c6efb5eaee2a622fc2272f1e7bd63 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -430,7 +430,7 @@ void LayoutGrid::repeatTracksSizingIfNeeded(GridSizingData& sizingData, LayoutUn
// a new cycle of the sizing algorithm; there may be more. In addition, not all the
// cases with orthogonal flows require this extra cycle; we need a more specific
// condition to detect whether child's min-content contribution has changed or not.
- if (m_hasAnyOrthogonalChild) {
+ if (!m_orthogonalChildren.isEmpty()) {
computeTrackSizesForDefiniteSize(ForColumns, sizingData, availableSpaceForColumns);
computeTrackSizesForDefiniteSize(ForRows, sizingData, availableSpaceForRows);
}
@@ -452,6 +452,18 @@ void LayoutGrid::layoutBlock(bool relayoutChildren)
LayoutSize previousSize = size();
+ // We need to clear both own and containingBlock override sizes to ensure we get the same
+ // result when grid's intrinsic size it's computed again.
cbiesinger 2016/09/27 09:47:42 Please add "in the updateLogicalWidth call below"
+ if (sizesLogicalWidthToFitContent(styleRef().logicalWidth()) || styleRef().logicalWidth().isIntrinsicOrAuto()) {
+ for (auto* child : m_orthogonalChildren) {
cbiesinger 2016/09/27 09:47:42 This is a little subtle because m_orthogonalChildr
+ if (child->isOutOfFlowPositioned())
+ continue;
+ child->clearOverrideSize();
+ child->clearContainingBlockOverrideSize();
+ child->forceLayout();
+ }
+ }
+
updateLogicalWidth();
m_hasDefiniteLogicalHeight = hasDefiniteLogicalHeight();
@@ -1568,12 +1580,13 @@ void LayoutGrid::placeItemsOnGrid(SizingOperation sizingOperation)
Vector<LayoutBox*> autoMajorAxisAutoGridItems;
Vector<LayoutBox*> specifiedMajorAxisAutoGridItems;
- m_hasAnyOrthogonalChild = false;
+ m_orthogonalChildren.shrink(0);
for (LayoutBox* child = m_orderIterator.first(); child; child = m_orderIterator.next()) {
if (child->isOutOfFlowPositioned())
continue;
- m_hasAnyOrthogonalChild = m_hasAnyOrthogonalChild || isOrthogonalChild(*child);
+ if (isOrthogonalChild(*child))
+ m_orthogonalChildren.append(child);
GridArea area = cachedGridArea(*child);
if (!area.rows.isIndefinite())
« 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