jenkins-bot has submitted this change and it was merged.

Change subject: UserCSSPrefsModule: Remove redundant inline 
text-decoration:none css rules
......................................................................


UserCSSPrefsModule: Remove redundant inline text-decoration:none css rules

By default user option 'underline' is '2' which means no skin override.

Once a upon a time, none of the popular MediaWiki skins specified whether links 
should have
underlines, and most browsers default to having an underline on links (when not 
hovering).

As such, there was an exception added for languages where underlines cause text 
to be unreadable.

Nowadays however all modern skins explicitly specify the intended design for 
links.
Neither the default skin (Vector) nor other popular skins I checked have 
underlines by default.
As such, this rule is redundant.

If a skin comes along that does specify underlines by default, then these rules 
should be placed
in that skins' stylesheet. Not in the HTML of all pages.

Incidentally, this was the last code branch in ResourceLoaderUserCSSPrefsModule 
that is true by
default. Which means from now on this <style> tag is automatically omitted from 
the HTML for
logged-out users and users that haven't changed the 'underline' or 'editfont' 
preference.

Implement the missing isKnownEmpty() method so that OutputPage does the 
automatic omission.

To test the new text-decoration rule in mediawiki.skinning:
* Change user preference language to "ar" and observe anchor links in the 
interface
  not having underlines on-hover.
* Change $wgLanguageCode to "ar" and observe anchor links in the content not 
having
  underlines on-hover.

History:
* 2011 (043f98a3; r101445) Move overrides from shared.css to 
ResourceLoaderUserOptionsModule
                           Also remove "!important" from underline css
* 2011 (33293c9b; r96261) Apply "!important" to underline user option css
* 2011 (81446abc; r91432; T31712) Move overrides from MessageXX.php to 
skins/common/shared.css
* 2006 (43b2fb56; r15823) Move overrides from LanguageXX.php to MessageX.php
* 2004 (f9f3e915) Add override to LanguageAr.php

Bug: T105313
Change-Id: I94dda30fb80b30e9c12a74a8b09065da55681929
---
M includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php
M resources/src/mediawiki.skinning/elements.css
2 files changed, 18 insertions(+), 5 deletions(-)

Approvals:
  Nikerabbit: Checked; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php 
b/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php
index 6705336..04b0434 100644
--- a/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php
+++ b/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php
@@ -50,14 +50,10 @@
                // Build CSS rules
                $rules = array();
 
-               // Underline: 2 = browser default, 1 = always, 0 = never
+               // Underline: 2 = skin default, 1 = always, 0 = never
                if ( $options['underline'] < 2 ) {
                        $rules[] = "a { text-decoration: " .
                                ( $options['underline'] ? 'underline' : 'none' 
) . "; }";
-               } else {
-                       # The scripts of these languages are very hard to read 
with underlines
-                       $rules[] = 'a:lang(ar), a:lang(kk-arab), a:lang(mzn), ' 
.
-                       'a:lang(ps), a:lang(ur) { text-decoration: none; }';
                }
                if ( $options['editfont'] !== 'default' ) {
                        // Double-check that $options['editfont'] consists of 
safe characters only
@@ -73,6 +69,15 @@
        }
 
        /**
+        * @param ResourceLoaderContext $context
+        * @return bool
+        */
+       public function isKnownEmpty( ResourceLoaderContext $context ) {
+               $styles = $this->getStyles( $context );
+               return isset( $styles['all'] ) && $styles['all'] === '';
+       }
+
+       /**
         * @return string
         */
        public function getGroup() {
diff --git a/resources/src/mediawiki.skinning/elements.css 
b/resources/src/mediawiki.skinning/elements.css
index d706d26..7872085 100644
--- a/resources/src/mediawiki.skinning/elements.css
+++ b/resources/src/mediawiki.skinning/elements.css
@@ -25,6 +25,14 @@
        text-decoration: underline;
 }
 
+a:lang(ar),
+a:lang(kk-arab),
+a:lang(mzn),
+a:lang(ps),
+a:lang(ur) {
+       text-decoration: none;
+}
+
 a.stub {
        color: #772233;
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/223596
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I94dda30fb80b30e9c12a74a8b09065da55681929
Gerrit-PatchSet: 10
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Bartosz DziewoƄski <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to