OLD | NEW |
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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "ui/events/base_event_utils.h" | 10 #include "ui/events/base_event_utils.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED && | 84 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED && |
85 ui::WebInputEventTraits::CanCauseScroll( | 85 ui::WebInputEventTraits::CanCauseScroll( |
86 event_sent_for_gesture_ack_->event) && | 86 event_sent_for_gesture_ack_->event) && |
87 event_sent_for_gesture_ack_->event.resendingPluginId == -1 && | 87 event_sent_for_gesture_ack_->event.resendingPluginId == -1 && |
88 (scrolling_device_ == blink::WebGestureDeviceUninitialized || | 88 (scrolling_device_ == blink::WebGestureDeviceUninitialized || |
89 scrolling_device_ == blink::WebGestureDeviceTouchpad)) { | 89 scrolling_device_ == blink::WebGestureDeviceTouchpad)) { |
90 WebGestureEvent scroll_update( | 90 WebGestureEvent scroll_update( |
91 WebInputEvent::GestureScrollUpdate, WebInputEvent::NoModifiers, | 91 WebInputEvent::GestureScrollUpdate, WebInputEvent::NoModifiers, |
92 event_sent_for_gesture_ack_->event.timeStampSeconds()); | 92 event_sent_for_gesture_ack_->event.timeStampSeconds()); |
93 | 93 |
94 scroll_update.x = event_sent_for_gesture_ack_->event.x; | 94 scroll_update.x = event_sent_for_gesture_ack_->event.positionInWidget().x; |
95 scroll_update.y = event_sent_for_gesture_ack_->event.y; | 95 scroll_update.y = event_sent_for_gesture_ack_->event.positionInWidget().y; |
96 scroll_update.globalX = event_sent_for_gesture_ack_->event.globalX; | 96 scroll_update.globalX = |
97 scroll_update.globalY = event_sent_for_gesture_ack_->event.globalY; | 97 event_sent_for_gesture_ack_->event.positionInScreen().x; |
| 98 scroll_update.globalY = |
| 99 event_sent_for_gesture_ack_->event.positionInScreen().y; |
98 scroll_update.sourceDevice = blink::WebGestureDeviceTouchpad; | 100 scroll_update.sourceDevice = blink::WebGestureDeviceTouchpad; |
99 scroll_update.resendingPluginId = -1; | 101 scroll_update.resendingPluginId = -1; |
100 | 102 |
101 // Swap X & Y if Shift is down and when there is no horizontal movement. | 103 // Swap X & Y if Shift is down and when there is no horizontal movement. |
102 if ((event_sent_for_gesture_ack_->event.modifiers() & | 104 if ((event_sent_for_gesture_ack_->event.modifiers() & |
103 WebInputEvent::ShiftKey) != 0 && | 105 WebInputEvent::ShiftKey) != 0 && |
104 event_sent_for_gesture_ack_->event.deltaX == 0) { | 106 event_sent_for_gesture_ack_->event.deltaX == 0) { |
105 scroll_update.data.scrollUpdate.deltaX = | 107 scroll_update.data.scrollUpdate.deltaX = |
106 event_sent_for_gesture_ack_->event.deltaY; | 108 event_sent_for_gesture_ack_->event.deltaY; |
107 scroll_update.data.scrollUpdate.deltaY = | 109 scroll_update.data.scrollUpdate.deltaY = |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 scroll_begin.data.scrollBegin.deltaHintUnits = | 347 scroll_begin.data.scrollBegin.deltaHintUnits = |
346 gesture_update.data.scrollUpdate.deltaUnits; | 348 gesture_update.data.scrollUpdate.deltaUnits; |
347 | 349 |
348 needs_scroll_begin_ = false; | 350 needs_scroll_begin_ = false; |
349 needs_scroll_end_ = true; | 351 needs_scroll_end_ = true; |
350 client_->ForwardGestureEventWithLatencyInfo( | 352 client_->ForwardGestureEventWithLatencyInfo( |
351 scroll_begin, ui::LatencyInfo(ui::SourceEventType::WHEEL)); | 353 scroll_begin, ui::LatencyInfo(ui::SourceEventType::WHEEL)); |
352 } | 354 } |
353 | 355 |
354 } // namespace content | 356 } // namespace content |
OLD | NEW |