| 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 10815 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  10826   document->frame()->eventHandler().handleMouseMoveEvent( |  10826   document->frame()->eventHandler().handleMouseMoveEvent( | 
|  10827       mouseMoveEvent, Vector<WebMouseEvent>()); |  10827       mouseMoveEvent, Vector<WebMouseEvent>()); | 
|  10828  |  10828  | 
|  10829   EXPECT_EQ(document->hoverNode(), |  10829   EXPECT_EQ(document->hoverNode(), | 
|  10830             document->frame()->chromeClient().lastSetTooltipNodeForTesting()); |  10830             document->frame()->chromeClient().lastSetTooltipNodeForTesting()); | 
|  10831   EXPECT_EQ(div2Tag, |  10831   EXPECT_EQ(div2Tag, | 
|  10832             document->frame()->chromeClient().lastSetTooltipNodeForTesting()); |  10832             document->frame()->chromeClient().lastSetTooltipNodeForTesting()); | 
|  10833 } |  10833 } | 
|  10834  |  10834  | 
|  10835 // Makes sure that mouse hover over an overlay scrollbar doesn't activate |  10835 // Makes sure that mouse hover over an overlay scrollbar doesn't activate | 
|  10836 // elements below unless the scrollbar is faded out. |  10836 // elements below(except the Element that owns the scrollbar) unless the | 
 |  10837 // scrollbar is faded out. | 
|  10837 TEST_F(WebFrameTest, MouseOverLinkAndOverlayScrollbar) { |  10838 TEST_F(WebFrameTest, MouseOverLinkAndOverlayScrollbar) { | 
|  10838   FrameTestHelpers::WebViewHelper webViewHelper; |  10839   FrameTestHelpers::WebViewHelper webViewHelper; | 
|  10839   webViewHelper.initialize(true, nullptr, nullptr, nullptr, |  10840   webViewHelper.initialize(true, nullptr, nullptr, nullptr, | 
|  10840                            [](WebSettings* settings) {}); |  10841                            [](WebSettings* settings) {}); | 
|  10841   webViewHelper.resize(WebSize(20, 20)); |  10842   webViewHelper.resize(WebSize(20, 20)); | 
|  10842   WebViewImpl* webView = webViewHelper.webView(); |  10843   WebViewImpl* webView = webViewHelper.webView(); | 
|  10843  |  10844  | 
|  10844   initializeWithHTML(*webView->mainFrameImpl()->frame(), |  10845   initializeWithHTML(*webView->mainFrameImpl()->frame(), | 
|  10845                      "<!DOCTYPE html>" |  10846                      "<!DOCTYPE html>" | 
|  10846                      "<a id='a' href='javascript:void(0);'>" |  10847                      "<a id='a' href='javascript:void(0);'>" | 
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  10988       TimeTicks::Now().InSeconds()); |  10989       TimeTicks::Now().InSeconds()); | 
|  10989   mouseMoveOverDivAndScrollbar.setFrameScale(1); |  10990   mouseMoveOverDivAndScrollbar.setFrameScale(1); | 
|  10990   document->frame()->eventHandler().handleMouseMoveEvent( |  10991   document->frame()->eventHandler().handleMouseMoveEvent( | 
|  10991       mouseMoveOverDivAndScrollbar, Vector<WebMouseEvent>()); |  10992       mouseMoveOverDivAndScrollbar, Vector<WebMouseEvent>()); | 
|  10992  |  10993  | 
|  10993   // Custom not change the DIV :hover |  10994   // Custom not change the DIV :hover | 
|  10994   EXPECT_EQ(document->hoverNode(), scrollbarDiv); |  10995   EXPECT_EQ(document->hoverNode(), scrollbarDiv); | 
|  10995   EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart); |  10996   EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart); | 
|  10996 } |  10997 } | 
|  10997  |  10998  | 
 |  10999 // Makes sure that mouse hover over a scrollbar also hover the element owns the | 
 |  11000 // scrollbar. | 
 |  11001 TEST_F(WebFrameTest, MouseOverScrollbarAndParentElement) { | 
 |  11002   registerMockedHttpURLLoad("scrollbar-and-element-hover.html"); | 
 |  11003   FrameTestHelpers::WebViewHelper webViewHelper; | 
 |  11004   RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); | 
 |  11005   WebViewImpl* webView = webViewHelper.initializeAndLoad( | 
 |  11006       m_baseURL + "scrollbar-and-element-hover.html"); | 
 |  11007  | 
 |  11008   webViewHelper.resize(WebSize(200, 200)); | 
 |  11009  | 
 |  11010   webView->updateAllLifecyclePhases(); | 
 |  11011  | 
 |  11012   Document* document = toLocalFrame(webView->page()->mainFrame())->document(); | 
 |  11013  | 
 |  11014   Element* parentDiv = document->getElementById("parent"); | 
 |  11015   Element* childDiv = document->getElementById("child"); | 
 |  11016   EXPECT_TRUE(parentDiv); | 
 |  11017   EXPECT_TRUE(childDiv); | 
 |  11018  | 
 |  11019   ScrollableArea* scrollableArea = | 
 |  11020       toLayoutBox(parentDiv->layoutObject())->getScrollableArea(); | 
 |  11021  | 
 |  11022   EXPECT_TRUE(scrollableArea->verticalScrollbar()); | 
 |  11023   EXPECT_FALSE(scrollableArea->verticalScrollbar()->isOverlayScrollbar()); | 
 |  11024   EXPECT_TRUE(scrollableArea->verticalScrollbar()->theme().isMockTheme()); | 
 |  11025  | 
 |  11026   // Ensure hittest only has DIV. | 
 |  11027   HitTestResult hitTestResult = webView->coreHitTestResultAt(WebPoint(1, 1)); | 
 |  11028  | 
 |  11029   EXPECT_TRUE(hitTestResult.innerElement()); | 
 |  11030   EXPECT_FALSE(hitTestResult.scrollbar()); | 
 |  11031  | 
 |  11032   // Mouse over DIV. | 
 |  11033   WebMouseEvent mouseMoveOverDiv( | 
 |  11034       WebInputEvent::MouseMove, WebFloatPoint(1, 1), WebFloatPoint(1, 1), | 
 |  11035       WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers, | 
 |  11036       TimeTicks::Now().InSeconds()); | 
 |  11037   mouseMoveOverDiv.setFrameScale(1); | 
 |  11038   document->frame()->eventHandler().handleMouseMoveEvent( | 
 |  11039       mouseMoveOverDiv, Vector<WebMouseEvent>()); | 
 |  11040  | 
 |  11041   // DIV :hover. | 
 |  11042   EXPECT_EQ(document->hoverNode(), parentDiv); | 
 |  11043  | 
 |  11044   // Ensure hittest has DIV and scrollbar. | 
 |  11045   hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 5)); | 
 |  11046  | 
 |  11047   EXPECT_TRUE(hitTestResult.innerElement()); | 
 |  11048   EXPECT_TRUE(hitTestResult.scrollbar()); | 
 |  11049   EXPECT_FALSE(hitTestResult.scrollbar()->isCustomScrollbar()); | 
 |  11050   EXPECT_TRUE(hitTestResult.scrollbar()->enabled()); | 
 |  11051  | 
 |  11052   // Mouse over scrollbar. | 
 |  11053   WebMouseEvent mouseMoveOverDivAndScrollbar( | 
 |  11054       WebInputEvent::MouseMove, WebFloatPoint(175, 5), WebFloatPoint(175, 5), | 
 |  11055       WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers, | 
 |  11056       TimeTicks::Now().InSeconds()); | 
 |  11057   mouseMoveOverDivAndScrollbar.setFrameScale(1); | 
 |  11058   document->frame()->eventHandler().handleMouseMoveEvent( | 
 |  11059       mouseMoveOverDivAndScrollbar, Vector<WebMouseEvent>()); | 
 |  11060  | 
 |  11061   // Not change the DIV :hover. | 
 |  11062   EXPECT_EQ(document->hoverNode(), parentDiv); | 
 |  11063  | 
 |  11064   // Disable the Scrollbar by remove the childDiv. | 
 |  11065   childDiv->remove(); | 
 |  11066   webView->updateAllLifecyclePhases(); | 
 |  11067  | 
 |  11068   // Ensure hittest has DIV and no scrollbar. | 
 |  11069   hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 5)); | 
 |  11070  | 
 |  11071   EXPECT_TRUE(hitTestResult.innerElement()); | 
 |  11072   EXPECT_TRUE(hitTestResult.scrollbar()); | 
 |  11073   EXPECT_FALSE(hitTestResult.scrollbar()->enabled()); | 
 |  11074   EXPECT_LT(hitTestResult.innerElement()->clientWidth(), 180); | 
 |  11075  | 
 |  11076   // Mouse over disabled scrollbar. | 
 |  11077   document->frame()->eventHandler().handleMouseMoveEvent( | 
 |  11078       mouseMoveOverDivAndScrollbar, Vector<WebMouseEvent>()); | 
 |  11079  | 
 |  11080   // Not change the DIV :hover. | 
 |  11081   EXPECT_EQ(document->hoverNode(), parentDiv); | 
 |  11082 } | 
 |  11083  | 
|  10998 TEST_F(WebFrameTest, MouseReleaseUpdatesScrollbarHoveredPart) { |  11084 TEST_F(WebFrameTest, MouseReleaseUpdatesScrollbarHoveredPart) { | 
|  10999   registerMockedHttpURLLoad("custom-scrollbar-hover.html"); |  11085   registerMockedHttpURLLoad("custom-scrollbar-hover.html"); | 
|  11000   FrameTestHelpers::WebViewHelper webViewHelper; |  11086   FrameTestHelpers::WebViewHelper webViewHelper; | 
|  11001   WebViewImpl* webView = webViewHelper.initializeAndLoad( |  11087   WebViewImpl* webView = webViewHelper.initializeAndLoad( | 
|  11002       m_baseURL + "custom-scrollbar-hover.html"); |  11088       m_baseURL + "custom-scrollbar-hover.html"); | 
|  11003  |  11089  | 
|  11004   webViewHelper.resize(WebSize(200, 200)); |  11090   webViewHelper.resize(WebSize(200, 200)); | 
|  11005  |  11091  | 
|  11006   webView->updateAllLifecyclePhases(); |  11092   webView->updateAllLifecyclePhases(); | 
|  11007  |  11093  | 
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  11257  |  11343  | 
|  11258   EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); |  11344   EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); | 
|  11259   EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); |  11345   EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); | 
|  11260   EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); |  11346   EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); | 
|  11261   EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); |  11347   EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); | 
|  11262  |  11348  | 
|  11263   webViewHelper.reset(); |  11349   webViewHelper.reset(); | 
|  11264 } |  11350 } | 
|  11265  |  11351  | 
|  11266 }  // namespace blink |  11352 }  // namespace blink | 
| OLD | NEW |