Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Unified Diff: Source/core/css/CSSComputedStyleDeclaration.cpp

Issue 636993002: [CSS Grid Layout] Upgrade justify-content parsing to CSS3 Box Alignment spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebaseline some tests expectations. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/CSSContentDistributionValue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSComputedStyleDeclaration.cpp
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index 7696f213d8697b8bb6d83a7b7e924da7ec232a32..1826778f75cbd4f6f455a12d1fba71d6a0da4637 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -1545,6 +1545,17 @@ static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element)
return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart;
}
+static ContentPosition resolveContentAlignmentAuto(ContentPosition position, ContentDistributionType distribution, Node* element)
+{
+ if (position != ContentPositionAuto || distribution != ContentDistributionDefault)
+ return position;
+
+ bool isFlex = element && element->computedStyle()
+ && element->computedStyle()->isDisplayFlexibleBox();
+
+ return isFlex ? ContentPositionFlexStart : ContentPositionStart;
+}
+
static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositionType positionType)
{
RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
@@ -1557,6 +1568,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();
@@ -1844,7 +1869,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu
case CSSPropertyFlexWrap:
return cssValuePool().createValue(style->flexWrap());
case CSSPropertyJustifyContent:
- return cssValuePool().createValue(style->justifyContent());
+ return valueForContentPositionAndDistributionWithOverflowAlignment(resolveContentAlignmentAuto(style->justifyContent(), style->justifyContentDistribution(), styledNode), style->justifyContentOverflowAlignment(), style->justifyContentDistribution());
case CSSPropertyOrder:
return cssValuePool().createValue(style->order(), CSSPrimitiveValue::CSS_NUMBER);
case CSSPropertyFloat:
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/CSSContentDistributionValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698