| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 if (enable_scroll_latching_) { | 176 if (enable_scroll_latching_) { |
| 177 if (event_sent_for_gesture_ack_->event.phase == | 177 if (event_sent_for_gesture_ack_->event.phase == |
| 178 blink::WebMouseWheelEvent::kPhaseBegan) { | 178 blink::WebMouseWheelEvent::kPhaseBegan) { |
| 179 SendScrollBegin(scroll_update, false); | 179 SendScrollBegin(scroll_update, false); |
| 180 } | 180 } |
| 181 | 181 |
| 182 if (needs_update) { | 182 if (needs_update) { |
| 183 ui::LatencyInfo latency = ui::LatencyInfo(ui::SourceEventType::WHEEL); | 183 ui::LatencyInfo latency = ui::LatencyInfo(ui::SourceEventType::WHEEL); |
| 184 latency.AddLatencyNumber( | 184 latency.AddLatencyNumber( |
| 185 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0, | 185 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0); |
| 186 0); | |
| 187 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency); | 186 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency); |
| 188 } | 187 } |
| 189 | 188 |
| 190 if (current_phase_ended) { | 189 if (current_phase_ended) { |
| 191 // Send GSE with if scroll latching is enabled and no fling is going | 190 // Send GSE with if scroll latching is enabled and no fling is going |
| 192 // to happen next. | 191 // to happen next. |
| 193 SendScrollEnd(scroll_update, false); | 192 SendScrollEnd(scroll_update, false); |
| 194 } | 193 } |
| 195 } else { // !enable_scroll_latching_ | 194 } else { // !enable_scroll_latching_ |
| 196 | 195 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 209 // If a GSB has been sent, generate a synthetic GSB if we have phase | 208 // If a GSB has been sent, generate a synthetic GSB if we have phase |
| 210 // information. This should be removed once crbug.com/526463 is | 209 // information. This should be removed once crbug.com/526463 is |
| 211 // fully implemented. | 210 // fully implemented. |
| 212 SendScrollBegin(scroll_update, true); | 211 SendScrollBegin(scroll_update, true); |
| 213 } | 212 } |
| 214 | 213 |
| 215 if (needs_update) { | 214 if (needs_update) { |
| 216 ui::LatencyInfo latency = ui::LatencyInfo(ui::SourceEventType::WHEEL); | 215 ui::LatencyInfo latency = ui::LatencyInfo(ui::SourceEventType::WHEEL); |
| 217 latency.AddLatencyNumber( | 216 latency.AddLatencyNumber( |
| 218 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, | 217 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, |
| 219 0, 0); | 218 0); |
| 220 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency); | 219 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency); |
| 221 } | 220 } |
| 222 | 221 |
| 223 if (current_phase_ended) { | 222 if (current_phase_ended) { |
| 224 // Non-synthetic GSEs are sent when the current phase is canceled or | 223 // Non-synthetic GSEs are sent when the current phase is canceled or |
| 225 // ended. | 224 // ended. |
| 226 SendScrollEnd(scroll_update, false); | 225 SendScrollEnd(scroll_update, false); |
| 227 } else if (has_phase_info) { | 226 } else if (has_phase_info) { |
| 228 // Generate a synthetic GSE for every update to force hit testing so | 227 // Generate a synthetic GSE for every update to force hit testing so |
| 229 // that the non-latching behavior is preserved. Remove once | 228 // that the non-latching behavior is preserved. Remove once |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 scroll_begin.data.scroll_begin.delta_hint_units = | 310 scroll_begin.data.scroll_begin.delta_hint_units = |
| 312 gesture_update.data.scroll_update.delta_units; | 311 gesture_update.data.scroll_update.delta_units; |
| 313 | 312 |
| 314 needs_scroll_begin_ = false; | 313 needs_scroll_begin_ = false; |
| 315 needs_scroll_end_ = true; | 314 needs_scroll_end_ = true; |
| 316 client_->ForwardGestureEventWithLatencyInfo( | 315 client_->ForwardGestureEventWithLatencyInfo( |
| 317 scroll_begin, ui::LatencyInfo(ui::SourceEventType::WHEEL)); | 316 scroll_begin, ui::LatencyInfo(ui::SourceEventType::WHEEL)); |
| 318 } | 317 } |
| 319 | 318 |
| 320 } // namespace content | 319 } // namespace content |
| OLD | NEW |