Bug 1387511 - Part 1: Use the grid negative number platform API to render negative line numbers correctly in css grid inspector. r=pbro draft
authorGabriel Luong <gabriel.luong@gmail.com>
Tue, 14 Nov 2017 00:57:34 -0500
changeset 697499 bd657dd656d4aac96d010c3240440998766e213f
parent 697498 44b0797a5899a0cfe1db6b478836a2c076457bcc
child 697500 b4133c9f6ac355c57f593aa4d43e469cfe667160
push id89026
push userbmo:gl@mozilla.com
push dateTue, 14 Nov 2017 05:58:59 +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 MozReview-Commit-ID: 8IVN2fYZiJS
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;