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

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: 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/css/CSSComputedStyleDeclaration.cpp
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index edf275fb242cb567cfbe21a909e9f6092b17b53d..9bb6e34483f110bb5323ccb6072782789822207e 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -1537,17 +1537,6 @@ Node* CSSComputedStyleDeclaration::styledNode() const
return m_node.get();
}
-static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element)
-{
- if (position != ItemPositionAuto)
- return position;
-
- bool isFlexOrGrid = element && element->computedStyle()
- && element->computedStyle()->isDisplayFlexibleOrGridBox();
-
- return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart;
-}
-
static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositionType positionType)
{
RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
@@ -1830,9 +1819,19 @@ 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();
+ if (alignSelf == ItemPositionAuto) {
+ Node* parent = styledNode->parentNode();
+ if (parent && parent->computedStyle()) {
+ alignSelf = parent->computedStyle()->alignItems();
+ overflow = parent->computedStyle()->alignItemsOverflowAlignment();
esprehn 2014/08/19 00:56:33 This seems like code duplication, also same issues
jfernandez 2014/08/19 21:00:12 Do you mean code duplication with the logic managi
esprehn 2014/09/03 21:45:28 Yes.
jfernandez 2014/09/03 22:27:49 Done.
+ }
+ }
+ return valueForItemPositionWithOverflowAlignment(alignSelf, overflow, NonLegacyPosition);
+ }
case CSSPropertyFlex:
return valuesForShorthandProperty(flexShorthand());
case CSSPropertyFlexBasis:
@@ -2000,9 +1999,19 @@ 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();
+ if (justifySelf == ItemPositionAuto) {
+ Node* parent = styledNode->parentNode();
+ if (parent && parent->computedStyle()) {
esprehn 2014/08/19 00:56:33 You need to use NodeRenderingTraversal::parent(),
jfernandez 2014/08/19 21:00:12 I used parentNode() because it was what it was use
esprehn 2014/09/03 21:45:27 I don't understand what you mean, style is resolve
jfernandez 2014/09/03 22:27:49 Acknowledged.
+ justifySelf = parent->computedStyle()->justifyItems();
+ overflow = parent->computedStyle()->justifyItemsOverflowAlignment();
+ }
+ }
+ return valueForItemPositionWithOverflowAlignment(justifySelf, overflow, NonLegacyPosition);
+ }
case CSSPropertyLeft:
return valueForPositionOffset(*style, CSSPropertyLeft, renderer);
case CSSPropertyLetterSpacing:

Powered by Google App Engine
This is Rietveld 408576698