Chromium Code Reviews| 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())) |