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

Unified Diff: webkit/glue/webinputevent_mac.mm

Issue 42561: Support 2d trackpad and mighty mouse scrolling on OS X. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 9 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: webkit/glue/webinputevent_mac.mm
===================================================================
--- webkit/glue/webinputevent_mac.mm (revision 12279)
+++ webkit/glue/webinputevent_mac.mm (working copy)
@@ -135,22 +135,16 @@
y = [view frame].size.height - location.y; // flip y
// Convert wheel delta amount to a number of pixels to scroll.
+ // Cocoa sets deltaX instead of deltaY if shift is pressed when scrolling
+ // with a scroll wheel, no need to do that ourselves.
static const float kScrollbarPixelsPerTick = 40.0f;
- float wheel_delta = [event deltaY];
- const float delta_lines = wheel_delta * kScrollbarPixelsPerTick;
- // Set scroll amount based on above calculations.
- if ([event modifierFlags] & NSShiftKeyMask) {
- delta_x = delta_lines;
- delta_y = 0;
- wheel_ticks_x = wheel_delta;
- wheel_ticks_y = 0;
- } else {
- delta_x = 0;
- delta_y = delta_lines;
- wheel_ticks_x = 0;
- wheel_ticks_y = wheel_delta;
- }
+ wheel_ticks_x = [event deltaX];
+ delta_x = wheel_ticks_x * kScrollbarPixelsPerTick;
+
+ wheel_ticks_y = [event deltaY];
+ delta_y = wheel_ticks_y * kScrollbarPixelsPerTick;
+
scroll_by_page = false;
}
« 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