Changeset 262299 in webkit
- Timestamp:
- May 29, 2020 9:36:52 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r262285 r262299 1 2020-05-27 Sergio Villar Senin <svillar@igalia.com> 2 3 [WebXR] Implement XRSession::requestReferenceSpace() 4 https://bugs.webkit.org/show_bug.cgi?id=212407 5 6 Reviewed by Youenn Fablet. 7 8 * platform/wpe/TestExpectations: Unskipped 3 more tests that are working now. 9 1 10 2020-05-29 Diego Pino Garcia <dpino@igalia.com> 2 11 -
trunk/LayoutTests/imported/w3c/ChangeLog
r262284 r262299 1 2020-05-27 Sergio Villar Senin <svillar@igalia.com> 2 3 [WebXR] Implement XRSession::requestReferenceSpace() 4 https://bugs.webkit.org/show_bug.cgi?id=212407 5 6 Reviewed by Youenn Fablet. 7 8 Added expectations. 9 10 * web-platform-tests/webxr/webGLCanvasContext_create_xrcompatible.https-expected.txt: Added. 11 * web-platform-tests/webxr/webGLCanvasContext_makecompatible_contextlost.https-expected.txt: Added. 12 * web-platform-tests/webxr/xrSession_requestReferenceSpace.https-expected.txt: Added. 13 1 14 2020-05-29 Javier Fernandez <jfernandez@igalia.com> 2 15 -
trunk/LayoutTests/platform/wpe/TestExpectations
r262282 r262299 968 968 # WebXR 969 969 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/idlharness.https.window.html [ Pass ] 970 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/webGLCanvasContext_create_xrcompatible.https.html [ Pass ] 971 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/webGLCanvasContext_makecompatible_contextlost.https.html [ Pass ] 970 972 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/xrDevice_isSessionSupported_inline.https.html [ Pass ] 971 973 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/xrDevice_isSessionSupported_immersive.https.html [ Pass ] … … 982 984 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/xrSession_features_deviceSupport.https.html [ Pass ] 983 985 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/xrSession_requestAnimationFrame_callback_calls.https.html [ Pass ] 986 webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/xrSession_requestReferenceSpace.https.html [ Pass ] 984 987 985 988 # Passing since r259532. -
trunk/Source/WebCore/ChangeLog
r262298 r262299 1 2020-05-27 Sergio Villar Senin <svillar@igalia.com> 2 3 [WebXR] Implement XRSession::requestReferenceSpace() 4 https://bugs.webkit.org/show_bug.cgi?id=212407 5 6 Reviewed by Youenn Fablet. 7 8 This patch implements the requestReferenceSpace() method of the XRSession which is used to 9 create reference spaces. A reference space establishes a space where pose data will be defined 10 and thus is mandatory to retrieve that pose information. 11 12 There are still some bits that have to implementated in follow up patches using platform code. 13 14 * Modules/webxr/WebXRBoundedReferenceSpace.cpp: 15 (WebCore::WebXRBoundedReferenceSpace::create): Added. 16 (WebCore::WebXRBoundedReferenceSpace::WebXRBoundedReferenceSpace): Ditto. 17 * Modules/webxr/WebXRBoundedReferenceSpace.h: 18 * Modules/webxr/WebXRReferenceSpace.cpp: 19 (WebCore::WebXRReferenceSpace::create): Added. 20 (WebCore::WebXRReferenceSpace::WebXRReferenceSpace): Ditto. 21 (WebCore::WebXRReferenceSpace::getOffsetReferenceSpace): Use the create() method. 22 * Modules/webxr/WebXRReferenceSpace.h: 23 * Modules/webxr/WebXRSession.cpp: 24 (WebCore::WebXRSession::referenceSpaceIsSupported const): New method to check whether a reference. 25 space is supported by session and device. 26 (WebCore::WebXRSession::requestReferenceSpace): New method that creates reference spaces for pose data. 27 * Modules/webxr/WebXRSession.h: 28 * Modules/webxr/WebXRSpace.cpp: 29 (WebCore::WebXRSpace::WebXRSpace): Store a reference to the session creating the space. 30 * Modules/webxr/WebXRSpace.h: 31 1 32 2020-05-29 Simon Fraser <simon.fraser@apple.com> 2 33 -
trunk/Source/WebCore/Modules/webxr/WebXRBoundedReferenceSpace.cpp
r258498 r262299 29 29 #if ENABLE(WEBXR) 30 30 31 #include "DOMPointReadOnly.h" 32 #include <wtf/IsoMallocInlines.h> 33 31 34 namespace WebCore { 35 36 WTF_MAKE_ISO_ALLOCATED_IMPL(WebXRBoundedReferenceSpace); 37 38 Ref<WebXRBoundedReferenceSpace> WebXRBoundedReferenceSpace::create(Document& document, Ref<WebXRSession>&& session, XRReferenceSpaceType type) 39 { 40 return adoptRef(*new WebXRBoundedReferenceSpace(document, WTFMove(session), type)); 41 } 42 43 WebXRBoundedReferenceSpace::WebXRBoundedReferenceSpace(Document& document, Ref<WebXRSession>&& session, XRReferenceSpaceType type) 44 : WebXRReferenceSpace(document, WTFMove(session), type) 45 { 46 } 47 48 WebXRBoundedReferenceSpace::~WebXRBoundedReferenceSpace() = default; 32 49 33 50 const Vector<Ref<DOMPointReadOnly>>& WebXRBoundedReferenceSpace::boundsGeometry() const -
trunk/Source/WebCore/Modules/webxr/WebXRBoundedReferenceSpace.h
r258498 r262299 27 27 28 28 #include "WebXRReferenceSpace.h" 29 #include <wtf/IsoMalloc.h> 29 30 #include <wtf/Ref.h> 30 31 #include <wtf/Vector.h> … … 37 38 38 39 class WebXRBoundedReferenceSpace : public WebXRReferenceSpace { 40 WTF_MAKE_ISO_ALLOCATED(WebXRBoundedReferenceSpace); 39 41 public: 42 static Ref<WebXRBoundedReferenceSpace> create(Document&, Ref<WebXRSession>&&, XRReferenceSpaceType); 43 40 44 virtual ~WebXRBoundedReferenceSpace(); 41 45 … … 43 47 44 48 private: 49 WebXRBoundedReferenceSpace(Document&, Ref<WebXRSession>&&, XRReferenceSpaceType); 50 45 51 Vector<Ref<DOMPointReadOnly>> m_boundsGeometry; 46 52 }; -
trunk/Source/WebCore/Modules/webxr/WebXRReferenceSpace.cpp
r258498 r262299 29 29 #if ENABLE(WEBXR) 30 30 31 #include "Document.h" 32 #include "WebXRSession.h" 33 #include <wtf/IsoMallocInlines.h> 34 31 35 namespace WebCore { 32 36 33 WebXRReferenceSpace::WebXRReferenceSpace(ScriptExecutionContext& context) 34 : WebXRSpace(context) 37 WTF_MAKE_ISO_ALLOCATED_IMPL(WebXRReferenceSpace); 38 39 Ref<WebXRReferenceSpace> WebXRReferenceSpace::create(Document& document, Ref<WebXRSession>&& session, XRReferenceSpaceType type) 40 { 41 return adoptRef(*new WebXRReferenceSpace(document, WTFMove(session), type)); 42 } 43 44 WebXRReferenceSpace::WebXRReferenceSpace(Document& document, Ref<WebXRSession>&& session, XRReferenceSpaceType type) 45 : WebXRSpace(document, WTFMove(session)) 46 , m_type(type) 35 47 { 36 48 } … … 38 50 WebXRReferenceSpace::~WebXRReferenceSpace() = default; 39 51 40 Ref <WebXRReferenceSpace> WebXRReferenceSpace::getOffsetReferenceSpace(const WebXRRigidTransform&)52 RefPtr<WebXRReferenceSpace> WebXRReferenceSpace::getOffsetReferenceSpace(const WebXRRigidTransform&) 41 53 { 42 return adoptRef(*new WebXRReferenceSpace(*scriptExecutionContext())); 54 if (!scriptExecutionContext()) 55 return nullptr; 56 ASSERT(is<Document>(scriptExecutionContext())); 57 return create(downcast<Document>(*scriptExecutionContext()), m_session.copyRef(), m_type); 43 58 } 44 59 -
trunk/Source/WebCore/Modules/webxr/WebXRReferenceSpace.h
r258498 r262299 29 29 30 30 #include "WebXRSpace.h" 31 31 #include "XRReferenceSpaceType.h" 32 #include <wtf/IsoMalloc.h> 32 33 #include <wtf/Ref.h> 33 34 … … 35 36 36 37 class WebXRRigidTransform; 38 class WebXRSession; 37 39 38 40 class WebXRReferenceSpace : public WebXRSpace { 41 WTF_MAKE_ISO_ALLOCATED(WebXRReferenceSpace); 39 42 public: 43 static Ref<WebXRReferenceSpace> create(Document&, Ref<WebXRSession>&&, XRReferenceSpaceType); 44 40 45 virtual ~WebXRReferenceSpace(); 41 46 42 Ref <WebXRReferenceSpace> getOffsetReferenceSpace(const WebXRRigidTransform&);47 RefPtr<WebXRReferenceSpace> getOffsetReferenceSpace(const WebXRRigidTransform&); 43 48 44 private: 45 WebXRReferenceSpace(ScriptExecutionContext&); 49 protected: 50 WebXRReferenceSpace(Document&, Ref<WebXRSession>&&, XRReferenceSpaceType); 51 52 XRReferenceSpaceType m_type; 46 53 }; 47 54 -
trunk/Source/WebCore/Modules/webxr/WebXRSession.cpp
r262292 r262299 29 29 #if ENABLE(WEBXR) 30 30 31 #include "JSWebXRReferenceSpace.h" 32 #include "WebXRBoundedReferenceSpace.h" 31 33 #include "WebXRFrame.h" 32 34 #include "WebXRSystem.h" … … 84 86 } 85 87 86 void WebXRSession::requestReferenceSpace(const XRReferenceSpaceType&, RequestReferenceSpacePromise&&) 87 { 88 // https://immersive-web.github.io/webxr/#reference-space-is-supported 89 bool WebXRSession::referenceSpaceIsSupported(XRReferenceSpaceType type) const 90 { 91 // 1. If type is not contained in session’s XR device's list of enabled features for mode return false. 92 if (!m_device->enabledFeatures(m_mode).contains(type)) 93 return false; 94 95 // 2. If type is viewer, return true. 96 if (type == XRReferenceSpaceType::Viewer) 97 return true; 98 99 bool isImmersiveSession = m_mode == XRSessionMode::ImmersiveAr || m_mode == XRSessionMode::ImmersiveVr; 100 if (type == XRReferenceSpaceType::Local || type == XRReferenceSpaceType::LocalFloor) { 101 // 3. If type is local or local-floor, and session is an immersive session, return true. 102 if (isImmersiveSession) 103 return true; 104 105 // 4. If type is local or local-floor, and the XR device supports reporting orientation data, return true. 106 // TODO: add API to PlatformXR::Device 107 return true; 108 } 109 110 111 // 5. If type is bounded-floor and session is an immersive session, return the result of whether bounded 112 // reference spaces are supported by the XR device. 113 // https://immersive-web.github.io/webxr/#bounded-reference-spaces-are-supported 114 // TODO: add API to PlatformXR::Device 115 if (type == XRReferenceSpaceType::BoundedFloor && isImmersiveSession) 116 return true; 117 118 // 6. If type is unbounded, session is an immersive session, and the XR device supports stable tracking 119 // near the user over an unlimited distance, return true. 120 // TODO: add API to PlatformXR::Device to check stable tracking over unlimited distance. 121 if (type == XRReferenceSpaceType::Unbounded && isImmersiveSession) 122 return true; 123 124 // 7. Return false. 125 return false; 126 } 127 128 // https://immersive-web.github.io/webxr/#dom-xrsession-requestreferencespace 129 void WebXRSession::requestReferenceSpace(XRReferenceSpaceType type, RequestReferenceSpacePromise&& promise) 130 { 131 if (!scriptExecutionContext()) { 132 promise.reject(Exception { InvalidStateError }); 133 return; 134 } 135 // 1. Let promise be a new Promise. 136 // 2. Run the following steps in parallel: 137 scriptExecutionContext()->postTask([this, promise = WTFMove(promise), type] (auto& context) mutable { 138 // 2.1. Create a reference space, referenceSpace, with the XRReferenceSpaceType type. 139 // 2.2. If referenceSpace is null, reject promise with a NotSupportedError and abort these steps. 140 if (!referenceSpaceIsSupported(type)) { 141 promise.reject(Exception { NotSupportedError }); 142 return; 143 } 144 145 // https://immersive-web.github.io/webxr/#create-a-reference-space 146 RefPtr<WebXRReferenceSpace> referenceSpace; 147 ASSERT(is<Document>(context)); 148 if (type == XRReferenceSpaceType::BoundedFloor) 149 referenceSpace = WebXRBoundedReferenceSpace::create(downcast<Document>(context), makeRef(*this), type); 150 else 151 referenceSpace = WebXRReferenceSpace::create(downcast<Document>(context), makeRef(*this), type); 152 153 // 2.3. Resolve promise with referenceSpace. 154 // 3. Return promise. 155 promise.resolve(referenceSpace.releaseNonNull()); 156 }); 88 157 } 89 158 -
trunk/Source/WebCore/Modules/webxr/WebXRSession.h
r262188 r262299 70 70 71 71 void updateRenderState(const XRRenderStateInit&); 72 void requestReferenceSpace( const XRReferenceSpaceType&, RequestReferenceSpacePromise&&);72 void requestReferenceSpace(XRReferenceSpaceType, RequestReferenceSpacePromise&&); 73 73 74 74 XRFrameRequestCallback::Id requestAnimationFrame(Ref<XRFrameRequestCallback>&&); … … 97 97 void scheduleAnimation(); 98 98 99 bool referenceSpaceIsSupported(XRReferenceSpaceType) const; 100 99 101 XREnvironmentBlendMode m_environmentBlendMode; 100 102 XRVisibilityState m_visibilityState; -
trunk/Source/WebCore/Modules/webxr/WebXRSpace.cpp
r258498 r262299 29 29 #if ENABLE(WEBXR) 30 30 31 #include "Document.h" 32 #include "WebXRSession.h" 31 33 #include <wtf/IsoMallocInlines.h> 32 34 … … 35 37 WTF_MAKE_ISO_ALLOCATED_IMPL(WebXRSpace); 36 38 37 WebXRSpace::WebXRSpace(ScriptExecutionContext& context) 38 : ContextDestructionObserver(&context) 39 WebXRSpace::WebXRSpace(Document& document, Ref<WebXRSession>&& session) 40 : ContextDestructionObserver(&document) 41 , m_session(WTFMove(session)) 39 42 { 43 ASSERT(context); 40 44 } 41 45 -
trunk/Source/WebCore/Modules/webxr/WebXRSpace.h
r258498 r262299 34 34 namespace WebCore { 35 35 36 class Document; 36 37 class ScriptExecutionContext; 38 class WebXRSession; 37 39 38 40 class WebXRSpace : public RefCounted<WebXRSpace>, public EventTargetWithInlineData, public ContextDestructionObserver { … … 45 47 46 48 protected: 47 WebXRSpace( ScriptExecutionContext&);49 WebXRSpace(Document&, Ref<WebXRSession>&&); 48 50 49 51 // EventTarget 50 52 ScriptExecutionContext* scriptExecutionContext() const override { return ContextDestructionObserver::scriptExecutionContext(); } 53 54 Ref<WebXRSession> m_session; 51 55 52 56 private:
Note: See TracChangeset
for help on using the changeset viewer.