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

Unified Diff: content/renderer/input/input_handler_proxy.cc

Issue 136173004: Early terminate flings when scrolling impossible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 9 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 | « content/renderer/input/input_handler_proxy.h ('k') | content/renderer/input/input_handler_proxy_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/input/input_handler_proxy.cc
diff --git a/content/renderer/input/input_handler_proxy.cc b/content/renderer/input/input_handler_proxy.cc
index 0b234ade40793f06fdf4bc9bbfcc0eb212025f7c..2793576bd3989fda204ba550ad3a516539bd8691 100644
--- a/content/renderer/input/input_handler_proxy.cc
+++ b/content/renderer/input/input_handler_proxy.cc
@@ -4,9 +4,11 @@
#include "content/renderer/input/input_handler_proxy.h"
+#include "base/auto_reset.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
+#include "content/common/input/did_overscroll_params.h"
#include "content/common/input/web_input_event_traits.h"
#include "content/renderer/input/input_handler_proxy_client.h"
#include "third_party/WebKit/public/platform/Platform.h"
@@ -375,8 +377,16 @@ void InputHandlerProxy::MainThreadHasStoppedFlinging() {
client_->DidStopFlinging();
}
-void InputHandlerProxy::DidOverscroll(const cc::DidOverscrollParams& params) {
+void InputHandlerProxy::DidOverscroll(
+ const gfx::Vector2dF& accumulated_overscroll,
+ const gfx::Vector2dF& latest_overscroll_delta) {
DCHECK(client_);
+
+ DidOverscrollParams params;
+ params.accumulated_overscroll = accumulated_overscroll;
+ params.latest_overscroll_delta = latest_overscroll_delta;
+ params.current_fling_velocity = current_fling_velocity_;
+
if (fling_curve_) {
static const int kFlingOverscrollThreshold = 1;
disallow_horizontal_fling_scroll_ |=
@@ -409,6 +419,7 @@ bool InputHandlerProxy::CancelCurrentFling(
had_fling_animation);
fling_curve_.reset();
gesture_scroll_on_impl_thread_ = false;
+ current_fling_velocity_ = gfx::Vector2dF();
fling_parameters_ = blink::WebActiveWheelFlingParameters();
if (send_fling_stopped_notification && had_fling_animation)
client_->DidStopFlinging();
@@ -458,15 +469,22 @@ static gfx::Vector2dF ToClientScrollIncrement(const WebFloatSize& increment) {
return gfx::Vector2dF(-increment.width, -increment.height);
}
-void InputHandlerProxy::scrollBy(const WebFloatSize& increment) {
+bool InputHandlerProxy::scrollBy(const WebFloatSize& increment,
+ const WebFloatSize& velocity) {
WebFloatSize clipped_increment;
- if (!disallow_horizontal_fling_scroll_)
+ WebFloatSize clipped_velocity;
+ if (!disallow_horizontal_fling_scroll_) {
clipped_increment.width = increment.width;
- if (!disallow_vertical_fling_scroll_)
+ clipped_velocity.width = velocity.width;
+ }
+ if (!disallow_vertical_fling_scroll_) {
clipped_increment.height = increment.height;
+ clipped_velocity.height = velocity.height;
+ }
+ current_fling_velocity_ = clipped_velocity;
if (clipped_increment == WebFloatSize())
- return;
+ return false;
TRACE_EVENT2("input",
"InputHandlerProxy::scrollBy",
@@ -483,6 +501,7 @@ void InputHandlerProxy::scrollBy(const WebFloatSize& increment) {
break;
case WebGestureEvent::Touchscreen:
clipped_increment = ToClientScrollIncrement(clipped_increment);
+ clipped_velocity = ToClientScrollIncrement(clipped_velocity);
did_scroll = input_handler_->ScrollBy(fling_parameters_.point,
clipped_increment);
break;
@@ -492,17 +511,8 @@ void InputHandlerProxy::scrollBy(const WebFloatSize& increment) {
fling_parameters_.cumulativeScroll.width += clipped_increment.width;
fling_parameters_.cumulativeScroll.height += clipped_increment.height;
}
-}
-void InputHandlerProxy::notifyCurrentFlingVelocity(
- const WebFloatSize& velocity) {
- TRACE_EVENT2("input",
- "InputHandlerProxy::notifyCurrentFlingVelocity",
- "vx",
- velocity.width,
- "vy",
- velocity.height);
- input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity));
+ return did_scroll;
}
} // namespace content
« no previous file with comments | « content/renderer/input/input_handler_proxy.h ('k') | content/renderer/input/input_handler_proxy_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698