OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 } | 714 } |
715 | 715 |
716 RenderBlock* RenderObject::containingBlock() const | 716 RenderBlock* RenderObject::containingBlock() const |
717 { | 717 { |
718 RenderObject* o = parent(); | 718 RenderObject* o = parent(); |
719 if (!isText() && m_style->position() == FixedPosition) { | 719 if (!isText() && m_style->position() == FixedPosition) { |
720 while (o && !o->isRenderView() && !(o->hasTransform() && o->isRenderBloc
k())) | 720 while (o && !o->isRenderView() && !(o->hasTransform() && o->isRenderBloc
k())) |
721 o = o->parent(); | 721 o = o->parent(); |
722 } else if (!isText() && m_style->position() == AbsolutePosition) { | 722 } else if (!isText() && m_style->position() == AbsolutePosition) { |
723 while (o && (o->style()->position() == StaticPosition || (o->isInline()
&& !o->isReplaced())) && !o->isRenderView() && !(o->hasTransform() && o->isRende
rBlock())) { | 723 while (o && (o->style()->position() == StaticPosition || (o->isInline()
&& !o->isReplaced())) && !o->isRenderView() && !(o->hasTransform() && o->isRende
rBlock())) { |
724 // For relpositioned inlines, we return the nearest enclosing block.
We don't try | 724 // For relpositioned inlines, we return the nearest non-anonymous en
closing block. We don't try |
725 // to return the inline itself. This allows us to avoid having a po
sitioned objects | 725 // to return the inline itself. This allows us to avoid having a po
sitioned objects |
726 // list in all RenderInlines and lets us return a strongly-typed Ren
derBlock* result | 726 // list in all RenderInlines and lets us return a strongly-typed Ren
derBlock* result |
727 // from this method. The container() method can actually be used to
obtain the | 727 // from this method. The container() method can actually be used to
obtain the |
728 // inline directly. | 728 // inline directly. |
729 if (o->style()->position() == RelativePosition && o->isInline() && !
o->isReplaced()) | 729 if (o->style()->position() == RelativePosition && o->isInline() && !
o->isReplaced()) { |
730 return o->containingBlock(); | 730 RenderBlock* relPositionedInlineContainingBlock = o->containingB
lock(); |
| 731 while (relPositionedInlineContainingBlock->isAnonymousBlock()) |
| 732 relPositionedInlineContainingBlock = relPositionedInlineCont
ainingBlock->containingBlock(); |
| 733 return relPositionedInlineContainingBlock; |
| 734 } |
731 #if ENABLE(SVG) | 735 #if ENABLE(SVG) |
732 if (o->isSVGForeignObject()) //foreignObject is the containing block
for contents inside it | 736 if (o->isSVGForeignObject()) //foreignObject is the containing block
for contents inside it |
733 break; | 737 break; |
734 #endif | 738 #endif |
735 | 739 |
736 o = o->parent(); | 740 o = o->parent(); |
737 } | 741 } |
738 } else { | 742 } else { |
739 while (o && ((o->isInline() && !o->isReplaced()) || o->isTableRow() || o
->isTableSection() | 743 while (o && ((o->isInline() && !o->isReplaced()) || o->isTableRow() || o
->isTableSection() |
740 || o->isTableCol() || o->isFrameSet() || o->isMedia() | 744 || o->isTableCol() || o->isFrameSet() || o->isMedia() |
(...skipping 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2816 { | 2820 { |
2817 if (object1) { | 2821 if (object1) { |
2818 const WebCore::RenderObject* root = object1; | 2822 const WebCore::RenderObject* root = object1; |
2819 while (root->parent()) | 2823 while (root->parent()) |
2820 root = root->parent(); | 2824 root = root->parent(); |
2821 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 2825 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
2822 } | 2826 } |
2823 } | 2827 } |
2824 | 2828 |
2825 #endif | 2829 #endif |
OLD | NEW |