From ae336d89efc3b06dce802c3a337267142badb447 Mon Sep 17 00:00:00 2001 From: Esanders Date: Fri, 29 Sep 2017 13:39:50 +0000 Subject: [PATCH] Revert "CSSMin: Mangle whitespace in embedded SVGs" This reverts commit dfd42d2653ea9ff2ca05dab7cd6f2285abba9d08. Bug: T176884 Change-Id: Iddc98332d0b5a31d3a1c56c14014a53a06393f21 --- includes/libs/CSSMin.php | 7 ------- tests/phpunit/includes/libs/CSSMinTest.php | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php index a9c021e697..adaae178f5 100644 --- a/includes/libs/CSSMin.php +++ b/includes/libs/CSSMin.php @@ -150,14 +150,7 @@ class CSSMin { '%3A' => ':', // Unencode colons '%3D' => '=', // Unencode equals signs '%22' => '"', // Unencode double quotes - '%0A' => ' ', // Change newlines to spaces - '%0D' => ' ', // Change carriage returns to spaces - '%09' => ' ', // Change tabs to spaces ] ); - // Consolidate runs of multiple spaces in a row - $encoded = preg_replace( '/ {2,}/', ' ', $encoded ); - // Remove leading and trailing spaces - $encoded = preg_replace( '/^ | $/', '', $encoded ); $uri = 'data:' . $type . ',' . $encoded; if ( !$ie8Compat || strlen( $uri ) < self::DATA_URI_SIZE_LIMIT ) { return $uri; diff --git a/tests/phpunit/includes/libs/CSSMinTest.php b/tests/phpunit/includes/libs/CSSMinTest.php index a770fa45a8..62f990b911 100644 --- a/tests/phpunit/includes/libs/CSSMinTest.php +++ b/tests/phpunit/includes/libs/CSSMinTest.php @@ -271,9 +271,9 @@ class CSSMinTest extends MediaWikiTestCase { // data: URIs for red.gif, green.gif, circle.svg $red = 'data:image/gif;base64,R0lGODlhAQABAIAAAP8AADAAACwAAAAAAQABAAACAkQBADs='; $green = 'data:image/gif;base64,R0lGODlhAQABAIAAAACAADAAACwAAAAAAQABAAACAkQBADs='; - $svg = 'data:image/svg+xml,%3C%3Fxml version="1.0" encoding="UTF-8"%3F%3E ' + $svg = 'data:image/svg+xml,%3C%3Fxml version="1.0" encoding="UTF-8"%3F%3E%0A' . '%3Csvg xmlns="http://www.w3.org/2000/svg" width="8" height=' - . '"8"%3E %3Ccircle cx="4" cy="4" r="2"/%3E %3C/svg%3E'; + . '"8"%3E%0A%09%3Ccircle cx="4" cy="4" r="2"/%3E%0A%3C/svg%3E%0A'; // @codingStandardsIgnoreStart Generic.Files.LineLength return [ -- 2.20.1