Add SpecifiedImageUrl for <url> used as images.

This commit is contained in:
Xidorn Quan 2018-03-08 21:31:05 +11:00
parent 14b708311b
commit a99ca543cd
18 changed files with 151 additions and 136 deletions

View file

@ -3544,7 +3544,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetBackgroundImage(
use style::properties::longhands::background_image::SpecifiedValue as BackgroundImage;
use style::values::Either;
use style::values::generics::image::Image;
use style::values::specified::url::SpecifiedUrl;
use style::values::specified::url::SpecifiedImageUrl;
let url_data = unsafe { RefPtr::from_ptr_ref(&raw_extra_data) };
let string = unsafe { (*value).to_string() };
@ -3555,8 +3555,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetBackgroundImage(
ParsingMode::DEFAULT,
QuirksMode::NoQuirks,
);
if let Ok(mut url) = SpecifiedUrl::parse_from_string(string.into(), &context) {
url.build_image_value();
if let Ok(url) = SpecifiedImageUrl::parse_from_string(string.into(), &context) {
let decl = PropertyDeclaration::BackgroundImage(BackgroundImage(
vec![Either::Second(Image::Url(url))]
));

View file

@ -42,10 +42,10 @@ size_of_test!(test_size_of_rule_node, RuleNode, 80);
// we only pass `&mut SourcePropertyDeclaration` references around.
size_of_test!(test_size_of_parsed_declaration, style::properties::SourcePropertyDeclaration, 608);
size_of_test!(test_size_of_computed_image, computed::image::Image, 40);
size_of_test!(test_size_of_specified_image, specified::image::Image, 40);
size_of_test!(test_size_of_computed_image, computed::image::Image, 32);
size_of_test!(test_size_of_specified_image, specified::image::Image, 32);
// FIXME(bz): These can shrink if we move the None_ value inside the
// enum instead of paying an extra word for the Either discriminant.
size_of_test!(test_size_of_computed_image_layer, computed::image::ImageLayer, 40);
size_of_test!(test_size_of_specified_image_layer, specified::image::ImageLayer, 40);
size_of_test!(test_size_of_computed_image_layer, computed::image::ImageLayer, 32);
size_of_test!(test_size_of_specified_image_layer, specified::image::ImageLayer, 32);