diff options
Diffstat (limited to 'includes/libs')
-rw-r--r-- | includes/libs/CSSJanus.php | 16 | ||||
-rw-r--r-- | includes/libs/CSSMin.php | 14 |
2 files changed, 7 insertions, 23 deletions
diff --git a/includes/libs/CSSJanus.php b/includes/libs/CSSJanus.php index 7b7b4071fbfa..4cfc9b7b71f6 100644 --- a/includes/libs/CSSJanus.php +++ b/includes/libs/CSSJanus.php @@ -174,22 +174,6 @@ class CSSJanus { $css = $noFlipClass->detokenize( $css ); $css = $noFlipSingle->detokenize( $css ); - // Remove remaining /* @noflip */ annotations, they won't be needed anymore - // and can interfere with other code (bug 69698). - $css = self::nullTransform( $css ); - - return $css; - } - - /** - * Remove @noflip annotations, but don't do any other transforms. - * @param string $css stylesheet to transform - * @return string Transformed stylesheet - */ - public static function nullTransform( $css ) { - $patt = self::$patterns['noflip_annotation']; - $css = preg_replace( "/($patt)\\s*/i", '', $css ); - return $css; } diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php index dcaa6857a271..c69e79f5b23e 100644 --- a/includes/libs/CSSMin.php +++ b/includes/libs/CSSMin.php @@ -200,10 +200,9 @@ class CSSMin { $remote = substr( $remote, 0, -1 ); } - // Replace all comments by a placeholder so they will not interfere - // with the remapping - // Warning: This will also catch on anything looking like the start of - // a comment between quotation marks (e.g. "foo /* bar"). + // Replace all comments by a placeholder so they will not interfere with the remapping. + // Warning: This will also catch on anything looking like the start of a comment between + // quotation marks (e.g. "foo /* bar"). $comments = array(); $placeholder = uniqid( '', true ); @@ -226,12 +225,13 @@ class CSSMin { $source = preg_replace_callback( $pattern, - function ( $matchOuter ) use ( $local, $remote, $embedData ) { + function ( $matchOuter ) use ( $local, $remote, $embedData, $placeholder ) { $rule = $matchOuter[0]; - // Check for global @embed comment and remove it + // Check for global @embed comment and remove it. Allow other comments to be present + // before @embed (they have been replaced with placeholders at this point). $embedAll = false; - $rule = preg_replace( '/^(\s*)' . CSSMin::EMBED_REGEX . '\s*/', '$1', $rule, 1, $embedAll ); + $rule = preg_replace( '/^((?:\s+|' . $placeholder . '(\d+)x)*)' . CSSMin::EMBED_REGEX . '\s*/', '$1', $rule, 1, $embedAll ); // Build two versions of current rule: with remapped URLs // and with embedded data: URIs (where possible). |