Remove intrinsic Root::r()

This commit is contained in:
Anthony Ramine 2016-05-13 14:20:00 +02:00
parent 51bcf516c8
commit 0b3ab875f4
55 changed files with 275 additions and 310 deletions

View file

@ -87,7 +87,6 @@ impl Runnable for ImageResponseHandlerRunnable {
fn handler(self: Box<Self>) {
// Update the image field
let element = self.element.root();
let element_ref = element.r();
let (image, metadata, trigger_image_load, trigger_image_error) = match self.image {
ImageResponse::Loaded(image) | ImageResponse::PlaceholderLoaded(image) => {
(Some(image.clone()), Some(ImageMetadata { height: image.height, width: image.width } ), true, false)
@ -97,8 +96,8 @@ impl Runnable for ImageResponseHandlerRunnable {
}
ImageResponse::None => (None, None, false, true)
};
element_ref.current_request.borrow_mut().image = image;
element_ref.current_request.borrow_mut().metadata = metadata;
element.current_request.borrow_mut().image = image;
element.current_request.borrow_mut().metadata = metadata;
// Mark the node dirty
let document = document_from_node(&*element);
@ -115,7 +114,7 @@ impl Runnable for ImageResponseHandlerRunnable {
}
// Trigger reflow
let window = window_from_node(document.r());
let window = window_from_node(&*document);
window.add_pending_reflow();
}
}
@ -229,7 +228,7 @@ impl HTMLImageElement {
width: Option<u32>,
height: Option<u32>) -> Fallible<Root<HTMLImageElement>> {
let document = global.as_window().Document();
let image = HTMLImageElement::new(atom!("img"), None, document.r());
let image = HTMLImageElement::new(atom!("img"), None, &document);
if let Some(w) = width {
image.SetWidth(w);
}