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

Unified Diff: content/child/fling_animator_impl_android.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
Index: content/child/fling_animator_impl_android.cc
diff --git a/content/child/fling_animator_impl_android.cc b/content/child/fling_animator_impl_android.cc
index 235f920b48f1cecf757c86ed5c79dd75956deb61..e2921445defe6ff1414fed39a5483e554091a0c6 100644
--- a/content/child/fling_animator_impl_android.cc
+++ b/content/child/fling_animator_impl_android.cc
@@ -4,6 +4,7 @@
#include "content/child/fling_animator_impl_android.h"
+#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "third_party/WebKit/public/platform/WebFloatSize.h"
#include "third_party/WebKit/public/platform/WebGestureCurveTarget.h"
@@ -15,6 +16,8 @@ namespace content {
namespace {
+const char* kCurveName = "FlingAnimatorImpl";
jochen (gone - plz use gerrit) 2014/03/31 09:59:10 why do you declare a variable for this but none of
jdduke (slow) 2014/03/31 15:41:43 I added the trace to mimic what was done in touch_
+
gfx::Scroller::Config GetScrollerConfig() {
gfx::Scroller::Config config;
config.flywheel_enabled = false;
@@ -26,9 +29,14 @@ gfx::Scroller::Config GetScrollerConfig() {
FlingAnimatorImpl::FlingAnimatorImpl()
: is_active_(false),
- scroller_(GetScrollerConfig()) {}
+ scroller_(GetScrollerConfig()) {
+ TRACE_EVENT_ASYNC_BEGIN1(
+ "input", "GestureAnimation", this, "curve", kCurveName);
+}
-FlingAnimatorImpl::~FlingAnimatorImpl() {}
+FlingAnimatorImpl::~FlingAnimatorImpl() {
+ TRACE_EVENT_ASYNC_END0("input", "GestureAnimation", this);
+}
void FlingAnimatorImpl::StartFling(const gfx::PointF& velocity) {
// No bounds on the fling. See http://webkit.org/b/96403
@@ -72,17 +80,15 @@ bool FlingAnimatorImpl::apply(double /* time */,
return false;
}
- target->notifyCurrentFlingVelocity(blink::WebFloatSize(
- scroller_.GetCurrVelocityX(), scroller_.GetCurrVelocityY()));
-
gfx::PointF current_position(scroller_.GetCurrX(), scroller_.GetCurrY());
gfx::Vector2dF scroll_amount(current_position - last_position_);
last_position_ = current_position;
// scrollBy() could delete this curve if the animation is over, so don't touch
// any member variables after making that call.
- target->scrollBy(blink::WebFloatSize(scroll_amount));
- return true;
+ return target->scrollBy(blink::WebFloatSize(scroll_amount),
+ blink::WebFloatSize(scroller_.GetCurrVelocityX(),
+ scroller_.GetCurrVelocityY()));
}
FlingAnimatorImpl* FlingAnimatorImpl::CreateAndroidGestureCurve(
« no previous file with comments | « content/browser/android/in_process/synchronous_input_event_filter.cc ('k') | content/child/touch_fling_gesture_curve.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698