diff options
author | Timo Tijhof <krinkle@fastmail.com> | 2023-07-13 02:39:09 +0100 |
---|---|---|
committer | Krinkle <krinkle@fastmail.com> | 2023-07-13 01:52:57 +0000 |
commit | e9871da9fa2e986b00f6467c49f34b1006e54bec (patch) | |
tree | ade327db990d75243138f30b97eb6fb17f4e1ff9 | |
parent | 0efb75c1694a7b868623111aa8fdf2d0d2841804 (diff) | |
download | mediawikicore-e9871da9fa2e986b00f6467c49f34b1006e54bec.tar.gz mediawikicore-e9871da9fa2e986b00f6467c49f34b1006e54bec.zip |
ResourceLoader: Remove unused rasterized URL in ImageModule::getCssDeclarations
The code appeared such that `getUrl(,'rasterized')` is still in active
use and somehow exposed, but it wasn't. Remove it as such, since the
parameter isn't used.
Bug: T329127
Bug: T321394
Change-Id: I32209b5c7628eea874dc0dbdb0bb361098fd2da8
-rw-r--r-- | includes/ResourceLoader/ImageModule.php | 11 | ||||
-rw-r--r-- | tests/phpunit/includes/ResourceLoader/ImageModuleTest.php | 2 |
2 files changed, 5 insertions, 8 deletions
diff --git a/includes/ResourceLoader/ImageModule.php b/includes/ResourceLoader/ImageModule.php index b955a758233d..c90b9757ce93 100644 --- a/includes/ResourceLoader/ImageModule.php +++ b/includes/ResourceLoader/ImageModule.php @@ -378,21 +378,18 @@ class ImageModule extends Module { $imageDataUri = $this->useDataURI ? $image->getDataUri( $context, $variant, 'original' ) : false; $primaryUrl = $imageDataUri ?: $image->getUrl( $context, $script, $variant, 'original' ); $declarations = $this->getCssDeclarations( - $primaryUrl, - $image->getUrl( $context, $script, $variant, 'rasterized' ) + $primaryUrl ); return implode( "\n\t", $declarations ); } /** - * This method formerly provided fallback rasterized images for browsers that do not support SVG. - * Now kept for backwards-compatibility. + * Format the CSS declaration for the image (defaults to background-image property). * * @param string $primary Primary URI - * @param string $fallback Fallback URI (unused) - * @return string[] CSS declarations to use given URIs as background-image + * @return string[] CSS declarations */ - protected function getCssDeclarations( $primary, $fallback ): array { + protected function getCssDeclarations( $primary ): array { $primaryUrl = CSSMin::buildUrlValue( $primary ); return [ "background-image: $primaryUrl;", diff --git a/tests/phpunit/includes/ResourceLoader/ImageModuleTest.php b/tests/phpunit/includes/ResourceLoader/ImageModuleTest.php index ba758fca1273..878dafcc8aef 100644 --- a/tests/phpunit/includes/ResourceLoader/ImageModuleTest.php +++ b/tests/phpunit/includes/ResourceLoader/ImageModuleTest.php @@ -303,7 +303,7 @@ class ImageModuleTestable extends ImageModule { * Replace with a stub to make test cases easier to write. * @inheritDoc */ - protected function getCssDeclarations( $primary, $fallback ): array { + protected function getCssDeclarations( $primary ): array { return [ '...' ]; } } |