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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1672003002: Mark/unmark orthogonal writing-mode roots when ancestors were changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove incorrect optimization using childNeedsStyleRecalc for crbug.com/585624 Created 4 years, 10 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 | « third_party/WebKit/LayoutTests/fast/writing-mode/orthogonal-writing-modes-change-root-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 6774606bbe87f2d44541a216072c22e94fcafb04..e3c2b1f099ec69a4ce3d31ddb3b0f085bb997413 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -265,6 +265,11 @@ static bool borderOrPaddingLogicalWidthChanged(const ComputedStyle& oldStyle, co
void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle)
{
+ // Horizontal writing mode definition is updated in LayoutBoxModelObject::updateFromStyle,
+ // (as part of the LayoutBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal
+ // writing mode value before style change here.
+ bool oldHorizontalWritingMode = isHorizontalWritingMode();
+
LayoutBox::styleDidChange(diff, oldStyle);
if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating() && !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isLayoutBlockFlow()) {
@@ -286,6 +291,21 @@ void LayoutBlock::styleDidChange(StyleDifference diff, const ComputedStyle* oldS
if (LayoutBlock* cb = containingBlock())
cb->removePositionedObjects(this, NewContainingBlock);
}
+
+ // Changing the writingMode() may change isOrthogonalWritingModeRoot()
+ // of children. Make sure all children are marked/unmarked as orthogonal
+ // writing-mode roots.
+ bool newHorizontalWritingMode = isHorizontalWritingMode();
+ if (oldHorizontalWritingMode != newHorizontalWritingMode) {
+ for (LayoutObject* child = firstChild(); child; child = child->nextSibling()) {
+ if (!child->isBox())
+ continue;
+ if (newHorizontalWritingMode != child->isHorizontalWritingMode())
+ toLayoutBox(child)->markOrthogonalWritingModeRoot();
+ else
+ toLayoutBox(child)->unmarkOrthogonalWritingModeRoot();
+ }
+ }
}
if (TextAutosizer* textAutosizer = document().textAutosizer())
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/writing-mode/orthogonal-writing-modes-change-root-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698