Diff
Modified: trunk/LayoutTests/ChangeLog (265664 => 265665)
--- trunk/LayoutTests/ChangeLog 2020-08-14 08:17:02 UTC (rev 265664)
+++ trunk/LayoutTests/ChangeLog 2020-08-14 08:24:47 UTC (rev 265665)
@@ -1,3 +1,12 @@
+2020-08-13 Sergio Villar Senin <[email protected]>
+
+ [WebXR] Implement WebXRSession::updateRenderState()
+ https://bugs.webkit.org/show_bug.cgi?id=213555
+
+ Reviewed by Darin Adler.
+
+ * platform/wpe/TestExpectations: Added a couple of tests that pass now.
+
2020-08-13 Carlos Garcia Campos <[email protected]>
Crash in WebCore::StyledMarkupAccumulator::traverseNodesForSerialization
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265664 => 265665)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-14 08:17:02 UTC (rev 265664)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-14 08:24:47 UTC (rev 265665)
@@ -1,3 +1,15 @@
+2020-08-13 Sergio Villar Senin <[email protected]>
+
+ [WebXR] Implement WebXRSession::updateRenderState()
+ https://bugs.webkit.org/show_bug.cgi?id=213555
+
+ Reviewed by Darin Adler.
+
+ New expectations.
+
+ * web-platform-tests/webxr/render_state_update.https-expected.txt: Added.
+ * web-platform-tests/webxr/render_state_vertical_fov_immersive.https-expected.txt: Added.
+
2020-08-13 Chris Dumez <[email protected]>
Unreviewed, rebaseline WPT tests that are currently marked as flaky.
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/render_state_update.https-expected.txt (0 => 265665)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/render_state_update.https-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/render_state_update.https-expected.txt 2020-08-14 08:24:47 UTC (rev 265665)
@@ -0,0 +1,7 @@
+
+PASS updateRenderState handles appropriately ended sessions
+PASS updateRenderState handles appropriately baseLayers created with different sessions
+PASS updateRenderState handles appropriately immersive sessions with specified inlineVerticalFieldOfView
+PASS updateRenderState handles appropriately XRRenderStateInit with no params
+PASS updateRenderState handles appropriately XRRenderStateInit params
+
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/render_state_update.https-expected.txt
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/render_state_vertical_fov_immersive.https-expected.txt (0 => 265665)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/render_state_vertical_fov_immersive.https-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/render_state_vertical_fov_immersive.https-expected.txt 2020-08-14 08:24:47 UTC (rev 265665)
@@ -0,0 +1,3 @@
+
+PASS inlineVerticalFieldOfView is set appropriately on immersively sessions
+
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/webxr/render_state_vertical_fov_immersive.https-expected.txt
___________________________________________________________________
Added: svn:eol-style
+LF
\ No newline at end of property
Modified: trunk/LayoutTests/platform/wpe/TestExpectations (265664 => 265665)
--- trunk/LayoutTests/platform/wpe/TestExpectations 2020-08-14 08:17:02 UTC (rev 265664)
+++ trunk/LayoutTests/platform/wpe/TestExpectations 2020-08-14 08:24:47 UTC (rev 265665)
@@ -917,6 +917,8 @@
imported/w3c/web-platform-tests/webxr/xrFrame_session_sameObject.https.html [ Pass ]
imported/w3c/web-platform-tests/webxr/xrRigidTransform_constructor.https.html [ Pass ]
imported/w3c/web-platform-tests/webxr/xrSession_prevent_multiple_exclusive.https.html [ Pass ]
+imported/w3c/web-platform-tests/webxr/render_state_vertical_fov_immersive.https.html [ Pass ]
+imported/w3c/web-platform-tests/webxr/render_state_update.https.html [ Pass ]
# Passing since r259532.
imported/w3c/web-platform-tests/css/css-ui/outline-019.html
Modified: trunk/Source/WebCore/ChangeLog (265664 => 265665)
--- trunk/Source/WebCore/ChangeLog 2020-08-14 08:17:02 UTC (rev 265664)
+++ trunk/Source/WebCore/ChangeLog 2020-08-14 08:24:47 UTC (rev 265665)
@@ -1,3 +1,45 @@
+2020-08-13 Sergio Villar Senin <[email protected]>
+
+ [WebXR] Implement WebXRSession::updateRenderState()
+ https://bugs.webkit.org/show_bug.cgi?id=213555
+
+ Reviewed by Darin Adler.
+
+ Added an implementation which matches the current specs. The updateRenderState() is specially useful to set
+ the base layer in the session where WebXR contents would be rendered. Authors would normally do:
+
+ glCanvas.getContext("webgl").makeXRCompatible().then(() => {
+ xrSession.updateRenderState({ baseLayer: new XRWebGLLayer(xrSession, gl) });
+ });
+
+ The XRRenderStateInit has also been updated to the latest version of specs.
+
+ * Modules/webxr/WebXRRenderState.cpp:
+ (WebCore::WebXRRenderState::WebXRRenderState):
+ (WebCore::WebXRRenderState::depthNear const): Inlined.
+ (WebCore::WebXRRenderState::depthFar const): Ditto.
+ (WebCore::WebXRRenderState::inlineVerticalFieldOfView const): Ditto.
+ (WebCore::WebXRRenderState::baseLayer const): Ditto.
+ * Modules/webxr/WebXRRenderState.h:
+ (WebCore::WebXRRenderState::depthNear const): Inlined.
+ (WebCore::WebXRRenderState::setDepthNear): Ditto.
+ (WebCore::WebXRRenderState::depthFar const): Ditto.
+ (WebCore::WebXRRenderState::setDepthFar): Ditto.
+ (WebCore::WebXRRenderState::inlineVerticalFieldOfView const): Added.
+ (WebCore::WebXRRenderState::setInlineVerticalFieldOfView): Ditto.
+ (WebCore::WebXRRenderState::baseLayer const): Ditto.
+ (WebCore::WebXRRenderState::setBaseLayer): Ditto.
+ * Modules/webxr/WebXRSession.cpp:
+ (WebCore::isImmersive):
+ (WebCore::WebXRSession::updateRenderState): Implemented.
+ (WebCore::WebXRSession::referenceSpaceIsSupported const):
+ * Modules/webxr/WebXRSession.h: updateRenderState may throw exception.
+ * Modules/webxr/WebXRSession.idl: Ditto.
+ * Modules/webxr/WebXRWebGLLayer.h:
+ (WebCore::WebXRWebGLLayer::session): Added.
+ * Modules/webxr/XRRenderStateInit.h: Added layers and made many attributes optional.
+ * Modules/webxr/XRRenderStateInit.idl: Ditto.
+
2020-08-13 Carlos Garcia Campos <[email protected]>
REGRESSION(r254506): [Freetype] Spektra variable font does not work properly
Modified: trunk/Source/WebCore/Modules/webxr/WebXRRenderState.cpp (265664 => 265665)
--- trunk/Source/WebCore/Modules/webxr/WebXRRenderState.cpp 2020-08-14 08:17:02 UTC (rev 265664)
+++ trunk/Source/WebCore/Modules/webxr/WebXRRenderState.cpp 2020-08-14 08:24:47 UTC (rev 265665)
@@ -28,8 +28,6 @@
#if ENABLE(WEBXR)
-#include "HTMLCanvasElement.h"
-#include "WebXRWebGLLayer.h"
#include "XRRenderStateInit.h"
#include <wtf/IsoMallocInlines.h>
#include <wtf/MathExtras.h>
@@ -45,42 +43,25 @@
return adoptRef(*new WebXRRenderState(mode == XRSessionMode::Inline ? makeOptional(piOverTwoDouble) : WTF::nullopt));
}
-WebXRRenderState::WebXRRenderState(Optional<double>&& inlineVerticalFieldOfView)
- : m_inlineVerticalFieldOfView(WTFMove(inlineVerticalFieldOfView))
+WebXRRenderState::WebXRRenderState(Optional<double> inlineVerticalFieldOfView)
+ : m_inlineVerticalFieldOfView(inlineVerticalFieldOfView)
{
}
-WebXRRenderState::WebXRRenderState(const XRRenderStateInit&)
-{
-}
-
WebXRRenderState::~WebXRRenderState() = default;
-double WebXRRenderState::depthNear() const
+Ref<WebXRRenderState> WebXRRenderState::clone() const
{
- return m_depth.near;
+ return adoptRef(*new WebXRRenderState(*this));
}
-double WebXRRenderState::depthFar() const
+WebXRRenderState::WebXRRenderState(const WebXRRenderState& other)
+ : m_depth(other.m_depth)
+ , m_inlineVerticalFieldOfView(other.m_inlineVerticalFieldOfView)
+ , m_baseLayer(other.baseLayer())
{
- return m_depth.far;
}
-Optional<double> WebXRRenderState::inlineVerticalFieldOfView() const
-{
- return m_inlineVerticalFieldOfView;
-}
-
-RefPtr<WebXRWebGLLayer> WebXRRenderState::baseLayer() const
-{
- return m_baseLayer;
-}
-
-HTMLCanvasElement* WebXRRenderState::outputCanvas() const
-{
- return m_outputCanvas.get();
-}
-
} // namespace WebCore
#endif // ENABLE(WEBXR)
Modified: trunk/Source/WebCore/Modules/webxr/WebXRRenderState.h (265664 => 265665)
--- trunk/Source/WebCore/Modules/webxr/WebXRRenderState.h 2020-08-14 08:17:02 UTC (rev 265664)
+++ trunk/Source/WebCore/Modules/webxr/WebXRRenderState.h 2020-08-14 08:24:47 UTC (rev 265665)
@@ -27,18 +27,12 @@
#if ENABLE(WEBXR)
+#include "HTMLCanvasElement.h"
+#include "WebXRWebGLLayer.h"
#include "XRSessionMode.h"
-#include <wtf/IsoMalloc.h>
-#include <wtf/Optional.h>
-#include <wtf/Ref.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/WeakPtr.h>
namespace WebCore {
-class HTMLCanvasElement;
-class WebXRWebGLLayer;
struct XRRenderStateInit;
class WebXRRenderState : public RefCounted<WebXRRenderState> {
@@ -47,15 +41,25 @@
static Ref<WebXRRenderState> create(XRSessionMode);
~WebXRRenderState();
- double depthNear() const;
- double depthFar() const;
- Optional<double> inlineVerticalFieldOfView() const;
- RefPtr<WebXRWebGLLayer> baseLayer() const;
- HTMLCanvasElement* outputCanvas() const;
+ Ref<WebXRRenderState> clone() const;
+ double depthNear() const { return m_depth.near; }
+ void setDepthNear(double near) { m_depth.near = near; }
+
+ double depthFar() const { return m_depth.far; }
+ void setDepthFar(double far) { m_depth.far = far; };
+
+ Optional<double> inlineVerticalFieldOfView() const { return m_inlineVerticalFieldOfView; }
+ void setInlineVerticalFieldOfView(double fieldOfView) { m_inlineVerticalFieldOfView = fieldOfView; }
+
+ RefPtr<WebXRWebGLLayer> baseLayer() const { return m_baseLayer; }
+ void setBaseLayer(WebXRWebGLLayer* baseLayer) { m_baseLayer = baseLayer; }
+
+ HTMLCanvasElement* outputCanvas() const { return m_outputCanvas.get(); }
+
private:
- explicit WebXRRenderState(Optional<double>&& fieldOfView);
- explicit WebXRRenderState(const XRRenderStateInit&);
+ explicit WebXRRenderState(Optional<double> fieldOfView);
+ explicit WebXRRenderState(const WebXRRenderState&);
// https://immersive-web.github.io/webxr/#initialize-the-render-state
struct {
Modified: trunk/Source/WebCore/Modules/webxr/WebXRSession.cpp (265664 => 265665)
--- trunk/Source/WebCore/Modules/webxr/WebXRSession.cpp 2020-08-14 08:17:02 UTC (rev 265664)
+++ trunk/Source/WebCore/Modules/webxr/WebXRSession.cpp 2020-08-14 08:24:47 UTC (rev 265665)
@@ -33,7 +33,9 @@
#include "WebXRFrame.h"
#include "WebXRSystem.h"
#include "XRFrameRequestCallback.h"
+#include "XRRenderStateInit.h"
#include <wtf/IsoMallocInlines.h>
+#include <wtf/RefPtr.h>
namespace WebCore {
@@ -85,10 +87,64 @@
return m_inputSources;
}
-void WebXRSession::updateRenderState(const XRRenderStateInit&)
+static bool isImmersive(XRSessionMode mode)
{
+ return mode == XRSessionMode::ImmersiveAr || mode == XRSessionMode::ImmersiveVr;
}
+// https://immersive-web.github.io/webxr/#dom-xrsession-updaterenderstate
+ExceptionOr<void> WebXRSession::updateRenderState(const XRRenderStateInit& newState)
+{
+ // 1. Let session be this.
+ // 2. If session's ended value is true, throw an InvalidStateError and abort these steps.
+ if (m_ended)
+ return Exception { InvalidStateError };
+
+ // 3. If newState's baseLayer was created with an XRSession other than session,
+ // throw an InvalidStateError and abort these steps.
+ if (newState.baseLayer && &newState.baseLayer->session() != this)
+ return Exception { InvalidStateError };
+
+ // 4. If newState's inlineVerticalFieldOfView is set and session is an immersive session,
+ // throw an InvalidStateError and abort these steps.
+ if (newState.inlineVerticalFieldOfView && isImmersive(m_mode))
+ return Exception { InvalidStateError };
+
+ // 5. If none of newState's depthNear, depthFar, inlineVerticalFieldOfView, baseLayer,
+ // layers are set, abort these steps.
+ if (!newState.depthNear && !newState.depthFar && !newState.inlineVerticalFieldOfView && !newState.baseLayer && !newState.layers)
+ return { };
+
+ // 6. Run update the pending layers state with session and newState.
+ // https://immersive-web.github.io/webxr/#update-the-pending-layers-state
+ if (newState.layers)
+ return Exception { NotSupportedError };
+
+ // 7. Let activeState be session's active render state.
+ // 8. If session's pending render state is null, set it to a copy of activeState.
+ if (!m_pendingRenderState)
+ m_pendingRenderState = m_activeRenderState->clone();
+
+ // 9. If newState's depthNear value is set, set session's pending render state's depthNear to newState's depthNear.
+ if (newState.depthNear)
+ m_pendingRenderState->setDepthNear(newState.depthNear.value());
+
+ // 10. If newState's depthFar value is set, set session's pending render state's depthFar to newState's depthFar.
+ if (newState.depthFar)
+ m_pendingRenderState->setDepthFar(newState.depthFar.value());
+
+ // 11. If newState's inlineVerticalFieldOfView is set, set session's pending render state's inlineVerticalFieldOfView
+ // to newState's inlineVerticalFieldOfView.
+ if (newState.inlineVerticalFieldOfView)
+ m_pendingRenderState->setInlineVerticalFieldOfView(newState.inlineVerticalFieldOfView.value());
+
+ // 12. If newState's baseLayer is set, set session's pending render state's baseLayer to newState's baseLayer.
+ if (newState.baseLayer)
+ m_pendingRenderState->setBaseLayer(newState.baseLayer.get());
+
+ return { };
+}
+
// https://immersive-web.github.io/webxr/#reference-space-is-supported
bool WebXRSession::referenceSpaceIsSupported(XRReferenceSpaceType type) const
{
@@ -100,7 +156,7 @@
if (type == XRReferenceSpaceType::Viewer)
return true;
- bool isImmersiveSession = m_mode == XRSessionMode::ImmersiveAr || m_mode == XRSessionMode::ImmersiveVr;
+ bool isImmersiveSession = isImmersive(m_mode);
if (type == XRReferenceSpaceType::Local || type == XRReferenceSpaceType::LocalFloor) {
// 3. If type is local or local-floor, and session is an immersive session, return true.
if (isImmersiveSession)
Modified: trunk/Source/WebCore/Modules/webxr/WebXRSession.h (265664 => 265665)
--- trunk/Source/WebCore/Modules/webxr/WebXRSession.h 2020-08-14 08:17:02 UTC (rev 265664)
+++ trunk/Source/WebCore/Modules/webxr/WebXRSession.h 2020-08-14 08:24:47 UTC (rev 265665)
@@ -70,7 +70,7 @@
const WebXRRenderState& renderState() const;
const WebXRInputSourceArray& inputSources() const;
- void updateRenderState(const XRRenderStateInit&);
+ ExceptionOr<void> updateRenderState(const XRRenderStateInit&);
void requestReferenceSpace(XRReferenceSpaceType, RequestReferenceSpacePromise&&);
unsigned requestAnimationFrame(Ref<XRFrameRequestCallback>&&);
Modified: trunk/Source/WebCore/Modules/webxr/WebXRSession.idl (265664 => 265665)
--- trunk/Source/WebCore/Modules/webxr/WebXRSession.idl 2020-08-14 08:17:02 UTC (rev 265664)
+++ trunk/Source/WebCore/Modules/webxr/WebXRSession.idl 2020-08-14 08:24:47 UTC (rev 265665)
@@ -39,7 +39,7 @@
[SameObject] readonly attribute WebXRInputSourceArray inputSources;
// Methods
- void updateRenderState(optional XRRenderStateInit stateInit);
+ [MayThrowException] void updateRenderState(optional XRRenderStateInit stateInit);
[NewObject] Promise<WebXRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type);
unsigned long requestAnimationFrame(XRFrameRequestCallback callback);
Modified: trunk/Source/WebCore/Modules/webxr/WebXRWebGLLayer.h (265664 => 265665)
--- trunk/Source/WebCore/Modules/webxr/WebXRWebGLLayer.h 2020-08-14 08:17:02 UTC (rev 265664)
+++ trunk/Source/WebCore/Modules/webxr/WebXRWebGLLayer.h 2020-08-14 08:24:47 UTC (rev 265665)
@@ -72,6 +72,8 @@
static double getNativeFramebufferScaleFactor(const WebXRSession&);
+ const WebXRSession& session() { return m_session; }
+
private:
WebXRWebGLLayer(Ref<WebXRSession>&&, WebXRRenderingContext&&, const XRWebGLLayerInit&);
Modified: trunk/Source/WebCore/Modules/webxr/XRRenderStateInit.h (265664 => 265665)
--- trunk/Source/WebCore/Modules/webxr/XRRenderStateInit.h 2020-08-14 08:17:02 UTC (rev 265664)
+++ trunk/Source/WebCore/Modules/webxr/XRRenderStateInit.h 2020-08-14 08:24:47 UTC (rev 265665)
@@ -28,15 +28,18 @@
#if ENABLE(WEBXR)
#include "WebXRWebGLLayer.h"
+#include <wtf/Optional.h>
#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
namespace WebCore {
struct XRRenderStateInit {
- double depthNear;
- double depthFar;
- double inlineVerticalFieldOfView;
+ Optional<double> depthNear;
+ Optional<double> depthFar;
+ Optional<double> inlineVerticalFieldOfView;
RefPtr<WebXRWebGLLayer> baseLayer;
+ Optional<Vector<RefPtr<WebXRLayer>>> layers;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webxr/XRRenderStateInit.idl (265664 => 265665)
--- trunk/Source/WebCore/Modules/webxr/XRRenderStateInit.idl 2020-08-14 08:17:02 UTC (rev 265664)
+++ trunk/Source/WebCore/Modules/webxr/XRRenderStateInit.idl 2020-08-14 08:24:47 UTC (rev 265665)
@@ -31,4 +31,5 @@
double depthFar;
double inlineVerticalFieldOfView;
WebXRWebGLLayer? baseLayer;
+ sequence<WebXRLayer>? layers;
};