Bug 1305007 - RTL: set dir attr. when loading devtools HTML document;r=bgrins

Toolbox sets the dir attribute on a panel document element when loading a panel,
if the panel is using a HTML document.

Using the ForceRTL addon, the dir attribute should be automatically updated whenever
the direction is changed by the addon.

MozReview-Commit-ID: 2r18APw7IBs
This commit is contained in:
Julian Descottes
2016-09-23 19:50:41 +02:00
parent d794ae4eee
commit 2e468e5eab
2 changed files with 12 additions and 4 deletions

View File

@@ -335,6 +335,7 @@ Toolbox.prototype = {
get splitConsole() {
return this._splitConsole;
},
/**
* Get the focused state of the split console
*/
@@ -1267,6 +1268,16 @@ Toolbox.prototype = {
// backward compatibility with existing extensions do a check
// for a promise return value.
let built = definition.build(iframe.contentWindow, this);
// Set the dir attribute on the documents of panels using HTML.
let docEl = iframe.contentWindow.document.documentElement;
if (docEl.namespaceURI === HTML_NS) {
let top = this.win.top;
let topDocEl = top.document.documentElement;
let isRtl = top.getComputedStyle(topDocEl).direction === "rtl";
docEl.setAttribute("dir", isRtl ? "rtl" : "ltr");
}
if (!(typeof built.then == "function")) {
let panel = built;
iframe.panel = panel;