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

Side by Side Diff: third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp

Issue 2832783003: [css-grid] Clearing the override height before layout (Closed)
Patch Set: Patch rebased. Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/GridTrackSizingAlgorithm.h" 5 #include "core/layout/GridTrackSizingAlgorithm.h"
6 6
7 #include "core/layout/Grid.h" 7 #include "core/layout/Grid.h"
8 #include "core/layout/LayoutGrid.h" 8 #include "core/layout/LayoutGrid.h"
9 #include "platform/LengthFunctions.h" 9 #include "platform/LengthFunctions.h"
10 10
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 // If |child| has a relative logical height, we shouldn't let it override its 275 // If |child| has a relative logical height, we shouldn't let it override its
276 // intrinsic height, which is what we are interested in here. Thus we need to 276 // intrinsic height, which is what we are interested in here. Thus we need to
277 // set the block-axis override size to -1 (no possible resolution). 277 // set the block-axis override size to -1 (no possible resolution).
278 if (ShouldClearOverrideContainingBlockContentSizeForChild(child, kForRows)) { 278 if (ShouldClearOverrideContainingBlockContentSizeForChild(child, kForRows)) {
279 SetOverrideContainingBlockContentSizeForChild(child, child_block_direction, 279 SetOverrideContainingBlockContentSizeForChild(child, child_block_direction,
280 LayoutUnit(-1)); 280 LayoutUnit(-1));
281 child.SetNeedsLayout(LayoutInvalidationReason::kGridChanged, kMarkOnlyThis); 281 child.SetNeedsLayout(LayoutInvalidationReason::kGridChanged, kMarkOnlyThis);
282 } 282 }
283 283
284 // We need to clear the stretched height to properly compute logical height
285 // during layout.
286 if (child.NeedsLayout())
287 child.ClearOverrideLogicalContentHeight();
288
289 child.LayoutIfNeeded(); 284 child.LayoutIfNeeded();
290 GridAxis baseline_axis = GetLayoutGrid()->IsOrthogonalChild(child) 285 GridAxis baseline_axis = GetLayoutGrid()->IsOrthogonalChild(child)
291 ? kGridRowAxis 286 ? kGridRowAxis
292 : kGridColumnAxis; 287 : kGridColumnAxis;
293 if (GetLayoutGrid()->IsBaselineAlignmentForChild(child, baseline_axis) && 288 if (GetLayoutGrid()->IsBaselineAlignmentForChild(child, baseline_axis) &&
294 GetLayoutGrid()->IsBaselineContextComputed(baseline_axis)) { 289 GetLayoutGrid()->IsBaselineContextComputed(baseline_axis)) {
295 auto& group = 290 auto& group =
296 GetLayoutGrid()->GetBaselineGroupForChild(child, baseline_axis); 291 GetLayoutGrid()->GetBaselineGroupForChild(child, baseline_axis);
297 return group.MaxAscent() + group.MaxDescent(); 292 return group.MaxAscent() + group.MaxDescent();
298 } 293 }
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 DCHECK(algorithm_.IsValidTransition()); 1488 DCHECK(algorithm_.IsValidTransition());
1494 DCHECK(!algorithm_.needs_setup_); 1489 DCHECK(!algorithm_.needs_setup_);
1495 } 1490 }
1496 1491
1497 GridTrackSizingAlgorithm::StateMachine::~StateMachine() { 1492 GridTrackSizingAlgorithm::StateMachine::~StateMachine() {
1498 algorithm_.AdvanceNextState(); 1493 algorithm_.AdvanceNextState();
1499 algorithm_.needs_setup_ = true; 1494 algorithm_.needs_setup_ = true;
1500 } 1495 }
1501 1496
1502 } // namespace blink 1497 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698