Bug 610996 - TabView should set its visibility with tab-view-deck.selectedPanel rather than selectedIndex r=ian
authorRaymond Lee <raymond@raysquare.com>
Thu, 14 Apr 2011 11:28:58 +0800
changeset 68173 784db2f4b6acadf9e24a6d37b308392082d08097
parent 68172 3b690b386210031535984dd956afb6da9e193a01
child 68174 59111031d49a2d8ab9236251f9ddeb0a6f19c308
push id19528
push usereakhgari@mozilla.com
push dateFri, 15 Apr 2011 13:35:33 +0000
treeherdermozilla-central@754e793c647e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersian
bugs610996
milestone6.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 610996 - TabView should set its visibility with tab-view-deck.selectedPanel rather than selectedIndex r=ian
browser/base/content/browser-tabview.js
browser/base/content/browser.xul
browser/base/content/tabview/tabview.js
browser/base/content/tabview/ui.js
--- a/browser/base/content/browser-tabview.js
+++ b/browser/base/content/browser-tabview.js
@@ -33,16 +33,17 @@
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 let TabView = {
   _deck: null,
+  _iframe: null,
   _window: null,
   _firstUseExperienced: false,
   _browserKeyHandlerInitialized: false,
   VISIBILITY_IDENTIFIER: "tabview-visibility",
 
   // ----------
   get windowTitle() {
     delete this.windowTitle;
@@ -130,27 +131,27 @@ let TabView = {
     if (this._window) {
       if (typeof callback == "function")
         callback();
     } else {
       // ___ find the deck
       this._deck = document.getElementById("tab-view-deck");
 
       // ___ create the frame
-      let iframe = document.createElement("iframe");
-      iframe.id = "tab-view";
-      iframe.setAttribute("transparent", "true");
-      iframe.flex = 1;
+      this._iframe = document.createElement("iframe");
+      this._iframe.id = "tab-view";
+      this._iframe.setAttribute("transparent", "true");
+      this._iframe.flex = 1;
 
       if (typeof callback == "function")
         window.addEventListener("tabviewframeinitialized", callback, false);
 
-      iframe.setAttribute("src", "chrome://browser/content/tabview.html");
-      this._deck.appendChild(iframe);
-      this._window = iframe.contentWindow;
+      this._iframe.setAttribute("src", "chrome://browser/content/tabview.html");
+      this._deck.appendChild(this._iframe);
+      this._window = this._iframe.contentWindow;
 
       if (this._tabShowEventListener) {
         gBrowser.tabContainer.removeEventListener(
           "TabShow", this._tabShowEventListener, true);
         this._tabShowEventListener = null;
       }
 
       this._setBrowserKeyHandlers();
@@ -158,18 +159,18 @@ let TabView = {
   },
 
   // ----------
   getContentWindow: function TabView_getContentWindow() {
     return this._window;
   },
 
   // ----------
-  isVisible: function() {
-    return (this._deck ? this._deck.selectedIndex == 1 : false);
+  isVisible: function TabView_isVisible() {
+    return (this._deck ? this._deck.selectedPanel == this._iframe : false);
   },
 
   // ----------
   show: function() {
     if (this.isVisible())
       return;
 
     let self = this;
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -458,17 +458,17 @@
         <toolbarbutton class="titlebar-button" id="titlebar-close" command="cmd_closeWindow"/>
       </hbox>
     </hbox>
   </hbox>
 </vbox>
 #endif
 
 <deck flex="1" id="tab-view-deck">
-<vbox flex="1">
+<vbox flex="1" id="browser-panel">
 
   <toolbox id="navigator-toolbox"
            defaultmode="icons" mode="icons"
 #ifdef WINCE
            defaulticonsize="small" iconsize="small"
 #else
            iconsize="large"
 #endif
--- a/browser/base/content/tabview/tabview.js
+++ b/browser/base/content/tabview/tabview.js
@@ -28,16 +28,17 @@ XPCOMUtils.defineLazyGetter(this, "gNetU
   Cu.import("resource://gre/modules/NetUtil.jsm", obj);
   return obj.NetUtil;
 });
 
 var gWindow = window.parent;
 var gBrowser = gWindow.gBrowser;
 var gTabView = gWindow.TabView;
 var gTabViewDeck = gWindow.document.getElementById("tab-view-deck");
+var gBrowserPanel = gWindow.document.getElementById("browser-panel");
 var gTabViewFrame = gWindow.document.getElementById("tab-view");
 
 # NB: Certain files need to evaluate before others
 
 #include iq.js
 #include storage.js
 #include items.js
 #include groupitems.js
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -411,17 +411,17 @@ let UI = {
   getActiveOrphanTab: function UI_getActiveOrphanTab() {
     return (this._activeTab && !this._activeTab.parent) ? this._activeTab : null;
   },
 
   // ----------
   // Function: isTabViewVisible
   // Returns true if the TabView UI is currently shown.
   isTabViewVisible: function UI_isTabViewVisible() {
-    return gTabViewDeck.selectedIndex == 1;
+    return gTabViewDeck.selectedPanel == gTabViewFrame;
   },
 
   // ---------
   // Function: _initPageDirection
   // Initializes the page base direction
   _initPageDirection: function UI__initPageDirection() {
     let chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].
                     getService(Ci.nsIXULChromeRegistry);
@@ -450,17 +450,17 @@ let UI = {
       groupItem.reorderTabItemsBasedOnTabOrder();
     });
     this._reorderTabItemsOnShow = [];
 
 #ifdef XP_WIN
     // Restore the full height when showing TabView
     gTabViewFrame.style.marginTop = "";
 #endif
-    gTabViewDeck.selectedIndex = 1;
+    gTabViewDeck.selectedPanel = gTabViewFrame;
     gWindow.TabsInTitlebar.allowedBy("tabview-open", false);
     gTabViewFrame.contentWindow.focus();
 
     gBrowser.updateTitlebar();
 #ifdef XP_MACOSX
     this.setTitlebarColors(true);
 #endif
     let event = document.createEvent("Events");
@@ -532,17 +532,17 @@ let UI = {
     this._reorderTabsOnHide = [];
 
 #ifdef XP_WIN
     // Push the top of TabView frame to behind the tabbrowser, so glass can show
     // XXX bug 586679: avoid shrinking the iframe and squishing iframe contents
     // as well as avoiding the flash of black as we animate out
     gTabViewFrame.style.marginTop = gBrowser.boxObject.y + "px";
 #endif
-    gTabViewDeck.selectedIndex = 0;
+    gTabViewDeck.selectedPanel = gBrowserPanel;
     gWindow.TabsInTitlebar.allowedBy("tabview-open", true);
     gBrowser.contentWindow.focus();
 
     gBrowser.updateTitlebar();
 #ifdef XP_MACOSX
     this.setTitlebarColors(false);
 #endif
     Storage.saveVisibilityData(gWindow, "false");