| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, Cancelable: %d, CausesScrolling: %d," |
| 115 " uniqueTouchEventId: %u\n[\n", | 115 " uniqueTouchEventId: %u\n[\n", |
| 116 event.touchesLength, event.cancelable, | 116 event.touchesLength, event.cancelable, |
| 117 event.causesScrollingIfUncanceled, 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 } |
| 127 | 127 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // correct state, i.e. the touch-points that moved in the last event, but | 233 // correct state, i.e. the touch-points that moved in the last event, but |
| 234 // didn't change in the current event, will have Stationary state. It is | 234 // didn't change in the current event, will have Stationary state. It is |
| 235 // necessary to change them back to Moved state. | 235 // necessary to change them back to Moved state. |
| 236 WebTouchEvent old_event = *event; | 236 WebTouchEvent old_event = *event; |
| 237 *event = event_to_coalesce; | 237 *event = event_to_coalesce; |
| 238 for (unsigned i = 0; i < event->touchesLength; ++i) { | 238 for (unsigned i = 0; i < event->touchesLength; ++i) { |
| 239 int i_old = GetIndexOfTouchID(old_event, event->touches[i].id); | 239 int i_old = GetIndexOfTouchID(old_event, event->touches[i].id); |
| 240 if (old_event.touches[i_old].state == blink::WebTouchPoint::StateMoved) | 240 if (old_event.touches[i_old].state == blink::WebTouchPoint::StateMoved) |
| 241 event->touches[i].state = blink::WebTouchPoint::StateMoved; | 241 event->touches[i].state = blink::WebTouchPoint::StateMoved; |
| 242 } | 242 } |
| 243 event->causesScrollingIfUncanceled |= old_event.causesScrollingIfUncanceled; | 243 event->movedBeyondSlopRegion |= old_event.movedBeyondSlopRegion; |
| 244 } | 244 } |
| 245 | 245 |
| 246 bool CanCoalesce(const WebGestureEvent& event_to_coalesce, | 246 bool CanCoalesce(const WebGestureEvent& event_to_coalesce, |
| 247 const WebGestureEvent& event) { | 247 const WebGestureEvent& event) { |
| 248 if (event.type != event_to_coalesce.type || | 248 if (event.type != event_to_coalesce.type || |
| 249 event.sourceDevice != event_to_coalesce.sourceDevice || | 249 event.sourceDevice != event_to_coalesce.sourceDevice || |
| 250 event.modifiers != event_to_coalesce.modifiers) | 250 event.modifiers != event_to_coalesce.modifiers) |
| 251 return false; | 251 return false; |
| 252 | 252 |
| 253 if (event.type == WebInputEvent::GestureScrollUpdate) | 253 if (event.type == WebInputEvent::GestureScrollUpdate) |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 494 |
| 495 uint32_t WebInputEventTraits::GetUniqueTouchEventId( | 495 uint32_t WebInputEventTraits::GetUniqueTouchEventId( |
| 496 const WebInputEvent& event) { | 496 const WebInputEvent& event) { |
| 497 if (WebInputEvent::isTouchEventType(event.type)) { | 497 if (WebInputEvent::isTouchEventType(event.type)) { |
| 498 return static_cast<const WebTouchEvent&>(event).uniqueTouchEventId; | 498 return static_cast<const WebTouchEvent&>(event).uniqueTouchEventId; |
| 499 } | 499 } |
| 500 return 0U; | 500 return 0U; |
| 501 } | 501 } |
| 502 | 502 |
| 503 } // namespace content | 503 } // namespace content |
| OLD | NEW |