diff options
author | David Zbarsky <dzbarsky@gmail.com> | 2015-11-02 22:26:50 -0800 |
---|---|---|
committer | David Zbarsky <dzbarsky@gmail.com> | 2015-11-03 19:51:46 -0800 |
commit | 722aa86c895b42798d60bcada41b0175dbafba52 (patch) | |
tree | 45d54ac56e4461f1ab3316a7796c4a8bc710e5b8 /components/script/dom/htmlelement.rs | |
parent | ca56ebbb09f3c258d10e7a7fa276d42fe258d893 (diff) | |
download | servo-722aa86c895b42798d60bcada41b0175dbafba52.tar.gz servo-722aa86c895b42798d60bcada41b0175dbafba52.zip |
Get rid of a bunch of explicit derefs
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r-- | components/script/dom/htmlelement.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 43c319678c9..d2727b851f2 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -153,19 +153,16 @@ impl HTMLElementMethods for HTMLElement { // https://html.spec.whatwg.org/multipage/#handler-onload fn GetOnload(&self) -> Option<Rc<EventHandlerNonNull>> { if self.is_body_or_frameset() { - let win = window_from_node(self); - win.r().GetOnload() + window_from_node(self).GetOnload() } else { - let target = self.upcast::<EventTarget>(); - target.get_event_handler_common("load") + self.upcast::<EventTarget>().get_event_handler_common("load") } } // https://html.spec.whatwg.org/multipage/#handler-onload fn SetOnload(&self, listener: Option<Rc<EventHandlerNonNull>>) { if self.is_body_or_frameset() { - let win = window_from_node(self); - win.r().SetOnload(listener) + window_from_node(self).SetOnload(listener) } else { self.upcast::<EventTarget>().set_event_handler_common("load", listener) } @@ -202,9 +199,9 @@ impl HTMLElementMethods for HTMLElement { } // https://html.spec.whatwg.org/multipage/#unfocusing-steps let document = document_from_node(self); - document.r().begin_focus_transaction(); + document.begin_focus_transaction(); // If `request_focus` is not called, focus will be set to None. - document.r().commit_focus_transaction(FocusType::Element); + document.commit_focus_transaction(FocusType::Element); } // https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface @@ -332,7 +329,7 @@ impl HTMLElement { pub fn get_custom_attr(&self, local_name: DOMString) -> Option<DOMString> { let local_name = Atom::from_slice(&to_snake_case(local_name)); self.upcast::<Element>().get_attribute(&ns!(""), &local_name).map(|attr| { - (**attr.r().value()).to_owned() + (**attr.value()).to_owned() }) } @@ -419,9 +416,9 @@ impl VirtualMethods for HTMLElement { match (attr.local_name(), mutation) { (name, AttributeMutation::Set(_)) if name.starts_with("on") => { let window = window_from_node(self); - let (cx, url, reflector) = (window.r().get_cx(), - window.r().get_url(), - window.r().reflector().get_jsobject()); + let (cx, url, reflector) = (window.get_cx(), + window.get_url(), + window.reflector().get_jsobject()); let evtarget = self.upcast::<EventTarget>(); evtarget.set_event_handler_uncompiled(cx, url, reflector, &name[2..], |