Index: third_party/WebKit/Source/core/page/ChromeClient.cpp |
diff --git a/third_party/WebKit/Source/core/page/ChromeClient.cpp b/third_party/WebKit/Source/core/page/ChromeClient.cpp |
index 0722386ff3d352bc587e7520346c1acf7da69b34..f8ad9928516cbc0766da5b48563bdf65f45f4f9f 100644 |
--- a/third_party/WebKit/Source/core/page/ChromeClient.cpp |
+++ b/third_party/WebKit/Source/core/page/ChromeClient.cpp |
@@ -38,6 +38,11 @@ |
namespace blink { |
+DEFINE_TRACE(ChromeClient) { |
+ visitor->trace(m_lastMouseOverNode); |
+ HostWindow::trace(visitor); |
+} |
+ |
void ChromeClient::setWindowRectWithAdjustment(const IntRect& pendingRect, |
LocalFrame& frame) { |
IntRect screen = screenInfo().availableRect; |
@@ -190,8 +195,20 @@ void ChromeClient::setToolTip(LocalFrame& frame, const HitTestResult& result) { |
if (m_lastToolTipPoint == result.hitTestLocation().point() && |
m_lastToolTipText == toolTip) |
return; |
+ |
+ // If a tooltip was displayed earlier, and mouse cursor moves over |
+ // a different node with the same tooltip text, make sure the previous |
+ // tooltip is unset, so that it does not get stuck positioned relative |
+ // to the previous node). |
+ // The ::setToolTip overload, which is be called down the road, |
+ // ensures a new tooltip to be displayed with the new context. |
+ if (result.innerNodeOrImageMapImage() != m_lastMouseOverNode && |
+ !m_lastToolTipText.isEmpty() && toolTip == m_lastToolTipText) |
+ clearToolTip(frame); |
+ |
m_lastToolTipPoint = result.hitTestLocation().point(); |
m_lastToolTipText = toolTip; |
+ m_lastMouseOverNode = result.innerNodeOrImageMapImage(); |
setToolTip(frame, toolTip, toolTipDirection); |
} |