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 05238fe1cbbfb262c462aad2cbaf99cee8da6f50..34782641ad47786a8d7fa548ca16eb33ebc3cc19 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; |
@@ -188,8 +193,18 @@ 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 the user has moved the mouse |
+ // cursor over a different node, make sure the previous tooltip is unset. |
+ // If the newly hovered node has a tooltip, then ::setToolTip will be called |
+ // later with the new text. |
+ 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); |
} |