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

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

Issue 2726103003: [css-grid] Implement transferred size part of Implied Minimum Size (Closed)
Patch Set: Swap order in condition Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-automatic-minimum-intrinsic-aspect-ratio.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-automatic-minimum-intrinsic-aspect-ratio.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698