| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 uncancelable) on the event. |
| 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 |
| OLD | NEW |