| 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 10543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10554 Document* document = webView->mainFrameImpl()->frame()->document(); | 10554 Document* document = webView->mainFrameImpl()->frame()->document(); |
| 10555 Element* aTag = document->getElementById("a"); | 10555 Element* aTag = document->getElementById("a"); |
| 10556 | 10556 |
| 10557 // Ensure hittest has scrollbar and link | 10557 // Ensure hittest has scrollbar and link |
| 10558 HitTestResult hitTestResult = | 10558 HitTestResult hitTestResult = |
| 10559 webView->coreHitTestResultAt(WebPoint(18, aTag->offsetTop())); | 10559 webView->coreHitTestResultAt(WebPoint(18, aTag->offsetTop())); |
| 10560 | 10560 |
| 10561 EXPECT_TRUE(hitTestResult.URLElement()); | 10561 EXPECT_TRUE(hitTestResult.URLElement()); |
| 10562 EXPECT_TRUE(hitTestResult.innerElement()); | 10562 EXPECT_TRUE(hitTestResult.innerElement()); |
| 10563 EXPECT_TRUE(hitTestResult.scrollbar()); | 10563 EXPECT_TRUE(hitTestResult.scrollbar()); |
| 10564 EXPECT_FALSE(hitTestResult.scrollbar()->isCustomScrollbar()); |
| 10564 | 10565 |
| 10565 // Mouse over link. Mouse cursor should be hand. | 10566 // Mouse over link. Mouse cursor should be hand. |
| 10566 PlatformMouseEvent mouseMoveOverLinkEvent( | 10567 PlatformMouseEvent mouseMoveOverLinkEvent( |
| 10567 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), | 10568 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), |
| 10568 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), | 10569 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), |
| 10569 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, | 10570 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, |
| 10570 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); | 10571 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); |
| 10571 document->frame()->eventHandler().handleMouseMoveEvent( | 10572 document->frame()->eventHandler().handleMouseMoveEvent( |
| 10572 mouseMoveOverLinkEvent); | 10573 mouseMoveOverLinkEvent); |
| 10573 | 10574 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10621 Cursor::Type::Hand, | 10622 Cursor::Type::Hand, |
| 10622 document->frame()->chromeClient().lastSetCursorForTesting().getType()); | 10623 document->frame()->chromeClient().lastSetCursorForTesting().getType()); |
| 10623 | 10624 |
| 10624 document->frame()->eventHandler().handleMousePressEvent(mousePressEvent); | 10625 document->frame()->eventHandler().handleMousePressEvent(mousePressEvent); |
| 10625 | 10626 |
| 10626 EXPECT_TRUE(document->activeHoverElement()); | 10627 EXPECT_TRUE(document->activeHoverElement()); |
| 10627 EXPECT_TRUE(document->hoverNode()); | 10628 EXPECT_TRUE(document->hoverNode()); |
| 10628 | 10629 |
| 10629 document->frame()->eventHandler().handleMouseReleaseEvent(MouseReleaseEvent); | 10630 document->frame()->eventHandler().handleMouseReleaseEvent(MouseReleaseEvent); |
| 10630 } | 10631 } |
| 10632 |
| 10633 // Makes sure that mouse hover over an custom scrollbar doesn't change the |
| 10634 // activate elements. |
| 10635 TEST_F(WebFrameTest, MouseOverCustomScrollbar) { |
| 10636 registerMockedHttpURLLoad("custom-scrollbar-hover.html"); |
| 10637 FrameTestHelpers::WebViewHelper webViewHelper; |
| 10638 WebViewImpl* webView = webViewHelper.initializeAndLoad( |
| 10639 m_baseURL + "custom-scrollbar-hover.html"); |
| 10640 |
| 10641 webViewHelper.resize(WebSize(200, 200)); |
| 10642 |
| 10643 webView->updateAllLifecyclePhases(); |
| 10644 |
| 10645 Document* document = toLocalFrame(webView->page()->mainFrame())->document(); |
| 10646 |
| 10647 Element* scrollbarDiv = document->getElementById("scrollbar"); |
| 10648 EXPECT_TRUE(scrollbarDiv); |
| 10649 |
| 10650 // Ensure hittest only has DIV |
| 10651 HitTestResult hitTestResult = webView->coreHitTestResultAt(WebPoint(1, 1)); |
| 10652 |
| 10653 EXPECT_TRUE(hitTestResult.innerElement()); |
| 10654 EXPECT_FALSE(hitTestResult.scrollbar()); |
| 10655 |
| 10656 // Mouse over DIV |
| 10657 PlatformMouseEvent mouseMoveOverDiv( |
| 10658 IntPoint(1, 1), IntPoint(1, 1), WebPointerProperties::Button::NoButton, |
| 10659 PlatformEvent::MouseMoved, 0, PlatformEvent::NoModifiers, |
| 10660 WTF::monotonicallyIncreasingTime()); |
| 10661 document->frame()->eventHandler().handleMouseMoveEvent(mouseMoveOverDiv); |
| 10662 |
| 10663 // DIV :hover |
| 10664 EXPECT_EQ(document->hoverNode(), scrollbarDiv); |
| 10665 |
| 10666 // Ensure hittest has DIV and scrollbar |
| 10667 hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 1)); |
| 10668 |
| 10669 EXPECT_TRUE(hitTestResult.innerElement()); |
| 10670 EXPECT_TRUE(hitTestResult.scrollbar()); |
| 10671 EXPECT_TRUE(hitTestResult.scrollbar()->isCustomScrollbar()); |
| 10672 |
| 10673 // Mouse over scrollbar |
| 10674 PlatformMouseEvent mouseMoveOverDivAndScrollbar( |
| 10675 IntPoint(175, 1), IntPoint(175, 1), |
| 10676 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, |
| 10677 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); |
| 10678 document->frame()->eventHandler().handleMouseMoveEvent( |
| 10679 mouseMoveOverDivAndScrollbar); |
| 10680 |
| 10681 // Custom not change the DIV :hover |
| 10682 EXPECT_EQ(document->hoverNode(), scrollbarDiv); |
| 10683 EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart); |
| 10684 } |
| 10685 |
| 10631 static void disableCompositing(WebSettings* settings) { | 10686 static void disableCompositing(WebSettings* settings) { |
| 10632 settings->setAcceleratedCompositingEnabled(false); | 10687 settings->setAcceleratedCompositingEnabled(false); |
| 10633 settings->setPreferCompositingToLCDTextEnabled(false); | 10688 settings->setPreferCompositingToLCDTextEnabled(false); |
| 10634 } | 10689 } |
| 10635 | 10690 |
| 10636 // Make sure overlay scrollbars on non-composited scrollers fade out and set | 10691 // Make sure overlay scrollbars on non-composited scrollers fade out and set |
| 10637 // the hidden bit as needed. | 10692 // the hidden bit as needed. |
| 10638 TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) { | 10693 TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) { |
| 10639 FrameTestHelpers::WebViewHelper webViewHelper; | 10694 FrameTestHelpers::WebViewHelper webViewHelper; |
| 10640 WebViewImpl* webViewImpl = webViewHelper.initialize( | 10695 WebViewImpl* webViewImpl = webViewHelper.initialize( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10719 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); | 10774 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); |
| 10720 HashSet<AtomicString> names; | 10775 HashSet<AtomicString> names; |
| 10721 for (Frame* frame = mainFrame->tree().firstChild(); frame; | 10776 for (Frame* frame = mainFrame->tree().firstChild(); frame; |
| 10722 frame = frame->tree().traverseNext()) { | 10777 frame = frame->tree().traverseNext()) { |
| 10723 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry); | 10778 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry); |
| 10724 } | 10779 } |
| 10725 EXPECT_EQ(10u, names.size()); | 10780 EXPECT_EQ(10u, names.size()); |
| 10726 } | 10781 } |
| 10727 | 10782 |
| 10728 } // namespace blink | 10783 } // namespace blink |
| OLD | NEW |