Bug 627755 Need to have resizer when the status bar is turned off r=Ratty
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Mon, 24 Jan 2011 23:57:28 +0000
changeset 6996 0c665572476a3247a57ee7dfcf2f0d48e1adf52f
parent 6995 6e981b8218f74c43e8fd8b0d6899a0c8f57dd9c6
child 6997 7821b0a1c9f59ed8372be0cb764ef4a76d0bca14
push idunknown
push userunknown
push dateunknown
reviewersRatty
bugs627755
Bug 627755 Need to have resizer when the status bar is turned off r=Ratty
suite/browser/navigator.js
suite/browser/navigatorOverlay.xul
suite/browser/tabbrowser.xml
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -501,16 +501,17 @@ function Startup()
   } catch (e) {
     alert("Error launching browser window:" + e);
     window.close(); // Give up.
     return;
   }
 
   // Do all UI building here:
   UpdateNavBar();
+  updateWindowResizer();
 
   // set home button tooltip text
   updateHomeButtonTooltip();
 
   // initialize observers and listeners
   var xw = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                  .getInterface(Components.interfaces.nsIWebNavigation)
                  .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
@@ -684,16 +685,18 @@ function Startup()
   // called when we go into full screen, even if it is 
   // initiated by a web page script
   addEventListener("fullscreen", onFullScreen, true);
 
   addEventListener("PopupCountChanged", UpdateStatusBarPopupIcon, true);
 
   addEventListener("AppCommand", HandleAppCommandEvent, true);
 
+  addEventListener("resize", updateWindowResizer, false);
+
   // does clicking on the urlbar select its contents?
   gClickSelectsAll = Services.prefs.getBoolPref("browser.urlbar.clickSelectsAll");
   gClickAtEndSelects = Services.prefs.getBoolPref("browser.urlbar.clickAtEndSelects");
 
   // BiDi UI
   gShowBiDi = isBidiEnabled();
   if (gShowBiDi) {
     document.getElementById("documentDirection-swap").hidden = false;
@@ -730,16 +733,23 @@ function UpdateNavBar()
     if (!next || !next.classList.contains("nav-bar-class"))
       element.classList.add("nav-bar-last");
     var previous = element.previousSibling;
     if (!previous || !previous.classList.contains("nav-bar-class"))
       element.classList.add("nav-bar-first");
   }
 }
 
+function updateWindowResizer()
+{
+  getBrowser().showWindowResizer =
+      window.windowState == window.STATE_NORMAL &&
+      !isElementVisible(document.getElementById("status-bar"));
+}
+
 function InitSessionStoreCallback()
 {
   try {
     var ss = Components.classes["@mozilla.org/suite/sessionstore;1"]
                        .getService(Components.interfaces.nsISessionStore);
     ss.init(window);
 
     //Check if we have "Deferred Session Restore"
--- a/suite/browser/navigatorOverlay.xul
+++ b/suite/browser/navigatorOverlay.xul
@@ -219,17 +219,17 @@
 
   <broadcasterset id="navBroadcasters">
     <broadcaster id="canGoBack"    disabled="true"/>
     <broadcaster id="canGoForward" disabled="true"/>
     <broadcaster id="canGoUp"      disabled="true"/>
     <broadcaster id="Communicator:WorkMode"/>
     <broadcaster id="cmd_viewnavbar" oncommand="goToggleToolbar( 'nav-bar','cmd_viewnavbar');" checked="true"/>
     <broadcaster id="cmd_viewpersonaltoolbar" oncommand="goToggleToolbar('PersonalToolbar','cmd_viewpersonaltoolbar');" checked="true"/>
-    <broadcaster id="cmd_viewtaskbar" oncommand="goToggleToolbar('status-bar','cmd_viewtaskbar');" checked="true"/>
+    <broadcaster id="cmd_viewtaskbar" oncommand="goToggleToolbar('status-bar','cmd_viewtaskbar'); updateWindowResizer();" checked="true"/>
     <broadcaster id="cmd_viewcomponentbar" oncommand="goToggleToolbar('component-bar', 'cmd_viewcomponentbar');" checked="true"/>
     <broadcaster id="isImage"/>
   </broadcasterset>
          
   <!-- bookmarks context menu -->
   <popupset id="bookmarksPopupset">
     <menupopup id="bookmarks-context-menu" 
            onpopupshowing="return BookmarksMenu.createContextMenu(event);"
--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -962,16 +962,17 @@
             this.mPreviousTab = null;
             this.mLastRelatedIndex = 0;
 
             var newBrowser = this.mPanelContainer.selectedPanel.firstChild;
             // Transfer the dropped link handler to the new browser.
             // Note: closing the current tab sets mCurrentBrowser to null
             //       so we use mCurrentTab.linkedBrowser instead.
             newBrowser.droppedLinkHandler = this.mCurrentTab.linkedBrowser.droppedLinkHandler;
+            newBrowser.showWindowResizer = this.mCurrentTab.linkedBrowser.showWindowResizer;
             if (this.mCurrentBrowser) {
               this.mCurrentBrowser.droppedLinkHandler = null;
               // Only save the focused element if it is in our content window
               // or in an ancestor window.
               var focusedWindow = document.commandDispatcher.focusedWindow;
               var saveFocus = false;
 
               if (focusedWindow && focusedWindow.top == window.content) {
@@ -2634,16 +2635,20 @@
       <property name="userTypedValue"
                 onget="return this.mCurrentBrowser.userTypedValue;"
                 onset="return this.mCurrentBrowser.userTypedValue = val;"/>
 
       <property name="droppedLinkHandler"
                 onget="return this.mCurrentBrowser.droppedLinkHandler;"
                 onset="return this.mCurrentBrowser.droppedLinkHandler = val;"/>
 
+      <property name="showWindowResizer"
+                onget="return this.mCurrentBrowser.showWindowResizer;"
+                onset="return this.mCurrentBrowser.showWindowResizer = val;"/>
+
       <method name="observe">
         <parameter name="aSubject"/>
         <parameter name="aTopic"/>
         <parameter name="aState"/>
         <body>
           <![CDATA[
             if (aTopic != "browser:purge-session-history")
               return;