| 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 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 ASSERT(document().inStyleRecalc() || isDocumentNode()); | 992 ASSERT(document().inStyleRecalc() || isDocumentNode()); |
| 993 ASSERT(needsAttach()); | 993 ASSERT(needsAttach()); |
| 994 ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || rende
rer()->isRenderView()))); | 994 ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || rende
rer()->isRenderView()))); |
| 995 | 995 |
| 996 clearNeedsStyleRecalc(); | 996 clearNeedsStyleRecalc(); |
| 997 | 997 |
| 998 if (AXObjectCache* cache = document().axObjectCache()) | 998 if (AXObjectCache* cache = document().axObjectCache()) |
| 999 cache->updateCacheAfterNodeIsAttached(this); | 999 cache->updateCacheAfterNodeIsAttached(this); |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 #ifndef NDEBUG | 1002 #if ENABLE(ASSERT) |
| 1003 static Node* detachingNode; | 1003 static Node* detachingNode; |
| 1004 | 1004 |
| 1005 bool Node::inDetach() const | 1005 bool Node::inDetach() const |
| 1006 { | 1006 { |
| 1007 return detachingNode == this; | 1007 return detachingNode == this; |
| 1008 } | 1008 } |
| 1009 #endif | 1009 #endif |
| 1010 | 1010 |
| 1011 void Node::detach(const AttachContext& context) | 1011 void Node::detach(const AttachContext& context) |
| 1012 { | 1012 { |
| 1013 ASSERT(document().lifecycle().stateAllowsDetach()); | 1013 ASSERT(document().lifecycle().stateAllowsDetach()); |
| 1014 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); | 1014 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); |
| 1015 | 1015 |
| 1016 #ifndef NDEBUG | 1016 #if ENABLE(ASSERT) |
| 1017 ASSERT(!detachingNode); | 1017 ASSERT(!detachingNode); |
| 1018 detachingNode = this; | 1018 detachingNode = this; |
| 1019 #endif | 1019 #endif |
| 1020 | 1020 |
| 1021 if (renderer()) | 1021 if (renderer()) |
| 1022 renderer()->destroyAndCleanupAnonymousWrappers(); | 1022 renderer()->destroyAndCleanupAnonymousWrappers(); |
| 1023 setRenderer(0); | 1023 setRenderer(0); |
| 1024 | 1024 |
| 1025 // Do not remove the element's hovered and active status | 1025 // Do not remove the element's hovered and active status |
| 1026 // if performing a reattach. | 1026 // if performing a reattach. |
| 1027 if (!context.performingReattach) { | 1027 if (!context.performingReattach) { |
| 1028 Document& doc = document(); | 1028 Document& doc = document(); |
| 1029 if (isUserActionElement()) { | 1029 if (isUserActionElement()) { |
| 1030 if (hovered()) | 1030 if (hovered()) |
| 1031 doc.hoveredNodeDetached(this); | 1031 doc.hoveredNodeDetached(this); |
| 1032 if (inActiveChain()) | 1032 if (inActiveChain()) |
| 1033 doc.activeChainNodeDetached(this); | 1033 doc.activeChainNodeDetached(this); |
| 1034 doc.userActionElements().didDetach(this); | 1034 doc.userActionElements().didDetach(this); |
| 1035 } | 1035 } |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 setStyleChange(NeedsReattachStyleChange); | 1038 setStyleChange(NeedsReattachStyleChange); |
| 1039 setChildNeedsStyleRecalc(); | 1039 setChildNeedsStyleRecalc(); |
| 1040 | 1040 |
| 1041 if (StyleResolver* resolver = document().styleResolver()) | 1041 if (StyleResolver* resolver = document().styleResolver()) |
| 1042 resolver->ruleFeatureSet().styleInvalidator().clearInvalidation(*this); | 1042 resolver->ruleFeatureSet().styleInvalidator().clearInvalidation(*this); |
| 1043 clearChildNeedsStyleInvalidation(); | 1043 clearChildNeedsStyleInvalidation(); |
| 1044 clearNeedsStyleInvalidation(); | 1044 clearNeedsStyleInvalidation(); |
| 1045 | 1045 |
| 1046 #ifndef NDEBUG | 1046 #if ENABLE(ASSERT) |
| 1047 detachingNode = 0; | 1047 detachingNode = 0; |
| 1048 #endif | 1048 #endif |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 void Node::reattachWhitespaceSiblings(Text* start) | 1051 void Node::reattachWhitespaceSiblings(Text* start) |
| 1052 { | 1052 { |
| 1053 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { | 1053 for (Node* sibling = start; sibling; sibling = sibling->nextSibling()) { |
| 1054 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace())
{ | 1054 if (sibling->isTextNode() && toText(sibling)->containsOnlyWhitespace())
{ |
| 1055 bool hadRenderer = !!sibling->renderer(); | 1055 bool hadRenderer = !!sibling->renderer(); |
| 1056 sibling->reattach(); | 1056 sibling->reattach(); |
| (...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2579 node->showTreeForThis(); | 2579 node->showTreeForThis(); |
| 2580 } | 2580 } |
| 2581 | 2581 |
| 2582 void showNodePath(const WebCore::Node* node) | 2582 void showNodePath(const WebCore::Node* node) |
| 2583 { | 2583 { |
| 2584 if (node) | 2584 if (node) |
| 2585 node->showNodePathForThis(); | 2585 node->showNodePathForThis(); |
| 2586 } | 2586 } |
| 2587 | 2587 |
| 2588 #endif | 2588 #endif |
| OLD | NEW |