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

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

Issue 2256733003: Touchpad scroll latching enabled for Mac behind flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
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 "content/common/input/web_input_event_traits.h" 10 #include "content/common/input/web_input_event_traits.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // because the events generated will be a GSB (non-synthetic) and GSE 164 // because the events generated will be a GSB (non-synthetic) and GSE
165 // (non-synthetic). This situation arises when OSX generates double 165 // (non-synthetic). This situation arises when OSX generates double
166 // phase end information. 166 // phase end information.
167 bool empty_sequence = 167 bool empty_sequence =
168 !needs_update && needs_scroll_begin_ && current_phase_ended; 168 !needs_update && needs_scroll_begin_ && current_phase_ended;
169 169
170 if (needs_update || !empty_sequence) { 170 if (needs_update || !empty_sequence) {
171 if (needs_scroll_begin_) { 171 if (needs_scroll_begin_) {
172 // If no GSB has been sent, it will be a non-synthetic GSB. 172 // If no GSB has been sent, it will be a non-synthetic GSB.
173 SendScrollBegin(scroll_update, false); 173 SendScrollBegin(scroll_update, false);
174 } else if (has_phase_info) { 174 } else if (has_phase_info && !enable_scroll_latching_) {
175 // If a GSB has been sent, generate a synthetic GSB if we have phase
176 // information. This should be removed once crbug.com/526463 is fully
177 // implemented.
tdresser 2016/08/18 13:59:47 These comments are still relevant, aren't they?
sahel 2016/08/18 15:41:56 Done.
178 SendScrollBegin(scroll_update, true); 175 SendScrollBegin(scroll_update, true);
179 } 176 }
180 177
181 if (needs_update) { 178 if (needs_update) {
182 ui::LatencyInfo latency = ui::LatencyInfo(); 179 ui::LatencyInfo latency = ui::LatencyInfo();
183 latency.AddLatencyNumber( 180 latency.AddLatencyNumber(
184 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0, 181 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0,
185 0); 182 0);
186 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency); 183 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency);
187 } 184 }
188 185
189 if (current_phase_ended) { 186 if (current_phase_ended) {
190 // Non-synthetic GSEs are sent when the current phase is canceled or 187 // Non-synthetic GSEs are sent when the current phase is canceled or
191 // ended. 188 // ended.
192 SendScrollEnd(scroll_update, false); 189 SendScrollEnd(scroll_update, false);
193 } else if (has_phase_info) { 190 } else if (has_phase_info) {
194 // Generate a synthetic GSE for every update to force hit testing so 191 if (!enable_scroll_latching_)
195 // that the non-latching behavior is preserved. Remove once 192 SendScrollEnd(scroll_update, true);
196 // crbug.com/526463 is fully implemented.
197 SendScrollEnd(scroll_update, true);
198 } else { 193 } else {
199 scroll_end_timer_.Start( 194 scroll_end_timer_.Start(
200 FROM_HERE, 195 FROM_HERE,
201 base::TimeDelta::FromMilliseconds(scroll_transaction_ms_), 196 base::TimeDelta::FromMilliseconds(scroll_transaction_ms_),
202 base::Bind(&MouseWheelEventQueue::SendScrollEnd, 197 base::Bind(&MouseWheelEventQueue::SendScrollEnd,
203 base::Unretained(this), scroll_update, false)); 198 base::Unretained(this), scroll_update, false));
204 } 199 }
205 } 200 }
206 } 201 }
207 202
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 scroll_begin.data.scrollBegin.targetViewport = false; 281 scroll_begin.data.scrollBegin.targetViewport = false;
287 scroll_begin.data.scrollBegin.deltaHintUnits = 282 scroll_begin.data.scrollBegin.deltaHintUnits =
288 gesture_update.data.scrollUpdate.deltaUnits; 283 gesture_update.data.scrollUpdate.deltaUnits;
289 284
290 needs_scroll_begin_ = false; 285 needs_scroll_begin_ = false;
291 needs_scroll_end_ = true; 286 needs_scroll_end_ = true;
292 client_->ForwardGestureEventWithLatencyInfo(scroll_begin, ui::LatencyInfo()); 287 client_->ForwardGestureEventWithLatencyInfo(scroll_begin, ui::LatencyInfo());
293 } 288 }
294 289
295 } // namespace content 290 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698