| 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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 break; | 850 break; |
| 851 } | 851 } |
| 852 o = container; | 852 o = container; |
| 853 } | 853 } |
| 854 } | 854 } |
| 855 | 855 |
| 856 LayoutBlock* LayoutObject::containerForFixedPosition(const LayoutBoxModelObject*
paintInvalidationContainer, bool* paintInvalidationContainerSkipped) const | 856 LayoutBlock* LayoutObject::containerForFixedPosition(const LayoutBoxModelObject*
paintInvalidationContainer, bool* paintInvalidationContainerSkipped) const |
| 857 { | 857 { |
| 858 ASSERT(!paintInvalidationContainerSkipped || !*paintInvalidationContainerSki
pped); | 858 ASSERT(!paintInvalidationContainerSkipped || !*paintInvalidationContainerSki
pped); |
| 859 ASSERT(!isText()); | 859 ASSERT(!isText()); |
| 860 ASSERT(style()->position() == FixedPosition); | 860 // Ideally we'd like to ASSERT here, but containingBlock(overrideStyle) can
hit this |
| 861 // when calculating containingBlock if the style was changed to overrideStyl
e. |
| 862 // ASSERT(style()->position() == FixedPosition); |
| 861 | 863 |
| 862 LayoutObject* ancestor = parent(); | 864 LayoutObject* ancestor = parent(); |
| 863 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a
ncestor->parent()) { | 865 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a
ncestor->parent()) { |
| 864 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo
ntainer) | 866 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo
ntainer) |
| 865 *paintInvalidationContainerSkipped = true; | 867 *paintInvalidationContainerSkipped = true; |
| 866 } | 868 } |
| 867 | 869 |
| 868 ASSERT(!ancestor || !ancestor->isAnonymousBlock()); | 870 ASSERT(!ancestor || !ancestor->isAnonymousBlock()); |
| 869 return toLayoutBlock(ancestor); | 871 return toLayoutBlock(ancestor); |
| 870 } | 872 } |
| 871 | 873 |
| 872 LayoutBlock* LayoutObject::containingBlock() const | 874 LayoutBlock* LayoutObject::containingBlock(const ComputedStyle* overrideStyle) c
onst |
| 873 { | 875 { |
| 874 LayoutObject* o = parent(); | 876 LayoutObject* o = parent(); |
| 875 if (!o && isLayoutScrollbarPart()) | 877 if (!o && isLayoutScrollbarPart()) |
| 876 o = toLayoutScrollbarPart(this)->layoutObjectOwningScrollbar(); | 878 o = toLayoutScrollbarPart(this)->layoutObjectOwningScrollbar(); |
| 877 if (!isTextOrSVGChild() && m_style->position() == FixedPosition) | 879 const ComputedStyle* style = overrideStyle ? overrideStyle : m_style.get(); |
| 880 if (!isTextOrSVGChild() && style->position() == FixedPosition) |
| 878 return containerForFixedPosition(); | 881 return containerForFixedPosition(); |
| 879 if (!isTextOrSVGChild() && m_style->position() == AbsolutePosition) { | 882 if (!isTextOrSVGChild() && style->position() == AbsolutePosition) { |
| 880 while (o) { | 883 while (o) { |
| 881 // For relpositioned inlines, we return the nearest non-anonymous en
closing block. We don't try | 884 // For relpositioned inlines, we return the nearest non-anonymous en
closing block. We don't try |
| 882 // to return the inline itself. This allows us to avoid having a po
sitioned objects | 885 // to return the inline itself. This allows us to avoid having a po
sitioned objects |
| 883 // list in all LayoutInlines and lets us return a strongly-typed Lay
outBlock* result | 886 // list in all LayoutInlines and lets us return a strongly-typed Lay
outBlock* result |
| 884 // from this method. The container() method can actually be used to
obtain the | 887 // from this method. The container() method can actually be used to
obtain the |
| 885 // inline directly. | 888 // inline directly. |
| 886 if (o->style()->position() != StaticPosition && (!o->isInline() || o
->isReplaced())) | 889 if (o->style()->position() != StaticPosition && (!o->isInline() || o
->isReplaced())) |
| 887 break; | 890 break; |
| 888 | 891 |
| 889 if (o->canContainFixedPositionObjects()) | 892 if (o->canContainFixedPositionObjects()) |
| (...skipping 2417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3307 const blink::LayoutObject* root = object1; | 3310 const blink::LayoutObject* root = object1; |
| 3308 while (root->parent()) | 3311 while (root->parent()) |
| 3309 root = root->parent(); | 3312 root = root->parent(); |
| 3310 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3313 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3311 } else { | 3314 } else { |
| 3312 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3315 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
| 3313 } | 3316 } |
| 3314 } | 3317 } |
| 3315 | 3318 |
| 3316 #endif | 3319 #endif |
| OLD | NEW |