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 71680c8b474ccc730920eb61a4b7ccda1d086fc0..5943c271966b8026e0bac8201b8e9e0b22ffb14d 100644 |
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
@@ -189,11 +189,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) |
@@ -205,30 +206,32 @@ 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 repurpose 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(ItemPosition normalValueBehaviour) const |
+{ |
+ return resolvedSelfAlignment(alignSelf(), normalValueBehaviour); |
+} |
+ |
+const StyleSelfAlignmentData ComputedStyle::resolvedJustifyItems(ItemPosition normalValueBehaviour) const |
+{ |
+ return resolvedSelfAlignment(justifyItems(), normalValueBehaviour); |
} |
-ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyle, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject) |
+const StyleSelfAlignmentData ComputedStyle::resolvedJustifySelf(ItemPosition normalValueBehaviour) const |
{ |
- if (childStyle.justifySelfPosition() == ItemPositionAuto) |
- return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolvedAutoPositionForLayoutObject : parentStyle.justifyItemsPosition(); |
- return childStyle.justifySelfPosition(); |
+ return resolvedSelfAlignment(justifySelf(), normalValueBehaviour); |
} |
static inline ContentPosition resolvedContentAlignmentPosition(const StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior) |