Bug 1387511 - Part 1: Use the grid negative number platform API to render negative line numbers correctly in css grid inspector. r=pbro
authorGabriel Luong <gabriel.luong@gmail.com>
Tue, 14 Nov 2017 22:02:44 -0500
changeset 436291 b0780ac4a74e0416263db9496c2057b6126ced41
parent 436290 f79a12dc2c55be9111ae7bd6689e85d64c0e4979
child 436292 46a0be972d5ae92da4a6dacb21f6e6ff119eb970
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewerspbro
bugs1387511
milestone59.0a1
Bug 1387511 - Part 1: Use the grid negative number platform API to render negative line numbers correctly in css grid inspector. 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
@@ -856,17 +856,22 @@ class CssGridHighlighter extends AutoRef
 
     // Keep track of the number of collapsed lines per line position
     let stackedLines = [];
 
     const { lines } = gridDimension;
 
     for (let i = 0, line; (line = lines[i++]);) {
       let linePos = line.start;
-      let negativeLineNumber = i - lines.length - 1;
+      let negativeLineNumber = line.negativeNumber;
+
+      // Don't render any negative line number greater than -1.
+      if (negativeLineNumber == 0) {
+        break;
+      }
 
       // Check for overlapping lines. We render a second box beneath the last overlapping
       // line number to indicate there are lines beneath it.
       const gridLine = gridDimension.tracks[line.number - 1];
 
       if (gridLine) {
         const { breadth }  = gridLine;