summaryrefslogtreecommitdiffstats
path: root/ash/display/event_transformation_handler.cc
diff options
context:
space:
mode:
authorsheckylin@chromium.org <sheckylin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-20 08:58:04 +0000
committersheckylin@chromium.org <sheckylin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-20 08:58:04 +0000
commit36ba1dc0a5134a094c13ab5e28d312628750964a (patch)
treefe0ffe6fec9ba12e800e5c272465d17da0199f1a /ash/display/event_transformation_handler.cc
parent5d03cedb6ace85bf9e227c84e7b40d77d1d39844 (diff)
downloadchromium_src-36ba1dc0a5134a094c13ab5e28d312628750964a.zip
chromium_src-36ba1dc0a5134a094c13ab5e28d312628750964a.tar.gz
chromium_src-36ba1dc0a5134a094c13ab5e28d312628750964a.tar.bz2
Do not scale ScrollEvent by device scale factor
We used to scale scroll events in event_transformation_handler because we want to mimic the behaviour of the CrOS X patch which scales pointer motions w.r.t. the screen resolution. See the patch here https://chromium-review.googlesource.com/#/c/45522/. The idea is actually wrong because Aura Views use DIPs instead of pixels as what X server does. The scaling would make scroll events to have 2x higher speed on Pixel as compared to normal resolution devices. This CL fixes the problem so that scroll events will have identical sensitivity on all devices regardless of the screen resolution. Note that the sensitivity would still be slightly different due to the sllightly different DIP resolution on each device. Contributed by sheckylin@chromium.org BUG=288211 TEST=Tested on Pixel and non-Pixel devices. Make sure: 1. Scrolling on webpages with touchpads goes through roughly the same amount of page if the scrolling distance and speed is the same. 2. 2f back/forward gesture should require roughly equal distance of scrolling on the touchpad at the same speed to trigger. 3. 3f tab-switching should go through roughly the same ratio of tab counts for the equal distance of scrolling on the touchpad at the same speed. Review URL: https://chromiumcodereview.appspot.com/23452037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224341 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/display/event_transformation_handler.cc')
-rw-r--r--ash/display/event_transformation_handler.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/ash/display/event_transformation_handler.cc b/ash/display/event_transformation_handler.cc
index 5f9e450..aaac56c 100644
--- a/ash/display/event_transformation_handler.cc
+++ b/ash/display/event_transformation_handler.cc
@@ -40,20 +40,17 @@ void EventTransformationHandler::OnScrollEvent(ui::ScrollEvent* event) {
if (transformation_mode_ == TRANSFORM_NONE)
return;
- // Get the device scale factor and stack it on the final scale factor.
+ // It is unnecessary to scale the event for the device scale factor since
+ // the event locations etc. are already in DIP.
gfx::Point point_in_screen(event->location());
aura::Window* target = static_cast<aura::Window*>(event->target());
- const float scale_at_target = ui::GetDeviceScaleFactor(target->layer());
- float scale = scale_at_target;
-
- // Apply some additional scaling if the display is non-integrated.
wm::ConvertPointToScreen(target, &point_in_screen);
const gfx::Display& display =
Shell::GetScreen()->GetDisplayNearestPoint(point_in_screen);
- if (!display.IsInternal())
- scale *= kBoostForNonIntegrated;
- event->Scale(scale);
+ // Apply some additional scaling if the display is non-integrated.
+ if (!display.IsInternal())
+ event->Scale(kBoostForNonIntegrated);
}
#if defined(OS_CHROMEOS)