Index: third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp |
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp |
index 27e5b85eb4b3e76cb6bce9a1559ead09f64c209a..59f196b05989a5ab856bab8b2c80320080457f5a 100644 |
--- a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp |
+++ b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp |
@@ -274,38 +274,31 @@ void StyleAdjuster::adjustStyleForFirstLetter(ComputedStyle& style) |
void StyleAdjuster::adjustStyleForAlignment(ComputedStyle& style, const ComputedStyle& parentStyle) |
{ |
- bool isFlexOrGrid = style.isDisplayFlexibleOrGridBox(); |
- bool absolutePositioned = style.position() == AbsolutePosition; |
+ // To avoid needing to copy the RareNonInheritedData, we could repurporse the 'auto' |
Timothy Loh
2016/05/23 05:45:39
The word 'could' here suggests we don't actually d
jfernandez
2016/05/25 18:26:49
Done.
|
+ // flag to not just mean 'auto' prior to running the StyleAdjuster but also mean 'normal' |
+ // after running it. |
- // If the inherited value of justify-items includes the legacy keyword, 'auto' |
+ // If the inherited value of justify-items includes the 'legacy' keyword, 'auto' |
// computes to the the inherited value. |
- // Otherwise, auto computes to: |
- // - 'stretch' for flex containers and grid containers. |
- // - 'start' for everything else. |
+ // Otherwise, 'auto' computes to 'normal'. |
if (style.justifyItemsPosition() == ItemPositionAuto) { |
if (parentStyle.justifyItemsPositionType() == LegacyPosition) |
style.setJustifyItems(parentStyle.justifyItems()); |
- else if (isFlexOrGrid) |
- style.setJustifyItemsPosition(ItemPositionStretch); |
} |
- // The 'auto' keyword computes to 'stretch' on absolutely-positioned elements, |
- // and to the computed value of justify-items on the parent (minus |
- // any legacy keywords) on all other boxes. |
+ // The 'auto' keyword computes the computed value of justify-items on the parent (minus |
+ // any legacy keywords), or 'normal' if the box has no parent. |
if (style.justifySelfPosition() == ItemPositionAuto) { |
- if (absolutePositioned) |
- style.setJustifySelfPosition(ItemPositionStretch); |
- else |
+ if (parentStyle.justifyItemsPositionType() == LegacyPosition) |
+ style.setJustifySelfPosition(parentStyle.justifyItemsPosition()); |
+ else if (parentStyle.justifyItemsPosition() != ItemPositionAuto) |
style.setJustifySelf(parentStyle.justifyItems()); |
} |
- // The 'auto' keyword computes to: |
- // - 'stretch' for flex containers and grid containers, |
- // - 'start' for everything else. |
- if (style.alignItemsPosition() == ItemPositionAuto) { |
- if (isFlexOrGrid) |
- style.setAlignItemsPosition(ItemPositionStretch); |
- } |
+ // The 'auto' keyword computes the computed value of align-items on the parent |
+ // or 'normal' if the box has no parent. |
+ if (style.alignSelfPosition() == ItemPositionAuto && parentStyle.alignItemsPosition() != ItemPositionNormal) |
+ style.setAlignSelf(parentStyle.alignItems()); |
} |
void StyleAdjuster::adjustStyleForHTMLElement(ComputedStyle& style, const ComputedStyle& parentStyle, HTMLElement& element) |