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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 flowAwareDirectionForChild(layoutGrid(), child, ForColumns); | 369 flowAwareDirectionForChild(layoutGrid(), child, ForColumns); |
370 bool isRowAxis = direction() == childInlineDirection; | 370 bool isRowAxis = direction() == childInlineDirection; |
371 const Length& childSize = isRowAxis ? child.styleRef().logicalWidth() | 371 const Length& childSize = isRowAxis ? child.styleRef().logicalWidth() |
372 : child.styleRef().logicalHeight(); | 372 : child.styleRef().logicalHeight(); |
373 const Length& childMinSize = isRowAxis ? child.styleRef().logicalMinWidth() | 373 const Length& childMinSize = isRowAxis ? child.styleRef().logicalMinWidth() |
374 : child.styleRef().logicalMinHeight(); | 374 : child.styleRef().logicalMinHeight(); |
375 bool overflowIsVisible = | 375 bool overflowIsVisible = |
376 isRowAxis | 376 isRowAxis |
377 ? child.styleRef().overflowInlineDirection() == EOverflow::kVisible | 377 ? child.styleRef().overflowInlineDirection() == EOverflow::kVisible |
378 : child.styleRef().overflowBlockDirection() == EOverflow::kVisible; | 378 : child.styleRef().overflowBlockDirection() == EOverflow::kVisible; |
379 if (!childSize.isAuto() || (childMinSize.isAuto() && overflowIsVisible)) | 379 if (!childSize.isAuto() || (childMinSize.isAuto() && overflowIsVisible)) { |
| 380 if (child.isLayoutReplaced() && childSize.isAuto()) { |
| 381 // If the box has an aspect ratio and no specified size, its automatic |
| 382 // minimum size is the smaller of its content size and its transferred |
| 383 // size. |
| 384 return isRowAxis ? std::min(child.intrinsicLogicalWidth(), |
| 385 minContentForChild(child)) |
| 386 : std::min(child.intrinsicLogicalHeight(), |
| 387 minContentForChild(child)); |
| 388 } |
380 return minContentForChild(child); | 389 return minContentForChild(child); |
| 390 } |
381 | 391 |
382 bool overrideSizeHasChanged = | 392 bool overrideSizeHasChanged = |
383 updateOverrideContainingBlockContentSizeForChild(child, | 393 updateOverrideContainingBlockContentSizeForChild(child, |
384 childInlineDirection); | 394 childInlineDirection); |
385 if (isRowAxis) | 395 if (isRowAxis) |
386 return minLogicalWidthForChild(child, childMinSize, childInlineDirection); | 396 return minLogicalWidthForChild(child, childMinSize, childInlineDirection); |
387 | 397 |
388 layoutGridItemForMinSizeComputation(child, overrideSizeHasChanged); | 398 layoutGridItemForMinSizeComputation(child, overrideSizeHasChanged); |
389 | 399 |
390 return child.computeLogicalHeightUsing(MinSize, childMinSize, | 400 return child.computeLogicalHeightUsing(MinSize, childMinSize, |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 DCHECK(m_algorithm.isValidTransition()); | 1435 DCHECK(m_algorithm.isValidTransition()); |
1426 DCHECK(!m_algorithm.m_needsSetup); | 1436 DCHECK(!m_algorithm.m_needsSetup); |
1427 } | 1437 } |
1428 | 1438 |
1429 GridTrackSizingAlgorithm::StateMachine::~StateMachine() { | 1439 GridTrackSizingAlgorithm::StateMachine::~StateMachine() { |
1430 m_algorithm.advanceNextState(); | 1440 m_algorithm.advanceNextState(); |
1431 m_algorithm.m_needsSetup = true; | 1441 m_algorithm.m_needsSetup = true; |
1432 } | 1442 } |
1433 | 1443 |
1434 } // namespace blink | 1444 } // namespace blink |
OLD | NEW |