| OLD | NEW |
| 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 Loading... |
| 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 // Currently we leave hasPreciseScrollingDeltas false, even for trackpad |
| 292 // The current heuristic for setting hasPreciseScrollingDelta is whether or | 292 // scrolls that generate WM_MOUSEWHEEL, since we don't have a good way to |
| 293 // not wheel_delta is an exact multiple of WHEEL_DELTA. Note that high | 293 // distinguish these from real mouse wheels (crbug.com/545234). |
| 294 // precision trackpads can occasionally generate deltas that are an exact | 294 wheel_delta = static_cast<float>(GET_WHEEL_DELTA_WPARAM(wparam)); |
| 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 | 295 |
| 301 if (message == WM_MOUSEHWHEEL) { | 296 if (message == WM_MOUSEHWHEEL) { |
| 302 horizontal_scroll = true; | 297 horizontal_scroll = true; |
| 303 wheel_delta = -wheel_delta; // Windows is <- -/+ ->, WebKit <- +/- ->. | 298 wheel_delta = -wheel_delta; // Windows is <- -/+ ->, WebKit <- +/- ->. |
| 304 } | 299 } |
| 305 } | 300 } |
| 306 if (key_state & MK_SHIFT) | 301 if (key_state & MK_SHIFT) |
| 307 horizontal_scroll = true; | 302 horizontal_scroll = true; |
| 308 | 303 |
| 309 // Set modifiers based on key state. | 304 // Set modifiers based on key state. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 result.wheelTicksX = wheel_delta; | 362 result.wheelTicksX = wheel_delta; |
| 368 } else { | 363 } else { |
| 369 result.deltaY = scroll_delta; | 364 result.deltaY = scroll_delta; |
| 370 result.wheelTicksY = wheel_delta; | 365 result.wheelTicksY = wheel_delta; |
| 371 } | 366 } |
| 372 | 367 |
| 373 return result; | 368 return result; |
| 374 } | 369 } |
| 375 | 370 |
| 376 } // namespace content | 371 } // namespace content |
| OLD | NEW |