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

Side by Side Diff: webkit/glue/webinputevent_linux.cc

Issue 40241: Convert from line scrolling to pixel scrolling. Increase pixel scroll amount... (Closed) Base URL: svn://chrome-svn/chrome/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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/event_conversion.cc ('k') | webkit/glue/webinputevent_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "webkit/glue/webinputevent.h" 7 #include "webkit/glue/webinputevent.h"
8 8
9 #include "KeyboardCodes.h" 9 #include "KeyboardCodes.h"
10 #include "KeyCodeConversion.h" 10 #include "KeyCodeConversion.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // How much should we scroll per mouse wheel event? 116 // How much should we scroll per mouse wheel event?
117 // - Windows uses 3 lines by default and obeys a system setting. 117 // - Windows uses 3 lines by default and obeys a system setting.
118 // - Mozilla has a pref that lets you either use the "system" number of lines 118 // - Mozilla has a pref that lets you either use the "system" number of lines
119 // to scroll, or lets the user override it. 119 // to scroll, or lets the user override it.
120 // For the "system" number of lines, it appears they've hardcoded 3. 120 // For the "system" number of lines, it appears they've hardcoded 3.
121 // See case NS_MOUSE_SCROLL in content/events/src/nsEventStateManager.cpp 121 // See case NS_MOUSE_SCROLL in content/events/src/nsEventStateManager.cpp
122 // and InitMouseScrollEvent in widget/src/gtk2/nsCommonWidget.cpp . 122 // and InitMouseScrollEvent in widget/src/gtk2/nsCommonWidget.cpp .
123 // - Gtk makes the scroll amount a function of the size of the scroll bar, 123 // - Gtk makes the scroll amount a function of the size of the scroll bar,
124 // which is not available to us here. 124 // which is not available to us here.
125 // Instead, we pick a number that empirically matches Firefox's behavior. 125 // Instead, we pick a number that empirically matches Firefox's behavior.
126 static const float kWheelDelta = 4; 126 static const float kScrollbarPixelsPerTick = 160.0f / 3.0f;
127 127
128 delta_x = 0; 128 delta_x = 0;
129 delta_y = 0; 129 delta_y = 0;
130 switch (event->direction) { 130 switch (event->direction) {
131 case GDK_SCROLL_UP: 131 case GDK_SCROLL_UP:
132 delta_y = kWheelDelta; 132 delta_y = kScrollbarPixelsPerTick;
133 break; 133 break;
134 case GDK_SCROLL_DOWN: 134 case GDK_SCROLL_DOWN:
135 delta_y = -kWheelDelta; 135 delta_y = -kScrollbarPixelsPerTick;
136 break; 136 break;
137 case GDK_SCROLL_LEFT: 137 case GDK_SCROLL_LEFT:
138 delta_x = kWheelDelta; 138 delta_x = kScrollbarPixelsPerTick;
139 break; 139 break;
140 case GDK_SCROLL_RIGHT: 140 case GDK_SCROLL_RIGHT:
141 delta_x = -kWheelDelta; 141 delta_x = -kScrollbarPixelsPerTick;
142 break; 142 break;
143 default: 143 default:
144 break; 144 break;
145 } 145 }
146 scroll_by_page = false; 146 scroll_by_page = false;
147 } 147 }
148 148
149 WebKeyboardEvent::WebKeyboardEvent(const GdkEventKey* event) { 149 WebKeyboardEvent::WebKeyboardEvent(const GdkEventKey* event) {
150 system_key = false; 150 system_key = false;
151 modifiers = GdkStateToWebEventModifiers(event->state); 151 modifiers = GdkStateToWebEventModifiers(event->state);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 break; 188 break;
189 } 189 }
190 190
191 std::string key_identifier_str = 191 std::string key_identifier_str =
192 webkit_glue::GetKeyIdentifierForWindowsKeyCode(windows_key_code); 192 webkit_glue::GetKeyIdentifierForWindowsKeyCode(windows_key_code);
193 base::strlcpy(key_identifier, key_identifier_str.c_str(), 193 base::strlcpy(key_identifier, key_identifier_str.c_str(),
194 kIdentifierLengthCap); 194 kIdentifierLengthCap);
195 195
196 // TODO(tc): Do we need to set IS_AUTO_REPEAT or IS_KEYPAD? 196 // TODO(tc): Do we need to set IS_AUTO_REPEAT or IS_KEYPAD?
197 } 197 }
OLDNEW
« no previous file with comments | « webkit/glue/event_conversion.cc ('k') | webkit/glue/webinputevent_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698