OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 WebViewBase* web_view = | 836 WebViewBase* web_view = |
837 web_view_helper.InitializeAndLoad(base_url + file_name); | 837 web_view_helper.InitializeAndLoad(base_url + file_name); |
838 int page_width = 640; | 838 int page_width = 640; |
839 int page_height = 480; | 839 int page_height = 480; |
840 web_view->Resize(WebSize(page_width, page_height)); | 840 web_view->Resize(WebSize(page_width, page_height)); |
841 web_view->UpdateAllLifecyclePhases(); | 841 web_view->UpdateAllLifecyclePhases(); |
842 | 842 |
843 FloatSize elastic_overscroll(10, -20); | 843 FloatSize elastic_overscroll(10, -20); |
844 web_view->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), | 844 web_view->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), |
845 elastic_overscroll, 1.0f, 0.0f); | 845 elastic_overscroll, 1.0f, 0.0f); |
846 FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrame()); | 846 FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrameImpl()); |
847 LocalFrameView* view = ToLocalFrame(web_view->GetPage()->MainFrame())->View(); | 847 LocalFrameView* view = ToLocalFrame(web_view->GetPage()->MainFrame())->View(); |
848 | 848 |
849 // Just elastic overscroll. | 849 // Just elastic overscroll. |
850 { | 850 { |
851 WebMouseEvent web_mouse_event(WebInputEvent::kMouseMove, | 851 WebMouseEvent web_mouse_event(WebInputEvent::kMouseMove, |
852 WebInputEvent::kNoModifiers, | 852 WebInputEvent::kNoModifiers, |
853 WebInputEvent::kTimeStampForTesting); | 853 WebInputEvent::kTimeStampForTesting); |
854 web_mouse_event.SetPositionInWidget(10, 50); | 854 web_mouse_event.SetPositionInWidget(10, 50); |
855 web_mouse_event.SetPositionInScreen(10, 50); | 855 web_mouse_event.SetPositionInScreen(10, 50); |
856 | 856 |
857 WebMouseEvent transformed_mouse_event = | 857 WebMouseEvent transformed_mouse_event = |
858 TransformWebMouseEvent(view, web_mouse_event); | 858 TransformWebMouseEvent(view, web_mouse_event); |
859 IntPoint position = | 859 IntPoint position = |
860 FlooredIntPoint(transformed_mouse_event.PositionInRootFrame()); | 860 FlooredIntPoint(transformed_mouse_event.PositionInRootFrame()); |
861 | 861 |
862 EXPECT_EQ(web_mouse_event.PositionInWidget().x + elastic_overscroll.Width(), | 862 EXPECT_EQ(web_mouse_event.PositionInWidget().x + elastic_overscroll.Width(), |
863 position.X()); | 863 position.X()); |
864 EXPECT_EQ( | 864 EXPECT_EQ( |
865 web_mouse_event.PositionInWidget().y + elastic_overscroll.Height(), | 865 web_mouse_event.PositionInWidget().y + elastic_overscroll.Height(), |
866 position.Y()); | 866 position.Y()); |
867 EXPECT_EQ(web_mouse_event.PositionInScreen().x, | 867 EXPECT_EQ(web_mouse_event.PositionInScreen().x, |
868 transformed_mouse_event.PositionInScreen().x); | 868 transformed_mouse_event.PositionInScreen().x); |
869 EXPECT_EQ(web_mouse_event.PositionInScreen().y, | 869 EXPECT_EQ(web_mouse_event.PositionInScreen().y, |
870 transformed_mouse_event.PositionInScreen().y); | 870 transformed_mouse_event.PositionInScreen().y); |
871 } | 871 } |
872 } | 872 } |
873 | 873 |
874 } // namespace blink | 874 } // namespace blink |
OLD | NEW |