Bug 589800 - Checkerboards are persistent on zoom of about:firstrun [r=mbrubeck]
authorVivien Nicolas <21@vingtetun.org>
Tue, 24 Aug 2010 19:13:00 +0200
changeset 66482 e00dc89e95c966d161eeba98fb43997ad04e2e95
parent 66481 94d2203a73c758146875947ef958c170e0db7f41
child 66483 87b0bb5d1ade67a7704d3ae4a215d813c8c82996
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
bugs589800
Bug 589800 - Checkerboards are persistent on zoom of about:firstrun [r=mbrubeck]
mobile/chrome/content/AnimatedZoom.js
--- a/mobile/chrome/content/AnimatedZoom.js
+++ b/mobile/chrome/content/AnimatedZoom.js
@@ -74,17 +74,16 @@ function AnimatedZoom(aBrowserView) {
 
   let remote = !this.bv.getBrowser().contentWindow;
   if (remote) {
     this.canvasReady = false;
     this.snapshot.addEventListener("MozAsyncCanvasRender", this, false);
     this.snapshot.pending_render = true;
   } else {
     this.canvasReady = true;
-    this.startAnimation();
   }
 }
 
 AnimatedZoom.prototype.handleEvent = function(aEvent) {
   if (aEvent.type == "MozAsyncCanvasRender") {
     let snapshot = aEvent.originalTarget;
     snapshot.pending_render = false;
     snapshot.removeEventListener("MozAsyncCanvasRender", this, false);
@@ -103,18 +102,17 @@ AnimatedZoom.createCanvas = function(aRe
     canvas.width = Math.max(window.innerWidth, window.innerHeight) * 2;
     canvas.height = Math.max(window.innerWidth, window.innerHeight) * 2;
     canvas.mozOpaque = true;
     this._canvas = canvas;
   }
   return this._canvas;
 };
 
-AnimatedZoom.prototype.startAnimation = function()
-{
+AnimatedZoom.prototype.startAnimation = function() {
   // stop live rendering during zooming
   this.bv.pauseRendering();
 
   // hide ui elements to avoid undefined states after zoom
   Browser.hideTitlebar();
   Browser.hideSidebars();
 
   let clientVis = Browser.browserViewToClientRect(this.bv.getCriticalRect());
@@ -125,22 +123,22 @@ AnimatedZoom.prototype.startAnimation = 
   viewBuffer.height = this.zoomFrom.height;
   viewBuffer.style.display = "block";
 
   // configure defaults for the canvas' drawing context
   let ctx = viewBuffer.getContext("2d");
 
   // disable smoothing and use the fastest composition operation
   ctx.mozImageSmoothingEnabled = false;
-  ctx.globalCompositeOperation = 'copy';
+  ctx.globalCompositeOperation = "copy";
 
   // set background fill pattern
   let backgroundImage = new Image();
   backgroundImage.src = "chrome://browser/content/checkerboard.png";
-  ctx.fillStyle = ctx.createPattern(backgroundImage, 'repeat');
+  ctx.fillStyle = ctx.createPattern(backgroundImage, "repeat");
 
   if (this.zoomTo) {
     this.updateTo(this.zoomFrom);
 
     // start animation timer
     this.counter = 0;
     this.inc = 1.0 / Services.prefs.getIntPref("browser.ui.zoom.animationDuration");
     this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
@@ -250,11 +248,12 @@ AnimatedZoom.prototype.finish = function
       Browser.setVisibleRect(this.zoomRect);
   }
   finally {
     if (this.timer) {
       this.timer.cancel();
       this.timer = null;
     }
     this.snapshot = null;
+    this.zoomTo = null;
   }
 };