Bug 690973 - Opening a new tab in portrait does not open the awesomescreen [r=wesj]

This commit is contained in:
Matt Brubeck 2011-09-30 17:25:29 -07:00
parent ac70357349
commit f40512756b

View File

@ -41,6 +41,9 @@ var TabsPopup = {
Elements.tabs.addEventListener("TabRemove", this, true);
this._updateTabsCount();
// Bind resizeHandler so we can pass it to addEventListener/removeEventListener.
this.resizeHandler = this.resizeHandler.bind(this);
},
get box() {
@ -117,12 +120,7 @@ var TabsPopup = {
this.box.anchorTo(this.button, "after_end");
BrowserUI.pushPopup(this, [this.box, this.button]);
window.addEventListener("resize", function resizeHandler(aEvent) {
if (aEvent.target != window)
return;
if (!Util.isPortrait())
TabsPopup._hidePortraitMenu();
}, false);
window.addEventListener("resize", this.resizeHandler, false);
},
toggle: function toggle() {
@ -140,7 +138,7 @@ var TabsPopup = {
if (!this.box.hidden) {
this.box.hidden = true;
BrowserUI.popPopup(this);
window.removeEventListener("resize", resizeHandler, false);
window.removeEventListener("resize", this.resizeHandler, false);
}
},
@ -172,6 +170,13 @@ var TabsPopup = {
cmd.setAttribute("label", Browser.tabs.length);
},
resizeHandler: function resizeHandler(aEvent) {
if (aEvent.target != window)
return;
if (!Util.isPortrait())
this._hidePortraitMenu();
},
handleEvent: function handleEvent(aEvent) {
this._updateTabsCount();
}