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
|
@ -5,12 +5,13 @@
|
|||
use crate::dom::bindings::codegen::Bindings::InputEventBinding::{self, InputEventMethods};
|
||||
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods;
|
||||
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::root::DomRoot;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::uievent::UIEvent;
|
||||
use crate::dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleObject;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct InputEvent {
|
||||
|
@ -20,8 +21,9 @@ pub struct InputEvent {
|
|||
}
|
||||
|
||||
impl InputEvent {
|
||||
pub fn new(
|
||||
fn new(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
type_: DOMString,
|
||||
can_bubble: bool,
|
||||
cancelable: bool,
|
||||
|
@ -30,13 +32,14 @@ impl InputEvent {
|
|||
data: Option<DOMString>,
|
||||
is_composing: bool,
|
||||
) -> DomRoot<InputEvent> {
|
||||
let ev = reflect_dom_object(
|
||||
let ev = reflect_dom_object2(
|
||||
Box::new(InputEvent {
|
||||
uievent: UIEvent::new_inherited(),
|
||||
data: data,
|
||||
is_composing: is_composing,
|
||||
}),
|
||||
window,
|
||||
proto,
|
||||
);
|
||||
ev.uievent
|
||||
.InitUIEvent(type_, can_bubble, cancelable, view, detail);
|
||||
|
@ -46,11 +49,13 @@ impl InputEvent {
|
|||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
type_: DOMString,
|
||||
init: &InputEventBinding::InputEventInit,
|
||||
) -> Fallible<DomRoot<InputEvent>> {
|
||||
let event = InputEvent::new(
|
||||
window,
|
||||
proto,
|
||||
type_,
|
||||
init.parent.parent.bubbles,
|
||||
init.parent.parent.cancelable,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue