Redo r107066 properly: apply CSSJanus to user CSS previews when needed. Ping r94421

This commit is contained in:
Roan Kattouw 2012-01-04 20:01:29 +00:00
parent 74b4b2716b
commit 6de6b5f6bf

View file

@ -3166,7 +3166,8 @@ $templates
* @return string
*/
public function buildCssLinks() {
global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs;
global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs,
$wgLang, $wgContLang;
$this->getSkin()->setupSkinUserCss( $this );
@ -3195,8 +3196,15 @@ $templates
$otherTags .= $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_STYLES, false,
array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
);
// Load the previewed CSS
$otherTags .= Html::inlineStyle( $this->getRequest()->getText( 'wpTextbox1' ) );
// If needed, Janus it first. This is user-supplied CSS, so it's
// assumed to be right for the content language directionality.
$previewedCSS = $this->getRequest()->getText( 'wpTextbox1' );
if ( $wgLang->getDir() !== $wgContLang->getDir() ) {
$previewedCSS = CSSJanus::transform( $previewedCSS, true, false );
}
$otherTags .= Html::inlineStyle( $previewedCSS );
} else {
// Load the user styles normally
$moduleStyles[] = 'user';