Chromium Code Reviews| 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 e9d00961ae56359570e6530bdc8e647c2c108593..287009ecc2b54890b2498d91ebb5725af657a3f9 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
| @@ -2194,20 +2194,23 @@ void LayoutGrid::applyStretchAlignmentToChildIfNeeded(LayoutBox& child) |
| auto& childStyle = child.styleRef(); |
| bool isHorizontalMode = isHorizontalWritingMode(); |
| - bool hasAutoSizeInColumnAxis = isHorizontalMode ? childStyle.height().isAuto() : childStyle.width().isAuto(); |
| - bool allowedToStretchChildAlongColumnAxis = hasAutoSizeInColumnAxis && !childStyle.marginBeforeUsing(style()).isAuto() && !childStyle.marginAfterUsing(style()).isAuto(); |
| - if (allowedToStretchChildAlongColumnAxis && ComputedStyle::resolveAlignment(styleRef(), childStyle, ItemPositionStretch) == ItemPositionStretch) { |
| - // TODO (lajava): If the child has orthogonal flow, then it already has an override height set, so use it. |
| - // TODO (lajava): grid track sizing and positioning do not support orthogonal modes yet. |
| - if (child.isHorizontalWritingMode() == isHorizontalMode) { |
| - LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildBeforeStretching(child.overrideContainingBlockContentLogicalHeight(), child); |
| - LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(stretchedLogicalHeight, LayoutUnit(-1)); |
| - child.setOverrideLogicalContentHeight(desiredLogicalHeight - child.borderAndPaddingLogicalHeight()); |
| - if (desiredLogicalHeight != child.logicalHeight()) { |
| - // TODO (lajava): Can avoid laying out here in some cases. See https://webkit.org/b/87905. |
| - child.setLogicalHeight(LayoutUnit()); |
| - child.setNeedsLayout(LayoutInvalidationReason::GridChanged); |
| - } |
| + bool childHasAutoSizeInColumnAxis = isHorizontalMode ? childStyle.height().isAuto() : childStyle.width().isAuto(); |
| + bool childHasAutoSizeInRowAxis = isHorizontalMode ? childStyle.width().isAuto() : childStyle.height().isAuto(); |
| + bool allowedToStretchChildAlongColumnAxis = childHasAutoSizeInColumnAxis && !hasAutoMarginsInColumnAxis(child); |
| + bool allowedToStretchChildAlongRowAxis = childHasAutoSizeInRowAxis && !hasAutoMarginsInRowAxis(child); |
| + bool stretchingAlongRowAxis = ComputedStyle::resolveJustification(styleRef(), childStyle, ItemPositionStretch) == ItemPositionStretch; |
| + bool stretchingAlognColumnAxis = ComputedStyle::resolveAlignment(styleRef(), childStyle, ItemPositionStretch) == ItemPositionStretch; |
|
cbiesinger
2016/07/22 16:44:00
Alogn -> Along
|
| + |
| + GridTrackSizingDirection childBlockDirection = flowAwareDirectionForChild(child, ForRows); |
| + bool allowedToStretchChildBlockSize = childBlockDirection == ForRows ? allowedToStretchChildAlongColumnAxis && stretchingAlognColumnAxis : allowedToStretchChildAlongRowAxis && stretchingAlongRowAxis; |
| + if (allowedToStretchChildBlockSize) { |
| + LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildBeforeStretching(overrideContainingBlockContentSizeForChild(child, childBlockDirection), child); |
| + LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(stretchedLogicalHeight, LayoutUnit(-1)); |
| + child.setOverrideLogicalContentHeight(desiredLogicalHeight - child.borderAndPaddingLogicalHeight()); |
| + if (desiredLogicalHeight != child.logicalHeight()) { |
| + // TODO (lajava): Can avoid laying out here in some cases. See https://webkit.org/b/87905. |
| + child.setLogicalHeight(LayoutUnit()); |
| + child.setNeedsLayout(LayoutInvalidationReason::GridChanged); |
| } |
| } |
| } |