+ merge
authorIan Gilman <ian@iangilman.com>
Wed, 30 Jun 2010 11:49:31 -0700
changeset 50061 0900e591036e5c4b6bf4ec67ba3b1f0e7b644f26
parent 50060 967057ff1a6ba15cb16b7030d702f22540c3d77a (current diff)
parent 50058 3f5bbeb43a9bd07107b88e3398e008a40f10032f (diff)
child 50062 b08ca210a74356658ca0993ab9602ed9f7d83e1e
child 50063 1f3f1046c24718e49164d1779d0d6dc30bff9ed9
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.3a6pre
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
+ merge
browser/base/content/tabcandy/app/items.js
browser/themes/pinstripe/browser/tabcandy/tabcandy.css
--- a/browser/base/content/tabcandy/app/drag.js
+++ b/browser/base/content/tabcandy/app/drag.js
@@ -226,16 +226,17 @@ Drag.prototype = {
       }
     }
   },
 
   // ----------  
   // Function: stop
   // Called in response to an <Item> draggable "stop" event.
   stop: function() {
+		Trenches.hideGuides();
     this.item.isDragging = false;
 
     if(this.parent && !this.parent.locked.close && this.parent != this.item.parent 
         && this.parent._children.length == 0 && !this.parent.getTitle()) {
       this.parent.close();
     }
      
     if(this.parent && this.parent.expanded)
--- a/browser/base/content/tabcandy/app/items.js
+++ b/browser/base/content/tabcandy/app/items.js
@@ -846,22 +846,21 @@ window.Items = {
     });
     
     return items;
   }, 
 
   // ----------
   // Function: getPageBounds
   // Returns a <Rect> defining the area of the page <Item>s should stay within. 
-  getPageBounds: function() {
-    var top = 0;
-    var bottom = TabItems.tabHeight + 10; // MAGIC NUMBER: giving room for the "new tabs" group
+  getPageBounds: function( dontCountNewTabGroup ) {
+    var bottom = dontCountNewTabGroup ? 0 : TabItems.tabHeight + Items.defaultGutter;
     var width = Math.max(100, window.innerWidth);
-    var height = Math.max(100, window.innerHeight - (top + bottom));
-    return new Rect(0, top, width, height);
+    var height = Math.max(100, window.innerHeight - bottom);
+    return new Rect(0, 0, width, height);
   },
   
   // ----------
   // Function: getSafeWindowBounds
   // Returns the bounds within which it is safe to place all non-stationary <Item>s.
   getSafeWindowBounds: function( dontCountNewTabGroup ) {
     // the safe bounds that would keep it "in the window"
     var gutter = Items.defaultGutter;
--- a/browser/base/content/tabcandy/app/storage.js
+++ b/browser/base/content/tabcandy/app/storage.js
@@ -50,16 +50,21 @@ Storage = {
     this._sessionStore = Components.classes["@mozilla.org/browser/sessionstore;1"]
                                    .getService(Components.interfaces.nsISessionStore);
   },
 
   // ----------
   wipe: function() {
     try {
       var win = Utils.getCurrentWindow();
+      
+      // make sure that we have the current window
+      if (!win)
+      	win = Utils.getCurrentWindow();
+      
       var self = this;
       
       // ___ Tabs
       Tabs.forEach(function(tab) {
         self.saveTab(tab.raw, null);
       });
       
       // ___ Other
--- a/browser/base/content/tabcandy/app/trench.js
+++ b/browser/base/content/tabcandy/app/trench.js
@@ -15,16 +15,17 @@
  *
  * The Initial Developer of the Original Code is
  * Michael Yoshitaka Erlewine <mitcho@mitcho.com>.
  * Portions created by the Initial Developer are Copyright (C) 2010
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * Ian Gilman <ian@iangilman.com>
+ * Aza Raskin <aza@mozilla.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -116,29 +117,33 @@ Trench.prototype = {
   // 
   // Parameters:
   //   position - (integer) px center position of the trench
   //   range - (<Range>) the explicit active range of the trench
   //   minRange - (<Range>) the minimum range of the trench
   setPosition: function Trench_setPos(position, range, minRange) {
     this.position = position;
     
+    var page = Items.getPageBounds( true );
+    
     // optionally, set the range.
     if (isRange(range)) {
       this.range = range;
+    } else {
+      this.range = new Range( 0, (this.xory == 'x' ? page.height : page.width) );
     }
     
     // if there's a minRange, set that too.
     if (isRange(minRange))
       this.minRange = minRange;
     
     // set the appropriate bounds as a rect.
-    if ( this.xory == "x" ) // horizontal
+    if ( this.xory == "x" ) // vertical
       this.rect = new Rect ( this.position - this.radius, this.range.min, 2 * this.radius, this.range.extent );
-    else
+    else // horizontal
       this.rect = new Rect ( this.range.min, this.position - this.radius, this.range.extent, 2 * this.radius );
       
     this.show(); // DEBUG
 
   },
   
   //----------
   // Function: setActiveRange
@@ -214,18 +219,20 @@ Trench.prototype = {
 
     if (this.active && this.showGuide) {
       if (!this.dom.guideTrench)
         this.dom.guideTrench = iQ("<div/>").addClass('guideTrench').css({id: 'guideTrench'+this.id});
       var guideTrench = this.dom.guideTrench;
       guideTrench.css(this.guideRect);
       iQ("body").append(guideTrench);
     } else {
-      if (this.dom.guideTrench)
+      if (this.dom.guideTrench) {
         this.dom.guideTrench.remove();
+        delete this.dom.guideTrench;
+      }
     }
 
     if (!Trenches.showDebug) {
       this.hide( true ); // true for dontHideGuides
       return;
     }
 
     if (!this.dom.visibleTrench)
@@ -577,41 +584,50 @@ var Trenches = {
           break;
         if (assumeConstantSize && updatedX && (newRect.adjustedEdge == "left"||newRect.adjustedEdge == "right"))
           continue;
         if (assumeConstantSize && updatedY && (newRect.adjustedEdge == "top"||newRect.adjustedEdge == "bottom"))
           continue;
 
         rect = newRect;
         updated = true;
-//        // turn on the guide
-//        t.showGuide = true;
-//        t.show();
   
         // register this trench as the "snapped trench" for the appropriate edge.
         snappedTrenches[newRect.adjustedEdge] = t;
   
         // if updatedX, we don't need to update x any more.
         if (newRect.adjustedEdge == "left" && this.preferLeft)
           updatedX = true;
         if (newRect.adjustedEdge == "right" && !this.preferLeft)
           updatedX = true;
   
         // if updatedY, we don't need to update x any more.
         if (newRect.adjustedEdge == "top" && this.preferTop)
           updatedY = true;
         if (newRect.adjustedEdge == "bottom" && !this.preferTop)
           updatedY = true;
 
-      } else if (t.showGuide) { // make sure to turn it off
+      }
+    }
+    
+    let snappedIds = [ snappedTrenches[j].id for (j in snappedTrenches) ];
+    for (let i in this.trenches) {
+      let t = this.trenches[i];
+      // show the guide if it was used in snapping
+      if (snappedIds.indexOf(t.id) != -1) {
+        t.showGuide = true;
+        t.show();
+      }
+      // make sure to turn the guide off if we're no longer snapping to it
+      if (t.showGuide && snappedIds.indexOf(t.id) == -1) {
         t.showGuide = false;
         t.show();
       }
     }
-    
+
     if (updated) {
       rect.snappedTrenches = snappedTrenches;
       return rect;
     } else {
       Trenches.hideGuides();
       return false;
     }
   },
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -120,17 +120,17 @@
 <!ENTITY locationItem.title           "Location">
 <!ENTITY searchItem.title             "Search">
 <!ENTITY throbberItem.title           "Activity Indicator">
 <!ENTITY bookmarksItem.title          "Bookmarks">
 
 <!-- Toolbar items --> 
 <!ENTITY  homeButton.label            "Home">
 <!ENTITY tabCandyButton.label         "TabCandy">
-<!ENTITY tabCandyButton.tooltip       "Open a visual tab interface.">
+<!ENTITY tabCandyButton.tooltip       "Open a visual tab interface">
 
 <!ENTITY bookmarksButton.label          "Bookmarks">
 <!ENTITY bookmarksButton.tooltip        "Display your bookmarks">
 <!ENTITY bookmarksButton.accesskey  "B">
 <!ENTITY bookmarksCmd.commandkey "b">
 
 <!ENTITY bookmarksMenuButton.label          "Bookmarks">
 <!ENTITY bookmarksMenuButton.tooltip        "Display your bookmarks">
--- a/browser/themes/pinstripe/browser/tabcandy/tabcandy.css
+++ b/browser/themes/pinstripe/browser/tabcandy/tabcandy.css
@@ -191,18 +191,18 @@ body {
 
 .guideTrench, .visibleTrench, .activeVisibleTrench {
   position: absolute;
 }
 
 .guideTrench {
   z-index: -101;
   opacity: 0.9;
-  border-top: 2px dashed rgba(0,0,0,0.15);
-  border-left: 2px dashed rgba(0,0,0,0.15);
+  border-top: 2px solid rgba(0,0,0,0.13);
+  border-left: 2px solid rgba(0,0,0,0.13);
 }
 
 .visibleTrench {
   z-index: -103;
   opacity: 0.05;
 }
 
 .activeVisibleTrench {