Box gradients and rects in Image. r=xidorn

Gradients and rects are rare, and large.  Image is much smaller with them boxed.

This is part of of the fix for Gecko bug 1397614
<https://bugzilla.mozilla.org/show_bug.cgi?id=1397614>
This commit is contained in:
Boris Zbarsky 2017-09-09 04:31:25 -04:00
parent 91b748ec22
commit 26b39241f9
4 changed files with 65 additions and 13 deletions

View file

@ -138,7 +138,7 @@ impl Parse for Image {
return Ok(GenericImage::Url(url));
}
if let Ok(gradient) = input.try(|i| Gradient::parse(context, i)) {
return Ok(GenericImage::Gradient(gradient));
return Ok(GenericImage::Gradient(Box::new(gradient)));
}
#[cfg(feature = "servo")]
{
@ -151,7 +151,7 @@ impl Parse for Image {
{
image_rect.url.build_image_value();
}
return Ok(GenericImage::Rect(image_rect));
return Ok(GenericImage::Rect(Box::new(image_rect)));
}
Ok(GenericImage::Element(Image::parse_element(input)?))
}