From baa79c70454d6598b59506706bff0854cda1b2a0 Mon Sep 17 00:00:00 2001 From: Daniel Friesen Date: Fri, 20 Dec 2013 17:26:14 -0800 Subject: [PATCH] Split skins.common up into a proper trio of .elements, .content, and .interface modules. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Ideally it would be possible to add these as dependencies and also make them depend on each other instead of partially duplicating the list of stylesheets, but ResourceLoader’s dependencies are completely broken for skin stylesheets. Followup to Ia193571afffff36ecb1f14ee9036fb9bb98347e7 Change-Id: I56758908c2f41430c7301a0ea6a4cf8b1eaa7fd8 --- includes/installer/WebInstallerOutput.php | 2 +- resources/Resources.php | 63 +++++++++++++++++++---- skins/MonoBook.php | 2 +- skins/Vector.php | 2 +- 4 files changed, 56 insertions(+), 13 deletions(-) diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php index 2a3a58440b..25634baf68 100644 --- a/includes/installer/WebInstallerOutput.php +++ b/includes/installer/WebInstallerOutput.php @@ -117,7 +117,7 @@ class WebInstallerOutput { // and loaded as one file. $moduleNames = array( 'mediawiki.legacy.shared', - 'skins.common', + 'skins.common.interface', 'skins.vector.styles', 'mediawiki.legacy.config', ); diff --git a/resources/Resources.php b/resources/Resources.php index 6fd16659c6..35e5dd53b5 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -50,6 +50,59 @@ return array( // Scripts for the dynamic language specific data, like grammar forms. 'mediawiki.language.data' => array( 'class' => 'ResourceLoaderLanguageDataModule' ), + /** + * Common skin styles, grouped into three graded levels. + * + * Level 1 "elements": + * The base level that only contains the most basic of common skin styles. + * Only styles for single elements are included, no styling for complex structures like the TOC + * is present. This level is for skins that want to implement the entire style of even content area + * structures like the TOC themselves. + * + * Level 2 "content": + * The most commonly used level for skins implemented from scratch. This level includes all the single + * element styles from "elements" as well as styles for complex structures such as the TOC that are output + * in the content area by MediaWiki rather than the skin. Essentially this is the common level that lets + * skins leave the style of the content area as it is normally styled, while leaving the rest of the skin + * up to the skin implementation. + * + * Level 3 "interface": + * The highest level, this stylesheet contains extra common styles for classes like .firstHeading, #contentSub, + * et cetera which are not outputted by MediaWiki but are common to skins like MonoBook, Vector, etc... + * Essentially this level is for styles that are common to MonoBook clones. And since practically every skin + * that currently exists within core is a MonoBook clone, all our core skins currently use this level. + * + * These modules are typically loaded by addModuleStyles which has absolutely no concept of dependency + * management. As a result the skins.common.* modules contain duplicate stylesheet references instead of + * setting 'dependencies' to the lower level the module is based on. For this reason avoid including multiple + * skins.common.* modules into your skin as this will result in duplicate css. + */ + 'skins.common.elements' => array( + 'styles' => array( + 'common/commonElements.css' => array( 'media' => 'screen' ), + ), + 'remoteBasePath' => $GLOBALS['wgStylePath'], + 'localBasePath' => $GLOBALS['wgStyleDirectory'], + ), + 'skins.common.content' => array( + 'styles' => array( + 'common/commonElements.css' => array( 'media' => 'screen' ), + 'common/commonContent.css' => array( 'media' => 'screen' ), + ), + 'remoteBasePath' => $GLOBALS['wgStylePath'], + 'localBasePath' => $GLOBALS['wgStyleDirectory'], + ), + 'skins.common.interface' => array( + // Used in the web installer. Test it after modifying this definition! + 'styles' => array( + 'common/commonElements.css' => array( 'media' => 'screen' ), + 'common/commonContent.css' => array( 'media' => 'screen' ), + 'common/commonInterface.css' => array( 'media' => 'screen' ), + ), + 'remoteBasePath' => $GLOBALS['wgStylePath'], + 'localBasePath' => $GLOBALS['wgStyleDirectory'], + ), + /** * Skins * Be careful not to add 'scripts' to these modules, @@ -76,16 +129,6 @@ return array( 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => $GLOBALS['wgStyleDirectory'], ), - 'skins.common' => array( - // Used in the web installer. Test it after modifying this definition! - 'styles' => array( - 'common/commonElements.css' => array( 'media' => 'screen' ), - 'common/commonContent.css' => array( 'media' => 'screen' ), - 'common/commonInterface.css' => array( 'media' => 'screen' ), - ), - 'remoteBasePath' => $GLOBALS['wgStylePath'], - 'localBasePath' => $GLOBALS['wgStyleDirectory'], - ), // FIXME: Remove in favour of skins.monobook.styles when cache expires 'skins.monobook' => array( 'styles' => array( diff --git a/skins/MonoBook.php b/skins/MonoBook.php index fdcb0c1654..bd914ceaa6 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -45,7 +45,7 @@ class SkinMonoBook extends SkinTemplate { function setupSkinUserCss( OutputPage $out ) { parent::setupSkinUserCss( $out ); - $out->addModuleStyles( array( 'skins.common', 'skins.monobook.styles' ) ); + $out->addModuleStyles( array( 'skins.common.interface', 'skins.monobook.styles' ) ); // TODO: Migrate all of these $out->addStyle( 'monobook/IE60Fixes.css', 'screen', 'IE 6' ); diff --git a/skins/Vector.php b/skins/Vector.php index a9ab8fbf64..00b920a44b 100644 --- a/skins/Vector.php +++ b/skins/Vector.php @@ -67,7 +67,7 @@ class SkinVector extends SkinTemplate { function setupSkinUserCss( OutputPage $out ) { parent::setupSkinUserCss( $out ); - $styles = array( 'skins.common', 'skins.vector.styles' ); + $styles = array( 'skins.common.interface', 'skins.vector.styles' ); wfRunHooks( 'SkinVectorStyleModules', array( &$this, &$styles ) ); $out->addModuleStyles( $styles ); } -- 2.20.1