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/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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 availableLogicalSpace); | 409 availableLogicalSpace); |
410 } | 410 } |
411 | 411 |
412 LayoutUnit DefiniteSizeStrategy::minLogicalWidthForChild( | 412 LayoutUnit DefiniteSizeStrategy::minLogicalWidthForChild( |
413 LayoutBox& child, | 413 LayoutBox& child, |
414 Length childMinSize, | 414 Length childMinSize, |
415 GridTrackSizingDirection childInlineDirection) const { | 415 GridTrackSizingDirection childInlineDirection) const { |
416 LayoutUnit marginLogicalWidth = | 416 LayoutUnit marginLogicalWidth = |
417 computeMarginLogicalSizeForChild(InlineDirection, layoutGrid(), child); | 417 computeMarginLogicalSizeForChild(InlineDirection, layoutGrid(), child); |
418 return child.computeLogicalWidthUsing( | 418 return child.computeLogicalWidthUsing( |
419 MinSize, childMinSize, overrideContainingBlockContentSizeForChild( | 419 MinSize, childMinSize, |
420 child, childInlineDirection), | 420 overrideContainingBlockContentSizeForChild(child, |
| 421 childInlineDirection), |
421 layoutGrid()) + | 422 layoutGrid()) + |
422 marginLogicalWidth; | 423 marginLogicalWidth; |
423 } | 424 } |
424 | 425 |
425 void DefiniteSizeStrategy::layoutGridItemForMinSizeComputation( | 426 void DefiniteSizeStrategy::layoutGridItemForMinSizeComputation( |
426 LayoutBox& child, | 427 LayoutBox& child, |
427 bool overrideSizeHasChanged) const { | 428 bool overrideSizeHasChanged) const { |
428 if (overrideSizeHasChanged) | 429 if (overrideSizeHasChanged) |
429 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); | 430 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); |
430 child.layoutIfNeeded(); | 431 child.layoutIfNeeded(); |
(...skipping 26 matching lines...) Expand all Loading... |
457 | 458 |
458 LayoutUnit IndefiniteSizeStrategy::minLogicalWidthForChild( | 459 LayoutUnit IndefiniteSizeStrategy::minLogicalWidthForChild( |
459 LayoutBox& child, | 460 LayoutBox& child, |
460 Length childMinSize, | 461 Length childMinSize, |
461 GridTrackSizingDirection childInlineDirection) const { | 462 GridTrackSizingDirection childInlineDirection) const { |
462 // TODO(svillar): we should use marginIntrinsicLogicalWidthForChild() instead | 463 // TODO(svillar): we should use marginIntrinsicLogicalWidthForChild() instead |
463 // but it is protected for LayoutObjects. Apparently none of the current tests | 464 // but it is protected for LayoutObjects. Apparently none of the current tests |
464 // fail, so we need a test case for this too. | 465 // fail, so we need a test case for this too. |
465 LayoutUnit marginLogicalWidth = LayoutUnit(); | 466 LayoutUnit marginLogicalWidth = LayoutUnit(); |
466 return child.computeLogicalWidthUsing( | 467 return child.computeLogicalWidthUsing( |
467 MinSize, childMinSize, overrideContainingBlockContentSizeForChild( | 468 MinSize, childMinSize, |
468 child, childInlineDirection), | 469 overrideContainingBlockContentSizeForChild(child, |
| 470 childInlineDirection), |
469 layoutGrid()) + | 471 layoutGrid()) + |
470 marginLogicalWidth; | 472 marginLogicalWidth; |
471 } | 473 } |
472 | 474 |
473 void IndefiniteSizeStrategy::layoutGridItemForMinSizeComputation( | 475 void IndefiniteSizeStrategy::layoutGridItemForMinSizeComputation( |
474 LayoutBox& child, | 476 LayoutBox& child, |
475 bool overrideSizeHasChanged) const { | 477 bool overrideSizeHasChanged) const { |
476 if (overrideSizeHasChanged && direction() != ForColumns) | 478 if (overrideSizeHasChanged && direction() != ForColumns) |
477 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); | 479 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); |
478 child.layoutIfNeeded(); | 480 child.layoutIfNeeded(); |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 DCHECK(m_algorithm.isValidTransition()); | 1427 DCHECK(m_algorithm.isValidTransition()); |
1426 DCHECK(!m_algorithm.m_needsSetup); | 1428 DCHECK(!m_algorithm.m_needsSetup); |
1427 } | 1429 } |
1428 | 1430 |
1429 GridTrackSizingAlgorithm::StateMachine::~StateMachine() { | 1431 GridTrackSizingAlgorithm::StateMachine::~StateMachine() { |
1430 m_algorithm.advanceNextState(); | 1432 m_algorithm.advanceNextState(); |
1431 m_algorithm.m_needsSetup = true; | 1433 m_algorithm.m_needsSetup = true; |
1432 } | 1434 } |
1433 | 1435 |
1434 } // namespace blink | 1436 } // namespace blink |
OLD | NEW |