diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/dom/DeviceOrientationEvent.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/dom/DeviceOrientationEvent.cpp')
-rw-r--r-- | Source/WebCore/dom/DeviceOrientationEvent.cpp | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/Source/WebCore/dom/DeviceOrientationEvent.cpp b/Source/WebCore/dom/DeviceOrientationEvent.cpp index 97b919e59..e06ec3170 100644 --- a/Source/WebCore/dom/DeviceOrientationEvent.cpp +++ b/Source/WebCore/dom/DeviceOrientationEvent.cpp @@ -27,7 +27,6 @@ #include "DeviceOrientationEvent.h" #include "DeviceOrientationData.h" -#include "EventNames.h" namespace WebCore { @@ -46,15 +45,60 @@ DeviceOrientationEvent::DeviceOrientationEvent(const AtomicString& eventType, De { } -void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceOrientationData* orientation) +std::optional<double> DeviceOrientationEvent::alpha() const +{ + return m_orientation->alpha(); +} + +std::optional<double> DeviceOrientationEvent::beta() const +{ + return m_orientation->beta(); +} + +std::optional<double> DeviceOrientationEvent::gamma() const +{ + return m_orientation->gamma(); +} + +#if PLATFORM(IOS) + +std::optional<double> DeviceOrientationEvent::compassHeading() const +{ + return m_orientation->compassHeading(); +} + +std::optional<double> DeviceOrientationEvent::compassAccuracy() const +{ + return m_orientation->compassAccuracy(); +} + +void DeviceOrientationEvent::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) { if (dispatched()) return; initEvent(type, bubbles, cancelable); - m_orientation = orientation; + m_orientation = DeviceOrientationData::create(alpha, beta, gamma, compassHeading, compassAccuracy); +} + +#else + +std::optional<bool> DeviceOrientationEvent::absolute() const +{ + return m_orientation->absolute(); } +void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute) +{ + if (dispatched()) + return; + + initEvent(type, bubbles, cancelable); + m_orientation = DeviceOrientationData::create(alpha, beta, gamma, absolute); +} + +#endif + EventInterface DeviceOrientationEvent::eventInterface() const { #if ENABLE(DEVICE_ORIENTATION) |