From 6ed5d967fd6555cfbacd04897000d8d8949cfe97 Mon Sep 17 00:00:00 2001 From: Trevor Parscal Date: Tue, 7 Dec 2010 22:27:00 +0000 Subject: [PATCH] Improves on r77693 by placing ResourceLoader "only styles" CSS links together with the other CSS links in buildCssLink rather than getHeadItems which is used for meta information. --- includes/OutputPage.php | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 4530c1c245..a7f7e2d1dc 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2231,8 +2231,8 @@ class OutputPage { $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n"; $ret .= implode( "\n", array( - $this->getHeadLinks( $sk ), - $this->buildCssLinks(), + $this->getHeadLinks(), + $this->buildCssLinks( $sk ), $this->getHeadItems(), ) ); if ( $sk->usercss ) { @@ -2517,7 +2517,7 @@ class OutputPage { /** * @return string HTML tag links to be put in the header. */ - public function getHeadLinks( Skin $sk ) { + public function getHeadLinks() { global $wgFeed; // Ideally this should happen earlier, somewhere. :P @@ -2588,19 +2588,6 @@ class OutputPage { } } - // Split the styles into three groups - $styles = array( 'other' => array(), 'user' => array(), 'site' => array() ); - $resourceLoader = $this->getResourceLoader(); - foreach ( $this->getModuleStyles() as $name ) { - $group = $resourceLoader->getModule( $name )->getGroup(); - // Modules in groups named "other" or anything different than "user" or "site" will - // be placed in the "other" group - $styles[isset( $style[$group] ) ? $group : 'other'][] = $name; - } - // Add styles to tags, user modules last - $tags[] = $this->makeResourceLoaderLink( - $sk, array_merge( $styles['other'], $styles['site'], $styles['user'] ), 'styles' - ); return implode( "\n", $tags ); } @@ -2658,8 +2645,23 @@ class OutputPage { * Build a set of s for the stylesheets specified in the $this->styles array. * These will be applied to various media & IE conditionals. */ - public function buildCssLinks() { - return implode( "\n", $this->buildCssLinksArray() ); + public function buildCssLinks( $sk ) { + // Split the styles into three groups + $styles = array( 'other' => array(), 'user' => array(), 'site' => array() ); + $resourceLoader = $this->getResourceLoader(); + foreach ( $this->getModuleStyles() as $name ) { + $group = $resourceLoader->getModule( $name )->getGroup(); + // Modules in groups named "other" or anything different than "user" or "site" will + // be placed in the "other" group + $styles[isset( $style[$group] ) ? $group : 'other'][] = $name; + } + // Add tags created using legacy methods + $tags = $this->buildCssLinksArray(); + // Add ResourceLoader module style tags + $tags[] = $this->makeResourceLoaderLink( + $sk, array_merge( $styles['other'], $styles['site'], $styles['user'] ), 'styles' + ); + return implode( "\n", $tags ); } public function buildCssLinksArray() { -- 2.20.1