Index: Source/core/css/CSSComputedStyleDeclaration.cpp |
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp |
index f1534a5654d0d71728f00f0b97dee1260915e376..7bb9d6cd4285bfa8494fb201343ca32319ea6518 100644 |
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp |
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp |
@@ -1548,6 +1548,22 @@ static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element) |
return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart; |
} |
+static void resolveAlignmentContentAuto(RenderStyle& style) |
+{ |
+ if (style.justifyContent() != ContentPositionAuto || style.justifyContentDistribution() != ContentDistributionDefault) |
+ return; |
+ |
+ // Block Containers: For table cells, the behavior of the 'auto' depends on the computed |
+ // value of 'vertical-align', otherwise behaves as 'start'. |
+ // Flex Containers: 'auto' computes to 'stretch'. |
+ // Grid Containers: 'auto' computes to 'start', and 'stretch' behaves like 'start'. |
+ if (style.isDisplayFlexibleBox()) { |
+ style.setJustifyContent(ContentPositionFlexStart); |
+ } else { |
+ style.setJustifyContent(ContentPositionStart); |
+ } |
+} |
+ |
static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositionType positionType) |
{ |
RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); |
@@ -1560,6 +1576,20 @@ static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig |
return result.release(); |
} |
+static PassRefPtrWillBeRawPtr<CSSValueList> valueForContentPositionAndDistributionWithOverflowAlignment(ContentPosition position, OverflowAlignment overflowAlignment, ContentDistributionType distribution) |
+{ |
+ RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); |
+ if (distribution != ContentDistributionDefault) |
+ result->append(CSSPrimitiveValue::create(distribution)); |
+ if (distribution == ContentDistributionDefault || position != ContentPositionAuto) |
+ result->append(CSSPrimitiveValue::create(position)); |
+ if ((position >= ContentPositionCenter || distribution != ContentDistributionDefault) && overflowAlignment != OverflowAlignmentDefault) |
+ result->append(CSSPrimitiveValue::create(overflowAlignment)); |
+ ASSERT(result->length() > 0); |
+ ASSERT(result->length() <= 3); |
+ return result.release(); |
+} |
+ |
PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const |
{ |
Node* styledNode = this->styledNode(); |
@@ -1847,7 +1877,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu |
case CSSPropertyFlexWrap: |
return cssValuePool().createValue(style->flexWrap()); |
case CSSPropertyJustifyContent: |
- return cssValuePool().createValue(style->justifyContent()); |
+ resolveAlignmentContentAuto(*style); |
+ return valueForContentPositionAndDistributionWithOverflowAlignment(style->justifyContent(), style->justifyContentOverflowAlignment(), style->justifyContentDistribution()); |
case CSSPropertyOrder: |
return cssValuePool().createValue(style->order(), CSSPrimitiveValue::CSS_NUMBER); |
case CSSPropertyFloat: |