mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Use proper escaping for pseudo-class strings.
We always serialize as an atom, which is the previous behavior (though previous code was using string escaping which I think was not totally sound either...). Differential Revision: https://phabricator.services.mozilla.com/D4753
This commit is contained in:
parent
40d2cbe8ed
commit
d56e537882
1 changed files with 5 additions and 2 deletions
|
@ -21,6 +21,7 @@ use str::starts_with_ignore_ascii_case;
|
||||||
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
||||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss as ToCss_};
|
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss as ToCss_};
|
||||||
use thin_slice::ThinBoxedSlice;
|
use thin_slice::ThinBoxedSlice;
|
||||||
|
use values::serialize_atom_identifier;
|
||||||
|
|
||||||
pub use gecko::pseudo_element::{PseudoElement, EAGER_PSEUDOS, EAGER_PSEUDO_COUNT, PSEUDO_COUNT};
|
pub use gecko::pseudo_element::{PseudoElement, EAGER_PSEUDOS, EAGER_PSEUDO_COUNT, PSEUDO_COUNT};
|
||||||
pub use gecko::snapshot::SnapshotMap;
|
pub use gecko::snapshot::SnapshotMap;
|
||||||
|
@ -78,7 +79,9 @@ impl ToCss for NonTSPseudoClass {
|
||||||
match *self {
|
match *self {
|
||||||
$(NonTSPseudoClass::$name => concat!(":", $css),)*
|
$(NonTSPseudoClass::$name => concat!(":", $css),)*
|
||||||
$(NonTSPseudoClass::$s_name(ref s) => {
|
$(NonTSPseudoClass::$s_name(ref s) => {
|
||||||
return write!(dest, concat!(":", $s_css, "({})"), s)
|
write!(dest, concat!(":", $s_css, "("))?;
|
||||||
|
serialize_atom_identifier(s, dest)?;
|
||||||
|
return dest.write_char(')');
|
||||||
}, )*
|
}, )*
|
||||||
NonTSPseudoClass::MozLocaleDir(ref dir) => {
|
NonTSPseudoClass::MozLocaleDir(ref dir) => {
|
||||||
dest.write_str(":-moz-locale-dir(")?;
|
dest.write_str(":-moz-locale-dir(")?;
|
||||||
|
@ -99,7 +102,7 @@ impl ToCss for NonTSPseudoClass {
|
||||||
dest.write_str(", ")?;
|
dest.write_str(", ")?;
|
||||||
selector.to_css(dest)?;
|
selector.to_css(dest)?;
|
||||||
}
|
}
|
||||||
return dest.write_str(")")
|
return dest.write_char(')')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue