From 06279d648ffafcd2e74b095e2faab6c581fd2803 Mon Sep 17 00:00:00 2001 From: Benjamin Stover Date: Fri, 17 Sep 2010 15:54:38 -0700 Subject: [PATCH] Bug 595403 - Can't scroll up after orientation change or resize [r=mbrubeck] --- mobile/chrome/content/bindings/browser.xml | 2 ++ mobile/chrome/content/browser.js | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mobile/chrome/content/bindings/browser.xml b/mobile/chrome/content/bindings/browser.xml index 4b59667f53d8..0d56eb533360 100644 --- a/mobile/chrome/content/bindings/browser.xml +++ b/mobile/chrome/content/bindings/browser.xml @@ -149,6 +149,8 @@ case "MozScrolledAreaChanged": this._contentDocumentWidth = aMessage.json.width; this._contentDocumentHeight = aMessage.json.height; + // Recalculate whether the visible area is actually in bounds + this.scrollBy(0, 0); this._updateCacheViewport(); break; } diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index 14c95cbb15e5..95439f6d6023 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -249,6 +249,14 @@ var Browser = { for (let i = Browser.tabs.length - 1; i >= 0; i--) Browser.tabs[i].updateViewportSize(); + // XXX page scrollbox jumps to a strange value on resize. Scrolling it will + // bound it to a sane place, but not where we were when the resize began :( + Browser.hideTitlebar(); + + // XXX Hack. Browser also behaves badly on resize. + getBrowser().style.display = "none"; + getBrowser().style.display = "block"; + let curEl = document.activeElement; if (curEl && curEl.scrollIntoView) curEl.scrollIntoView(false); @@ -1084,7 +1092,7 @@ Browser.MainDragger.prototype = { if (doffset.x > 0 && rect.left > 0) x = Math.min(doffset.x, rect.left); - let height = document.getElementById("tile-stack").getBoundingClientRect().height; + let height = document.getElementById("content-viewport").getBoundingClientRect().height; rect = Rect.fromRect(Browser.contentScrollbox.getBoundingClientRect()).map(Math.round); if (doffset.y < 0 && rect.bottom < height) y = Math.max(doffset.y, rect.bottom - height);