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

Side by Side Diff: content/common/input/web_input_event_traits.cc

Issue 997283002: Coalesce async touch move events until the ack back from render (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ack struct and unittest Created 5 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/input/web_input_event_traits.h" 5 #include "content/common/input/web_input_event_traits.h"
6 6
7 #include <bitset> 7 #include <bitset>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "content/common/input_messages.h"
jdduke (slow) 2015/05/07 21:11:16 I think we can remove this include.
12 13
13 using base::StringAppendF; 14 using base::StringAppendF;
14 using base::SStringPrintf; 15 using base::SStringPrintf;
15 using blink::WebGestureEvent; 16 using blink::WebGestureEvent;
16 using blink::WebInputEvent; 17 using blink::WebInputEvent;
17 using blink::WebKeyboardEvent; 18 using blink::WebKeyboardEvent;
18 using blink::WebMouseEvent; 19 using blink::WebMouseEvent;
19 using blink::WebMouseWheelEvent; 20 using blink::WebMouseWheelEvent;
20 using blink::WebTouchEvent; 21 using blink::WebTouchEvent;
21 using blink::WebTouchPoint; 22 using blink::WebTouchPoint;
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 event_to_coalesce, 457 event_to_coalesce,
457 &event); 458 &event);
458 } 459 }
459 460
460 void WebInputEventTraits::Coalesce(const WebInputEvent& event_to_coalesce, 461 void WebInputEventTraits::Coalesce(const WebInputEvent& event_to_coalesce,
461 WebInputEvent* event) { 462 WebInputEvent* event) {
462 DCHECK(event); 463 DCHECK(event);
463 Apply(WebInputEventCoalesce(), event->type, event_to_coalesce, event); 464 Apply(WebInputEventCoalesce(), event->type, event_to_coalesce, event);
464 } 465 }
465 466
466 bool WebInputEventTraits::IgnoresAckDisposition(const WebInputEvent& event) { 467 bool WebInputEventTraits::WillReceiveAckFromRenderer(
468 const WebInputEvent& event) {
467 switch (event.type) { 469 switch (event.type) {
468 case WebInputEvent::MouseDown: 470 case WebInputEvent::MouseDown:
469 case WebInputEvent::MouseUp: 471 case WebInputEvent::MouseUp:
470 case WebInputEvent::MouseEnter: 472 case WebInputEvent::MouseEnter:
471 case WebInputEvent::MouseLeave: 473 case WebInputEvent::MouseLeave:
472 case WebInputEvent::ContextMenu: 474 case WebInputEvent::ContextMenu:
473 case WebInputEvent::GestureScrollBegin: 475 case WebInputEvent::GestureScrollBegin:
474 case WebInputEvent::GestureScrollEnd: 476 case WebInputEvent::GestureScrollEnd:
475 case WebInputEvent::GestureShowPress: 477 case WebInputEvent::GestureShowPress:
476 case WebInputEvent::GestureTapUnconfirmed: 478 case WebInputEvent::GestureTapUnconfirmed:
477 case WebInputEvent::GestureTapDown: 479 case WebInputEvent::GestureTapDown:
478 case WebInputEvent::GestureTapCancel: 480 case WebInputEvent::GestureTapCancel:
479 case WebInputEvent::GesturePinchBegin: 481 case WebInputEvent::GesturePinchBegin:
480 case WebInputEvent::GesturePinchEnd: 482 case WebInputEvent::GesturePinchEnd:
481 case WebInputEvent::TouchCancel: 483 case WebInputEvent::TouchCancel:
484 return false;
485 case WebInputEvent::TouchStart:
486 case WebInputEvent::TouchEnd:
487 return static_cast<const WebTouchEvent&>(event).cancelable;
488 default:
482 return true; 489 return true;
483 case WebInputEvent::TouchStart:
484 case WebInputEvent::TouchMove:
485 case WebInputEvent::TouchEnd:
486 return !static_cast<const WebTouchEvent&>(event).cancelable;
487 default:
488 return false;
489 } 490 }
490 } 491 }
491 492
493 uint32 WebInputEventTraits::GetUniqueTouchEventId(const WebInputEvent& event) {
494 if (WebInputEvent::isTouchEventType(event.type)) {
495 return static_cast<const WebTouchEvent&>(event).uniqueTouchEventId;
496 }
497 return 0U;
498 }
499
492 } // namespace content 500 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698