Chromium Code Reviews| Index: Source/core/css/resolver/StyleAdjuster.cpp |
| diff --git a/Source/core/css/resolver/StyleAdjuster.cpp b/Source/core/css/resolver/StyleAdjuster.cpp |
| index 91edb430ee0bd5e1f29df19ae155d704db5defaa..b1b9fca52a68df16cc43f681cf9f9c742a4312df 100644 |
| --- a/Source/core/css/resolver/StyleAdjuster.cpp |
| +++ b/Source/core/css/resolver/StyleAdjuster.cpp |
| @@ -254,6 +254,62 @@ void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty |
| style->setTextAutosizingMultiplier(e->renderStyle()->textAutosizingMultiplier()); |
| style->setUnique(); |
| } |
| + |
| + adjustStyleForAlignment(style, parentStyle); |
| +} |
| + |
| +void StyleAdjuster::adjustStyleForAlignment(RenderStyle* style, RenderStyle* parentStyle) |
|
esprehn
2014/07/12 00:39:19
These should both be references.
|
| +{ |
| + // If the inherited value of justify-items includes the legacy keyword, 'auto' |
| + // computes to the the inherited value. |
| + if (style->justifyItems() == ItemPositionAuto) { |
| + if (parentStyle->justifyItemsPositionType() == LegacyPosition) { |
| + style->setJustifyItems(parentStyle->justifyItems()); |
| + style->setJustifyItemsPositionType(parentStyle->justifyItemsPositionType()); |
| + // Otherwise, auto computes to: |
| + } else if (style->isDisplayFlexibleOrGridBox()) { |
| + // 'stretch' for flex containers and grid containers. |
| + style->setJustifyItems(ItemPositionStretch); |
| + } else { |
| + // 'start' for everything else. |
| + style->setJustifyItems(ItemPositionStart); |
| + } |
| + } |
| + |
| + // The 'auto' keyword computes to 'stretch' on absolutely-positioned elements, |
| + if (style->justifySelf() == ItemPositionAuto) { |
| + if (style->position() == AbsolutePosition) { |
| + style->setJustifySelf(ItemPositionStretch); |
| + } else { |
| + // and to the computed value of justify-items on the parent (minus |
| + // any legacy keywords) on all other boxes. |
| + style->setJustifySelf(parentStyle->justifyItems()); |
| + style->setJustifySelfOverflowAlignment(parentStyle->justifyItemsOverflowAlignment()); |
| + } |
| + } |
| + |
| + // The 'auto' keyword computes to: |
| + if (style->alignItems() == ItemPositionAuto) { |
| + if (style->isDisplayFlexibleOrGridBox()) { |
| + // 'stretch' for flex containers and grid containers, |
| + style->setAlignItems(ItemPositionStretch); |
| + } else { |
| + // 'start' for everything else |
| + style->setAlignItems(ItemPositionStart); |
| + } |
| + } |
| + |
| + // The 'auto' keyword computes to 'stretch' on absolutely-positioned elements, |
| + if (style->alignSelf() == ItemPositionAuto) { |
| + if ((style->position() == AbsolutePosition) || (parentStyle->alignItems() == ItemPositionAuto)) { |
| + style->setAlignSelf(ItemPositionStretch); |
| + } else { |
| + // and to the computed value of align-items on the parent (minus |
| + // any 'legacy' keywords) on all other boxes. |
| + style->setAlignSelf(parentStyle->alignItems()); |
| + style->setAlignSelfOverflowAlignment(parentStyle->alignItemsOverflowAlignment()); |
| + } |
| + } |
| } |
| void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* parentStyle, Element& element) |