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

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: Address comments: never use uninitialized, track fling source device. 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
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 27b2257ce476d635243430b6c24a9933cf7077e6..71ded6d99fd611eefd2e2df4b744990ddd37115b 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)
@@ -642,6 +642,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;
@@ -913,6 +914,7 @@ 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);
+ m_flingSourceDevice = parameters.sourceDevice;
scheduleAnimation();
}
@@ -920,6 +922,7 @@ bool WebViewImpl::endActiveFlingAnimation()
{
if (m_gestureAnimation) {
m_gestureAnimation.clear();
+ m_flingSourceDevice = WebGestureDeviceUninitialized;
if (m_layerTreeView)
m_layerTreeView->didStopFlinging();
return true;
@@ -1872,9 +1875,10 @@ void WebViewImpl::beginFrame(const WebBeginFrameArgs& frameTime)
else {
endActiveFlingAnimation();
+ ASSERT(m_flingSourceDevice != WebGestureDeviceUninitialized);
PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd,
m_positionOnFlingStart, m_globalPositionOnFlingStart,
- IntSize(), 0, PlatformEvent::NoModifiers);
+ IntSize(), 0, PlatformEvent::NoModifiers, m_flingSourceDevice == WebGestureDeviceTouchpad ? PlatformGestureSourceTouchpad : PlatformGestureSourceTouchscreen);
endScrollEvent.setScrollGestureData(0, 0, 0, 0, true, false, -1 /* null plugin id */);
mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endScrollEvent);

Powered by Google App Engine
This is Rietveld 408576698