Support arbitrary protos when wrapping DOM objects with constructors.

This commit is contained in:
Josh Matthews 2023-05-28 22:43:55 -04:00
parent d9600ff50f
commit dbff26bce0
197 changed files with 2028 additions and 586 deletions

View file

@ -13,7 +13,7 @@ use crate::dom::bindings::codegen::Bindings::XRWebGLBindingBinding::XRWebGLBindi
use crate::dom::bindings::codegen::UnionTypes::WebGLRenderingContextOrWebGL2RenderingContext;
use crate::dom::bindings::error::Error;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::reflector::reflect_dom_object2;
use crate::dom::bindings::reflector::Reflector;
use crate::dom::bindings::root::Dom;
use crate::dom::bindings::root::DomRoot;
@ -30,6 +30,7 @@ use crate::dom::xrsession::XRSession;
use crate::dom::xrview::XRView;
use crate::dom::xrwebglsubimage::XRWebGLSubImage;
use dom_struct::dom_struct;
use js::rust::HandleObject;
#[dom_struct]
pub struct XRWebGLBinding {
@ -47,20 +48,23 @@ impl XRWebGLBinding {
}
}
pub fn new(
fn new(
global: &Window,
proto: Option<HandleObject>,
session: &XRSession,
context: &WebGLRenderingContext,
) -> DomRoot<XRWebGLBinding> {
reflect_dom_object(
reflect_dom_object2(
Box::new(XRWebGLBinding::new_inherited(session, context)),
global,
proto,
)
}
#[allow(non_snake_case)]
pub fn Constructor(
global: &Window,
proto: Option<HandleObject>,
session: &XRSession,
context: WebGLRenderingContextOrWebGL2RenderingContext,
) -> DomRoot<XRWebGLBinding> {
@ -70,7 +74,7 @@ impl XRWebGLBinding {
ctx.base_context()
},
};
XRWebGLBinding::new(global, session, &context)
XRWebGLBinding::new(global, proto, session, &context)
}
}