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

Unified Diff: ash/display/event_transformation_handler.cc

Issue 23452037: Do not scale ScrollEvent by device scale factor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/event_transformation_handler.cc
diff --git a/ash/display/event_transformation_handler.cc b/ash/display/event_transformation_handler.cc
index cb33891edf6bbd8261898723976780e840903dce..8f91da3dda08212ae8920634c0ccf83bf2759a95 100644
--- a/ash/display/event_transformation_handler.cc
+++ b/ash/display/event_transformation_handler.cc
@@ -40,11 +40,28 @@ 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.
+ // The original purpose of this function is to scale scroll events
+ // w.r.t. the screen resolution and physical size as what we do for
+ // pointer motions in the CrOS X server patch (i.e. linear scaling
+ // w.r.t. the device scale factor and 20% more for non-integrated
+ // display). However, Aura scroll events differs from X's pointer
+ // motions in an important way where the consumers of scroll events
+ // assume the use of DIP instead of real pixels. Scaling them by the
+ // device scale factor would result in over-scaling and make high
+ // resolution device (e.g. Pixel) to have faster scrolling speed than
+ // normal ones.
+ //
+ // Our solution here is to NOT scale events by the device scale factor
+ // and instead let the scroll event to enjoy the "implicit" scaling
+ // due to the use of DIP (e.g. treating the scroll values as DIPs
+ // implies an implicit scaling factor of 2 in terms of physical
+ // distance on the Pixel screen). All the Views that consume these
+ // events would also behave identically both on Pixel and non-Pixel
+ // devices as they take the values as DIPs (e.g. 2f back/forward
+ // gesture and 3f tab switching would have equal sensitivity).
sadrul 2013/09/18 15:36:41 Does 'It is not necessary to scale the event for t
oshima 2013/09/18 16:26:10 Agreed.
Shecky Lin 2013/09/20 04:44:10 Done.
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;
+ float scale = 1.0;
// Apply some additional scaling if the display is non-integrated.
wm::ConvertPointToScreen(target, &point_in_screen);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698