| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 10838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10849 document->frame()->eventHandler().handleMouseMoveEvent( | 10849 document->frame()->eventHandler().handleMouseMoveEvent( |
| 10850 mouseMoveEvent, Vector<PlatformMouseEvent>()); | 10850 mouseMoveEvent, Vector<PlatformMouseEvent>()); |
| 10851 | 10851 |
| 10852 EXPECT_EQ(document->hoverNode(), | 10852 EXPECT_EQ(document->hoverNode(), |
| 10853 document->frame()->chromeClient().lastSetTooltipNodeForTesting()); | 10853 document->frame()->chromeClient().lastSetTooltipNodeForTesting()); |
| 10854 EXPECT_EQ(div2Tag, | 10854 EXPECT_EQ(div2Tag, |
| 10855 document->frame()->chromeClient().lastSetTooltipNodeForTesting()); | 10855 document->frame()->chromeClient().lastSetTooltipNodeForTesting()); |
| 10856 } | 10856 } |
| 10857 | 10857 |
| 10858 // Makes sure that mouse hover over an overlay scrollbar doesn't activate | 10858 // Makes sure that mouse hover over an overlay scrollbar doesn't activate |
| 10859 // elements below(except the Element that owns the scrollbar) unless the | 10859 // elements below unless the scrollbar is faded out. |
| 10860 // scrollbar is faded out. | |
| 10861 TEST_F(WebFrameTest, MouseOverLinkAndOverlayScrollbar) { | 10860 TEST_F(WebFrameTest, MouseOverLinkAndOverlayScrollbar) { |
| 10862 FrameTestHelpers::WebViewHelper webViewHelper; | 10861 FrameTestHelpers::WebViewHelper webViewHelper; |
| 10863 webViewHelper.initialize(true, nullptr, nullptr, nullptr, | 10862 webViewHelper.initialize(true, nullptr, nullptr, nullptr, |
| 10864 [](WebSettings* settings) {}); | 10863 [](WebSettings* settings) {}); |
| 10865 webViewHelper.resize(WebSize(20, 20)); | 10864 webViewHelper.resize(WebSize(20, 20)); |
| 10866 WebViewImpl* webView = webViewHelper.webView(); | 10865 WebViewImpl* webView = webViewHelper.webView(); |
| 10867 | 10866 |
| 10868 initializeWithHTML(*webView->mainFrameImpl()->frame(), | 10867 initializeWithHTML(*webView->mainFrameImpl()->frame(), |
| 10869 "<!DOCTYPE html>" | 10868 "<!DOCTYPE html>" |
| 10870 "<a id='a' href='javascript:void(0);'>" | 10869 "<a id='a' href='javascript:void(0);'>" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11002 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, | 11001 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, |
| 11003 PlatformEvent::NoModifiers, TimeTicks::Now()); | 11002 PlatformEvent::NoModifiers, TimeTicks::Now()); |
| 11004 document->frame()->eventHandler().handleMouseMoveEvent( | 11003 document->frame()->eventHandler().handleMouseMoveEvent( |
| 11005 mouseMoveOverDivAndScrollbar, Vector<PlatformMouseEvent>()); | 11004 mouseMoveOverDivAndScrollbar, Vector<PlatformMouseEvent>()); |
| 11006 | 11005 |
| 11007 // Custom not change the DIV :hover | 11006 // Custom not change the DIV :hover |
| 11008 EXPECT_EQ(document->hoverNode(), scrollbarDiv); | 11007 EXPECT_EQ(document->hoverNode(), scrollbarDiv); |
| 11009 EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart); | 11008 EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart); |
| 11010 } | 11009 } |
| 11011 | 11010 |
| 11012 // Makes sure that mouse hover over a scrollbar also hover the element owns the | |
| 11013 // scrollbar. | |
| 11014 TEST_F(WebFrameTest, MouseOverScrollbarAndParentElement) { | |
| 11015 registerMockedHttpURLLoad("scrollbar-and-element-hover.html"); | |
| 11016 FrameTestHelpers::WebViewHelper webViewHelper; | |
| 11017 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); | |
| 11018 WebViewImpl* webView = webViewHelper.initializeAndLoad( | |
| 11019 m_baseURL + "scrollbar-and-element-hover.html"); | |
| 11020 | |
| 11021 webViewHelper.resize(WebSize(200, 200)); | |
| 11022 | |
| 11023 webView->updateAllLifecyclePhases(); | |
| 11024 | |
| 11025 Document* document = toLocalFrame(webView->page()->mainFrame())->document(); | |
| 11026 | |
| 11027 Element* parentDiv = document->getElementById("parent"); | |
| 11028 Element* childDiv = document->getElementById("child"); | |
| 11029 EXPECT_TRUE(parentDiv); | |
| 11030 EXPECT_TRUE(childDiv); | |
| 11031 | |
| 11032 ScrollableArea* scrollableArea = | |
| 11033 toLayoutBox(parentDiv->layoutObject())->getScrollableArea(); | |
| 11034 | |
| 11035 EXPECT_TRUE(scrollableArea->verticalScrollbar()); | |
| 11036 EXPECT_FALSE(scrollableArea->verticalScrollbar()->isOverlayScrollbar()); | |
| 11037 EXPECT_TRUE(scrollableArea->verticalScrollbar()->theme().isMockTheme()); | |
| 11038 | |
| 11039 // Ensure hittest only has DIV. | |
| 11040 HitTestResult hitTestResult = webView->coreHitTestResultAt(WebPoint(1, 1)); | |
| 11041 | |
| 11042 EXPECT_TRUE(hitTestResult.innerElement()); | |
| 11043 EXPECT_FALSE(hitTestResult.scrollbar()); | |
| 11044 | |
| 11045 // Mouse over DIV. | |
| 11046 WebMouseEvent mouseMoveOverDiv( | |
| 11047 WebInputEvent::MouseMove, WebFloatPoint(1, 1), WebFloatPoint(1, 1), | |
| 11048 WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers, | |
| 11049 TimeTicks::Now().InSeconds()); | |
| 11050 mouseMoveOverDiv.setFrameScale(1); | |
| 11051 document->frame()->eventHandler().handleMouseMoveEvent( | |
| 11052 mouseMoveOverDiv, Vector<WebMouseEvent>()); | |
| 11053 | |
| 11054 // DIV :hover. | |
| 11055 EXPECT_EQ(document->hoverNode(), parentDiv); | |
| 11056 | |
| 11057 // Ensure hittest has DIV and scrollbar. | |
| 11058 hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 5)); | |
| 11059 | |
| 11060 EXPECT_TRUE(hitTestResult.innerElement()); | |
| 11061 EXPECT_TRUE(hitTestResult.scrollbar()); | |
| 11062 EXPECT_FALSE(hitTestResult.scrollbar()->isCustomScrollbar()); | |
| 11063 EXPECT_TRUE(hitTestResult.scrollbar()->enabled()); | |
| 11064 | |
| 11065 // Mouse over scrollbar. | |
| 11066 WebMouseEvent mouseMoveOverDivAndScrollbar( | |
| 11067 WebInputEvent::MouseMove, WebFloatPoint(175, 5), WebFloatPoint(175, 5), | |
| 11068 WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers, | |
| 11069 TimeTicks::Now().InSeconds()); | |
| 11070 mouseMoveOverDivAndScrollbar.setFrameScale(1); | |
| 11071 document->frame()->eventHandler().handleMouseMoveEvent( | |
| 11072 mouseMoveOverDivAndScrollbar, Vector<WebMouseEvent>()); | |
| 11073 | |
| 11074 // Not change the DIV :hover. | |
| 11075 EXPECT_EQ(document->hoverNode(), parentDiv); | |
| 11076 | |
| 11077 // Disable the Scrollbar by remove the childDiv. | |
| 11078 childDiv->remove(); | |
| 11079 webView->updateAllLifecyclePhases(); | |
| 11080 | |
| 11081 // Ensure hittest has DIV and no scrollbar. | |
| 11082 hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 5)); | |
| 11083 | |
| 11084 EXPECT_TRUE(hitTestResult.innerElement()); | |
| 11085 EXPECT_TRUE(hitTestResult.scrollbar()); | |
| 11086 EXPECT_FALSE(hitTestResult.scrollbar()->enabled()); | |
| 11087 EXPECT_LT(hitTestResult.innerElement()->clientWidth(), 180); | |
| 11088 | |
| 11089 // Mouse over disabled scrollbar. | |
| 11090 document->frame()->eventHandler().handleMouseMoveEvent( | |
| 11091 mouseMoveOverDivAndScrollbar, Vector<WebMouseEvent>()); | |
| 11092 | |
| 11093 // Not change the DIV :hover. | |
| 11094 EXPECT_EQ(document->hoverNode(), parentDiv); | |
| 11095 } | |
| 11096 | |
| 11097 TEST_F(WebFrameTest, MouseReleaseUpdatesScrollbarHoveredPart) { | 11011 TEST_F(WebFrameTest, MouseReleaseUpdatesScrollbarHoveredPart) { |
| 11098 registerMockedHttpURLLoad("custom-scrollbar-hover.html"); | 11012 registerMockedHttpURLLoad("custom-scrollbar-hover.html"); |
| 11099 FrameTestHelpers::WebViewHelper webViewHelper; | 11013 FrameTestHelpers::WebViewHelper webViewHelper; |
| 11100 WebViewImpl* webView = webViewHelper.initializeAndLoad( | 11014 WebViewImpl* webView = webViewHelper.initializeAndLoad( |
| 11101 m_baseURL + "custom-scrollbar-hover.html"); | 11015 m_baseURL + "custom-scrollbar-hover.html"); |
| 11102 | 11016 |
| 11103 webViewHelper.resize(WebSize(200, 200)); | 11017 webViewHelper.resize(WebSize(200, 200)); |
| 11104 | 11018 |
| 11105 webView->updateAllLifecyclePhases(); | 11019 webView->updateAllLifecyclePhases(); |
| 11106 | 11020 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11351 | 11265 |
| 11352 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); | 11266 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); |
| 11353 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); | 11267 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); |
| 11354 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); | 11268 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); |
| 11355 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); | 11269 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); |
| 11356 | 11270 |
| 11357 webViewHelper.reset(); | 11271 webViewHelper.reset(); |
| 11358 } | 11272 } |
| 11359 | 11273 |
| 11360 } // namespace blink | 11274 } // namespace blink |
| OLD | NEW |