Index: Source/core/css/CSSComputedStyleDeclaration.cpp |
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp |
index d34ce94922e4e15fcff7e6cb129cc3f92f423e0b..2eb9f06073ccc3eb75fc5af06876e8b49ed65e70 100644 |
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp |
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp |
@@ -1558,11 +1558,12 @@ Node* CSSComputedStyleDeclaration::styledNode() const |
static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositionType positionType) |
{ |
+ ItemPosition resolvedPosition = itemPosition == ItemPositionAuto ? ItemPositionStart : itemPosition; |
svillar
2014/07/29 10:40:05
Maybe we need some ASSERT here? I guess you're ass
|
RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); |
if (positionType == LegacyPosition) |
result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); |
- result->append(CSSPrimitiveValue::create(itemPosition)); |
- if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlignmentDefault) |
+ result->append(CSSPrimitiveValue::create(resolvedPosition)); |
+ if (resolvedPosition >= ItemPositionCenter && overflowAlignment != OverflowAlignmentDefault) |
result->append(CSSPrimitiveValue::create(overflowAlignment)); |
ASSERT(result->length() <= 2); |
return result.release(); |
@@ -1887,17 +1888,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu |
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); |
- } |
+ case CSSPropertyAlignSelf: |
+ return valueForItemPositionWithOverflowAlignment(style->alignSelf(), style->alignSelfOverflowAlignment(), NonLegacyPosition); |
case CSSPropertyFlex: |
return valuesForShorthandProperty(flexShorthand()); |
case CSSPropertyFlexBasis: |
@@ -2061,47 +2053,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(style->justifyItems(), style->justifyItemsOverflowAlignment(), style->justifyItemsPositionType()); |
+ case CSSPropertyJustifySelf: |
+ return valueForItemPositionWithOverflowAlignment(style->justifySelf(), style->justifySelfOverflowAlignment(), NonLegacyPosition); |
case CSSPropertyLeft: |
return valueForPositionOffset(*style, CSSPropertyLeft, renderer); |
case CSSPropertyLetterSpacing: |