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

Side by Side Diff: content/renderer/input/input_handler_proxy.cc

Issue 131373004: Let the browser know the end of fling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DidStartFlinging(); Don't bother ContentViewGestureHandler and GestureEventFilter # Created 6 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/input/input_handler_proxy.h" 5 #include "content/renderer/input/input_handler_proxy.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "content/renderer/input/input_handler_proxy_client.h" 10 #include "content/renderer/input/input_handler_proxy_client.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 fling_parameters_.delta = 289 fling_parameters_.delta =
290 WebFloatPoint(gesture_event.data.flingStart.velocityX, 290 WebFloatPoint(gesture_event.data.flingStart.velocityX,
291 gesture_event.data.flingStart.velocityY); 291 gesture_event.data.flingStart.velocityY);
292 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); 292 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y);
293 fling_parameters_.globalPoint = 293 fling_parameters_.globalPoint =
294 WebPoint(gesture_event.globalX, gesture_event.globalY); 294 WebPoint(gesture_event.globalX, gesture_event.globalY);
295 fling_parameters_.modifiers = gesture_event.modifiers; 295 fling_parameters_.modifiers = gesture_event.modifiers;
296 fling_parameters_.sourceDevice = gesture_event.sourceDevice; 296 fling_parameters_.sourceDevice = gesture_event.sourceDevice;
297 input_handler_->ScheduleAnimation(); 297 input_handler_->ScheduleAnimation();
298 client_->DidStartFlinging();
298 return DID_HANDLE; 299 return DID_HANDLE;
299 } 300 }
300 case cc::InputHandler::ScrollOnMainThread: { 301 case cc::InputHandler::ScrollOnMainThread: {
301 TRACE_EVENT_INSTANT0("renderer", 302 TRACE_EVENT_INSTANT0("renderer",
302 "InputHandlerProxy::HandleGestureFling::" 303 "InputHandlerProxy::HandleGestureFling::"
303 "scroll_on_main_thread", 304 "scroll_on_main_thread",
304 TRACE_EVENT_SCOPE_THREAD); 305 TRACE_EVENT_SCOPE_THREAD);
305 fling_may_be_active_on_main_thread_ = true; 306 fling_may_be_active_on_main_thread_ = true;
307 client_->DidStartFlinging();
jdduke (slow) 2014/01/10 17:45:59 So, if the fling goes unhandled by main, the |DidS
306 return DID_NOT_HANDLE; 308 return DID_NOT_HANDLE;
307 } 309 }
308 case cc::InputHandler::ScrollIgnored: { 310 case cc::InputHandler::ScrollIgnored: {
309 TRACE_EVENT_INSTANT0( 311 TRACE_EVENT_INSTANT0(
310 "renderer", 312 "renderer",
311 "InputHandlerProxy::HandleGestureFling::ignored", 313 "InputHandlerProxy::HandleGestureFling::ignored",
312 TRACE_EVENT_SCOPE_THREAD); 314 TRACE_EVENT_SCOPE_THREAD);
313 if (gesture_event.sourceDevice == WebGestureEvent::Touchpad) { 315 if (gesture_event.sourceDevice == WebGestureEvent::Touchpad) {
314 // We still pass the curve to the main thread if there's nothing 316 // We still pass the curve to the main thread if there's nothing
315 // scrollable, in case something 317 // scrollable, in case something
(...skipping 29 matching lines...) Expand all
345 } else { 347 } else {
346 TRACE_EVENT_INSTANT0("renderer", 348 TRACE_EVENT_INSTANT0("renderer",
347 "InputHandlerProxy::animate::flingOver", 349 "InputHandlerProxy::animate::flingOver",
348 TRACE_EVENT_SCOPE_THREAD); 350 TRACE_EVENT_SCOPE_THREAD);
349 CancelCurrentFling(); 351 CancelCurrentFling();
350 } 352 }
351 } 353 }
352 354
353 void InputHandlerProxy::MainThreadHasStoppedFlinging() { 355 void InputHandlerProxy::MainThreadHasStoppedFlinging() {
354 fling_may_be_active_on_main_thread_ = false; 356 fling_may_be_active_on_main_thread_ = false;
357 client_->DidStopFlinging();
355 } 358 }
356 359
357 void InputHandlerProxy::DidOverscroll(const cc::DidOverscrollParams& params) { 360 void InputHandlerProxy::DidOverscroll(const cc::DidOverscrollParams& params) {
358 DCHECK(client_); 361 DCHECK(client_);
359 if (fling_curve_) { 362 if (fling_curve_) {
360 static const int kFlingOverscrollThreshold = 1; 363 static const int kFlingOverscrollThreshold = 1;
361 disallow_horizontal_fling_scroll_ |= 364 disallow_horizontal_fling_scroll_ |=
362 std::abs(params.accumulated_overscroll.x()) >= 365 std::abs(params.accumulated_overscroll.x()) >=
363 kFlingOverscrollThreshold; 366 kFlingOverscrollThreshold;
364 disallow_vertical_fling_scroll_ |= 367 disallow_vertical_fling_scroll_ |=
(...skipping 16 matching lines...) Expand all
381 } 384 }
382 385
383 TRACE_EVENT_INSTANT1("renderer", 386 TRACE_EVENT_INSTANT1("renderer",
384 "InputHandlerProxy::CancelCurrentFling", 387 "InputHandlerProxy::CancelCurrentFling",
385 TRACE_EVENT_SCOPE_THREAD, 388 TRACE_EVENT_SCOPE_THREAD,
386 "had_fling_animation", 389 "had_fling_animation",
387 had_fling_animation); 390 had_fling_animation);
388 fling_curve_.reset(); 391 fling_curve_.reset();
389 gesture_scroll_on_impl_thread_ = false; 392 gesture_scroll_on_impl_thread_ = false;
390 fling_parameters_ = blink::WebActiveWheelFlingParameters(); 393 fling_parameters_ = blink::WebActiveWheelFlingParameters();
394 if (had_fling_animation)
395 client_->DidStopFlinging();
391 return had_fling_animation; 396 return had_fling_animation;
392 } 397 }
393 398
394 bool InputHandlerProxy::TouchpadFlingScroll( 399 bool InputHandlerProxy::TouchpadFlingScroll(
395 const WebFloatSize& increment) { 400 const WebFloatSize& increment) {
396 WebMouseWheelEvent synthetic_wheel; 401 WebMouseWheelEvent synthetic_wheel;
397 synthetic_wheel.type = WebInputEvent::MouseWheel; 402 synthetic_wheel.type = WebInputEvent::MouseWheel;
398 synthetic_wheel.deltaX = increment.width; 403 synthetic_wheel.deltaX = increment.width;
399 synthetic_wheel.deltaY = increment.height; 404 synthetic_wheel.deltaY = increment.height;
400 synthetic_wheel.hasPreciseScrollingDeltas = true; 405 synthetic_wheel.hasPreciseScrollingDeltas = true;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 TRACE_EVENT2("renderer", 480 TRACE_EVENT2("renderer",
476 "InputHandlerProxy::notifyCurrentFlingVelocity", 481 "InputHandlerProxy::notifyCurrentFlingVelocity",
477 "vx", 482 "vx",
478 velocity.width, 483 velocity.width,
479 "vy", 484 "vy",
480 velocity.height); 485 velocity.height);
481 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity)); 486 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity));
482 } 487 }
483 488
484 } // namespace content 489 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698