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

Unified Diff: third_party/WebKit/Source/web/tests/WebFrameTest.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
« no previous file with comments | « third_party/WebKit/Source/core/page/ChromeClient.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index 089729b50e6e7f3a2dc6d7868477b3c9b1320942..b12abf964c8b1d5e34365c8018c46265f5676e60 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -10751,6 +10751,75 @@ TEST_F(WebFrameTest, HidingScrollbarsOnScrollableAreaDisablesScrollbars) {
scrollerArea->verticalScrollbar()->shouldParticipateInHitTesting());
}
+TEST_F(WebFrameTest, MouseOverDifferntNodeClearsTooltip) {
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initialize(true, nullptr, nullptr, nullptr,
+ [](WebSettings* settings) {});
+ webViewHelper.resize(WebSize(200, 200));
+ WebViewImpl* webView = webViewHelper.webView();
+
+ initializeWithHTML(
+ *webView->mainFrameImpl()->frame(),
+ "<head>"
+ " <style type='text/css'>"
+ " div"
+ " {"
+ " width: 200px;"
+ " height: 100px;"
+ " background-color: #eeeeff;"
+ " }"
+ " div:hover"
+ " {"
+ " background-color: #ddddff;"
+ " }"
+ " </style>"
+ "</head>"
+ "<body>"
+ " <div id='div1' title='Title Attribute Value'>Hover HERE</div>"
+ " <div id='div2' title='Title Attribute Value'>Then HERE</div>"
+ " <br><br><br>"
+ "</body>");
+
+ webView->updateAllLifecyclePhases();
+
+ Document* document = webView->mainFrameImpl()->frame()->document();
+ Element* div1Tag = document->getElementById("div1");
+
+ HitTestResult hitTestResult = webView->coreHitTestResultAt(
+ WebPoint(div1Tag->offsetLeft() + 5, div1Tag->offsetTop() + 5));
+
+ EXPECT_TRUE(hitTestResult.innerElement());
+
+ // Mouse over link. Mouse cursor should be hand.
+ PlatformMouseEvent mouseMoveOverLinkEvent(
+ IntPoint(div1Tag->offsetLeft() + 5, div1Tag->offsetTop() + 5),
+ IntPoint(div1Tag->offsetLeft() + 5, div1Tag->offsetTop() + 5),
+ WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0,
+ PlatformEvent::NoModifiers, TimeTicks::Now());
+ document->frame()->eventHandler().handleMouseMoveEvent(
+ mouseMoveOverLinkEvent, Vector<PlatformMouseEvent>());
+
+ EXPECT_EQ(document->hoverNode(),
+ document->frame()->chromeClient().lastSetTooltipNodeForTesting());
+ EXPECT_EQ(div1Tag,
+ document->frame()->chromeClient().lastSetTooltipNodeForTesting());
+
+ Element* div2Tag = document->getElementById("div2");
+
+ PlatformMouseEvent mouseMoveEvent(
+ IntPoint(div2Tag->offsetLeft() + 5, div2Tag->offsetTop() + 5),
+ IntPoint(div2Tag->offsetLeft() + 5, div2Tag->offsetTop() + 5),
+ WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0,
+ PlatformEvent::NoModifiers, TimeTicks::Now());
+ document->frame()->eventHandler().handleMouseMoveEvent(
+ mouseMoveEvent, Vector<PlatformMouseEvent>());
+
+ EXPECT_EQ(document->hoverNode(),
+ document->frame()->chromeClient().lastSetTooltipNodeForTesting());
+ EXPECT_EQ(div2Tag,
+ document->frame()->chromeClient().lastSetTooltipNodeForTesting());
+}
+
// Makes sure that mouse hover over an overlay scrollbar doesn't activate
// elements below unless the scrollbar is faded out.
TEST_F(WebFrameTest, MouseOverLinkAndOverlayScrollbar) {
« no previous file with comments | « third_party/WebKit/Source/core/page/ChromeClient.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698