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 "content/browser/renderer_host/input/web_input_event_util.h" | 7 #include "content/browser/renderer_host/input/web_input_event_util.h" |
8 #include "content/browser/renderer_host/ui_events_helper.h" | 8 #include "content/browser/renderer_host/ui_events_helper.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 | 190 |
191 // Replace the event's coordinate fields with translated position data from | 191 // Replace the event's coordinate fields with translated position data from |
192 // |event|. | 192 // |event|. |
193 webkit_event.windowX = webkit_event.x = event->x(); | 193 webkit_event.windowX = webkit_event.x = event->x(); |
194 webkit_event.windowY = webkit_event.y = event->y(); | 194 webkit_event.windowY = webkit_event.y = event->y(); |
195 | 195 |
196 const gfx::Point root_point = event->root_location(); | 196 const gfx::Point root_point = event->root_location(); |
197 webkit_event.globalX = root_point.x(); | 197 webkit_event.globalX = root_point.x(); |
198 webkit_event.globalY = root_point.y(); | 198 webkit_event.globalY = root_point.y(); |
199 | 199 |
200 // Scroll events generated from the mouse wheel when the control key is held | |
201 // don't trigger scrolling. Instead, they may cause zooming. | |
202 bool from_mouseWheel = !webkit_event.hasPreciseScrollingDeltas; | |
tdresser
2014/12/03 13:45:05
Sorry, I used the wrong formatting in my comment.
lanwei
2014/12/03 22:06:44
Done.
| |
203 if ((webkit_event.modifiers & blink::WebInputEvent::ControlKey) | |
204 && from_mouseWheel) { | |
jdduke (slow)
2014/12/03 21:37:10
Nit: The && should be at the end of the preceding
lanwei
2014/12/03 22:06:44
Done.
Yes, just realize they have different style
| |
205 webkit_event.canScroll = false; | |
206 } | |
207 | |
200 return webkit_event; | 208 return webkit_event; |
201 } | 209 } |
202 | 210 |
203 blink::WebMouseWheelEvent MakeWebMouseWheelEvent(ui::ScrollEvent* event) { | 211 blink::WebMouseWheelEvent MakeWebMouseWheelEvent(ui::ScrollEvent* event) { |
204 #if defined(OS_WIN) | 212 #if defined(OS_WIN) |
205 // Construct an untranslated event from the platform event data. | 213 // Construct an untranslated event from the platform event data. |
206 blink::WebMouseWheelEvent webkit_event = | 214 blink::WebMouseWheelEvent webkit_event = |
207 MakeUntranslatedWebMouseWheelEventFromNativeEvent(event->native_event()); | 215 MakeUntranslatedWebMouseWheelEventFromNativeEvent(event->native_event()); |
208 #else | 216 #else |
209 blink::WebMouseWheelEvent webkit_event = | 217 blink::WebMouseWheelEvent webkit_event = |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 webkit_event.deltaY = event->y_offset(); | 360 webkit_event.deltaY = event->y_offset(); |
353 } | 361 } |
354 | 362 |
355 webkit_event.wheelTicksX = webkit_event.deltaX / kPixelsPerTick; | 363 webkit_event.wheelTicksX = webkit_event.deltaX / kPixelsPerTick; |
356 webkit_event.wheelTicksY = webkit_event.deltaY / kPixelsPerTick; | 364 webkit_event.wheelTicksY = webkit_event.deltaY / kPixelsPerTick; |
357 | 365 |
358 return webkit_event; | 366 return webkit_event; |
359 } | 367 } |
360 | 368 |
361 } // namespace content | 369 } // namespace content |
OLD | NEW |