diff options
author | chansuke <chansuke@georepublic.de> | 2018-09-18 23:24:15 +0900 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2018-09-19 17:40:47 -0400 |
commit | c37a345dc9f4dda6ea29c42f96f6c7201c42cbac (patch) | |
tree | 1f05b49bac02318455a59d5b143c186fd872bdb9 /components/script/dom/customevent.rs | |
parent | 2ca7a134736bb4759ff209c1bc0b6dc3cc1984c9 (diff) | |
download | servo-c37a345dc9f4dda6ea29c42f96f6c7201c42cbac.tar.gz servo-c37a345dc9f4dda6ea29c42f96f6c7201c42cbac.zip |
Format script component
Diffstat (limited to 'components/script/dom/customevent.rs')
-rw-r--r-- | components/script/dom/customevent.rs | 68 |
1 files changed, 39 insertions, 29 deletions
diff --git a/components/script/dom/customevent.rs b/components/script/dom/customevent.rs index f932e1a96ae..b054d1a0dcb 100644 --- a/components/script/dom/customevent.rs +++ b/components/script/dom/customevent.rs @@ -36,38 +36,46 @@ impl CustomEvent { } pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<CustomEvent> { - reflect_dom_object(Box::new(CustomEvent::new_inherited()), - global, - CustomEventBinding::Wrap) + reflect_dom_object( + Box::new(CustomEvent::new_inherited()), + global, + CustomEventBinding::Wrap, + ) } - pub fn new(global: &GlobalScope, - type_: Atom, - bubbles: bool, - cancelable: bool, - detail: HandleValue) - -> DomRoot<CustomEvent> { + pub fn new( + global: &GlobalScope, + type_: Atom, + bubbles: bool, + cancelable: bool, + detail: HandleValue, + ) -> DomRoot<CustomEvent> { let ev = CustomEvent::new_uninitialized(global); ev.init_custom_event(type_, bubbles, cancelable, detail); ev } #[allow(unsafe_code)] - pub fn Constructor(global: &GlobalScope, - type_: DOMString, - init: RootedTraceableBox<CustomEventBinding::CustomEventInit>) - -> Fallible<DomRoot<CustomEvent>> { - Ok(CustomEvent::new(global, - Atom::from(type_), - init.parent.bubbles, - init.parent.cancelable, - init.detail.handle())) + pub fn Constructor( + global: &GlobalScope, + type_: DOMString, + init: RootedTraceableBox<CustomEventBinding::CustomEventInit>, + ) -> Fallible<DomRoot<CustomEvent>> { + Ok(CustomEvent::new( + global, + Atom::from(type_), + init.parent.bubbles, + init.parent.cancelable, + init.detail.handle(), + )) } - fn init_custom_event(&self, - type_: Atom, - can_bubble: bool, - cancelable: bool, - detail: HandleValue) { + fn init_custom_event( + &self, + type_: Atom, + can_bubble: bool, + cancelable: bool, + detail: HandleValue, + ) { let event = self.upcast::<Event>(); if event.dispatching() { return; @@ -87,12 +95,14 @@ impl CustomEventMethods for CustomEvent { #[allow(unsafe_code)] // https://dom.spec.whatwg.org/#dom-customevent-initcustomevent - unsafe fn InitCustomEvent(&self, - _cx: *mut JSContext, - type_: DOMString, - can_bubble: bool, - cancelable: bool, - detail: HandleValue) { + unsafe fn InitCustomEvent( + &self, + _cx: *mut JSContext, + type_: DOMString, + can_bubble: bool, + cancelable: bool, + detail: HandleValue, + ) { self.init_custom_event(Atom::from(type_), can_bubble, cancelable, detail) } |