Remove doublepointer in VirtualMethods, and from_borrowed_ref

Most of the heavy lifting done by:

```
$ ls *rs | xargs gawk -i inplace '/let .*: &&.*from_borrowed_ref/{sub("&&", "\\&");sub("_borrowed_","_");} {print $0}'
$ ls *rs | xargs gawk -i inplace "/impl.*VirtualMethods/{in_vm=1; sub(/<'a>/,\"\");sub(/&'a /,\"\")} /^}\$/{in_vm=0;} in_vm{\$0=gensub(/\\*self([^.])/,\"self\\\1\",\"g\"); sub(/from_borrowed_ref/,\"from_ref\")} {print}"
```
This commit is contained in:
Manish Goregaokar 2015-08-27 01:07:34 +05:30
parent 5e83a3f0a3
commit b33c5427bc
34 changed files with 159 additions and 164 deletions

View file

@ -106,9 +106,9 @@ impl<'a> HTMLBodyElementHelpers for &'a HTMLBodyElement {
}
}
impl<'a> VirtualMethods for &'a HTMLBodyElement {
impl VirtualMethods for HTMLBodyElement {
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
let element: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
let element: &HTMLElement = HTMLElementCast::from_ref(self);
Some(element as &VirtualMethods)
}
@ -121,7 +121,7 @@ impl<'a> VirtualMethods for &'a HTMLBodyElement {
return
}
let window = window_from_node(*self);
let window = window_from_node(self);
let document = window.r().Document();
document.r().set_reflow_timeout(time::precise_time_ns() + INITIAL_REFLOW_DELAY);
let ConstellationChan(ref chan) = window.r().constellation_chan();
@ -141,7 +141,7 @@ impl<'a> VirtualMethods for &'a HTMLBodyElement {
"onbeforeunload", "onhashchange", "onlanguagechange", "onmessage",
"onoffline", "ononline", "onpagehide", "onpageshow", "onpopstate",
"onstorage", "onresize", "onunload", "onerror"];
let window = window_from_node(*self);
let window = window_from_node(self);
let (cx, url, reflector) = (window.r().get_cx(),
window.r().get_url(),
window.r().reflector().get_jsobject());
@ -149,7 +149,7 @@ impl<'a> VirtualMethods for &'a HTMLBodyElement {
if FORWARDED_EVENTS.iter().any(|&event| &**name == event) {
EventTargetCast::from_ref(window.r())
} else {
EventTargetCast::from_ref(*self)
EventTargetCast::from_ref(self)
};
evtarget.set_event_handler_uncompiled(cx, url, reflector,
&name[2..],
@ -161,7 +161,7 @@ impl<'a> VirtualMethods for &'a HTMLBodyElement {
self.background_color.set(str::parse_legacy_color(&attr.value()).ok())
}
&atom!("background") => {
let doc = document_from_node(*self);
let doc = document_from_node(self);
let base = doc.r().url();
*self.background.borrow_mut() = UrlParser::new().base_url(&base).parse(&attr.value()).ok();