mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
implement and use From<bool> for enum and back
implement and use From<bool> for EventBubbles (and back direction) implement and use From<bool> for EventCancelable (and back direction)
This commit is contained in:
parent
7a9dc57761
commit
0a5ac3b207
10 changed files with 68 additions and 78 deletions
|
@ -39,7 +39,7 @@ impl ProgressEvent {
|
|||
ProgressEventBinding::Wrap);
|
||||
{
|
||||
let event = ev.upcast::<Event>();
|
||||
event.init_event(type_, can_bubble == EventBubbles::Bubbles, cancelable == EventCancelable::Cancelable);
|
||||
event.init_event(type_, bool::from(can_bubble), bool::from(cancelable));
|
||||
}
|
||||
ev
|
||||
}
|
||||
|
@ -47,9 +47,8 @@ impl ProgressEvent {
|
|||
type_: DOMString,
|
||||
init: &ProgressEventBinding::ProgressEventInit)
|
||||
-> Fallible<Root<ProgressEvent>> {
|
||||
let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble };
|
||||
let cancelable = if init.parent.cancelable { EventCancelable::Cancelable }
|
||||
else { EventCancelable::NotCancelable };
|
||||
let bubbles = EventBubbles::from(init.parent.bubbles);
|
||||
let cancelable = EventCancelable::from(init.parent.cancelable);
|
||||
let ev = ProgressEvent::new(global, Atom::from(type_), bubbles, cancelable,
|
||||
init.lengthComputable, init.loaded, init.total);
|
||||
Ok(ev)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue