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

Unified Diff: Source/core/style/ComputedStyle.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/style/ComputedStyle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/style/ComputedStyle.cpp
diff --git a/Source/core/style/ComputedStyle.cpp b/Source/core/style/ComputedStyle.cpp
index c01ddf928a2c652f6b556d64357ec39ae634dc64..873c608aa44bc2cc8bc740c02882ddbc4326e3f7 100644
--- a/Source/core/style/ComputedStyle.cpp
+++ b/Source/core/style/ComputedStyle.cpp
@@ -177,9 +177,7 @@ StyleRecalcChange ComputedStyle::stylePropagationDiff(const ComputedStyle* oldSt
|| oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FIRST_LETTER)
|| oldStyle->columnSpan() != newStyle->columnSpan()
|| !oldStyle->contentDataEquivalent(newStyle)
- || oldStyle->hasTextCombine() != newStyle->hasTextCombine()
- || oldStyle->justifyItems() != newStyle->justifyItems()
- || oldStyle->alignItems() != newStyle->alignItems())
+ || oldStyle->hasTextCombine() != newStyle->hasTextCombine())
return Reattach;
if (oldStyle->inheritedNotEqual(*newStyle))
@@ -194,7 +192,7 @@ StyleRecalcChange ComputedStyle::stylePropagationDiff(const ComputedStyle* oldSt
return NoInherit;
}
-ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject)
+ItemPosition ComputedStyle::resolvedAlignSelfPosition(const ComputedStyle& parentStyle, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject)
{
// The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto".
if (childStyle.alignSelfPosition() == ItemPositionAuto)
@@ -202,13 +200,58 @@ ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, c
return childStyle.alignSelfPosition();
}
-ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyle, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject)
+OverflowAlignment ComputedStyle::resolvedAlignSelfOverflow(const ComputedStyle& parentStyle, const ComputedStyle& childStyle)
{
+ // It computes to the parent's align-items computed value if "auto".
+ return (childStyle.alignSelfPosition() == ItemPositionAuto) ? parentStyle.alignItemsOverflowAlignment() : childStyle.alignSelfOverflowAlignment();
+}
+
+ItemPosition ComputedStyle::resolvedJustifySelfPosition(const ComputedStyle& parentStyle, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject)
+{
+ // The auto keyword computes to the parent's justify-items computed value, or to "stretch", if not set or "auto".
if (childStyle.justifySelfPosition() == ItemPositionAuto)
return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolvedAutoPositionForLayoutObject : parentStyle.justifyItemsPosition();
return childStyle.justifySelfPosition();
}
+OverflowAlignment ComputedStyle::resolvedJustifySelfOverflow(const ComputedStyle& parentStyle, const ComputedStyle& childStyle)
+{
+ // It computes to the parent's justify-items computed value if "auto".
+ return (childStyle.justifySelfPosition() == ItemPositionAuto) ? parentStyle.justifyItemsOverflowAlignment() : childStyle.justifySelfOverflowAlignment();
+}
+
+ContentPosition ComputedStyle::resolvedAlignContentPosition() const
+{
+ const StyleContentAlignmentData& align = alignContent();
+ if (align.position() != ContentPositionAuto || align.distribution() != ContentDistributionDefault)
+ return align.position();
+ // 'auto' computes to 'stretch' for flexbox, hence it's managed by distribution().
+ return isDisplayFlexibleBox() ? ContentPositionAuto : ContentPositionStart;
+}
+
+ContentDistributionType ComputedStyle::resolvedAlignContentDistribution() const
+{
+ const StyleContentAlignmentData& align = alignContent();
+ if (align.position() != ContentPositionAuto || align.distribution() != ContentDistributionDefault)
+ return align.distribution();
+ return isDisplayFlexibleBox() ? ContentDistributionStretch : ContentDistributionDefault;
+}
+
+ContentPosition ComputedStyle::resolvedJustifyContentPosition() const
+{
+ const StyleContentAlignmentData& justify = justifyContent();
+ if (justify.position() != ContentPositionAuto || justify.distribution() != ContentDistributionDefault)
+ return justify.position();
+ // 'auto' computes to 'stretch' for flexbox, but since flexing in the main axis is controlled by flex, it behaves as flex-start.
+ return isDisplayFlexibleBox() ? ContentPositionFlexStart : ContentPositionStart;
+}
+
+ContentDistributionType ComputedStyle::resolvedJustifyContentDistribution() const
+{
+ // even that 'auto' computes to 'stretch' for flexbox it behaves as flex-start, hence it's managed by position().
+ return justifyContentDistribution();
+}
+
void ComputedStyle::inheritFrom(const ComputedStyle& inheritParent, IsAtShadowBoundary isAtShadowBoundary)
{
if (isAtShadowBoundary == AtShadowBoundary) {
@@ -468,12 +511,16 @@ bool ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation(const ComputedStyle&
|| rareNonInheritedData->m_wrapThrough != other.rareNonInheritedData->m_wrapThrough
|| rareNonInheritedData->m_shapeMargin != other.rareNonInheritedData->m_shapeMargin
|| rareNonInheritedData->m_order != other.rareNonInheritedData->m_order
- || rareNonInheritedData->m_grid.get() != other.rareNonInheritedData->m_grid.get()
- || rareNonInheritedData->m_gridItem.get() != other.rareNonInheritedData->m_gridItem.get()
|| rareNonInheritedData->m_textCombine != other.rareNonInheritedData->m_textCombine
|| rareNonInheritedData->hasFilters() != other.rareNonInheritedData->hasFilters())
return true;
+ if ((rareNonInheritedData->m_grid.get() != other.rareNonInheritedData->m_grid.get()
+ && *rareNonInheritedData->m_grid.get() != *other.rareNonInheritedData->m_grid.get())
+ || (rareNonInheritedData->m_gridItem.get() != other.rareNonInheritedData->m_gridItem.get()
+ && *rareNonInheritedData->m_gridItem.get() != *other.rareNonInheritedData->m_gridItem.get()))
+ return true;
+
if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other.rareNonInheritedData->m_deprecatedFlexibleBox.get()
&& *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other.rareNonInheritedData->m_deprecatedFlexibleBox.get())
return true;
« no previous file with comments | « Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698