| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_input_event_aura.h" | 5 #include "content/browser/renderer_host/web_input_event_aura.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.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 "content/browser/renderer_host/ui_events_helper.h" | 9 #include "content/browser/renderer_host/ui_events_helper.h" |
| 10 #include "ui/aura/client/screen_position_client.h" | 10 #include "ui/aura/client/screen_position_client.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 249 |
| 250 // Replace the event's coordinate fields with translated position data from | 250 // Replace the event's coordinate fields with translated position data from |
| 251 // |event|. | 251 // |event|. |
| 252 webkit_event.windowX = webkit_event.x = event.x(); | 252 webkit_event.windowX = webkit_event.x = event.x(); |
| 253 webkit_event.windowY = webkit_event.y = event.y(); | 253 webkit_event.windowY = webkit_event.y = event.y(); |
| 254 | 254 |
| 255 const gfx::Point screen_point = GetScreenLocationFromEvent(event); | 255 const gfx::Point screen_point = GetScreenLocationFromEvent(event); |
| 256 webkit_event.globalX = screen_point.x(); | 256 webkit_event.globalX = screen_point.x(); |
| 257 webkit_event.globalY = screen_point.y(); | 257 webkit_event.globalY = screen_point.y(); |
| 258 | 258 |
| 259 // Scroll events generated from the mouse wheel when the control key is held | |
| 260 // don't trigger scrolling. Instead, they may cause zooming. | |
| 261 bool from_mouse_wheel = !webkit_event.hasPreciseScrollingDeltas; | |
| 262 if ((webkit_event.modifiers & blink::WebInputEvent::ControlKey) && | |
| 263 from_mouse_wheel) { | |
| 264 webkit_event.canScroll = false; | |
| 265 } | |
| 266 | |
| 267 return webkit_event; | 259 return webkit_event; |
| 268 } | 260 } |
| 269 | 261 |
| 270 blink::WebMouseWheelEvent MakeWebMouseWheelEvent(const ui::ScrollEvent& event) { | 262 blink::WebMouseWheelEvent MakeWebMouseWheelEvent(const ui::ScrollEvent& event) { |
| 271 #if defined(OS_WIN) | 263 #if defined(OS_WIN) |
| 272 // Construct an untranslated event from the platform event data. | 264 // Construct an untranslated event from the platform event data. |
| 273 blink::WebMouseWheelEvent webkit_event = | 265 blink::WebMouseWheelEvent webkit_event = |
| 274 event.native_event().message | 266 event.native_event().message |
| 275 ? MakeUntranslatedWebMouseWheelEventFromNativeEvent( | 267 ? MakeUntranslatedWebMouseWheelEventFromNativeEvent( |
| 276 event.native_event(), event.time_stamp(), | 268 event.native_event(), event.time_stamp(), |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 webkit_event.tiltX = roundf(event.pointer_details().tilt_x); | 435 webkit_event.tiltX = roundf(event.pointer_details().tilt_x); |
| 444 webkit_event.tiltY = roundf(event.pointer_details().tilt_y); | 436 webkit_event.tiltY = roundf(event.pointer_details().tilt_y); |
| 445 webkit_event.force = event.pointer_details().force; | 437 webkit_event.force = event.pointer_details().force; |
| 446 webkit_event.pointerType = | 438 webkit_event.pointerType = |
| 447 EventPointerTypeToWebPointerType(event.pointer_details().pointer_type); | 439 EventPointerTypeToWebPointerType(event.pointer_details().pointer_type); |
| 448 | 440 |
| 449 return webkit_event; | 441 return webkit_event; |
| 450 } | 442 } |
| 451 | 443 |
| 452 } // namespace content | 444 } // namespace content |
| OLD | NEW |