| 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/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| 11 #include "core/frame/LocalFrame.h" | 11 #include "core/frame/LocalFrame.h" |
| 12 #include "core/html/HTMLBodyElement.h" | 12 #include "core/html/HTMLBodyElement.h" |
| 13 #include "core/html/HTMLElement.h" | 13 #include "core/html/HTMLElement.h" |
| 14 #include "core/input/EventHandler.h" | 14 #include "core/input/EventHandler.h" |
| 15 #include "core/layout/LayoutObject.h" | 15 #include "core/layout/LayoutObject.h" |
| 16 #include "core/layout/api/LayoutViewItem.h" | 16 #include "core/layout/api/LayoutViewItem.h" |
| 17 #include "core/layout/compositing/PaintLayerCompositor.h" | 17 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 18 #include "core/page/Page.h" | 18 #include "core/page/Page.h" |
| 19 #include "core/paint/PaintLayer.h" | 19 #include "core/paint/PaintLayer.h" |
| 20 #include "platform/PlatformGestureEvent.h" | |
| 21 #include "platform/geometry/DoublePoint.h" | 20 #include "platform/geometry/DoublePoint.h" |
| 22 #include "platform/geometry/DoubleRect.h" | 21 #include "platform/geometry/DoubleRect.h" |
| 23 #include "platform/graphics/CompositorElementId.h" | 22 #include "platform/graphics/CompositorElementId.h" |
| 24 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 23 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| 25 #include "platform/testing/URLTestHelpers.h" | 24 #include "platform/testing/URLTestHelpers.h" |
| 26 #include "public/platform/Platform.h" | 25 #include "public/platform/Platform.h" |
| 27 #include "public/platform/WebCachePolicy.h" | 26 #include "public/platform/WebCachePolicy.h" |
| 28 #include "public/platform/WebInputEvent.h" | 27 #include "public/platform/WebInputEvent.h" |
| 29 #include "public/platform/WebLayerTreeView.h" | 28 #include "public/platform/WebLayerTreeView.h" |
| 30 #include "public/platform/WebURLLoaderMockFactory.h" | 29 #include "public/platform/WebURLLoaderMockFactory.h" |
| (...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 VisualViewport& visualViewport = | 1857 VisualViewport& visualViewport = |
| 1859 frame()->page()->frameHost().visualViewport(); | 1858 frame()->page()->frameHost().visualViewport(); |
| 1860 | 1859 |
| 1861 // Apply some scroll and scale from the impl-side. | 1860 // Apply some scroll and scale from the impl-side. |
| 1862 webViewImpl()->applyViewportDeltas(WebFloatSize(300, 200), WebFloatSize(0, 0), | 1861 webViewImpl()->applyViewportDeltas(WebFloatSize(300, 200), WebFloatSize(0, 0), |
| 1863 WebFloatSize(0, 0), 2, 0); | 1862 WebFloatSize(0, 0), 2, 0); |
| 1864 | 1863 |
| 1865 EXPECT_SIZE_EQ(FloatSize(300, 200), visualViewport.getScrollOffset()); | 1864 EXPECT_SIZE_EQ(FloatSize(300, 200), visualViewport.getScrollOffset()); |
| 1866 | 1865 |
| 1867 // Send a scroll event on the main thread path. | 1866 // Send a scroll event on the main thread path. |
| 1868 PlatformGestureEvent gsu(PlatformEvent::GestureScrollUpdate, IntPoint(0, 0), | 1867 WebGestureEvent gsu; |
| 1869 IntPoint(0, 0), IntSize(5, 5), TimeTicks(), | 1868 gsu.setFrameScale(1); |
| 1870 PlatformEvent::NoModifiers, | 1869 gsu.type = WebInputEvent::GestureScrollUpdate; |
| 1871 PlatformGestureSourceTouchpad); | 1870 gsu.sourceDevice = WebGestureDeviceTouchpad; |
| 1872 gsu.setScrollGestureData(-50, -60, ScrollByPrecisePixel, 1, 1, | 1871 gsu.data.scrollUpdate.deltaX = -50; |
| 1873 ScrollInertialPhaseUnknown, false, | 1872 gsu.data.scrollUpdate.deltaY = -60; |
| 1874 -1 /* null plugin id */); | 1873 gsu.data.scrollUpdate.deltaUnits = WebGestureEvent::PrecisePixels; |
| 1874 gsu.data.scrollUpdate.velocityX = 1; |
| 1875 gsu.data.scrollUpdate.velocityY = 1; |
| 1875 | 1876 |
| 1876 frame()->eventHandler().handleGestureEvent(gsu); | 1877 frame()->eventHandler().handleGestureEvent(gsu); |
| 1877 | 1878 |
| 1878 // The scroll sent from the impl-side must not be overwritten. | 1879 // The scroll sent from the impl-side must not be overwritten. |
| 1879 EXPECT_SIZE_EQ(FloatSize(350, 260), visualViewport.getScrollOffset()); | 1880 EXPECT_SIZE_EQ(FloatSize(350, 260), visualViewport.getScrollOffset()); |
| 1880 } | 1881 } |
| 1881 | 1882 |
| 1882 static void accessibilitySettings(WebSettings* settings) { | 1883 static void accessibilitySettings(WebSettings* settings) { |
| 1883 VisualViewportTest::configureSettings(settings); | 1884 VisualViewportTest::configureSettings(settings); |
| 1884 settings->setAccessibilityEnabled(true); | 1885 settings->setAccessibilityEnabled(true); |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2392 if (rootLayerScrolling) | 2393 if (rootLayerScrolling) |
| 2393 EXPECT_TRUE(invalidationTracking); | 2394 EXPECT_TRUE(invalidationTracking); |
| 2394 else | 2395 else |
| 2395 EXPECT_FALSE(invalidationTracking); | 2396 EXPECT_FALSE(invalidationTracking); |
| 2396 | 2397 |
| 2397 document->view()->setTracksPaintInvalidations(false); | 2398 document->view()->setTracksPaintInvalidations(false); |
| 2398 RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); | 2399 RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); |
| 2399 } | 2400 } |
| 2400 | 2401 |
| 2401 } // namespace | 2402 } // namespace |
| OLD | NEW |