mirror of
https://github.com/servo/servo.git
synced 2025-08-09 23:45:35 +01:00
style: Serialize a bunch of image properties with Servo.
I had to fix the conversion for BackgroundSize too, hopefully we can simplify all this using cbindgen in the future instead of CalcValue. Differential Revision: https://phabricator.services.mozilla.com/D7580
This commit is contained in:
parent
0d5d5a9c82
commit
7345af613a
4 changed files with 63 additions and 19 deletions
|
@ -273,14 +273,18 @@ impl ToComputedValue for SpecifiedImageUrl {
|
|||
}
|
||||
}
|
||||
|
||||
fn serialize_computed_url<W>(url_value_data: &URLValueData, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
fn serialize_computed_url<W>(
|
||||
url_value_data: &URLValueData,
|
||||
dest: &mut CssWriter<W>,
|
||||
get_url: unsafe extern "C" fn(*const URLValueData, *mut nsCString) -> (),
|
||||
) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
dest.write_str("url(")?;
|
||||
unsafe {
|
||||
let mut string = nsCString::new();
|
||||
bindings::Gecko_GetComputedURLSpec(url_value_data, &mut string);
|
||||
get_url(url_value_data, &mut string);
|
||||
string.as_str_unchecked().to_css(dest)?;
|
||||
}
|
||||
dest.write_char(')')
|
||||
|
@ -298,7 +302,11 @@ impl ToCss for ComputedUrl {
|
|||
where
|
||||
W: Write,
|
||||
{
|
||||
serialize_computed_url(&self.0.url_value._base, dest)
|
||||
serialize_computed_url(
|
||||
&self.0.url_value._base,
|
||||
dest,
|
||||
bindings::Gecko_GetComputedURLSpec,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,7 +327,11 @@ impl ToCss for ComputedImageUrl {
|
|||
where
|
||||
W: Write,
|
||||
{
|
||||
serialize_computed_url(&self.0.image_value._base, dest)
|
||||
serialize_computed_url(
|
||||
&self.0.image_value._base,
|
||||
dest,
|
||||
bindings::Gecko_GetComputedImageURLSpec,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue