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/Modules/proximity/DeviceProximityEvent.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/Modules/proximity/DeviceProximityEvent.h')
-rw-r--r-- | Source/WebCore/Modules/proximity/DeviceProximityEvent.h | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/Source/WebCore/Modules/proximity/DeviceProximityEvent.h b/Source/WebCore/Modules/proximity/DeviceProximityEvent.h index 0ece25413..373ac451e 100644 --- a/Source/WebCore/Modules/proximity/DeviceProximityEvent.h +++ b/Source/WebCore/Modules/proximity/DeviceProximityEvent.h @@ -17,8 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#ifndef DeviceProximityEvent_h -#define DeviceProximityEvent_h +#pragma once #if ENABLE(PROXIMITY_EVENTS) @@ -26,39 +25,29 @@ namespace WebCore { -struct DeviceProximityEventInit : public EventInit { - DeviceProximityEventInit() - : value(std::numeric_limits<double>::infinity()) - , min(-std::numeric_limits<double>::infinity()) - , max(std::numeric_limits<double>::infinity()) - { - // Default value of bubbles is true by the Proximity Events spec. - // http://www.w3.org/TR/proximity/#deviceproximityevent-interface - bubbles = true; - }; - - double value; - double min; - double max; -}; - class DeviceProximityEvent : public Event { public: ~DeviceProximityEvent() { } - static PassRefPtr<DeviceProximityEvent> create() + static Ref<DeviceProximityEvent> create() { - return adoptRef(new DeviceProximityEvent()); + return adoptRef(*new DeviceProximityEvent()); } - static PassRefPtr<DeviceProximityEvent> create(const AtomicString& eventType, const double value, const double min, const double max) + static Ref<DeviceProximityEvent> create(const AtomicString& eventType, const double value, const double min, const double max) { - return adoptRef(new DeviceProximityEvent(eventType, value, min, max)); + return adoptRef(*new DeviceProximityEvent(eventType, value, min, max)); } - static PassRefPtr<DeviceProximityEvent> create(const AtomicString& type, const DeviceProximityEventInit& initializer) + struct Init : EventInit { + std::optional<double> value; + std::optional<double> min; + std::optional<double> max; + }; + + static Ref<DeviceProximityEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No) { - return adoptRef(new DeviceProximityEvent(type, initializer)); + return adoptRef(*new DeviceProximityEvent(type, initializer, isTrusted)); } double value() { return m_value; } @@ -70,7 +59,7 @@ public: private: DeviceProximityEvent(); DeviceProximityEvent(const AtomicString& eventType, const double value, const double min, const double max); - DeviceProximityEvent(const AtomicString& eventType, const DeviceProximityEventInit&); + DeviceProximityEvent(const AtomicString& eventType, const Init&, IsTrusted); double m_value; double m_min; @@ -80,4 +69,3 @@ private: } // namespace WebCore #endif // DeviceProximityEvent_h -#endif // PROXIMITY_EVENTS |