Index: trunk/phase3/includes/ResourceLoader.php |
— | — | @@ -307,8 +307,17 @@ |
308 | 308 | |
309 | 309 | // Output |
310 | 310 | if ( $context->getOnly() === 'styles' ) { |
311 | | - foreach ( $styles as $media => $style ) { |
312 | | - echo "@media $media {\n$style\n}\n"; |
| 311 | + if ( $context->getDebug() ) { |
| 312 | + echo "/* $name */\n"; |
| 313 | + foreach ( $styles as $media => $style ) { |
| 314 | + echo "@media $media {\n" . str_replace( "\n", "\n\t", "\t" . $style ) . "\n}\n"; |
| 315 | + } |
| 316 | + } else { |
| 317 | + foreach ( $styles as $media => $style ) { |
| 318 | + if ( strlen( $style ) ) { |
| 319 | + echo "@media $media{" . $style . "}"; |
| 320 | + } |
| 321 | + } |
313 | 322 | } |
314 | 323 | } else if ( $context->getOnly() === 'scripts' ) { |
315 | 324 | echo $scripts; |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -646,17 +646,7 @@ |
647 | 647 | // If we use the site's dynamic CSS, throw that in, too |
648 | 648 | // Per-site custom styles |
649 | 649 | if ( $wgUseSiteCss ) { |
650 | | - global $wgHandheldStyle; |
651 | | - |
652 | | - $query = wfArrayToCGI( self::getDynamicStylesheetQuery() ); |
653 | | - # Site settings must override extension css! (bug 15025) |
654 | | - $out->addStyle( self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) ); |
655 | | - $out->addStyle( self::makeNSUrl( 'Print.css', $query, NS_MEDIAWIKI ), 'print' ); |
656 | | - |
657 | | - if ( $wgHandheldStyle ) { |
658 | | - $out->addStyle( self::makeNSUrl( 'Handheld.css', $query, NS_MEDIAWIKI ), 'handheld' ); |
659 | | - } |
660 | | - $out->addStyle( self::makeNSUrl( $this->getSkinName() . '.css', $query, NS_MEDIAWIKI ) ); |
| 650 | + $out->addModuleStyles( 'site' ); |
661 | 651 | } |
662 | 652 | |
663 | 653 | global $wgAllowUserCssPrefs; |
— | — | @@ -727,6 +717,7 @@ |
728 | 718 | $out->addModuleStyles( 'mediawiki.legacy.oldshared' ); |
729 | 719 | // TODO: Figure out how to best integrate this stuff into ResourceLoader |
730 | 720 | $out->addStyle( $this->getStylesheet() ); |
| 721 | + // TODO: When converting old skins to use ResourceLoader (or removing them) this needs to be reconsidered |
731 | 722 | $out->addStyle( 'common/common_rtl.css', '', '', 'rtl' ); |
732 | 723 | } |
733 | 724 | |
Index: trunk/phase3/includes/ResourceLoaderModule.php |
— | — | @@ -691,6 +691,8 @@ |
692 | 692 | } |
693 | 693 | |
694 | 694 | public function getModifiedTime( ResourceLoaderContext $context ) { |
| 695 | + global $wgHandheldStyle; |
| 696 | + |
695 | 697 | if ( isset( $this->modifiedTime[$context->getHash()] ) ) { |
696 | 698 | return $this->modifiedTime[$context->getHash()]; |
697 | 699 | } |
— | — | @@ -698,20 +700,28 @@ |
699 | 701 | // HACK: We duplicate the message names from generateUserJs() |
700 | 702 | // here and weird things (i.e. mtime moving backwards) can happen |
701 | 703 | // when a MediaWiki:Something.js page is deleted |
702 | | - $jsPages = array( Title::makeTitle( NS_MEDIAWIKI, 'Common.js' ), |
703 | | - Title::makeTitle( NS_MEDIAWIKI, ucfirst( $context->getSkin() ) . '.js' ) |
| 704 | + $pages = array( |
| 705 | + Title::makeTitle( NS_MEDIAWIKI, 'Common.js' ), |
| 706 | + Title::makeTitle( NS_MEDIAWIKI, 'Common.css' ), |
| 707 | + Title::makeTitle( NS_MEDIAWIKI, ucfirst( $context->getSkin() ) . '.js' ), |
| 708 | + Title::makeTitle( NS_MEDIAWIKI, ucfirst( $context->getSkin() ) . '.css' ), |
| 709 | + Title::makeTitle( NS_MEDIAWIKI, 'Print.css' ), |
| 710 | + |
704 | 711 | ); |
| 712 | + if ( $wgHandheldStyle ) { |
| 713 | + $pages[] = Title::makeTitle( NS_MEDIAWIKI, 'Handheld.css' ); |
| 714 | + } |
705 | 715 | |
706 | 716 | // Do batch existence check |
707 | 717 | // TODO: This would work better if page_touched were loaded by this as well |
708 | | - $lb = new LinkBatch( $jsPages ); |
| 718 | + $lb = new LinkBatch( $pages ); |
709 | 719 | $lb->execute(); |
710 | 720 | |
711 | 721 | $this->modifiedTime = 1; // wfTimestamp() interprets 0 as "now" |
712 | 722 | |
713 | | - foreach ( $jsPages as $jsPage ) { |
714 | | - if ( $jsPage->exists() ) { |
715 | | - $this->modifiedTime = max( $this->modifiedTime, wfTimestamp( TS_UNIX, $jsPage->getTouched() ) ); |
| 723 | + foreach ( $pages as $page ) { |
| 724 | + if ( $page->exists() ) { |
| 725 | + $this->modifiedTime = max( $this->modifiedTime, wfTimestamp( TS_UNIX, $page->getTouched() ) ); |
716 | 726 | } |
717 | 727 | } |
718 | 728 | |
— | — | @@ -719,7 +729,26 @@ |
720 | 730 | } |
721 | 731 | |
722 | 732 | public function getStyles( ResourceLoaderContext $context ) { |
723 | | - return array(); |
| 733 | + global $wgHandheldStyle; |
| 734 | + $styles = array( |
| 735 | + 'all' => array( 'Common.css', $context->getSkin() . '.css' ), |
| 736 | + 'print' => array( 'Print.css' ), |
| 737 | + ); |
| 738 | + if ( $wgHandheldStyle ) { |
| 739 | + $sources['handheld'] = array( 'Handheld.css' ); |
| 740 | + } |
| 741 | + foreach ( $styles as $media => $messages ) { |
| 742 | + foreach ( $messages as $i => $message ) { |
| 743 | + $style = wfMsgExt( $message, 'content' ); |
| 744 | + if ( !wfEmptyMsg( $message, $style ) ) { |
| 745 | + $styles[$media][$i] = $style; |
| 746 | + } |
| 747 | + } |
| 748 | + } |
| 749 | + foreach ( $styles as $media => $messages ) { |
| 750 | + $styles[$media] = implode( "\n", $messages ); |
| 751 | + } |
| 752 | + return $styles; |
724 | 753 | } |
725 | 754 | public function getMessages() { return array(); } |
726 | 755 | public function getLoaderScript() { return ''; } |