From: Brion Vibber Date: Sun, 10 Aug 2008 00:54:26 +0000 (+0000) Subject: Revert r39021 "Tweak css load order (broken for extensions since r38116)" X-Git-Tag: 1.31.0-rc.0~45979 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=2142b0bb18d303c41d00fbac99c54596eba8e59b;p=lhc%2Fweb%2Fwiklou.git Revert r39021 "Tweak css load order (broken for extensions since r38116)" This regresses us back from using , which we want, to using @import, which we don't. There are a few reasons we don't want it: * IE and Firefox at least don't save @import'ed stylesheets when you save a web page as bundled HTML + resources, which is annoying * Allegedly, browsers may be more efficient about the order of things they load when using , however I haven't tested this * the CSS media markers may be different, we're trying to make that consistent... * Trying to get things to use a consistent interface so we can switch to merging and compressing all these files in a sane fashion --- diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 249ec1a348..89b0f690d8 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -982,42 +982,41 @@ class SkinTemplate extends Skin { $siteargs['ts'] = $wgUser->mTouched; } - $sitecss = $usercss = ''; // If we use the site's dynamic CSS, throw that in, too // Per-site custom styles - if( $wgUseSiteCss ) { + if ( $wgUseSiteCss ) { $query = wfArrayToCGI( array( 'usemsgcache' => 'yes', 'ctype' => 'text/css', 'smaxage' => $wgSquidMaxage ) + $siteargs ); - # Site settings must override extension css! (bug 15025) - $sitecss .= '@import "' . self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI) . '";' . "\n"; - $sitecss .= '@import "' . self::makeNSUrl( ucfirst( $this->skinname ) . '.css', $query, NS_MEDIAWIKI ) . '";' . "\n"; + $this->addStyle( self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) ); + $this->addStyle( self::makeNSUrl( ucfirst( $this->skinname ) . '.css', $query, NS_MEDIAWIKI ), + 'screen' ); } // Per-user styles based on preferences $siteargs['gen'] = 'css'; - if( ( $us = $wgRequest->getVal( 'useskin', '' ) ) !== '' ) { + if( ( $us = $wgRequest->getVal( 'useskin', '' ) ) !== '' ) $siteargs['useskin'] = $us; - } - $prefcss = '@import "' . self::makeUrl( '-', wfArrayToCGI( $siteargs ) ) . '";' . "\n"; + $this->addStyle( self::makeUrl( '-', wfArrayToCGI( $siteargs ) ), 'screen' ); // Per-user custom style pages - if( $wgAllowUserCss && $this->loggedin ) { + if ( $wgAllowUserCss && $this->loggedin ) { $action = $wgRequest->getVal('action'); - # If we're previewing the CSS page, use it + + # if we're previewing the CSS page, use it if( $this->mTitle->isCssSubpage() && $this->userCanPreview( $action ) ) { $previewCss = $wgRequest->getText('wpTextbox1'); - // @FIXME: properly escape the cdata! - $this->usercss = "/**/"; + + /// @fixme properly escape the cdata! + $this->usercss = "/**/"; } else { - $usercss .= '@import "' . self::makeUrl($this->userpage .'/'.$this->skinname .'.css', - 'action=raw&ctype=text/css') . '";' . "\n"; - $this->usercss = "/**/'; + $this->addStyle( self::makeUrl($this->userpage . '/'.$this->skinname.'.css', + 'action=raw&ctype=text/css'), 'screen' ); } - } else { - $this->usercss = "/**/'; } wfProfileOut( __METHOD__ );