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

Unified Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 1403893003: Plumb gesture source value through Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Convert more tests (related to CL) to use Touchscreen. Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/Source/web/tests/ImeOnFocusTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebViewImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 8328ce8ad9257b9f60ec1e8f838dd46f9cc16cad..6d7c4079a48308167a1247a3f7bd194470dc3ab3 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -437,7 +437,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_matchesHeuristicsForGpuRasterization(false)
, m_recreatingGraphicsContext(false)
, m_flingModifier(0)
- , m_flingSourceDevice(false)
+ , m_flingSourceDevice(WebGestureDeviceUninitialized)
, m_fullscreenController(FullscreenController::create(this))
, m_showFPSCounter(false)
, m_baseBackgroundColor(Color::white)
@@ -644,6 +644,7 @@ bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve
bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& velocity)
{
+ ASSERT(m_flingSourceDevice != WebGestureDeviceUninitialized);
if (m_flingSourceDevice == WebGestureDeviceTouchpad) {
WebMouseWheelEvent syntheticWheel;
const float tickDivisor = WheelEvent::TickMultiplier;
@@ -703,6 +704,7 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event)
m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY);
m_flingModifier = event.modifiers;
m_flingSourceDevice = event.sourceDevice;
+ ASSERT(m_flingSourceDevice != WebGestureDeviceUninitialized);
OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->createFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.velocityX, event.data.flingStart.velocityY), WebSize()));
ASSERT(flingCurve);
m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(flingCurve.release(), this);
@@ -915,6 +917,8 @@ void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar
OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAnimationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters.cumulativeScroll));
ASSERT(curve);
m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset(curve.release(), this, parameters.startTime);
+ ASSERT(parameters.sourceDevice != WebGestureDeviceUninitialized);
+ m_flingSourceDevice = parameters.sourceDevice;
scheduleAnimation();
}
@@ -922,6 +926,7 @@ bool WebViewImpl::endActiveFlingAnimation()
{
if (m_gestureAnimation) {
m_gestureAnimation.clear();
+ m_flingSourceDevice = WebGestureDeviceUninitialized;
if (m_layerTreeView)
m_layerTreeView->didStopFlinging();
return true;
@@ -1878,11 +1883,13 @@ void WebViewImpl::beginFrame(double lastFrameTimeMonotonic)
if (m_gestureAnimation->animate(lastFrameTimeMonotonic))
scheduleAnimation();
else {
+ ASSERT(m_flingSourceDevice != WebGestureDeviceUninitialized);
+ WebGestureDevice lastFlingSourceDevice = m_flingSourceDevice;
endActiveFlingAnimation();
PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd,
m_positionOnFlingStart, m_globalPositionOnFlingStart,
- IntSize(), 0, PlatformEvent::NoModifiers);
+ IntSize(), 0, PlatformEvent::NoModifiers, lastFlingSourceDevice == WebGestureDeviceTouchpad ? PlatformGestureSourceTouchpad : PlatformGestureSourceTouchscreen);
endScrollEvent.setScrollGestureData(0, 0, 0, 0, true, false, -1 /* null plugin id */);
mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endScrollEvent);
@@ -4085,6 +4092,8 @@ WebHitTestResult WebViewImpl::hitTestResultForTap(const WebPoint& tapPointWindow
tapEvent.x = tapPointWindowPos.x;
tapEvent.y = tapPointWindowPos.y;
tapEvent.type = WebInputEvent::GestureTap;
+ // GestureTap is only ever from a touchscreen.
+ tapEvent.sourceDevice = WebGestureDeviceTouchscreen;
tapEvent.data.tap.tapCount = 1;
tapEvent.data.tap.width = tapArea.width;
tapEvent.data.tap.height = tapArea.height;
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/Source/web/tests/ImeOnFocusTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698