mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +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
|
@ -53,7 +53,7 @@ impl WebGLContextEvent {
|
|||
|
||||
{
|
||||
let parent = event.upcast::<Event>();
|
||||
parent.init_event(type_, bubbles == EventBubbles::Bubbles, cancelable == EventCancelable::Cancelable);
|
||||
parent.init_event(type_, bool::from(bubbles), bool::from(cancelable));
|
||||
}
|
||||
|
||||
event
|
||||
|
@ -67,17 +67,9 @@ impl WebGLContextEvent {
|
|||
None => DOMString::new(),
|
||||
};
|
||||
|
||||
let bubbles = if init.parent.bubbles {
|
||||
EventBubbles::Bubbles
|
||||
} else {
|
||||
EventBubbles::DoesNotBubble
|
||||
};
|
||||
let bubbles = EventBubbles::from(init.parent.bubbles);
|
||||
|
||||
let cancelable = if init.parent.cancelable {
|
||||
EventCancelable::Cancelable
|
||||
} else {
|
||||
EventCancelable::NotCancelable
|
||||
};
|
||||
let cancelable = EventCancelable::from(init.parent.cancelable);
|
||||
|
||||
Ok(WebGLContextEvent::new(global, Atom::from(type_),
|
||||
bubbles,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue