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); |