Bug 696602 - Active tab not shown in tab strip on return from Panorama r=tim

This commit is contained in:
Raymond Lee 2011-12-03 00:31:12 +08:00
parent 2b6e549e62
commit fb7140e519
4 changed files with 64 additions and 0 deletions

View File

@ -1963,6 +1963,8 @@
else
this.showTab(tab);
}, this);
this.tabContainer.mTabstrip.ensureElementIsVisible(this.selectedTab, false);
]]>
</body>
</method>

View File

@ -164,6 +164,7 @@ _BROWSER_FILES = \
browser_tabview_bug685476.js \
browser_tabview_bug685692.js \
browser_tabview_bug686654.js \
browser_tabview_bug696602.js \
browser_tabview_bug697390.js \
browser_tabview_bug705621.js \
browser_tabview_bug706430.js \

View File

@ -0,0 +1,51 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let win;
function test() {
waitForExplicitFinish();
newWindowWithTabView(function(newWin) {
win = newWin;
registerCleanupFunction(function() {
win.close();
});
let cw = win.TabView.getContentWindow();
let groupItemOne = cw.GroupItems.groupItems[0];
let groupItemTwo = createGroupItemWithBlankTabs(win, 300, 300, 20, 10);
is(win.gBrowser.tabContainer.getAttribute("overflow"), "true",
"The tabstrip is overflow");
is(groupItemOne.getChildren().length, 10, "Group one has 10 tabs");
is(groupItemTwo.getChildren().length, 10, "Group two has 10 tabs");
checkSelectedTabVisible("two", function() {
showTabView(function() {
checkSelectedTabVisible("one", finish);
groupItemOne.getChild(9).zoomIn();
}, win);
});
groupItemTwo.getChild(9).zoomIn();
}, function(newWin) {
for (let i = 0; i < 9; i++)
newWin.gBrowser.addTab();
});
}
function isSelectedTabVisible() {
let tabstrip = win.gBrowser.tabContainer.mTabstrip;
let scrollRect = tabstrip.scrollClientRect;
let tab = win.gBrowser.selectedTab.getBoundingClientRect();
return (scrollRect.left <= tab.left && tab.right <= scrollRect.right);
}
function checkSelectedTabVisible(groupName, callback) {
whenTabViewIsHidden(function() {
ok(isSelectedTabVisible(), "Group " + groupName + " selected tab is visible");
callback();
}, win);
}

View File

@ -152,6 +152,10 @@ let UI = {
// Used to keep track of the last opened tab.
_lastOpenedTab: null,
// Variable: _originalSmoothScroll
// Used to keep track of the tab strip smooth scroll value.
_originalSmoothScroll: null,
// ----------
// Function: toString
// Prints [UI] for debug use
@ -514,6 +518,11 @@ let UI = {
this._isChangingVisibility = true;
// store tab strip smooth scroll value and disable it.
let tabStrip = gBrowser.tabContainer.mTabstrip;
this._originalSmoothScroll = tabStrip.smoothScroll;
tabStrip.smoothScroll = false;
// initialize the direction of the page
this._initPageDirection();
@ -609,6 +618,7 @@ let UI = {
gBrowser.selectedBrowser.focus();
gBrowser.updateTitlebar();
gBrowser.tabContainer.mTabstrip.smoothScroll = this._originalSmoothScroll;
#ifdef XP_MACOSX
this.setTitlebarColors(false);
#endif