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

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

Issue 2690183007: Calling container() on floats should only skip LayoutInline ancestors. (Closed)
Patch Set: Not so unreachable after all. container() is sometimes called on an unrooted tree. Created 3 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/multicol/dynamic/abspos-video-with-floated-control-crash.html ('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/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index e913d31e1340f849c08cc1f8b86a41dd5aee504c..1e2b3b75c8fca137cdf97d7d31b046c71c391b01 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -2504,8 +2504,17 @@ LayoutObject* LayoutObject::container(AncestorSkipInfo* skipInfo) const {
return multicolContainer;
}
- if (isFloating())
- return containingBlock(skipInfo);
+ if (isFloating()) {
+ // Skip non-atomic inline ancestors, but nothing else. We want to stop at
+ // e.g. LayoutMedia objects, since they act as containing blocks but do not
+ // inherit from LayoutBlock (so we cannot just use containingBlock() here).
+ for (LayoutObject* walker = parent(); walker; walker = walker->parent()) {
+ if (!walker->isLayoutInline())
+ return walker;
+ if (skipInfo)
+ skipInfo->update(*walker);
+ }
+ }
return parent();
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/multicol/dynamic/abspos-video-with-floated-control-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698