mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
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
This commit is contained in:
parent
74c449c04c
commit
cd7619dbf6
2 changed files with 11 additions and 8 deletions
|
@ -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("}")
|
||||
|
|
|
@ -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("}")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue