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

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

Issue 613273002: [CSS Grid Layout] Stretch value for align and justify properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: resolveAlignment and resolveJustification now defined in RenderStyle. Created 6 years, 2 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 4f875ad5ca4190c0011198add9e4d02855d1d57d..73fd13281ec8315dd1ae245dc8517f3aef3d4342 100644
--- a/Source/core/rendering/style/RenderStyle.cpp
+++ b/Source/core/rendering/style/RenderStyle.cpp
@@ -198,13 +198,19 @@ StyleRecalcChange RenderStyle::stylePropagationDiff(const RenderStyle* oldStyle,
return NoInherit;
}
-ItemPosition RenderStyle::resolveAlignment(const RenderStyle* parentStyle, const RenderStyle* childStyle)
+ItemPosition RenderStyle::resolveAlignment(const RenderStyle* parentStyle, const RenderStyle* childStyle, ItemPosition defaultPosition)
{
- ItemPosition align = childStyle->alignSelf();
// The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto".
- if (align == ItemPositionAuto)
- align = (parentStyle->alignItems() == ItemPositionAuto) ? ItemPositionStretch : parentStyle->alignItems();
- return align;
+ if (childStyle->alignSelf() == ItemPositionAuto)
+ return (parentStyle->alignItems() == ItemPositionAuto) ? defaultPosition : parentStyle->alignItems();
+ return childStyle->alignSelf();
+}
+
+ItemPosition RenderStyle::resolveJustification(const RenderStyle* parentStyle, const RenderStyle* childStyle, ItemPosition defaultPosition)
+{
+ if (childStyle->justifySelf() == ItemPositionAuto)
+ return (parentStyle->justifyItems() == ItemPositionAuto) ? defaultPosition : parentStyle->justifyItems();
+ return childStyle->justifySelf();
}
void RenderStyle::inheritFrom(const RenderStyle* inheritParent, IsAtShadowBoundary isAtShadowBoundary)
« Source/core/rendering/style/RenderStyle.h ('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