| 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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 LayoutObject* ancestor = parent(); | 858 LayoutObject* ancestor = parent(); |
| 859 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a
ncestor->parent()) { | 859 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a
ncestor->parent()) { |
| 860 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo
ntainer) | 860 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo
ntainer) |
| 861 *paintInvalidationContainerSkipped = true; | 861 *paintInvalidationContainerSkipped = true; |
| 862 } | 862 } |
| 863 | 863 |
| 864 ASSERT(!ancestor || !ancestor->isAnonymousBlock()); | 864 ASSERT(!ancestor || !ancestor->isAnonymousBlock()); |
| 865 return toLayoutBlock(ancestor); | 865 return toLayoutBlock(ancestor); |
| 866 } | 866 } |
| 867 | 867 |
| 868 LayoutBlock* LayoutObject::containingBlockForAbsolutePosition() const |
| 869 { |
| 870 LayoutObject* o = parent(); |
| 871 while (o) { |
| 872 if (o->style()->position() != StaticPosition && (!o->isInline() || o->is
Replaced())) |
| 873 break; |
| 874 |
| 875 if (o->canContainFixedPositionObjects()) |
| 876 break; |
| 877 |
| 878 o = o->parent(); |
| 879 } |
| 880 |
| 881 if (o && !o->isLayoutBlock()) |
| 882 o = o->containingBlock(); |
| 883 |
| 884 while (o && o->isAnonymousBlock()) |
| 885 o = o->containingBlock(); |
| 886 |
| 887 if (!o || !o->isLayoutBlock()) |
| 888 return nullptr; // This can still happen in case of an orphaned tree |
| 889 |
| 890 return toLayoutBlock(o); |
| 891 } |
| 892 |
| 868 LayoutBlock* LayoutObject::containingBlock() const | 893 LayoutBlock* LayoutObject::containingBlock() const |
| 869 { | 894 { |
| 870 LayoutObject* o = parent(); | 895 LayoutObject* o = parent(); |
| 871 if (!o && isLayoutScrollbarPart()) | 896 if (!o && isLayoutScrollbarPart()) |
| 872 o = toLayoutScrollbarPart(this)->layoutObjectOwningScrollbar(); | 897 o = toLayoutScrollbarPart(this)->layoutObjectOwningScrollbar(); |
| 873 if (!isTextOrSVGChild() && m_style->position() == FixedPosition) | 898 if (!isTextOrSVGChild()) { |
| 874 return containerForFixedPosition(); | 899 if (m_style->position() == FixedPosition) |
| 875 if (!isTextOrSVGChild() && m_style->position() == AbsolutePosition) { | 900 return containerForFixedPosition(); |
| 876 while (o) { | 901 if (m_style->position() == AbsolutePosition) |
| 877 if (o->style()->position() != StaticPosition && (!o->isInline() || o
->isReplaced())) | 902 return containingBlockForAbsolutePosition(); |
| 878 break; | 903 } |
| 879 | 904 if (isColumnSpanAll()) { |
| 880 if (o->canContainFixedPositionObjects()) | |
| 881 break; | |
| 882 | |
| 883 o = o->parent(); | |
| 884 } | |
| 885 | |
| 886 if (o && !o->isLayoutBlock()) | |
| 887 o = o->containingBlock(); | |
| 888 | |
| 889 while (o && o->isAnonymousBlock()) | |
| 890 o = o->containingBlock(); | |
| 891 } else if (isColumnSpanAll()) { | |
| 892 o = spannerPlaceholder()->containingBlock(); | 905 o = spannerPlaceholder()->containingBlock(); |
| 893 } else { | 906 } else { |
| 894 while (o && ((o->isInline() && !o->isReplaced()) || !o->isLayoutBlock())
) | 907 while (o && ((o->isInline() && !o->isReplaced()) || !o->isLayoutBlock())
) |
| 895 o = o->parent(); | 908 o = o->parent(); |
| 896 } | 909 } |
| 897 | 910 |
| 898 if (!o || !o->isLayoutBlock()) | 911 if (!o || !o->isLayoutBlock()) |
| 899 return nullptr; // This can still happen in case of an orphaned tree | 912 return nullptr; // This can still happen in case of an orphaned tree |
| 900 | 913 |
| 901 return toLayoutBlock(o); | 914 return toLayoutBlock(o); |
| (...skipping 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3276 const blink::LayoutObject* root = object1; | 3289 const blink::LayoutObject* root = object1; |
| 3277 while (root->parent()) | 3290 while (root->parent()) |
| 3278 root = root->parent(); | 3291 root = root->parent(); |
| 3279 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3292 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3280 } else { | 3293 } else { |
| 3281 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3294 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
| 3282 } | 3295 } |
| 3283 } | 3296 } |
| 3284 | 3297 |
| 3285 #endif | 3298 #endif |
| OLD | NEW |