| 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" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 | 12 |
| 13 using base::StringAppendF; | 13 using base::StringAppendF; |
| 14 using base::SStringPrintf; | 14 //using base::SStringPrintf; |
| 15 using blink::WebGestureEvent; | 15 using blink::WebGestureEvent; |
| 16 using blink::WebInputEvent; | 16 using blink::WebInputEvent; |
| 17 using blink::WebKeyboardEvent; | 17 using blink::WebKeyboardEvent; |
| 18 using blink::WebMouseEvent; | 18 using blink::WebMouseEvent; |
| 19 using blink::WebMouseWheelEvent; | 19 using blink::WebMouseWheelEvent; |
| 20 using blink::WebTouchEvent; | 20 using blink::WebTouchEvent; |
| 21 using blink::WebTouchPoint; | 21 using blink::WebTouchPoint; |
| 22 using std::numeric_limits; | 22 using std::numeric_limits; |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 if (event->data.pinchUpdate.scale < numeric_limits<float>::min()) | 278 if (event->data.pinchUpdate.scale < numeric_limits<float>::min()) |
| 279 event->data.pinchUpdate.scale = numeric_limits<float>::min(); | 279 event->data.pinchUpdate.scale = numeric_limits<float>::min(); |
| 280 else if (event->data.pinchUpdate.scale > numeric_limits<float>::max()) | 280 else if (event->data.pinchUpdate.scale > numeric_limits<float>::max()) |
| 281 event->data.pinchUpdate.scale = numeric_limits<float>::max(); | 281 event->data.pinchUpdate.scale = numeric_limits<float>::max(); |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 | 284 |
| 285 struct WebInputEventToString { | 285 struct WebInputEventToString { |
| 286 template <class EventType> | 286 template <class EventType> |
| 287 bool Execute(const WebInputEvent& event, std::string* result) const { | 287 bool Execute(const WebInputEvent& event, std::string* result) const { |
| 288 SStringPrintf(result, "%s (Time: %lf, Modifiers: %d)\n", | 288 /*SStringPrintf(result, "%s (Time: %lf, Modifiers: %d)\n", |
| 289 WebInputEventTraits::GetName(event.type), | 289 WebInputEventTraits::GetName(event.type), |
| 290 event.timeStampSeconds, | 290 event.timeStampSeconds, |
| 291 event.modifiers); | 291 event.modifiers);*/ |
| 292 const EventType& typed_event = static_cast<const EventType&>(event); | 292 const EventType& typed_event = static_cast<const EventType&>(event); |
| 293 ApppendEventDetails(typed_event, result); | 293 ApppendEventDetails(typed_event, result); |
| 294 return true; | 294 return true; |
| 295 } | 295 } |
| 296 }; | 296 }; |
| 297 | 297 |
| 298 struct WebInputEventSize { | 298 struct WebInputEventSize { |
| 299 template <class EventType> | 299 template <class EventType> |
| 300 bool Execute(WebInputEvent::Type /* type */, size_t* type_size) const { | 300 bool Execute(WebInputEvent::Type /* type */, size_t* type_size) const { |
| 301 *type_size = sizeof(EventType); | 301 *type_size = sizeof(EventType); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 } | 490 } |
| 491 | 491 |
| 492 uint32 WebInputEventTraits::GetUniqueTouchEventId(const WebInputEvent& event) { | 492 uint32 WebInputEventTraits::GetUniqueTouchEventId(const WebInputEvent& event) { |
| 493 if (WebInputEvent::isTouchEventType(event.type)) { | 493 if (WebInputEvent::isTouchEventType(event.type)) { |
| 494 return static_cast<const WebTouchEvent&>(event).uniqueTouchEventId; | 494 return static_cast<const WebTouchEvent&>(event).uniqueTouchEventId; |
| 495 } | 495 } |
| 496 return 0U; | 496 return 0U; |
| 497 } | 497 } |
| 498 | 498 |
| 499 } // namespace content | 499 } // namespace content |
| OLD | NEW |