Chromium Code Reviews| 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 190c5c7e242c96804b85905e39ea7b9278c24185..40b38de2ef8be4f60dccafb6124d66139f56761a 100644 |
| --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
| +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
| @@ -10491,6 +10491,7 @@ TEST_F(WebFrameTest, MouseOverLinkAndOverlayScrollbar) { |
| EXPECT_TRUE(hitTestResult.URLElement()); |
| EXPECT_TRUE(hitTestResult.innerElement()); |
| EXPECT_TRUE(hitTestResult.scrollbar()); |
| + EXPECT_TRUE(hitTestResult.scrollbar()->isOverlayScrollbar()); |
| // Mouse over link. Mouse cursor should be hand. |
| PlatformMouseEvent mouseMoveOverLinkEvent( |
| @@ -10558,6 +10559,57 @@ TEST_F(WebFrameTest, MouseOverLinkAndOverlayScrollbar) { |
| document->frame()->eventHandler().handleMouseReleaseEvent(MouseReleaseEvent); |
| } |
| + |
| +// Makes sure that mouse hover over an custom scrollbar doesn't change the |
| +// activate elements. |
| +TEST_F(WebFrameTest, MouseOverCustomScrollbar) { |
| + registerMockedHttpURLLoad("custom-scrollbar-hover.html"); |
| + FrameTestHelpers::WebViewHelper webViewHelper; |
| + WebViewImpl* webView = webViewHelper.initializeAndLoad( |
| + m_baseURL + "custom-scrollbar-hover.html", true, nullptr, nullptr, |
| + nullptr, |
| + [](WebSettings* settings) { settings->setDeviceSupportsMouse(true); }); |
|
bokan
2016/11/23 15:07:50
This is unneeded, deviceSupportsMouse=true is the
|
| + |
| + webViewHelper.resize(WebSize(200, 200)); |
| + |
| + webView->updateAllLifecyclePhases(); |
| + |
| + Document* document = toLocalFrame(webView->page()->mainFrame())->document(); |
| + |
| + // Ensure hittest only has DIV |
| + HitTestResult hitTestResult = webView->coreHitTestResultAt(WebPoint(1, 1)); |
| + |
| + EXPECT_TRUE(hitTestResult.innerElement()); |
| + EXPECT_FALSE(hitTestResult.scrollbar()); |
| + |
| + // Mouse over DIV |
| + PlatformMouseEvent mouseMoveOverDiv( |
| + IntPoint(1, 1), IntPoint(1, 1), WebPointerProperties::Button::NoButton, |
| + PlatformEvent::MouseMoved, 0, PlatformEvent::NoModifiers, |
| + WTF::monotonicallyIncreasingTime()); |
| + document->frame()->eventHandler().handleMouseMoveEvent(mouseMoveOverDiv); |
| + |
| + // DIV :hover |
| + EXPECT_TRUE(document->hoverNode()); |
|
bokan
2016/11/23 15:07:50
Make sure this is false before the mouse event. Al
|
| + |
| + // Ensure hittest has DIV and scrollbar |
| + hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 175)); |
| + |
| + EXPECT_TRUE(hitTestResult.innerElement()); |
| + EXPECT_TRUE(hitTestResult.scrollbar()); |
| + |
| + // Mouse over DIV |
| + PlatformMouseEvent mouseMoveOverDivAndScrollbar( |
| + IntPoint(175, 175), IntPoint(175, 175), |
| + WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, |
| + PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); |
| + document->frame()->eventHandler().handleMouseMoveEvent( |
| + mouseMoveOverDivAndScrollbar); |
| + |
| + // Custom not change the DIV :hover |
| + EXPECT_TRUE(document->hoverNode()); |
|
bokan
2016/11/23 15:07:50
Isn't the bug that the scrollbar doesn't get a hov
chaopeng
2016/11/23 16:58:36
No, This bug is the DIV get hover and change the t
|
| +} |
| + |
| static void disableCompositing(WebSettings* settings) { |
| settings->setAcceleratedCompositingEnabled(false); |
| settings->setPreferCompositingToLCDTextEnabled(false); |