| 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 10473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10484 Document* document = webView->mainFrameImpl()->frame()->document(); | 10484 Document* document = webView->mainFrameImpl()->frame()->document(); |
| 10485 Element* aTag = document->getElementById("a"); | 10485 Element* aTag = document->getElementById("a"); |
| 10486 | 10486 |
| 10487 // Ensure hittest has scrollbar and link | 10487 // Ensure hittest has scrollbar and link |
| 10488 HitTestResult hitTestResult = | 10488 HitTestResult hitTestResult = |
| 10489 webView->coreHitTestResultAt(WebPoint(18, aTag->offsetTop())); | 10489 webView->coreHitTestResultAt(WebPoint(18, aTag->offsetTop())); |
| 10490 | 10490 |
| 10491 EXPECT_TRUE(hitTestResult.URLElement()); | 10491 EXPECT_TRUE(hitTestResult.URLElement()); |
| 10492 EXPECT_TRUE(hitTestResult.innerElement()); | 10492 EXPECT_TRUE(hitTestResult.innerElement()); |
| 10493 EXPECT_TRUE(hitTestResult.scrollbar()); | 10493 EXPECT_TRUE(hitTestResult.scrollbar()); |
| 10494 EXPECT_FALSE(hitTestResult.scrollbar()->isCustomScrollbar()); |
| 10494 | 10495 |
| 10495 // Mouse over link. Mouse cursor should be hand. | 10496 // Mouse over link. Mouse cursor should be hand. |
| 10496 PlatformMouseEvent mouseMoveOverLinkEvent( | 10497 PlatformMouseEvent mouseMoveOverLinkEvent( |
| 10497 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), | 10498 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), |
| 10498 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), | 10499 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), |
| 10499 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, | 10500 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, |
| 10500 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); | 10501 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); |
| 10501 document->frame()->eventHandler().handleMouseMoveEvent( | 10502 document->frame()->eventHandler().handleMouseMoveEvent( |
| 10502 mouseMoveOverLinkEvent); | 10503 mouseMoveOverLinkEvent); |
| 10503 | 10504 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10551 Cursor::Type::Hand, | 10552 Cursor::Type::Hand, |
| 10552 document->frame()->chromeClient().lastSetCursorForTesting().getType()); | 10553 document->frame()->chromeClient().lastSetCursorForTesting().getType()); |
| 10553 | 10554 |
| 10554 document->frame()->eventHandler().handleMousePressEvent(mousePressEvent); | 10555 document->frame()->eventHandler().handleMousePressEvent(mousePressEvent); |
| 10555 | 10556 |
| 10556 EXPECT_TRUE(document->activeHoverElement()); | 10557 EXPECT_TRUE(document->activeHoverElement()); |
| 10557 EXPECT_TRUE(document->hoverNode()); | 10558 EXPECT_TRUE(document->hoverNode()); |
| 10558 | 10559 |
| 10559 document->frame()->eventHandler().handleMouseReleaseEvent(MouseReleaseEvent); | 10560 document->frame()->eventHandler().handleMouseReleaseEvent(MouseReleaseEvent); |
| 10560 } | 10561 } |
| 10562 |
| 10563 // Makes sure that mouse hover over an custom scrollbar doesn't change the |
| 10564 // activate elements. |
| 10565 TEST_F(WebFrameTest, MouseOverCustomScrollbar) { |
| 10566 registerMockedHttpURLLoad("custom-scrollbar-hover.html"); |
| 10567 FrameTestHelpers::WebViewHelper webViewHelper; |
| 10568 WebViewImpl* webView = webViewHelper.initializeAndLoad( |
| 10569 m_baseURL + "custom-scrollbar-hover.html"); |
| 10570 |
| 10571 webViewHelper.resize(WebSize(200, 200)); |
| 10572 |
| 10573 webView->updateAllLifecyclePhases(); |
| 10574 |
| 10575 Document* document = toLocalFrame(webView->page()->mainFrame())->document(); |
| 10576 |
| 10577 Element* scrollbarDiv = document->getElementById("scrollbar"); |
| 10578 EXPECT_TRUE(scrollbarDiv); |
| 10579 |
| 10580 // Ensure hittest only has DIV |
| 10581 HitTestResult hitTestResult = webView->coreHitTestResultAt(WebPoint(1, 1)); |
| 10582 |
| 10583 EXPECT_TRUE(hitTestResult.innerElement()); |
| 10584 EXPECT_FALSE(hitTestResult.scrollbar()); |
| 10585 |
| 10586 // Mouse over DIV |
| 10587 PlatformMouseEvent mouseMoveOverDiv( |
| 10588 IntPoint(1, 1), IntPoint(1, 1), WebPointerProperties::Button::NoButton, |
| 10589 PlatformEvent::MouseMoved, 0, PlatformEvent::NoModifiers, |
| 10590 WTF::monotonicallyIncreasingTime()); |
| 10591 document->frame()->eventHandler().handleMouseMoveEvent(mouseMoveOverDiv); |
| 10592 |
| 10593 // DIV :hover |
| 10594 EXPECT_EQ(document->hoverNode(), scrollbarDiv); |
| 10595 |
| 10596 // Ensure hittest has DIV and scrollbar |
| 10597 hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 1)); |
| 10598 |
| 10599 EXPECT_TRUE(hitTestResult.innerElement()); |
| 10600 EXPECT_TRUE(hitTestResult.scrollbar()); |
| 10601 EXPECT_TRUE(hitTestResult.scrollbar()->isCustomScrollbar()); |
| 10602 |
| 10603 // Mouse over scrollbar |
| 10604 PlatformMouseEvent mouseMoveOverDivAndScrollbar( |
| 10605 IntPoint(175, 1), IntPoint(175, 1), |
| 10606 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, |
| 10607 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); |
| 10608 document->frame()->eventHandler().handleMouseMoveEvent( |
| 10609 mouseMoveOverDivAndScrollbar); |
| 10610 |
| 10611 // Custom not change the DIV :hover |
| 10612 EXPECT_EQ(document->hoverNode(), scrollbarDiv); |
| 10613 EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart); |
| 10614 } |
| 10615 |
| 10561 static void disableCompositing(WebSettings* settings) { | 10616 static void disableCompositing(WebSettings* settings) { |
| 10562 settings->setAcceleratedCompositingEnabled(false); | 10617 settings->setAcceleratedCompositingEnabled(false); |
| 10563 settings->setPreferCompositingToLCDTextEnabled(false); | 10618 settings->setPreferCompositingToLCDTextEnabled(false); |
| 10564 } | 10619 } |
| 10565 | 10620 |
| 10566 // Make sure overlay scrollbars on non-composited scrollers fade out and set | 10621 // Make sure overlay scrollbars on non-composited scrollers fade out and set |
| 10567 // the hidden bit as needed. | 10622 // the hidden bit as needed. |
| 10568 TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) { | 10623 TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) { |
| 10569 FrameTestHelpers::WebViewHelper webViewHelper; | 10624 FrameTestHelpers::WebViewHelper webViewHelper; |
| 10570 WebViewImpl* webViewImpl = webViewHelper.initialize( | 10625 WebViewImpl* webViewImpl = webViewHelper.initialize( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10649 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); | 10704 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); |
| 10650 HashSet<AtomicString> names; | 10705 HashSet<AtomicString> names; |
| 10651 for (Frame* frame = mainFrame->tree().firstChild(); frame; | 10706 for (Frame* frame = mainFrame->tree().firstChild(); frame; |
| 10652 frame = frame->tree().traverseNext()) { | 10707 frame = frame->tree().traverseNext()) { |
| 10653 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry); | 10708 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry); |
| 10654 } | 10709 } |
| 10655 EXPECT_EQ(10u, names.size()); | 10710 EXPECT_EQ(10u, names.size()); |
| 10656 } | 10711 } |
| 10657 | 10712 |
| 10658 } // namespace blink | 10713 } // namespace blink |
| OLD | NEW |