Bug 638164 - Checkerboarding after zooming in, visiting other page, then going back in history [r=mbrubeck,wesj, a=blocking-fennec]
authorMark Finkle <mark.finkle>
Thu, 17 Mar 2011 09:49:00 -0700
changeset 2919 4244c84027679b353f120d2586b59f69ec66da27
parent 2918 f8f616b259ff161731ca21a9910d8a2554598068
child 2920 a73d7944abef7e18dd027e38203ae6dcd184dd8a
push id2463
push usermbrubeck@mozilla.com
push dateThu, 17 Mar 2011 18:39:58 +0000
reviewersmbrubeck, wesj, blocking-fennec
bugs638164
Bug 638164 - Checkerboarding after zooming in, visiting other page, then going back in history [r=mbrubeck,wesj, a=blocking-fennec]
chrome/content/bindings/browser.js
--- a/chrome/content/bindings/browser.js
+++ b/chrome/content/bindings/browser.js
@@ -288,16 +288,17 @@ DOMEvents.init();
 let ContentScroll =  {
   _scrollOffset: { x: 0, y: 0 },
 
   init: function() {
     addMessageListener("Content:SetCacheViewport", this);
     addMessageListener("Content:SetWindowSize", this);
 
     addEventListener("scroll", this, false);
+    addEventListener("pagehide", this, false);
     addEventListener("MozScrolledAreaChanged", this, false);
   },
 
   getScrollOffset: function(aWindow) {
     let cwu = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
     let scrollX = {}, scrollY = {};
     cwu.getScrollXY(false, scrollX, scrollY);
     return { x: scrollX.value, y: scrollY.value };
@@ -377,16 +378,20 @@ let ContentScroll =  {
         cwu.setCSSViewport(json.width, json.height);
         break;
       }
     }
   },
 
   handleEvent: function(aEvent) {
     switch (aEvent.type) {
+      case "pagehide":
+        this._scrollOffset = { x: 0, y: 0 };
+        break;
+
       case "scroll": {
         let doc = aEvent.target;
         if (doc != content.document)
           break;
 
         this.sendScroll();
         break;
       }