From 764c50908cee15826ad7513482b62fb9f8bc4cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E4=B8=9D?= Date: Thu, 24 Mar 2022 17:43:42 +0800 Subject: [PATCH] fix: `font-family: revert/revert-layer` cannot remove quotation marks --- src/lib.rs | 10 ++++++++++ src/properties/font.rs | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 381bdcef..fa7ab42f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3636,7 +3636,17 @@ mod tests { minify_test(".foo { font-family: inherit; }", ".foo{font-family:inherit}"); minify_test(".foo { font-family: inherit test; }", ".foo{font-family:inherit test}"); minify_test(".foo { font-family: 'inherit test'; }", ".foo{font-family:inherit test}"); + minify_test(".foo { font-family: revert; }", ".foo{font-family:revert}"); + minify_test(".foo { font-family: 'revert'; }", ".foo{font-family:\"revert\"}"); + minify_test(".foo { font-family: revert-layer; }", ".foo{font-family:revert-layer}"); + minify_test(".foo { font-family: revert-layer, serif; }", ".foo{font-family:revert-layer,serif}"); + minify_test(".foo { font-family: 'revert', sans-serif; }", ".foo{font-family:\"revert\",sans-serif}"); + minify_test(".foo { font-family: 'revert', foo, sans-serif; }", ".foo{font-family:\"revert\",foo,sans-serif}"); minify_test(".foo { font-family: ''; }", ".foo{font-family:\"\"}"); + + // font-family in @font-face + minify_test("@font-face { font-family: 'revert'; }", "@font-face{font-family:\"revert\"}"); + minify_test("@font-face { font-family: 'revert-layer'; }", "@font-face{font-family:\"revert-layer\"}"); } #[test] diff --git a/src/properties/font.rs b/src/properties/font.rs index 6137e560..1bb93f95 100644 --- a/src/properties/font.rs +++ b/src/properties/font.rs @@ -263,6 +263,11 @@ enum_property! { // Default is also reserved by the type. // https://www.w3.org/TR/css-values-4/#custom-idents "default": Default, + + // CSS defaulting keywords + // https://drafts.csswg.org/css-cascade-5/#defaulting-keywords + "revert": Revert, + "revert-layer": RevertLayer, } }