| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/core/dom/Element.h" | 6 #include "sky/engine/core/dom/Element.h" |
| 7 #include "sky/engine/core/events/GestureEvent.h" | 7 #include "sky/engine/core/events/GestureEvent.h" |
| 8 #include "sky/engine/wtf/text/AtomicString.h" | 8 #include "sky/engine/wtf/text/AtomicString.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 return EventNames::GestureEvent; | 60 return EventNames::GestureEvent; |
| 61 } | 61 } |
| 62 | 62 |
| 63 GestureEvent::GestureEvent() | 63 GestureEvent::GestureEvent() |
| 64 : GestureEvent(AtomicString(), GestureEventInit()) | 64 : GestureEvent(AtomicString(), GestureEventInit()) |
| 65 { | 65 { |
| 66 } | 66 } |
| 67 | 67 |
| 68 GestureEvent::GestureEvent(const WebGestureEvent& event) | 68 GestureEvent::GestureEvent(const WebGestureEvent& event) |
| 69 : Event(stringForType(event.type), true, true) | 69 : Event(stringForType(event.type), true, true) |
| 70 , m_primaryPointer(event.primaryPointer) |
| 70 , m_x(event.x) | 71 , m_x(event.x) |
| 71 , m_y(event.y) | 72 , m_y(event.y) |
| 72 , m_dx(0) | 73 , m_dx(0) |
| 73 , m_dy(0) | 74 , m_dy(0) |
| 74 , m_velocityX(0) | 75 , m_velocityX(0) |
| 75 , m_velocityY(0) | 76 , m_velocityY(0) |
| 76 { | 77 { |
| 77 m_timeStamp = event.timeStampMS; | 78 m_timeStamp = event.timeStampMS; |
| 78 | 79 |
| 79 if (event.type == WebInputEvent::GestureFlingStart) { | 80 if (event.type == WebInputEvent::GestureFlingStart) { |
| 80 m_velocityX = event.data.flingStart.velocityX; | 81 m_velocityX = event.data.flingStart.velocityX; |
| 81 m_velocityY = event.data.flingStart.velocityY; | 82 m_velocityY = event.data.flingStart.velocityY; |
| 82 } else if (event.type == WebInputEvent::GestureScrollUpdate | 83 } else if (event.type == WebInputEvent::GestureScrollUpdate |
| 83 || event.type == WebInputEvent::GestureScrollUpdateWithoutPropagatio
n) { | 84 || event.type == WebInputEvent::GestureScrollUpdateWithoutPropagatio
n) { |
| 84 m_dx = event.data.scrollUpdate.deltaX; | 85 m_dx = event.data.scrollUpdate.deltaX; |
| 85 m_dy = event.data.scrollUpdate.deltaY; | 86 m_dy = event.data.scrollUpdate.deltaY; |
| 86 m_velocityX = event.data.scrollUpdate.velocityX; | 87 m_velocityX = event.data.scrollUpdate.velocityX; |
| 87 m_velocityY = event.data.scrollUpdate.velocityY; | 88 m_velocityY = event.data.scrollUpdate.velocityY; |
| 88 } | 89 } |
| 89 } | 90 } |
| 90 | 91 |
| 91 GestureEvent::GestureEvent(const AtomicString& type, const GestureEventInit& ini
tializer) | 92 GestureEvent::GestureEvent(const AtomicString& type, const GestureEventInit& ini
tializer) |
| 92 : Event(type, initializer) | 93 : Event(type, initializer) |
| 94 , m_primaryPointer(initializer.primaryPointer) |
| 93 , m_x(initializer.x) | 95 , m_x(initializer.x) |
| 94 , m_y(initializer.y) | 96 , m_y(initializer.y) |
| 95 , m_dx(initializer.dx) | 97 , m_dx(initializer.dx) |
| 96 , m_dy(initializer.dy) | 98 , m_dy(initializer.dy) |
| 97 , m_velocityX(initializer.velocityX) | 99 , m_velocityX(initializer.velocityX) |
| 98 , m_velocityY(initializer.velocityY) | 100 , m_velocityY(initializer.velocityY) |
| 99 { | 101 { |
| 100 } | 102 } |
| 101 | 103 |
| 102 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |