Back out changeset 6b26a933cad7 (Bug 649319) on suspicion of causing Windows debug Mochitest-other permaorange - CLOSED TREE.

This commit is contained in:
Matt Brubeck 2011-05-05 14:52:24 -07:00
parent edc6e0c61b
commit c3e4065e5d
5 changed files with 20 additions and 93 deletions

View File

@ -85,6 +85,19 @@ function Drag(item, event, isFauxDrag) {
this.safeWindowBounds = Items.getSafeWindowBounds(); this.safeWindowBounds = Items.getSafeWindowBounds();
Trenches.activateOthersTrenches(this.el); 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 = { Drag.prototype = {

View File

@ -1014,7 +1014,8 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
if (typeof item.setResizable == 'function') if (typeof item.setResizable == 'function')
item.setResizable(false, options.immediately); 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); this.setActiveTab(item);
// if it matches the selected tab or no active tab and the browser // if it matches the selected tab or no active tab and the browser

View File

@ -151,9 +151,10 @@ Item.prototype = {
this.dragOptions = { this.dragOptions = {
cancelClass: 'close stackExpander', cancelClass: 'close stackExpander',
start: function(e, ui) { start: function(e, ui) {
UI.setActive(this); if (this.isAGroupItem) {
if (this.isAGroupItem) UI.setActive(this);
this._unfreezeItemSize(); this._unfreezeItemSize();
}
// if we start dragging a tab within a group, start with dropSpace on. // if we start dragging a tab within a group, start with dropSpace on.
else if (this.parent != null) else if (this.parent != null)
this.parent._dropSpaceActive = true; this.parent._dropSpaceActive = true;
@ -200,7 +201,8 @@ Item.prototype = {
minWidth: 90, minWidth: 90,
minHeight: 90, minHeight: 90,
start: function(e,ui) { start: function(e,ui) {
UI.setActive(this); if (this.isAGroupItem)
UI.setActive(this);
resize.info = new Drag(this, e); resize.info = new Drag(this, e);
}, },
resize: function(e,ui) { resize: function(e,ui) {

View File

@ -135,7 +135,6 @@ _BROWSER_FILES = \
browser_tabview_bug648882.js \ browser_tabview_bug648882.js \
browser_tabview_bug649006.js \ browser_tabview_bug649006.js \
browser_tabview_bug649307.js \ browser_tabview_bug649307.js \
browser_tabview_bug649319.js \
browser_tabview_bug651311.js \ browser_tabview_bug651311.js \
browser_tabview_dragdrop.js \ browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \ browser_tabview_exit_button.js \

View File

@ -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();
});
});
}