Bug 629665 - [regression] Tab bar covers full screen [r=mfinkle]

This commit is contained in:
Vivien Nicolas 2011-02-07 13:56:11 +01:00
parent 9c9f3550cd
commit 8964798c55
4 changed files with 66 additions and 7 deletions

View File

@ -440,6 +440,7 @@ var BrowserUI = {
Elements.tabs.addEventListener("TabSelect", this, true);
Elements.tabs.addEventListener("TabOpen", this, true);
Elements.tabs.addEventListener("TabRemove", this, true);
Elements.browsers.addEventListener("PanFinished", this, true);
#if MOZ_PLATFORM_MAEMO == 6
@ -843,9 +844,10 @@ var BrowserUI = {
this._tabSelect(aEvent);
break;
case "TabOpen":
case "TabRemove":
{
// Workaround to hide the tabstrip if it is partially visible
// See bug 524469
// See bug 524469 and bug 626660
let [tabsVisibility,,,] = Browser.computeSidebarVisibility();
if (tabsVisibility > 0.0 && tabsVisibility < 1.0)
Browser.hideSidebars();
@ -853,9 +855,18 @@ var BrowserUI = {
break;
}
case "PanFinished":
let [tabsVisibility,,,] = Browser.computeSidebarVisibility();
if (tabsVisibility == 0.0)
document.getElementById("tabs").removeClosedTab();
let tabs = document.getElementById("tabs");
let [tabsVisibility,,oldLeftWidth, oldRightWidth] = Browser.computeSidebarVisibility();
if (tabsVisibility == 0.0 && tabs.hasClosedTab) {
let { x: x1, y: y1 } = Browser.getScrollboxPosition(Browser.controlsScrollboxScroller);
tabs.removeClosedTab();
let [,, leftWidth, rightWidth] = Browser.computeSidebarVisibility();
let delta = (oldLeftWidth - leftWidth) || (oldRightWidth - rightWidth);
x1 += (x1 == leftWidth) ? delta : -delta;
Browser.controlsScrollboxScroller.scrollTo(x1, 0);
Browser.tryFloatToolbar(0, 0);
}
break;
case "SizeChanged":
this.sizeControls(ViewableAreaObserver.width, ViewableAreaObserver.height);

View File

@ -737,10 +737,15 @@ var Browser = {
tab.chromeTab.dispatchEvent(event);
tab.browser.messageManager.sendAsyncMessage("Browser:TabClose");
let container = tab.chromeTab.parentNode;
tab.destroy();
this._tabs.splice(tabIndex, 1);
this.selectedTab = nextTab;
event = document.createEvent("Events");
event.initEvent("TabRemove", true, false);
container.dispatchEvent(event);
},
get selectedTab() {

View File

@ -108,9 +108,11 @@
<implementation>
<field name="children">document.getAnonymousElementByAttribute(this, "anonid", "tabs-children");</field>
<field name="_tabsUndo">document.getAnonymousElementByAttribute(this, "anonid", "tabs-undo");</field>
<field name="_closedTab">null</field>
<field name="_selectedTab">null</field>
<field name="_closedTab">null</field>
<property name="hasClosedTab" readonly="true" onget="return !!this._closedTab;"/>
<property name="selectedTab" onget="return this._selectedTab;">
<setter>
<![CDATA[
@ -189,8 +191,8 @@
let element = this.children.getBoundingClientRect();
let undo = this._tabsUndo.getBoundingClientRect();
let lastChild = this.parentNode.lastChild.getBoundingClientRect();
let height = window.innerHeight - element.top - (undo.bottom - undo.top) - (lastChild.top - element.bottom) - lastChild.height;
let height = window.innerHeight - element.top - (lastChild.top - element.bottom) - lastChild.height;
this.children.style.height = height + "px";
this._updateWidth();

View File

@ -155,6 +155,47 @@ gTests.push({
},
checkLeftVisible: function() {
Browser.controlsScrollboxScroller.scrollTo(0, 0);
checkSidebars(1, 0);
checkOnResize(gCurrentTest.checkRightVisible);
},
checkRightVisible: function() {
let [,, leftWidth, rightWidth] = Browser.computeSidebarVisibility();
Browser.controlsScrollboxScroller.scrollTo(leftWidth + rightWidth, 0);
checkSidebars(0, 1);
checkOnResize(gCurrentTest.onFinish);
},
onFinish: function() {
Browser.hideSidebars();
BrowserUI.activePanel = null;
runNextTest();
}
});
gTests.push({
desc: "Testing horizontal positionning of the sidebars for multiple columns with an undo tab",
run: function() {
let tabs = document.getElementById("tabs");
ok(tabs._columnsCount > 1, "Tabs layout should be on multiple columns");
Elements.tabs.addEventListener("TabRemove", function() {
Elements.tabs.removeEventListener("TabRemove", arguments.callee, false);
setTimeout(gCurrentTest.onTabClose, 0);
}, false);
let lastTab = newTabs.pop().chromeTab;
lastTab._onClose();
},
onTabClose: function() {
checkSidebars(0, 0);
checkOnResize(gCurrentTest.checkLeftVisible);
},
checkLeftVisible: function() {
Browser.controlsScrollboxScroller.scrollTo(0, 0);
checkSidebars(1, 0);