Bug 1386812 - Apply Linux theme on Tier3 platforms under devtools/.
MozReview-Commit-ID: Lan712U4J1W
--- a/devtools/client/debugger/new/test/mochitest/head.js
+++ b/devtools/client/debugger/new/test/mochitest/head.js
@@ -575,18 +575,18 @@ function togglePauseOnExceptions(
*/
function invokeInTab(fnc) {
info(`Invoking function ${fnc} in tab`);
return ContentTask.spawn(gBrowser.selectedBrowser, fnc, function*(fnc) {
content.wrappedJSObject[fnc](); // eslint-disable-line mozilla/no-cpows-in-tests, max-len
});
}
-const isLinux = Services.appinfo.OS === "Linux";
-const isMac = Services.appinfo.OS === "Darwin";
+const isLinux = /^gtk/.test(Services.appinfo.widgetToolkit);
+const isMac = Services.appinfo.widgetToolkit === "cocoa";
const cmdOrCtrl = isLinux ? { ctrlKey: true } : { metaKey: true };
const shiftOrAlt = isMac
? { accelKey: true, shiftKey: true }
: { accelKey: true, altKey: true };
// On Mac, going to beginning/end only works with meta+left/right. On
// Windows, it only works with home/end. On Linux, apparently, either
// ctrl+left/right or home/end work.
--- a/devtools/client/inspector/local-toolbox.js
+++ b/devtools/client/inspector/local-toolbox.js
@@ -53,22 +53,22 @@ function fixStylesheets(doc) {
let themeLink = doc.createElement("link");
themeLink.setAttribute("rel", "stylesheet");
themeLink.setAttribute("href", "/devtools/skin/light-theme.css");
doc.head.appendChild(themeLink);
doc.documentElement.classList.add("theme-light");
doc.body.classList.add("theme-light");
- if (appinfo.OS === "Darwin") {
+ if (appinfo.widgetToolkit == "windows") {
+ doc.documentElement.setAttribute("platform", "win");
+ } else if (appinfo.widgetToolkit == "cocoa") {
doc.documentElement.setAttribute("platform", "mac");
- } else if (appinfo.OS === "Linux") {
+ } else {
doc.documentElement.setAttribute("platform", "linux");
- } else {
- doc.documentElement.setAttribute("platform", "win");
}
}
/**
* Called each time a childList mutation is received on the main document.
* Check the iframes currently loaded in the document and call fixStylesheets if needed.
*/
function fixStylesheetsOnMutation() {
--- a/devtools/client/netmonitor/index.js
+++ b/devtools/client/netmonitor/index.js
@@ -61,22 +61,22 @@ window.store = store;
* Will also add mandatory classnames and attributes to be compatible with devtools theme
* stylesheet.
*/
window.addEventListener("DOMContentLoaded", () => {
for (let link of document.head.querySelectorAll("link")) {
link.href = link.href.replace(/(resource|chrome)\:\/\//, "/");
}
- if (appinfo.OS === "Darwin") {
+ if (appinfo.widgetToolkit == "windows") {
+ document.documentElement.setAttribute("platform", "win");
+ } else if (appinfo.widgetToolkit == "cocoa") {
document.documentElement.setAttribute("platform", "mac");
- } else if (appinfo.OS === "Linux") {
+ } else {
document.documentElement.setAttribute("platform", "linux");
- } else {
- document.documentElement.setAttribute("platform", "win");
}
});
bootstrap(React, ReactDOM).then((connection) => {
if (!connection) {
return;
}
renderRoot(React, ReactDOM, App, store);
--- a/devtools/client/shared/developer-toolbar.js
+++ b/devtools/client/shared/developer-toolbar.js
@@ -128,20 +128,20 @@ exports.CommandUtils = CommandUtils;
/**
* Due to a number of panel bugs we need a way to check if we are running on
* Linux. See the comments for TooltipPanel and OutputPanel for further details.
*
* When bug 780102 is fixed all isLinux checks can be removed and we can revert
* to using panels.
*/
loader.lazyGetter(this, "isLinux", function () {
- return Services.appinfo.OS == "Linux";
+ return /^gtk/.test(Services.appinfo.widgetToolkit);
});
loader.lazyGetter(this, "isMac", function () {
- return Services.appinfo.OS == "Darwin";
+ return Services.appinfo.widgetToolkit == "cocoa";
});
/**
* A component to manage the global developer toolbar, which contains a GCLI
* and buttons for various developer tools.
* @param chromeWindow The browser window to which this toolbar is attached
*/
function DeveloperToolbar(chromeWindow) {
@@ -942,24 +942,24 @@ OutputPanel.prototype._resize = function
// Set max panel width to match any content with a max of the width of the
// browser window.
let maxWidth = this._panel.ownerDocument.documentElement.clientWidth;
// Adjust max width according to OS.
// We'd like to put this in CSS but we can't:
// body { width: calc(min(-5px, max-content)); }
// #_panel { max-width: -5px; }
- switch (Services.appinfo.OS) {
- case "Linux":
+ switch (Services.appinfo.widgetToolkit) {
+ case "windows":
maxWidth -= 5;
break;
- case "Darwin":
+ case "cocoa":
maxWidth -= 25;
break;
- case "WINNT":
+ default:
maxWidth -= 5;
break;
}
this.document.body.style.width = "-moz-max-content";
let style = this._frame.contentWindow.getComputedStyle(this.document.body);
let frameWidth = parseInt(style.width, 10);
let width = Math.min(maxWidth, frameWidth);
--- a/devtools/client/webconsole/local-dev/index.js
+++ b/devtools/client/webconsole/local-dev/index.js
@@ -56,22 +56,22 @@ document.querySelector("#mount").appendC
document.documentElement.classList.add("theme-light");
// Copied from netmonitor/index.js:
window.addEventListener("DOMContentLoaded", () => {
for (let link of document.head.querySelectorAll("link")) {
link.href = link.href.replace(/(resource|chrome)\:\/\//, "/");
}
- if (appinfo.OS === "Darwin") {
+ if (appinfo.widgetToolkit == "windows") {
+ document.documentElement.setAttribute("platform", "win");
+ } else if (appinfo.widgetToolkit == "cocoa") {
document.documentElement.setAttribute("platform", "mac");
- } else if (appinfo.OS === "Linux") {
+ } else {
document.documentElement.setAttribute("platform", "linux");
- } else {
- document.documentElement.setAttribute("platform", "win");
}
});
let consoleFrame;
function onConnect(connection) {
// If we are on the main dashboard don't render the component
if (!connection || !connection.tabConnection || !connection.tabConnection.tabTarget) {
return;