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

Unified Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 363133003: [CSS Grid Layout] Adapting align-self, align-items and justify-self to the last CSS 3 spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: A new approach for resolving auto values. Created 6 years, 5 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: Source/core/rendering/style/RenderStyle.cpp
diff --git a/Source/core/rendering/style/RenderStyle.cpp b/Source/core/rendering/style/RenderStyle.cpp
index d89e8f6753fdc0e58afeeaa2c7cc5dd4aad2201b..d4a1090c03116a916f720a0bedaa87ffb40ca681 100644
--- a/Source/core/rendering/style/RenderStyle.cpp
+++ b/Source/core/rendering/style/RenderStyle.cpp
@@ -179,7 +179,9 @@ StyleRecalcChange RenderStyle::stylePropagationDiff(const RenderStyle* oldStyle,
|| oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FIRST_LETTER)
|| oldStyle->columnSpan() != newStyle->columnSpan()
|| !oldStyle->contentDataEquivalent(newStyle)
- || oldStyle->hasTextCombine() != newStyle->hasTextCombine())
+ || oldStyle->hasTextCombine() != newStyle->hasTextCombine()
+ || oldStyle->justifyItems() != newStyle->justifyItems()
+ || oldStyle->alignItems() != newStyle->alignItems())
return Reattach;
if (*oldStyle == *newStyle)
@@ -1693,4 +1695,67 @@ float calcBorderRadiiConstraintScaleFor(const FloatRect& rect, const FloatRounde
return factor;
}
+
+void RenderStyle::resolveJustifyItemsAuto(const RenderStyle& parentStyle)
+{
+ if (justifyItems() != ItemPositionAuto)
+ return;
+
+ // If the inherited value of justify-items includes the legacy keyword, 'auto'
+ // computes to the the inherited value.
+ // Otherwise, auto computes to:
+ // - 'stretch' for flex containers and grid containers.
+ // - 'start' for everything else.
svillar 2014/07/29 10:40:05 I don't think you need these comments. Code is sel
+ if (parentStyle.justifyItemsPositionType() == LegacyPosition) {
+ setJustifyItems(parentStyle.justifyItems());
+ setJustifyItemsPositionType(parentStyle.justifyItemsPositionType());
+ } else if (isDisplayFlexibleOrGridBox()) {
+ setJustifyItems(ItemPositionStretch);
+ }
+}
+
+void RenderStyle::resolveJustifySelfAuto(const RenderStyle& parentStyle)
+{
+ if (justifySelf() != ItemPositionAuto)
+ return;
+
+ // The 'auto' keyword computes to 'stretch' on absolutely-positioned elements,
+ // and to the computed value of justify-items on the parent (minus
+ // any legacy keywords) on all other boxes.
svillar 2014/07/29 10:40:05 Ditto.
+ if (position() == AbsolutePosition) {
+ setJustifySelf(ItemPositionStretch);
+ } else {
+ setJustifySelf(parentStyle.justifyItems());
+ setJustifySelfOverflowAlignment(parentStyle.justifyItemsOverflowAlignment());
+ }
+}
+
+void RenderStyle::resolveAlignItemsAuto(const RenderStyle& parentStyle)
+{
+ if (alignItems() != ItemPositionAuto)
+ return;
+
+ // The 'auto' keyword computes to:
+ // 'stretch' for flex containers and grid containers,
+ // 'start' for everything else.
svillar 2014/07/29 10:40:05 Ditto.
+ if (isDisplayFlexibleOrGridBox())
+ setAlignItems(ItemPositionStretch);
+}
+
+void RenderStyle::resolveAlignSelfAuto(const RenderStyle& parentStyle)
+{
+ if (alignSelf() != ItemPositionAuto)
+ return;
+
+ // The 'auto' keyword computes to 'stretch' on absolutely-positioned elements,
+ // and to the computed value of align-items on the parent (minus
+ // any 'legacy' keywords) on all other boxes.
svillar 2014/07/29 10:40:05 Ditto.
+ if ((position() == AbsolutePosition)) {
+ setAlignSelf(ItemPositionStretch);
+ } else {
+ setAlignSelf(parentStyle.alignItems());
+ setAlignSelfOverflowAlignment(parentStyle.alignItemsOverflowAlignment());
+ }
+}
+
} // namespace blink
« Source/core/css/CSSComputedStyleDeclaration.cpp ('K') | « Source/core/rendering/style/RenderStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698