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 e51ccac6482ac12b479821aebca9bbcf9e7c7986..3ed11cab27c61da10154e24f62bac529dad15deb 100644 |
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
@@ -181,8 +181,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)) |
@@ -197,30 +196,41 @@ 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); |
+} |
+ |
+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); |
} |
-ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyle, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject) |
+const StyleSelfAlignmentData ComputedStyle::resolvedJustifyItems(ItemPosition normalValueBehaviour) const |
+{ |
+ 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) |