summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authoraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-19 20:55:50 +0000
committeraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-19 20:55:50 +0000
commit01ae53417b7c0a698e48861f251167f0b6b4c872 (patch)
tree189f273ada75a1be63618971d95ec2225518fba9 /webkit
parente41a07e08dda7eace29c62bf7db40286b1e4c1d4 (diff)
downloadchromium_src-01ae53417b7c0a698e48861f251167f0b6b4c872.zip
chromium_src-01ae53417b7c0a698e48861f251167f0b6b4c872.tar.gz
chromium_src-01ae53417b7c0a698e48861f251167f0b6b4c872.tar.bz2
Fix Android fling curve deceleration.
Because Android OverScroller fling deceleration is a constant, dividing the velocity by DPI-scale doubled the rate of deceleration. Instead, leave velocity as-is and divide the output scrolls by DPI-scale. NOTRY=true TBR=sievers@chromium.org BUG=176869 Review URL: https://chromiumcodereview.appspot.com/12303014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183285 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/fling_animator_impl_android.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/webkit/glue/fling_animator_impl_android.cc b/webkit/glue/fling_animator_impl_android.cc
index bac4e91..db5fb51 100644
--- a/webkit/glue/fling_animator_impl_android.cc
+++ b/webkit/glue/fling_animator_impl_android.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGestureCurveTarget.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h"
+#include "ui/gfx/screen.h"
#include "ui/gfx/vector2d.h"
using base::android::AttachCurrentThread;
@@ -108,7 +109,9 @@ bool FlingAnimatorImpl::apply(double time,
gfx::Point current_position = GetCurrentPosition();
gfx::Vector2d diff(current_position - last_position_);
last_position_ = current_position;
- WebKit::WebPoint scroll_amount(diff.x(), diff.y());
+ float dpi_scale = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay()
+ .device_scale_factor();
+ WebKit::WebPoint scroll_amount(diff.x() / dpi_scale, diff.y() / dpi_scale);
// scrollBy() could delete this curve if the animation is over, so don't touch
// any member variables after making that call.
target->scrollBy(scroll_amount);