diff options
Diffstat (limited to 'components/script/dom/hashchangeevent.rs')
-rw-r--r-- | components/script/dom/hashchangeevent.rs | 77 |
1 files changed, 42 insertions, 35 deletions
diff --git a/components/script/dom/hashchangeevent.rs b/components/script/dom/hashchangeevent.rs index 4505d79f440..046500b9b6d 100644 --- a/components/script/dom/hashchangeevent.rs +++ b/components/script/dom/hashchangeevent.rs @@ -1,17 +1,17 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use dom::bindings::codegen::Bindings::EventBinding::EventMethods; -use dom::bindings::codegen::Bindings::HashChangeEventBinding; -use dom::bindings::codegen::Bindings::HashChangeEventBinding::HashChangeEventMethods; -use dom::bindings::error::Fallible; -use dom::bindings::inheritance::Castable; -use dom::bindings::js::Root; -use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::str::{DOMString, USVString}; -use dom::event::Event; -use dom::window::Window; +use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; +use crate::dom::bindings::codegen::Bindings::HashChangeEventBinding; +use crate::dom::bindings::codegen::Bindings::HashChangeEventBinding::HashChangeEventMethods; +use crate::dom::bindings::error::Fallible; +use crate::dom::bindings::inheritance::Castable; +use crate::dom::bindings::reflector::reflect_dom_object; +use crate::dom::bindings::root::DomRoot; +use crate::dom::bindings::str::{DOMString, USVString}; +use crate::dom::event::Event; +use crate::dom::window::Window; use dom_struct::dom_struct; use servo_atoms::Atom; @@ -32,22 +32,25 @@ impl HashChangeEvent { } } - pub fn new_uninitialized(window: &Window) -> Root<HashChangeEvent> { - reflect_dom_object(box HashChangeEvent::new_inherited(String::new(), String::new()), - window, - HashChangeEventBinding::Wrap) + pub fn new_uninitialized(window: &Window) -> DomRoot<HashChangeEvent> { + reflect_dom_object( + Box::new(HashChangeEvent::new_inherited(String::new(), String::new())), + window, + ) } - pub fn new(window: &Window, - type_: Atom, - bubbles: bool, - cancelable: bool, - old_url: String, - new_url: String) - -> Root<HashChangeEvent> { - let ev = reflect_dom_object(box HashChangeEvent::new_inherited(old_url, new_url), - window, - HashChangeEventBinding::Wrap); + pub fn new( + window: &Window, + type_: Atom, + bubbles: bool, + cancelable: bool, + old_url: String, + new_url: String, + ) -> DomRoot<HashChangeEvent> { + let ev = reflect_dom_object( + Box::new(HashChangeEvent::new_inherited(old_url, new_url)), + window, + ); { let event = ev.upcast::<Event>(); event.init_event(type_, bubbles, cancelable); @@ -55,16 +58,20 @@ impl HashChangeEvent { ev } - pub fn Constructor(window: &Window, - type_: DOMString, - init: &HashChangeEventBinding::HashChangeEventInit) - -> Fallible<Root<HashChangeEvent>> { - Ok(HashChangeEvent::new(window, - Atom::from(type_), - init.parent.bubbles, - init.parent.cancelable, - init.oldURL.0.clone(), - init.newURL.0.clone())) + #[allow(non_snake_case)] + pub fn Constructor( + window: &Window, + type_: DOMString, + init: &HashChangeEventBinding::HashChangeEventInit, + ) -> Fallible<DomRoot<HashChangeEvent>> { + Ok(HashChangeEvent::new( + window, + Atom::from(type_), + init.parent.bubbles, + init.parent.cancelable, + init.oldURL.0.clone(), + init.newURL.0.clone(), + )) } } |