Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: third_party/WebKit/Source/web/tests/VisualViewportTest.cpp

Issue 2539283002: Remove PlatformGestureEvent in favour of using WebGestureEvent (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 VisualViewport& visualViewport = 1851 VisualViewport& visualViewport =
1853 frame()->page()->frameHost().visualViewport(); 1852 frame()->page()->frameHost().visualViewport();
1854 1853
1855 // Apply some scroll and scale from the impl-side. 1854 // Apply some scroll and scale from the impl-side.
1856 webViewImpl()->applyViewportDeltas(WebFloatSize(300, 200), WebFloatSize(0, 0), 1855 webViewImpl()->applyViewportDeltas(WebFloatSize(300, 200), WebFloatSize(0, 0),
1857 WebFloatSize(0, 0), 2, 0); 1856 WebFloatSize(0, 0), 2, 0);
1858 1857
1859 EXPECT_SIZE_EQ(FloatSize(300, 200), visualViewport.scrollOffset()); 1858 EXPECT_SIZE_EQ(FloatSize(300, 200), visualViewport.scrollOffset());
1860 1859
1861 // Send a scroll event on the main thread path. 1860 // Send a scroll event on the main thread path.
1862 PlatformGestureEvent gsu(PlatformEvent::GestureScrollUpdate, IntPoint(0, 0), 1861 WebGestureEvent gsu;
1863 IntPoint(0, 0), IntSize(5, 5), 0, 1862 gsu.type = WebInputEvent::GestureScrollUpdate;
1864 PlatformEvent::NoModifiers, 1863 gsu.sourceDevice = WebGestureDeviceTouchpad;
1865 PlatformGestureSourceTouchpad); 1864 gsu.data.scrollUpdate.deltaX = -50;
1866 gsu.setScrollGestureData(-50, -60, ScrollByPrecisePixel, 1, 1, 1865 gsu.data.scrollUpdate.deltaY = -60;
1867 ScrollInertialPhaseUnknown, false, 1866 gsu.data.scrollUpdate.deltaUnits = WebGestureEvent::PrecisePixels;
1868 -1 /* null plugin id */); 1867 gsu.data.scrollUpdate.velocityX = 1;
1868 gsu.data.scrollUpdate.velocityY = 1;
1869 1869
1870 frame()->eventHandler().handleGestureEvent(gsu); 1870 frame()->eventHandler().handleGestureEvent(gsu);
1871 1871
1872 // The scroll sent from the impl-side must not be overwritten. 1872 // The scroll sent from the impl-side must not be overwritten.
1873 EXPECT_SIZE_EQ(FloatSize(350, 260), visualViewport.scrollOffset()); 1873 EXPECT_SIZE_EQ(FloatSize(350, 260), visualViewport.scrollOffset());
1874 } 1874 }
1875 1875
1876 static void accessibilitySettings(WebSettings* settings) { 1876 static void accessibilitySettings(WebSettings* settings) {
1877 VisualViewportTest::configureSettings(settings); 1877 VisualViewportTest::configureSettings(settings);
1878 settings->setAccessibilityEnabled(true); 1878 settings->setAccessibilityEnabled(true);
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
2386 if (rootLayerScrolling) 2386 if (rootLayerScrolling)
2387 EXPECT_TRUE(invalidationTracking); 2387 EXPECT_TRUE(invalidationTracking);
2388 else 2388 else
2389 EXPECT_FALSE(invalidationTracking); 2389 EXPECT_FALSE(invalidationTracking);
2390 2390
2391 document->view()->setTracksPaintInvalidations(false); 2391 document->view()->setTracksPaintInvalidations(false);
2392 RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls); 2392 RuntimeEnabledFeatures::setInertTopControlsEnabled(originalInertTopControls);
2393 } 2393 }
2394 2394
2395 } // namespace 2395 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698