summaryrefslogtreecommitdiff
path: root/Source/WebCore/Modules/proximity/DeviceProximityEvent.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/Modules/proximity/DeviceProximityEvent.h')
-rw-r--r--Source/WebCore/Modules/proximity/DeviceProximityEvent.h40
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