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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 point.radiusX, | 103 point.radiusX, |
104 point.radiusY, | 104 point.radiusY, |
105 point.rotationAngle, | 105 point.rotationAngle, |
106 point.force); | 106 point.force); |
107 } | 107 } |
108 | 108 |
109 void ApppendEventDetails(const WebTouchEvent& event, std::string* result) { | 109 void ApppendEventDetails(const WebTouchEvent& event, std::string* result) { |
110 StringAppendF(result, | 110 StringAppendF(result, |
111 "{\n Touches: %u, Cancelable: %d, CausesScrolling: %d," | 111 "{\n Touches: %u, Cancelable: %d, CausesScrolling: %d," |
112 " uniqueTouchEventId: %u\n[\n", | 112 " uniqueTouchEventId: %u\n[\n", |
113 event.touchesLength, | 113 event.touchesLength, event.cancelable, |
114 event.cancelable, | 114 event.causesScrollingIfUncanceled, event.uniqueTouchEventId); |
115 event.causesScrollingIfUncanceled, | |
116 static_cast<uint32>(event.uniqueTouchEventId)); | |
117 for (unsigned i = 0; i < event.touchesLength; ++i) | 115 for (unsigned i = 0; i < event.touchesLength; ++i) |
118 ApppendTouchPointDetails(event.touches[i], result); | 116 ApppendTouchPointDetails(event.touches[i], result); |
119 result->append(" ]\n}"); | 117 result->append(" ]\n}"); |
120 } | 118 } |
121 | 119 |
122 bool CanCoalesce(const WebKeyboardEvent& event_to_coalesce, | 120 bool CanCoalesce(const WebKeyboardEvent& event_to_coalesce, |
123 const WebKeyboardEvent& event) { | 121 const WebKeyboardEvent& event) { |
124 return false; | 122 return false; |
125 } | 123 } |
126 | 124 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 event_to_coalesce, | 454 event_to_coalesce, |
457 &event); | 455 &event); |
458 } | 456 } |
459 | 457 |
460 void WebInputEventTraits::Coalesce(const WebInputEvent& event_to_coalesce, | 458 void WebInputEventTraits::Coalesce(const WebInputEvent& event_to_coalesce, |
461 WebInputEvent* event) { | 459 WebInputEvent* event) { |
462 DCHECK(event); | 460 DCHECK(event); |
463 Apply(WebInputEventCoalesce(), event->type, event_to_coalesce, event); | 461 Apply(WebInputEventCoalesce(), event->type, event_to_coalesce, event); |
464 } | 462 } |
465 | 463 |
466 bool WebInputEventTraits::IgnoresAckDisposition(const WebInputEvent& event) { | 464 bool WebInputEventTraits::WillReceiveAckFromRenderer( |
| 465 const WebInputEvent& event) { |
467 switch (event.type) { | 466 switch (event.type) { |
468 case WebInputEvent::MouseDown: | 467 case WebInputEvent::MouseDown: |
469 case WebInputEvent::MouseUp: | 468 case WebInputEvent::MouseUp: |
470 case WebInputEvent::MouseEnter: | 469 case WebInputEvent::MouseEnter: |
471 case WebInputEvent::MouseLeave: | 470 case WebInputEvent::MouseLeave: |
472 case WebInputEvent::ContextMenu: | 471 case WebInputEvent::ContextMenu: |
473 case WebInputEvent::GestureScrollBegin: | 472 case WebInputEvent::GestureScrollBegin: |
474 case WebInputEvent::GestureScrollEnd: | 473 case WebInputEvent::GestureScrollEnd: |
475 case WebInputEvent::GestureShowPress: | 474 case WebInputEvent::GestureShowPress: |
476 case WebInputEvent::GestureTapUnconfirmed: | 475 case WebInputEvent::GestureTapUnconfirmed: |
477 case WebInputEvent::GestureTapDown: | 476 case WebInputEvent::GestureTapDown: |
478 case WebInputEvent::GestureTapCancel: | 477 case WebInputEvent::GestureTapCancel: |
479 case WebInputEvent::GesturePinchBegin: | 478 case WebInputEvent::GesturePinchBegin: |
480 case WebInputEvent::GesturePinchEnd: | 479 case WebInputEvent::GesturePinchEnd: |
481 case WebInputEvent::TouchCancel: | 480 case WebInputEvent::TouchCancel: |
| 481 return false; |
| 482 case WebInputEvent::TouchStart: |
| 483 case WebInputEvent::TouchEnd: |
| 484 return static_cast<const WebTouchEvent&>(event).cancelable; |
| 485 default: |
482 return true; | 486 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 } | 487 } |
490 } | 488 } |
491 | 489 |
| 490 uint32 WebInputEventTraits::GetUniqueTouchEventId(const WebInputEvent& event) { |
| 491 if (WebInputEvent::isTouchEventType(event.type)) { |
| 492 return static_cast<const WebTouchEvent&>(event).uniqueTouchEventId; |
| 493 } |
| 494 return 0U; |
| 495 } |
| 496 |
492 } // namespace content | 497 } // namespace content |
OLD | NEW |