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

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

Issue 1407633003: [css-grid] Implementation of Baseline Self-Alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do no update the intrinsic size. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp
diff --git a/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp b/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp
index 1664c868cba5f4cbd255fec17eafee02b85130b9..e7f42fc766bf391adf95a355232720dc60b2ef0f 100644
--- a/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp
+++ b/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp
@@ -275,6 +275,13 @@ LayoutUnit GridTrackSizingAlgorithmStrategy::logicalHeightForChild(
child.clearOverrideLogicalContentHeight();
child.layoutIfNeeded();
+ GridAxis baselineAxis =
+ layoutGrid()->isOrthogonalChild(child) ? GridRowAxis : GridColumnAxis;
+ if (layoutGrid()->isBaselineAlignmentForChild(child, baselineAxis) &&
+ layoutGrid()->isBaselineContextComputed(baselineAxis)) {
+ auto& group = layoutGrid()->getBaselineGroupForChild(child, baselineAxis);
+ return group.maxAscent() + group.maxDescent();
+ }
return child.logicalHeight() + child.marginLogicalHeight();
}
@@ -312,6 +319,11 @@ LayoutUnit GridTrackSizingAlgorithmStrategy::minContentForChild(
if (direction() == ForColumns &&
m_algorithm.m_sizingOperation == IntrinsicSizeComputation) {
DCHECK(layoutGrid()->isOrthogonalChild(child));
+ if (layoutGrid()->isBaselineAlignmentForChild(child, GridRowAxis) &&
+ layoutGrid()->isBaselineContextComputed(GridRowAxis)) {
+ auto& group = layoutGrid()->getBaselineGroupForChild(child, GridRowAxis);
+ return group.maxAscent() + group.maxDescent();
+ }
return child.logicalHeight() + child.marginLogicalHeight();
}

Powered by Google App Engine
This is Rietveld 408576698