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

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

Issue 1218023004: Fix a regression when position:static with absolute child changed to relative (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add ASSERT(gPositionedContainerMap->get(o)->size() == 1) Created 5 years, 5 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/LayoutObject.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutObject.cpp
diff --git a/Source/core/layout/LayoutObject.cpp b/Source/core/layout/LayoutObject.cpp
index 39912284a41dacf2f68f32faac07fca4172e674a..f9044c996db85fc62b0b941f1b49f7117dd1c6a8 100644
--- a/Source/core/layout/LayoutObject.cpp
+++ b/Source/core/layout/LayoutObject.cpp
@@ -865,6 +865,31 @@ LayoutBlock* LayoutObject::containerForFixedPosition(const LayoutBoxModelObject*
return toLayoutBlock(ancestor);
}
+LayoutBlock* LayoutObject::containerForAbsolutePosition() const
+{
+ LayoutObject* o = parent();
+ while (o) {
+ if (o->style()->position() != StaticPosition && (!o->isInline() || o->isReplaced()))
+ break;
+
+ if (o->canContainFixedPositionObjects())
+ break;
+
+ o = o->parent();
+ }
+
+ if (o && !o->isLayoutBlock())
+ o = o->containingBlock();
+
+ while (o && o->isAnonymousBlock())
+ o = o->containingBlock();
+
+ if (!o || !o->isLayoutBlock())
+ return nullptr; // This can still happen in case of an orphaned tree
+
+ return toLayoutBlock(o);
+}
+
LayoutBlock* LayoutObject::containingBlock() const
{
LayoutObject* o = parent();
@@ -872,23 +897,9 @@ LayoutBlock* LayoutObject::containingBlock() const
o = toLayoutScrollbarPart(this)->layoutObjectOwningScrollbar();
if (!isTextOrSVGChild() && m_style->position() == FixedPosition)
return containerForFixedPosition();
- if (!isTextOrSVGChild() && m_style->position() == AbsolutePosition) {
- while (o) {
- if (o->style()->position() != StaticPosition && (!o->isInline() || o->isReplaced()))
- break;
-
- if (o->canContainFixedPositionObjects())
- break;
-
- o = o->parent();
- }
-
- if (o && !o->isLayoutBlock())
- o = o->containingBlock();
-
- while (o && o->isAnonymousBlock())
- o = o->containingBlock();
- } else if (isColumnSpanAll()) {
+ if (!isTextOrSVGChild() && m_style->position() == AbsolutePosition)
mstensho (USE GERRIT) 2015/07/06 09:46:24 Kind of silly to call isTextOrSVGChild() all day l
kojii 2015/07/07 08:40:38 Done.
+ return containerForAbsolutePosition();
mstensho (USE GERRIT) 2015/07/06 09:46:24 containingBlockForAbsolutePosition() is a better n
kojii 2015/07/07 08:40:38 Done.
+ if (isColumnSpanAll()) {
o = spannerPlaceholder()->containingBlock();
} else {
while (o && ((o->isInline() && !o->isReplaced()) || !o->isLayoutBlock()))
« no previous file with comments | « Source/core/layout/LayoutObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698