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

Unified Diff: webkit/glue/webinputevent_mac.mm

Issue 40135: Various fixes to mouse wheel scrolling:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « webkit/glue/webinputevent_linux.cc ('k') | webkit/glue/webinputevent_win.cc » ('j') | 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 10933)
+++ webkit/glue/webinputevent_mac.mm (working copy)
@@ -119,37 +119,38 @@
type = MOUSE_WHEEL;
button = BUTTON_NONE;
+ // Set modifiers based on key state.
+ if ([event modifierFlags] & NSControlKeyMask)
+ modifiers |= CTRL_KEY;
+ if ([event modifierFlags] & NSShiftKeyMask)
+ modifiers |= SHIFT_KEY;
+ if ([event modifierFlags] & NSAlternateKeyMask)
+ modifiers |= ALT_KEY;
+
+ // Set coordinates by translating event coordinates from screen to client.
NSPoint location = [NSEvent mouseLocation]; // global coordinates
global_x = location.x;
global_y = location.y;
-
NSPoint windowLocal = [event locationInWindow];
location = [view convertPoint:windowLocal fromView:nil];
+ x = location.x;
y = [view frame].size.height - location.y; // flip y
- x = location.x;
- int wheel_delta = [event deltaY];
- const int delta_lines = wheel_delta * kDefaultScrollLinesPerWheelDelta;
+ // Convert wheel delta amount to a number of lines to scroll.
+ float wheel_delta = [event deltaY];
+ const float delta_lines = wheel_delta * kDefaultScrollLinesPerWheelDelta;
- // Scroll horizontally if shift is held. WebKit's WebKit/win/WebView.cpp
- // does the equivalent.
- // TODO(jackson): Support WM_MOUSEHWHEEL = 0x020E event as well.
- // (Need a mouse with horizontal scrolling capabilities to test it.)
+ // Set scroll amount based on above calculations.
if ([event modifierFlags] & NSShiftKeyMask) {
- // Scrolling up should move left, scrolling down should move right
- delta_x = -delta_lines;
+ // Scrolling up should move left, scrolling down should move right. This is
+ // opposite Safari, but seems more consistent with vertical scrolling.
Avi (use Gerrit) 2009/03/05 02:10:36 Nonono. Safari's shift-scrolling matches Cocoa's,
+ delta_x = delta_lines;
delta_y = 0;
} else {
delta_x = 0;
delta_y = delta_lines;
}
-
- if ([event modifierFlags] & NSControlKeyMask)
- modifiers |= CTRL_KEY;
- if ([event modifierFlags] & NSShiftKeyMask)
- modifiers |= SHIFT_KEY;
- if ([event modifierFlags] & NSAlternateKeyMask)
- modifiers |= ALT_KEY;
+ scroll_by_page = false;
}
// WebKeyboardEvent -----------------------------------------------------------
« no previous file with comments | « webkit/glue/webinputevent_linux.cc ('k') | webkit/glue/webinputevent_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698