Bug 627500 - Clicking on a link that has window.scrollTo(0, 1000) will clear the content of that frame [r=wjohnston]
authorMark Finkle <mfinkle@mozilla.com>
Wed, 26 Jan 2011 08:37:18 -0500
changeset 67309 78b41312ef10686b78430fdefa3d4d2a156faba6
parent 67308 5bf4f772990ee2c9737b2a0c4de4c52f02f2cdc0
child 67310 d9dc2c751e49468781e125924b2550253370b261
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)
reviewerswjohnston
bugs627500
Bug 627500 - Clicking on a link that has window.scrollTo(0, 1000) will clear the content of that frame [r=wjohnston]
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -1176,25 +1176,16 @@ Browser.MainDragger.prototype = {
     let bcr = browser.getBoundingClientRect();
     this._contentView = browser.getViewAt(clientX - bcr.left, clientY - bcr.top);
   },
 
   dragStop: function dragStop(dx, dy, scroller) {
     this._contentView = null;
     this.dragMove(Browser.snapSidebars(), 0, scroller);
     Browser.tryUnfloatToolbar();
-
-    if (dx == 0 && dy == 0)
-      return;
-
-    // Update the scroll position of the content
-    let browser = getBrowser();
-    browser._updateCSSViewport();
-    let view = browser.getRootView();
-    view._updateCacheViewport();
   },
 
   dragMove: function dragMove(dx, dy, scroller) {
     let doffset = new Point(dx, dy);
 
     // First calculate any panning to take sidebars out of view
     let panOffset = this._panControlsAwayOffset(doffset);
 
@@ -1232,20 +1223,26 @@ Browser.MainDragger.prototype = {
         const SCROLL_CORNER_SIZE = 8;
         this._scrollScales = {
           x: (width + ALLOWED_MARGIN) < contentWidth ? (width - SCROLL_CORNER_SIZE) / contentWidth : 0,
           y: (height + ALLOWED_MARGIN) < contentHeight ? (height - SCROLL_CORNER_SIZE) / contentHeight : 0
         }
         this._showScrollbars();
         break;
       }
-      case "PanFinished":
+      case "PanFinished": {
         this._hideScrollbars();
+
+        // Update the scroll position of the content
+        let browser = getBrowser();
+        browser._updateCSSViewport();
+        let view = browser.getRootView();
+        view._updateCacheViewport();
         break;
-
+      }
       case "SizeChanged":
         let height = Elements.contentNavigator.getBoundingClientRect().height;
         this._horizontalScrollbar.setAttribute("bottom", 2 + height);
         break;
     }
   },
 
   /** Return offset that pans controls away from screen. Updates doffset with leftovers. */