Bug 589800 - Checkerboards are persistent on zoom of about:firstrun [r=mbrubeck]
--- 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;
}
};