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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/frame/BrowserControls.h" | 10 #include "core/frame/BrowserControls.h" |
(...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 | 1835 |
1836 VisualViewport& visual_viewport = GetFrame()->GetPage()->GetVisualViewport(); | 1836 VisualViewport& visual_viewport = GetFrame()->GetPage()->GetVisualViewport(); |
1837 | 1837 |
1838 // Apply some scroll and scale from the impl-side. | 1838 // Apply some scroll and scale from the impl-side. |
1839 WebViewImpl()->ApplyViewportDeltas(WebFloatSize(300, 200), WebFloatSize(0, 0), | 1839 WebViewImpl()->ApplyViewportDeltas(WebFloatSize(300, 200), WebFloatSize(0, 0), |
1840 WebFloatSize(0, 0), 2, 0); | 1840 WebFloatSize(0, 0), 2, 0); |
1841 | 1841 |
1842 EXPECT_SIZE_EQ(FloatSize(300, 200), visual_viewport.GetScrollOffset()); | 1842 EXPECT_SIZE_EQ(FloatSize(300, 200), visual_viewport.GetScrollOffset()); |
1843 | 1843 |
1844 // Send a scroll event on the main thread path. | 1844 // Send a scroll event on the main thread path. |
| 1845 WebGestureEvent gsb(WebInputEvent::kGestureScrollBegin, |
| 1846 WebInputEvent::kNoModifiers, |
| 1847 WebInputEvent::kTimeStampForTesting); |
| 1848 gsb.SetFrameScale(1); |
| 1849 gsb.source_device = kWebGestureDeviceTouchpad; |
| 1850 gsb.data.scroll_begin.delta_x_hint = -50; |
| 1851 gsb.data.scroll_begin.delta_x_hint = -60; |
| 1852 gsb.data.scroll_begin.delta_hint_units = WebGestureEvent::kPrecisePixels; |
| 1853 GetFrame()->GetEventHandler().HandleGestureEvent(gsb); |
| 1854 |
1845 WebGestureEvent gsu(WebInputEvent::kGestureScrollUpdate, | 1855 WebGestureEvent gsu(WebInputEvent::kGestureScrollUpdate, |
1846 WebInputEvent::kNoModifiers, | 1856 WebInputEvent::kNoModifiers, |
1847 WebInputEvent::kTimeStampForTesting); | 1857 WebInputEvent::kTimeStampForTesting); |
1848 gsu.SetFrameScale(1); | 1858 gsu.SetFrameScale(1); |
1849 gsu.source_device = kWebGestureDeviceTouchpad; | 1859 gsu.source_device = kWebGestureDeviceTouchpad; |
1850 gsu.data.scroll_update.delta_x = -50; | 1860 gsu.data.scroll_update.delta_x = -50; |
1851 gsu.data.scroll_update.delta_y = -60; | 1861 gsu.data.scroll_update.delta_y = -60; |
1852 gsu.data.scroll_update.delta_units = WebGestureEvent::kPrecisePixels; | 1862 gsu.data.scroll_update.delta_units = WebGestureEvent::kPrecisePixels; |
1853 gsu.data.scroll_update.velocity_x = 1; | 1863 gsu.data.scroll_update.velocity_x = 1; |
1854 gsu.data.scroll_update.velocity_y = 1; | 1864 gsu.data.scroll_update.velocity_y = 1; |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2417 " margin: 0px;" | 2427 " margin: 0px;" |
2418 " }" | 2428 " }" |
2419 " div { height:110vh; width: 110vw; }" | 2429 " div { height:110vh; width: 110vw; }" |
2420 "</style>" | 2430 "</style>" |
2421 "<div></div>", | 2431 "<div></div>", |
2422 base_url); | 2432 base_url); |
2423 } | 2433 } |
2424 | 2434 |
2425 } // namespace | 2435 } // namespace |
2426 } // namespace blink | 2436 } // namespace blink |
OLD | NEW |