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

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

Issue 1888163003: Articulate the cancel behavior in the WebTouchEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify PlatformTouchEvent and address comments in patch set 1 Created 4 years, 8 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"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 point.radiusX, 104 point.radiusX,
105 point.radiusY, 105 point.radiusY,
106 point.rotationAngle, 106 point.rotationAngle,
107 point.force, 107 point.force,
108 point.tiltX, 108 point.tiltX,
109 point.tiltY); 109 point.tiltY);
110 } 110 }
111 111
112 void ApppendEventDetails(const WebTouchEvent& event, std::string* result) { 112 void ApppendEventDetails(const WebTouchEvent& event, std::string* result) {
113 StringAppendF(result, 113 StringAppendF(result,
114 "{\n Touches: %u, Cancelable: %d, CausesScrolling: %d," 114 "{\n Touches: %u, DispatchType: %d, CausesScrolling: %d,"
115 " uniqueTouchEventId: %u\n[\n", 115 " uniqueTouchEventId: %u\n[\n",
116 event.touchesLength, event.cancelable, 116 event.touchesLength, event.dispatchType,
117 event.movedBeyondSlopRegion, event.uniqueTouchEventId); 117 event.movedBeyondSlopRegion, event.uniqueTouchEventId);
118 for (unsigned i = 0; i < event.touchesLength; ++i) 118 for (unsigned i = 0; i < event.touchesLength; ++i)
119 ApppendTouchPointDetails(event.touches[i], result); 119 ApppendTouchPointDetails(event.touches[i], result);
120 result->append(" ]\n}"); 120 result->append(" ]\n}");
121 } 121 }
122 122
123 bool CanCoalesce(const WebKeyboardEvent& event_to_coalesce, 123 bool CanCoalesce(const WebKeyboardEvent& event_to_coalesce,
124 const WebKeyboardEvent& event) { 124 const WebKeyboardEvent& event) {
125 return false; 125 return false;
126 } 126 }
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 case WebInputEvent::MouseLeave: 474 case WebInputEvent::MouseLeave:
475 case WebInputEvent::ContextMenu: 475 case WebInputEvent::ContextMenu:
476 case WebInputEvent::GestureScrollBegin: 476 case WebInputEvent::GestureScrollBegin:
477 case WebInputEvent::GestureScrollEnd: 477 case WebInputEvent::GestureScrollEnd:
478 case WebInputEvent::GestureShowPress: 478 case WebInputEvent::GestureShowPress:
479 case WebInputEvent::GestureTapUnconfirmed: 479 case WebInputEvent::GestureTapUnconfirmed:
480 case WebInputEvent::GestureTapDown: 480 case WebInputEvent::GestureTapDown:
481 case WebInputEvent::GestureTapCancel: 481 case WebInputEvent::GestureTapCancel:
482 case WebInputEvent::GesturePinchBegin: 482 case WebInputEvent::GesturePinchBegin:
483 case WebInputEvent::GesturePinchEnd: 483 case WebInputEvent::GesturePinchEnd:
484 return false;
485
486 // Touch cancel should always be non-blocking.
484 case WebInputEvent::TouchCancel: 487 case WebInputEvent::TouchCancel:
488 DCHECK_NE(WebInputEvent::Blocking,
489 static_cast<const WebTouchEvent&>(event).dispatchType);
485 return false; 490 return false;
491
492 // Touch start and touch end indicate whether they are non-blocking
493 // (aka cancelable) on the event.
tdresser 2016/04/18 19:40:45 The aka here is backwards. non-blocking -> uncanc
dtapuska 2016/04/18 20:09:09 Done.
486 case WebInputEvent::TouchStart: 494 case WebInputEvent::TouchStart:
487 case WebInputEvent::TouchEnd: 495 case WebInputEvent::TouchEnd:
488 return static_cast<const WebTouchEvent&>(event).cancelable; 496 return static_cast<const WebTouchEvent&>(event).dispatchType ==
497 WebInputEvent::Blocking;
498
499 // Touch move events may be non-blocking but are always explicitly
500 // acknowledge by the renderer so they block the event stream.
501 case WebInputEvent::TouchMove:
489 default: 502 default:
490 return true; 503 return true;
491 } 504 }
492 } 505 }
493 506
494 uint32_t WebInputEventTraits::GetUniqueTouchEventId( 507 uint32_t WebInputEventTraits::GetUniqueTouchEventId(
495 const WebInputEvent& event) { 508 const WebInputEvent& event) {
496 if (WebInputEvent::isTouchEventType(event.type)) { 509 if (WebInputEvent::isTouchEventType(event.type)) {
497 return static_cast<const WebTouchEvent&>(event).uniqueTouchEventId; 510 return static_cast<const WebTouchEvent&>(event).uniqueTouchEventId;
498 } 511 }
499 return 0U; 512 return 0U;
500 } 513 }
501 514
502 } // namespace content 515 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698