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

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

Issue 2415313003: [css-grid] Computing free space on indefinite sized grids (Closed)
Patch Set: Created 4 years, 2 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-content-alignment-overflow-expected.txt ('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 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 GridSizingData& sizingData, 685 GridSizingData& sizingData,
686 LayoutUnit& minIntrinsicSize, 686 LayoutUnit& minIntrinsicSize,
687 LayoutUnit& maxIntrinsicSize) const { 687 LayoutUnit& maxIntrinsicSize) const {
688 DCHECK(sizingData.isValidTransition(direction)); 688 DCHECK(sizingData.isValidTransition(direction));
689 sizingData.setAvailableSpace(LayoutUnit()); 689 sizingData.setAvailableSpace(LayoutUnit());
690 sizingData.freeSpace(direction) = LayoutUnit(); 690 sizingData.freeSpace(direction) = LayoutUnit();
691 sizingData.sizingOperation = IntrinsicSizeComputation; 691 sizingData.sizingOperation = IntrinsicSizeComputation;
692 692
693 computeUsedBreadthOfGridTracks(direction, sizingData, minIntrinsicSize, 693 computeUsedBreadthOfGridTracks(direction, sizingData, minIntrinsicSize,
694 maxIntrinsicSize); 694 maxIntrinsicSize);
695 // Free Space is always 0 for indefinite sizing computation.
696 sizingData.freeSpace(direction) = LayoutUnit();
svillar 2016/10/17 08:20:33 I disagree with this change for 2 reasons: 1) the
jfernandez 2016/10/17 08:43:54 Well, since we are initializing it to 0, we are ge
svillar 2016/10/17 09:13:19 I understand but what you're doing here is exactly
695 697
696 size_t numberOfTracks = direction == ForColumns 698 size_t numberOfTracks = direction == ForColumns
697 ? sizingData.columnTracks.size() 699 ? sizingData.columnTracks.size()
698 : sizingData.rowTracks.size(); 700 : sizingData.rowTracks.size();
699 LayoutUnit totalGuttersSize = 701 LayoutUnit totalGuttersSize =
700 guttersSize(direction, 0, numberOfTracks, sizingData.sizingOperation); 702 guttersSize(direction, 0, numberOfTracks, sizingData.sizingOperation);
701 minIntrinsicSize += totalGuttersSize; 703 minIntrinsicSize += totalGuttersSize;
702 maxIntrinsicSize += totalGuttersSize; 704 maxIntrinsicSize += totalGuttersSize;
703 705
704 #if ENABLE(ASSERT) 706 #if ENABLE(ASSERT)
(...skipping 2500 matching lines...) Expand 10 before | Expand all | Expand 10 after
3205 // If <content-distribution> value can't be applied, 'position' will become 3207 // If <content-distribution> value can't be applied, 'position' will become
3206 // the associated <content-position> fallback value. 3208 // the associated <content-position> fallback value.
3207 ContentAlignmentData contentAlignment = contentDistributionOffset( 3209 ContentAlignmentData contentAlignment = contentDistributionOffset(
3208 availableFreeSpace, position, distribution, numberOfGridTracks); 3210 availableFreeSpace, position, distribution, numberOfGridTracks);
3209 if (contentAlignment.isValid()) 3211 if (contentAlignment.isValid())
3210 return contentAlignment; 3212 return contentAlignment;
3211 3213
3212 OverflowAlignment overflow = 3214 OverflowAlignment overflow =
3213 isRowAxis ? styleRef().justifyContentOverflowAlignment() 3215 isRowAxis ? styleRef().justifyContentOverflowAlignment()
3214 : styleRef().alignContentOverflowAlignment(); 3216 : styleRef().alignContentOverflowAlignment();
3215 if (availableFreeSpace <= 0 && overflow == OverflowAlignmentSafe) 3217 // TODO (lajava): Default value for overflow isn't exaclty as 'unsafe'.
3218 // https://drafts.csswg.org/css-align/#overflow-values
3219 if (availableFreeSpace == 0 ||
3220 (availableFreeSpace < 0 && overflow == OverflowAlignmentSafe))
3216 return {LayoutUnit(), LayoutUnit()}; 3221 return {LayoutUnit(), LayoutUnit()};
3217 3222
3218 switch (position) { 3223 switch (position) {
3219 case ContentPositionLeft: 3224 case ContentPositionLeft:
3220 // The align-content's axis is always orthogonal to the inline-axis. 3225 // The align-content's axis is always orthogonal to the inline-axis.
3221 return {LayoutUnit(), LayoutUnit()}; 3226 return {LayoutUnit(), LayoutUnit()};
3222 case ContentPositionRight: 3227 case ContentPositionRight:
3223 if (isRowAxis) 3228 if (isRowAxis)
3224 return {availableFreeSpace, LayoutUnit()}; 3229 return {availableFreeSpace, LayoutUnit()};
3225 // The align-content's axis is always orthogonal to the inline-axis. 3230 // The align-content's axis is always orthogonal to the inline-axis.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3308 if (!m_gridItemArea.isEmpty()) 3313 if (!m_gridItemArea.isEmpty())
3309 GridPainter(*this).paintChildren(paintInfo, paintOffset); 3314 GridPainter(*this).paintChildren(paintInfo, paintOffset);
3310 } 3315 }
3311 3316
3312 bool LayoutGrid::cachedHasDefiniteLogicalHeight() const { 3317 bool LayoutGrid::cachedHasDefiniteLogicalHeight() const {
3313 SECURITY_DCHECK(m_hasDefiniteLogicalHeight); 3318 SECURITY_DCHECK(m_hasDefiniteLogicalHeight);
3314 return m_hasDefiniteLogicalHeight.value(); 3319 return m_hasDefiniteLogicalHeight.value();
3315 } 3320 }
3316 3321
3317 } // namespace blink 3322 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-content-alignment-overflow-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698