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

Side by Side Diff: content/browser/renderer_host/input/web_input_event_builders_win.cc

Issue 1574013002: Remove the % WHEEL_DELTA check in WebMouseWheelEventBuilder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | content/browser/renderer_host/input/web_input_event_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/renderer_host/input/web_input_event_builders_win.h" 5 #include "content/browser/renderer_host/input/web_input_event_builders_win.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/renderer_host/input/web_input_event_util.h" 8 #include "content/browser/renderer_host/input/web_input_event_util.h"
9 #include "ui/events/blink/blink_event_util.h" 9 #include "ui/events/blink/blink_event_util.h"
10 #include "ui/events/event_utils.h" 10 #include "ui/events/event_utils.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 281
282 if (message == WM_HSCROLL) 282 if (message == WM_HSCROLL)
283 horizontal_scroll = true; 283 horizontal_scroll = true;
284 } else { 284 } else {
285 // Non-synthesized event; we can just read data off the event. 285 // Non-synthesized event; we can just read data off the event.
286 key_state = GET_KEYSTATE_WPARAM(wparam); 286 key_state = GET_KEYSTATE_WPARAM(wparam);
287 287
288 result.globalX = static_cast<short>(LOWORD(lparam)); 288 result.globalX = static_cast<short>(LOWORD(lparam));
289 result.globalY = static_cast<short>(HIWORD(lparam)); 289 result.globalY = static_cast<short>(HIWORD(lparam));
290 290
291 short wheel_delta_wparam = GET_WHEEL_DELTA_WPARAM(wparam); 291 wheel_delta = static_cast<float>(GET_WHEEL_DELTA_WPARAM(wparam));
Rick Byers 2016/01/12 14:12:21 nit: maybe worth a comment saying that we err on t
skobes 2016/01/14 22:36:07 Done.
292 // The current heuristic for setting hasPreciseScrollingDelta is whether or
293 // not wheel_delta is an exact multiple of WHEEL_DELTA. Note that high
294 // precision trackpads can occasionally generate deltas that are an exact
295 // multiple of WHEEL_DELTA.
296 if (wheel_delta_wparam % WHEEL_DELTA != 0)
297 result.hasPreciseScrollingDeltas = true;
298
299 wheel_delta = static_cast<float>(wheel_delta_wparam);
300 292
301 if (message == WM_MOUSEHWHEEL) { 293 if (message == WM_MOUSEHWHEEL) {
302 horizontal_scroll = true; 294 horizontal_scroll = true;
303 wheel_delta = -wheel_delta; // Windows is <- -/+ ->, WebKit <- +/- ->. 295 wheel_delta = -wheel_delta; // Windows is <- -/+ ->, WebKit <- +/- ->.
304 } 296 }
305 } 297 }
306 if (key_state & MK_SHIFT) 298 if (key_state & MK_SHIFT)
307 horizontal_scroll = true; 299 horizontal_scroll = true;
308 300
309 // Set modifiers based on key state. 301 // Set modifiers based on key state.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 result.wheelTicksX = wheel_delta; 359 result.wheelTicksX = wheel_delta;
368 } else { 360 } else {
369 result.deltaY = scroll_delta; 361 result.deltaY = scroll_delta;
370 result.wheelTicksY = wheel_delta; 362 result.wheelTicksY = wheel_delta;
371 } 363 }
372 364
373 return result; 365 return result;
374 } 366 }
375 367
376 } // namespace content 368 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/web_input_event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698