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

Unified Diff: webkit/child/fling_animator_impl_android.cc

Issue 170993003: [Android] Use DIP coordinates for GestureFlingStart events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undo unnecessary changes Created 6 years, 10 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/browser/android/content_view_core_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/child/fling_animator_impl_android.cc
diff --git a/webkit/child/fling_animator_impl_android.cc b/webkit/child/fling_animator_impl_android.cc
index 668076ba235cfa9decadaa14c13743552ecfba42..4abee7d862799a786caaeaccb7f8216b9da8daec 100644
--- a/webkit/child/fling_animator_impl_android.cc
+++ b/webkit/child/fling_animator_impl_android.cc
@@ -53,10 +53,14 @@ void FlingAnimatorImpl::StartFling(const gfx::PointF& velocity)
JNIEnv* env = base::android::AttachCurrentThread();
+ // The OverScroller deceleration constants work in pixel space. DIP scaling
+ // will be performed in |apply()| on the generated fling updates.
+ float dpi_scale = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay()
+ .device_scale_factor();
JNI_OverScroller::Java_OverScroller_flingV_I_I_I_I_I_I_I_I(
env, java_scroller_.obj(), 0, 0,
- static_cast<int>(velocity.x()),
- static_cast<int>(velocity.y()),
+ static_cast<int>(velocity.x() * dpi_scale),
+ static_cast<int>(velocity.y() * dpi_scale),
INT_MIN, INT_MAX, INT_MIN, INT_MAX);
}
@@ -108,7 +112,7 @@ bool FlingAnimatorImpl::apply(double time,
float dpi_scale = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay()
.device_scale_factor();
blink::WebFloatSize scroll_amount(diff.x() / dpi_scale,
- diff.y() / dpi_scale);
+ diff.y() / dpi_scale);
float delta_time = time - last_time_;
last_time_ = time;
@@ -128,7 +132,7 @@ bool FlingAnimatorImpl::apply(double time,
}
last_velocity_ = current_velocity;
blink::WebFloatSize fling_velocity(current_velocity.x() / dpi_scale,
- current_velocity.y() / dpi_scale);
+ current_velocity.y() / dpi_scale);
target->notifyCurrentFlingVelocity(fling_velocity);
// scrollBy() could delete this curve if the animation is over, so don't touch
« no previous file with comments | « content/browser/android/content_view_core_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698