aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/storageevent.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/storageevent.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/storageevent.rs')
-rw-r--r--components/script/dom/storageevent.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/components/script/dom/storageevent.rs b/components/script/dom/storageevent.rs
index 4c7200f5fc1..7d1f7520c4a 100644
--- a/components/script/dom/storageevent.rs
+++ b/components/script/dom/storageevent.rs
@@ -57,7 +57,7 @@ impl StorageEvent {
StorageEventBinding::Wrap);
{
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
}
@@ -70,12 +70,8 @@ impl StorageEvent {
let newValue = init.newValue.clone();
let url = init.url.clone();
let storageArea = init.storageArea.r();
- 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 event = StorageEvent::new(global, Atom::from(type_),
bubbles, cancelable,
key, oldValue, newValue,