mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #16595 - emilio:strings-are-hard, r=Manishearth
stylo: Fix a serialization bug for string pseudos. The string is null-terminated, so we need to avoid passing that last null character. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16595) <!-- Reviewable:end -->
This commit is contained in:
commit
8efa680774
1 changed files with 5 additions and 1 deletions
|
@ -235,8 +235,12 @@ impl ToCss for NonTSPseudoClass {
|
|||
$(NonTSPseudoClass::$s_name(ref s) => {
|
||||
write!(dest, ":{}(", $s_css)?;
|
||||
{
|
||||
// FIXME(emilio): Avoid the extra allocation!
|
||||
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(")")
|
||||
}, )*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue