| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #ifndef DeviceMotionEvent_h | 26 #ifndef DeviceMotionEvent_h |
| 27 #define DeviceMotionEvent_h | 27 #define DeviceMotionEvent_h |
| 28 | 28 |
| 29 #include "modules/EventModules.h" | 29 #include "modules/EventModules.h" |
| 30 #include "platform/heap/Handle.h" | 30 #include "platform/heap/Handle.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 class DeviceAcceleration; | 34 class DeviceAcceleration; |
| 35 class DeviceMotionData; | 35 class DeviceMotionData; |
| 36 class DeviceMotionEventInit; |
| 36 class DeviceRotationRate; | 37 class DeviceRotationRate; |
| 37 | 38 |
| 38 class DeviceMotionEvent final : public Event { | 39 class DeviceMotionEvent final : public Event { |
| 39 DEFINE_WRAPPERTYPEINFO(); | 40 DEFINE_WRAPPERTYPEINFO(); |
| 40 | 41 |
| 41 public: | 42 public: |
| 42 ~DeviceMotionEvent() override; | 43 ~DeviceMotionEvent() override; |
| 43 static DeviceMotionEvent* create() { return new DeviceMotionEvent; } | 44 static DeviceMotionEvent* create() { return new DeviceMotionEvent; } |
| 44 static DeviceMotionEvent* create(const AtomicString& eventType, | 45 static DeviceMotionEvent* create(const AtomicString& eventType, |
| 46 const DeviceMotionEventInit& initializer) { |
| 47 return new DeviceMotionEvent(eventType, initializer); |
| 48 } |
| 49 static DeviceMotionEvent* create(const AtomicString& eventType, |
| 45 DeviceMotionData* deviceMotionData) { | 50 DeviceMotionData* deviceMotionData) { |
| 46 return new DeviceMotionEvent(eventType, deviceMotionData); | 51 return new DeviceMotionEvent(eventType, deviceMotionData); |
| 47 } | 52 } |
| 48 | 53 |
| 49 void initDeviceMotionEvent(const AtomicString& type, | 54 void initDeviceMotionEvent(const AtomicString& type, |
| 50 bool bubbles, | 55 bool bubbles, |
| 51 bool cancelable, | 56 bool cancelable, |
| 52 DeviceMotionData*); | 57 DeviceMotionData*); |
| 53 | 58 |
| 54 DeviceMotionData* getDeviceMotionData() const { | 59 DeviceMotionData* getDeviceMotionData() const { |
| 55 return m_deviceMotionData.get(); | 60 return m_deviceMotionData.get(); |
| 56 } | 61 } |
| 57 | 62 |
| 58 DeviceAcceleration* acceleration(); | 63 DeviceAcceleration* acceleration(); |
| 59 DeviceAcceleration* accelerationIncludingGravity(); | 64 DeviceAcceleration* accelerationIncludingGravity(); |
| 60 DeviceRotationRate* rotationRate(); | 65 DeviceRotationRate* rotationRate(); |
| 61 double interval(bool& isNull) const; | 66 double interval(bool& isNull) const; |
| 62 | 67 |
| 63 const AtomicString& interfaceName() const override; | 68 const AtomicString& interfaceName() const override; |
| 64 | 69 |
| 65 DECLARE_VIRTUAL_TRACE(); | 70 DECLARE_VIRTUAL_TRACE(); |
| 66 | 71 |
| 67 private: | 72 private: |
| 68 DeviceMotionEvent(); | 73 DeviceMotionEvent(); |
| 74 DeviceMotionEvent(const AtomicString&, const DeviceMotionEventInit&); |
| 69 DeviceMotionEvent(const AtomicString& eventType, DeviceMotionData*); | 75 DeviceMotionEvent(const AtomicString& eventType, DeviceMotionData*); |
| 70 | 76 |
| 71 Member<DeviceMotionData> m_deviceMotionData; | 77 Member<DeviceMotionData> m_deviceMotionData; |
| 72 Member<DeviceAcceleration> m_acceleration; | 78 Member<DeviceAcceleration> m_acceleration; |
| 73 Member<DeviceAcceleration> m_accelerationIncludingGravity; | 79 Member<DeviceAcceleration> m_accelerationIncludingGravity; |
| 74 Member<DeviceRotationRate> m_rotationRate; | 80 Member<DeviceRotationRate> m_rotationRate; |
| 75 }; | 81 }; |
| 76 | 82 |
| 77 DEFINE_TYPE_CASTS(DeviceMotionEvent, | 83 DEFINE_TYPE_CASTS(DeviceMotionEvent, |
| 78 Event, | 84 Event, |
| 79 event, | 85 event, |
| 80 event->interfaceName() == EventNames::DeviceMotionEvent, | 86 event->interfaceName() == EventNames::DeviceMotionEvent, |
| 81 event.interfaceName() == EventNames::DeviceMotionEvent); | 87 event.interfaceName() == EventNames::DeviceMotionEvent); |
| 82 | 88 |
| 83 } // namespace blink | 89 } // namespace blink |
| 84 | 90 |
| 85 #endif // DeviceMotionEvent_h | 91 #endif // DeviceMotionEvent_h |
| OLD | NEW |