diff options
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 4f2149e346b..cbe95bc6e24 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -6,16 +6,16 @@ use dom::attr::{Attr, AttrHelpersForLayout, AttrValue}; use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding; use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; -use dom::bindings::codegen::InheritTypes::{ElementCast, EventCast, EventTargetCast}; -use dom::bindings::codegen::InheritTypes::{HTMLElementCast, NodeCast}; -use dom::bindings::conversions::ToJSValConvertible; +use dom::bindings::conversions::{Castable, ToJSValConvertible}; use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::global::GlobalRef; use dom::bindings::js::{Root, LayoutJS}; use dom::bindings::utils::Reflectable; use dom::customevent::CustomEvent; use dom::document::Document; -use dom::element::{self, AttributeMutation}; +use dom::element::{self, AttributeMutation, Element}; +use dom::event::Event; +use dom::eventtarget::EventTarget; use dom::htmlelement::HTMLElement; use dom::node::{Node, window_from_node}; use dom::urlhelper::UrlHelper; @@ -67,7 +67,7 @@ impl HTMLIFrameElement { } pub fn get_url(&self) -> Option<Url> { - let element = ElementCast::from_ref(self); + let element = self.upcast::<Element>(); element.get_attribute(&ns!(""), &atom!("src")).and_then(|src| { let url = src.r().value(); if url.is_empty() { @@ -148,8 +148,8 @@ impl HTMLIFrameElement { true, true, detail.handle()); - let target = EventTargetCast::from_ref(self); - let event = EventCast::from_ref(custom_event.r()); + let target = self.upcast::<EventTarget>(); + let event = custom_event.upcast::<Event>(); event.fire(target); } } @@ -161,7 +161,7 @@ impl HTMLIFrameElement { #[allow(unsafe_code)] pub fn get_width(&self) -> LengthOrPercentageOrAuto { unsafe { - element::get_attr_for_layout(ElementCast::from_ref(&*self), + element::get_attr_for_layout(self.upcast::<Element>(), &ns!(""), &atom!("width")).map(|attribute| { str::parse_length(&**attribute.value_for_layout()) @@ -172,7 +172,7 @@ impl HTMLIFrameElement { #[allow(unsafe_code)] pub fn get_height(&self) -> LengthOrPercentageOrAuto { unsafe { - element::get_attr_for_layout(ElementCast::from_ref(&*self), + element::get_attr_for_layout(self.upcast::<Element>(), &ns!(""), &atom!("height")).map(|attribute| { str::parse_length(&**attribute.value_for_layout()) @@ -227,7 +227,7 @@ impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> { pub fn Navigate(iframe: &HTMLIFrameElement, direction: NavigationDirection) -> Fallible<()> { if iframe.Mozbrowser() { - let node = NodeCast::from_ref(iframe); + let node = iframe.upcast::<Node>(); if node.is_in_doc() { let window = window_from_node(iframe); let window = window.r(); @@ -249,25 +249,25 @@ pub fn Navigate(iframe: &HTMLIFrameElement, direction: NavigationDirection) -> F impl HTMLIFrameElementMethods for HTMLIFrameElement { // https://html.spec.whatwg.org/multipage/#dom-iframe-src fn Src(&self) -> DOMString { - let element = ElementCast::from_ref(self); + let element = self.upcast::<Element>(); element.get_string_attribute(&atom!("src")) } // https://html.spec.whatwg.org/multipage/#dom-iframe-src fn SetSrc(&self, src: DOMString) { - let element = ElementCast::from_ref(self); + let element = self.upcast::<Element>(); element.set_url_attribute(&atom!("src"), src) } // https://html.spec.whatwg.org/multipage/#dom-iframe-sandbox fn Sandbox(&self) -> DOMString { - let element = ElementCast::from_ref(self); + let element = self.upcast::<Element>(); element.get_string_attribute(&atom!("sandbox")) } // https://html.spec.whatwg.org/multipage/#dom-iframe-sandbox fn SetSandbox(&self, sandbox: DOMString) { - let element = ElementCast::from_ref(self); + let element = self.upcast::<Element>(); element.set_tokenlist_attribute(&atom!("sandbox"), sandbox); } @@ -311,7 +311,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser fn Mozbrowser(&self) -> bool { if mozbrowser_enabled() { - let element = ElementCast::from_ref(self); + let element = self.upcast::<Element>(); element.has_attribute(&Atom::from_slice("mozbrowser")) } else { false @@ -321,7 +321,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser fn SetMozbrowser(&self, value: bool) -> ErrorResult { if mozbrowser_enabled() { - let element = ElementCast::from_ref(self); + let element = self.upcast::<Element>(); element.set_bool_attribute(&Atom::from_slice("mozbrowser"), value); } Ok(()) @@ -360,7 +360,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { impl VirtualMethods for HTMLIFrameElement { fn super_type(&self) -> Option<&VirtualMethods> { - let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self); + let htmlelement: &HTMLElement = self.upcast::<HTMLElement>(); Some(htmlelement as &VirtualMethods) } @@ -386,7 +386,7 @@ impl VirtualMethods for HTMLIFrameElement { }, &atom!(src) => { if let AttributeMutation::Set(_) = mutation { - if NodeCast::from_ref(self).is_in_doc() { + if self.upcast::<Node>().is_in_doc() { self.process_the_iframe_attributes(); } } |