gfx, html, layout: Unbreak images by removing a bad copy

This commit is contained in:
Patrick Walton 2012-11-18 21:14:54 -08:00
parent 61f558dffc
commit 0c72f6ded8
3 changed files with 14 additions and 6 deletions

View file

@ -52,7 +52,10 @@ impl DisplayItem {
let baseline_origin = Point2D(origin.x, origin.y + font.metrics.ascent);
font.draw_text_into_context(ctx, new_run, range, baseline_origin, color);
},
Image(_, ref img) => ctx.draw_image(self.d().bounds, clone_arc(img)),
Image(_, ref img) => {
debug!("drawing image at %?", self.d().bounds);
ctx.draw_image(self.d().bounds, clone_arc(img));
}
Border(_, width, color) => ctx.draw_border(&self.d().bounds, width, color),
}

View file

@ -259,7 +259,7 @@ pub fn parse_html(scope: NodeScope,
_ => {}
}
},
~HTMLImageElement(copy d) => { // FIXME: Bad copy.
~HTMLImageElement(ref d) => {
do elem.get_attr(~"src").iter |img_url_str| {
let img_url = make_url(copy *img_url_str, Some(copy *url));
d.image = Some(copy img_url);

View file

@ -440,10 +440,15 @@ impl RenderBox : RenderBoxMethods {
},
ImageBox(_,i) => {
match i.get_image() {
Some(image) => list.append_item(~DisplayItem::new_Image(&abs_box_bounds,
arc::clone(&image))),
/* No image data at all? Okay, add some fallback content instead. */
None => ()
Some(image) => {
debug!("(building display list) building image box");
list.append_item(~DisplayItem::new_Image(&abs_box_bounds,
arc::clone(&image)));
}
None => {
/* No image data at all? Okay, add some fallback content instead. */
debug!("(building display list) no image :(");
}
}
}
}