forked from mirrors/gecko-dev
Bug 1854809 - Include quotes in AtomString CSS serialization r=emilio
The serialization of `AtomString` should include quotes itself rather than users of it having to do so themselves. Differential Revision: https://phabricator.services.mozilla.com/D189050
This commit is contained in:
parent
37aaf4d308
commit
ec54a400d5
4 changed files with 7 additions and 9 deletions
1
servo/components/selectors/CHANGES.md
Normal file
1
servo/components/selectors/CHANGES.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
- `parser.rs` no longer wraps values in quotes (`"..."`) but expects their `to_css` impl to already wrap it ([Gecko Bug 1854809](https://bugzilla.mozilla.org/show_bug.cgi?id=1854809))
|
||||||
|
|
@ -2291,9 +2291,7 @@ impl<Impl: SelectorImpl> ToCss for Component<Impl> {
|
||||||
dest.write_char('[')?;
|
dest.write_char('[')?;
|
||||||
local_name.to_css(dest)?;
|
local_name.to_css(dest)?;
|
||||||
operator.to_css(dest)?;
|
operator.to_css(dest)?;
|
||||||
dest.write_char('"')?;
|
|
||||||
value.to_css(dest)?;
|
value.to_css(dest)?;
|
||||||
dest.write_char('"')?;
|
|
||||||
match case_sensitivity {
|
match case_sensitivity {
|
||||||
ParsedCaseSensitivity::CaseSensitive |
|
ParsedCaseSensitivity::CaseSensitive |
|
||||||
ParsedCaseSensitivity::AsciiCaseInsensitiveIfInHtmlElementInHtmlDocument => {},
|
ParsedCaseSensitivity::AsciiCaseInsensitiveIfInHtmlElementInHtmlDocument => {},
|
||||||
|
|
@ -2397,9 +2395,7 @@ impl<Impl: SelectorImpl> ToCss for AttrSelectorWithOptionalNamespace<Impl> {
|
||||||
ref value,
|
ref value,
|
||||||
} => {
|
} => {
|
||||||
operator.to_css(dest)?;
|
operator.to_css(dest)?;
|
||||||
dest.write_char('"')?;
|
|
||||||
value.to_css(dest)?;
|
value.to_css(dest)?;
|
||||||
dest.write_char('"')?;
|
|
||||||
match case_sensitivity {
|
match case_sensitivity {
|
||||||
ParsedCaseSensitivity::CaseSensitive |
|
ParsedCaseSensitivity::CaseSensitive |
|
||||||
ParsedCaseSensitivity::AsciiCaseInsensitiveIfInHtmlElementInHtmlDocument => {},
|
ParsedCaseSensitivity::AsciiCaseInsensitiveIfInHtmlElementInHtmlDocument => {},
|
||||||
|
|
|
||||||
|
|
@ -177,15 +177,18 @@ impl cssparser::ToCss for AtomString {
|
||||||
where
|
where
|
||||||
W: Write,
|
W: Write,
|
||||||
{
|
{
|
||||||
|
// Wrap in quotes to form a string literal
|
||||||
|
dest.write_char('"')?;
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
{
|
{
|
||||||
cssparser::CssStringWriter::new(dest).write_str(self.as_ref())
|
cssparser::CssStringWriter::new(dest).write_str(self.as_ref())?;
|
||||||
}
|
}
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
{
|
{
|
||||||
self.0
|
self.0
|
||||||
.with_str(|s| cssparser::CssStringWriter::new(dest).write_str(s))
|
.with_str(|s| cssparser::CssStringWriter::new(dest).write_str(s))?;
|
||||||
}
|
}
|
||||||
|
dest.write_char('"')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -966,10 +966,8 @@ impl ToCss for Attr {
|
||||||
serialize_atom_identifier(&self.attribute, dest)?;
|
serialize_atom_identifier(&self.attribute, dest)?;
|
||||||
|
|
||||||
if !self.fallback.is_empty() {
|
if !self.fallback.is_empty() {
|
||||||
// Fallback will always be a string value for now, so always wrap in "..."
|
dest.write_str(", ")?;
|
||||||
dest.write_str(", \"")?;
|
|
||||||
self.fallback.to_css(dest)?;
|
self.fallback.to_css(dest)?;
|
||||||
dest.write_char('"')?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dest.write_char(')')
|
dest.write_char(')')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue