From d71c865ef25f9c9da34ae4fa641cbd5a828f44f2 Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Mon, 19 Jun 2017 22:35:10 +0200 Subject: [PATCH] Backed out changeset 2d2ee0638f59 (bug 1373492) for failing browser_inspector_highlighter-eyedropper-xul.js. r=backout --- devtools/client/framework/toolbox-options.js | 5 +++++ devtools/client/inspector/boxmodel/test/head.js | 2 ++ devtools/client/inspector/grids/test/head.js | 2 ++ devtools/client/inspector/inspector.js | 12 +++++++----- devtools/client/locales/en-US/layout.properties | 2 ++ devtools/client/preferences/devtools.js | 3 +++ 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/devtools/client/framework/toolbox-options.js b/devtools/client/framework/toolbox-options.js index affce0073b7f..393dc217450a 100644 --- a/devtools/client/framework/toolbox-options.js +++ b/devtools/client/framework/toolbox-options.js @@ -322,6 +322,11 @@ OptionsPanel.prototype = { label: "Enable new debugger frontend", id: "devtools-new-debugger", parentId: "debugger-options" + }, { + pref: "devtools.layoutview.enabled", + label: "Enable layout panel", + id: "devtools-layout-panel", + parentId: "inspector-options" }]; let createPreferenceOption = ({pref, label, id}) => { diff --git a/devtools/client/inspector/boxmodel/test/head.js b/devtools/client/inspector/boxmodel/test/head.js index 8f0bbef6e370..cf79833b8a92 100644 --- a/devtools/client/inspector/boxmodel/test/head.js +++ b/devtools/client/inspector/boxmodel/test/head.js @@ -11,8 +11,10 @@ Services.scriptloader.loadSubScript( "chrome://mochitests/content/browser/devtools/client/inspector/test/head.js", this); +Services.prefs.setBoolPref("devtools.layoutview.enabled", true); Services.prefs.setIntPref("devtools.toolbox.footer.height", 350); registerCleanupFunction(() => { + Services.prefs.clearUserPref("devtools.layoutview.enabled"); Services.prefs.clearUserPref("devtools.toolbox.footer.height"); }); diff --git a/devtools/client/inspector/grids/test/head.js b/devtools/client/inspector/grids/test/head.js index 6788f638c3b9..9606513bf213 100644 --- a/devtools/client/inspector/grids/test/head.js +++ b/devtools/client/inspector/grids/test/head.js @@ -16,9 +16,11 @@ Services.scriptloader.loadSubScript( "chrome://mochitests/content/browser/devtools/client/framework/test/shared-redux-head.js", this); +Services.prefs.setBoolPref("devtools.layoutview.enabled", true); Services.prefs.setBoolPref("devtools.promote.layoutview.showPromoteBar", false); Services.prefs.setIntPref("devtools.toolbox.footer.height", 350); registerCleanupFunction(() => { + Services.prefs.clearUserPref("devtools.layoutview.enabled"); Services.prefs.clearUserPref("devtools.promote.layoutview.showPromoteBar"); Services.prefs.clearUserPref("devtools.toolbox.footer.height"); }); diff --git a/devtools/client/inspector/inspector.js b/devtools/client/inspector/inspector.js index d0881a66797c..e02ac1a8fcd8 100644 --- a/devtools/client/inspector/inspector.js +++ b/devtools/client/inspector/inspector.js @@ -620,12 +620,14 @@ Inspector.prototype = { INSPECTOR_L10N.getStr("inspector.sidebar.computedViewTitle"), defaultTab == "computedview"); - // Grid and layout panels aren't lazy-loaded as their module end up - // calling inspector.addSidebarTab - this.gridInspector = new GridInspector(this, this.panelWin); + if (Services.prefs.getBoolPref("devtools.layoutview.enabled")) { + // Grid and layout panels aren't lazy-loaded as their module end up + // calling inspector.addSidebarTab + this.gridInspector = new GridInspector(this, this.panelWin); - const LayoutView = this.browserRequire("devtools/client/inspector/layout/layout"); - this.layoutview = new LayoutView(this, this.panelWin); + const LayoutView = this.browserRequire("devtools/client/inspector/layout/layout"); + this.layoutview = new LayoutView(this, this.panelWin); + } if (this.target.form.animationsActor) { this.sidebar.addFrameTab( diff --git a/devtools/client/locales/en-US/layout.properties b/devtools/client/locales/en-US/layout.properties index 423db443b015..2e868f019509 100644 --- a/devtools/client/locales/en-US/layout.properties +++ b/devtools/client/locales/en-US/layout.properties @@ -4,6 +4,8 @@ # LOCALIZATION NOTE This file contains the Layout Inspector strings. # The Layout Inspector is a panel accessible in the Inspector sidebar. +# The Layout Inspector may need to be enabled in about:config by setting +# devtools.layoutview.enabled to true. # LOCALIZATION NOTE (layout.cannotShowGridOutline, layout.cannotSHowGridOutline.title): # In the case where the grid outline cannot be effectively displayed. diff --git a/devtools/client/preferences/devtools.js b/devtools/client/preferences/devtools.js index 4462735471f4..8523beb1079c 100644 --- a/devtools/client/preferences/devtools.js +++ b/devtools/client/preferences/devtools.js @@ -68,6 +68,9 @@ pref("devtools.inspector.colorWidget.enabled", false); // Enable the Font Inspector pref("devtools.fontinspector.enabled", true); +// Enable the Layout View +pref("devtools.layoutview.enabled", false); + // Counter to promote the inspector layout view. // @remove after release 56 (See Bug 1355747) pref("devtools.promote.layoutview", 1);