Bug 454978: Difficult to close tabs, r=gavin
authorMark Finkle <mfinkle@mozilla.com>
Tue, 23 Sep 2008 16:15:20 -0500
changeset 64848 787acc4ca742afc73669aad354934ab345b2f3aa
parent 64847 33e097e17939ef945edc70fc8a8fa0ab2d7085eb
child 64849 74f35e6bae26062449bbd33de17c9b4cbef2d4d2
push id19389
push userffxbld
push dateWed, 06 Apr 2011 21:33:21 +0000
treeherdermozilla-central@8e9f90073a20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs454978
Bug 454978: Difficult to close tabs, r=gavin
mobile/chrome/content/browser-ui.js
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -248,22 +248,19 @@ var BrowserUI = {
 
         let tabbarW = tabbar.boxObject.width;
         let sidebarW = sidebar.boxObject.width;
         let browserW = browser.boxObject.width;
 
         // Limit the panning
         if (newLeft > 0)
           newLeft = 0;
-        if (newLeft < -(tabbarW + sidebarW))
+        else if (newLeft < -(tabbarW + sidebarW))
           newLeft = -(tabbarW + sidebarW);
 
-        // Add a "snap" for the tabbar
-        if (Math.abs(newLeft + tabbarW) < 30)
-          newLeft = -tabbarW;
         tabbar.left = newLeft;
 
         // Never let the toolbar pan off the screen
         let newToolbarLeft = newLeft;
         if (newToolbarLeft < 0)
           newToolbarLeft = 0;
         toolbar.left = newToolbarLeft;
 
@@ -275,18 +272,20 @@ var BrowserUI = {
 
         browser.left = newLeft + tabbarW;
         sidebar.left = newLeft + tabbarW + browserW;
         panelUI.left = newLeft + tabbarW + browserW + sidebarW;
 
         // Set the UI mode based on where we ended up
         if (newLeft > -tabbarW && newLeft <= 0)
           this.mode = UIMODE_TABS;
-        if (newLeft >= -(tabbarW + sidebarW) && newLeft < -tabbarW)
+        else if (newLeft >= -(tabbarW + sidebarW) && newLeft < -tabbarW)
           this.mode = UIMODE_CONTROLS;
+        else if (newLeft == -tabbarW)
+          this.mode = (browser.top == 0 ? UIMODE_NONE : UIMODE_URLVIEW);
 
         pannedUI = true;
       }
     }
 
     if (pannedUI) {
       aEvent.stopPropagation();
 
@@ -362,21 +361,21 @@ var BrowserUI = {
           newLeft = -(tabbarW + sidebarW);
           break;
         case UIMODE_TABS:
           newLeft = 0;
           break;
       }
       tabbar.left = newLeft;
 
-      let newToolbarLeft = newLeft + tabbarW;
-      if (newToolbarLeft < -sidebarW)
-        newToolbarLeft += sidebarW;
-      else if (newToolbarLeft < 0)
+      let newToolbarLeft = newLeft;
+      if (newToolbarLeft < 0 && aMode != UIMODE_PANEL)
         newToolbarLeft = 0;
+      else if (newToolbarLeft < 0 && aMode == UIMODE_PANEL)
+        newToolbarLeft += tabbarW + sidebarW;
       toolbar.left = newToolbarLeft;
 
       browser.left = newLeft + tabbarW;
       sidebar.left = newLeft + tabbarW + browserW;
       panelUI.left = newLeft + tabbarW + browserW + sidebarW;
       panelUI.width = browserW;
   },
 
@@ -763,16 +762,18 @@ var BrowserUI = {
         this._dragData.dragY = 0;
         this._dragData.screenX = this._dragData.lastX = aEvent.screenX;
         this._dragData.screenY = this._dragData.lastY = aEvent.screenY;
         this._dragData.sTop = document.getElementById("toolbar-main").top;
         this._dragData.sLeft = document.getElementById("tab-list-container").left;
         break;
       case "mouseup":
         this._dragData.dragging = false;
+        // Cause the UI to snap, if needed
+        this._showPanel(this.mode);
         break;
       case "mousemove":
         this._scrollToolbar(aEvent);
         break;
       // Window size events
       case "resize":
         this._sizeControls(aEvent);
         break;