| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #include "core/loader/DocumentThreadableLoader.h" | 72 #include "core/loader/DocumentThreadableLoader.h" |
| 73 #include "core/loader/DocumentThreadableLoaderClient.h" | 73 #include "core/loader/DocumentThreadableLoaderClient.h" |
| 74 #include "core/loader/FrameLoadRequest.h" | 74 #include "core/loader/FrameLoadRequest.h" |
| 75 #include "core/loader/ThreadableLoader.h" | 75 #include "core/loader/ThreadableLoader.h" |
| 76 #include "core/page/Page.h" | 76 #include "core/page/Page.h" |
| 77 #include "core/page/ScopedPageLoadDeferrer.h" | 77 #include "core/page/ScopedPageLoadDeferrer.h" |
| 78 #include "core/paint/PaintLayer.h" | 78 #include "core/paint/PaintLayer.h" |
| 79 #include "core/testing/NullExecutionContext.h" | 79 #include "core/testing/NullExecutionContext.h" |
| 80 #include "modules/mediastream/MediaStream.h" | 80 #include "modules/mediastream/MediaStream.h" |
| 81 #include "modules/mediastream/MediaStreamRegistry.h" | 81 #include "modules/mediastream/MediaStreamRegistry.h" |
| 82 #include "platform/Cursor.h" |
| 82 #include "platform/DragImage.h" | 83 #include "platform/DragImage.h" |
| 84 #include "platform/PlatformMouseEvent.h" |
| 83 #include "platform/PlatformResourceLoader.h" | 85 #include "platform/PlatformResourceLoader.h" |
| 84 #include "platform/RuntimeEnabledFeatures.h" | 86 #include "platform/RuntimeEnabledFeatures.h" |
| 85 #include "platform/UserGestureIndicator.h" | 87 #include "platform/UserGestureIndicator.h" |
| 86 #include "platform/geometry/FloatRect.h" | 88 #include "platform/geometry/FloatRect.h" |
| 87 #include "platform/network/ResourceError.h" | 89 #include "platform/network/ResourceError.h" |
| 90 #include "platform/scroll/Scrollbar.h" |
| 91 #include "platform/scroll/ScrollbarTestSuite.h" |
| 88 #include "platform/scroll/ScrollbarTheme.h" | 92 #include "platform/scroll/ScrollbarTheme.h" |
| 93 #include "platform/scroll/ScrollbarThemeMock.h" |
| 89 #include "platform/scroll/ScrollbarThemeOverlayMock.h" | 94 #include "platform/scroll/ScrollbarThemeOverlayMock.h" |
| 90 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 95 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| 91 #include "platform/testing/URLTestHelpers.h" | 96 #include "platform/testing/URLTestHelpers.h" |
| 92 #include "platform/testing/UnitTestHelpers.h" | 97 #include "platform/testing/UnitTestHelpers.h" |
| 93 #include "platform/weborigin/KURLHash.h" | 98 #include "platform/weborigin/KURLHash.h" |
| 94 #include "platform/weborigin/SchemeRegistry.h" | 99 #include "platform/weborigin/SchemeRegistry.h" |
| 95 #include "platform/weborigin/SecurityOrigin.h" | 100 #include "platform/weborigin/SecurityOrigin.h" |
| 96 #include "public/platform/Platform.h" | 101 #include "public/platform/Platform.h" |
| 97 #include "public/platform/WebCachePolicy.h" | 102 #include "public/platform/WebCachePolicy.h" |
| 98 #include "public/platform/WebClipboard.h" | 103 #include "public/platform/WebClipboard.h" |
| (...skipping 10355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10454 scrollerArea->horizontalScrollbar()->shouldParticipateInHitTesting()); | 10459 scrollerArea->horizontalScrollbar()->shouldParticipateInHitTesting()); |
| 10455 EXPECT_FALSE( | 10460 EXPECT_FALSE( |
| 10456 scrollerArea->verticalScrollbar()->shouldParticipateInHitTesting()); | 10461 scrollerArea->verticalScrollbar()->shouldParticipateInHitTesting()); |
| 10457 scrollerArea->setScrollbarsHidden(false); | 10462 scrollerArea->setScrollbarsHidden(false); |
| 10458 EXPECT_TRUE( | 10463 EXPECT_TRUE( |
| 10459 scrollerArea->horizontalScrollbar()->shouldParticipateInHitTesting()); | 10464 scrollerArea->horizontalScrollbar()->shouldParticipateInHitTesting()); |
| 10460 EXPECT_TRUE( | 10465 EXPECT_TRUE( |
| 10461 scrollerArea->verticalScrollbar()->shouldParticipateInHitTesting()); | 10466 scrollerArea->verticalScrollbar()->shouldParticipateInHitTesting()); |
| 10462 } | 10467 } |
| 10463 | 10468 |
| 10469 // Makes sure that mouse hover over an overlay scrollbar doesn't activate |
| 10470 // elements below unless the scrollbar is faded out. |
| 10471 TEST_F(WebFrameTest, MouseOverLinkAndOverlayScrollbar) { |
| 10472 FrameTestHelpers::WebViewHelper webViewHelper; |
| 10473 webViewHelper.initialize( |
| 10474 true, nullptr, nullptr, nullptr, |
| 10475 [](WebSettings* settings) { settings->setDeviceSupportsMouse(true); }); |
| 10476 webViewHelper.resize(WebSize(20, 20)); |
| 10477 WebViewImpl* webView = webViewHelper.webView(); |
| 10478 |
| 10479 initializeWithHTML(*webView->mainFrameImpl()->frame(), |
| 10480 "<!DOCTYPE html>" |
| 10481 "<a id='a' href='javascript:void(0);'>" |
| 10482 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 10483 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 10484 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 10485 "</a>" |
| 10486 "<div style='position: absolute; top: 1000px'>end</div>"); |
| 10487 |
| 10488 webView->updateAllLifecyclePhases(); |
| 10489 |
| 10490 Document* document = webView->mainFrameImpl()->frame()->document(); |
| 10491 Element* aTag = document->getElementById("a"); |
| 10492 |
| 10493 // Ensure hittest has scrollbar and link |
| 10494 HitTestResult hitTestResult = |
| 10495 webView->coreHitTestResultAt(WebPoint(18, aTag->offsetTop())); |
| 10496 |
| 10497 EXPECT_TRUE(hitTestResult.URLElement()); |
| 10498 EXPECT_TRUE(hitTestResult.innerElement()); |
| 10499 EXPECT_TRUE(hitTestResult.scrollbar()); |
| 10500 |
| 10501 // Mouse over link. Mouse cursor should be hand. |
| 10502 PlatformMouseEvent mouseMoveOverLinkEvent( |
| 10503 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), |
| 10504 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), |
| 10505 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, |
| 10506 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); |
| 10507 document->frame()->eventHandler().handleMouseMoveEvent( |
| 10508 mouseMoveOverLinkEvent); |
| 10509 |
| 10510 EXPECT_EQ( |
| 10511 Cursor::Type::Hand, |
| 10512 document->frame()->chromeClient().lastSetCursorForTesting().getType()); |
| 10513 |
| 10514 // Mouse over enabled overlay scrollbar. Mouse cursor should be pointer and no |
| 10515 // active hover element. |
| 10516 PlatformMouseEvent mouseMoveEvent( |
| 10517 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()), |
| 10518 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, |
| 10519 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); |
| 10520 document->frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); |
| 10521 |
| 10522 EXPECT_EQ( |
| 10523 Cursor::Type::Pointer, |
| 10524 document->frame()->chromeClient().lastSetCursorForTesting().getType()); |
| 10525 |
| 10526 PlatformMouseEvent mousePressEvent( |
| 10527 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()), |
| 10528 WebPointerProperties::Button::Left, PlatformEvent::MousePressed, 0, |
| 10529 PlatformEvent::Modifiers::LeftButtonDown, |
| 10530 WTF::monotonicallyIncreasingTime()); |
| 10531 document->frame()->eventHandler().handleMousePressEvent(mousePressEvent); |
| 10532 |
| 10533 EXPECT_FALSE(document->activeHoverElement()); |
| 10534 EXPECT_FALSE(document->hoverNode()); |
| 10535 |
| 10536 PlatformMouseEvent MouseReleaseEvent( |
| 10537 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()), |
| 10538 WebPointerProperties::Button::Left, PlatformEvent::MouseReleased, 0, |
| 10539 PlatformEvent::Modifiers::LeftButtonDown, |
| 10540 WTF::monotonicallyIncreasingTime()); |
| 10541 document->frame()->eventHandler().handleMouseReleaseEvent(MouseReleaseEvent); |
| 10542 |
| 10543 // Mouse over disabled overlay scrollbar. Mouse cursor should be hand and has |
| 10544 // active hover element. |
| 10545 webView->mainFrameImpl()->frameView()->setScrollbarsHidden(true); |
| 10546 |
| 10547 // Ensure hittest only has link |
| 10548 hitTestResult = webView->coreHitTestResultAt(WebPoint(18, aTag->offsetTop())); |
| 10549 |
| 10550 EXPECT_TRUE(hitTestResult.URLElement()); |
| 10551 EXPECT_TRUE(hitTestResult.innerElement()); |
| 10552 EXPECT_FALSE(hitTestResult.scrollbar()); |
| 10553 |
| 10554 document->frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); |
| 10555 |
| 10556 EXPECT_EQ( |
| 10557 Cursor::Type::Hand, |
| 10558 document->frame()->chromeClient().lastSetCursorForTesting().getType()); |
| 10559 |
| 10560 document->frame()->eventHandler().handleMousePressEvent(mousePressEvent); |
| 10561 |
| 10562 EXPECT_TRUE(document->activeHoverElement()); |
| 10563 EXPECT_TRUE(document->hoverNode()); |
| 10564 |
| 10565 document->frame()->eventHandler().handleMouseReleaseEvent(MouseReleaseEvent); |
| 10566 } |
| 10464 static void disableCompositing(WebSettings* settings) { | 10567 static void disableCompositing(WebSettings* settings) { |
| 10465 settings->setAcceleratedCompositingEnabled(false); | 10568 settings->setAcceleratedCompositingEnabled(false); |
| 10466 settings->setPreferCompositingToLCDTextEnabled(false); | 10569 settings->setPreferCompositingToLCDTextEnabled(false); |
| 10467 } | 10570 } |
| 10468 | 10571 |
| 10469 // Make sure overlay scrollbars on non-composited scrollers fade out and set | 10572 // Make sure overlay scrollbars on non-composited scrollers fade out and set |
| 10470 // the hidden bit as needed. | 10573 // the hidden bit as needed. |
| 10471 TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) { | 10574 TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) { |
| 10472 FrameTestHelpers::WebViewHelper webViewHelper; | 10575 FrameTestHelpers::WebViewHelper webViewHelper; |
| 10473 WebViewImpl* webViewImpl = webViewHelper.initialize( | 10576 WebViewImpl* webViewImpl = webViewHelper.initialize( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10552 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); | 10655 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); |
| 10553 HashSet<AtomicString> names; | 10656 HashSet<AtomicString> names; |
| 10554 for (Frame* frame = mainFrame->tree().firstChild(); frame; | 10657 for (Frame* frame = mainFrame->tree().firstChild(); frame; |
| 10555 frame = frame->tree().traverseNext()) { | 10658 frame = frame->tree().traverseNext()) { |
| 10556 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry); | 10659 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry); |
| 10557 } | 10660 } |
| 10558 EXPECT_EQ(10u, names.size()); | 10661 EXPECT_EQ(10u, names.size()); |
| 10559 } | 10662 } |
| 10560 | 10663 |
| 10561 } // namespace blink | 10664 } // namespace blink |
| OLD | NEW |