| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "public/platform/WebCoalescedInputEvent.h" | 5 #include "public/platform/WebCoalescedInputEvent.h" |
| 6 | 6 |
| 7 #include "public/platform/WebGestureEvent.h" | 7 #include "public/platform/WebGestureEvent.h" |
| 8 #include "public/platform/WebKeyboardEvent.h" | 8 #include "public/platform/WebKeyboardEvent.h" |
| 9 #include "public/platform/WebMouseWheelEvent.h" | 9 #include "public/platform/WebMouseWheelEvent.h" |
| 10 #include "public/platform/WebTouchEvent.h" | 10 #include "public/platform/WebTouchEvent.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 WebCoalescedInputEvent::WebCoalescedInputEvent( | 87 WebCoalescedInputEvent::WebCoalescedInputEvent( |
| 88 const WebInputEvent& event, | 88 const WebInputEvent& event, |
| 89 const std::vector<const WebInputEvent*>& coalesced_events) { | 89 const std::vector<const WebInputEvent*>& coalesced_events) { |
| 90 event_ = MakeWebScopedInputEvent(event); | 90 event_ = MakeWebScopedInputEvent(event); |
| 91 for (const auto& coalesced_event : coalesced_events) | 91 for (const auto& coalesced_event : coalesced_events) |
| 92 coalesced_events_.push_back(MakeWebScopedInputEvent(*coalesced_event)); | 92 coalesced_events_.push_back(MakeWebScopedInputEvent(*coalesced_event)); |
| 93 } | 93 } |
| 94 | 94 |
| 95 WebCoalescedInputEvent::WebCoalescedInputEvent( |
| 96 const WebCoalescedInputEvent& event) |
| 97 : WebCoalescedInputEvent(event.Event(), |
| 98 event.GetCoalescedEventsPointers()) {} |
| 99 |
| 95 WebCoalescedInputEvent::WebScopedInputEvent | 100 WebCoalescedInputEvent::WebScopedInputEvent |
| 96 WebCoalescedInputEvent::MakeWebScopedInputEvent( | 101 WebCoalescedInputEvent::MakeWebScopedInputEvent( |
| 97 const blink::WebInputEvent& event) { | 102 const blink::WebInputEvent& event) { |
| 98 if (blink::WebInputEvent::IsGestureEventType(event.GetType())) { | 103 if (blink::WebInputEvent::IsGestureEventType(event.GetType())) { |
| 99 return WebScopedInputEvent(new blink::WebGestureEvent( | 104 return WebScopedInputEvent(new blink::WebGestureEvent( |
| 100 static_cast<const blink::WebGestureEvent&>(event))); | 105 static_cast<const blink::WebGestureEvent&>(event))); |
| 101 } | 106 } |
| 102 if (blink::WebInputEvent::IsMouseEventType(event.GetType())) { | 107 if (blink::WebInputEvent::IsMouseEventType(event.GetType())) { |
| 103 return WebScopedInputEvent(new blink::WebMouseEvent( | 108 return WebScopedInputEvent(new blink::WebMouseEvent( |
| 104 static_cast<const blink::WebMouseEvent&>(event))); | 109 static_cast<const blink::WebMouseEvent&>(event))); |
| 105 } | 110 } |
| 106 if (blink::WebInputEvent::IsTouchEventType(event.GetType())) { | 111 if (blink::WebInputEvent::IsTouchEventType(event.GetType())) { |
| 107 return WebScopedInputEvent(new blink::WebTouchEvent( | 112 return WebScopedInputEvent(new blink::WebTouchEvent( |
| 108 static_cast<const blink::WebTouchEvent&>(event))); | 113 static_cast<const blink::WebTouchEvent&>(event))); |
| 109 } | 114 } |
| 110 if (event.GetType() == blink::WebInputEvent::kMouseWheel) { | 115 if (event.GetType() == blink::WebInputEvent::kMouseWheel) { |
| 111 return WebScopedInputEvent(new blink::WebMouseWheelEvent( | 116 return WebScopedInputEvent(new blink::WebMouseWheelEvent( |
| 112 static_cast<const blink::WebMouseWheelEvent&>(event))); | 117 static_cast<const blink::WebMouseWheelEvent&>(event))); |
| 113 } | 118 } |
| 114 if (blink::WebInputEvent::IsKeyboardEventType(event.GetType())) { | 119 if (blink::WebInputEvent::IsKeyboardEventType(event.GetType())) { |
| 115 return WebScopedInputEvent(new blink::WebKeyboardEvent( | 120 return WebScopedInputEvent(new blink::WebKeyboardEvent( |
| 116 static_cast<const blink::WebKeyboardEvent&>(event))); | 121 static_cast<const blink::WebKeyboardEvent&>(event))); |
| 117 } | 122 } |
| 118 NOTREACHED(); | 123 NOTREACHED(); |
| 119 return WebScopedInputEvent(); | 124 return WebScopedInputEvent(); |
| 120 } | 125 } |
| 121 | 126 |
| 122 } // namespace blink | 127 } // namespace blink |
| OLD | NEW |