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

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: Wrapped comments. Created 4 years, 2 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 a9d80d7ebbd8775def2668b9adf41c2c2b336d45..c0a775f9d25d4722d21a050190e45f19d4e0ab5a 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -464,7 +464,7 @@ void LayoutGrid::repeatTracksSizingIfNeeded(GridSizingData& sizingData,
// 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,
@@ -487,6 +487,25 @@ 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 is
+ // computed again in the updateLogicalWidth call bellow.
+ if (sizesLogicalWidthToFitContent(styleRef().logicalWidth()) ||
+ styleRef().logicalWidth().isIntrinsicOrAuto()) {
+ // We do cache orthogonal items during the placeItemsOnGrid call, which is
+ // executed later. However, we are
+ // only interested on running this logic when we are performing a
+ // relayout, hence we have already cached
+ // the orthogonal items.
+ for (auto* child : m_orthogonalChildren) {
+ if (child->isOutOfFlowPositioned())
+ continue;
+ child->clearOverrideSize();
+ child->clearContainingBlockOverrideSize();
+ child->forceLayout();
+ }
+ }
+
updateLogicalWidth();
m_hasDefiniteLogicalHeight = hasDefiniteLogicalHeight();
@@ -1913,14 +1932,14 @@ 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