Title: [233515] trunk/Source/WebCore
Revision
233515
Author
[email protected]
Date
2018-07-05 04:42:00 -0700 (Thu, 05 Jul 2018)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (233514 => 233515)


--- trunk/Source/WebCore/ChangeLog	2018-07-05 08:07:41 UTC (rev 233514)
+++ trunk/Source/WebCore/ChangeLog	2018-07-05 11:42:00 UTC (rev 233515)
@@ -1,3 +1,20 @@
+2018-07-05  Sergio Villar Senin  <[email protected]>
+
+        [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:
+
 2018-07-04  Carlos Garcia Campos  <[email protected]>
 
         REGRESSION(r233325): [GTK] Broke 40 animations tests

Modified: trunk/Source/WebCore/Modules/webvr/VRDisplayEvent.cpp (233514 => 233515)


--- trunk/Source/WebCore/Modules/webvr/VRDisplayEvent.cpp	2018-07-05 08:07:41 UTC (rev 233514)
+++ trunk/Source/WebCore/Modules/webvr/VRDisplayEvent.cpp	2018-07-05 11:42:00 UTC (rev 233515)
@@ -31,20 +31,19 @@
 
 VRDisplayEvent::VRDisplayEvent(const AtomicString& type, const Init& initializer, IsTrusted isTrusted)
     : Event(type, initializer, isTrusted)
+    , m_display(initializer.display)
+    , m_reason(initializer.reason)
 {
 }
 
-VRDisplayEvent::~VRDisplayEvent() = default;
-
-RefPtr<VRDisplay> VRDisplayEvent::display() const
+VRDisplayEvent::VRDisplayEvent(const AtomicString& name, const RefPtr<VRDisplay>& display, std::optional<VRDisplayEventReason>&& reason)
+    : Event(name, false /*canBubble*/, false /*cancelable*/)
+    , m_display(display)
+    , m_reason(WTFMove(reason))
 {
-    return nullptr;
 }
 
-VRDisplayEventReason VRDisplayEvent::reason() const
-{
-    return VRDisplayEventReason::Mounted;
-}
+VRDisplayEvent::~VRDisplayEvent() = default;
 
 EventInterface VRDisplayEvent::eventInterface() const
 {

Modified: trunk/Source/WebCore/Modules/webvr/VRDisplayEvent.h (233514 => 233515)


--- trunk/Source/WebCore/Modules/webvr/VRDisplayEvent.h	2018-07-05 08:07:41 UTC (rev 233514)
+++ trunk/Source/WebCore/Modules/webvr/VRDisplayEvent.h	2018-07-05 11:42:00 UTC (rev 233515)
@@ -33,9 +33,14 @@
 
 class VRDisplayEvent final : public Event {
 public:
+    static Ref<VRDisplayEvent> create(const AtomicString& type, const RefPtr<VRDisplay>& display, std::optional<VRDisplayEventReason>&& reason)
+    {
+        return adoptRef(*new VRDisplayEvent(type, display, WTFMove(reason)));
+    }
+
     struct Init : EventInit {
         RefPtr<VRDisplay> display;
-        VRDisplayEventReason reason;
+        std::optional<VRDisplayEventReason> reason;
     };
 
     static Ref<VRDisplayEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
@@ -45,14 +50,18 @@
 
     virtual ~VRDisplayEvent();
 
-    RefPtr<VRDisplay> display() const;
-    VRDisplayEventReason reason() const;
+    RefPtr<VRDisplay> display() const { return m_display; }
+    const std::optional<VRDisplayEventReason>& reason() const { return m_reason; }
 
 private:
     VRDisplayEvent(const AtomicString&, const Init&, IsTrusted);
+    VRDisplayEvent(const AtomicString&, const RefPtr<VRDisplay>&, std::optional<VRDisplayEventReason>&&);
 
     // Event
     EventInterface eventInterface() const override;
+
+    RefPtr<VRDisplay> m_display;
+    std::optional<VRDisplayEventReason> m_reason;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to