Bug 605668 - Page offset to the left after two-Finger page-up/down gesture on a zoomed-in right side of the page [r=mbrubeck]
authorMark Finkle <mfinkle@mozilla.com>
Thu, 04 Nov 2010 23:04:56 -0400
changeset 66964 3f017cd50ab4ba780a1552d89b4efd00f6dcb9a2
parent 66963 c51635273c93402b0c99c604a0b810004c5b98b3
child 66965 064cf5869210e3eb5011731e7ff85b35e91af6ab
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs605668
Bug 605668 - Page offset to the left after two-Finger page-up/down gesture on a zoomed-in right side of the page [r=mbrubeck]
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -471,24 +471,34 @@ var Browser = {
 
     return url;
   },
 
   get browsers() {
     return this._tabs.map(function(tab) { return tab.browser; });
   },
 
-  scrollContentToTop: function scrollContentToTop() {
-    this.contentScrollboxScroller.scrollTo(0, 0);
+  scrollContentToTop: function scrollContentToTop(aOptions) {
+    let x = {}, y = {};
+    this.contentScrollboxScroller.getPosition(x, y);
+    if (aOptions)
+      x.value = ("x" in aOptions ? aOptions.x : x.value);
+
+    this.contentScrollboxScroller.scrollTo(x.value, 0);
     this.pageScrollboxScroller.scrollTo(0, 0);
   },
   
   // cmd_scrollBottom does not work in Fennec (Bug 590535).
-  scrollContentToBottom: function scrollContentToBottom() {
-    this.contentScrollboxScroller.scrollTo(0, Number.MAX_VALUE);
+  scrollContentToBottom: function scrollContentToBottom(aOptions) {
+    let x = {}, y = {};
+    this.contentScrollboxScroller.getPosition(x, y);
+    if (aOptions)
+      x.value = ("x" in aOptions ? aOptions.x : x.value);
+
+    this.contentScrollboxScroller.scrollTo(x.value, Number.MAX_VALUE);
     this.pageScrollboxScroller.scrollTo(0, Number.MAX_VALUE);
   },
 
   hideSidebars: function scrollSidebarsOffscreen() {
     let rect = Elements.browsers.getBoundingClientRect();
     this.controlsScrollboxScroller.scrollBy(Math.round(rect.left), 0);
   },
 
@@ -2313,17 +2323,17 @@ ProgressController.prototype = {
       this.browser.lastLocation = location;
       Browser.removeTransientNotificationsForTab(this._tab);
       this._tab.resetZoomLevel();
 
       if (this._tab == Browser.selectedTab) {
         // We're about to have new page content, so scroll the content area
         // to the top so the new paints will draw correctly.
         // (background tabs are delayed scrolled to top in _documentStop)
-        Browser.scrollContentToTop();
+        Browser.scrollContentToTop({ x: 0 });
       }
     }
   },
 
   /**
    * This method is called to indicate a status changes for the currently
    * loading page.  The message is already formatted for display.
    */