Bug 1296912 - Fix the CSS grid highlighter size when zooming in and out by limiting the devicePixelRatio to 2 decimal places r=pbro
authorGabriel Luong <gabriel.luong@gmail.com>
Mon, 22 Aug 2016 14:57:27 -0400
changeset 336328 cba664ef3a3ea8702508239b463fc8014bbb228b
parent 336327 74f16e8aed180aaf153827a6e5eedfb818c0cb11
child 336329 873e1bd0833abf954ac0e0fab6c43b1ce5380e1c
push id10033
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:50:26 +0000
treeherdermozilla-aurora@5dddbefdf759 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro
bugs1296912
milestone51.0a1
Bug 1296912 - Fix the CSS grid highlighter size when zooming in and out by limiting the devicePixelRatio to 2 decimal places r=pbro
devtools/server/actors/highlighters/css-grid.js
--- a/devtools/server/actors/highlighters/css-grid.js
+++ b/devtools/server/actors/highlighters/css-grid.js
@@ -138,17 +138,17 @@ CssGridHighlighter.prototype = extend(Au
 
     this._showGrid();
 
     setIgnoreLayoutChanges(false, this.currentNode.ownerDocument.documentElement);
     return true;
   },
 
   clearCanvas() {
-    let ratio = this.win.devicePixelRatio || 1;
+    let ratio = parseFloat((this.win.devicePixelRatio || 1).toFixed(2));
     let width = this.win.innerWidth;
     let height = this.win.innerHeight;
 
     // Resize the canvas taking the dpr into account so as to have crisp lines.
     this.canvas.setAttribute("width", width * ratio);
     this.canvas.setAttribute("height", height * ratio);
     this.canvas.setAttribute("style", `width:${width}px;height:${height}px`);
     this.ctx.scale(ratio, ratio);