Title: [207187] trunk/Source/WebCore
Revision
207187
Author
[email protected]
Date
2016-10-11 21:47:00 -0700 (Tue, 11 Oct 2016)

Log Message

Update DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163311

Reviewed by Ryosuke Niwa.

Update DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event]
and use a regular constructor instead, as in the specification:
- https://www.w3.org/TR/2015/WD-proximity-20150903/#deviceproximityevent-interface

* Modules/proximity/DeviceProximityEvent.cpp:
(WebCore::DeviceProximityEvent::DeviceProximityEvent):
* Modules/proximity/DeviceProximityEvent.h:
(WebCore::DeviceProximityEvent::create):
(WebCore::DeviceProximityEventInit::DeviceProximityEventInit): Deleted.
* Modules/proximity/DeviceProximityEvent.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207186 => 207187)


--- trunk/Source/WebCore/ChangeLog	2016-10-12 03:14:56 UTC (rev 207186)
+++ trunk/Source/WebCore/ChangeLog	2016-10-12 04:47:00 UTC (rev 207187)
@@ -1,3 +1,21 @@
+2016-10-11  Chris Dumez  <[email protected]>
+
+        Update DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event]
+        https://bugs.webkit.org/show_bug.cgi?id=163311
+
+        Reviewed by Ryosuke Niwa.
+
+        Update DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event]
+        and use a regular constructor instead, as in the specification:
+        - https://www.w3.org/TR/2015/WD-proximity-20150903/#deviceproximityevent-interface
+
+        * Modules/proximity/DeviceProximityEvent.cpp:
+        (WebCore::DeviceProximityEvent::DeviceProximityEvent):
+        * Modules/proximity/DeviceProximityEvent.h:
+        (WebCore::DeviceProximityEvent::create):
+        (WebCore::DeviceProximityEventInit::DeviceProximityEventInit): Deleted.
+        * Modules/proximity/DeviceProximityEvent.idl:
+
 2016-10-11  Gyuyoung Kim  <[email protected]>
 
         Unreviewed, EFL build fix because of r207173.

Modified: trunk/Source/WebCore/Modules/proximity/DeviceProximityEvent.cpp (207186 => 207187)


--- trunk/Source/WebCore/Modules/proximity/DeviceProximityEvent.cpp	2016-10-12 03:14:56 UTC (rev 207186)
+++ trunk/Source/WebCore/Modules/proximity/DeviceProximityEvent.cpp	2016-10-12 04:47:00 UTC (rev 207187)
@@ -39,11 +39,11 @@
 {
 }
 
-DeviceProximityEvent::DeviceProximityEvent(const AtomicString& eventType, const DeviceProximityEventInit& initializer)
-    : Event(eventType, initializer)
-    , m_value(initializer.value)
-    , m_min(initializer.min)
-    , m_max(initializer.max)
+DeviceProximityEvent::DeviceProximityEvent(const AtomicString& eventType, const Init& initializer, IsTrusted isTrusted)
+    : Event(eventType, initializer, isTrusted)
+    , m_value(initializer.value ? *initializer.value : std::numeric_limits<double>::infinity())
+    , m_min(initializer.min ? *initializer.min : -std::numeric_limits<double>::infinity())
+    , m_max(initializer.max ? *initializer.max : std::numeric_limits<double>::infinity())
 {
 }
 

Modified: trunk/Source/WebCore/Modules/proximity/DeviceProximityEvent.h (207186 => 207187)


--- trunk/Source/WebCore/Modules/proximity/DeviceProximityEvent.h	2016-10-12 03:14:56 UTC (rev 207186)
+++ trunk/Source/WebCore/Modules/proximity/DeviceProximityEvent.h	2016-10-12 04:47:00 UTC (rev 207187)
@@ -26,22 +26,6 @@
 
 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() { }
@@ -56,9 +40,15 @@
         return adoptRef(*new DeviceProximityEvent(eventType, value, min, max));
     }
 
-    static Ref<DeviceProximityEvent> create(const AtomicString& type, const DeviceProximityEventInit& initializer)
+    struct Init : EventInit {
+        Optional<double> value;
+        Optional<double> min;
+        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 +60,7 @@
 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;

Modified: trunk/Source/WebCore/Modules/proximity/DeviceProximityEvent.idl (207186 => 207187)


--- trunk/Source/WebCore/Modules/proximity/DeviceProximityEvent.idl	2016-10-12 03:14:56 UTC (rev 207186)
+++ trunk/Source/WebCore/Modules/proximity/DeviceProximityEvent.idl	2016-10-12 04:47:00 UTC (rev 207187)
@@ -19,10 +19,15 @@
 
 [
     Conditional=PROXIMITY_EVENTS,
-    ConstructorTemplate=Event,
+    Constructor(DOMString type, optional DeviceProximityEventInit eventInitDict),
 ] interface DeviceProximityEvent : Event {
-    [InitializedByEventConstructor] readonly attribute unrestricted double value;
-    [InitializedByEventConstructor] readonly attribute unrestricted double min;
-    [InitializedByEventConstructor] readonly attribute unrestricted double max;
+    readonly attribute unrestricted double value;
+    readonly attribute unrestricted double min;
+    readonly attribute unrestricted double max;
 };
 
+dictionary DeviceProximityEventInit : EventInit {
+    double value;
+    double min;
+    double max;
+};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to