Chromium Code Reviews| 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_TRUE(hitTestResult.scrollbar()->isOverlayScrollbar()); | |
| 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", true, nullptr, nullptr, | |
| 10570 nullptr, | |
| 10571 [](WebSettings* settings) { settings->setDeviceSupportsMouse(true); }); | |
|
bokan
2016/11/23 15:07:50
This is unneeded, deviceSupportsMouse=true is the
| |
| 10572 | |
| 10573 webViewHelper.resize(WebSize(200, 200)); | |
| 10574 | |
| 10575 webView->updateAllLifecyclePhases(); | |
| 10576 | |
| 10577 Document* document = toLocalFrame(webView->page()->mainFrame())->document(); | |
| 10578 | |
| 10579 // Ensure hittest only has DIV | |
| 10580 HitTestResult hitTestResult = webView->coreHitTestResultAt(WebPoint(1, 1)); | |
| 10581 | |
| 10582 EXPECT_TRUE(hitTestResult.innerElement()); | |
| 10583 EXPECT_FALSE(hitTestResult.scrollbar()); | |
| 10584 | |
| 10585 // Mouse over DIV | |
| 10586 PlatformMouseEvent mouseMoveOverDiv( | |
| 10587 IntPoint(1, 1), IntPoint(1, 1), WebPointerProperties::Button::NoButton, | |
| 10588 PlatformEvent::MouseMoved, 0, PlatformEvent::NoModifiers, | |
| 10589 WTF::monotonicallyIncreasingTime()); | |
| 10590 document->frame()->eventHandler().handleMouseMoveEvent(mouseMoveOverDiv); | |
| 10591 | |
| 10592 // DIV :hover | |
| 10593 EXPECT_TRUE(document->hoverNode()); | |
|
bokan
2016/11/23 15:07:50
Make sure this is false before the mouse event. Al
| |
| 10594 | |
| 10595 // Ensure hittest has DIV and scrollbar | |
| 10596 hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 175)); | |
| 10597 | |
| 10598 EXPECT_TRUE(hitTestResult.innerElement()); | |
| 10599 EXPECT_TRUE(hitTestResult.scrollbar()); | |
| 10600 | |
| 10601 // Mouse over DIV | |
| 10602 PlatformMouseEvent mouseMoveOverDivAndScrollbar( | |
| 10603 IntPoint(175, 175), IntPoint(175, 175), | |
| 10604 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, | |
| 10605 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); | |
| 10606 document->frame()->eventHandler().handleMouseMoveEvent( | |
| 10607 mouseMoveOverDivAndScrollbar); | |
| 10608 | |
| 10609 // Custom not change the DIV :hover | |
| 10610 EXPECT_TRUE(document->hoverNode()); | |
|
bokan
2016/11/23 15:07:50
Isn't the bug that the scrollbar doesn't get a hov
chaopeng
2016/11/23 16:58:36
No, This bug is the DIV get hover and change the t
| |
| 10611 } | |
| 10612 | |
| 10561 static void disableCompositing(WebSettings* settings) { | 10613 static void disableCompositing(WebSettings* settings) { |
| 10562 settings->setAcceleratedCompositingEnabled(false); | 10614 settings->setAcceleratedCompositingEnabled(false); |
| 10563 settings->setPreferCompositingToLCDTextEnabled(false); | 10615 settings->setPreferCompositingToLCDTextEnabled(false); |
| 10564 } | 10616 } |
| 10565 | 10617 |
| 10566 // Make sure overlay scrollbars on non-composited scrollers fade out and set | 10618 // Make sure overlay scrollbars on non-composited scrollers fade out and set |
| 10567 // the hidden bit as needed. | 10619 // the hidden bit as needed. |
| 10568 TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) { | 10620 TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) { |
| 10569 FrameTestHelpers::WebViewHelper webViewHelper; | 10621 FrameTestHelpers::WebViewHelper webViewHelper; |
| 10570 WebViewImpl* webViewImpl = webViewHelper.initialize( | 10622 WebViewImpl* webViewImpl = webViewHelper.initialize( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10649 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); | 10701 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); |
| 10650 HashSet<AtomicString> names; | 10702 HashSet<AtomicString> names; |
| 10651 for (Frame* frame = mainFrame->tree().firstChild(); frame; | 10703 for (Frame* frame = mainFrame->tree().firstChild(); frame; |
| 10652 frame = frame->tree().traverseNext()) { | 10704 frame = frame->tree().traverseNext()) { |
| 10653 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry); | 10705 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry); |
| 10654 } | 10706 } |
| 10655 EXPECT_EQ(10u, names.size()); | 10707 EXPECT_EQ(10u, names.size()); |
| 10656 } | 10708 } |
| 10657 | 10709 |
| 10658 } // namespace blink | 10710 } // namespace blink |
| OLD | NEW |