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 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 if (node == this) | 1061 if (node == this) |
1062 return true; | 1062 return true; |
1063 if (node->isDocumentFragment() && static_cast<const DocumentFragment*>(n
ode)->isTemplateContent()) | 1063 if (node->isDocumentFragment() && static_cast<const DocumentFragment*>(n
ode)->isTemplateContent()) |
1064 node = static_cast<const TemplateContentDocumentFragment*>(node)->ho
st(); | 1064 node = static_cast<const TemplateContentDocumentFragment*>(node)->ho
st(); |
1065 else | 1065 else |
1066 node = node->parentOrShadowHostNode(); | 1066 node = node->parentOrShadowHostNode(); |
1067 } | 1067 } |
1068 return false; | 1068 return false; |
1069 } | 1069 } |
1070 | 1070 |
1071 void Node::attach() | 1071 void Node::attach(const AttachContext&) |
1072 { | 1072 { |
1073 ASSERT(!attached()); | 1073 ASSERT(!attached()); |
1074 ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || rende
rer()->isRenderView()))); | 1074 ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || rende
rer()->isRenderView()))); |
1075 | 1075 |
1076 // If this node got a renderer it may be the previousRenderer() of sibling t
ext nodes and thus affect the | 1076 // If this node got a renderer it may be the previousRenderer() of sibling t
ext nodes and thus affect the |
1077 // result of Text::textRendererIsNeeded() for those nodes. | 1077 // result of Text::textRendererIsNeeded() for those nodes. |
1078 if (renderer()) { | 1078 if (renderer()) { |
1079 for (Node* next = nextSibling(); next; next = next->nextSibling()) { | 1079 for (Node* next = nextSibling(); next; next = next->nextSibling()) { |
1080 if (next->renderer()) | 1080 if (next->renderer()) |
1081 break; | 1081 break; |
(...skipping 22 matching lines...) Expand all Loading... |
1104 | 1104 |
1105 #ifndef NDEBUG | 1105 #ifndef NDEBUG |
1106 static Node* detachingNode; | 1106 static Node* detachingNode; |
1107 | 1107 |
1108 bool Node::inDetach() const | 1108 bool Node::inDetach() const |
1109 { | 1109 { |
1110 return detachingNode == this; | 1110 return detachingNode == this; |
1111 } | 1111 } |
1112 #endif | 1112 #endif |
1113 | 1113 |
1114 void Node::detach() | 1114 void Node::detach(const AttachContext& context) |
1115 { | 1115 { |
1116 #ifndef NDEBUG | 1116 #ifndef NDEBUG |
1117 ASSERT(!detachingNode); | 1117 ASSERT(!detachingNode); |
1118 detachingNode = this; | 1118 detachingNode = this; |
1119 #endif | 1119 #endif |
1120 | 1120 |
1121 if (renderer()) | 1121 if (renderer()) |
1122 renderer()->destroyAndCleanupAnonymousWrappers(); | 1122 renderer()->destroyAndCleanupAnonymousWrappers(); |
1123 setRenderer(0); | 1123 setRenderer(0); |
1124 | 1124 |
1125 Document* doc = document(); | 1125 // Do not remove the element's hovered and active status |
1126 if (isUserActionElement()) { | 1126 // if performing a reattach. |
1127 if (hovered()) | 1127 if (!context.performingReattach) { |
1128 doc->hoveredNodeDetached(this); | 1128 Document* doc = document(); |
1129 if (inActiveChain()) | 1129 if (isUserActionElement()) { |
1130 doc->activeChainNodeDetached(this); | 1130 if (hovered()) |
1131 doc->userActionElements().didDetach(this); | 1131 doc->hoveredNodeDetached(this); |
| 1132 if (inActiveChain()) |
| 1133 doc->activeChainNodeDetached(this); |
| 1134 doc->userActionElements().didDetach(this); |
| 1135 } |
1132 } | 1136 } |
1133 | 1137 |
1134 clearFlag(IsAttachedFlag); | 1138 clearFlag(IsAttachedFlag); |
1135 | 1139 |
1136 #ifndef NDEBUG | 1140 #ifndef NDEBUG |
1137 detachingNode = 0; | 1141 detachingNode = 0; |
1138 #endif | 1142 #endif |
1139 } | 1143 } |
1140 | 1144 |
1141 // FIXME: This code is used by editing. Seems like it could move over there and
not pollute Node. | 1145 // FIXME: This code is used by editing. Seems like it could move over there and
not pollute Node. |
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2762 node->showTreeForThis(); | 2766 node->showTreeForThis(); |
2763 } | 2767 } |
2764 | 2768 |
2765 void showNodePath(const WebCore::Node* node) | 2769 void showNodePath(const WebCore::Node* node) |
2766 { | 2770 { |
2767 if (node) | 2771 if (node) |
2768 node->showNodePathForThis(); | 2772 node->showNodePathForThis(); |
2769 } | 2773 } |
2770 | 2774 |
2771 #endif | 2775 #endif |
OLD | NEW |