OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/frame/VisualViewport.h" | 5 #include "core/frame/VisualViewport.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/BrowserControls.h" | 8 #include "core/frame/BrowserControls.h" |
9 #include "core/frame/FrameTestHelpers.h" | 9 #include "core/frame/FrameTestHelpers.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 | 1838 |
1839 VisualViewport& visual_viewport = GetFrame()->GetPage()->GetVisualViewport(); | 1839 VisualViewport& visual_viewport = GetFrame()->GetPage()->GetVisualViewport(); |
1840 | 1840 |
1841 // Apply some scroll and scale from the impl-side. | 1841 // Apply some scroll and scale from the impl-side. |
1842 WebViewImpl()->ApplyViewportDeltas(WebFloatSize(300, 200), WebFloatSize(0, 0), | 1842 WebViewImpl()->ApplyViewportDeltas(WebFloatSize(300, 200), WebFloatSize(0, 0), |
1843 WebFloatSize(0, 0), 2, 0); | 1843 WebFloatSize(0, 0), 2, 0); |
1844 | 1844 |
1845 EXPECT_SIZE_EQ(FloatSize(300, 200), visual_viewport.GetScrollOffset()); | 1845 EXPECT_SIZE_EQ(FloatSize(300, 200), visual_viewport.GetScrollOffset()); |
1846 | 1846 |
1847 // Send a scroll event on the main thread path. | 1847 // Send a scroll event on the main thread path. |
| 1848 WebGestureEvent gsb(WebInputEvent::kGestureScrollBegin, |
| 1849 WebInputEvent::kNoModifiers, |
| 1850 WebInputEvent::kTimeStampForTesting); |
| 1851 gsb.SetFrameScale(1); |
| 1852 gsb.source_device = kWebGestureDeviceTouchpad; |
| 1853 gsb.data.scroll_begin.delta_x_hint = -50; |
| 1854 gsb.data.scroll_begin.delta_x_hint = -60; |
| 1855 gsb.data.scroll_begin.delta_hint_units = WebGestureEvent::kPrecisePixels; |
| 1856 GetFrame()->GetEventHandler().HandleGestureEvent(gsb); |
| 1857 |
1848 WebGestureEvent gsu(WebInputEvent::kGestureScrollUpdate, | 1858 WebGestureEvent gsu(WebInputEvent::kGestureScrollUpdate, |
1849 WebInputEvent::kNoModifiers, | 1859 WebInputEvent::kNoModifiers, |
1850 WebInputEvent::kTimeStampForTesting); | 1860 WebInputEvent::kTimeStampForTesting); |
1851 gsu.SetFrameScale(1); | 1861 gsu.SetFrameScale(1); |
1852 gsu.source_device = kWebGestureDeviceTouchpad; | 1862 gsu.source_device = kWebGestureDeviceTouchpad; |
1853 gsu.data.scroll_update.delta_x = -50; | 1863 gsu.data.scroll_update.delta_x = -50; |
1854 gsu.data.scroll_update.delta_y = -60; | 1864 gsu.data.scroll_update.delta_y = -60; |
1855 gsu.data.scroll_update.delta_units = WebGestureEvent::kPrecisePixels; | 1865 gsu.data.scroll_update.delta_units = WebGestureEvent::kPrecisePixels; |
1856 gsu.data.scroll_update.velocity_x = 1; | 1866 gsu.data.scroll_update.velocity_x = 1; |
1857 gsu.data.scroll_update.velocity_y = 1; | 1867 gsu.data.scroll_update.velocity_y = 1; |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 " margin: 0px;" | 2442 " margin: 0px;" |
2433 " }" | 2443 " }" |
2434 " div { height:110vh; width: 110vw; }" | 2444 " div { height:110vh; width: 110vw; }" |
2435 "</style>" | 2445 "</style>" |
2436 "<div></div>", | 2446 "<div></div>", |
2437 base_url); | 2447 base_url); |
2438 } | 2448 } |
2439 | 2449 |
2440 } // namespace | 2450 } // namespace |
2441 } // namespace blink | 2451 } // namespace blink |
OLD | NEW |