summaryrefslogtreecommitdiffstats
path: root/content/renderer/input
diff options
context:
space:
mode:
authorlanwei <lanwei@chromium.org>2014-12-22 14:36:59 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-22 22:37:58 +0000
commitb3361bcdd3766a67c702c19781154c895fee75ca (patch)
tree5a3573c8490deaa93d1ef67169e2cdf7cfe1d43d /content/renderer/input
parentd355ff75f2eb9129cb06e160c5beb1590d7d0ee3 (diff)
downloadchromium_src-b3361bcdd3766a67c702c19781154c895fee75ca.zip
chromium_src-b3361bcdd3766a67c702c19781154c895fee75ca.tar.gz
chromium_src-b3361bcdd3766a67c702c19781154c895fee75ca.tar.bz2
Explicitly suppress scrolling for wheel events that will trigger zooming
We added a flag in Blink to decide if Ctrl-wheel-scroll should scroll or zoom, and now we use this flag in chromium code. This patch is part of a series: patch #1: https://codereview.chromium.org/759073002 patch #2: This CL patch #3: https://codereview.chromium.org/768443002 BUG=397027, 378755 Review URL: https://codereview.chromium.org/739013008 Cr-Commit-Position: refs/heads/master@{#309472}
Diffstat (limited to 'content/renderer/input')
-rw-r--r--content/renderer/input/input_handler_proxy.cc6
-rw-r--r--content/renderer/input/input_handler_proxy_unittest.cc4
2 files changed, 5 insertions, 5 deletions
diff --git a/content/renderer/input/input_handler_proxy.cc b/content/renderer/input/input_handler_proxy.cc
index 3edb957..602f113 100644
--- a/content/renderer/input/input_handler_proxy.cc
+++ b/content/renderer/input/input_handler_proxy.cc
@@ -324,9 +324,9 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel(
// TODO(jamesr): We don't properly handle scroll by page in the compositor
// thread, so punt it to the main thread. http://crbug.com/236639
result = DID_NOT_HANDLE;
- } else if (wheel_event.modifiers & WebInputEvent::ControlKey) {
- // Wheel events involving the control key never trigger scrolling, only
- // event handlers. Forward to the main thread.
+ } else if (!wheel_event.canScroll) {
+ // Wheel events with |canScroll| == false will not trigger scrolling,
+ // only event handlers. Forward to the main thread.
result = DID_NOT_HANDLE;
} else if (smooth_scroll_enabled_) {
cc::InputHandler::ScrollStatus scroll_status =
diff --git a/content/renderer/input/input_handler_proxy_unittest.cc b/content/renderer/input/input_handler_proxy_unittest.cc
index cb85701..ad715ac 100644
--- a/content/renderer/input/input_handler_proxy_unittest.cc
+++ b/content/renderer/input/input_handler_proxy_unittest.cc
@@ -288,12 +288,12 @@ TEST_F(InputHandlerProxyTest, MouseWheelByPageMainThread) {
testing::Mock::VerifyAndClearExpectations(&mock_client_);
}
-TEST_F(InputHandlerProxyTest, MouseWheelWithCtrl) {
+TEST_F(InputHandlerProxyTest, MouseWheelWithCtrlNotScroll) {
expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
WebMouseWheelEvent wheel;
wheel.type = WebInputEvent::MouseWheel;
wheel.modifiers = WebInputEvent::ControlKey;
-
+ wheel.canScroll = false;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel));
testing::Mock::VerifyAndClearExpectations(&mock_client_);
}