mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
stylo: Fix a serialization bug for string pseudos.
The string is null-terminated, so we need to avoid passing that last null character.
This commit is contained in:
parent
ef3903163d
commit
e136863939
1 changed files with 5 additions and 1 deletions
|
@ -235,8 +235,12 @@ impl ToCss for NonTSPseudoClass {
|
||||||
$(NonTSPseudoClass::$s_name(ref s) => {
|
$(NonTSPseudoClass::$s_name(ref s) => {
|
||||||
write!(dest, ":{}(", $s_css)?;
|
write!(dest, ":{}(", $s_css)?;
|
||||||
{
|
{
|
||||||
|
// FIXME(emilio): Avoid the extra allocation!
|
||||||
let mut css = CssStringWriter::new(dest);
|
let mut css = CssStringWriter::new(dest);
|
||||||
css.write_str(&String::from_utf16(&s).unwrap())?;
|
|
||||||
|
// Discount the null char in the end from the
|
||||||
|
// string.
|
||||||
|
css.write_str(&String::from_utf16(&s[..s.len() - 1]).unwrap())?;
|
||||||
}
|
}
|
||||||
return dest.write_str(")")
|
return dest.write_str(")")
|
||||||
}, )*
|
}, )*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue