Backed out changeset b1c0b12a5f65
authorDão Gottwald <dao@mozilla.com>
Sat, 24 Sep 2011 12:18:30 +0200
changeset 77443 630e74940e326a46a2dc488caa8646448806369c
parent 77400 b1c0b12a5f6512e335685f6dcf75694e5ed8d81c
child 77444 b389f3d1e3577e909cd252546c7b3334b74cf35c
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
milestone9.0a1
backs outb1c0b12a5f6512e335685f6dcf75694e5ed8d81c
Backed out changeset b1c0b12a5f65
browser/devtools/highlighter/TreePanel.jsm
browser/themes/gnomestripe/browser/browser.css
browser/themes/pinstripe/browser/browser.css
browser/themes/winstripe/browser/browser.css
--- a/browser/devtools/highlighter/TreePanel.jsm
+++ b/browser/devtools/highlighter/TreePanel.jsm
@@ -44,46 +44,36 @@
 const Cu = Components.utils;
 
 Cu.import("resource:///modules/domplate.jsm");
 Cu.import("resource:///modules/InsideOutBox.jsm");
 Cu.import("resource:///modules/Services.jsm");
 
 var EXPORTED_SYMBOLS = ["TreePanel"];
 
-const INSPECTOR_URI = "chrome://browser/content/inspector.html";
-
 /**
  * TreePanel
  * A container for the Inspector's HTML Tree Panel widget constructor function.
  * @param aContext nsIDOMWindow (xulwindow)
  * @param aIUI global InspectorUI object
  */
 function TreePanel(aContext, aIUI) {
   this._init(aContext, aIUI);
 };
 
 TreePanel.prototype = {
   showTextNodesWithWhitespace: false,
   id: "treepanel", // DO NOT LOCALIZE
-  openInDock: true,
 
   /**
-   * The tree panel container element.
-   * @returns xul:panel|xul:vbox|null
-   *          xul:panel is returned when the tree panel is not docked, or
-   *          xul:vbox when when the tree panel is docked.
-   *          null is returned when no container is available.
+   * container.
+   * @returns xul:panel element
    */
   get container()
   {
-    if (this.openInDock) {
-      return this.document.getElementById("inspector-tree-box");
-    }
-
     return this.document.getElementById("inspector-tree-panel");
   },
 
   /**
    * Main TreePanel boot-strapping method. Initialize the TreePanel with the
    * originating context and the InspectorUI global.
    * @param aContext nsIDOMWindow (xulwindow)
    * @param aIUI global InspectorUI object
@@ -103,25 +93,23 @@ TreePanel.prototype = {
       label: this.IUI.strings.GetStringFromName("htmlPanel.label"),
       tooltiptext: this.IUI.strings.GetStringFromName("htmlPanel.tooltiptext"),
       accesskey: this.IUI.strings.GetStringFromName("htmlPanel.accesskey"),
       context: this,
       get isOpen() isOpen(),
       show: this.open,
       hide: this.close,
       onSelect: this.select,
-      panel: this.openInDock ? null : this.container,
+      panel: this.container,
       unregister: this.destroy,
     };
     this.editingEvents = {};
 
-    if (!this.openInDock) {
-      this._boundClose = this.close.bind(this);
-      this.container.addEventListener("popuphiding", this._boundClose, false);
-    }
+    this._boundClose = this.close.bind(this);
+    this.container.addEventListener("popuphiding", this._boundClose, false);
 
     // Register the HTML panel with the highlighter
     this.IUI.registerTool(this.registrationObject);
   },
 
   /**
    * Initialization function for the TreePanel.
    */
@@ -151,157 +139,87 @@ TreePanel.prototype = {
    */
   open: function TP_open()
   {
     if (this.initializingTreePanel && !this.treeLoaded) {
       return;
     }
 
     this.initializingTreePanel = true;
-    if (!this.openInDock)
-      this.container.hidden = false;
+    this.container.hidden = false;
 
     this.treeIFrame = this.document.getElementById("inspector-tree-iframe");
     if (!this.treeIFrame) {
+      let resizerBox = this.document.getElementById("tree-panel-resizer-box");
       this.treeIFrame = this.document.createElement("iframe");
       this.treeIFrame.setAttribute("id", "inspector-tree-iframe");
-      this.treeIFrame.flex = 1;
+      this.treeIFrame.setAttribute("flex", "1");
       this.treeIFrame.setAttribute("type", "content");
-    }
-
-    if (this.openInDock) { // Create vbox
-      this.openDocked();
-      return;
+      this.treeIFrame = this.container.insertBefore(this.treeIFrame, resizerBox);
     }
 
-    let resizerBox = this.document.getElementById("tree-panel-resizer-box");
-    this.treeIFrame = this.container.insertBefore(this.treeIFrame, resizerBox);
-
-    let boundLoadedInitializeTreePanel = function loadedInitializeTreePanel()
-    {
-      this.treeIFrame.removeEventListener("load",
-        boundLoadedInitializeTreePanel, true);
-      this.initializeIFrame();
-    }.bind(this);
+    let self = this;
+    this.container.addEventListener("popupshown", function treePanelShown() {
+      self.container.removeEventListener("popupshown",
+        treePanelShown, false);
 
-    let boundTreePanelShown = function treePanelShown()
-    {
-      this.container.removeEventListener("popupshown",
-        boundTreePanelShown, false);
-
-      this.treeIFrame.addEventListener("load",
-        boundLoadedInitializeTreePanel, true);
+        self.treeIFrame.addEventListener("load",
+          function loadedInitializeTreePanel() {
+            self.treeIFrame.removeEventListener("load",
+              loadedInitializeTreePanel, true);
+            self.initializeIFrame();
+          }, true);
 
-      let src = this.treeIFrame.getAttribute("src");
-      if (src != INSPECTOR_URI) {
-        this.treeIFrame.setAttribute("src", INSPECTOR_URI);
+      let src = self.treeIFrame.getAttribute("src");
+      if (src != "chrome://browser/content/inspector.html") {
+        self.treeIFrame.setAttribute("src",
+          "chrome://browser/content/inspector.html");
       } else {
-        this.treeIFrame.contentWindow.location.reload();
+        self.treeIFrame.contentWindow.location.reload();
       }
-    }.bind(this);
-
-    this.container.addEventListener("popupshown", boundTreePanelShown, false);
+    }, false);
 
     const panelWidthRatio = 7 / 8;
     const panelHeightRatio = 1 / 5;
 
     let width = parseInt(this.IUI.win.outerWidth * panelWidthRatio);
     let height = parseInt(this.IUI.win.outerHeight * panelHeightRatio);
     let y = Math.min(this.document.defaultView.screen.availHeight - height,
       this.IUI.win.innerHeight);
 
     this.container.openPopup(this.browser, "overlap", 0, 0,
       false, false);
 
     this.container.moveTo(80, y);
     this.container.sizeTo(width, height);
   },
 
-  openDocked: function TP_openDocked()
-  {
-    let treeBox = null;
-    let toolbar = this.IUI.toolbar.nextSibling; // Addons bar, typically
-    let toolbarParent =
-      this.IUI.browser.ownerDocument.getElementById("browser-bottombox");
-    treeBox = this.document.createElement("vbox");
-    treeBox.id = "inspector-tree-box";
-    treeBox.state = "open"; // for the registerTools API.
-    treeBox.minHeight = 10;
-    treeBox.flex = 1;
-    toolbarParent.insertBefore(treeBox, toolbar);
-    this.createResizer();
-    treeBox.appendChild(this.treeIFrame);
-
-    let boundLoadedInitializeTreePanel = function loadedInitializeTreePanel()
-    {
-      this.treeIFrame.removeEventListener("load",
-        boundLoadedInitializeTreePanel, true);
-      this.initializeIFrame();
-    }.bind(this);
-
-    this.treeIFrame.addEventListener("load",
-      boundLoadedInitializeTreePanel, true);
-
-    let src = this.treeIFrame.getAttribute("src");
-    if (src != INSPECTOR_URI) {
-      this.treeIFrame.setAttribute("src", INSPECTOR_URI);
-    } else {
-      this.treeIFrame.contentWindow.location.reload();
-    }
-  },
-
-  /**
-   * Lame resizer on the toolbar.
-   */
-  createResizer: function TP_createResizer()
-  {
-    let resizer = this.document.createElement("resizer");
-    resizer.id = "inspector-horizontal-splitter";
-    resizer.setAttribute("dir", "top");
-    resizer.flex = 1;
-    resizer.setAttribute("element", "inspector-tree-box");
-    resizer.height = 24;
-    this.IUI.toolbar.appendChild(resizer);
-    this.resizer = resizer;
-  },
-
   /**
    * Close the TreePanel.
    */
   close: function TP_close()
   {
-    if (this.openInDock) {
-      this.IUI.toolbar.removeChild(this.resizer);
-      let treeBox = this.container;
-      let treeBoxParent = treeBox.parentNode;
-      treeBoxParent.removeChild(treeBox);
-    } else {
-      this.container.hidePopup();
-    }
-
     if (this.treePanelDiv) {
       this.treePanelDiv.ownerPanel = null;
       let parent = this.treePanelDiv.parentNode;
       parent.removeChild(this.treePanelDiv);
       delete this.treePanelDiv;
       delete this.treeBrowserDocument;
     }
 
     this.treeLoaded = false;
+    this.container.hidePopup();
   },
 
   /**
    * Is the TreePanel open?
    * @returns boolean
    */
   isOpen: function TP_isOpen()
   {
-    if (this.openInDock)
-      return this.treeLoaded && this.container;
-
     return this.treeLoaded && this.container.state == "open";
   },
 
   /**
    * Create the ObjectBox for the given object.
    * @param object nsIDOMNode
    * @param isRoot boolean - Is this the root object?
    * @returns InsideOutBox
@@ -741,17 +659,16 @@ TreePanel.prototype = {
   destroy: function TP_destroy()
   {
     if (this.isOpen()) {
       this.close();
     }
 
     domplateUtils.setDOM(null);
 
-    delete this.resizer;
     delete this.treeWalker;
 
     if (this.treePanelDiv) {
       this.treePanelDiv.ownerPanel = null;
       let parent = this.treePanelDiv.parentNode;
       parent.removeChild(this.treePanelDiv);
       delete this.treePanelDiv;
       delete this.treeBrowserDocument;
@@ -765,15 +682,13 @@ TreePanel.prototype = {
       delete this.treeIFrame;
     }
 
     if (this.ioBox) {
       this.ioBox.destroy();
       delete this.ioBox;
     }
 
-    if (!this.openInDock) {
-      this.container.removeEventListener("popuphiding", this._boundClose, false);
-      delete this._boundClose;
-    }
+    this.container.removeEventListener("popuphiding", this._boundClose, false);
+    delete this._boundClose;
   }
 };
 
--- a/browser/themes/gnomestripe/browser/browser.css
+++ b/browser/themes/gnomestripe/browser/browser.css
@@ -1983,17 +1983,8 @@ panel[dimmed="true"] {
   outline: 1px dashed rgba(255,255,255,0.5);
   outline-offset: -1px;
 }
 
 #highlighter-veil-container[locked] > #highlighter-veil-middlebox > #highlighter-veil-transparentbox {
   box-shadow: 0 0 0 1px black;
   outline-color: white;
 }
-
-/*
- * need a "bumpy" background image for this!
- */
-#inspector-horizontal-splitter {
-  background: none !important;
-  -moz-appearance: none;
-  cursor: n-resize;
-}
--- a/browser/themes/pinstripe/browser/browser.css
+++ b/browser/themes/pinstripe/browser/browser.css
@@ -2619,18 +2619,8 @@ panel[dimmed="true"] {
   background: -moz-linear-gradient(hsla(220,6%,10%,.6), hsla(210,11%,18%,.45) 75%, hsla(210,11%,30%,.4));
   box-shadow: 0 1px 3px hsla(210,8%,5%,.25) inset, 0 1px 3px hsla(210,8%,5%,.25) inset, 0 1px 0 hsla(210,16%,76%,.15);
 }
 
 #inspector-inspect-toolbutton[checked]:hover:active,
 #inspector-tools > toolbarbutton[checked]:hover:active {
   background-color: hsla(210,8%,5%,.2);
 }
-
-/*
- * need a "bumpy" background image for this!
- */
-#inspector-horizontal-splitter {
-  background: none !important;
-  -moz-appearance: none;
-  cursor: n-resize;
-}
-
--- a/browser/themes/winstripe/browser/browser.css
+++ b/browser/themes/winstripe/browser/browser.css
@@ -2551,18 +2551,8 @@ panel[dimmed="true"] {
   outline: 1px dashed rgba(255,255,255,0.5);
   outline-offset: -1px;
 }
 
 #highlighter-veil-container[locked] > #highlighter-veil-middlebox > #highlighter-veil-transparentbox {
   box-shadow: 0 0 0 1px black;
   outline-color: white;
 }
-
-/*
- * need a "bumpy" background image for this!
- */
-#inspector-horizontal-splitter {
-  background: none !important;
-  -moz-appearance: none;
-  cursor: n-resize;
-}
-