Chromium Code Reviews

Side by Side Diff: content/child/fling_animator_impl_android.cc

Issue 213743004: Revert of Early terminate flings when scrolling impossible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/child/fling_animator_impl_android.h" 5 #include "content/child/fling_animator_impl_android.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/WebKit/public/platform/WebFloatSize.h" 8 #include "third_party/WebKit/public/platform/WebFloatSize.h"
9 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" 9 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h"
10 #include "ui/gfx/android/view_configuration.h" 10 #include "ui/gfx/android/view_configuration.h"
(...skipping 54 matching lines...)
65 blink::WebGestureCurveTarget* target) { 65 blink::WebGestureCurveTarget* target) {
66 // Historically, Android's Scroller used |currentAnimationTimeMillis()|, 66 // Historically, Android's Scroller used |currentAnimationTimeMillis()|,
67 // which is equivalent to gfx::FrameTime::Now(). In practice, this produces 67 // which is equivalent to gfx::FrameTime::Now(). In practice, this produces
68 // smoother results than using |time|, so continue using FrameTime::Now(). 68 // smoother results than using |time|, so continue using FrameTime::Now().
69 // TODO(jdduke): Use |time| upon resolution of crbug.com/345459. 69 // TODO(jdduke): Use |time| upon resolution of crbug.com/345459.
70 if (!scroller_.ComputeScrollOffset(gfx::FrameTime::Now())) { 70 if (!scroller_.ComputeScrollOffset(gfx::FrameTime::Now())) {
71 is_active_ = false; 71 is_active_ = false;
72 return false; 72 return false;
73 } 73 }
74 74
75 target->notifyCurrentFlingVelocity(blink::WebFloatSize(
76 scroller_.GetCurrVelocityX(), scroller_.GetCurrVelocityY()));
77
75 gfx::PointF current_position(scroller_.GetCurrX(), scroller_.GetCurrY()); 78 gfx::PointF current_position(scroller_.GetCurrX(), scroller_.GetCurrY());
76 gfx::Vector2dF scroll_amount(current_position - last_position_); 79 gfx::Vector2dF scroll_amount(current_position - last_position_);
77 last_position_ = current_position; 80 last_position_ = current_position;
78 81
79 // scrollBy() could delete this curve if the animation is over, so don't touch 82 // scrollBy() could delete this curve if the animation is over, so don't touch
80 // any member variables after making that call. 83 // any member variables after making that call.
81 return target->scrollBy(blink::WebFloatSize(scroll_amount), 84 target->scrollBy(blink::WebFloatSize(scroll_amount));
82 blink::WebFloatSize(scroller_.GetCurrVelocityX(), 85 return true;
83 scroller_.GetCurrVelocityY()));
84 } 86 }
85 87
86 FlingAnimatorImpl* FlingAnimatorImpl::CreateAndroidGestureCurve( 88 FlingAnimatorImpl* FlingAnimatorImpl::CreateAndroidGestureCurve(
87 const blink::WebFloatPoint& velocity, 89 const blink::WebFloatPoint& velocity,
88 const blink::WebSize&) { 90 const blink::WebSize&) {
89 FlingAnimatorImpl* gesture_curve = new FlingAnimatorImpl(); 91 FlingAnimatorImpl* gesture_curve = new FlingAnimatorImpl();
90 gesture_curve->StartFling(velocity); 92 gesture_curve->StartFling(velocity);
91 return gesture_curve; 93 return gesture_curve;
92 } 94 }
93 95
94 } // namespace content 96 } // namespace content
OLDNEW
« 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