mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
gfx, html, layout: Unbreak images by removing a bad copy
This commit is contained in:
parent
61f558dffc
commit
0c72f6ded8
3 changed files with 14 additions and 6 deletions
|
@ -52,7 +52,10 @@ impl DisplayItem {
|
||||||
let baseline_origin = Point2D(origin.x, origin.y + font.metrics.ascent);
|
let baseline_origin = Point2D(origin.x, origin.y + font.metrics.ascent);
|
||||||
font.draw_text_into_context(ctx, new_run, range, baseline_origin, color);
|
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),
|
Border(_, width, color) => ctx.draw_border(&self.d().bounds, width, color),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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| {
|
do elem.get_attr(~"src").iter |img_url_str| {
|
||||||
let img_url = make_url(copy *img_url_str, Some(copy *url));
|
let img_url = make_url(copy *img_url_str, Some(copy *url));
|
||||||
d.image = Some(copy img_url);
|
d.image = Some(copy img_url);
|
||||||
|
|
|
@ -440,10 +440,15 @@ impl RenderBox : RenderBoxMethods {
|
||||||
},
|
},
|
||||||
ImageBox(_,i) => {
|
ImageBox(_,i) => {
|
||||||
match i.get_image() {
|
match i.get_image() {
|
||||||
Some(image) => list.append_item(~DisplayItem::new_Image(&abs_box_bounds,
|
Some(image) => {
|
||||||
arc::clone(&image))),
|
debug!("(building display list) building image box");
|
||||||
/* No image data at all? Okay, add some fallback content instead. */
|
list.append_item(~DisplayItem::new_Image(&abs_box_bounds,
|
||||||
None => ()
|
arc::clone(&image)));
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
/* No image data at all? Okay, add some fallback content instead. */
|
||||||
|
debug!("(building display list) no image :(");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue