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

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: Improving the skipped tesst by solving some rounding issues Created 3 years, 8 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 e7ec0d99eedbbb33150b39498edd23d560c96ba1..2d251c65ac86e7df961147e8e5ea2d8be06dce44 100644
--- a/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp
+++ b/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp
@@ -276,6 +276,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();
}
@@ -304,6 +311,16 @@ LayoutUnit GridTrackSizingAlgorithmStrategy::minContentForChild(
return child.minPreferredLogicalWidth() + marginLogicalWidth;
}
+ 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();
+ }
+ }
+
if (updateOverrideContainingBlockContentSizeForChild(child,
childInlineDirection))
setGridItemNeedsLayout(child);

Powered by Google App Engine
This is Rietveld 408576698