aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/xrwebgllayer.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2023-05-28 22:43:55 -0400
committerJosh Matthews <josh@joshmatthews.net>2023-05-28 23:23:12 -0400
commitdbff26bce05d404027ef5bbfd85fb5995e4726bc (patch)
tree6ebb631eef396c2f387fe8269b0d59bde0dccae2 /components/script/dom/xrwebgllayer.rs
parentd9600ff50f3c1bdd8c44e2dfc15a18416d80cb82 (diff)
downloadservo-dbff26bce05d404027ef5bbfd85fb5995e4726bc.tar.gz
servo-dbff26bce05d404027ef5bbfd85fb5995e4726bc.zip
Support arbitrary protos when wrapping DOM objects with constructors.
Diffstat (limited to 'components/script/dom/xrwebgllayer.rs')
-rw-r--r--components/script/dom/xrwebgllayer.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/components/script/dom/xrwebgllayer.rs b/components/script/dom/xrwebgllayer.rs
index dd1e4eff57f..bbf6e76e5db 100644
--- a/components/script/dom/xrwebgllayer.rs
+++ b/components/script/dom/xrwebgllayer.rs
@@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::XRWebGLRenderi
use crate::dom::bindings::error::Error;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
+use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::globalscope::GlobalScope;
use crate::dom::webglframebuffer::WebGLFramebuffer;
@@ -28,6 +28,7 @@ use canvas_traits::webgl::WebGLContextId;
use canvas_traits::webgl::WebGLTextureId;
use dom_struct::dom_struct;
use euclid::{Rect, Size2D};
+use js::rust::HandleObject;
use std::convert::TryInto;
use webxr_api::ContextId as WebXRContextId;
use webxr_api::LayerId;
@@ -78,15 +79,16 @@ impl XRWebGLLayer {
}
}
- pub fn new(
+ fn new(
global: &GlobalScope,
+ proto: Option<HandleObject>,
session: &XRSession,
context: &WebGLRenderingContext,
init: &XRWebGLLayerInit,
framebuffer: Option<&WebGLFramebuffer>,
layer_id: Option<LayerId>,
) -> DomRoot<XRWebGLLayer> {
- reflect_dom_object(
+ reflect_dom_object2(
Box::new(XRWebGLLayer::new_inherited(
session,
context,
@@ -95,6 +97,7 @@ impl XRWebGLLayer {
layer_id,
)),
global,
+ proto,
)
}
@@ -102,6 +105,7 @@ impl XRWebGLLayer {
#[allow(non_snake_case)]
pub fn Constructor(
global: &Window,
+ proto: Option<HandleObject>,
session: &XRSession,
context: XRWebGLRenderingContext,
init: &XRWebGLLayerInit,
@@ -147,6 +151,7 @@ impl XRWebGLLayer {
// Step 10. "Return layer."
Ok(XRWebGLLayer::new(
&global.global(),
+ proto,
session,
&context,
init,