| Index: Source/core/css/CSSComputedStyleDeclaration.cpp
|
| diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
|
| index d34ce94922e4e15fcff7e6cb129cc3f92f423e0b..2a787abbb71619f20f43cc80bedda0893f3d35ec 100644
|
| --- a/Source/core/css/CSSComputedStyleDeclaration.cpp
|
| +++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
|
| @@ -1556,6 +1556,17 @@ Node* CSSComputedStyleDeclaration::styledNode() const
|
| return m_node.get();
|
| }
|
|
|
| +static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element)
|
| +{
|
| + if (position != ItemPositionAuto)
|
| + return position;
|
| +
|
| + bool isFlexOrGrid = element && element->computedStyle()
|
| + && element->computedStyle()->isDisplayFlexibleOrGridBox();
|
| +
|
| + return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart;
|
| +}
|
| +
|
| static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositionType positionType)
|
| {
|
| RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
|
| @@ -1886,18 +1897,9 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu
|
| case CSSPropertyAlignContent:
|
| return cssValuePool().createValue(style->alignContent());
|
| case CSSPropertyAlignItems:
|
| - return valueForItemPositionWithOverflowAlignment(style->alignItems(), style->alignItemsOverflowAlignment(), NonLegacyPosition);
|
| - case CSSPropertyAlignSelf: {
|
| - ItemPosition alignSelf = style->alignSelf();
|
| - if (alignSelf == ItemPositionAuto) {
|
| - Node* parent = styledNode->parentNode();
|
| - if (parent && parent->computedStyle())
|
| - alignSelf = parent->computedStyle()->alignItems();
|
| - else
|
| - alignSelf = ItemPositionStretch;
|
| - }
|
| - return valueForItemPositionWithOverflowAlignment(alignSelf, style->alignSelfOverflowAlignment(), NonLegacyPosition);
|
| - }
|
| + return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->alignItems(), styledNode), style->alignItemsOverflowAlignment(), NonLegacyPosition);
|
| + case CSSPropertyAlignSelf:
|
| + return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->alignSelf(), styledNode->parentNode()), style->alignSelfOverflowAlignment(), NonLegacyPosition);
|
| case CSSPropertyFlex:
|
| return valuesForShorthandProperty(flexShorthand());
|
| case CSSPropertyFlexBasis:
|
| @@ -2061,47 +2063,10 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu
|
| return CSSPrimitiveValue::create(style->imageRendering());
|
| case CSSPropertyIsolation:
|
| return cssValuePool().createValue(style->isolation());
|
| - case CSSPropertyJustifyItems: {
|
| - // FIXME: I would like this to be tested; is not possible with a layout test but it
|
| - // should be possible using a method similar to https://codereview.chromium.org/351973004
|
| - ItemPosition justifyItems = style->justifyItems();
|
| - ItemPositionType positionType = style->justifyItemsPositionType();
|
| - if (justifyItems == ItemPositionAuto) {
|
| - Node* parent = styledNode->parentNode();
|
| - // If the inherited value of justify-items includes the legacy keyword, 'auto'
|
| - // computes to the the inherited value.
|
| - if (parent && parent->computedStyle() && parent->computedStyle()->justifyItemsPositionType()) {
|
| - justifyItems = parent->computedStyle()->justifyItems();
|
| - positionType = parent->computedStyle()->justifyItemsPositionType();
|
| - // Otherwise, auto computes to:
|
| - } else if (style->isDisplayFlexibleOrGridBox()) {
|
| - // 'stretch' for flex containers and grid containers.
|
| - justifyItems = ItemPositionStretch;
|
| - } else {
|
| - // 'start' for everything else.
|
| - justifyItems = ItemPositionStart;
|
| - }
|
| - }
|
| - return valueForItemPositionWithOverflowAlignment(justifyItems, style->justifyItemsOverflowAlignment(), positionType);
|
| - }
|
| - case CSSPropertyJustifySelf: {
|
| - // FIXME: I would like this to be tested; is not possible with a layout test but it
|
| - // should be possible using a method similar to https://codereview.chromium.org/351973004
|
| - ItemPosition justifySelf = style->justifySelf();
|
| - if (justifySelf == ItemPositionAuto) {
|
| - // The auto keyword computes to stretch on absolutely-positioned elements,
|
| - if (style->position() == AbsolutePosition) {
|
| - justifySelf = ItemPositionStretch;
|
| - } else {
|
| - // and to the computed value of justify-items on the parent (minus
|
| - // any legacy keywords) on all other boxes.
|
| - Node* parent = styledNode->parentNode();
|
| - if (parent && parent->computedStyle())
|
| - justifySelf = parent->computedStyle()->justifyItems();
|
| - }
|
| - }
|
| - return valueForItemPositionWithOverflowAlignment(justifySelf, style->justifySelfOverflowAlignment(), NonLegacyPosition);
|
| - }
|
| + case CSSPropertyJustifyItems:
|
| + return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->justifyItems(), styledNode), style->justifyItemsOverflowAlignment(), style->justifyItemsPositionType());
|
| + case CSSPropertyJustifySelf:
|
| + return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->justifySelf(), styledNode->parentNode()), style->justifySelfOverflowAlignment(), NonLegacyPosition);
|
| case CSSPropertyLeft:
|
| return valueForPositionOffset(*style, CSSPropertyLeft, renderer);
|
| case CSSPropertyLetterSpacing:
|
|
|