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

Unified Diff: Source/core/css/CSSComputedStyleDeclaration.cpp

Issue 433153003: [CSS Grid Layout] Don't resolve align-self and justify-self properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Applied suggested comments. Created 6 years, 3 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
« no previous file with comments | « LayoutTests/css3/flexbox/css-properties-expected.txt ('k') | Source/core/css/resolver/StyleAdjuster.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSComputedStyleDeclaration.cpp
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index d2aae7dff888c26e3357ccb41d925bf2ef766978..3c150c71a26cb533a8860e281119ccf099fd29d2 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -55,6 +55,7 @@
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
+#include "core/dom/NodeRenderingTraversal.h"
#include "core/dom/PseudoElement.h"
#include "core/rendering/RenderBox.h"
#include "core/rendering/RenderGrid.h"
@@ -1536,15 +1537,16 @@ Node* CSSComputedStyleDeclaration::styledNode() const
return m_node.get();
}
-static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element)
+static void resolveAlignment(Node* styledNode, ItemPosition& position, OverflowAlignment& overflow)
{
- if (position != ItemPositionAuto)
- return position;
-
- bool isFlexOrGrid = element && element->computedStyle()
- && element->computedStyle()->isDisplayFlexibleOrGridBox();
-
- return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart;
+ if (position == ItemPositionAuto) {
+ if (Node* parent = NodeRenderingTraversal::parent(styledNode)) {
+ if (RenderStyle* parentStyle = parent->computedStyle()) {
+ position = parentStyle->alignItems();
+ overflow = parentStyle->alignItemsOverflowAlignment();
+ }
+ }
+ }
}
static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositionType positionType)
@@ -1828,9 +1830,13 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu
case CSSPropertyAlignContent:
return cssValuePool().createValue(style->alignContent());
case CSSPropertyAlignItems:
- return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->alignItems(), styledNode), style->alignItemsOverflowAlignment(), NonLegacyPosition);
- case CSSPropertyAlignSelf:
- return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->alignSelf(), styledNode->parentNode()), style->alignSelfOverflowAlignment(), NonLegacyPosition);
+ return valueForItemPositionWithOverflowAlignment(style->alignItems(), style->alignItemsOverflowAlignment(), NonLegacyPosition);
+ case CSSPropertyAlignSelf: {
+ ItemPosition alignSelf = style->alignSelf();
+ OverflowAlignment overflow = style->alignSelfOverflowAlignment();
+ resolveAlignment(styledNode, alignSelf, overflow);
+ return valueForItemPositionWithOverflowAlignment(alignSelf, overflow, NonLegacyPosition);
+ }
case CSSPropertyFlex:
return valuesForShorthandProperty(flexShorthand());
case CSSPropertyFlexBasis:
@@ -1998,9 +2004,13 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu
case CSSPropertyIsolation:
return cssValuePool().createValue(style->isolation());
case CSSPropertyJustifyItems:
- return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->justifyItems(), styledNode), style->justifyItemsOverflowAlignment(), style->justifyItemsPositionType());
- case CSSPropertyJustifySelf:
- return valueForItemPositionWithOverflowAlignment(resolveAlignmentAuto(style->justifySelf(), styledNode->parentNode()), style->justifySelfOverflowAlignment(), NonLegacyPosition);
+ return valueForItemPositionWithOverflowAlignment(style->justifyItems(), style->justifyItemsOverflowAlignment(), style->justifyItemsPositionType());
+ case CSSPropertyJustifySelf: {
+ ItemPosition justifySelf = style->justifySelf();
+ OverflowAlignment overflow = style->justifySelfOverflowAlignment();
+ resolveAlignment(styledNode, justifySelf, overflow);
+ return valueForItemPositionWithOverflowAlignment(justifySelf, overflow, NonLegacyPosition);
+ }
case CSSPropertyLeft:
return valueForPositionOffset(*style, CSSPropertyLeft, renderer);
case CSSPropertyLetterSpacing:
« no previous file with comments | « LayoutTests/css3/flexbox/css-properties-expected.txt ('k') | Source/core/css/resolver/StyleAdjuster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698