| 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) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 ASSERT(document().inStyleRecalc() || isDocumentNode()); | 924 ASSERT(document().inStyleRecalc() || isDocumentNode()); |
| 925 ASSERT(needsAttach()); | 925 ASSERT(needsAttach()); |
| 926 ASSERT(!layoutObject() || (layoutObject()->style() && (layoutObject()->paren
t() || layoutObject()->isLayoutView()))); | 926 ASSERT(!layoutObject() || (layoutObject()->style() && (layoutObject()->paren
t() || layoutObject()->isLayoutView()))); |
| 927 | 927 |
| 928 clearNeedsStyleRecalc(); | 928 clearNeedsStyleRecalc(); |
| 929 | 929 |
| 930 if (AXObjectCache* cache = document().axObjectCache()) | 930 if (AXObjectCache* cache = document().axObjectCache()) |
| 931 cache->updateCacheAfterNodeIsAttached(this); | 931 cache->updateCacheAfterNodeIsAttached(this); |
| 932 } | 932 } |
| 933 | 933 |
| 934 #if ENABLE(ASSERT) | |
| 935 static Node* detachingNode; | |
| 936 | |
| 937 bool Node::inDetach() const | |
| 938 { | |
| 939 return detachingNode == this; | |
| 940 } | |
| 941 #endif | |
| 942 | |
| 943 void Node::detach(const AttachContext& context) | 934 void Node::detach(const AttachContext& context) |
| 944 { | 935 { |
| 945 ASSERT(document().lifecycle().stateAllowsDetach()); | 936 ASSERT(document().lifecycle().stateAllowsDetach()); |
| 946 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); | 937 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); |
| 947 | 938 |
| 948 #if ENABLE(ASSERT) | |
| 949 // The detaching might trigger destruction of a popup menu window, | |
| 950 // with ensuing detachment of its Nodes. In a separate document, so | |
| 951 // don't assert for these, but do set detachingNode to the most recent | |
| 952 // Node being detached. | |
| 953 ASSERT(!detachingNode || detachingNode->document() != document()); | |
| 954 detachingNode = this; | |
| 955 #endif | |
| 956 | |
| 957 if (layoutObject()) | 939 if (layoutObject()) |
| 958 layoutObject()->destroyAndCleanupAnonymousWrappers(); | 940 layoutObject()->destroyAndCleanupAnonymousWrappers(); |
| 959 setLayoutObject(nullptr); | 941 setLayoutObject(nullptr); |
| 960 | 942 |
| 961 setStyleChange(NeedsReattachStyleChange); | 943 setStyleChange(NeedsReattachStyleChange); |
| 962 clearChildNeedsStyleInvalidation(); | 944 clearChildNeedsStyleInvalidation(); |
| 963 | |
| 964 #if ENABLE(ASSERT) | |
| 965 detachingNode = nullptr; | |
| 966 #endif | |
| 967 } | 945 } |
| 968 | 946 |
| 969 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start) | 947 void Node::reattachWhitespaceSiblingsIfNeeded(Text* start) |
| 970 { | 948 { |
| 971 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { | 949 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { |
| 972 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace())
{ | 950 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace())
{ |
| 973 bool hadLayoutObject = !!sibling->layoutObject(); | 951 bool hadLayoutObject = !!sibling->layoutObject(); |
| 974 toText(sibling)->reattachIfNeeded(); | 952 toText(sibling)->reattachIfNeeded(); |
| 975 // If sibling's layout object status didn't change we don't need to
continue checking | 953 // If sibling's layout object status didn't change we don't need to
continue checking |
| 976 // other siblings since their layout object status won't change eith
er. | 954 // other siblings since their layout object status won't change eith
er. |
| (...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 | 2459 |
| 2482 void showNodePath(const blink::Node* node) | 2460 void showNodePath(const blink::Node* node) |
| 2483 { | 2461 { |
| 2484 if (node) | 2462 if (node) |
| 2485 node->showNodePathForThis(); | 2463 node->showNodePathForThis(); |
| 2486 else | 2464 else |
| 2487 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2465 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
| 2488 } | 2466 } |
| 2489 | 2467 |
| 2490 #endif | 2468 #endif |
| OLD | NEW |