Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(882)

Unified Diff: third_party/WebKit/Source/core/page/ChromeClient.cpp

Issue 2592263003: Send an empty tooltip text when hovering over a different node (Closed)
Patch Set: Send an empty tooltip text when hoverring over a different node Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
« no previous file with comments | « third_party/WebKit/Source/core/page/ChromeClient.h ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698