aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webxr/xrwebgllayer.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2025-03-16 09:46:14 -0400
committerGitHub <noreply@github.com>2025-03-16 13:46:14 +0000
commitd35da38a2fd6f093967e74f704612391b4988e69 (patch)
tree96c8705a5a597be25ac74b58043e57b3e06992f4 /components/script/dom/webxr/xrwebgllayer.rs
parent3ecd1c069978f6ceb20e4ee6af599fbef425e9da (diff)
downloadservo-d35da38a2fd6f093967e74f704612391b4988e69.tar.gz
servo-d35da38a2fd6f093967e74f704612391b4988e69.zip
Cleanups for future script crate split (#35987)
* script: Avoid direct impl blocks on generated dicts and unions. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Remove references to codegen-specific import module. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix tidy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/script/dom/webxr/xrwebgllayer.rs')
-rw-r--r--components/script/dom/webxr/xrwebgllayer.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/components/script/dom/webxr/xrwebgllayer.rs b/components/script/dom/webxr/xrwebgllayer.rs
index e06ae3fd3b6..0e93e583c6f 100644
--- a/components/script/dom/webxr/xrwebgllayer.rs
+++ b/components/script/dom/webxr/xrwebgllayer.rs
@@ -11,6 +11,7 @@ use js::rust::HandleObject;
use webxr_api::{ContextId as WebXRContextId, LayerId, LayerInit, Viewport};
use crate::canvas_context::CanvasContext as _;
+use crate::conversions::Convert;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::{
@@ -35,15 +36,15 @@ use crate::dom::xrview::XRView;
use crate::dom::xrviewport::XRViewport;
use crate::script_runtime::CanGc;
-impl<'a> From<&'a XRWebGLLayerInit> for LayerInit {
- fn from(init: &'a XRWebGLLayerInit) -> LayerInit {
+impl Convert<LayerInit> for XRWebGLLayerInit {
+ fn convert(self) -> LayerInit {
LayerInit::WebGLLayer {
- alpha: init.alpha,
- antialias: init.antialias,
- depth: init.depth,
- stencil: init.stencil,
- framebuffer_scale_factor: *init.framebufferScaleFactor as f32,
- ignore_depth_values: init.ignoreDepthValues,
+ alpha: self.alpha,
+ antialias: self.antialias,
+ depth: self.depth,
+ stencil: self.stencil,
+ framebuffer_scale_factor: *self.framebufferScaleFactor as f32,
+ ignore_depth_values: self.ignoreDepthValues,
}
}
}
@@ -271,7 +272,7 @@ impl XRWebGLLayerMethods<crate::DomTypeHolder> for XRWebGLLayer {
// Step 9.3. "Allocate and initialize resources compatible with session’s XR device,
// including GPU accessible memory buffers, as required to support the compositing of layer."
let context_id = WebXRContextId::from(context.context_id());
- let layer_init = LayerInit::from(init);
+ let layer_init: LayerInit = init.convert();
let layer_id = session
.with_session(|session| session.create_layer(context_id, layer_init))
.map_err(|_| Error::Operation)?;