 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 from zooming the page while retaining the scroll event | |
| 2875 // and other modifier combinations in case the webpage might want to use | |
| 2876 // them. | |
| 2877 if (mouse_wheel_event.modifiers == blink::WebInputEvent::ControlKey) | |
| 2878 mouse_wheel_event.modifiers = 0; | |
| 
sadrul
2014/01/03 18:09:17
If we want to disable this only on chromeos, then
 
Rick Byers
2014/04/04 17:35:53
I think it's fine to do this for ChromeOS only for
 
sadrul
2014/04/04 19:00:21
Note that shortly after this patchset, we started
 | |
| 2868 host_->ForwardWheelEvent(mouse_wheel_event); | 2879 host_->ForwardWheelEvent(mouse_wheel_event); | 
| 2869 RecordAction(UserMetricsAction("TrackpadScroll")); | 2880 RecordAction(UserMetricsAction("TrackpadScroll")); | 
| 2870 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 2881 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 
| 2871 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 2882 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 
| 2872 blink::WebGestureEvent gesture_event = | 2883 blink::WebGestureEvent gesture_event = | 
| 2873 MakeWebGestureEvent(event); | 2884 MakeWebGestureEvent(event); | 
| 2874 host_->ForwardGestureEvent(gesture_event); | 2885 host_->ForwardGestureEvent(gesture_event); | 
| 2875 if (event->type() == ui::ET_SCROLL_FLING_START) | 2886 if (event->type() == ui::ET_SCROLL_FLING_START) | 
| 2876 RecordAction(UserMetricsAction("TrackpadScrollFling")); | 2887 RecordAction(UserMetricsAction("TrackpadScrollFling")); | 
| 2877 } | 2888 } | 
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3486 RenderWidgetHost* widget) { | 3497 RenderWidgetHost* widget) { | 
| 3487 return new RenderWidgetHostViewAura(widget); | 3498 return new RenderWidgetHostViewAura(widget); | 
| 3488 } | 3499 } | 
| 3489 | 3500 | 
| 3490 // static | 3501 // static | 
| 3491 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3502 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 
| 3492 GetScreenInfoForWindow(results, NULL); | 3503 GetScreenInfoForWindow(results, NULL); | 
| 3493 } | 3504 } | 
| 3494 | 3505 | 
| 3495 } // namespace content | 3506 } // namespace content | 
| OLD | NEW |