Bug 666650 - [highlighter] create a global toolbar for the highlighter; r=mihai.sucan,gavin.sharp
authorRob Campbell <rcampbell@mozilla.com>
Tue, 02 Aug 2011 18:28:49 -0300
changeset 73629 3d5ba47b14f2586fe86eab82582d6751988e6f0a
parent 73628 6eee63caf1c62c71c73fcf7577c54d4fd6d010db
child 73630 56a12277818e375fd1f2c800699f8e9671caad1a
push id73
push userrcampbell@mozilla.com
push dateTue, 02 Aug 2011 21:29:44 +0000
treeherderfx-team@3d5ba47b14f2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmihai.sucan, gavin.sharp
bugs666650
milestone8.0a1
Bug 666650 - [highlighter] create a global toolbar for the highlighter; r=mihai.sucan,gavin.sharp
browser/base/content/browser.xul
browser/base/content/inspector.js
browser/base/content/test/inspector/browser_inspector_initialization.js
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -229,24 +229,16 @@
            hidden="true"
            ignorekeys="true"
            noautofocus="true"
            noautohide="true"
            titlebar="normal"
            close="true"
            onpopuphiding="InspectorUI.closeInspectorUI();"
            label="&inspectPanelTitle.label;">
-      <toolbar id="inspector-toolbar"
-               nowindowdrag="true">
-        <toolbarbutton id="inspector-inspect-toolbutton"
-                       label="&inspectButton.label;"
-                       accesskey="&inspectButton.accesskey;"
-                       class="toolbarbutton-text"
-                       command="Inspector:Inspect"/>
-      </toolbar>
       <hbox id="tree-panel-resizer-box" align="end">
         <spacer flex="1" />
         <resizer dir="bottomend" />
       </hbox>
     </panel>
 
     <menupopup id="toolbar-context-menu"
                onpopupshowing="onViewToolbarsPopupShowing(event);">
@@ -966,16 +958,28 @@
                   autocompletepopup="PopupAutoComplete"
                   onclick="return contentAreaClick(event, false);"/>
       <statuspanel id="statusbar-display" label=""/>
     </vbox>
     <vbox id="browser-border-end" hidden="true" layer="true"/>
   </hbox>
 
   <vbox id="browser-bottombox" layer="true">
+    <toolbar id="inspector-toolbar"
+             hidden="true">
+      <toolbarbutton id="inspector-inspect-toolbutton"
+                     label="&inspectButton.label;"
+                     accesskey="&inspectButton.accesskey;"
+                     class="toolbarbutton-text"
+                     command="Inspector:Inspect"/>
+      <toolbarseparator />
+      <hbox id="inspector-tools">
+        <!-- registered tools go here -->
+      </hbox>
+    </toolbar>
     <toolbar id="addon-bar"
              toolbarname="&addonBarCmd.label;" accesskey="&addonBarCmd.accesskey;"
              collapsed="true"
              class="toolbar-primary chromeclass-toolbar"
              context="toolbar-context-menu" toolboxid="navigator-toolbox"
              mode="icons" iconsize="small" defaulticonsize="small"
              lockiconsize="true"
              defaultset="addonbar-closebutton,spring,status-bar"
--- a/browser/base/content/inspector.js
+++ b/browser/base/content/inspector.js
@@ -217,16 +217,17 @@ Highlighter.prototype = {
     this.veilLeftBox = null;
     this.veilMiddleBox = null;
     this.veilTransparentBox = null;
     this.node = null;
     this.highlighterContainer.parentNode.removeChild(this.highlighterContainer);
     this.highlighterContainer = null;
     this.win = null
     this.browser = null;
+    this.toolbar = null;
   },
 
   /**
    * Is the highlighter highlighting? Public method for querying the state
    * of the highlighter.
    */
   get isHighlighting() {
     return this._highlighting;
@@ -753,23 +754,26 @@ var InspectorUI = {
    * resize, tabContainer.TabSelect and others.
    */
   openInspectorUI: function IUI_openInspectorUI()
   {
     // initialization
     this.browser = gBrowser.selectedBrowser;
     this.win = this.browser.contentWindow;
     this.winID = this.getWindowID(this.win);
+    this.toolbar = document.getElementById("inspector-toolbar");
+
     if (!this.domplate) {
       Cu.import("resource:///modules/domplate.jsm", this);
       this.domplateUtils.setDOM(window);
     }
 
     this.openTreePanel();
 
+    this.toolbar.hidden = null;
     this.inspectCmd.setAttribute("checked", true);
   },
 
   /**
    * Initialize highlighter.
    */
   initializeHighlighter: function IUI_initializeHighlighter()
   {
@@ -813,16 +817,17 @@ var InspectorUI = {
    */
   closeInspectorUI: function IUI_closeInspectorUI(aKeepStore)
   {
     if (this.closing || !this.win || !this.browser) {
       return;
     }
 
     this.closing = true;
+    this.toolbar.hidden = true;
 
     if (!aKeepStore) {
       InspectorStore.deleteStore(this.winID);
       this.win.removeEventListener("pagehide", this, true);
     } else {
       // Update the store before closing.
       if (this.selection) {
         InspectorStore.setValue(this.winID, "selectedNode",
@@ -1281,25 +1286,25 @@ var InspectorUI = {
       aRegObj.panel.addEventListener("popupshowing",
         function IUI_toolPanelShowing() {
           btn.setAttribute("checked", "true");
         }, false);
 
       this.tools[id] = aRegObj;
     }
 
-    let toolbar = document.getElementById("inspector-toolbar");
+    let toolbox = document.getElementById("inspector-tools");
     let btn = document.createElement("toolbarbutton");
     btn.setAttribute("id", aRegObj.buttonId);
     btn.setAttribute("label", aRegObj.label);
     btn.setAttribute("tooltiptext", aRegObj.tooltiptext);
     btn.setAttribute("accesskey", aRegObj.accesskey);
     btn.setAttribute("class", "toolbarbutton-text");
     btn.setAttribute("image", aRegObj.icon || "");
-    toolbar.appendChild(btn);
+    toolbox.appendChild(btn);
 
     btn.addEventListener("click",
       function IUI_ToolButtonClick(aEvent) {
         if (btn.getAttribute("checked") == "true") {
           aRegObj.onHide.apply(aRegObj.context);
         } else {
           aRegObj.onShow.apply(aRegObj.context, [InspectorUI.selection]);
           aRegObj.onSelect.apply(aRegObj.context, [InspectorUI.selection]);
--- a/browser/base/content/test/inspector/browser_inspector_initialization.js
+++ b/browser/base/content/test/inspector/browser_inspector_initialization.js
@@ -47,16 +47,17 @@ function startInspectorTests()
 
 function runInspectorTests()
 {
   Services.obs.removeObserver(runInspectorTests,
     INSPECTOR_NOTIFICATIONS.OPENED, false);
   Services.obs.addObserver(finishInspectorTests,
     INSPECTOR_NOTIFICATIONS.CLOSED, false);
 
+  is(InspectorUI.toolbar.getAttribute("collapsed"), "false", "toolbar is visible");
   let iframe = document.getElementById("inspector-tree-iframe");
   is(InspectorUI.treeIFrame, iframe, "Inspector IFrame matches");
   ok(InspectorUI.inspecting, "Inspector is inspecting");
   ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
   ok(InspectorUI.highlighter, "Highlighter is up");
 
   executeSoon(function() {
     InspectorUI.closeInspectorUI();
@@ -66,16 +67,17 @@ function runInspectorTests()
 function finishInspectorTests()
 {
   Services.obs.removeObserver(finishInspectorTests,
     INSPECTOR_NOTIFICATIONS.CLOSED, false);
 
   ok(!InspectorUI.highlighter, "Highlighter is gone");
   ok(!InspectorUI.isTreePanelOpen, "Inspector Tree Panel is closed");
   ok(!InspectorUI.inspecting, "Inspector is not inspecting");
+  is(InspectorUI.toolbar.getAttribute("collapsed"), "true", "toolbar is collapsed");
 
   gBrowser.removeCurrentTab();
   finish();
 }
 
 function test()
 {
   waitForExplicitFinish();