Bug 1643438 [wpt PR 23994] - WebXR - mojo - rename XRReferenceSpaceCategory to XRReferenceSpaceType, a=testonly

Automatic update from web-platform-tests
WebXR - mojo - rename XRReferenceSpaceCategory to XRReferenceSpaceType

This is a mechanical change to rename the mojo type and additional misc
changes requested as a followup for CL https://crrev.com/c/2203277.

Changes:
- s/XRReferenceSpaceCategory/XRReferenceSpaceType, along with renaming
few variable names from "*category" to "*type"
- changed mojo type from now-deprecated macro-style naming to
constant-style naming
- refactored few lines of code that compute reference space appropriate
for anchor creation into XRSession::GetStationaryReferenceSpace(), used
both in XRFrame and in XRHitTestResult for anchor creation
- added `using` in xr_reference_space.cc to help with readability of a
quite-long type to something shorter (`ReferenceSpaceType` instead of
`device::mojom::blink::XRReferenceSpaceType`) - same directive could be
introduced in other files but the occurrences of the offending type are
not that common elsewhere
- refactored `XRReferenceSpace::NativeFromMojo()` since 3 `case`s were
identical or very similar

There should be no functional change.

Change-Id: I8e8efdc036f11347f8d9159fbaede44634c6eb78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2229622
Reviewed-by: Klaus Weidner <klausw@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Piotr Bialecki <bialpio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#775189}

--

wpt-commits: 70225fa88786126e19a9010fc803d95eeea0994e
wpt-pr: 23994
This commit is contained in:
Piotr Bialecki 2020-06-10 11:30:13 +00:00 committed by moz-wptsync-bot
parent cab64f36ef
commit 38cbecbf1b

View File

@ -948,10 +948,10 @@ class MockRuntime extends EventTarget {
}
return true;
} else if (nativeOriginInformation.$tag == device.mojom.XRNativeOriginInformation.Tags.referenceSpaceCategory) {
} else if (nativeOriginInformation.$tag == device.mojom.XRNativeOriginInformation.Tags.referenceSpaceType) {
// Bounded_floor & unbounded ref spaces are not yet supported for AR:
if (nativeOriginInformation.referenceSpaceCategory == device.mojom.XRReferenceSpaceCategory.UNBOUNDED
|| nativeOriginInformation.referenceSpaceCategory == device.mojom.XRReferenceSpaceCategory.BOUNDED_FLOOR) {
if (nativeOriginInformation.referenceSpaceType == device.mojom.XRReferenceSpaceType.kUnbounded
|| nativeOriginInformation.referenceSpaceType == device.mojom.XRReferenceSpaceType.kBoundedFlor) {
return false;
}
@ -1256,25 +1256,25 @@ class MockRuntime extends EventTarget {
const inputSource = this.input_sources_.get(nativeOriginInformation.inputSourceId);
return inputSource._getMojoFromInputSource(mojo_from_viewer);
}
} else if (nativeOriginInformation.$tag == device.mojom.XRNativeOriginInformation.Tags.referenceSpaceCategory) {
switch (nativeOriginInformation.referenceSpaceCategory) {
case device.mojom.XRReferenceSpaceCategory.LOCAL:
} else if (nativeOriginInformation.$tag == device.mojom.XRNativeOriginInformation.Tags.referenceSpaceType) {
switch (nativeOriginInformation.referenceSpaceType) {
case device.mojom.XRReferenceSpaceType.kLocal:
return XRMathHelper.identity();
case device.mojom.XRReferenceSpaceCategory.LOCAL_FLOOR:
case device.mojom.XRReferenceSpaceType.kLocalFloor:
if (this.stageParameters_ == null || this.stageParameters_.standingTransform == null) {
console.warn("Standing transform not available.");
return null;
}
// this.stageParameters_.standingTransform = floor_from_mojo aka native_origin_from_mojo
return XRMathHelper.inverse(this.stageParameters_.standingTransform.matrix);
case device.mojom.XRReferenceSpaceCategory.VIEWER:
case device.mojom.XRReferenceSpaceType.kViewer:
return mojo_from_viewer;
case device.mojom.XRReferenceSpaceCategory.BOUNDED_FLOOR:
case device.mojom.XRReferenceSpaceType.kBoundedFlor:
return null;
case device.mojom.XRReferenceSpaceCategory.UNBOUNDED:
case device.mojom.XRReferenceSpaceType.kUnbounded:
return null;
default:
throw new TypeError("Unrecognized XRReferenceSpaceCategory!");
throw new TypeError("Unrecognized XRReferenceSpaceType!");
}
} else {
// Anchors & planes are not yet supported for hit test.