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 504259b74d5d9eafac10c6fcd1c2229d6e78cba2..5bc8a80a65cfd5b8d9fa1639c55d6e5dddc7f094 100644 |
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
@@ -186,11 +186,12 @@ StyleRecalcChange ComputedStyle::stylePropagationDiff(const ComputedStyle* oldSt |
if (oldStyle->display() != newStyle->display() |
|| oldStyle->hasPseudoStyle(PseudoIdFirstLetter) != newStyle->hasPseudoStyle(PseudoIdFirstLetter) |
|| !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)) |
+ if (oldStyle->inheritedNotEqual(*newStyle) |
+ || oldStyle->alignItems() != newStyle->alignItems() |
+ || oldStyle->justifyItems() != newStyle->justifyItems()) |
return Inherit; |
if (*oldStyle == *newStyle) |
@@ -202,30 +203,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(); |
+ // To avoid needing to copy the RareNonInheritedData, we could repurporse the 'auto' flag to not just mean 'auto' prior to running the StyleAdjuster but also mean 'normal' after running it. |
+ if (value.position() == ItemPositionNormal || value.position() == ItemPositionAuto) |
+ 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) |
Timothy Loh
2016/05/23 05:45:39
I think this branch is no longer needed (or correc
jfernandez
2016/05/25 18:26:49
I think you're right. However, we'd may need this
|
+ 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) |
Timothy Loh
2016/05/23 05:45:39
this one too
jfernandez
2016/05/25 18:26:49
Done.
|
+ return parentStyle.resolvedJustifyItems(normalValueBehaviour); |
+ return resolvedSelfAlignment(justifySelf(), normalValueBehaviour); |
} |
static inline ContentPosition resolvedContentAlignmentPosition(const StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior) |