Chromium Code Reviews| Index: Source/core/rendering/style/RenderStyle.cpp |
| diff --git a/Source/core/rendering/style/RenderStyle.cpp b/Source/core/rendering/style/RenderStyle.cpp |
| index d89e8f6753fdc0e58afeeaa2c7cc5dd4aad2201b..d4a1090c03116a916f720a0bedaa87ffb40ca681 100644 |
| --- a/Source/core/rendering/style/RenderStyle.cpp |
| +++ b/Source/core/rendering/style/RenderStyle.cpp |
| @@ -179,7 +179,9 @@ StyleRecalcChange RenderStyle::stylePropagationDiff(const RenderStyle* oldStyle, |
| || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FIRST_LETTER) |
| || oldStyle->columnSpan() != newStyle->columnSpan() |
| || !oldStyle->contentDataEquivalent(newStyle) |
| - || oldStyle->hasTextCombine() != newStyle->hasTextCombine()) |
| + || oldStyle->hasTextCombine() != newStyle->hasTextCombine() |
| + || oldStyle->justifyItems() != newStyle->justifyItems() |
| + || oldStyle->alignItems() != newStyle->alignItems()) |
| return Reattach; |
| if (*oldStyle == *newStyle) |
| @@ -1693,4 +1695,67 @@ float calcBorderRadiiConstraintScaleFor(const FloatRect& rect, const FloatRounde |
| return factor; |
| } |
| + |
| +void RenderStyle::resolveJustifyItemsAuto(const RenderStyle& parentStyle) |
| +{ |
| + if (justifyItems() != ItemPositionAuto) |
| + return; |
| + |
| + // 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. |
|
svillar
2014/07/29 10:40:05
I don't think you need these comments. Code is sel
|
| + if (parentStyle.justifyItemsPositionType() == LegacyPosition) { |
| + setJustifyItems(parentStyle.justifyItems()); |
| + setJustifyItemsPositionType(parentStyle.justifyItemsPositionType()); |
| + } else if (isDisplayFlexibleOrGridBox()) { |
| + setJustifyItems(ItemPositionStretch); |
| + } |
| +} |
| + |
| +void RenderStyle::resolveJustifySelfAuto(const RenderStyle& parentStyle) |
| +{ |
| + if (justifySelf() != ItemPositionAuto) |
| + return; |
| + |
| + // 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. |
|
svillar
2014/07/29 10:40:05
Ditto.
|
| + if (position() == AbsolutePosition) { |
| + setJustifySelf(ItemPositionStretch); |
| + } else { |
| + setJustifySelf(parentStyle.justifyItems()); |
| + setJustifySelfOverflowAlignment(parentStyle.justifyItemsOverflowAlignment()); |
| + } |
| +} |
| + |
| +void RenderStyle::resolveAlignItemsAuto(const RenderStyle& parentStyle) |
| +{ |
| + if (alignItems() != ItemPositionAuto) |
| + return; |
| + |
| + // The 'auto' keyword computes to: |
| + // 'stretch' for flex containers and grid containers, |
| + // 'start' for everything else. |
|
svillar
2014/07/29 10:40:05
Ditto.
|
| + if (isDisplayFlexibleOrGridBox()) |
| + setAlignItems(ItemPositionStretch); |
| +} |
| + |
| +void RenderStyle::resolveAlignSelfAuto(const RenderStyle& parentStyle) |
| +{ |
| + if (alignSelf() != ItemPositionAuto) |
| + return; |
| + |
| + // The 'auto' keyword computes to 'stretch' on absolutely-positioned elements, |
| + // and to the computed value of align-items on the parent (minus |
| + // any 'legacy' keywords) on all other boxes. |
|
svillar
2014/07/29 10:40:05
Ditto.
|
| + if ((position() == AbsolutePosition)) { |
| + setAlignSelf(ItemPositionStretch); |
| + } else { |
| + setAlignSelf(parentStyle.alignItems()); |
| + setAlignSelfOverflowAlignment(parentStyle.alignItemsOverflowAlignment()); |
| + } |
| +} |
| + |
| } // namespace blink |