aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/errorevent.rs
diff options
context:
space:
mode:
authorAlexander Popiak <alex@zenguard.org>2016-03-17 22:50:22 +0100
committerAlexander Popiak <alex@zenguard.org>2016-03-17 22:50:22 +0100
commit0a5ac3b207b74a5388334abb85e19c67771248a5 (patch)
tree48d805a78027792cb90b121c109cb6318d3b4c5a /components/script/dom/errorevent.rs
parent7a9dc577617b442ff0fe07eaa683207234c519ee (diff)
downloadservo-0a5ac3b207b74a5388334abb85e19c67771248a5.tar.gz
servo-0a5ac3b207b74a5388334abb85e19c67771248a5.zip
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)
Diffstat (limited to 'components/script/dom/errorevent.rs')
-rw-r--r--components/script/dom/errorevent.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/components/script/dom/errorevent.rs b/components/script/dom/errorevent.rs
index c9d5a79b0fd..763fa823d17 100644
--- a/components/script/dom/errorevent.rs
+++ b/components/script/dom/errorevent.rs
@@ -60,8 +60,8 @@ impl ErrorEvent {
let ev = ErrorEvent::new_uninitialized(global);
{
let event = ev.upcast::<Event>();
- event.init_event(type_, bubbles == EventBubbles::Bubbles,
- cancelable == EventCancelable::Cancelable);
+ event.init_event(type_, bool::from(bubbles),
+ bool::from(cancelable));
*ev.message.borrow_mut() = message;
*ev.filename.borrow_mut() = filename;
ev.lineno.set(lineno);
@@ -88,13 +88,9 @@ impl ErrorEvent {
let col_num = init.colno.unwrap_or(0);
- 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);
// Dictionaries need to be rooted
// https://github.com/servo/servo/issues/6381