mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -7,12 +7,13 @@ use crate::dom::bindings::codegen::Bindings::PageTransitionEventBinding;
|
|||
use crate::dom::bindings::codegen::Bindings::PageTransitionEventBinding::PageTransitionEventMethods;
|
||||
use crate::dom::bindings::error::Fallible;
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::event::Event;
|
||||
use crate::dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleObject;
|
||||
use servo_atoms::Atom;
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -31,8 +32,8 @@ impl PageTransitionEvent {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_uninitialized(window: &Window) -> DomRoot<PageTransitionEvent> {
|
||||
reflect_dom_object(Box::new(PageTransitionEvent::new_inherited()), window)
|
||||
fn new_uninitialized(window: &Window, proto: Option<HandleObject>) -> DomRoot<PageTransitionEvent> {
|
||||
reflect_dom_object2(Box::new(PageTransitionEvent::new_inherited()), window, proto)
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
|
@ -42,7 +43,18 @@ impl PageTransitionEvent {
|
|||
cancelable: bool,
|
||||
persisted: bool,
|
||||
) -> DomRoot<PageTransitionEvent> {
|
||||
let ev = PageTransitionEvent::new_uninitialized(window);
|
||||
Self::new_with_proto(window, None, type_, bubbles, cancelable, persisted)
|
||||
}
|
||||
|
||||
fn new_with_proto(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
type_: Atom,
|
||||
bubbles: bool,
|
||||
cancelable: bool,
|
||||
persisted: bool,
|
||||
) -> DomRoot<PageTransitionEvent> {
|
||||
let ev = PageTransitionEvent::new_uninitialized(window, proto);
|
||||
ev.persisted.set(persisted);
|
||||
{
|
||||
let event = ev.upcast::<Event>();
|
||||
|
@ -54,11 +66,13 @@ impl PageTransitionEvent {
|
|||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
type_: DOMString,
|
||||
init: &PageTransitionEventBinding::PageTransitionEventInit,
|
||||
) -> Fallible<DomRoot<PageTransitionEvent>> {
|
||||
Ok(PageTransitionEvent::new(
|
||||
Ok(PageTransitionEvent::new_with_proto(
|
||||
window,
|
||||
proto,
|
||||
Atom::from(type_),
|
||||
init.parent.bubbles,
|
||||
init.parent.cancelable,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue