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

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

Issue 1181983002: Ensure that positioned objects' list is always in parent first order (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More comprehensive test cases Created 5 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: Source/core/layout/LayoutBlock.cpp
diff --git a/Source/core/layout/LayoutBlock.cpp b/Source/core/layout/LayoutBlock.cpp
index dd9facbf773689c89c04a2fa25bf0158e740a832..10eb36fe5e9cce8a0d519d85c7da9a1b63a9c2b3 100644
--- a/Source/core/layout/LayoutBlock.cpp
+++ b/Source/core/layout/LayoutBlock.cpp
@@ -281,20 +281,11 @@ void LayoutBlock::styleWillChange(StyleDifference diff, const ComputedStyle& new
// Clear our positioned objects list. Our absolutely positioned descendants will be
// inserted into our containing block's positioned objects list during layout.
removePositionedObjects(0, NewContainingBlock);
- } else if (!oldStyleIsContainer && newStyleIsContainer) {
+ } else if ((!oldStyleIsContainer || oldStyle->position() != newStyle.position()) && newStyleIsContainer) {
// Remove our absolutely positioned descendants from their current containing block.
mstensho (USE GERRIT) 2015/06/15 10:02:55 This comment is now inaccurate. We're removing pos
// They will be inserted into our positioned objects list during layout.
- LayoutObject* cb = parent();
- while (cb && (cb->style()->position() == StaticPosition || (cb->isInline() && !cb->isReplaced())) && !cb->isLayoutView()) {
- if (cb->style()->position() == RelativePosition && cb->isInline() && !cb->isReplaced()) {
- cb = cb->containingBlock();
- break;
- }
- cb = cb->parent();
- }
-
- if (cb->isLayoutBlock())
- toLayoutBlock(cb)->removePositionedObjects(this, NewContainingBlock);
+ if (LayoutBlock* cb = containingBlock(&newStyle))
mstensho (USE GERRIT) 2015/06/15 10:02:54 Why not do this in styleDidChange() instead of sty
+ cb->removePositionedObjects(this, NewContainingBlock);
}
}

Powered by Google App Engine
This is Rietveld 408576698