Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit 585aa49

Browse files
klauswchromium-wpt-export-bot
authored andcommitted
WebXR: experimental DOM Overlay support for immersive-ar mode
This opt-in mode keeps DOM content visible as a transparent overlay while in an immersive-ar WebXR session. It is activated by requesting an optional or required feature on session start: navigator.xr.requestSession( 'immersive-ar', {optionalFeatures: ['dom-overlay-for-handheld-ar']}); This functionality is only available if the corresponding feature flag chrome://flags#webxr-ar-dom-overlay is enabled. On session start, this fullscreens the <body> element. The application can use the Fullscreen API to change the visible element. Exiting the session ends fullscreen mode, and calling document.exitFullscreen() exits the immersive-ar session if there are no remaining fullscreened elements. (As of this CL, changing the fullscreen element doesn't fully update layer visibility, so non-fullscreen content can remain visible unexpectedly. That's being addressed in a followup.) Change-Id: I77b767b111436b45e2b584e46a390a68473ab118 Bug: 991747 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1741008 Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Xianzhu Wang <[email protected]> Reviewed-by: Philip Jägenstedt <[email protected]> Reviewed-by: Alex Moshchuk <[email protected]> Reviewed-by: Rune Lillesveen <[email protected]> Reviewed-by: Michael Thiessen <[email protected]> Reviewed-by: Matthew Jones <[email protected]> Reviewed-by: Alexander Cooper <[email protected]> Commit-Queue: Klaus Weidner <[email protected]> Cr-Commit-Position: refs/heads/master@{#703074}
1 parent 87ff3bc commit 585aa49

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

resources/chromium/webxr-test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@ class MockVRService {
187187
// Implements XRFrameDataProvider and XRPresentationProvider. Maintains a mock
188188
// for XRPresentationProvider.
189189
class MockRuntime {
190+
// Mapping from string feature names to the corresponding mojo types.
191+
// This is exposed as a member for extensibility.
192+
static featureToMojoMap = {
193+
"viewer": device.mojom.XRSessionFeature.REF_SPACE_VIEWER,
194+
"local": device.mojom.XRSessionFeature.REF_SPACE_LOCAL,
195+
"local-floor": device.mojom.XRSessionFeature.REF_SPACE_LOCAL_FLOOR,
196+
"bounded-floor": device.mojom.XRSessionFeature.REF_SPACE_BOUNDED_FLOOR,
197+
"unbounded": device.mojom.XRSessionFeature.REF_SPACE_UNBOUNDED };
198+
190199
constructor(fakeDeviceInit, service) {
191200
this.sessionClient_ = new device.mojom.XRSessionClientPtr();
192201
this.presentation_provider_ = new MockXRPresentationProvider();
@@ -456,19 +465,10 @@ class MockRuntime {
456465

457466
setFeatures(supportedFeatures) {
458467
function convertFeatureToMojom(feature) {
459-
switch (feature) {
460-
case "viewer":
461-
return device.mojom.XRSessionFeature.REF_SPACE_VIEWER;
462-
case "local":
463-
return device.mojom.XRSessionFeature.REF_SPACE_LOCAL;
464-
case "local-floor":
465-
return device.mojom.XRSessionFeature.REF_SPACE_LOCAL_FLOOR;
466-
case "bounded-floor":
467-
return device.mojom.XRSessionFeature.REF_SPACE_BOUNDED_FLOOR;
468-
case "unbounded":
469-
return device.mojom.XRSessionFeature.REF_SPACE_UNBOUNDED;
470-
default:
471-
return device.mojom.XRSessionFeature.INVALID;
468+
if (feature in MockRuntime.featureToMojoMap) {
469+
return MockRuntime.featureToMojoMap[feature];
470+
} else {
471+
return device.mojom.XRSessionFeature.INVALID;
472472
}
473473
}
474474

0 commit comments

Comments
 (0)