From 0ec46b805720e4849480f20134d099749c5d3c05 Mon Sep 17 00:00:00 2001 From: Rob Campbell Date: Thu, 3 Nov 2011 19:55:02 -0300 Subject: [PATCH] Bug 699475 - Backed out changeset b878369ab3c8, testfailures and a bug. a=orange --- browser/app/profile/firefox.js | 3 - browser/devtools/highlighter/inspector.jsm | 105 +----------------- .../test/browser_inspector_initialization.js | 22 +--- .../browser/devtools/inspector.properties | 5 - 4 files changed, 4 insertions(+), 131 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index e4b30bf3703e..aa9f364d2f82 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1008,9 +1008,6 @@ pref("devtools.inspector.enabled", true); // Enable the style inspector pref("devtools.styleinspector.enabled", true); -// Enable the rules view -pref("devtools.ruleview.enabled", true); - // Enable the Scratchpad tool. pref("devtools.scratchpad.enabled", true); diff --git a/browser/devtools/highlighter/inspector.jsm b/browser/devtools/highlighter/inspector.jsm index 0985befbb69c..a6021ea8e4b3 100644 --- a/browser/devtools/highlighter/inspector.jsm +++ b/browser/devtools/highlighter/inspector.jsm @@ -50,7 +50,6 @@ var EXPORTED_SYMBOLS = ["InspectorUI"]; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource:///modules/TreePanel.jsm"); -Cu.import("resource:///modules/devtools/CssRuleView.jsm"); const INSPECTOR_INVISIBLE_ELEMENTS = { "head": true, @@ -741,7 +740,6 @@ InspectorUI.prototype = { toolEvents: null, inspecting: false, treePanelEnabled: true, - ruleViewEnabled: true, isDirty: false, store: null, @@ -893,11 +891,6 @@ InspectorUI.prototype = { this.treePanel = new TreePanel(this.chromeWin, this); } - if (Services.prefs.getBoolPref("devtools.ruleview.enabled") && - !this.toolRegistered("ruleview")) { - this.registerRuleView(); - } - if (Services.prefs.getBoolPref("devtools.styleinspector.enabled") && !this.toolRegistered("styleinspector")) { this.stylePanel = new StyleInspector(this.chromeWin, this); @@ -917,28 +910,6 @@ InspectorUI.prototype = { this.initializeHighlighter(); }, - registerRuleView: function IUI_registerRuleView() - { - let isOpen = this.isRuleViewOpen.bind(this); - - this.ruleViewObject = { - id: "ruleview", - label: this.strings.GetStringFromName("ruleView.label"), - tooltiptext: this.strings.GetStringFromName("ruleView.tooltiptext"), - accesskey: this.strings.GetStringFromName("ruleView.accesskey"), - context: this, - get isOpen() isOpen(), - show: this.openRuleView, - hide: this.closeRuleView, - onSelect: this.selectInRuleView, - panel: null, - unregister: this.destroyRuleView, - sidebar: true, - }; - - this.registerTool(this.ruleViewObject); - }, - /** * Register and initialize any included tools. */ @@ -1300,80 +1271,6 @@ InspectorUI.prototype = { } }, - ///////////////////////////////////////////////////////////////////////// - //// CssRuleView methods - - /** - * Is the cssRuleView open? - */ - isRuleViewOpen: function IUI_isRuleViewOpen() - { - return this.isSidebarOpen && this.ruleButton.hasAttribute("checked") && - (this.sidebarDeck.selectedPanel == this.getToolIframe(this.ruleViewObject)); - }, - - /** - * Convenience getter to retrieve the Rule Button. - */ - get ruleButton() - { - return this.chromeDoc.getElementById( - this.getToolbarButtonId(this.ruleViewObject.id)); - }, - - /** - * Open the CssRuleView. - */ - openRuleView: function IUI_openRuleView() - { - let iframe = this.getToolIframe(this.ruleViewObject); - let boundLoadListener = function() { - iframe.removeEventListener("load", boundLoadListener, true); - let doc = iframe.contentDocument; - this.ruleView = new CssRuleView(doc); - let body = doc.getElementById("ruleview-body"); - body.appendChild(this.ruleView.element); - this.ruleView.highlight(this.selection); - }.bind(this); - - iframe.addEventListener("load", boundLoadListener, true); - - iframe.setAttribute("src", "chrome://browser/content/cssruleview.xhtml"); - }, - - /** - * Stub to Close the CSS Rule View. Does nothing currently because the - * Rule View lives in the sidebar. - */ - closeRuleView: function IUI_closeRuleView() - { - // do nothing for now - }, - - /** - * Update the selected node in the Css Rule View. - * @param {nsIDOMnode} the selected node. - */ - selectInRuleView: function IUI_selectInRuleView(aNode) - { - if (this.ruleView) - this.ruleView.highlight(aNode); - }, - - /** - * Destroy the rule view. - */ - destroyRuleView: function IUI_destroyRuleView() - { - let iframe = this.getToolIframe(this.ruleViewObject); - iframe.parentNode.removeChild(iframe); - - if (this.ruleView) { - this.ruleView.clear(); - delete this.ruleView; - } - }, - ///////////////////////////////////////////////////////////////////////// //// Utility Methods @@ -1657,7 +1554,7 @@ InspectorUI.prototype = { this.bindToolEvent(btn, "click", function showIframe() { let visible = this.sidebarDeck.selectedPanel == iframe; if (!visible) { - this.sidebarDeck.selectedPanel = iframe; + sidebarDeck.selectedPanel = iframe; } this.toolShow(aRegObj); }.bind(this)); diff --git a/browser/devtools/highlighter/test/browser_inspector_initialization.js b/browser/devtools/highlighter/test/browser_inspector_initialization.js index e56cdfaeeb9b..4bffe770c277 100644 --- a/browser/devtools/highlighter/test/browser_inspector_initialization.js +++ b/browser/devtools/highlighter/test/browser_inspector_initialization.js @@ -95,34 +95,22 @@ function treePanelTests() executeSoon(function() { InspectorUI.showSidebar(); - document.getElementById(InspectorUI.getToolbarButtonId("styleinspector")).click(); }); } function stylePanelTests() { Services.obs.removeObserver(stylePanelTests, "StyleInspector-opened"); + Services.obs.addObserver(runContextMenuTest, + InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false); ok(InspectorUI.isSidebarOpen, "Inspector Sidebar is open"); ok(InspectorUI.stylePanel.cssHtmlTree, "Style Panel has a cssHtmlTree"); - InspectorUI.ruleButton.click(); - executeSoon(function() { - ruleViewTests(); - }); -} - -function ruleViewTests() -{ - Services.obs.addObserver(runContextMenuTest, - InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false); - - ok(InspectorUI.isRuleViewOpen(), "Rule View is open"); - ok(InspectorUI.ruleView, "InspectorUI has a cssRuleView"); - executeSoon(function() { InspectorUI.closeInspectorUI(); }); + } function runContextMenuTest() @@ -205,10 +193,6 @@ function finishInspectorTests() ok(!InspectorUI.treePanel, "Inspector Tree Panel is closed"); ok(!InspectorUI.inspecting, "Inspector is not inspecting"); ok(!InspectorUI.isSidebarOpen, "Inspector Sidebar is closed"); - ok(!InspectorUI.stylePanel, "Inspector Style Panel is gone"); - ok(!InspectorUI.ruleView, "Inspector Rule View is gone"); - is(InspectorUI.sidebarToolbar.children.length, 0, "No items in the Sidebar toolbar"); - is(InspectorUI.sidebarDeck.children.length, 0, "No items in the Sidebar deck"); ok(!InspectorUI.toolbar, "toolbar is hidden"); gBrowser.removeCurrentTab(); diff --git a/browser/locales/en-US/chrome/browser/devtools/inspector.properties b/browser/locales/en-US/chrome/browser/devtools/inspector.properties index f265cda6f39f..6f5bb87a9c82 100644 --- a/browser/locales/en-US/chrome/browser/devtools/inspector.properties +++ b/browser/locales/en-US/chrome/browser/devtools/inspector.properties @@ -23,8 +23,3 @@ htmlPanel.tooltiptext=HTML panel # toolbar button. htmlPanel.accesskey=H -# LOCALIZATION NOTE (ruleView.*): Button label, accesskey and tooltip text -# associated with the Highlighter's CSS Rule View in the Style Sidebar. -ruleView.label=Rules -ruleView.accesskey=R -ruleView.tooltiptext=View and Edit CSS \ No newline at end of file