⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 233515 in webkit


Ignore:
Timestamp:
Jul 5, 2018, 4:42:00 AM (8 years ago)
Author:
svillar@igalia.com
Message:

[WebVR] Fix VRDisplayEvent implementation
​https://bugs.webkit.org/show_bug.cgi?id=187337

Reviewed by Žan Doberšek.

VRDisplayEvent implementation had two issues. First there were no attributes storing the
VRDisplay the event refers to. Secondly the VRDisplayEventReason is not mandatory so it
should be handled via an optional.

  • Modules/webvr/VRDisplayEvent.cpp:

(WebCore::VRDisplayEvent::VRDisplayEvent):
(WebCore::VRDisplayEvent::display const): Deleted.
(WebCore::VRDisplayEvent::reason const): Deleted.

  • Modules/webvr/VRDisplayEvent.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r233512 r233515  
     12018-07-05  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [WebVR] Fix VRDisplayEvent implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=187337
     5
     6        Reviewed by Žan Doberšek.
     7
     8        VRDisplayEvent implementation had two issues. First there were no attributes storing the
     9        VRDisplay the event refers to. Secondly the VRDisplayEventReason is not mandatory so it
     10        should be handled via an optional.
     11
     12        * Modules/webvr/VRDisplayEvent.cpp:
     13        (WebCore::VRDisplayEvent::VRDisplayEvent):
     14        (WebCore::VRDisplayEvent::display const): Deleted.
     15        (WebCore::VRDisplayEvent::reason const): Deleted.
     16        * Modules/webvr/VRDisplayEvent.h:
     17
    1182018-07-04  Carlos Garcia Campos  <cgarcia@igalia.com>
    219
  • trunk/Source/WebCore/Modules/webvr/VRDisplayEvent.cpp

    r221966 r233515  
    3232VRDisplayEvent::VRDisplayEvent(const AtomicString& type, const Init& initializer, IsTrusted isTrusted)
    3333    : Event(type, initializer, isTrusted)
     34    , m_display(initializer.display)
     35    , m_reason(initializer.reason)
     36{
     37}
     38
     39VRDisplayEvent::VRDisplayEvent(const AtomicString& name, const RefPtr<VRDisplay>& display, std::optional<VRDisplayEventReason>&& reason)
     40    : Event(name, false /*canBubble*/, false /*cancelable*/)
     41    , m_display(display)
     42    , m_reason(WTFMove(reason))
    3443{
    3544}
    3645
    3746VRDisplayEvent::~VRDisplayEvent() = default;
    38 
    39 RefPtr<VRDisplay> VRDisplayEvent::display() const
    40 {
    41     return nullptr;
    42 }
    43 
    44 VRDisplayEventReason VRDisplayEvent::reason() const
    45 {
    46     return VRDisplayEventReason::Mounted;
    47 }
    4847
    4948EventInterface VRDisplayEvent::eventInterface() const
  • trunk/Source/WebCore/Modules/webvr/VRDisplayEvent.h

    r221966 r233515  
    3434class VRDisplayEvent final : public Event {
    3535public:
     36    static Ref<VRDisplayEvent> create(const AtomicString& type, const RefPtr<VRDisplay>& display, std::optional<VRDisplayEventReason>&& reason)
     37    {
     38        return adoptRef(*new VRDisplayEvent(type, display, WTFMove(reason)));
     39    }
     40
    3641    struct Init : EventInit {
    3742        RefPtr<VRDisplay> display;
    38         VRDisplayEventReason reason;
     43        std::optional<VRDisplayEventReason> reason;
    3944    };
    4045
    … …  
    4651    virtual ~VRDisplayEvent();
    4752
    48     RefPtr<VRDisplay> display() const;
    49     VRDisplayEventReason reason() const;
     53    RefPtr<VRDisplay> display() const { return m_display; }
     54    const std::optional<VRDisplayEventReason>& reason() const { return m_reason; }
    5055
    5156private:
    5257    VRDisplayEvent(const AtomicString&, const Init&, IsTrusted);
     58    VRDisplayEvent(const AtomicString&, const RefPtr<VRDisplay>&, std::optional<VRDisplayEventReason>&&);
    5359
    5460    // Event
    5561    EventInterface eventInterface() const override;
     62
     63    RefPtr<VRDisplay> m_display;
     64    std::optional<VRDisplayEventReason> m_reason;
    5665};
    5766
Note: See TracChangeset for help on using the changeset viewer.