Index: Source/WebCore/rendering/RenderObject.cpp |
=================================================================== |
--- Source/WebCore/rendering/RenderObject.cpp (revision 122125) |
+++ Source/WebCore/rendering/RenderObject.cpp (working copy) |
@@ -724,7 +724,11 @@ |
if (!o && isRenderScrollbarPart()) |
o = toRenderScrollbarPart(this)->rendererOwningScrollbar(); |
if (!isText() && m_style->position() == FixedPosition) { |
- while (o && !o->isRenderView() && !(o->hasTransform() && o->isRenderBlock())) { |
+ while (o) { |
+ if (o->isRenderView()) |
+ break; |
+ if (o->hasTransform() && o->isRenderBlock()) |
+ break; |
#if ENABLE(SVG) |
// foreignObject is the containing block for its contents. |
if (o->isSVGForeignObject()) |
@@ -732,18 +736,24 @@ |
#endif |
o = o->parent(); |
} |
+ ASSERT(!o->isAnonymousBlock()); |
} else if (!isText() && m_style->position() == AbsolutePosition) { |
- while (o && (o->style()->position() == StaticPosition || (o->isInline() && !o->isReplaced())) && !o->isRenderView() && !(o->hasTransform() && o->isRenderBlock())) { |
+ while (o) { |
// For relpositioned inlines, we return the nearest non-anonymous enclosing block. We don't try |
// to return the inline itself. This allows us to avoid having a positioned objects |
// list in all RenderInlines and lets us return a strongly-typed RenderBlock* result |
// from this method. The container() method can actually be used to obtain the |
// inline directly. |
+ if (!o->style()->position() == StaticPosition && !(o->isInline() && !o->isReplaced())) |
+ break; |
+ if (o->isRenderView()) |
+ break; |
+ if (o->hasTransform() && o->isRenderBlock()) |
+ break; |
+ |
if (o->style()->position() == RelativePosition && o->isInline() && !o->isReplaced()) { |
- RenderBlock* relPositionedInlineContainingBlock = o->containingBlock(); |
- while (relPositionedInlineContainingBlock->isAnonymousBlock()) |
- relPositionedInlineContainingBlock = relPositionedInlineContainingBlock->containingBlock(); |
- return relPositionedInlineContainingBlock; |
+ o = o->containingBlock(); |
+ break; |
} |
#if ENABLE(SVG) |
if (o->isSVGForeignObject()) //foreignObject is the containing block for contents inside it |
@@ -752,6 +762,9 @@ |
o = o->parent(); |
} |
+ |
+ while (o && o->isAnonymousBlock()) |
+ o = o->containingBlock(); |
} else { |
while (o && ((o->isInline() && !o->isReplaced()) || !o->isRenderBlock())) |
o = o->parent(); |