mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Convert various helper traits from &JSRef to JSRef
I converted them all with a few exceptions: - Methods that were used by trait objects, since trait objects don't work with `self` methods. - Methods that take an &'b JSRef<'a, T> and return an &'b. In reality, many (all?) could return an &'a instead, but this isn't allowed by the Deref trait. - Methods that internally rely on the same issue with Deref. - I left out the traits involved in layout entirely, even though not all of their methods suffer from one of the above problems. There will probably be solutions to all of these problems in the future.
This commit is contained in:
parent
2c8d51a37c
commit
d768ee77ad
17 changed files with 196 additions and 196 deletions
|
@ -39,14 +39,14 @@ impl HTMLImageElementDerived for EventTarget {
|
|||
}
|
||||
|
||||
trait PrivateHTMLImageElementHelpers {
|
||||
fn update_image(&self, value: Option<(DOMString, &Url)>);
|
||||
fn update_image(self, value: Option<(DOMString, &Url)>);
|
||||
}
|
||||
|
||||
impl<'a> PrivateHTMLImageElementHelpers for JSRef<'a, HTMLImageElement> {
|
||||
/// Makes the local `image` member match the status of the `src` attribute and starts
|
||||
/// prefetching the image. This method must be called after `src` is changed.
|
||||
fn update_image(&self, value: Option<(DOMString, &Url)>) {
|
||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
||||
fn update_image(self, value: Option<(DOMString, &Url)>) {
|
||||
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||
let document = node.owner_doc().root();
|
||||
let window = document.deref().window.root();
|
||||
let image_cache = &window.image_cache_task;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue