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

Unified Diff: Source/core/layout/LayoutBox.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/layout/LayoutBox.h ('k') | Source/core/layout/LayoutFlexibleBox.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutBox.cpp
diff --git a/Source/core/layout/LayoutBox.cpp b/Source/core/layout/LayoutBox.cpp
index 78cc863c00f7c60c6398c8324003374d91bb8047..b7199a19948f93dca28ad8c3654a21fdd91382fb 100644
--- a/Source/core/layout/LayoutBox.cpp
+++ b/Source/core/layout/LayoutBox.cpp
@@ -252,6 +252,7 @@ void LayoutBox::styleDidChange(StyleDifference diff, const ComputedStyle* oldSty
}
updateShapeOutsideInfoAfterStyleChange(*style(), oldStyle);
updateGridPositionAfterStyleChange(oldStyle);
+ updateAlignmentAfterStyleChange(oldStyle);
if (LayoutMultiColumnSpannerPlaceholder* placeholder = this->spannerPlaceholder())
placeholder->updateMarginProperties();
@@ -299,6 +300,23 @@ void LayoutBox::updateGridPositionAfterStyleChange(const ComputedStyle* oldStyle
toLayoutGrid(parent())->dirtyGrid();
}
+void LayoutBox::updateAlignmentAfterStyleChange(const ComputedStyle* oldStyle)
+{
+ if (!oldStyle)
+ return;
+
+ // When container's justify-items value changes and the new value containes the 'legacy'
+ // keyword, it will affect children's justify-item 'auto' value resolution.
+ if (oldStyle->justifyItemsPositionType() != styleRef().justifyItemsPositionType()
+ || (styleRef().justifyItemsPositionType() == LegacyPosition && oldStyle->justifyItemsPosition() != styleRef().justifyItemsPosition())) {
+ for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+ if ((styleRef().justifyItemsPositionType() == LegacyPosition) && (child->styleRef().justifyItemsPosition() == ItemPositionAuto))
+ child->mutableStyleRef().setJustifyItemsPosition(styleRef().justifyItemsPosition());
+ child->setNeedsLayout(LayoutInvalidationReason::GridChanged);
+ }
+ }
+}
+
void LayoutBox::updateFromStyle()
{
LayoutBoxModelObject::updateFromStyle();
@@ -2140,7 +2158,7 @@ static bool columnFlexItemHasStretchAlignment(const LayoutObject* flexitem)
ASSERT(parent->style()->isColumnFlexDirection());
if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEnd().isAuto())
return false;
- return flexitem->style()->alignSelfPosition() == ItemPositionStretch || (flexitem->style()->alignSelfPosition() == ItemPositionAuto && parent->style()->alignItemsPosition() == ItemPositionStretch);
+ return ComputedStyle::resolvedAlignSelfPosition(parent->styleRef(), flexitem->styleRef(), ItemPositionStretch) == ItemPositionStretch;
}
static bool isStretchingColumnFlexItem(const LayoutObject* flexitem)
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | Source/core/layout/LayoutFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698