OLD | NEW |
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/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 #endif | 375 #endif |
376 | 376 |
377 switch (scroll_status) { | 377 switch (scroll_status) { |
378 case cc::InputHandler::ScrollStarted: { | 378 case cc::InputHandler::ScrollStarted: { |
379 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad) | 379 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad) |
380 input_handler_->ScrollEnd(); | 380 input_handler_->ScrollEnd(); |
381 | 381 |
382 const float vx = gesture_event.data.flingStart.velocityX; | 382 const float vx = gesture_event.data.flingStart.velocityX; |
383 const float vy = gesture_event.data.flingStart.velocityY; | 383 const float vy = gesture_event.data.flingStart.velocityY; |
384 current_fling_velocity_ = gfx::Vector2dF(vx, vy); | 384 current_fling_velocity_ = gfx::Vector2dF(vx, vy); |
385 // TODO(rjkroege): Remove cast after landing 3rd patch for | |
386 // http://crbug.com/343327 | |
387 fling_curve_.reset(client_->CreateFlingAnimationCurve( | 385 fling_curve_.reset(client_->CreateFlingAnimationCurve( |
388 (blink::WebGestureDevice)gesture_event.sourceDevice, | 386 gesture_event.sourceDevice, |
389 WebFloatPoint(vx, vy), | 387 WebFloatPoint(vx, vy), |
390 blink::WebSize())); | 388 blink::WebSize())); |
391 disallow_horizontal_fling_scroll_ = !vx; | 389 disallow_horizontal_fling_scroll_ = !vx; |
392 disallow_vertical_fling_scroll_ = !vy; | 390 disallow_vertical_fling_scroll_ = !vy; |
393 TRACE_EVENT_ASYNC_BEGIN2("input", | 391 TRACE_EVENT_ASYNC_BEGIN2("input", |
394 "InputHandlerProxy::HandleGestureFling::started", | 392 "InputHandlerProxy::HandleGestureFling::started", |
395 this, | 393 this, |
396 "vx", | 394 "vx", |
397 vx, | 395 vx, |
398 "vy", | 396 "vy", |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 | 523 |
526 if (fling_boosted) | 524 if (fling_boosted) |
527 current_fling_velocity_ += new_fling_velocity; | 525 current_fling_velocity_ += new_fling_velocity; |
528 else | 526 else |
529 current_fling_velocity_ = new_fling_velocity; | 527 current_fling_velocity_ = new_fling_velocity; |
530 | 528 |
531 WebFloatPoint velocity(current_fling_velocity_.x(), | 529 WebFloatPoint velocity(current_fling_velocity_.x(), |
532 current_fling_velocity_.y()); | 530 current_fling_velocity_.y()); |
533 deferred_fling_cancel_time_seconds_ = 0; | 531 deferred_fling_cancel_time_seconds_ = 0; |
534 last_fling_boost_event_ = WebGestureEvent(); | 532 last_fling_boost_event_ = WebGestureEvent(); |
535 // TODO(rjkroege): Remove cast after 3rd patch of http://crbug.com/343327 | |
536 fling_curve_.reset(client_->CreateFlingAnimationCurve( | 533 fling_curve_.reset(client_->CreateFlingAnimationCurve( |
537 (blink::WebGestureDevice)gesture_event.sourceDevice, | 534 gesture_event.sourceDevice, |
538 velocity, | 535 velocity, |
539 blink::WebSize())); | 536 blink::WebSize())); |
540 fling_parameters_.startTime = gesture_event.timeStampSeconds; | 537 fling_parameters_.startTime = gesture_event.timeStampSeconds; |
541 fling_parameters_.delta = velocity; | 538 fling_parameters_.delta = velocity; |
542 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); | 539 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); |
543 fling_parameters_.globalPoint = | 540 fling_parameters_.globalPoint = |
544 WebPoint(gesture_event.globalX, gesture_event.globalY); | 541 WebPoint(gesture_event.globalX, gesture_event.globalY); |
545 | 542 |
546 TRACE_EVENT_INSTANT2("input", | 543 TRACE_EVENT_INSTANT2("input", |
547 fling_boosted ? "InputHandlerProxy::FlingBoosted" | 544 fling_boosted ? "InputHandlerProxy::FlingBoosted" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 // trigger a scroll, e.g., with a trivial time delta between fling updates. | 785 // trigger a scroll, e.g., with a trivial time delta between fling updates. |
789 // Return true in this case to prevent early fling termination. | 786 // Return true in this case to prevent early fling termination. |
790 if (std::abs(clipped_increment.width) < kScrollEpsilon && | 787 if (std::abs(clipped_increment.width) < kScrollEpsilon && |
791 std::abs(clipped_increment.height) < kScrollEpsilon) | 788 std::abs(clipped_increment.height) < kScrollEpsilon) |
792 return true; | 789 return true; |
793 | 790 |
794 return did_scroll; | 791 return did_scroll; |
795 } | 792 } |
796 | 793 |
797 } // namespace content | 794 } // namespace content |
OLD | NEW |