From 2dbe4d7af1521cb58db28bae7635cd3f5f3f6316 Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Tue, 12 Nov 2019 11:09:26 -0800 Subject: [PATCH] Drop usage of mediawiki.skinning.interface module in favor of SkinModule Thanks to the dependent change, the print logo is now provided in core so we can remove the custom Vector ResourceLoader module ResourceLoaderLessModule is replaced with a ResourceLoaderSkinModule and gains the features capability replacing the need for 'mediawiki.skinning.interface' making use of the changes added in 6845912bcf1. Note that for cached HTML both 'mediawiki.skinning.interface' and skins.vector.styles will be loaded. We can avoid this by renaming skins.vector.styles if necessary (but I'm not sure if we'd want to do that) Bug: T232140 Depends-On: I00899c16c0325f36b671baf17e88c2b5187b3526 Change-Id: I569e0d800e147eabc7852567acd140108613f074 --- includes/ResourceLoaderLessModule.php | 64 ------------------------ includes/SkinVector.php | 1 - resources/skins.vector.styles/print.less | 31 ------------ skin.json | 6 +-- 4 files changed, 3 insertions(+), 99 deletions(-) delete mode 100644 includes/ResourceLoaderLessModule.php diff --git a/includes/ResourceLoaderLessModule.php b/includes/ResourceLoaderLessModule.php deleted file mode 100644 index 4386726c0..000000000 --- a/includes/ResourceLoaderLessModule.php +++ /dev/null @@ -1,64 +0,0 @@ -getConfigFactory()->makeConfig( 'vector' ); - $printLogo = $config->get( 'VectorPrintLogo' ); - } catch ( ConfigException $e ) { - // Config is not available when running in the context of the MediaWiki installer. (T183640) - $printLogo = false; - } - if ( $printLogo ) { - $lessVars[ 'printLogo' ] = true; - $lessVars[ 'printLogoUrl' ] = CSSMin::buildUrlValue( $printLogo['url'] ); - $lessVars[ 'printLogoWidth' ] = intval( $printLogo['width'] ); - $lessVars[ 'printLogoHeight' ] = intval( $printLogo['height'] ); - } else { - $lessVars[ 'printLogo' ] = false; - } - return $lessVars; - } -} diff --git a/includes/SkinVector.php b/includes/SkinVector.php index d3ee83a15..140d4c964 100644 --- a/includes/SkinVector.php +++ b/includes/SkinVector.php @@ -64,7 +64,6 @@ class SkinVector extends SkinTemplate { public function getDefaultModules() { $modules = parent::getDefaultModules(); // add vector skin styles and vector module - $modules['styles']['skin'][] = 'mediawiki.skinning.interface'; $modules['styles']['skin'][] = 'skins.vector.styles'; $modules['core'][] = 'skins.vector.js'; diff --git a/resources/skins.vector.styles/print.less b/resources/skins.vector.styles/print.less index 638e91537..d0825cb9c 100644 --- a/resources/skins.vector.styles/print.less +++ b/resources/skins.vector.styles/print.less @@ -6,29 +6,6 @@ @border-color-base: @wmui-color-base0; @border-color-footer: #eee; -// We have to render the wordmark image before the print dialog is invoked, otherwise the image -// won't render in the printed file. Use a little hack to render the image outside the viewport -// and bring it in the viewport in print view. -.firstHeading { - // We could also use a CSS background to display the logo. - // The problem is that the logo won't be printed unless the user prints the background too. - // Note. This specification does not fully define the interaction of :before and :after with - // replaced elements (such as IMG in HTML). This will be defined in more detail in a future - // specification. See https://www.w3.org/TR/CSS2/generate.html#before-after-content - & when( @printLogo = 1 ) { - &:before { - content: @printLogoUrl; - display: block; - height: ~'@{printLogoHeight}px'; - left: -9999px; - line-height: 0; // line-height is needed for correctly displaying the size of the content box. - margin-bottom: 20px; - position: absolute; - width: ~'@{printLogoWidth}px'; - } - } -} - @media print { /* These styles retain the existing typography in screen.less @@ -79,14 +56,6 @@ line-height: 28pt; margin-bottom: 20px; padding-bottom: 5px; - - // Bring back the wordmark to the viewport (see above how it's rendered outside the viewport). - & when( @printLogo = 1 ) { - &:before { - left: auto; - position: relative; - } - } } // Headings diff --git a/skin.json b/skin.json index 0c2e83634..b38b25183 100644 --- a/skin.json +++ b/skin.json @@ -24,8 +24,7 @@ "AutoloadClasses": { "Vector\\Hooks": "includes/Hooks.php", "SkinVector": "includes/SkinVector.php", - "VectorTemplate": "includes/VectorTemplate.php", - "Vector\\ResourceLoaderLessModule": "includes/ResourceLoaderLessModule.php" + "VectorTemplate": "includes/VectorTemplate.php" }, "Hooks": { "BeforePageDisplayMobile": "Vector\\Hooks::onBeforePageDisplayMobile" @@ -33,7 +32,8 @@ "@note": "When modifying skins.vector.styles definition, make sure the installer still works", "ResourceModules": { "skins.vector.styles": { - "class": "Vector\\ResourceLoaderLessModule", + "class": "ResourceLoaderSkinModule", + "features": [ "elements", "content", "interface", "logo" ], "targets": [ "desktop", "mobile"