mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Support arbitrary protos when wrapping DOM objects with constructors.
This commit is contained in:
parent
d9600ff50f
commit
dbff26bce0
197 changed files with 2028 additions and 586 deletions
|
@ -6,7 +6,7 @@ use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMe
|
|||
use crate::dom::bindings::codegen::Bindings::XRSessionEventBinding::{self, XRSessionEventMethods};
|
||||
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::bindings::str::DOMString;
|
||||
use crate::dom::event::Event;
|
||||
|
@ -14,6 +14,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::dom::window::Window;
|
||||
use crate::dom::xrsession::XRSession;
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleObject;
|
||||
use servo_atoms::Atom;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -37,9 +38,20 @@ impl XRSessionEvent {
|
|||
bubbles: bool,
|
||||
cancelable: bool,
|
||||
session: &XRSession,
|
||||
) -> DomRoot<XRSessionEvent> {
|
||||
Self::new_with_proto(global, None, type_, bubbles, cancelable, session)
|
||||
}
|
||||
|
||||
fn new_with_proto(
|
||||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
type_: Atom,
|
||||
bubbles: bool,
|
||||
cancelable: bool,
|
||||
session: &XRSession,
|
||||
) -> DomRoot<XRSessionEvent> {
|
||||
let trackevent =
|
||||
reflect_dom_object(Box::new(XRSessionEvent::new_inherited(&session)), global);
|
||||
reflect_dom_object2(Box::new(XRSessionEvent::new_inherited(&session)), global, proto);
|
||||
{
|
||||
let event = trackevent.upcast::<Event>();
|
||||
event.init_event(type_, bubbles, cancelable);
|
||||
|
@ -50,11 +62,13 @@ impl XRSessionEvent {
|
|||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
type_: DOMString,
|
||||
init: &XRSessionEventBinding::XRSessionEventInit,
|
||||
) -> Fallible<DomRoot<XRSessionEvent>> {
|
||||
Ok(XRSessionEvent::new(
|
||||
Ok(XRSessionEvent::new_with_proto(
|
||||
&window.global(),
|
||||
proto,
|
||||
Atom::from(type_),
|
||||
init.parent.bubbles,
|
||||
init.parent.cancelable,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue