Index: third_party/WebKit/Source/core/style/ComputedStyle.cpp |
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
index ed5d4b0a435374138ecf6adea549edd43fcb2fe1..8497c0de32f2a60959ed69782a02910325021715 100644 |
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
@@ -186,8 +186,7 @@ StyleRecalcChange ComputedStyle::stylePropagationDiff(const ComputedStyle* oldSt |
if (oldStyle->display() != newStyle->display() |
|| oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FIRST_LETTER) |
|| !oldStyle->contentDataEquivalent(newStyle) |
- || oldStyle->hasTextCombine() != newStyle->hasTextCombine() |
- || oldStyle->justifyItems() != newStyle->justifyItems()) // TODO (lajava): We must avoid this Reattach. |
+ || oldStyle->hasTextCombine() != newStyle->hasTextCombine()) |
return Reattach; |
if (oldStyle->inheritedNotEqual(*newStyle)) |
@@ -202,30 +201,47 @@ StyleRecalcChange ComputedStyle::stylePropagationDiff(const ComputedStyle* oldSt |
return NoInherit; |
} |
-ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject) |
+static const StyleSelfAlignmentData resolvedSelfAlignment(const StyleSelfAlignmentData& value, ItemPosition normalValueBehavior) |
{ |
- // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". |
- if (childStyle.alignSelfPosition() == ItemPositionAuto) |
- return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolvedAutoPositionForLayoutObject : parentStyle.alignItemsPosition(); |
- return childStyle.alignSelfPosition(); |
+ ASSERT(value.position() != ItemPositionAuto); |
+ if (value.position() == ItemPositionNormal) |
+ return {normalValueBehavior, OverflowAlignmentDefault}; |
+ return value; |
} |
-const StyleSelfAlignmentData ComputedStyle::resolvedAlignment(const ComputedStyle& parentStyle, ItemPosition resolvedAutoPositionForLayoutObject) const |
+const StyleSelfAlignmentData ComputedStyle::resolvedAlignItems(ItemPosition normalValueBehaviour) const |
{ |
- // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". |
- if (alignSelfPosition() == ItemPositionAuto) { |
- if (parentStyle.alignItemsPosition() == ItemPositionAuto) |
- return {resolvedAutoPositionForLayoutObject, OverflowAlignmentDefault}; |
- return parentStyle.alignItems(); |
- } |
- return alignSelf(); |
+ return resolvedSelfAlignment(alignItems(), normalValueBehaviour); |
} |
-ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyle, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject) |
+const StyleSelfAlignmentData ComputedStyle::resolvedAlignSelf(const ComputedStyle& parentStyle, ItemPosition normalValueBehaviour) const |
+{ |
+ // The auto keyword computes to the parent's align-items computed value. |
+ // We will return the behaviour of 'normal' value if needed, which is specific of each layout model. |
+ if (alignSelfPosition() == ItemPositionAuto) |
+ return parentStyle.resolvedAlignItems(normalValueBehaviour); |
+ return resolvedSelfAlignment(alignSelf(), normalValueBehaviour); |
+} |
+ |
+const StyleSelfAlignmentData ComputedStyle::resolvedJustifyItems(ItemPosition normalValueBehaviour) const |
+{ |
+ // FIXME: justify-items 'auto' value is allowed only to provide the 'legacy' keyword's behavior, which it's still not implemented for layout. |
+ // "If the inherited value of justify-items includes the legacy keyword, auto computes to the inherited value." |
+ // https://drafts.csswg.org/css-align/#justify-items-property |
+ if (justifyItemsPosition() == ItemPositionAuto) |
+ return {normalValueBehaviour, OverflowAlignmentDefault}; |
+ |
+ return resolvedSelfAlignment(justifyItems(), normalValueBehaviour); |
+} |
+ |
+ |
+const StyleSelfAlignmentData ComputedStyle::resolvedJustifySelf(const ComputedStyle& parentStyle, ItemPosition normalValueBehaviour) const |
{ |
- if (childStyle.justifySelfPosition() == ItemPositionAuto) |
- return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolvedAutoPositionForLayoutObject : parentStyle.justifyItemsPosition(); |
- return childStyle.justifySelfPosition(); |
+ // The auto keyword computes to the parent's justify-items computed value. |
+ // We will return the behaviour of 'normal' value if needed, which is specific of each layout model. |
+ if (justifySelfPosition() == ItemPositionAuto) |
+ return parentStyle.resolvedJustifyItems(normalValueBehaviour); |
+ return resolvedSelfAlignment(justifySelf(), normalValueBehaviour); |
} |
static inline ContentPosition resolvedContentAlignmentPosition(const StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior) |