Last modified: 2011-02-08 21:56:10 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T28555, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 26555 - Styles for a skin added with $out->addStyle() are loaded after instead of before user custom styles.
Styles for a skin added with $out->addStyle() are loaded after instead of bef...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.17.x
All All
: Normal major (vote)
: ---
Assigned To: Trevor Parscal
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-03 21:15 UTC by Krinkle
Modified: 2011-02-08 21:56 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Krinkle 2011-01-03 21:15:02 UTC
The following in a custom skin worked in older versions of MediaWiki, but 
in the current trunk it's loaded after the user css

function setupSkinUserCss( OutputPage $out ) {
           parent::setupSkinUserCss( $out );
          $out->addStyle( 'luontoliitto/main.css', 'screen' );
 }

<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" href="/w/load.php?debug=true&amp;lang=fi&amp;modules=site&amp;only=styles&amp;skin=luontoliitto&amp;version=20110103T210326Z">
<link rel="stylesheet" href="/w/load.php?debug=true&amp;lang=fi&amp;modules=user&amp;only=styles&amp;skin=luontoliitto&amp;user=Krinkle&amp;version=20110103T210140Z">
<link rel="stylesheet" href="/w/skins/luontoliitto/main.css?301" media="screen">
Comment 1 Ilmari Karonen 2011-01-03 21:24:29 UTC
I _think_ the problem is caused by OutputPage::headElement() doing

	$ret .= implode( "\n", array(
		$this->getHeadLinks( $sk ),
		$this->buildCssLinks(),
		$this->getHeadItems(),
	) );

Here, ResourceLoader is adding its style links in getHeadLinks(), while style links added via addStyle() are output in buildCssLinks().  To fix this issue, either a) the ResourceLoader code could be pulled out of getHeadLinks() into a separate method, b) the call to buildCssLinks() could be moved before getHeadLinks(), or c) the call to buildCssLinks() could be moved _inside_ getHeadLinks().  Not being very familiar with ResourceLoader, I have no idea which of these would be the cleanest solution, or the least likely to cause unexpected side effects.
Comment 2 Roan Kattouw 2011-01-04 16:58:05 UTC
(In reply to comment #1)
> Here, ResourceLoader is adding its style links in getHeadLinks(), while style
> links added via addStyle() are output in buildCssLinks().  To fix this issue,
> either a) the ResourceLoader code could be pulled out of getHeadLinks() into a
> separate method, b) the call to buildCssLinks() could be moved before
> getHeadLinks(), or c) the call to buildCssLinks() could be moved _inside_
> getHeadLinks().  Not being very familiar with ResourceLoader, I have no idea
> which of these would be the cleanest solution, or the least likely to cause
> unexpected side effects.
Trevor tried to move the RL stuff into buildCssLinks() but that didn't work too well. I'll poke at this later.
Comment 3 Roan Kattouw 2011-01-06 16:35:09 UTC
*** Bug 26570 has been marked as a duplicate of this bug. ***
Comment 4 Roan Kattouw 2011-01-06 17:05:01 UTC
Fixed in r79732.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links