mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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::WebGLContextEventBinding::WebGLCont
|
|||
use crate::dom::bindings::codegen::Bindings::WebGLContextEventBinding::WebGLContextEventMethods;
|
||||
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, EventBubbles, EventCancelable};
|
||||
use crate::dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleObject;
|
||||
use servo_atoms::Atom;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -34,7 +35,7 @@ impl WebGLContextEventMethods for WebGLContextEvent {
|
|||
}
|
||||
|
||||
impl WebGLContextEvent {
|
||||
pub fn new_inherited(status_message: DOMString) -> WebGLContextEvent {
|
||||
fn new_inherited(status_message: DOMString) -> WebGLContextEvent {
|
||||
WebGLContextEvent {
|
||||
event: Event::new_inherited(),
|
||||
status_message: status_message,
|
||||
|
@ -48,9 +49,21 @@ impl WebGLContextEvent {
|
|||
cancelable: EventCancelable,
|
||||
status_message: DOMString,
|
||||
) -> DomRoot<WebGLContextEvent> {
|
||||
let event = reflect_dom_object(
|
||||
Self::new_with_proto(window, None, type_, bubbles, cancelable, status_message)
|
||||
}
|
||||
|
||||
fn new_with_proto(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
type_: Atom,
|
||||
bubbles: EventBubbles,
|
||||
cancelable: EventCancelable,
|
||||
status_message: DOMString,
|
||||
) -> DomRoot<WebGLContextEvent> {
|
||||
let event = reflect_dom_object2(
|
||||
Box::new(WebGLContextEvent::new_inherited(status_message)),
|
||||
window,
|
||||
proto,
|
||||
);
|
||||
|
||||
{
|
||||
|
@ -64,6 +77,7 @@ impl WebGLContextEvent {
|
|||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
type_: DOMString,
|
||||
init: &WebGLContextEventInit,
|
||||
) -> Fallible<DomRoot<WebGLContextEvent>> {
|
||||
|
@ -76,8 +90,9 @@ impl WebGLContextEvent {
|
|||
|
||||
let cancelable = EventCancelable::from(init.parent.cancelable);
|
||||
|
||||
Ok(WebGLContextEvent::new(
|
||||
Ok(WebGLContextEvent::new_with_proto(
|
||||
window,
|
||||
proto,
|
||||
Atom::from(type_),
|
||||
bubbles,
|
||||
cancelable,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue