From 0c72f6ded8e580d8ded70eb6fed014d5b0e42826 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Sun, 18 Nov 2012 21:14:54 -0800 Subject: [PATCH] gfx, html, layout: Unbreak images by removing a bad copy --- src/servo-gfx/display_list.rs | 5 ++++- src/servo/html/hubbub_html_parser.rs | 2 +- src/servo/layout/box.rs | 13 +++++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/servo-gfx/display_list.rs b/src/servo-gfx/display_list.rs index f8c97319318..49bab4d9ab0 100644 --- a/src/servo-gfx/display_list.rs +++ b/src/servo-gfx/display_list.rs @@ -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), } diff --git a/src/servo/html/hubbub_html_parser.rs b/src/servo/html/hubbub_html_parser.rs index 59d16d4897f..a1656f5efb2 100644 --- a/src/servo/html/hubbub_html_parser.rs +++ b/src/servo/html/hubbub_html_parser.rs @@ -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); diff --git a/src/servo/layout/box.rs b/src/servo/layout/box.rs index 7deced40404..e96fda42839 100644 --- a/src/servo/layout/box.rs +++ b/src/servo/layout/box.rs @@ -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 :("); + } } } }