Merge "Add 'noflip' option on RL modules to disable CSSJanus"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 19 Oct 2016 06:52:02 +0000 (06:52 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 19 Oct 2016 06:52:02 +0000 (06:52 +0000)
docs/extension.schema.json
docs/extension.schema.v1.json
includes/resourceloader/ResourceLoaderFileModule.php

index 84a404a..e408d03 100644 (file)
                                                                        "items": {
                                                                                "type": "string"
                                                                        }
+                                                               },
+                                                               "noflip": {
+                                                                       "type": "boolean",
+                                                                       "description": "Whether to skip CSSJanus LTR-to-RTL flipping for this module. Recommended for styles imported from libraries that already properly handle their RTL styles. Default is false, meaning CSSJanus will be applied on RTL-mode output."
                                                                }
                                                        }
                                                },
index 9499927..6d48a06 100644 (file)
                                                                        "items": {
                                                                                "type": "string"
                                                                        }
+                                                               },
+                                                               "noflip": {
+                                                                       "type": "boolean",
+                                                                       "description": "Whether to skip CSSJanus LTR-to-RTL flipping for this module. Recommended for styles imported from libraries that already properly handle their RTL styles. Default is false, meaning CSSJanus will be applied on RTL-mode output."
                                                                }
                                                        }
                                                },
index 2dcc841..07649e3 100644 (file)
@@ -128,6 +128,9 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
 
        protected $targets = [ 'desktop' ];
 
+       /** @var bool Whether CSSJanus flipping should be skipped for this module */
+       protected $noflip = false;
+
        /**
         * @var bool Whether getStyleURLsForDebug should return raw file paths,
         * or return load.php urls
@@ -277,6 +280,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                                // Single booleans
                                case 'debugRaw':
                                case 'raw':
+                               case 'noflip':
                                        $this->{$member} = (bool)$option;
                                        break;
                        }
@@ -913,7 +917,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @return bool
         */
        public function getFlip( $context ) {
-               return $context->getDirection() === 'rtl';
+               return $context->getDirection() === 'rtl' && !$this->noflip;
        }
 
        /**