mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Move the CloseEventInit defaults into IDL.
This commit is contained in:
parent
692fc09041
commit
94b3617629
2 changed files with 5 additions and 12 deletions
|
@ -15,8 +15,6 @@ use script_task::ScriptChan;
|
||||||
|
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
||||||
use std::borrow::ToOwned;
|
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CloseEvent {
|
pub struct CloseEvent {
|
||||||
event: Event,
|
event: Event,
|
||||||
|
@ -57,15 +55,10 @@ impl CloseEvent {
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &CloseEventBinding::CloseEventInit)
|
init: &CloseEventBinding::CloseEventInit)
|
||||||
-> Fallible<Temporary<CloseEvent>> {
|
-> Fallible<Temporary<CloseEvent>> {
|
||||||
let clean_status = init.wasClean.unwrap_or(true);
|
|
||||||
let cd = init.code.unwrap_or(0);
|
|
||||||
let rsn = match init.reason.as_ref() {
|
|
||||||
Some(reason) => reason.clone(),
|
|
||||||
None => "".to_owned(),
|
|
||||||
};
|
|
||||||
let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble };
|
let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble };
|
||||||
let cancelable = if init.parent.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable };
|
let cancelable = if init.parent.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable };
|
||||||
Ok(CloseEvent::new(global, type_, bubbles, cancelable, clean_status, cd, rsn))
|
Ok(CloseEvent::new(global, type_, bubbles, cancelable, init.wasClean,
|
||||||
|
init.code, init.reason.clone()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ interface CloseEvent : Event {
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary CloseEventInit : EventInit {
|
dictionary CloseEventInit : EventInit {
|
||||||
boolean wasClean;
|
boolean wasClean = true;
|
||||||
unsigned short code;
|
unsigned short code = 0;
|
||||||
DOMString reason;
|
DOMString reason = "";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue