Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index 5ef85b8c99b269694a820145e9b53603cb2d594f..71359b57440c67b0d0964ba4a2922903acecb43f 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -5424,10 +5424,20 @@ void Document::updateHoverActiveState(const HitTestRequest& request, Element* in |
} |
} |
- // Now set the hover state for our new object up to the root. |
- for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) { |
- if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->node()->inActiveChain())) |
- nodesToAddToChain.append(curr->node()); |
+ if (oldHoverObj == newHoverObj && request.leave()) { |
+ // clear hover path upto including the ancestor |
+ for (RenderObject* curr = oldHoverObj; curr; curr = curr->hoverAncestor()) { |
+ if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->node()->inActiveChain())) { |
+ nodesToRemoveFromChain.append(curr->node()); |
+ } |
+ } |
+ setHoverNode(nullptr); |
+ } else { |
+ // Now set the hover state for our new object up to the root. |
+ for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) { |
+ if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->node()->inActiveChain())) |
+ nodesToAddToChain.append(curr->node()); |
+ } |
} |
// mouseenter and mouseleave events do not bubble, so they are dispatched iff there is a capturing |