| 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 10893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10904 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | 10904 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 10905 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | 10905 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 10906 "</a>" | 10906 "</a>" |
| 10907 "<div style='position: absolute; top: 1000px'>end</div>"); | 10907 "<div style='position: absolute; top: 1000px'>end</div>"); |
| 10908 | 10908 |
| 10909 webView->updateAllLifecyclePhases(); | 10909 webView->updateAllLifecyclePhases(); |
| 10910 | 10910 |
| 10911 Document* document = webView->mainFrameImpl()->frame()->document(); | 10911 Document* document = webView->mainFrameImpl()->frame()->document(); |
| 10912 Element* aTag = document->getElementById("a"); | 10912 Element* aTag = document->getElementById("a"); |
| 10913 | 10913 |
| 10914 // Ensure hittest has scrollbar and link | 10914 // Ensure hittest only has scrollbar. |
| 10915 HitTestResult hitTestResult = | 10915 HitTestResult hitTestResult = |
| 10916 webView->coreHitTestResultAt(WebPoint(18, aTag->offsetTop())); | 10916 webView->coreHitTestResultAt(WebPoint(18, aTag->offsetTop())); |
| 10917 | 10917 |
| 10918 EXPECT_TRUE(hitTestResult.URLElement()); | 10918 EXPECT_FALSE(hitTestResult.URLElement()); |
| 10919 EXPECT_TRUE(hitTestResult.innerElement()); | 10919 EXPECT_FALSE(hitTestResult.innerElement()); |
| 10920 EXPECT_TRUE(hitTestResult.scrollbar()); | 10920 EXPECT_TRUE(hitTestResult.scrollbar()); |
| 10921 EXPECT_FALSE(hitTestResult.scrollbar()->isCustomScrollbar()); | 10921 EXPECT_FALSE(hitTestResult.scrollbar()->isCustomScrollbar()); |
| 10922 | 10922 |
| 10923 // Mouse over link. Mouse cursor should be hand. | 10923 // Mouse over link. Mouse cursor should be hand. |
| 10924 WebMouseEvent mouseMoveOverLinkEvent( | 10924 WebMouseEvent mouseMoveOverLinkEvent( |
| 10925 WebInputEvent::MouseMove, | 10925 WebInputEvent::MouseMove, |
| 10926 WebFloatPoint(aTag->offsetLeft(), aTag->offsetTop()), | 10926 WebFloatPoint(aTag->offsetLeft(), aTag->offsetTop()), |
| 10927 WebFloatPoint(aTag->offsetLeft(), aTag->offsetTop()), | 10927 WebFloatPoint(aTag->offsetLeft(), aTag->offsetTop()), |
| 10928 WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers, | 10928 WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers, |
| 10929 TimeTicks::Now().InSeconds()); | 10929 TimeTicks::Now().InSeconds()); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11044 TimeTicks::Now().InSeconds()); | 11044 TimeTicks::Now().InSeconds()); |
| 11045 mouseMoveOverDivAndScrollbar.setFrameScale(1); | 11045 mouseMoveOverDivAndScrollbar.setFrameScale(1); |
| 11046 document->frame()->eventHandler().handleMouseMoveEvent( | 11046 document->frame()->eventHandler().handleMouseMoveEvent( |
| 11047 mouseMoveOverDivAndScrollbar, Vector<WebMouseEvent>()); | 11047 mouseMoveOverDivAndScrollbar, Vector<WebMouseEvent>()); |
| 11048 | 11048 |
| 11049 // Custom not change the DIV :hover | 11049 // Custom not change the DIV :hover |
| 11050 EXPECT_EQ(document->hoverNode(), scrollbarDiv); | 11050 EXPECT_EQ(document->hoverNode(), scrollbarDiv); |
| 11051 EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart); | 11051 EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart); |
| 11052 } | 11052 } |
| 11053 | 11053 |
| 11054 // Makes sure that mouse hover over an overlay scrollbar doesn't hover iframe |
| 11055 // below. |
| 11056 TEST_F(WebFrameTest, MouseOverScrollbarAndIFrame) { |
| 11057 registerMockedHttpURLLoad("scrollbar-and-iframe-hover.html"); |
| 11058 FrameTestHelpers::WebViewHelper webViewHelper; |
| 11059 WebViewImpl* webView = webViewHelper.initializeAndLoad( |
| 11060 m_baseURL + "scrollbar-and-iframe-hover.html"); |
| 11061 |
| 11062 webViewHelper.resize(WebSize(200, 200)); |
| 11063 |
| 11064 webView->updateAllLifecyclePhases(); |
| 11065 |
| 11066 Document* document = toLocalFrame(webView->page()->mainFrame())->document(); |
| 11067 Element* iframe = document->getElementById("iframe"); |
| 11068 DCHECK(iframe); |
| 11069 |
| 11070 // Ensure hittest only has IFRAME. |
| 11071 HitTestResult hitTestResult = webView->coreHitTestResultAt(WebPoint(5, 5)); |
| 11072 |
| 11073 EXPECT_TRUE(hitTestResult.innerElement()); |
| 11074 EXPECT_FALSE(hitTestResult.scrollbar()); |
| 11075 |
| 11076 // Mouse over IFRAME. |
| 11077 WebMouseEvent mouseMoveOverIFrame( |
| 11078 WebInputEvent::MouseMove, WebFloatPoint(5, 5), WebFloatPoint(5, 5), |
| 11079 WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers, |
| 11080 TimeTicks::Now().InSeconds()); |
| 11081 mouseMoveOverIFrame.setFrameScale(1); |
| 11082 document->frame()->eventHandler().handleMouseMoveEvent( |
| 11083 mouseMoveOverIFrame, Vector<WebMouseEvent>()); |
| 11084 |
| 11085 // IFRAME hover. |
| 11086 EXPECT_EQ(document->hoverNode(), iframe); |
| 11087 |
| 11088 // Ensure hittest has scrollbar. |
| 11089 hitTestResult = webView->coreHitTestResultAt(WebPoint(195, 5)); |
| 11090 EXPECT_FALSE(hitTestResult.innerElement()); |
| 11091 EXPECT_TRUE(hitTestResult.scrollbar()); |
| 11092 EXPECT_TRUE(hitTestResult.scrollbar()->enabled()); |
| 11093 |
| 11094 // Mouse over scrollbar. |
| 11095 WebMouseEvent mouseMoveOverIFrameAndScrollbar( |
| 11096 WebInputEvent::MouseMove, WebFloatPoint(195, 5), WebFloatPoint(195, 5), |
| 11097 WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers, |
| 11098 TimeTicks::Now().InSeconds()); |
| 11099 mouseMoveOverIFrameAndScrollbar.setFrameScale(1); |
| 11100 document->frame()->eventHandler().handleMouseMoveEvent( |
| 11101 mouseMoveOverIFrameAndScrollbar, Vector<WebMouseEvent>()); |
| 11102 |
| 11103 // IFRAME not hover. |
| 11104 EXPECT_NE(document->hoverNode(), iframe); |
| 11105 |
| 11106 // Disable the Scrollbar. |
| 11107 webView->mainFrameImpl()->frameView()->setScrollbarsHidden(true); |
| 11108 |
| 11109 // Ensure hittest has IFRAME and no scrollbar. |
| 11110 hitTestResult = webView->coreHitTestResultAt(WebPoint(196, 5)); |
| 11111 |
| 11112 EXPECT_TRUE(hitTestResult.innerElement()); |
| 11113 EXPECT_FALSE(hitTestResult.scrollbar()); |
| 11114 |
| 11115 // Mouse over disabled scrollbar. |
| 11116 WebMouseEvent mouseMoveOverIFrameAndDisabledScrollbar( |
| 11117 WebInputEvent::MouseMove, WebFloatPoint(196, 5), WebFloatPoint(196, 5), |
| 11118 WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers, |
| 11119 TimeTicks::Now().InSeconds()); |
| 11120 mouseMoveOverIFrameAndDisabledScrollbar.setFrameScale(1); |
| 11121 document->frame()->eventHandler().handleMouseMoveEvent( |
| 11122 mouseMoveOverIFrameAndDisabledScrollbar, Vector<WebMouseEvent>()); |
| 11123 |
| 11124 // IFRAME hover. |
| 11125 EXPECT_EQ(document->hoverNode(), iframe); |
| 11126 } |
| 11127 |
| 11054 // Makes sure that mouse hover over a scrollbar also hover the element owns the | 11128 // Makes sure that mouse hover over a scrollbar also hover the element owns the |
| 11055 // scrollbar. | 11129 // scrollbar. |
| 11056 TEST_F(WebFrameTest, MouseOverScrollbarAndParentElement) { | 11130 TEST_F(WebFrameTest, MouseOverScrollbarAndParentElement) { |
| 11057 registerMockedHttpURLLoad("scrollbar-and-element-hover.html"); | 11131 registerMockedHttpURLLoad("scrollbar-and-element-hover.html"); |
| 11058 FrameTestHelpers::WebViewHelper webViewHelper; | 11132 FrameTestHelpers::WebViewHelper webViewHelper; |
| 11059 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); | 11133 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); |
| 11060 WebViewImpl* webView = webViewHelper.initializeAndLoad( | 11134 WebViewImpl* webView = webViewHelper.initializeAndLoad( |
| 11061 m_baseURL + "scrollbar-and-element-hover.html"); | 11135 m_baseURL + "scrollbar-and-element-hover.html"); |
| 11062 | 11136 |
| 11063 webViewHelper.resize(WebSize(200, 200)); | 11137 webViewHelper.resize(WebSize(200, 200)); |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11582 FrameTestHelpers::loadFrame(localFrame, "data:text/html,some page"); | 11656 FrameTestHelpers::loadFrame(localFrame, "data:text/html,some page"); |
| 11583 | 11657 |
| 11584 // Local frame with remote parent should have transparent baseBackgroundColor. | 11658 // Local frame with remote parent should have transparent baseBackgroundColor. |
| 11585 Color color = localFrame->frameView()->baseBackgroundColor(); | 11659 Color color = localFrame->frameView()->baseBackgroundColor(); |
| 11586 EXPECT_EQ(Color::transparent, color); | 11660 EXPECT_EQ(Color::transparent, color); |
| 11587 | 11661 |
| 11588 view->close(); | 11662 view->close(); |
| 11589 } | 11663 } |
| 11590 | 11664 |
| 11591 } // namespace blink | 11665 } // namespace blink |
| OLD | NEW |