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
Родитель 34406ffbc0
Коммит a6c100fd3c
4 изменённых файлов: 64 добавлений и 0 удалений

Просмотреть файл

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

Просмотреть файл

@ -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 \

Просмотреть файл

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

Просмотреть файл

@ -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