| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 // Replace the event's coordinate fields with translated position data from | 254 // Replace the event's coordinate fields with translated position data from |
| 255 // |event|. | 255 // |event|. |
| 256 webkit_event.windowX = webkit_event.x = event.x(); | 256 webkit_event.windowX = webkit_event.x = event.x(); |
| 257 webkit_event.windowY = webkit_event.y = event.y(); | 257 webkit_event.windowY = webkit_event.y = event.y(); |
| 258 | 258 |
| 259 const gfx::Point screen_point = GetScreenLocationFromEvent(event); | 259 const gfx::Point screen_point = GetScreenLocationFromEvent(event); |
| 260 webkit_event.globalX = screen_point.x(); | 260 webkit_event.globalX = screen_point.x(); |
| 261 webkit_event.globalY = screen_point.y(); | 261 webkit_event.globalY = screen_point.y(); |
| 262 | 262 |
| 263 // Scroll events generated from the mouse wheel when the control key is held | |
| 264 // don't trigger scrolling. Instead, they may cause zooming. | |
| 265 bool from_mouse_wheel = !webkit_event.hasPreciseScrollingDeltas; | |
| 266 if ((webkit_event.modifiers & blink::WebInputEvent::ControlKey) && | |
| 267 from_mouse_wheel) { | |
| 268 webkit_event.canScroll = false; | |
| 269 } | |
| 270 | |
| 271 return webkit_event; | 263 return webkit_event; |
| 272 } | 264 } |
| 273 | 265 |
| 274 blink::WebMouseWheelEvent MakeWebMouseWheelEvent(const ui::ScrollEvent& event) { | 266 blink::WebMouseWheelEvent MakeWebMouseWheelEvent(const ui::ScrollEvent& event) { |
| 275 #if defined(OS_WIN) | 267 #if defined(OS_WIN) |
| 276 // Construct an untranslated event from the platform event data. | 268 // Construct an untranslated event from the platform event data. |
| 277 blink::WebMouseWheelEvent webkit_event = | 269 blink::WebMouseWheelEvent webkit_event = |
| 278 event.native_event().message | 270 event.native_event().message |
| 279 ? MakeUntranslatedWebMouseWheelEventFromNativeEvent( | 271 ? MakeUntranslatedWebMouseWheelEventFromNativeEvent( |
| 280 event.native_event(), event.time_stamp(), | 272 event.native_event(), event.time_stamp(), |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 webkit_event.tiltX = roundf(event.pointer_details().tilt_x); | 441 webkit_event.tiltX = roundf(event.pointer_details().tilt_x); |
| 450 webkit_event.tiltY = roundf(event.pointer_details().tilt_y); | 442 webkit_event.tiltY = roundf(event.pointer_details().tilt_y); |
| 451 webkit_event.force = event.pointer_details().force; | 443 webkit_event.force = event.pointer_details().force; |
| 452 webkit_event.pointerType = | 444 webkit_event.pointerType = |
| 453 EventPointerTypeToWebPointerType(event.pointer_details().pointer_type); | 445 EventPointerTypeToWebPointerType(event.pointer_details().pointer_type); |
| 454 | 446 |
| 455 return webkit_event; | 447 return webkit_event; |
| 456 } | 448 } |
| 457 | 449 |
| 458 } // namespace content | 450 } // namespace content |
| OLD | NEW |