| 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 11631 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 11642   EXPECT_EQ(scrollbar->HoveredPart(), ScrollbarPart::kNoPart); | 11642   EXPECT_EQ(scrollbar->HoveredPart(), ScrollbarPart::kNoPart); | 
| 11643 | 11643 | 
| 11644   // Mouse moved over the scrollbar. | 11644   // Mouse moved over the scrollbar. | 
| 11645   WebMouseEvent mouse_move_over_scrollbar( | 11645   WebMouseEvent mouse_move_over_scrollbar( | 
| 11646       WebInputEvent::kMouseMove, WebFloatPoint(175, 1), WebFloatPoint(175, 1), | 11646       WebInputEvent::kMouseMove, WebFloatPoint(175, 1), WebFloatPoint(175, 1), | 
| 11647       WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers, | 11647       WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers, | 
| 11648       TimeTicks::Now().InSeconds()); | 11648       TimeTicks::Now().InSeconds()); | 
| 11649   mouse_move_over_scrollbar.SetFrameScale(1); | 11649   mouse_move_over_scrollbar.SetFrameScale(1); | 
| 11650   document->GetFrame()->GetEventHandler().HandleMouseMoveEvent( | 11650   document->GetFrame()->GetEventHandler().HandleMouseMoveEvent( | 
| 11651       mouse_move_over_scrollbar, Vector<WebMouseEvent>()); | 11651       mouse_move_over_scrollbar, Vector<WebMouseEvent>()); | 
| 11652   HitTestResult hit_test_result = |  | 
| 11653       web_view->CoreHitTestResultAt(WebPoint(175, 1)); |  | 
| 11654   EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kNoPart); | 11652   EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kNoPart); | 
| 11655   EXPECT_EQ(scrollbar->HoveredPart(), ScrollbarPart::kThumbPart); | 11653   EXPECT_EQ(scrollbar->HoveredPart(), ScrollbarPart::kThumbPart); | 
| 11656 | 11654 | 
| 11657   // Mouse pressed. | 11655   // Mouse pressed. | 
| 11658   WebMouseEvent mouse_press_event( | 11656   WebMouseEvent mouse_press_event( | 
| 11659       WebInputEvent::kMouseDown, WebFloatPoint(175, 1), WebFloatPoint(175, 1), | 11657       WebInputEvent::kMouseDown, WebFloatPoint(175, 1), WebFloatPoint(175, 1), | 
| 11660       WebPointerProperties::Button::kLeft, 0, | 11658       WebPointerProperties::Button::kLeft, 0, | 
| 11661       WebInputEvent::Modifiers::kLeftButtonDown, TimeTicks::Now().InSeconds()); | 11659       WebInputEvent::Modifiers::kLeftButtonDown, TimeTicks::Now().InSeconds()); | 
| 11662   mouse_press_event.SetFrameScale(1); | 11660   mouse_press_event.SetFrameScale(1); | 
| 11663   document->GetFrame()->GetEventHandler().HandleMousePressEvent( | 11661   document->GetFrame()->GetEventHandler().HandleMousePressEvent( | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 11681       WebInputEvent::kMouseUp, WebFloatPoint(1, 1), WebFloatPoint(1, 1), | 11679       WebInputEvent::kMouseUp, WebFloatPoint(1, 1), WebFloatPoint(1, 1), | 
| 11682       WebPointerProperties::Button::kLeft, 0, | 11680       WebPointerProperties::Button::kLeft, 0, | 
| 11683       WebInputEvent::Modifiers::kLeftButtonDown, TimeTicks::Now().InSeconds()); | 11681       WebInputEvent::Modifiers::kLeftButtonDown, TimeTicks::Now().InSeconds()); | 
| 11684   mouse_release_event.SetFrameScale(1); | 11682   mouse_release_event.SetFrameScale(1); | 
| 11685   document->GetFrame()->GetEventHandler().HandleMouseReleaseEvent( | 11683   document->GetFrame()->GetEventHandler().HandleMouseReleaseEvent( | 
| 11686       mouse_release_event); | 11684       mouse_release_event); | 
| 11687   EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kNoPart); | 11685   EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kNoPart); | 
| 11688   EXPECT_EQ(scrollbar->HoveredPart(), ScrollbarPart::kNoPart); | 11686   EXPECT_EQ(scrollbar->HoveredPart(), ScrollbarPart::kNoPart); | 
| 11689 } | 11687 } | 
| 11690 | 11688 | 
|  | 11689 class TapChangeHoverStateTest : public WebFrameTest { | 
|  | 11690  public: | 
|  | 11691   void RunTest(bool viewport_enabled, | 
|  | 11692                bool viewport_meta, | 
|  | 11693                bool should_change_hover_state) { | 
|  | 11694     std::string test_page = | 
|  | 11695         viewport_meta ? "viewport-2-div.html" : "noviewport-2-div.html"; | 
|  | 11696 | 
|  | 11697     FakeCompositingWebViewClient client; | 
|  | 11698     RegisterMockedHttpURLLoad(test_page); | 
|  | 11699     FrameTestHelpers::WebViewHelper web_view_helper; | 
|  | 11700     WebViewBase* web_view; | 
|  | 11701     if (viewport_enabled) { | 
|  | 11702       web_view = web_view_helper.InitializeAndLoad(base_url_ + test_page, false, | 
|  | 11703                                                    nullptr, &client, nullptr, | 
|  | 11704                                                    ConfigureAndroid); | 
|  | 11705     } else { | 
|  | 11706       web_view = web_view_helper.InitializeAndLoad(base_url_ + test_page); | 
|  | 11707     } | 
|  | 11708     web_view_helper.Resize(WebSize(250, 250)); | 
|  | 11709 | 
|  | 11710     Document* document = | 
|  | 11711         ToLocalFrame(web_view->GetPage()->MainFrame())->GetDocument(); | 
|  | 11712 | 
|  | 11713     Element* div1 = document->getElementById("div1"); | 
|  | 11714     Element* div2 = document->getElementById("div2"); | 
|  | 11715 | 
|  | 11716     // Move mouse over div1 should hover div1. | 
|  | 11717     WebMouseEvent mouse_move_over_div1( | 
|  | 11718         WebInputEvent::kMouseMove, WebFloatPoint(10, 10), WebFloatPoint(10, 10), | 
|  | 11719         WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers, | 
|  | 11720         TimeTicks::Now().InSeconds()); | 
|  | 11721     mouse_move_over_div1.SetFrameScale(1); | 
|  | 11722     document->GetFrame()->GetEventHandler().HandleMouseMoveEvent( | 
|  | 11723         mouse_move_over_div1, Vector<WebMouseEvent>()); | 
|  | 11724 | 
|  | 11725     DCHECK(document->HoverElement() == div1); | 
|  | 11726 | 
|  | 11727     // Tap on div2. | 
|  | 11728     WebGestureEvent tap_on_div2(WebInputEvent::kGestureTap, | 
|  | 11729                                 WebInputEvent::kNoModifiers, | 
|  | 11730                                 WebInputEvent::kTimeStampForTesting); | 
|  | 11731     tap_on_div2.SetFrameScale(1); | 
|  | 11732     tap_on_div2.x = tap_on_div2.global_x = 10; | 
|  | 11733     tap_on_div2.y = tap_on_div2.global_y = 110; | 
|  | 11734     tap_on_div2.source_device = kWebGestureDeviceTouchscreen; | 
|  | 11735     web_view_helper.WebView() | 
|  | 11736         ->MainFrameImpl() | 
|  | 11737         ->GetFrame() | 
|  | 11738         ->GetEventHandler() | 
|  | 11739         .HandleGestureEvent(tap_on_div2); | 
|  | 11740 | 
|  | 11741     Element* expected_hover_element = should_change_hover_state ? div2 : div1; | 
|  | 11742     EXPECT_EQ(expected_hover_element, document->HoverElement()); | 
|  | 11743   } | 
|  | 11744 }; | 
|  | 11745 | 
|  | 11746 TEST_F(TapChangeHoverStateTest, TapNotChangeHoverStateOnViewportMetaAndMobile) { | 
|  | 11747   RunTest(true, true, false); | 
|  | 11748 } | 
|  | 11749 | 
|  | 11750 TEST_F(TapChangeHoverStateTest, TapChangeHoverStateOnNoViewportMetaAndMobile) { | 
|  | 11751   RunTest(true, false, true); | 
|  | 11752 } | 
|  | 11753 | 
|  | 11754 TEST_F(TapChangeHoverStateTest, TapChangeHoverStateOnViewportMetaAndDesktop) { | 
|  | 11755   RunTest(false, true, true); | 
|  | 11756 } | 
|  | 11757 | 
| 11691 TEST_F(WebFrameTest, | 11758 TEST_F(WebFrameTest, | 
| 11692        CustomScrollbarInOverlayScrollbarThemeWillNotCauseDCHECKFails) { | 11759        CustomScrollbarInOverlayScrollbarThemeWillNotCauseDCHECKFails) { | 
| 11693   RegisterMockedHttpURLLoad( | 11760   RegisterMockedHttpURLLoad( | 
| 11694       "custom-scrollbar-dcheck-failed-when-paint-scroll-corner.html"); | 11761       "custom-scrollbar-dcheck-failed-when-paint-scroll-corner.html"); | 
| 11695   FrameTestHelpers::WebViewHelper web_view_helper; | 11762   FrameTestHelpers::WebViewHelper web_view_helper; | 
| 11696   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 11763   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
| 11697       base_url_ + | 11764       base_url_ + | 
| 11698       "custom-scrollbar-dcheck-failed-when-paint-scroll-corner.html"); | 11765       "custom-scrollbar-dcheck-failed-when-paint-scroll-corner.html"); | 
| 11699 | 11766 | 
| 11700   web_view_helper.Resize(WebSize(200, 200)); | 11767   web_view_helper.Resize(WebSize(200, 200)); | 
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 12232     if (obj->IsText()) { | 12299     if (obj->IsText()) { | 
| 12233       LayoutText* layout_text = ToLayoutText(obj); | 12300       LayoutText* layout_text = ToLayoutText(obj); | 
| 12234       text = layout_text->GetText(); | 12301       text = layout_text->GetText(); | 
| 12235       break; | 12302       break; | 
| 12236     } | 12303     } | 
| 12237   } | 12304   } | 
| 12238   EXPECT_EQ("foo alt", text.Utf8()); | 12305   EXPECT_EQ("foo alt", text.Utf8()); | 
| 12239 } | 12306 } | 
| 12240 | 12307 | 
| 12241 }  // namespace blink | 12308 }  // namespace blink | 
| OLD | NEW | 
|---|