 Chromium Code Reviews
 Chromium Code Reviews Issue 112293004:
  Prevent ctrl+2f scroll on the touchpad to zoom the page  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 112293004:
  Prevent ctrl+2f scroll on the touchpad to zoom the page  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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/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 2847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2858 return; | 2858 return; | 
| 2859 | 2859 | 
| 2860 if (event->type() == ui::ET_SCROLL) { | 2860 if (event->type() == ui::ET_SCROLL) { | 
| 2861 if (event->finger_count() != 2) | 2861 if (event->finger_count() != 2) | 
| 2862 return; | 2862 return; | 
| 2863 blink::WebGestureEvent gesture_event = | 2863 blink::WebGestureEvent gesture_event = | 
| 2864 MakeWebGestureEventFlingCancel(); | 2864 MakeWebGestureEventFlingCancel(); | 
| 2865 host_->ForwardGestureEvent(gesture_event); | 2865 host_->ForwardGestureEvent(gesture_event); | 
| 2866 blink::WebMouseWheelEvent mouse_wheel_event = | 2866 blink::WebMouseWheelEvent mouse_wheel_event = | 
| 2867 MakeWebMouseWheelEvent(event); | 2867 MakeWebMouseWheelEvent(event); | 
| 2868 | |
| 2869 // We don't want ctrl+two finger scroll to trigger the WebContents zooming | |
| 2870 // function as it is too sensitive and most people don't expect the effect | |
| 2871 // (unlike ctrl+mousewheel, which most people expect to zoom the page). | |
| 2872 // Therefore, we clear the modifier here if and only if the ctrl key is | |
| 2873 // pressed and no any other key is pressed at the same time. This prevents | |
| 2874 // WebContentsImpl to zoom the page while retain the scroll event and other | |
| 
Daniel Erat
2013/12/26 14:44:22
nit: s/to zoom/from zooming/, s/while retain/while
 
Shecky Lin
2013/12/27 03:23:54
Done.
 | |
| 2875 // modifier combinations in case the webpage might want to use them. | |
| 2876 if (mouse_wheel_event.modifiers == blink::WebInputEvent::ControlKey) | |
| 2877 mouse_wheel_event.modifiers = 0; | |
| 2868 host_->ForwardWheelEvent(mouse_wheel_event); | 2878 host_->ForwardWheelEvent(mouse_wheel_event); | 
| 2869 RecordAction(UserMetricsAction("TrackpadScroll")); | 2879 RecordAction(UserMetricsAction("TrackpadScroll")); | 
| 2870 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 2880 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 
| 2871 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 2881 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 
| 2872 blink::WebGestureEvent gesture_event = | 2882 blink::WebGestureEvent gesture_event = | 
| 2873 MakeWebGestureEvent(event); | 2883 MakeWebGestureEvent(event); | 
| 2874 host_->ForwardGestureEvent(gesture_event); | 2884 host_->ForwardGestureEvent(gesture_event); | 
| 2875 if (event->type() == ui::ET_SCROLL_FLING_START) | 2885 if (event->type() == ui::ET_SCROLL_FLING_START) | 
| 2876 RecordAction(UserMetricsAction("TrackpadScrollFling")); | 2886 RecordAction(UserMetricsAction("TrackpadScrollFling")); | 
| 2877 } | 2887 } | 
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3486 RenderWidgetHost* widget) { | 3496 RenderWidgetHost* widget) { | 
| 3487 return new RenderWidgetHostViewAura(widget); | 3497 return new RenderWidgetHostViewAura(widget); | 
| 3488 } | 3498 } | 
| 3489 | 3499 | 
| 3490 // static | 3500 // static | 
| 3491 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3501 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 
| 3492 GetScreenInfoForWindow(results, NULL); | 3502 GetScreenInfoForWindow(results, NULL); | 
| 3493 } | 3503 } | 
| 3494 | 3504 | 
| 3495 } // namespace content | 3505 } // namespace content | 
| OLD | NEW |