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

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

Issue 134013002: Upgrade align-self and align-items parsing to CSS 3 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Really fix the tests Created 6 years, 11 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
Index: Source/core/css/CSSComputedStyleDeclaration.cpp
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index 14b1fb4dbe63ee44e7a4bde8a069af1dea325ffa..ce60899eff6cf79c074af4bb94594dcdd28be7f6 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -1520,6 +1520,15 @@ Node* CSSComputedStyleDeclaration::styledNode() const
return m_node.get();
}
+static PassRefPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPosition itemPosition, OverflowAlignment overflowAlignment)
+{
+ RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
+ result->append(CSSPrimitiveValue::create(itemPosition));
+ if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlignmentDefault)
+ result->append(CSSPrimitiveValue::create(overflowAlignment));
+ return result.release();
+}
+
PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
{
Node* styledNode = this->styledNode();
@@ -1856,15 +1865,18 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
case CSSPropertyAlignContent:
return cssValuePool().createValue(style->alignContent());
case CSSPropertyAlignItems:
- return cssValuePool().createValue(style->alignItems());
- case CSSPropertyAlignSelf:
- if (style->alignSelf() == AlignAuto) {
+ return valueForItemPositionWithOverflowAlignment(style->alignItems(), style->alignItemsOverflowAlignment());
+ case CSSPropertyAlignSelf: {
+ ItemPosition alignSelf = style->alignSelf();
+ if (alignSelf == ItemPositionAuto) {
Node* parent = styledNode->parentNode();
if (parent && parent->computedStyle())
- return cssValuePool().createValue(parent->computedStyle()->alignItems());
- return cssValuePool().createValue(AlignStretch);
+ alignSelf = parent->computedStyle()->alignItems();
+ else
+ alignSelf = ItemPositionStretch;
}
- return cssValuePool().createValue(style->alignSelf());
+ return valueForItemPositionWithOverflowAlignment(alignSelf, style->alignSelfOverflowAlignment());
+ }
case CSSPropertyFlex:
return valuesForShorthandProperty(flexShorthand());
case CSSPropertyFlexBasis:
@@ -1991,13 +2003,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
return CSSPrimitiveValue::create(style->imageRendering());
case CSSPropertyIsolation:
return cssValuePool().createValue(style->isolation());
- case CSSPropertyJustifySelf: {
- RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
- result->append(CSSPrimitiveValue::create(style->justifySelf()));
- if (style->justifySelf() >= ItemPositionCenter && style->justifySelfOverflowAlignment() != OverflowAlignmentDefault)
- result->append(CSSPrimitiveValue::create(style->justifySelfOverflowAlignment()));
- return result.release();
- }
+ case CSSPropertyJustifySelf:
+ return valueForItemPositionWithOverflowAlignment(style->justifySelf(), style->justifySelfOverflowAlignment());
case CSSPropertyLeft:
return valueForPositionOffset(*style, CSSPropertyLeft, renderer);
case CSSPropertyLetterSpacing:

Powered by Google App Engine
This is Rietveld 408576698