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

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

Issue 242733008: Prevent Control+two-finger-scroll from zooming the page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months 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 | Annotate | Revision Log
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/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 2496 matching lines...) Expand 10 before | Expand all | Expand 10 after
2507 // TODO(ananta) 2507 // TODO(ananta)
2508 // Investigate if this is true for Windows 8 Metro ASH as well. 2508 // Investigate if this is true for Windows 8 Metro ASH as well.
2509 if (event->finger_count() != 2) 2509 if (event->finger_count() != 2)
2510 return; 2510 return;
2511 #endif 2511 #endif
2512 blink::WebGestureEvent gesture_event = 2512 blink::WebGestureEvent gesture_event =
2513 MakeWebGestureEventFlingCancel(); 2513 MakeWebGestureEventFlingCancel();
2514 host_->ForwardGestureEvent(gesture_event); 2514 host_->ForwardGestureEvent(gesture_event);
2515 blink::WebMouseWheelEvent mouse_wheel_event = 2515 blink::WebMouseWheelEvent mouse_wheel_event =
2516 MakeWebMouseWheelEvent(event); 2516 MakeWebMouseWheelEvent(event);
2517
2518 // We don't want Control+two-finger-scroll to trigger the WebContents
2519 // zooming function as it is too sensitive and most people don't expect the
2520 // effect (unlike Control+mouse-wheel, which is commonly used to zoom the
2521 // page). Therefore, clear the modifier here if and only if the Control key
2522 // is pressed and no any other key is pressed at the same time. This
2523 // prevents WebContentsImpl from zooming the page while retaining the scroll
2524 // event and other modifier combinations in case the webpage might want to
2525 // use them.
2526 if (mouse_wheel_event.modifiers == blink::WebInputEvent::ControlKey)
2527 mouse_wheel_event.modifiers = 0;
Rick Byers 2014/04/22 14:15:15 Now that it's possible for pages to receive ctrl+w
Daniel Erat 2014/04/22 15:27:04 thanks, makes sense (and i agree that it seems muc
2528
2517 host_->ForwardWheelEvent(mouse_wheel_event); 2529 host_->ForwardWheelEvent(mouse_wheel_event);
2518 RecordAction(base::UserMetricsAction("TrackpadScroll")); 2530 RecordAction(base::UserMetricsAction("TrackpadScroll"));
2519 } else if (event->type() == ui::ET_SCROLL_FLING_START || 2531 } else if (event->type() == ui::ET_SCROLL_FLING_START ||
2520 event->type() == ui::ET_SCROLL_FLING_CANCEL) { 2532 event->type() == ui::ET_SCROLL_FLING_CANCEL) {
2521 blink::WebGestureEvent gesture_event = 2533 blink::WebGestureEvent gesture_event =
2522 MakeWebGestureEvent(event); 2534 MakeWebGestureEvent(event);
2523 host_->ForwardGestureEvent(gesture_event); 2535 host_->ForwardGestureEvent(gesture_event);
2524 if (event->type() == ui::ET_SCROLL_FLING_START) 2536 if (event->type() == ui::ET_SCROLL_FLING_START)
2525 RecordAction(base::UserMetricsAction("TrackpadScrollFling")); 2537 RecordAction(base::UserMetricsAction("TrackpadScrollFling"));
2526 } 2538 }
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
3170 RenderWidgetHost* widget) { 3182 RenderWidgetHost* widget) {
3171 return new RenderWidgetHostViewAura(widget); 3183 return new RenderWidgetHostViewAura(widget);
3172 } 3184 }
3173 3185
3174 // static 3186 // static
3175 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3187 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3176 GetScreenInfoForWindow(results, NULL); 3188 GetScreenInfoForWindow(results, NULL);
3177 } 3189 }
3178 3190
3179 } // namespace content 3191 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698