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

Side by Side Diff: content/renderer/input/render_widget_input_handler.cc

Issue 2479123003: WIP Add getCoalescedEvents API using vector of WebInputEvents (Closed)
Patch Set: Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/renderer/input/render_widget_input_handler.h" 5 #include "content/renderer/input/render_widget_input_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 suppress_next_char_events_(false) { 183 suppress_next_char_events_(false) {
184 DCHECK(delegate); 184 DCHECK(delegate);
185 DCHECK(widget); 185 DCHECK(widget);
186 delegate->SetInputHandler(this); 186 delegate->SetInputHandler(this);
187 } 187 }
188 188
189 RenderWidgetInputHandler::~RenderWidgetInputHandler() {} 189 RenderWidgetInputHandler::~RenderWidgetInputHandler() {}
190 190
191 void RenderWidgetInputHandler::HandleInputEvent( 191 void RenderWidgetInputHandler::HandleInputEvent(
192 const WebInputEvent& input_event, 192 const WebInputEvent& input_event,
193 const std::vector<const WebInputEvent*>& coalescedEvents,
193 const ui::LatencyInfo& latency_info, 194 const ui::LatencyInfo& latency_info,
194 InputEventDispatchType dispatch_type) { 195 InputEventDispatchType dispatch_type) {
195 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_, 196 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_,
196 true); 197 true);
197 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( 198 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter(
198 &handling_event_type_, input_event.type); 199 &handling_event_type_, input_event.type);
199 200
200 // Calls into |didOverscroll()| while handling this event will populate 201 // Calls into |didOverscroll()| while handling this event will populate
201 // |event_overscroll|, which in turn will be bundled with the event ack. 202 // |event_overscroll|, which in turn will be bundled with the event ack.
202 std::unique_ptr<DidOverscrollParams> event_overscroll; 203 std::unique_ptr<DidOverscrollParams> event_overscroll;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 prevent_default = 309 prevent_default =
309 prevent_default || delegate_->WillHandleGestureEvent(gesture_event); 310 prevent_default || delegate_->WillHandleGestureEvent(gesture_event);
310 } 311 }
311 312
312 WebInputEventResult processed = prevent_default 313 WebInputEventResult processed = prevent_default
313 ? WebInputEventResult::HandledSuppressed 314 ? WebInputEventResult::HandledSuppressed
314 : WebInputEventResult::NotHandled; 315 : WebInputEventResult::NotHandled;
315 if (input_event.type != WebInputEvent::Char || !suppress_next_char_events_) { 316 if (input_event.type != WebInputEvent::Char || !suppress_next_char_events_) {
316 suppress_next_char_events_ = false; 317 suppress_next_char_events_ = false;
317 if (processed == WebInputEventResult::NotHandled && widget_->GetWebWidget()) 318 if (processed == WebInputEventResult::NotHandled && widget_->GetWebWidget())
318 processed = widget_->GetWebWidget()->handleInputEvent(input_event); 319 processed = widget_->GetWebWidget()->handleInputEvent(input_event,
320 coalescedEvents);
319 } 321 }
320 322
321 // TODO(dtapuska): Use the input_event.timeStampSeconds as the start 323 // TODO(dtapuska): Use the input_event.timeStampSeconds as the start
322 // ideally this should be when the event was sent by the compositor to the 324 // ideally this should be when the event was sent by the compositor to the
323 // renderer. crbug.com/565348 325 // renderer. crbug.com/565348
324 if (input_event.type == WebInputEvent::TouchStart || 326 if (input_event.type == WebInputEvent::TouchStart ||
325 input_event.type == WebInputEvent::TouchMove || 327 input_event.type == WebInputEvent::TouchMove ||
326 input_event.type == WebInputEvent::TouchEnd) { 328 input_event.type == WebInputEvent::TouchEnd) {
327 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event); 329 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event);
328 330
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 // it can be bundled in the event ack. 471 // it can be bundled in the event ack.
470 if (handling_event_overscroll_) { 472 if (handling_event_overscroll_) {
471 *handling_event_overscroll_ = std::move(params); 473 *handling_event_overscroll_ = std::move(params);
472 return; 474 return;
473 } 475 }
474 476
475 delegate_->OnDidOverscroll(*params); 477 delegate_->OnDidOverscroll(*params);
476 } 478 }
477 479
478 } // namespace content 480 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698