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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 1709963002: [css-align] New CSS Value 'normal' for Self Alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed repaint tests. Created 4 years, 6 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: 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)

Powered by Google App Engine
This is Rietveld 408576698