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

Side by Side Diff: content/browser/renderer_host/web_input_event_aura.cc

Issue 739013008: Explicitly suppress scrolling for wheel events that will trigger zooming (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change comments Created 6 years 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
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/input_router_impl.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698