diff --git a/includes/sanitizers/class-amp-style-sanitizer.php b/includes/sanitizers/class-amp-style-sanitizer.php index 783b98c26d7..28658d89112 100644 --- a/includes/sanitizers/class-amp-style-sanitizer.php +++ b/includes/sanitizers/class-amp-style-sanitizer.php @@ -1561,7 +1561,7 @@ private function get_parsed_stylesheet( $stylesheet, $options = [] ) { $parsed = null; $cache_key = null; $cached = true; - $cache_group = 'amp-parsed-stylesheet-v35'; // This should be bumped whenever the PHP-CSS-Parser is updated or parsed format is updated. + $cache_group = 'amp-parsed-stylesheet-v36'; // This should be bumped whenever the PHP-CSS-Parser is updated or parsed format is updated. $use_transients = $this->should_use_transient_caching(); $cache_impacting_options = array_merge( @@ -2157,24 +2157,7 @@ private function process_css_list( CSSList $css_list, $options ) { $this->process_css_declaration_block( $css_item, $css_list, $options ) ); } elseif ( $css_item instanceof AtRuleBlockList ) { - if ( - '-moz-document' === $css_item->atRuleName() - && - 'url-prefix()' === $css_item->atRuleArgs() - && - in_array( 'supports', $options['allowed_at_rules'], true ) - ) { - // Replace `@-moz-document url-prefix()` with `@supports (-moz-appearance:meterbar)` as an alternative - // way to provide Firefox-specific style rules. This is a workaround since @-moz-document is not - // yet allowed in AMP, and this use of @supports is another recognized Firefox-specific CSS hack, - // per . - // For adding @-moz-document to AMP, see . - $new_css_item = new AtRuleBlockList( 'supports', '(-moz-appearance:meterbar)' ); - $new_css_item->setContents( $css_item->getContents() ); - $this->replace_inside_css_list( $css_list, $css_item, [ $new_css_item ] ); - $css_item = $new_css_item; // To process_css_list below. - $sanitized = false; - } elseif ( ! in_array( $css_item->atRuleName(), $options['allowed_at_rules'], true ) ) { + if ( ! in_array( $css_item->atRuleName(), $options['allowed_at_rules'], true ) ) { $error = [ 'code' => self::CSS_SYNTAX_INVALID_AT_RULE, 'at_rule' => $css_item->atRuleName(), diff --git a/tests/php/test-amp-style-sanitizer.php b/tests/php/test-amp-style-sanitizer.php index 25a9f2ad78b..a84b8690779 100644 --- a/tests/php/test-amp-style-sanitizer.php +++ b/tests/php/test-amp-style-sanitizer.php @@ -206,11 +206,11 @@ public function get_body_style_attribute_data() { '
', '
', [ - '@media screen and ( max-width: 640px ){body{font-size:small}}@font-face{font-family:"Open Sans";src:url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2")}@supports (-moz-appearance:meterbar){body{color:red}}@supports (display: grid){div{display:grid}}@-moz-keyframes appear{from{opacity:0}to{opacity:1}}@keyframes appear{from{opacity:0}to{opacity:1}}', + '@media screen and ( max-width: 640px ){body{font-size:small}}@font-face{font-family:"Open Sans";src:url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2")}@-moz-document url-prefix(){body{color:red}}@supports (display: grid){div{display:grid}}@-moz-keyframes appear{from{opacity:0}to{opacity:1}}@keyframes appear{from{opacity:0}to{opacity:1}}', ], ], - 'moz_document_transformed' => [ + 'moz_document_allowed' => [ '