From 8961afc7138d7b51ae79d1416699c76ed072a9eb Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Fri, 22 Aug 2008 23:25:17 -0400 Subject: [PATCH] b=451676, r=gavin. Remember the URLBar position when switching tabs --- mobile/chrome/content/browser-ui.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mobile/chrome/content/browser-ui.js b/mobile/chrome/content/browser-ui.js index 48822a3807d..83291049156 100644 --- a/mobile/chrome/content/browser-ui.js +++ b/mobile/chrome/content/browser-ui.js @@ -92,6 +92,20 @@ var BrowserUI = { this.setURI(); this._titleChanged(browser.contentDocument); this._favicon.setAttribute("src", browser.mIconURL || kDefaultFavIconURL); + + let toolbar = document.getElementById("toolbar-main"); + let browserBox = document.getElementById("browser"); + if (Browser.content.currentTab.chromeTop) { + // Browser box was panned, so let's reset it + browserBox.top = Browser.content.currentTab.chromeTop; + toolbar.top = browserBox.top - toolbar.boxObject.height; + } + else { + // Must be initial conditions + toolbar.top = 0; + browserBox.top = toolbar.boxObject.height; + } + this.show(PANELMODE_NONE); }, @@ -196,6 +210,9 @@ var BrowserUI = { toolbar.top = newTop; browser.top = newTop + toolbar.boxObject.height; + // Cache the current top so we can use it when switching tabs + Browser.content.currentTab.chromeTop = browser.top; + aEvent.stopPropagation(); } }