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

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: Applied suggested changes. Created 4 years, 9 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 adb73a602df75ebd5d50748f5c497c90c5da03b8..a750696ee24e1b9ea64fd8fcba42651598da8f2a 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -202,30 +202,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)

Powered by Google App Engine
This is Rietveld 408576698