Catrope has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/72683


Change subject: Transplant CSS from the main document to each iframe
......................................................................

Transplant CSS from the main document to each iframe

We previously manually loaded CSS into these frames, which is flawed
because it completely bypasses ResourceLoader (so CSSJanus didn't flip
them, necessitating a bunch of hacks for RTL), and doesn't pull in
MediaWiki styles (so templates inside references don't render correctly).
Instead, this commit copies all styles from the main document into each
frame's document, inlining what it can.

Loading all styles in dialogs and inspectors caused some problems,
initially. We didn't namespace our styles for dialogs vs. inspectors
at all; the only reason inspector styles weren't being applied to dialogs
and vice versa was because we controlled which files were being loaded
in which context. This commit namespaces the inspector and dialog styles
where needed so they don't conflict and try to override each other.

Tested in Vector and Monobook, but not in Apex and not in RTL.

ve.init.mw.ViewPageTarget*.css:
* Namespace styles that are only intended for the main document
* Undo Monobook's font-size: x-small; in frames

*Dialog.js:
* Remove addLocalStylesheet() calls, we don't need those any more
** ve.ui.MWDialog seems to be unneeded now, we may want to remove it

*.css:
* Remove @noflip-ped RTL rules where they were just flipped versions of
  their LTR counterparts

ve.ui.Dialog.css, ve.ui.Inspector.css:
* Namespace styles with .ve-ui-dialog-content / .ve-ui-inspector-content

ve.ui.Frame.css:
* Move the margin:0 and padding:0 here (were in the frame <body>'s style
  attribute) and add background:none to prevent frames from getting
  the skin's background (grey in Vector, a book in Monobook)

ve.ui.Dialog.js, ve.ui.Inspector.js:
* Add ve-ui-dialog-content / ve-ui-inspector-content class to the
  frame's content <div> so we can restrict styles to only apply in
  dialogs / inspectors

ve.ui.Frame.js:
* Replace infrastructure for @import-ing stylesheets with transplantation
* Remove code polling to see when the stylesheets were loaded
** We can't do this in the new approach AFAIK, since all styles in the
   frame are either inlined or inaccessible due to the same-origin policy
** We also shouldn't need it because the browser should have cached the
   styles when it loaded the main document
* Apply ve-ui-frame-body class to the frame's <body> so we can style it
** Move inline padding:0;margin:0; into ve.ui.Frame.css
** Move the ve-ltr/ve-rtl class up to the <body>

ve.ui.Window.js:
* Remove infrastructure registering stylesheet URLs to load

Change-Id: I4a37115301811ad860f4578344a04873ea8c2b69
---
M modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-apex.css
M modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css
M modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css
M modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
M modules/ve-mw/ui/dialogs/ve.ui.MWReferenceEditDialog.js
M modules/ve-mw/ui/styles/ve.ui.MWDialog.css
M modules/ve-mw/ui/ve.ui.MWDialog.js
M modules/ve/ui/styles/ve.ui.Dialog.css
M modules/ve/ui/styles/ve.ui.Frame.css
M modules/ve/ui/styles/ve.ui.Inspector.css
M modules/ve/ui/styles/ve.ui.Layout.css
M modules/ve/ui/styles/ve.ui.Widget.css
M modules/ve/ui/styles/ve.ui.Window.css
M modules/ve/ui/ve.ui.Dialog.js
M modules/ve/ui/ve.ui.Frame.js
M modules/ve/ui/ve.ui.Inspector.js
M modules/ve/ui/ve.ui.Window.js
18 files changed, 82 insertions(+), 203 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/83/72683/1

diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-apex.css 
b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-apex.css
index de6e8d6..d567953 100644
--- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-apex.css
+++ b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-apex.css
@@ -5,7 +5,7 @@
  * @license The MIT License (MIT); see LICENSE.txt
  */
 
-.ve-ui-surface {
+.skin-apex .ve-ui-surface {
        margin-top: 0.8em;
 }
 
diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css 
b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css
index 9800915..becd8bf 100644
--- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css
+++ b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css
@@ -5,7 +5,7 @@
  * @license The MIT License (MIT); see LICENSE.txt
  */
 
-.ve-ui-toolbar {
+.skin-monobook .ve-ui-toolbar {
        margin: 0 -0.8em;
 }
 
@@ -20,6 +20,11 @@
        line-height: 1.5em;
 }
 
+/* Monobook sets font-size: x-small; on the body. Undo this in frames */
+.ve-ui-frame-body {
+       font-size: medium;
+}
+
 .ve-ui-surface-overlay-global {
        z-index: 4;
 }
diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css 
b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css
index ba5dc0c..4371d98 100644
--- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css
+++ b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css
@@ -5,11 +5,11 @@
  * @license The MIT License (MIT); see LICENSE.txt
  */
 
-.ve-ui-surface {
+.skin-vector .ve-ui-surface {
        margin: 0.8em -1.5em 0 -1.5em;
 }
 
-.ve-ce-documentNode {
+.skin-vector .ve-ce-documentNode {
        font-size: 0.8em;
        padding: 0 1.875em; /* 1.5/0.8 */
 }
diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css 
b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css
index 4b67376..d4cb427 100644
--- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css
+++ b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css
@@ -7,7 +7,7 @@
 
 /* VisualEditor */
 
-.ve-ui-menuWidget {
+.mediawiki .ve-ui-menuWidget {
        font-size: 0.8em;
 }
 
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index a57e4e0..3cb3d63 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -42,19 +42,6 @@
        'bold', 'italic', 'mwLink', 'undo', 'redo'
 ];
 
-/* Static Initialization */
-
-ve.ui.MWMediaEditDialog.static.addLocalStylesheets( [
-       've/ce/styles/ve.ce.Node.css',
-       've-mw/ce/styles/ve.ce.Node.css',
-       've/ce/styles/ve.ce.Surface.css',
-       've/ui/styles/ve.ui.Surface.css',
-       've/ui/styles/ve.ui.Context.css',
-       've/ui/styles/ve.ui.Tool.css',
-       've-mw/ui/styles/ve.ui.Tool.css',
-       've/ui/styles/ve.ui.Toolbar.css'
-] );
-
 /* Methods */
 
 ve.ui.MWMediaEditDialog.prototype.initialize = function () {
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceEditDialog.js
index c7ca3e1..8dc20f3 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceEditDialog.js
@@ -42,19 +42,6 @@
        'bold', 'italic', 'mwLink', 'undo', 'redo'
 ];
 
-/* Static Initialization */
-
-ve.ui.MWReferenceEditDialog.static.addLocalStylesheets( [
-       've/ce/styles/ve.ce.Node.css',
-       've-mw/ce/styles/ve.ce.Node.css',
-       've/ce/styles/ve.ce.Surface.css',
-       've/ui/styles/ve.ui.Surface.css',
-       've/ui/styles/ve.ui.Context.css',
-       've/ui/styles/ve.ui.Tool.css',
-       've-mw/ui/styles/ve.ui.Tool.css',
-       've/ui/styles/ve.ui.Toolbar.css'
-] );
-
 /* Methods */
 
 ve.ui.MWReferenceEditDialog.prototype.initialize = function () {
diff --git a/modules/ve-mw/ui/styles/ve.ui.MWDialog.css 
b/modules/ve-mw/ui/styles/ve.ui.MWDialog.css
index 7493160..9190ca9 100644
--- a/modules/ve-mw/ui/styles/ve.ui.MWDialog.css
+++ b/modules/ve-mw/ui/styles/ve.ui.MWDialog.css
@@ -75,11 +75,6 @@
        text-align: left;
 }
 
-/*@noflip*/
-.ve-rtl fieldset .ve-ui-mwMetaDialog-languages-table th {
-       text-align: right;
-}
-
 .ve-ui-mwMetaDialog-languages-table th,
 .ve-ui-mwMetaDialog-languages-table td {
        padding: 0.75em 1em;
diff --git a/modules/ve-mw/ui/ve.ui.MWDialog.js 
b/modules/ve-mw/ui/ve.ui.MWDialog.js
index 31269dd..b263132 100644
--- a/modules/ve-mw/ui/ve.ui.MWDialog.js
+++ b/modules/ve-mw/ui/ve.ui.MWDialog.js
@@ -24,14 +24,3 @@
 /* Inheritance */
 
 ve.inheritClass( ve.ui.MWDialog, ve.ui.Dialog );
-
-
-/* Initialization */
-
-ve.ui.MWDialog.static.addLocalStylesheets( [
-       've-mw/ui/styles/ve.ui.MWDialog.css',
-       've-mw/ui/styles/ve.ui.Widget.css',
-       ( document.createElementNS && document.createElementNS( 
'http://www.w3.org/2000/svg', 'svg' ).createSVGRect ?
-               've-mw/ui/styles/ve.ui.Icons-vector.css' :
-               've-mw/ui/styles/ve.ui.Icons-raster.css' )
-] );
diff --git a/modules/ve/ui/styles/ve.ui.Dialog.css 
b/modules/ve/ui/styles/ve.ui.Dialog.css
index 95f3f09..7f752cf 100644
--- a/modules/ve/ui/styles/ve.ui.Dialog.css
+++ b/modules/ve/ui/styles/ve.ui.Dialog.css
@@ -65,9 +65,9 @@
        height: 100%;
 }
 
-.ve-ui-window-head,
-.ve-ui-window-body,
-.ve-ui-window-foot {
+.ve-ui-dialog-content .ve-ui-window-head,
+.ve-ui-dialog-content .ve-ui-window-body,
+.ve-ui-dialog-content .ve-ui-window-foot {
        position: absolute;
        left: 0;
        right: 0;
@@ -77,69 +77,53 @@
        overflow: hidden;
 }
 
-.ve-ui-window-head {
+.ve-ui-dialog-content .ve-ui-window-head {
        top: 0;
        height: 3.8em;
        padding: 0.5em;
 }
 
-.ve-ui-window-foot {
+.ve-ui-dialog-content .ve-ui-window-foot {
        bottom: 0;
        height: 4.8em;
        padding: 1em;
 }
 
-.ve-ui-window-body {
+.ve-ui-dialog-content .ve-ui-window-body {
        box-shadow: 0 0 0.66em rgba(0,0,0,0.25);
        top: 3.8em;
        bottom: 4.8em;
 }
 
-.ve-ui-window-icon {
+.ve-ui-dialog-content .ve-ui-window-icon {
        width: 2.4em;
        height: 2.8em;
        line-height: 2.8em;
 }
 
-.ve-ui-window-title {
+.ve-ui-dialog-content .ve-ui-window-title {
        line-height: 2.8em;
 }
 
-.ve-ui-window-foot .ve-ui-buttonWidget {
+.ve-ui-dialog-content .ve-ui-window-foot .ve-ui-buttonWidget {
        float: right;
        margin: 0.125em 0.25em;
 }
 
-/* @noflip */
-.ve-rtl .ve-ui-window-foot .ve-ui-buttonWidget {
-       float: left;
-}
-
-.ve-ui-window-closeButton {
+.ve-ui-dialog-content .ve-ui-window-closeButton {
        float: right;
        margin: 0.25em 0.25em;
 }
 
-.ve-ui-window-body .ve-ui-surface {
+.ve-ui-dialog-content .ve-ui-window-body .ve-ui-surface {
        border: solid 1px #ddd;
        border-radius: 0.25em;
        border-top-right-radius: 0;
        border-top-left-radius: 0;
 }
 
-/* @noflip */
-.ve-rtl .ve-ui-window-closeButton {
-       float: left;
-}
-
 .ve-ui-pagedDialog-outlinePanel {
        border-right: solid 1px #ddd;
-}
-
-/* @noflip */
-.ve-ui-pagedDialog-outlinePanel.ve-rtl {
-       border-right: 0;
-       border-left: solid 1px #ddd;
 }
 
 .ve-ui-pagedDialog-outlinePanel-editable .ve-ui-outlineWidget {
diff --git a/modules/ve/ui/styles/ve.ui.Frame.css 
b/modules/ve/ui/styles/ve.ui.Frame.css
index 990af6c..43bfae7 100644
--- a/modules/ve/ui/styles/ve.ui.Frame.css
+++ b/modules/ve/ui/styles/ve.ui.Frame.css
@@ -10,6 +10,12 @@
        padding: 0;
 }
 
+.ve-ui-frame-body {
+       margin: 0;
+       padding: 0;
+       background: none;
+}
+
 .ve-ui-frame-content {
        font-family: sans-serif;
        font-size: 0.8em;
diff --git a/modules/ve/ui/styles/ve.ui.Inspector.css 
b/modules/ve/ui/styles/ve.ui.Inspector.css
index 514f869..9bbd6cc 100644
--- a/modules/ve/ui/styles/ve.ui.Inspector.css
+++ b/modules/ve/ui/styles/ve.ui.Inspector.css
@@ -18,36 +18,36 @@
        height: 3em;
 }
 
-.ve-ui-window-head {
+.ve-ui-inspector-content .ve-ui-window-head {
        height: 2em;
        padding: 0.5em;
 }
 
-.ve-ui-window-icon {
+.ve-ui-inspector-content .ve-ui-window-icon {
        padding-left: 0.5em;
        margin-left: 0.25em;
        border-left: solid 1px #eee;
 }
 
-.ve-ui-inspector-closeButton {
+.ve-ui-inspector-content .ve-ui-inspector-closeButton {
        float: left;
 }
 
-.ve-ui-inspector-removeButton {
+.ve-ui-inspector-content .ve-ui-inspector-removeButton {
        float: right;
 }
 
-.ve-ui-window-body form {
+.ve-ui-inspector-content .ve-ui-window-body form {
        margin: 0.25em 0 0 0;
        padding: 0;
        white-space: nowrap;
 }
 
-.ve-ui-window-body .ve-ui-textInputWidget {
+.ve-ui-inspector-content .ve-ui-window-body .ve-ui-textInputWidget {
        width: 100%;
 }
 
-.ve-ui-window-body form input.ve-ui-linkInspector-location {
+.ve-ui-inspector-content .ve-ui-window-body form 
input.ve-ui-linkInspector-location {
        /* @see ve.ui.Icons */
        background-position: 18.75em center;
        background-repeat: no-repeat;
diff --git a/modules/ve/ui/styles/ve.ui.Layout.css 
b/modules/ve/ui/styles/ve.ui.Layout.css
index 51fc245..029eab4 100644
--- a/modules/ve/ui/styles/ve.ui.Layout.css
+++ b/modules/ve/ui/styles/ve.ui.Layout.css
@@ -35,9 +35,3 @@
        background-position: left center;
        background-repeat: no-repeat;
 }
-
-/* @noflip */
-.ve-rtl .ve-ui-fieldsetLayout-decorated > legend.ve-ui-labeledElement-label {
-       padding-right: 1.75em;
-       background-position: right center;
-}
diff --git a/modules/ve/ui/styles/ve.ui.Widget.css 
b/modules/ve/ui/styles/ve.ui.Widget.css
index 96a9849..587839b 100644
--- a/modules/ve/ui/styles/ve.ui.Widget.css
+++ b/modules/ve/ui/styles/ve.ui.Widget.css
@@ -196,12 +196,6 @@
        font-size: 1.1em;
 }
 
-/* @noflip */
-.ve-rtl ul li.ve-ui-outlineItemWidget {
-       padding: 1.25em 3.5em 1.25em 3.5em;
-       background-position: right 1em center;
-}
-
 .ve-ui-outlineItemWidget-level-1 {
        padding-left: 5.5em;
        background-position: 3em center;
diff --git a/modules/ve/ui/styles/ve.ui.Window.css 
b/modules/ve/ui/styles/ve.ui.Window.css
index 4d56b35..3e664cf 100644
--- a/modules/ve/ui/styles/ve.ui.Window.css
+++ b/modules/ve/ui/styles/ve.ui.Window.css
@@ -31,22 +31,12 @@
        background-repeat: no-repeat;
 }
 
-/* @noflip */
-.ve-rtl .ve-ui-window-icon {
-       float: right;
-}
-
 .ve-ui-window-title {
        float: left;
        line-height: 2em;
        color: #333;
        white-space: nowrap;
        cursor: default;
-}
-
-/* @noflip */
-.ve-rtl .ve-ui-window-title {
-       float: right;
 }
 
 .ve-ui-window-overlay {
diff --git a/modules/ve/ui/ve.ui.Dialog.js b/modules/ve/ui/ve.ui.Dialog.js
index 721e947..f711925 100644
--- a/modules/ve/ui/ve.ui.Dialog.js
+++ b/modules/ve/ui/ve.ui.Dialog.js
@@ -155,12 +155,9 @@
        this.frame.$document.on( 'keydown', ve.bind( 
this.onFrameDocumentKeyDown, this ) );
 
        // Initialization
+       this.frame.$content.addClass( 've-ui-dialog-content' );
        this.closeButton.$.addClass( 've-ui-window-closeButton' );
        this.applyButton.$.addClass( 've-ui-window-applyButton' );
        this.$head.append( this.closeButton.$ );
        this.$foot.append( this.applyButton.$ );
 };
-
-/* Initialization */
-
-ve.ui.Dialog.static.addLocalStylesheets( [ 've/ui/styles/ve.ui.Dialog.css' ] );
diff --git a/modules/ve/ui/ve.ui.Frame.js b/modules/ve/ui/ve.ui.Frame.js
index b29397b..6ccffec 100644
--- a/modules/ve/ui/ve.ui.Frame.js
+++ b/modules/ve/ui/ve.ui.Frame.js
@@ -14,7 +14,6 @@
  *
  * @constructor
  * @param {Object} [config] Config options
- * @cfg {string[]} [stylesheets] List of stylesheet file names, each relative 
to ve/ui/styles
  */
 ve.ui.Frame = function VeUiFrame( config ) {
        // Parent constructor
@@ -75,14 +74,8 @@
  * @emits initialize
  */
 ve.ui.Frame.prototype.load = function () {
-       var interval, rules,
-               win = this.$.prop( 'contentWindow' ),
-               doc = win.document,
-               style = doc.createElement( 'style' ),
-               initialize = ve.bind( function () {
-                       this.initialized = true;
-                       this.emit( 'initialize' );
-               }, this );
+       var win = this.$.prop( 'contentWindow' ),
+               doc = win.document;
 
        // Figure out directionality:
        this.dir = this.$.closest( '[dir]' ).prop( 'dir' ) || 'ltr';
@@ -92,42 +85,61 @@
        doc.write(
                '<!doctype html>' +
                '<html>' +
-                       '<body style="padding:0;margin:0;direction:' + this.dir 
+ ';" dir="' + this.dir + '">' +
-                               '<div class="ve-ui-frame-content ve-' + 
this.dir + '"></div>' +
+                       '<body class="ve-ui-frame-body ve-' + this.dir + '" 
style="direction:' + this.dir + ';" dir="' + this.dir + '">' +
+                               '<div class="ve-ui-frame-content"></div>' +
                        '</body>' +
                '</html>'
        );
        doc.close();
 
-       // Import all stylesheets
-       style.textContent = '@import "' + this.config.stylesheets.join( 
'";\n@import "' ) + '";';
-
-       doc.body.appendChild( style );
-
-       // Poll for access to stylesheet content
-       interval = setInterval( ve.bind( function () {
-               try {
-                       // MAGIC: only accessible when the stylesheet is loaded
-                       rules = style.sheet.cssRules;
-               } catch ( e ) {
-                       // Try again in 10ms
-                       return;
-               }
-               // If that didn't throw an exception, we're done loading
-               clearInterval( interval );
-               // Protect against IE running interval one extra time after 
clearing
-               if ( !this.initialized ) {
-                       initialize();
-               }
-       }, this ), 10 );
-
        // Properties
        this.$$ = ve.Element.get$$( doc, this );
        this.$content = this.$$( '.ve-ui-frame-content' );
        this.$document = this.$$( doc );
+
+       this.transplantStyles();
+       this.initialized = true;
+       this.emit( 'initialize' );
 };
 
 /**
+ * Transplant the CSS styles from the frame's parent document to the frame's 
document.
+ *
+ * This loops over the style sheets in the parent document, and copies their 
tags to the
+ * frame's document. <link> tags pointing to same-origin style sheets are 
inlined as <style> tags;
+ * <link> tags pointing to foreign URLs and <style> tags are copied verbatim.
+ */
+ve.ui.Frame.prototype.transplantStyles = function () {
+       var i, ilen, j, jlen, sheet, rules, cssText, styleNode,
+               newDoc = this.$document[0],
+               parentDoc = this.getElementDocument();
+       for ( i = 0, ilen = parentDoc.styleSheets.length; i < ilen; i++ ) {
+               sheet = parentDoc.styleSheets[i];
+               try {
+                       rules = sheet.cssRules;
+               } catch ( e ) { }
+               if ( sheet.ownerNode.nodeName.toLowerCase() === 'link' && rules 
) {
+                       // This is a <link> tag pointing to a same-origin style 
sheet. Rebuild it as a
+                       // <style> tag
+                       cssText = '';
+                       for ( j = 0, jlen = sheet.cssRules.length; j < jlen; 
j++ ) {
+                               cssText += sheet.cssRules[j].cssText + '\n';
+                       }
+                       cssText += '/* Transplanted styles from ' + sheet.href 
+ ' */\n';
+                       styleNode = newDoc.createElement( 'style' );
+                       styleNode.textContent = cssText;
+               } else {
+                       // It's either a <style> tag or a <link> tag pointing 
to a foreign URL; just copy
+                       // it to the new document
+                       styleNode = newDoc.importNode( sheet.ownerNode, true );
+               }
+               newDoc.body.appendChild( styleNode );
+       }
+};
+
+/**
+ * Run a callback as soon as the frame has been initialized.
+ *
  * @param {Function} callback
  */
 ve.ui.Frame.prototype.run = function ( callback ) {
diff --git a/modules/ve/ui/ve.ui.Inspector.js b/modules/ve/ui/ve.ui.Inspector.js
index 2d5c86a..e56dc06 100644
--- a/modules/ve/ui/ve.ui.Inspector.js
+++ b/modules/ve/ui/ve.ui.Inspector.js
@@ -47,6 +47,7 @@
        ve.ui.Window.prototype.initialize.call( this );
 
        // Initialization
+       this.frame.$content.addClass( 've-ui-inspector-content' );
        this.$form = this.$$( '<form>' );
        this.closeButton = new ve.ui.IconButtonWidget( {
                '$$': this.$$, 'icon': 'previous', 'title': ve.msg( 
'visualeditor-inspector-close-tooltip' )
@@ -130,7 +131,3 @@
 ve.ui.Inspector.prototype.onOpen = function () {
        this.initialSelection = this.surface.getModel().getSelection();
 };
-
-/* Initialization */
-
-ve.ui.Inspector.static.addLocalStylesheets( [ 
've/ui/styles/ve.ui.Inspector.css' ] );
diff --git a/modules/ve/ui/ve.ui.Window.js b/modules/ve/ui/ve.ui.Window.js
index 9fb542b..8f2f927 100644
--- a/modules/ve/ui/ve.ui.Window.js
+++ b/modules/ve/ui/ve.ui.Window.js
@@ -37,7 +37,7 @@
        this.$
                .addClass( 've-ui-window' )
                .append( this.$frame );
-       this.frame = new ve.ui.Frame( { 'stylesheets': 
this.constructor.static.stylesheets } );
+       this.frame = new ve.ui.Frame();
        this.$frame
                .addClass( 've-ui-window-frame' )
                .append( this.frame.$ );
@@ -77,15 +77,6 @@
 /* Static Properties */
 
 /**
- * List of stylesheet URLs to load.
- *
- * @static
- * @inheritable
- * @property {Array}
- */
-ve.ui.Window.static.stylesheets = [];
-
-/**
  * Symbolic name of icon.
  *
  * @static
@@ -102,41 +93,6 @@
  * @property {string}
  */
 ve.ui.Window.static.titleMessage = null;
-
-/* Static Methods */
-
-/**
- * Add a stylesheet to be loaded into the window's frame.
- *
- * @method
- * @param {string[]} paths List of absolute stylesheet paths
- */
-ve.ui.Window.static.addStylesheetFiles = function ( paths ) {
-       if ( !this.hasOwnProperty( 'stylesheets' ) ) {
-               this.stylesheets = this.stylesheets.slice( 0 );
-       }
-       this.stylesheets.push.apply( this.stylesheets, paths );
-};
-
-/**
- * Add a stylesheet from a local directory.
- *
- * @method
- * @param {string[]} files Names of stylesheet files
- */
-ve.ui.Window.static.addLocalStylesheets = function ( files ) {
-       var i, len,
-               base = ve.init.platform.getModulesUrl(),
-               paths = [];
-
-       // Prepend base path to each file name
-       for ( i = 0, len = files.length; i < len; i++ ) {
-               // Extract the module name and convert it to a path
-               paths[i] = base + '/' + files[i];
-       }
-
-       this.addStylesheetFiles( paths );
-};
 
 /* Methods */
 
@@ -331,17 +287,3 @@
                this.closing = false;
        }
 };
-
-/* Initialization */
-
-ve.ui.Window.static.addLocalStylesheets( [
-       've/ui/styles/ve.ui.css',
-       've/ui/styles/ve.ui.Frame.css',
-       've/ui/styles/ve.ui.Window.css',
-       've/ui/styles/ve.ui.Element.css',
-       've/ui/styles/ve.ui.Layout.css',
-       've/ui/styles/ve.ui.Widget.css',
-       ( document.createElementNS && document.createElementNS( 
'http://www.w3.org/2000/svg', 'svg' ).createSVGRect ?
-               've/ui/styles/ve.ui.Icons-vector.css' :
-               've/ui/styles/ve.ui.Icons-raster.css' )
-] );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a37115301811ad860f4578344a04873ea8c2b69
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

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

Reply via email to