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 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 if (node == this) | 1080 if (node == this) |
1081 return true; | 1081 return true; |
1082 if (node->isDocumentFragment() && static_cast<const DocumentFragment*>(n
ode)->isTemplateContent()) | 1082 if (node->isDocumentFragment() && static_cast<const DocumentFragment*>(n
ode)->isTemplateContent()) |
1083 node = static_cast<const TemplateContentDocumentFragment*>(node)->ho
st(); | 1083 node = static_cast<const TemplateContentDocumentFragment*>(node)->ho
st(); |
1084 else | 1084 else |
1085 node = node->parentOrShadowHostNode(); | 1085 node = node->parentOrShadowHostNode(); |
1086 } | 1086 } |
1087 return false; | 1087 return false; |
1088 } | 1088 } |
1089 | 1089 |
1090 void Node::attach() | 1090 void Node::attach(const AttachContext&) |
1091 { | 1091 { |
1092 ASSERT(!attached()); | 1092 ASSERT(!attached()); |
1093 ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || rende
rer()->isRenderView()))); | 1093 ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || rende
rer()->isRenderView()))); |
1094 | 1094 |
1095 // If this node got a renderer it may be the previousRenderer() of sibling t
ext nodes and thus affect the | 1095 // If this node got a renderer it may be the previousRenderer() of sibling t
ext nodes and thus affect the |
1096 // result of Text::textRendererIsNeeded() for those nodes. | 1096 // result of Text::textRendererIsNeeded() for those nodes. |
1097 if (renderer()) { | 1097 if (renderer()) { |
1098 for (Node* next = nextSibling(); next; next = next->nextSibling()) { | 1098 for (Node* next = nextSibling(); next; next = next->nextSibling()) { |
1099 if (next->renderer()) | 1099 if (next->renderer()) |
1100 break; | 1100 break; |
(...skipping 22 matching lines...) Expand all Loading... |
1123 | 1123 |
1124 #ifndef NDEBUG | 1124 #ifndef NDEBUG |
1125 static Node* detachingNode; | 1125 static Node* detachingNode; |
1126 | 1126 |
1127 bool Node::inDetach() const | 1127 bool Node::inDetach() const |
1128 { | 1128 { |
1129 return detachingNode == this; | 1129 return detachingNode == this; |
1130 } | 1130 } |
1131 #endif | 1131 #endif |
1132 | 1132 |
1133 void Node::detach() | 1133 void Node::detach(const AttachContext& context) |
1134 { | 1134 { |
1135 #ifndef NDEBUG | 1135 #ifndef NDEBUG |
1136 ASSERT(!detachingNode); | 1136 ASSERT(!detachingNode); |
1137 detachingNode = this; | 1137 detachingNode = this; |
1138 #endif | 1138 #endif |
1139 | 1139 |
1140 if (renderer()) | 1140 if (renderer()) |
1141 renderer()->destroyAndCleanupAnonymousWrappers(); | 1141 renderer()->destroyAndCleanupAnonymousWrappers(); |
1142 setRenderer(0); | 1142 setRenderer(0); |
1143 | 1143 |
1144 Document* doc = document(); | 1144 // Do not remove the element's hovered and active status |
1145 if (isUserActionElement()) { | 1145 // if performing a reattach. |
1146 if (hovered()) | 1146 if (!context.performingReattach) { |
1147 doc->hoveredNodeDetached(this); | 1147 Document* doc = document(); |
1148 if (inActiveChain()) | 1148 if (isUserActionElement()) { |
1149 doc->activeChainNodeDetached(this); | 1149 if (hovered()) |
1150 doc->userActionElements().didDetach(this); | 1150 doc->hoveredNodeDetached(this); |
| 1151 if (inActiveChain()) |
| 1152 doc->activeChainNodeDetached(this); |
| 1153 doc->userActionElements().didDetach(this); |
| 1154 } |
1151 } | 1155 } |
1152 | 1156 |
1153 clearFlag(IsAttachedFlag); | 1157 clearFlag(IsAttachedFlag); |
1154 | 1158 |
1155 #ifndef NDEBUG | 1159 #ifndef NDEBUG |
1156 detachingNode = 0; | 1160 detachingNode = 0; |
1157 #endif | 1161 #endif |
1158 } | 1162 } |
1159 | 1163 |
1160 // FIXME: This code is used by editing. Seems like it could move over there and
not pollute Node. | 1164 // 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... |
2781 node->showTreeForThis(); | 2785 node->showTreeForThis(); |
2782 } | 2786 } |
2783 | 2787 |
2784 void showNodePath(const WebCore::Node* node) | 2788 void showNodePath(const WebCore::Node* node) |
2785 { | 2789 { |
2786 if (node) | 2790 if (node) |
2787 node->showNodePathForThis(); | 2791 node->showNodePathForThis(); |
2788 } | 2792 } |
2789 | 2793 |
2790 #endif | 2794 #endif |
OLD | NEW |