Bug 587223 - fix exception in AnimatedZoom.js while zooming out [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Fri, 13 Aug 2010 19:49:36 -0700
changeset 66441 d5a1eae38759f457f1bdc0e8f41907965d7f1859
parent 66440 5ba7a3d59319ae7848c55c485c96c9105e6bb829
child 66442 3d135a627fa4fd02700d45207868de9004cbb91f
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)
reviewersmfinkle
bugs587223
Bug 587223 - fix exception in AnimatedZoom.js while zooming out [r=mfinkle]
mobile/chrome/content/AnimatedZoom.js
--- a/mobile/chrome/content/AnimatedZoom.js
+++ b/mobile/chrome/content/AnimatedZoom.js
@@ -58,16 +58,19 @@ function AnimatedZoom(aBrowserView) {
 
   // try to cover twice the size of the current visible rect
   this.snapshotRect = this.bv.getVisibleRect().inflate(2);
 
   // sanitize the snapshot rectangle to fit inside viewport
   this.snapshotRect.translateInside(viewportRect).restrictTo(viewportRect).expandToIntegers();
 
   this.snapshot = AnimatedZoom.createCanvas();
+  this.snapshotRect.width = Math.min(this.snapshotRect.width, this.snapshot.width);
+  this.snapshotRect.height = Math.min(this.snapshotRect.height, this.snapshot.height);
+
   let snapshotCtx = this.snapshot.MozGetIPCContext("2d")
   snapshotCtx.clearRect(0, 0, this.snapshotRect.width, this.snapshotRect.height);
   this.bv.renderToCanvas(this.snapshot, this.snapshotRect.width, this.snapshotRect.height, this.snapshotRect.clone());
 
   let remote = !this.bv.getBrowser().contentWindow;
   if (remote) {
     this.canvasReady = false;
     this.snapshot.addEventListener("MozAsyncCanvasRender", this, false);