зеркало из https://github.com/mozilla/gecko-dev.git
Bug 597980 - Switching into and out of Panorama mode quickly can cause the wrong tab to be selected on return [r=ian, a=dolske]
This commit is contained in:
Родитель
6527677dac
Коммит
f151b834ce
|
@ -64,7 +64,6 @@
|
|||
// bounds - a <Rect>; otherwise based on the locations of the provided elements
|
||||
// container - a DOM element to use as the container for this groupItem; otherwise will create
|
||||
// title - the title for the groupItem; otherwise blank
|
||||
// dontPush - true if this groupItem shouldn't push away on creation; default is false
|
||||
// dontPush - true if this groupItem shouldn't push away or snap on creation; default is false
|
||||
// immediately - true if we want all placement immediately, not with animation
|
||||
function GroupItem(listOfEls, options) {
|
||||
|
@ -690,7 +689,6 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
GroupItems.setActiveGroupItem(closestTabItem.parent);
|
||||
} else {
|
||||
GroupItems.setActiveOrphanTab(closestTabItem);
|
||||
GroupItems.setActiveGroupItem(null);
|
||||
}
|
||||
} else {
|
||||
GroupItems.setActiveGroupItem(null);
|
||||
|
@ -1425,7 +1423,6 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
};
|
||||
}
|
||||
|
||||
GroupItems.setActiveGroupItem(self);
|
||||
return { shouldZoom: true };
|
||||
},
|
||||
|
||||
|
@ -2277,6 +2274,8 @@ let GroupItems = {
|
|||
// Paramaters:
|
||||
// groupItem - the active <TabItem> or <null>
|
||||
setActiveOrphanTab: function GroupItems_setActiveOrphanTab(tabItem) {
|
||||
if (tabItem !== null)
|
||||
this.setActiveGroupItem(null);
|
||||
this._activeOrphanTab = tabItem;
|
||||
},
|
||||
|
||||
|
@ -2305,11 +2304,11 @@ let GroupItems = {
|
|||
Utils.assertThrow(tabItem && tabItem.isATabItem, "tabItem must be a TabItem");
|
||||
|
||||
let groupItem = tabItem.parent;
|
||||
this.setActiveGroupItem(groupItem);
|
||||
|
||||
if (groupItem)
|
||||
if (groupItem) {
|
||||
this.setActiveGroupItem(groupItem);
|
||||
groupItem.setActiveTab(tabItem);
|
||||
else
|
||||
} else
|
||||
this.setActiveOrphanTab(tabItem);
|
||||
|
||||
this._updateTabBar();
|
||||
|
|
|
@ -617,8 +617,13 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
var self = this;
|
||||
var $tabEl = this.$container, $canvas = this.$canvas;
|
||||
var childHitResult = { shouldZoom: true };
|
||||
if (this.parent)
|
||||
UI.setActiveTab(this);
|
||||
if (this.parent) {
|
||||
childHitResult = this.parent.childHit(this);
|
||||
GroupItems.setActiveGroupItem(this.parent);
|
||||
} else {
|
||||
GroupItems.setActiveOrphanTab(this);
|
||||
}
|
||||
|
||||
this.shouldHideCachedData = true;
|
||||
TabItems._update(this.tab);
|
||||
|
|
|
@ -71,6 +71,7 @@ _BROWSER_FILES = \
|
|||
browser_tabview_bug597248.js \
|
||||
browser_tabview_bug597360.js \
|
||||
browser_tabview_bug597399.js \
|
||||
browser_tabview_bug597980.js \
|
||||
browser_tabview_bug598600.js \
|
||||
browser_tabview_bug599626.js \
|
||||
browser_tabview_bug600645.js \
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
newWindowWithTabView(onTabViewShown);
|
||||
}
|
||||
|
||||
function onTabViewShown(win) {
|
||||
let contentWindow = win.document.getElementById("tab-view").contentWindow;
|
||||
is(contentWindow.GroupItems.groupItems.length, 1, "Has only one group");
|
||||
|
||||
let originalTab = win.gBrowser.selectedTab;
|
||||
let originalGroup = contentWindow.GroupItems.groupItems[0];
|
||||
let newTab = win.gBrowser.loadOneTab("about:blank", {inBackground: true});
|
||||
|
||||
is(originalGroup.getChildren().length, 2, "The original group now has two tabs");
|
||||
|
||||
// create group two with the new tab
|
||||
let box = new contentWindow.Rect(300,300,150,150);
|
||||
let newGroup = new contentWindow.GroupItem([], {bounds: box, immediately: true});
|
||||
newGroup.add(newTab._tabViewTabItem, {immediately: true});
|
||||
|
||||
// ensure active group item and tab
|
||||
contentWindow.GroupItems.setActiveGroupItem(originalGroup);
|
||||
is(contentWindow.GroupItems.getActiveGroupItem(), originalGroup,
|
||||
"The original group is active");
|
||||
is(contentWindow.UI.getActiveTab(), originalTab._tabViewTabItem,
|
||||
"The original tab is active");
|
||||
|
||||
function checkActive(callback, time) {
|
||||
is(contentWindow.GroupItems.getActiveGroupItem(), newGroup,
|
||||
"The new group is active");
|
||||
is(contentWindow.UI.getActiveTab(), newTab._tabViewTabItem,
|
||||
"The new tab is active");
|
||||
if (time)
|
||||
setTimeout(callback, time);
|
||||
else
|
||||
callback();
|
||||
}
|
||||
|
||||
// click on the new tab, and check that the new tab and group are active
|
||||
// at two times: 10 ms after (still during the animation) and
|
||||
// 500 ms after (after the animation, hopefully). Either way, the new
|
||||
// tab and group should be active.
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
newTab._tabViewTabItem.container, contentWindow);
|
||||
EventUtils.sendMouseEvent({ type: "mouseup" },
|
||||
newTab._tabViewTabItem.container, contentWindow);
|
||||
setTimeout(function() {
|
||||
checkActive(function() {
|
||||
checkActive(function() {
|
||||
win.close();
|
||||
finish();
|
||||
});
|
||||
}, 490);
|
||||
}, 10)
|
||||
}
|
Загрузка…
Ссылка в новой задаче