aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2020-09-05 00:42:43 +0000
committerEmilio Cobos Álvarez <emilio@crisal.io>2021-02-26 16:44:05 +0100
commitcd7619dbf64493bccbab28c1ea3cb50b74c81cd8 (patch)
tree94b048e74ef92468bf116b099d5ebb1e3164c217
parent74c449c04c799cd8b8830ee35b0891a7618bbe1a (diff)
downloadservo-cd7619dbf64493bccbab28c1ea3cb50b74c81cd8.tar.gz
servo-cd7619dbf64493bccbab28c1ea3cb50b74c81cd8.zip
style: Make @font-face and @counter-style serialization closer other browsers and style rules.
Style rules serialize on one line and so should @font-face blocks. Part of https://github.com/w3c/csswg-drafts/issues/4828. Differential Revision: https://phabricator.services.mozilla.com/D89302
-rw-r--r--components/style/counter_style/mod.rs6
-rw-r--r--components/style/font_face.rs13
2 files changed, 11 insertions, 8 deletions
diff --git a/components/style/counter_style/mod.rs b/components/style/counter_style/mod.rs
index ecdc8828ec1..c7854b1ef1e 100644
--- a/components/style/counter_style/mod.rs
+++ b/components/style/counter_style/mod.rs
@@ -232,12 +232,12 @@ macro_rules! counter_style_descriptors {
fn to_css(&self, _guard: &SharedRwLockReadGuard, dest: &mut CssStringWriter) -> fmt::Result {
dest.write_str("@counter-style ")?;
self.name.to_css(&mut CssWriter::new(dest))?;
- dest.write_str(" {\n")?;
+ dest.write_str(" { ")?;
$(
if let Some(ref value) = self.$ident {
- dest.write_str(concat!(" ", $name, ": "))?;
+ dest.write_str(concat!($name, ": "))?;
ToCss::to_css(value, &mut CssWriter::new(dest))?;
- dest.write_str(";\n")?;
+ dest.write_str("; ")?;
}
)+
dest.write_str("}")
diff --git a/components/style/font_face.rs b/components/style/font_face.rs
index 3ddd6b69a85..24204efc131 100644
--- a/components/style/font_face.rs
+++ b/components/style/font_face.rs
@@ -456,9 +456,9 @@ macro_rules! font_face_descriptors_common {
pub fn decl_to_css(&self, dest: &mut CssStringWriter) -> fmt::Result {
$(
if let Some(ref value) = self.$ident {
- dest.write_str(concat!(" ", $name, ": "))?;
+ dest.write_str(concat!($name, ": "))?;
ToCss::to_css(value, &mut CssWriter::new(dest))?;
- dest.write_str(";\n")?;
+ dest.write_str("; ")?;
}
)*
Ok(())
@@ -469,8 +469,11 @@ macro_rules! font_face_descriptors_common {
type Declaration = ();
type Error = StyleParseErrorKind<'i>;
- fn parse_value<'t>(&mut self, name: CowRcStr<'i>, input: &mut Parser<'i, 't>)
- -> Result<(), ParseError<'i>> {
+ fn parse_value<'t>(
+ &mut self,
+ name: CowRcStr<'i>,
+ input: &mut Parser<'i, 't>,
+ ) -> Result<(), ParseError<'i>> {
match_ignore_ascii_case! { &*name,
$(
$name if is_descriptor_enabled!($name) => {
@@ -493,7 +496,7 @@ macro_rules! font_face_descriptors_common {
impl ToCssWithGuard for FontFaceRuleData {
// Serialization of FontFaceRule is not specced.
fn to_css(&self, _guard: &SharedRwLockReadGuard, dest: &mut CssStringWriter) -> fmt::Result {
- dest.write_str("@font-face {\n")?;
+ dest.write_str("@font-face { ")?;
self.decl_to_css(dest)?;
dest.write_str("}")
}