diff options
Diffstat (limited to 'Source/WebCore/dom/DeviceOrientationEvent.h')
-rw-r--r-- | Source/WebCore/dom/DeviceOrientationEvent.h | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/Source/WebCore/dom/DeviceOrientationEvent.h b/Source/WebCore/dom/DeviceOrientationEvent.h index d69ddbf95..a5d70316c 100644 --- a/Source/WebCore/dom/DeviceOrientationEvent.h +++ b/Source/WebCore/dom/DeviceOrientationEvent.h @@ -23,8 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef DeviceOrientationEvent_h -#define DeviceOrientationEvent_h +#pragma once #include "Event.h" @@ -32,31 +31,42 @@ namespace WebCore { class DeviceOrientationData; -class DeviceOrientationEvent : public Event { +class DeviceOrientationEvent final : public Event { public: - ~DeviceOrientationEvent(); - static PassRefPtr<DeviceOrientationEvent> create() + static Ref<DeviceOrientationEvent> create(const AtomicString& eventType, DeviceOrientationData* orientation) { - return adoptRef(new DeviceOrientationEvent); + return adoptRef(*new DeviceOrientationEvent(eventType, orientation)); } - static PassRefPtr<DeviceOrientationEvent> create(const AtomicString& eventType, DeviceOrientationData* orientation) + + static Ref<DeviceOrientationEvent> createForBindings() { - return adoptRef(new DeviceOrientationEvent(eventType, orientation)); + return adoptRef(*new DeviceOrientationEvent); } - void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceOrientationData*); + virtual ~DeviceOrientationEvent(); + + std::optional<double> alpha() const; + std::optional<double> beta() const; + std::optional<double> gamma() const; + +#if PLATFORM(IOS) + std::optional<double> compassHeading() const; + std::optional<double> compassAccuracy() const; - DeviceOrientationData* orientation() const { return m_orientation.get(); } + void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy); +#else + std::optional<bool> absolute() const; - virtual EventInterface eventInterface() const override; + void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute); +#endif private: DeviceOrientationEvent(); DeviceOrientationEvent(const AtomicString& eventType, DeviceOrientationData*); + EventInterface eventInterface() const override; + RefPtr<DeviceOrientationData> m_orientation; }; } // namespace WebCore - -#endif // DeviceOrientationEvent_h |