OLD | NEW |
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/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
8 #include "core/layout/Grid.h" | 8 #include "core/layout/Grid.h" |
9 #include "core/layout/LayoutGrid.h" | 9 #include "core/layout/LayoutGrid.h" |
10 #include "platform/LengthFunctions.h" | 10 #include "platform/LengthFunctions.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SetGridItemNeedsLayout(child); | 281 SetGridItemNeedsLayout(child); |
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 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 DCHECK(algorithm_.IsValidTransition()); | 1486 DCHECK(algorithm_.IsValidTransition()); |
1492 DCHECK(!algorithm_.needs_setup_); | 1487 DCHECK(!algorithm_.needs_setup_); |
1493 } | 1488 } |
1494 | 1489 |
1495 GridTrackSizingAlgorithm::StateMachine::~StateMachine() { | 1490 GridTrackSizingAlgorithm::StateMachine::~StateMachine() { |
1496 algorithm_.AdvanceNextState(); | 1491 algorithm_.AdvanceNextState(); |
1497 algorithm_.needs_setup_ = true; | 1492 algorithm_.needs_setup_ = true; |
1498 } | 1493 } |
1499 | 1494 |
1500 } // namespace blink | 1495 } // namespace blink |
OLD | NEW |