Back out changeset 6b26a933cad7 (Bug 649319) on suspicion of causing Windows debug Mochitest-other permaorange - CLOSED TREE.
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 05 May 2011 14:52:24 -0700
changeset 69034 88fdbd974f82a7032e0632f1eda2b8ccebd1f6b3
parent 69033 359643f58412ae768aeff01fc270fe51e2797ed3
child 69036 0833508a377c18a94c35bd1e4569416f33d70003
push id19836
push usermbrubeck@mozilla.com
push dateThu, 05 May 2011 21:53:02 +0000
treeherdermozilla-central@88fdbd974f82 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs649319
milestone6.0a1
backs out6b26a933cad7b064249a211394767b4382c80ecd
first release with
nightly linux32
88fdbd974f82 / 6.0a1 / 20110506030557 / files
nightly linux64
88fdbd974f82 / 6.0a1 / 20110506030557 / files
nightly mac
88fdbd974f82 / 6.0a1 / 20110506030557 / files
nightly win32
88fdbd974f82 / 6.0a1 / 20110506030557 / files
nightly win64
88fdbd974f82 / 6.0a1 / 20110506030212 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Back out changeset 6b26a933cad7 (Bug 649319) on suspicion of causing Windows debug Mochitest-other permaorange - CLOSED TREE.
browser/base/content/tabview/drag.js
browser/base/content/tabview/groupitems.js
browser/base/content/tabview/items.js
browser/base/content/test/tabview/Makefile.in
browser/base/content/test/tabview/browser_tabview_bug649319.js
--- a/browser/base/content/tabview/drag.js
+++ b/browser/base/content/tabview/drag.js
@@ -80,16 +80,29 @@ function Drag(item, event, isFauxDrag) {
   this.startTime = Date.now();
 
   this.item.isDragging = true;
   this.item.setZ(999999);
 
   this.safeWindowBounds = Items.getSafeWindowBounds();
 
   Trenches.activateOthersTrenches(this.el);
+
+  if (!isFauxDrag) {
+    // When a tab drag starts, make it the focused tab.
+    if (this.item.isAGroupItem) {
+      var tab = UI.getActiveTab();
+      if (!tab || tab.parent != this.item) {
+        if (this.item._children.length)
+          UI.setActive(this.item._children[0]);
+      }
+    } else if (this.item.isATabItem) {
+      UI.setActive(this.item);
+    }
+  }
 };
 
 Drag.prototype = {
   // ----------
   // Function: toString
   // Prints [Drag (item)] for debug use
   toString: function Drag_toString() {
     return "[Drag (" + this.item + ")]";
--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -1009,17 +1009,18 @@ GroupItem.prototype = Utils.extend(new I
             UI.setActive(self);
         });
 
         item.setParent(this);
 
         if (typeof item.setResizable == 'function')
           item.setResizable(false, options.immediately);
 
-        if (item == UI.getActiveTab() || !this._activeTab)
+        // if it is visually active, set it as the active tab.
+        if (iQ(item.container).hasClass("focus"))
           this.setActiveTab(item);
 
         // if it matches the selected tab or no active tab and the browser
         // tab is hidden, the active group item would be set.
         if (item.tab == gBrowser.selectedTab ||
             (!GroupItems.getActiveGroupItem() && !item.tab.hidden))
           UI.setActive(this);
       }
--- a/browser/base/content/tabview/items.js
+++ b/browser/base/content/tabview/items.js
@@ -146,19 +146,20 @@ Item.prototype = {
     this.$container = iQ(container);
 
     iQ(this.container).data('item', this);
 
     // ___ drag
     this.dragOptions = {
       cancelClass: 'close stackExpander',
       start: function(e, ui) {
-        UI.setActive(this);
-        if (this.isAGroupItem)
+        if (this.isAGroupItem) {
+          UI.setActive(this);
           this._unfreezeItemSize();
+        }
         // if we start dragging a tab within a group, start with dropSpace on.
         else if (this.parent != null)
           this.parent._dropSpaceActive = true;
         drag.info = new Drag(this, e);
       },
       drag: function(e) {
         drag.info.drag(e);
       },
@@ -195,17 +196,18 @@ Item.prototype = {
 
     // ___ resize
     var self = this;
     this.resizeOptions = {
       aspectRatio: self.keepProportional,
       minWidth: 90,
       minHeight: 90,
       start: function(e,ui) {
-        UI.setActive(this);
+        if (this.isAGroupItem)
+          UI.setActive(this);
         resize.info = new Drag(this, e);
       },
       resize: function(e,ui) {
         resize.info.snap(UI.rtl ? 'topright' : 'topleft', false, self.keepProportional);
       },
       stop: function() {
         self.setUserSize();
         self.pushAway();
--- a/browser/base/content/test/tabview/Makefile.in
+++ b/browser/base/content/test/tabview/Makefile.in
@@ -130,17 +130,16 @@ include $(topsrcdir)/config/rules.mk
                  browser_tabview_bug640765.js \
                  browser_tabview_bug641802.js \
                  browser_tabview_bug642793.js \
                  browser_tabview_bug644097.js \
                  browser_tabview_bug645653.js \
                  browser_tabview_bug648882.js \
                  browser_tabview_bug649006.js \
                  browser_tabview_bug649307.js \
-                 browser_tabview_bug649319.js \
                  browser_tabview_bug651311.js \
                  browser_tabview_dragdrop.js \
                  browser_tabview_exit_button.js \
                  browser_tabview_expander.js \
                  browser_tabview_firstrun_pref.js \
                  browser_tabview_group.js \
                  browser_tabview_launch.js \
                  browser_tabview_multiwindow_search.js \
deleted file mode 100644
--- a/browser/base/content/test/tabview/browser_tabview_bug649319.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
-  waitForExplicitFinish();
-
-  newWindowWithTabView(function (win) {
-    registerCleanupFunction(function () win.close());
-    waitForFocus(function () testScenarios(win));
-  });
-}
-
-function testScenarios(win) {
-  let simulateDragDrop = function (target) {
-    EventUtils.synthesizeMouseAtCenter(target, {type: "mousedown"}, cw);
-    EventUtils.synthesizeMouse(target, 40, 20, {type: "mousemove"}, cw);
-    EventUtils.synthesizeMouse(target, 80, 20, {type: "mouseup"}, cw);
-  }
-
-  let dragOutOfGroup = function (target) {
-    EventUtils.synthesizeMouseAtCenter(target, {type: "mousedown"}, cw);
-    EventUtils.synthesizeMouse(target, 600, 5, {type: "mousemove"}, cw);
-    EventUtils.synthesizeMouse(target, 600, 5, {type: "mouseup"}, cw);
-  }
-
-  let dragIntoGroup = function (target) {
-    EventUtils.synthesizeMouseAtCenter(target, {type: "mousedown"}, cw);
-    EventUtils.synthesizeMouse(target, -200, 5, {type: "mousemove"}, cw);
-    EventUtils.synthesizeMouse(target, -200, 5, {type: "mouseup"}, cw);
-  }
-
-  let assertActiveOrphan = function (tabItem) {
-    ok(!cw.GroupItems.getActiveGroupItem(), "no groupItem is active");
-    is(cw.UI.getActiveTab(), tabItem, "orphan tab is active");
-    is(cw.UI.getActiveOrphanTab(), tabItem, "orphan tab is active");
-  }
-
-  let cw = win.TabView.getContentWindow();
-  let groupItem = cw.GroupItems.groupItems[0];
-  let groupItem2 = createGroupItemWithBlankTabs(win, 400, 300, 20, 4);
-
-  // move group
-  cw.UI.setActive(groupItem);
-  simulateDragDrop(groupItem2.container);
-  is(cw.GroupItems.getActiveGroupItem(), groupItem2, "second groupItem is active");
-  is(cw.UI.getActiveTab(), groupItem2.getChild(0), "second groupItem's first tab is active");
-
-  // resize group
-  cw.UI.setActive(groupItem);
-  let tabItem = groupItem2.getChild(2);
-  groupItem2.setActiveTab(tabItem);
-  simulateDragDrop(groupItem2.$resizer[0]);
-  is(cw.GroupItems.getActiveGroupItem(), groupItem2, "second groupItem is active");
-  is(cw.UI.getActiveTab(), tabItem, "second groupItem's third tab is active");
-
-  // create orphan
-  tabItem = groupItem2.getChild(0);
-  dragOutOfGroup(tabItem.container);
-
-  // move orphan
-  cw.UI.setActive(groupItem2);
-  simulateDragDrop(tabItem.container);
-  assertActiveOrphan(tabItem);
-
-  // resize orphan
-  cw.UI.setActive(groupItem2);
-  let $resizer = cw.iQ('.iq-resizable-handle', tabItem.container);
-  simulateDragDrop($resizer[0]);
-  assertActiveOrphan(tabItem);
-
-  // drag back into group
-  dragIntoGroup(tabItem.container);
-  cw.UI.setActive(groupItem);
-  cw.UI.setActive(groupItem2);
-  is(cw.UI.getActiveTab(), tabItem, "the dropped tab is active");
-
-  // hide + unhide groupItem
-  hideGroupItem(groupItem2, function () {
-    is(cw.GroupItems.getActiveGroupItem(), groupItem, "first groupItem is active");
-
-    unhideGroupItem(groupItem2, function () {
-      is(cw.GroupItems.getActiveGroupItem(), groupItem2, "second groupItem is active");
-      is(cw.UI.getActiveTab(), tabItem, "the dropped tab is active");
-
-      finish();
-    });
-  });
-}