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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 } | 710 } |
711 | 711 |
712 RenderBlock* RenderObject::containingBlock() const | 712 RenderBlock* RenderObject::containingBlock() const |
713 { | 713 { |
714 RenderObject* o = parent(); | 714 RenderObject* o = parent(); |
715 if (!isText() && m_style->position() == FixedPosition) { | 715 if (!isText() && m_style->position() == FixedPosition) { |
716 while (o && !o->isRenderView() && !(o->hasTransform() && o->isRenderBloc
k())) | 716 while (o && !o->isRenderView() && !(o->hasTransform() && o->isRenderBloc
k())) |
717 o = o->parent(); | 717 o = o->parent(); |
718 } else if (!isText() && m_style->position() == AbsolutePosition) { | 718 } else if (!isText() && m_style->position() == AbsolutePosition) { |
719 while (o && (o->style()->position() == StaticPosition || (o->isInline()
&& !o->isReplaced())) && !o->isRenderView() && !(o->hasTransform() && o->isRende
rBlock())) { | 719 while (o && (o->style()->position() == StaticPosition || (o->isInline()
&& !o->isReplaced())) && !o->isRenderView() && !(o->hasTransform() && o->isRende
rBlock())) { |
720 // For relpositioned inlines, we return the nearest enclosing block.
We don't try | 720 // For relpositioned inlines, we return the nearest non-anonymous en
closing block. We don't try |
721 // to return the inline itself. This allows us to avoid having a po
sitioned objects | 721 // to return the inline itself. This allows us to avoid having a po
sitioned objects |
722 // list in all RenderInlines and lets us return a strongly-typed Ren
derBlock* result | 722 // list in all RenderInlines and lets us return a strongly-typed Ren
derBlock* result |
723 // from this method. The container() method can actually be used to
obtain the | 723 // from this method. The container() method can actually be used to
obtain the |
724 // inline directly. | 724 // inline directly. |
725 if (o->style()->position() == RelativePosition && o->isInline() && !
o->isReplaced()) | 725 if (o->style()->position() == RelativePosition && o->isInline() && !
o->isReplaced()) { |
726 return o->containingBlock(); | 726 RenderBlock* relPositionedInlineContainingBlock = o->containingB
lock(); |
| 727 while (relPositionedInlineContainingBlock->isAnonymousBlock()) |
| 728 relPositionedInlineContainingBlock = relPositionedInlineCont
ainingBlock->containingBlock(); |
| 729 return relPositionedInlineContainingBlock; |
| 730 } |
727 #if ENABLE(SVG) | 731 #if ENABLE(SVG) |
728 if (o->isSVGForeignObject()) //foreignObject is the containing block
for contents inside it | 732 if (o->isSVGForeignObject()) //foreignObject is the containing block
for contents inside it |
729 break; | 733 break; |
730 #endif | 734 #endif |
731 | 735 |
732 o = o->parent(); | 736 o = o->parent(); |
733 } | 737 } |
734 } else { | 738 } else { |
735 while (o && ((o->isInline() && !o->isReplaced()) || o->isTableRow() || o
->isTableSection() | 739 while (o && ((o->isInline() && !o->isReplaced()) || o->isTableRow() || o
->isTableSection() |
736 || o->isTableCol() || o->isFrameSet() || o->isMedia() | 740 || o->isTableCol() || o->isFrameSet() || o->isMedia() |
(...skipping 2056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2793 { | 2797 { |
2794 if (object1) { | 2798 if (object1) { |
2795 const WebCore::RenderObject* root = object1; | 2799 const WebCore::RenderObject* root = object1; |
2796 while (root->parent()) | 2800 while (root->parent()) |
2797 root = root->parent(); | 2801 root = root->parent(); |
2798 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 2802 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
2799 } | 2803 } |
2800 } | 2804 } |
2801 | 2805 |
2802 #endif | 2806 #endif |
OLD | NEW |