| Index: Source/core/css/resolver/StyleAdjuster.cpp
|
| diff --git a/Source/core/css/resolver/StyleAdjuster.cpp b/Source/core/css/resolver/StyleAdjuster.cpp
|
| index 5d7c1aa7b235643035d2c71cb92d93279de623bd..b8ffe49313c1ce9b67e375f3cd034605fb375424 100644
|
| --- a/Source/core/css/resolver/StyleAdjuster.cpp
|
| +++ b/Source/core/css/resolver/StyleAdjuster.cpp
|
| @@ -254,6 +254,60 @@ void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty
|
| style->setTextAutosizingMultiplier(e->renderStyle()->textAutosizingMultiplier());
|
| style->setUnique();
|
| }
|
| +
|
| + adjustStyleForAlignment(*style, *parentStyle);
|
| +}
|
| +
|
| +void StyleAdjuster::adjustStyleForAlignment(RenderStyle& style, const RenderStyle& parentStyle)
|
| +{
|
| + bool isFlexOrGrid = style.isDisplayFlexibleOrGridBox();
|
| + bool absolutePositioned = style.position() == AbsolutePosition;
|
| +
|
| + // 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.
|
| + if (style.justifyItems() == ItemPositionAuto) {
|
| + if (parentStyle.justifyItemsPositionType() == LegacyPosition) {
|
| + style.setJustifyItems(parentStyle.justifyItems());
|
| + style.setJustifyItemsPositionType(parentStyle.justifyItemsPositionType());
|
| + } else if (isFlexOrGrid) {
|
| + style.setJustifyItems(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.
|
| + if (style.justifySelf() == ItemPositionAuto) {
|
| + if (absolutePositioned) {
|
| + style.setJustifySelf(ItemPositionStretch);
|
| + } else {
|
| + style.setJustifySelf(parentStyle.justifyItems());
|
| + style.setJustifySelfOverflowAlignment(parentStyle.justifyItemsOverflowAlignment());
|
| + }
|
| + }
|
| +
|
| + // The 'auto' keyword computes to:
|
| + // - 'stretch' for flex containers and grid containers,
|
| + // - 'start' for everything else.
|
| + if (style.alignItems() == ItemPositionAuto) {
|
| + if (isFlexOrGrid)
|
| + style.setAlignItems(ItemPositionStretch);
|
| + }
|
| +
|
| + // 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.
|
| + if (style.alignSelf() == ItemPositionAuto) {
|
| + if (absolutePositioned) {
|
| + style.setAlignSelf(ItemPositionStretch);
|
| + } else {
|
| + style.setAlignSelf(parentStyle.alignItems());
|
| + style.setAlignSelfOverflowAlignment(parentStyle.alignItemsOverflowAlignment());
|
| + }
|
| + }
|
| }
|
|
|
| void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* parentStyle, Element& element)
|
|
|