Index: Source/core/dom/Node.cpp |
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp |
index 775c5e9c6b7aa73e3290e3aeb92a7b64ba32a130..6db1162e9fbe81ed4b5ad45a33cf8e7a53bfd63f 100644 |
--- a/Source/core/dom/Node.cpp |
+++ b/Source/core/dom/Node.cpp |
@@ -1068,7 +1068,7 @@ bool Node::containsIncludingHostElements(const Node* node) const |
return false; |
} |
-void Node::attach() |
+void Node::attach(const AttachContext&) |
{ |
ASSERT(!attached()); |
ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || renderer()->isRenderView()))); |
@@ -1111,7 +1111,7 @@ bool Node::inDetach() const |
} |
#endif |
-void Node::detach() |
+void Node::detach(const AttachContext& context) |
{ |
#ifndef NDEBUG |
ASSERT(!detachingNode); |
@@ -1122,13 +1122,17 @@ void Node::detach() |
renderer()->destroyAndCleanupAnonymousWrappers(); |
setRenderer(0); |
- Document* doc = document(); |
- if (isUserActionElement()) { |
- if (hovered()) |
- doc->hoveredNodeDetached(this); |
- if (inActiveChain()) |
- doc->activeChainNodeDetached(this); |
- doc->userActionElements().didDetach(this); |
+ // Do not remove the element's hovered and active status |
+ // if performing a reattach. |
+ if (!context.performingReattach) { |
+ Document* doc = document(); |
+ if (isUserActionElement()) { |
+ if (hovered()) |
+ doc->hoveredNodeDetached(this); |
+ if (inActiveChain()) |
+ doc->activeChainNodeDetached(this); |
+ doc->userActionElements().didDetach(this); |
+ } |
} |
clearFlag(IsAttachedFlag); |