Index: Source/WebCore/rendering/RenderObject.cpp |
=================================================================== |
--- Source/WebCore/rendering/RenderObject.cpp (revision 122124) |
+++ Source/WebCore/rendering/RenderObject.cpp (working copy) |
@@ -710,7 +710,11 @@ |
{ |
RenderObject* o = parent(); |
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()) |
@@ -718,18 +722,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 |
@@ -738,6 +748,9 @@ |
o = o->parent(); |
} |
+ |
+ while (o && o->isAnonymousBlock()) |
+ o = o->containingBlock(); |
} else { |
while (o && ((o->isInline() && !o->isReplaced()) || !o->isRenderBlock())) |
o = o->parent(); |