Changeset 207187 in webkit


Ignore:
Timestamp:
Oct 11, 2016 9:47:00 PM (8 years ago)
Author:
Chris Dumez
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:

  • Modules/proximity/DeviceProximityEvent.cpp:

(WebCore::DeviceProximityEvent::DeviceProximityEvent):

  • Modules/proximity/DeviceProximityEvent.h:

(WebCore::DeviceProximityEvent::create):
(WebCore::DeviceProximityEventInit::DeviceProximityEventInit): Deleted.

  • Modules/proximity/DeviceProximityEvent.idl:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r207183 r207187  
     12016-10-11  Chris Dumez  <cdumez@apple.com>
     2
     3        Update DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event]
     4        https://bugs.webkit.org/show_bug.cgi?id=163311
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Update DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event]
     9        and use a regular constructor instead, as in the specification:
     10        - https://www.w3.org/TR/2015/WD-proximity-20150903/#deviceproximityevent-interface
     11
     12        * Modules/proximity/DeviceProximityEvent.cpp:
     13        (WebCore::DeviceProximityEvent::DeviceProximityEvent):
     14        * Modules/proximity/DeviceProximityEvent.h:
     15        (WebCore::DeviceProximityEvent::create):
     16        (WebCore::DeviceProximityEventInit::DeviceProximityEventInit): Deleted.
     17        * Modules/proximity/DeviceProximityEvent.idl:
     18
    1192016-10-11  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
    220
  • trunk/Source/WebCore/Modules/proximity/DeviceProximityEvent.cpp

    r136385 r207187  
    4040}
    4141
    42 DeviceProximityEvent::DeviceProximityEvent(const AtomicString& eventType, const DeviceProximityEventInit& initializer)
    43     : Event(eventType, initializer)
    44     , m_value(initializer.value)
    45     , m_min(initializer.min)
    46     , m_max(initializer.max)
     42DeviceProximityEvent::DeviceProximityEvent(const AtomicString& eventType, const Init& initializer, IsTrusted isTrusted)
     43    : Event(eventType, initializer, isTrusted)
     44    , m_value(initializer.value ? *initializer.value : std::numeric_limits<double>::infinity())
     45    , m_min(initializer.min ? *initializer.min : -std::numeric_limits<double>::infinity())
     46    , m_max(initializer.max ? *initializer.max : std::numeric_limits<double>::infinity())
    4747{
    4848}
  • trunk/Source/WebCore/Modules/proximity/DeviceProximityEvent.h

    r177259 r207187  
    2727namespace WebCore {
    2828
    29 struct DeviceProximityEventInit : public EventInit {
    30     DeviceProximityEventInit()
    31         : value(std::numeric_limits<double>::infinity())
    32         , min(-std::numeric_limits<double>::infinity())
    33         , max(std::numeric_limits<double>::infinity())
    34     {
    35         // Default value of bubbles is true by the Proximity Events spec.
    36         // http://www.w3.org/TR/proximity/#deviceproximityevent-interface
    37         bubbles = true;
    38     };
    39 
    40     double value;
    41     double min;
    42     double max;
    43 };
    44 
    4529class DeviceProximityEvent : public Event {
    4630public:
     
    5741    }
    5842
    59     static Ref<DeviceProximityEvent> create(const AtomicString& type, const DeviceProximityEventInit& initializer)
     43    struct Init : EventInit {
     44        Optional<double> value;
     45        Optional<double> min;
     46        Optional<double> max;
     47    };
     48
     49    static Ref<DeviceProximityEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
    6050    {
    61         return adoptRef(*new DeviceProximityEvent(type, initializer));
     51        return adoptRef(*new DeviceProximityEvent(type, initializer, isTrusted));
    6252    }
    6353
     
    7161    DeviceProximityEvent();
    7262    DeviceProximityEvent(const AtomicString& eventType, const double value, const double min, const double max);
    73     DeviceProximityEvent(const AtomicString& eventType, const DeviceProximityEventInit&);
     63    DeviceProximityEvent(const AtomicString& eventType, const Init&, IsTrusted);
    7464
    7565    double m_value;
  • trunk/Source/WebCore/Modules/proximity/DeviceProximityEvent.idl

    r168302 r207187  
    2020[
    2121    Conditional=PROXIMITY_EVENTS,
    22     ConstructorTemplate=Event,
     22    Constructor(DOMString type, optional DeviceProximityEventInit eventInitDict),
    2323] interface DeviceProximityEvent : Event {
    24     [InitializedByEventConstructor] readonly attribute unrestricted double value;
    25     [InitializedByEventConstructor] readonly attribute unrestricted double min;
    26     [InitializedByEventConstructor] readonly attribute unrestricted double max;
     24    readonly attribute unrestricted double value;
     25    readonly attribute unrestricted double min;
     26    readonly attribute unrestricted double max;
    2727};
    2828
     29dictionary DeviceProximityEventInit : EventInit {
     30    double value;
     31    double min;
     32    double max;
     33};
Note: See TracChangeset for help on using the changeset viewer.