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

Unified Diff: Source/core/css/resolver/StyleAdjuster.cpp

Issue 1136283006: [CSS Grid Layout] Avoid using StyleAdjuster to resolve 'auto' values. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed some layout tests failures. Created 5 years, 7 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 | « Source/core/css/resolver/StyleAdjuster.h ('k') | Source/core/layout/LayoutBox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleAdjuster.cpp
diff --git a/Source/core/css/resolver/StyleAdjuster.cpp b/Source/core/css/resolver/StyleAdjuster.cpp
index ddc486e2911935341e95b48dedfddcfd04cb115a..5421b2b5c4f381eab803b789a74c33c4c8e78bdc 100644
--- a/Source/core/css/resolver/StyleAdjuster.cpp
+++ b/Source/core/css/resolver/StyleAdjuster.cpp
@@ -243,7 +243,11 @@ void StyleAdjuster::adjustComputedStyle(ComputedStyle& style, const ComputedStyl
if (isSVGTextElement(*e))
style.clearMultiCol();
}
- adjustStyleForAlignment(style, parentStyle);
+
+ // If the inherited value of justify-items includes the legacy keyword, 'auto'
+ // computes to the the inherited value.
+ if (parentStyle.justifyItemsPositionType() == LegacyPosition && style.justifyItemsPosition() == ItemPositionAuto)
+ style.setJustifyItemsPosition(parentStyle.justifyItemsPosition());
}
void StyleAdjuster::adjustStyleForFirstLetter(ComputedStyle& style)
@@ -258,78 +262,6 @@ void StyleAdjuster::adjustStyleForFirstLetter(ComputedStyle& style)
style.setPosition(StaticPosition);
}
-void StyleAdjuster::adjustStyleForAlignment(ComputedStyle& style, const ComputedStyle& parentStyle)
-{
- bool isFlexOrGrid = style.isDisplayFlexibleOrGridBox();
- bool absolutePositioned = style.position() == AbsolutePosition;
-
- // 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.
- 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.
- if (style.justifySelfPosition() == ItemPositionAuto) {
- if (absolutePositioned)
- style.setJustifySelfPosition(ItemPositionStretch);
- else
- 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 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.
- if (style.alignSelfPosition() == ItemPositionAuto) {
- if (absolutePositioned)
- style.setAlignSelfPosition(ItemPositionStretch);
- else
- style.setAlignSelf(parentStyle.alignItems());
- }
-
- // Block Containers: For table cells, the behavior of the 'auto' depends on the computed
- // value of 'vertical-align', otherwise behaves as 'start'.
- // Flex Containers: 'auto' computes to 'flex-start'.
- // Grid Containers: 'auto' computes to 'start', and 'stretch' behaves like 'start'.
- if ((style.justifyContentPosition() == ContentPositionAuto) && (style.justifyContentDistribution() == ContentDistributionDefault)) {
- if (style.isDisplayFlexibleOrGridBox()) {
- if (style.isDisplayFlexibleBox())
- style.setJustifyContentPosition(ContentPositionFlexStart);
- else
- style.setJustifyContentPosition(ContentPositionStart);
- }
- }
-
- // Block Containers: For table cells, the behavior of the 'auto' depends on the computed
- // value of 'vertical-align', otherwise behaves as 'start'.
- // Flex Containers: 'auto' computes to 'stretch'.
- // Grid Containers: 'auto' computes to 'start', and 'stretch' behaves like 'start'.
- if (style.alignContentPosition() == ContentPositionAuto && style.alignContentDistribution() == ContentDistributionDefault) {
- if (style.isDisplayFlexibleOrGridBox()) {
- if (style.isDisplayFlexibleBox())
- style.setAlignContentDistribution(ContentDistributionStretch);
- else
- style.setAlignContentPosition(ContentPositionStart);
- }
- }
-}
-
void StyleAdjuster::adjustStyleForHTMLElement(ComputedStyle& style, const ComputedStyle& parentStyle, HTMLElement& element)
{
// <div> and <span> are the most common elements on the web, we skip all the work for them.
« no previous file with comments | « Source/core/css/resolver/StyleAdjuster.h ('k') | Source/core/layout/LayoutBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698