| 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 "content/common/input/input_event_dispatch_type.h" | 10 #include "content/common/input/input_event_dispatch_type.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 if (enable_scroll_latching_) { | 181 if (enable_scroll_latching_) { |
| 182 if (event_sent_for_gesture_ack_->event.phase == | 182 if (event_sent_for_gesture_ack_->event.phase == |
| 183 blink::WebMouseWheelEvent::kPhaseBegan) { | 183 blink::WebMouseWheelEvent::kPhaseBegan) { |
| 184 send_wheel_events_async_ = true; | 184 send_wheel_events_async_ = true; |
| 185 SendScrollBegin(scroll_update, false); | 185 SendScrollBegin(scroll_update, false); |
| 186 } | 186 } |
| 187 | 187 |
| 188 if (needs_update) { | 188 if (needs_update) { |
| 189 ui::LatencyInfo latency = ui::LatencyInfo(ui::SourceEventType::WHEEL); | 189 ui::LatencyInfo latency = ui::LatencyInfo(ui::SourceEventType::WHEEL); |
| 190 latency.AddLatencyNumber( | 190 latency.AddLatencyNumber( |
| 191 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0, | 191 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0); |
| 192 0); | |
| 193 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency); | 192 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency); |
| 194 } | 193 } |
| 195 | 194 |
| 196 if (current_phase_ended) { | 195 if (current_phase_ended) { |
| 197 // Send GSE with if scroll latching is enabled and no fling is going | 196 // Send GSE with if scroll latching is enabled and no fling is going |
| 198 // to happen next. | 197 // to happen next. |
| 199 SendScrollEnd(scroll_update, false); | 198 SendScrollEnd(scroll_update, false); |
| 200 } | 199 } |
| 201 } else { // !enable_scroll_latching_ | 200 } else { // !enable_scroll_latching_ |
| 202 | 201 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 215 // If a GSB has been sent, generate a synthetic GSB if we have phase | 214 // If a GSB has been sent, generate a synthetic GSB if we have phase |
| 216 // information. This should be removed once crbug.com/526463 is | 215 // information. This should be removed once crbug.com/526463 is |
| 217 // fully implemented. | 216 // fully implemented. |
| 218 SendScrollBegin(scroll_update, true); | 217 SendScrollBegin(scroll_update, true); |
| 219 } | 218 } |
| 220 | 219 |
| 221 if (needs_update) { | 220 if (needs_update) { |
| 222 ui::LatencyInfo latency = ui::LatencyInfo(ui::SourceEventType::WHEEL); | 221 ui::LatencyInfo latency = ui::LatencyInfo(ui::SourceEventType::WHEEL); |
| 223 latency.AddLatencyNumber( | 222 latency.AddLatencyNumber( |
| 224 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, | 223 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, |
| 225 0, 0); | 224 0); |
| 226 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency); | 225 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency); |
| 227 } | 226 } |
| 228 | 227 |
| 229 if (current_phase_ended) { | 228 if (current_phase_ended) { |
| 230 // Non-synthetic GSEs are sent when the current phase is canceled or | 229 // Non-synthetic GSEs are sent when the current phase is canceled or |
| 231 // ended. | 230 // ended. |
| 232 SendScrollEnd(scroll_update, false); | 231 SendScrollEnd(scroll_update, false); |
| 233 } else if (has_phase_info) { | 232 } else if (has_phase_info) { |
| 234 // Generate a synthetic GSE for every update to force hit testing so | 233 // Generate a synthetic GSE for every update to force hit testing so |
| 235 // that the non-latching behavior is preserved. Remove once | 234 // that the non-latching behavior is preserved. Remove once |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 scroll_begin.data.scroll_begin.delta_hint_units = | 330 scroll_begin.data.scroll_begin.delta_hint_units = |
| 332 gesture_update.data.scroll_update.delta_units; | 331 gesture_update.data.scroll_update.delta_units; |
| 333 | 332 |
| 334 needs_scroll_begin_ = false; | 333 needs_scroll_begin_ = false; |
| 335 needs_scroll_end_ = true; | 334 needs_scroll_end_ = true; |
| 336 client_->ForwardGestureEventWithLatencyInfo( | 335 client_->ForwardGestureEventWithLatencyInfo( |
| 337 scroll_begin, ui::LatencyInfo(ui::SourceEventType::WHEEL)); | 336 scroll_begin, ui::LatencyInfo(ui::SourceEventType::WHEEL)); |
| 338 } | 337 } |
| 339 | 338 |
| 340 } // namespace content | 339 } // namespace content |
| OLD | NEW |