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

Side by Side Diff: content/browser/renderer_host/input/mouse_wheel_event_queue.cc

Issue 2359463002: Send the WebMouseWheelEvents unconverted if Shift is down. (Closed)
Patch Set: Add comemnt Created 4 years, 3 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
« no previous file with comments | « no previous file | ui/events/blink/web_input_event.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/input/mouse_wheel_event_queue.h" 5 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "ui/events/blink/web_input_event_traits.h" 10 #include "ui/events/blink/web_input_event_traits.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 scroll_update.timeStampSeconds = 92 scroll_update.timeStampSeconds =
93 event_sent_for_gesture_ack_->event.timeStampSeconds; 93 event_sent_for_gesture_ack_->event.timeStampSeconds;
94 94
95 scroll_update.x = event_sent_for_gesture_ack_->event.x; 95 scroll_update.x = event_sent_for_gesture_ack_->event.x;
96 scroll_update.y = event_sent_for_gesture_ack_->event.y; 96 scroll_update.y = event_sent_for_gesture_ack_->event.y;
97 scroll_update.globalX = event_sent_for_gesture_ack_->event.globalX; 97 scroll_update.globalX = event_sent_for_gesture_ack_->event.globalX;
98 scroll_update.globalY = event_sent_for_gesture_ack_->event.globalY; 98 scroll_update.globalY = event_sent_for_gesture_ack_->event.globalY;
99 scroll_update.type = WebInputEvent::GestureScrollUpdate; 99 scroll_update.type = WebInputEvent::GestureScrollUpdate;
100 scroll_update.sourceDevice = blink::WebGestureDeviceTouchpad; 100 scroll_update.sourceDevice = blink::WebGestureDeviceTouchpad;
101 scroll_update.resendingPluginId = -1; 101 scroll_update.resendingPluginId = -1;
102 scroll_update.data.scrollUpdate.deltaX = 102
103 event_sent_for_gesture_ack_->event.deltaX; 103 // Swap X & Y if Shift is down and when there is no horizontal movement.
104 scroll_update.data.scrollUpdate.deltaY = 104 if ((event_sent_for_gesture_ack_->event.modifiers &
105 event_sent_for_gesture_ack_->event.deltaY; 105 WebInputEvent::ShiftKey) != 0 &&
106 event_sent_for_gesture_ack_->event.deltaX == 0) {
107 scroll_update.data.scrollUpdate.deltaX =
108 event_sent_for_gesture_ack_->event.deltaY;
109 scroll_update.data.scrollUpdate.deltaY =
110 event_sent_for_gesture_ack_->event.deltaX;
111 } else {
112 scroll_update.data.scrollUpdate.deltaX =
113 event_sent_for_gesture_ack_->event.deltaX;
114 scroll_update.data.scrollUpdate.deltaY =
115 event_sent_for_gesture_ack_->event.deltaY;
116 }
106 // Only OSX populates the phase and momentumPhase; so 117 // Only OSX populates the phase and momentumPhase; so
107 // |inertialPhase| will be UnknownMomentumPhase on all other platforms. 118 // |inertialPhase| will be UnknownMomentumPhase on all other platforms.
108 if (event_sent_for_gesture_ack_->event.momentumPhase != 119 if (event_sent_for_gesture_ack_->event.momentumPhase !=
109 blink::WebMouseWheelEvent::PhaseNone) { 120 blink::WebMouseWheelEvent::PhaseNone) {
110 scroll_update.data.scrollUpdate.inertialPhase = 121 scroll_update.data.scrollUpdate.inertialPhase =
111 WebGestureEvent::MomentumPhase; 122 WebGestureEvent::MomentumPhase;
112 } else if (event_sent_for_gesture_ack_->event.phase != 123 } else if (event_sent_for_gesture_ack_->event.phase !=
113 blink::WebMouseWheelEvent::PhaseNone) { 124 blink::WebMouseWheelEvent::PhaseNone) {
114 scroll_update.data.scrollUpdate.inertialPhase = 125 scroll_update.data.scrollUpdate.inertialPhase =
115 WebGestureEvent::NonMomentumPhase; 126 WebGestureEvent::NonMomentumPhase;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 scroll_begin.data.scrollBegin.deltaHintUnits = 301 scroll_begin.data.scrollBegin.deltaHintUnits =
291 gesture_update.data.scrollUpdate.deltaUnits; 302 gesture_update.data.scrollUpdate.deltaUnits;
292 303
293 needs_scroll_begin_ = false; 304 needs_scroll_begin_ = false;
294 needs_scroll_end_ = true; 305 needs_scroll_end_ = true;
295 client_->ForwardGestureEventWithLatencyInfo( 306 client_->ForwardGestureEventWithLatencyInfo(
296 scroll_begin, ui::LatencyInfo(ui::SourceEventType::WHEEL)); 307 scroll_begin, ui::LatencyInfo(ui::SourceEventType::WHEEL));
297 } 308 }
298 309
299 } // namespace content 310 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/events/blink/web_input_event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698