Index: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp |
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp |
index ec34824adfd266e4da89f93d8a5e6d9a3b495aa2..f8c0cf3f63a79213743c8a104cd8ed7eabab1f19 100644 |
--- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp |
+++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp |
@@ -435,25 +435,15 @@ static CSSValue* valueForReflection(const StyleReflection* reflection, const Com |
return CSSReflectValue::create(direction, offset, valueForNinePieceImage(reflection->mask(), style)); |
} |
-static ItemPosition resolveAlignmentAuto(ItemPosition position, const ComputedStyle* style) |
-{ |
- if (position != ItemPositionAuto) |
- return position; |
- |
- if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
- return ItemPositionStretch; |
- |
- return isFlexOrGrid(style) ? ItemPositionStretch : ItemPositionStart; |
-} |
- |
-static CSSValueList* valueForItemPositionWithOverflowAlignment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositionType positionType) |
+static CSSValueList* valueForItemPositionWithOverflowAlignment(const StyleSelfAlignmentData& data) |
{ |
CSSValueList* result = CSSValueList::createSpaceSeparated(); |
- if (positionType == LegacyPosition) |
+ if (data.positionType() == LegacyPosition) |
result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); |
- result->append(CSSPrimitiveValue::create(itemPosition)); |
- if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlignmentDefault) |
- result->append(CSSPrimitiveValue::create(overflowAlignment)); |
+ // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto' flag to not just mean 'auto' prior to running the StyleAdjuster but also mean 'normal' after running it. |
+ result->append(CSSPrimitiveValue::create(data.position() == ItemPositionAuto ? ItemPositionNormal : data.position())); |
+ if (data.position() >= ItemPositionCenter && data.overflow() != OverflowAlignmentDefault) |
+ result->append(CSSPrimitiveValue::create(data.overflow())); |
ASSERT(result->length() <= 2); |
return result; |
} |
@@ -1873,16 +1863,9 @@ CSSValue* ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const Comp |
case CSSPropertyAlignContent: |
return valueForContentPositionAndDistributionWithOverflowAlignment(style.alignContent()); |
case CSSPropertyAlignItems: |
- return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style.alignItemsPosition(), &style), style.alignItemsOverflowAlignment(), NonLegacyPosition); |
- case CSSPropertyAlignSelf: { |
- ItemPosition position = style.alignSelfPosition(); |
- if (position == ItemPositionAuto) { |
- // TODO(lajava): This code doesn't work for ShadowDOM (see Node::parentComputedStyle) |
- const ComputedStyle* parentStyle = styledNode->parentNode() ? styledNode->parentNode()->ensureComputedStyle() : nullptr; |
- position = parentStyle ? ComputedStyle::resolveAlignment(*parentStyle, style, resolveAlignmentAuto(parentStyle->alignItemsPosition(), parentStyle)) : ItemPositionStart; |
- } |
- return valueForItemPositionWithOverflowAlignment(position, style.alignSelfOverflowAlignment(), NonLegacyPosition); |
- } |
+ return valueForItemPositionWithOverflowAlignment(style.alignItems()); |
+ case CSSPropertyAlignSelf: |
+ return valueForItemPositionWithOverflowAlignment(style.alignSelf()); |
case CSSPropertyFlex: |
return valuesForShorthandProperty(flexShorthand(), style, layoutObject, styledNode, allowVisitedStyle); |
case CSSPropertyFlexBasis: |
@@ -2037,11 +2020,9 @@ CSSValue* ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const Comp |
case CSSPropertyIsolation: |
return cssValuePool().createValue(style.isolation()); |
case CSSPropertyJustifyItems: |
- return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style.justifyItemsPosition(), &style), style.justifyItemsOverflowAlignment(), style.justifyItemsPositionType()); |
- case CSSPropertyJustifySelf: { |
- Node* parent = styledNode->parentNode(); |
- return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style.justifySelfPosition(), parent ? parent->ensureComputedStyle() : nullptr), style.justifySelfOverflowAlignment(), NonLegacyPosition); |
- } |
+ return valueForItemPositionWithOverflowAlignment(style.justifyItems()); |
+ case CSSPropertyJustifySelf: |
+ return valueForItemPositionWithOverflowAlignment(style.justifySelf()); |
case CSSPropertyLeft: |
return valueForPositionOffset(style, CSSPropertyLeft, layoutObject); |
case CSSPropertyLetterSpacing: |