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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutGrid.cpp

Issue 2415313003: [css-grid] Computing free space on indefinite sized grids (Closed)
Patch Set: Clearer layout test cases. 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutGrid.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
index 26b4afd42c9f6a66f70e7a0e1a2aeccb0f5cc909..3d87b15370992692f181efdb4a73bb5b062511ff 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -535,13 +535,19 @@ void LayoutGrid::layoutBlock(bool relayoutChildren) {
sizingData.nextState();
sizingData.sizingOperation = TrackSizing;
}
- setLogicalHeight(computeTrackBasedLogicalHeight(sizingData) +
- borderAndPaddingLogicalHeight() +
- scrollbarLogicalHeight());
+ LayoutUnit trackBasedLogicalHeight =
+ computeTrackBasedLogicalHeight(sizingData) +
+ borderAndPaddingLogicalHeight() + scrollbarLogicalHeight();
+ setLogicalHeight(trackBasedLogicalHeight);
LayoutUnit oldClientAfterEdge = clientLogicalBottom();
updateLogicalHeight();
+ // Once grid's indefinite height is resolved, we can compute the
+ // available free space for Content Alignment.
+ if (!cachedHasDefiniteLogicalHeight())
+ sizingData.freeSpace(ForRows) = logicalHeight() - trackBasedLogicalHeight;
+
// 3- If the min-content contribution of any grid items have changed based
// on the row sizes calculated in step 2, steps 1 and 2 are repeated with
// the new min-content contribution (once only).
@@ -3227,7 +3233,10 @@ ContentAlignmentData LayoutGrid::computeContentPositionAndDistributionOffset(
OverflowAlignment overflow =
isRowAxis ? styleRef().justifyContentOverflowAlignment()
: styleRef().alignContentOverflowAlignment();
- if (availableFreeSpace <= 0 && overflow == OverflowAlignmentSafe)
+ // TODO (lajava): Default value for overflow isn't exaclty as 'unsafe'.
+ // https://drafts.csswg.org/css-align/#overflow-values
+ if (availableFreeSpace == 0 ||
+ (availableFreeSpace < 0 && overflow == OverflowAlignmentSafe))
return {LayoutUnit(), LayoutUnit()};
switch (position) {
« 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