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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleAdjuster.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: Fixed repaint tests. Created 4 years, 6 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/css/resolver/StyleAdjuster.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
index 5d363848d3c5ab03df6601b0635173eddeff537e..8a3a251c2dec6c590fc76ca27d5c632173a34478 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
@@ -243,7 +243,10 @@ void StyleAdjuster::adjustComputedStyle(ComputedStyle& style, const ComputedStyl
if (isSVGTextElement(*element))
style.clearMultiCol();
}
- adjustStyleForAlignment(style, parentStyle);
+ if (element && element->layoutObject() && element->layoutObject()->containingBlock()->isAnonymous())
+ adjustStyleForAlignment(style, element->layoutObject()->containingBlock()->styleRef());
+ else
+ adjustStyleForAlignment(style, parentStyle);
rune 2016/06/13 12:24:19 I still have a hard time understanding the spec he
jfernandez 2016/06/13 13:00:36 That's how I understand the spec, yes. An element'
}
void StyleAdjuster::adjustStyleForEditing(ComputedStyle& style)
@@ -273,38 +276,31 @@ void StyleAdjuster::adjustStyleForFirstLetter(ComputedStyle& style)
void StyleAdjuster::adjustStyleForAlignment(ComputedStyle& style, const ComputedStyle& parentStyle)
{
- bool isFlexOrGrid = style.isDisplayFlexibleOrGridBox();
- bool absolutePositioned = style.position() == AbsolutePosition;
+ // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto' flag
+ // to not just mean 'auto' prior to running the StyleAdjuster but also mean 'normal'
+ // after running it.
- // If the inherited value of justify-items includes the legacy keyword, 'auto'
+ // 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.
+ // Otherwise, 'auto' computes to 'normal'.
if (style.justifyItemsPosition() == ItemPositionAuto) {
if (parentStyle.justifyItemsPositionType() == LegacyPosition)
style.setJustifyItems(parentStyle.justifyItems());
- else if (isFlexOrGrid)
- style.setJustifyItemsPosition(ItemPositionStretch);
}
- // 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.
+ // The 'auto' keyword computes the computed value of justify-items on the parent (minus
+ // any legacy keywords), or 'normal' if the box has no parent.
if (style.justifySelfPosition() == ItemPositionAuto) {
- if (absolutePositioned)
- style.setJustifySelfPosition(ItemPositionStretch);
- else
+ if (parentStyle.justifyItemsPositionType() == LegacyPosition)
+ style.setJustifySelfPosition(parentStyle.justifyItemsPosition());
+ else if (parentStyle.justifyItemsPosition() != ItemPositionAuto)
style.setJustifySelf(parentStyle.justifyItems());
}
- // The 'auto' keyword computes to:
- // - 'stretch' for flex containers and grid containers,
- // - 'start' for everything else.
- if (style.alignItemsPosition() == ItemPositionAuto) {
- if (isFlexOrGrid)
- style.setAlignItemsPosition(ItemPositionStretch);
- }
+ // The 'auto' keyword computes the computed value of align-items on the parent
+ // or 'normal' if the box has no parent.
+ if (style.alignSelfPosition() == ItemPositionAuto && parentStyle.alignItemsPosition() != ItemPositionNormal)
+ style.setAlignSelf(parentStyle.alignItems());
}
void StyleAdjuster::adjustStyleForHTMLElement(ComputedStyle& style, const ComputedStyle& parentStyle, HTMLElement& element)
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698