| 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 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 | 1904 |
| 1905 IntPoint hitPoint = IntPoint(30, 30); // button size is 100x100 | 1905 IntPoint hitPoint = IntPoint(30, 30); // button size is 100x100 |
| 1906 | 1906 |
| 1907 WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); | 1907 WebLocalFrameImpl* frame = webViewHelper.webView()->mainFrameImpl(); |
| 1908 Document* document = frame->frame()->document(); | 1908 Document* document = frame->frame()->document(); |
| 1909 Element* element = document->getElementById("tap_button"); | 1909 Element* element = document->getElementById("tap_button"); |
| 1910 | 1910 |
| 1911 ASSERT_NE(nullptr, element); | 1911 ASSERT_NE(nullptr, element); |
| 1912 EXPECT_EQ(String("oldValue"), element->innerText()); | 1912 EXPECT_EQ(String("oldValue"), element->innerText()); |
| 1913 | 1913 |
| 1914 PlatformGestureEvent gestureEvent( | 1914 PlatformGestureEvent gestureEvent(PlatformEvent::EventType::GestureTap, |
| 1915 PlatformEvent::EventType::GestureTap, hitPoint, hitPoint, IntSize(0, 0), | 1915 hitPoint, hitPoint, IntSize(0, 0), |
| 1916 0, PlatformEvent::NoModifiers, PlatformGestureSourceTouchscreen); | 1916 TimeTicks(), PlatformEvent::NoModifiers, |
| 1917 PlatformGestureSourceTouchscreen); |
| 1917 webViewHelper.webView() | 1918 webViewHelper.webView() |
| 1918 ->mainFrameImpl() | 1919 ->mainFrameImpl() |
| 1919 ->frame() | 1920 ->frame() |
| 1920 ->eventHandler() | 1921 ->eventHandler() |
| 1921 .handleGestureEvent(gestureEvent); | 1922 .handleGestureEvent(gestureEvent); |
| 1922 // when pressed, the button changes its own text to "updatedValue" | 1923 // when pressed, the button changes its own text to "updatedValue" |
| 1923 EXPECT_EQ(String("updatedValue"), element->innerText()); | 1924 EXPECT_EQ(String("updatedValue"), element->innerText()); |
| 1924 } | 1925 } |
| 1925 | 1926 |
| 1926 TEST_F(WebFrameTest, FrameOwnerPropertiesMargin) { | 1927 TEST_F(WebFrameTest, FrameOwnerPropertiesMargin) { |
| (...skipping 4972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6899 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", | 6900 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", |
| 6900 true, &client); | 6901 true, &client); |
| 6901 | 6902 |
| 6902 Document* document = | 6903 Document* document = |
| 6903 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); | 6904 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); |
| 6904 KURL destination = document->url(); | 6905 KURL destination = document->url(); |
| 6905 destination.setFragmentIdentifier("test"); | 6906 destination.setFragmentIdentifier("test"); |
| 6906 | 6907 |
| 6907 Event* event = MouseEvent::create( | 6908 Event* event = MouseEvent::create( |
| 6908 EventTypeNames::click, false, false, document->domWindow(), 0, 0, 0, 0, 0, | 6909 EventTypeNames::click, false, false, document->domWindow(), 0, 0, 0, 0, 0, |
| 6909 0, 0, PlatformEvent::NoModifiers, 1, 0, nullptr, 0, | 6910 0, 0, PlatformEvent::NoModifiers, 1, 0, nullptr, TimeTicks(), |
| 6910 PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr); | 6911 PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr); |
| 6911 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); | 6912 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); |
| 6912 frameRequest.setTriggeringEvent(event); | 6913 frameRequest.setTriggeringEvent(event); |
| 6913 toLocalFrame(webViewHelper.webView()->page()->mainFrame()) | 6914 toLocalFrame(webViewHelper.webView()->page()->mainFrame()) |
| 6914 ->loader() | 6915 ->loader() |
| 6915 .load(frameRequest); | 6916 .load(frameRequest); |
| 6916 } | 6917 } |
| 6917 | 6918 |
| 6918 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { | 6919 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { |
| 6919 public: | 6920 public: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6954 webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true, | 6955 webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true, |
| 6955 &webFrameClient, &webViewClient); | 6956 &webFrameClient, &webViewClient); |
| 6956 | 6957 |
| 6957 Document* document = | 6958 Document* document = |
| 6958 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); | 6959 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); |
| 6959 KURL destination = toKURL(m_baseURL + "hello_world.html"); | 6960 KURL destination = toKURL(m_baseURL + "hello_world.html"); |
| 6960 | 6961 |
| 6961 // ctrl+click event | 6962 // ctrl+click event |
| 6962 Event* event = MouseEvent::create( | 6963 Event* event = MouseEvent::create( |
| 6963 EventTypeNames::click, false, false, document->domWindow(), 0, 0, 0, 0, 0, | 6964 EventTypeNames::click, false, false, document->domWindow(), 0, 0, 0, 0, 0, |
| 6964 0, 0, PlatformEvent::CtrlKey, 0, 0, nullptr, 0, | 6965 0, 0, PlatformEvent::CtrlKey, 0, 0, nullptr, TimeTicks(), |
| 6965 PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr); | 6966 PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr); |
| 6966 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); | 6967 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); |
| 6967 frameRequest.setTriggeringEvent(event); | 6968 frameRequest.setTriggeringEvent(event); |
| 6968 UserGestureIndicator gesture(DocumentUserGestureToken::create(document)); | 6969 UserGestureIndicator gesture(DocumentUserGestureToken::create(document)); |
| 6969 toLocalFrame(webViewHelper.webView()->page()->mainFrame()) | 6970 toLocalFrame(webViewHelper.webView()->page()->mainFrame()) |
| 6970 ->loader() | 6971 ->loader() |
| 6971 .load(frameRequest); | 6972 .load(frameRequest); |
| 6972 FrameTestHelpers::pumpPendingRequestsForFrameToLoad( | 6973 FrameTestHelpers::pumpPendingRequestsForFrameToLoad( |
| 6973 webViewHelper.webView()->mainFrame()); | 6974 webViewHelper.webView()->mainFrame()); |
| 6974 | 6975 |
| (...skipping 3802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10777 EXPECT_TRUE(hitTestResult.URLElement()); | 10778 EXPECT_TRUE(hitTestResult.URLElement()); |
| 10778 EXPECT_TRUE(hitTestResult.innerElement()); | 10779 EXPECT_TRUE(hitTestResult.innerElement()); |
| 10779 EXPECT_TRUE(hitTestResult.scrollbar()); | 10780 EXPECT_TRUE(hitTestResult.scrollbar()); |
| 10780 EXPECT_FALSE(hitTestResult.scrollbar()->isCustomScrollbar()); | 10781 EXPECT_FALSE(hitTestResult.scrollbar()->isCustomScrollbar()); |
| 10781 | 10782 |
| 10782 // Mouse over link. Mouse cursor should be hand. | 10783 // Mouse over link. Mouse cursor should be hand. |
| 10783 PlatformMouseEvent mouseMoveOverLinkEvent( | 10784 PlatformMouseEvent mouseMoveOverLinkEvent( |
| 10784 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), | 10785 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), |
| 10785 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), | 10786 IntPoint(aTag->offsetLeft(), aTag->offsetTop()), |
| 10786 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, | 10787 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, |
| 10787 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); | 10788 PlatformEvent::NoModifiers, TimeTicks::Now()); |
| 10788 document->frame()->eventHandler().handleMouseMoveEvent( | 10789 document->frame()->eventHandler().handleMouseMoveEvent( |
| 10789 mouseMoveOverLinkEvent, Vector<PlatformMouseEvent>()); | 10790 mouseMoveOverLinkEvent, Vector<PlatformMouseEvent>()); |
| 10790 | 10791 |
| 10791 EXPECT_EQ( | 10792 EXPECT_EQ( |
| 10792 Cursor::Type::Hand, | 10793 Cursor::Type::Hand, |
| 10793 document->frame()->chromeClient().lastSetCursorForTesting().getType()); | 10794 document->frame()->chromeClient().lastSetCursorForTesting().getType()); |
| 10794 | 10795 |
| 10795 // Mouse over enabled overlay scrollbar. Mouse cursor should be pointer and no | 10796 // Mouse over enabled overlay scrollbar. Mouse cursor should be pointer and no |
| 10796 // active hover element. | 10797 // active hover element. |
| 10797 PlatformMouseEvent mouseMoveEvent( | 10798 PlatformMouseEvent mouseMoveEvent( |
| 10798 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()), | 10799 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()), |
| 10799 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, | 10800 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, |
| 10800 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); | 10801 PlatformEvent::NoModifiers, TimeTicks::Now()); |
| 10801 document->frame()->eventHandler().handleMouseMoveEvent( | 10802 document->frame()->eventHandler().handleMouseMoveEvent( |
| 10802 mouseMoveEvent, Vector<PlatformMouseEvent>()); | 10803 mouseMoveEvent, Vector<PlatformMouseEvent>()); |
| 10803 | 10804 |
| 10804 EXPECT_EQ( | 10805 EXPECT_EQ( |
| 10805 Cursor::Type::Pointer, | 10806 Cursor::Type::Pointer, |
| 10806 document->frame()->chromeClient().lastSetCursorForTesting().getType()); | 10807 document->frame()->chromeClient().lastSetCursorForTesting().getType()); |
| 10807 | 10808 |
| 10808 PlatformMouseEvent mousePressEvent( | 10809 PlatformMouseEvent mousePressEvent( |
| 10809 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()), | 10810 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()), |
| 10810 WebPointerProperties::Button::Left, PlatformEvent::MousePressed, 0, | 10811 WebPointerProperties::Button::Left, PlatformEvent::MousePressed, 0, |
| 10811 PlatformEvent::Modifiers::LeftButtonDown, | 10812 PlatformEvent::Modifiers::LeftButtonDown, TimeTicks::Now()); |
| 10812 WTF::monotonicallyIncreasingTime()); | |
| 10813 document->frame()->eventHandler().handleMousePressEvent(mousePressEvent); | 10813 document->frame()->eventHandler().handleMousePressEvent(mousePressEvent); |
| 10814 | 10814 |
| 10815 EXPECT_FALSE(document->activeHoverElement()); | 10815 EXPECT_FALSE(document->activeHoverElement()); |
| 10816 EXPECT_FALSE(document->hoverNode()); | 10816 EXPECT_FALSE(document->hoverNode()); |
| 10817 | 10817 |
| 10818 PlatformMouseEvent MouseReleaseEvent( | 10818 PlatformMouseEvent MouseReleaseEvent( |
| 10819 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()), | 10819 IntPoint(18, aTag->offsetTop()), IntPoint(18, aTag->offsetTop()), |
| 10820 WebPointerProperties::Button::Left, PlatformEvent::MouseReleased, 0, | 10820 WebPointerProperties::Button::Left, PlatformEvent::MouseReleased, 0, |
| 10821 PlatformEvent::Modifiers::LeftButtonDown, | 10821 PlatformEvent::Modifiers::LeftButtonDown, TimeTicks::Now()); |
| 10822 WTF::monotonicallyIncreasingTime()); | |
| 10823 document->frame()->eventHandler().handleMouseReleaseEvent(MouseReleaseEvent); | 10822 document->frame()->eventHandler().handleMouseReleaseEvent(MouseReleaseEvent); |
| 10824 | 10823 |
| 10825 // Mouse over disabled overlay scrollbar. Mouse cursor should be hand and has | 10824 // Mouse over disabled overlay scrollbar. Mouse cursor should be hand and has |
| 10826 // active hover element. | 10825 // active hover element. |
| 10827 webView->mainFrameImpl()->frameView()->setScrollbarsHidden(true); | 10826 webView->mainFrameImpl()->frameView()->setScrollbarsHidden(true); |
| 10828 | 10827 |
| 10829 // Ensure hittest only has link | 10828 // Ensure hittest only has link |
| 10830 hitTestResult = webView->coreHitTestResultAt(WebPoint(18, aTag->offsetTop())); | 10829 hitTestResult = webView->coreHitTestResultAt(WebPoint(18, aTag->offsetTop())); |
| 10831 | 10830 |
| 10832 EXPECT_TRUE(hitTestResult.URLElement()); | 10831 EXPECT_TRUE(hitTestResult.URLElement()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10868 // Ensure hittest only has DIV | 10867 // Ensure hittest only has DIV |
| 10869 HitTestResult hitTestResult = webView->coreHitTestResultAt(WebPoint(1, 1)); | 10868 HitTestResult hitTestResult = webView->coreHitTestResultAt(WebPoint(1, 1)); |
| 10870 | 10869 |
| 10871 EXPECT_TRUE(hitTestResult.innerElement()); | 10870 EXPECT_TRUE(hitTestResult.innerElement()); |
| 10872 EXPECT_FALSE(hitTestResult.scrollbar()); | 10871 EXPECT_FALSE(hitTestResult.scrollbar()); |
| 10873 | 10872 |
| 10874 // Mouse over DIV | 10873 // Mouse over DIV |
| 10875 PlatformMouseEvent mouseMoveOverDiv( | 10874 PlatformMouseEvent mouseMoveOverDiv( |
| 10876 IntPoint(1, 1), IntPoint(1, 1), WebPointerProperties::Button::NoButton, | 10875 IntPoint(1, 1), IntPoint(1, 1), WebPointerProperties::Button::NoButton, |
| 10877 PlatformEvent::MouseMoved, 0, PlatformEvent::NoModifiers, | 10876 PlatformEvent::MouseMoved, 0, PlatformEvent::NoModifiers, |
| 10878 WTF::monotonicallyIncreasingTime()); | 10877 TimeTicks::Now()); |
| 10879 document->frame()->eventHandler().handleMouseMoveEvent( | 10878 document->frame()->eventHandler().handleMouseMoveEvent( |
| 10880 mouseMoveOverDiv, Vector<PlatformMouseEvent>()); | 10879 mouseMoveOverDiv, Vector<PlatformMouseEvent>()); |
| 10881 | 10880 |
| 10882 // DIV :hover | 10881 // DIV :hover |
| 10883 EXPECT_EQ(document->hoverNode(), scrollbarDiv); | 10882 EXPECT_EQ(document->hoverNode(), scrollbarDiv); |
| 10884 | 10883 |
| 10885 // Ensure hittest has DIV and scrollbar | 10884 // Ensure hittest has DIV and scrollbar |
| 10886 hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 1)); | 10885 hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 1)); |
| 10887 | 10886 |
| 10888 EXPECT_TRUE(hitTestResult.innerElement()); | 10887 EXPECT_TRUE(hitTestResult.innerElement()); |
| 10889 EXPECT_TRUE(hitTestResult.scrollbar()); | 10888 EXPECT_TRUE(hitTestResult.scrollbar()); |
| 10890 EXPECT_TRUE(hitTestResult.scrollbar()->isCustomScrollbar()); | 10889 EXPECT_TRUE(hitTestResult.scrollbar()->isCustomScrollbar()); |
| 10891 | 10890 |
| 10892 // Mouse over scrollbar | 10891 // Mouse over scrollbar |
| 10893 PlatformMouseEvent mouseMoveOverDivAndScrollbar( | 10892 PlatformMouseEvent mouseMoveOverDivAndScrollbar( |
| 10894 IntPoint(175, 1), IntPoint(175, 1), | 10893 IntPoint(175, 1), IntPoint(175, 1), |
| 10895 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, | 10894 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, |
| 10896 PlatformEvent::NoModifiers, WTF::monotonicallyIncreasingTime()); | 10895 PlatformEvent::NoModifiers, TimeTicks::Now()); |
| 10897 document->frame()->eventHandler().handleMouseMoveEvent( | 10896 document->frame()->eventHandler().handleMouseMoveEvent( |
| 10898 mouseMoveOverDivAndScrollbar, Vector<PlatformMouseEvent>()); | 10897 mouseMoveOverDivAndScrollbar, Vector<PlatformMouseEvent>()); |
| 10899 | 10898 |
| 10900 // Custom not change the DIV :hover | 10899 // Custom not change the DIV :hover |
| 10901 EXPECT_EQ(document->hoverNode(), scrollbarDiv); | 10900 EXPECT_EQ(document->hoverNode(), scrollbarDiv); |
| 10902 EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart); | 10901 EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart); |
| 10903 } | 10902 } |
| 10904 | 10903 |
| 10905 static void disableCompositing(WebSettings* settings) { | 10904 static void disableCompositing(WebSettings* settings) { |
| 10906 settings->setAcceleratedCompositingEnabled(false); | 10905 settings->setAcceleratedCompositingEnabled(false); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11084 | 11083 |
| 11085 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); | 11084 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); |
| 11086 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); | 11085 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); |
| 11087 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); | 11086 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); |
| 11088 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); | 11087 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); |
| 11089 | 11088 |
| 11090 webViewHelper.reset(); | 11089 webViewHelper.reset(); |
| 11091 } | 11090 } |
| 11092 | 11091 |
| 11093 } // namespace blink | 11092 } // namespace blink |
| OLD | NEW |