Backed out 3 changesets (bug 1415670) for failing chrome test dom/grid/test/chrome/test_grid_implicit.html r=backout on a CLOSED TREE
authorBogdan Tara <btara@mozilla.com>
Mon, 04 Dec 2017 21:58:13 +0200
changeset 394911 715afcd248d8f731e07784eaf065d795b433d41f
parent 394910 2f6d008575ba7dcdcdcf00d9bd6cf5c7e288c0db
child 394912 3aa8186e64ea661f5c79ce1fcb30514584cf966a
push id33025
push usershindli@mozilla.com
push dateTue, 05 Dec 2017 09:57:50 +0000
treeherdermozilla-central@390c1aad9d4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1415670
milestone59.0a1
backs out812aaf31c57798aefc120d93057956eafcd67c2e
ec9fa6d9dca9e3fed927922d92c491c4bbaa1570
92d2a5673bbcc992091437f113acbe30b21e2999
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 3 changesets (bug 1415670) for failing chrome test dom/grid/test/chrome/test_grid_implicit.html r=backout on a CLOSED TREE Backed out changeset 812aaf31c577 (bug 1415670) Backed out changeset ec9fa6d9dca9 (bug 1415670) Backed out changeset 92d2a5673bbc (bug 1415670)
dom/grid/GridLine.cpp
dom/grid/GridLine.h
dom/grid/GridLines.cpp
dom/grid/GridLines.h
dom/grid/test/chrome/test_grid_implicit.html
dom/grid/test/chrome/test_grid_line_numbers.html
dom/grid/test/chrome/test_grid_lines.html
dom/grid/test/chrome/test_grid_repeats.html
dom/webidl/Grid.webidl
--- a/dom/grid/GridLine.cpp
+++ b/dom/grid/GridLine.cpp
@@ -65,32 +65,24 @@ GridLine::Type() const
 }
 
 uint32_t
 GridLine::Number() const
 {
   return mNumber;
 }
 
-int32_t
-GridLine::NegativeNumber() const
-{
-  return mNegativeNumber;
-}
-
 void
 GridLine::SetLineValues(const nsTArray<nsString>& aNames,
                         double aStart,
                         double aBreadth,
                         uint32_t aNumber,
-                        int32_t aNegativeNumber,
                         GridDeclaration aType)
 {
   mNames = aNames;
   mStart = aStart;
   mBreadth = aBreadth;
   mNumber = aNumber;
-  mNegativeNumber = aNegativeNumber;
   mType = aType;
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/grid/GridLine.h
+++ b/dom/grid/GridLine.h
@@ -37,31 +37,28 @@ public:
   {
     return mParent;
   }
 
   double Start() const;
   double Breadth() const;
   GridDeclaration Type() const;
   uint32_t Number() const;
-  int32_t NegativeNumber() const;
 
   void SetLineValues(const nsTArray<nsString>& aNames,
                      double aStart,
                      double aBreadth,
                      uint32_t aNumber,
-                     int32_t aNegativeNumber,
                      GridDeclaration aType);
 
 protected:
   RefPtr<GridLines> mParent;
   nsTArray<nsString> mNames;
   double mStart;
   double mBreadth;
   GridDeclaration mType;
   uint32_t mNumber;
-  int32_t mNegativeNumber;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif /* mozilla_dom_GridLine_h */
--- a/dom/grid/GridLines.cpp
+++ b/dom/grid/GridLines.cpp
@@ -82,31 +82,16 @@ GridLines::SetLineInfo(const ComputedGri
   // than the number of tracks.
   if (trackCount > 0) {
     nscoord lastTrackEdge = 0;
     nscoord startOfNextTrack;
     uint32_t repeatIndex = 0;
     uint32_t numRepeatTracks = aTrackInfo->mRemovedRepeatTracks.Length();
     uint32_t numAddedLines = 0;
 
-    // For the calculation of negative line numbers, we need to know
-    // the total number of leading implicit and explicit tracks.
-    // This might be different from the number of tracks sizes in
-    // aTrackInfo, because some of those tracks may be auto-fits that
-    // have been removed. So the total number of tracks is:
-    // trackCount + (count of mRemovedRepeatTracks elements == true).
-    uint32_t leadingTrackCount = trackCount;
-    if (numRepeatTracks > 0) {
-      for (auto& removedTrack : aTrackInfo->mRemovedRepeatTracks) {
-        if (removedTrack) {
-          ++leadingTrackCount;
-        }
-      }
-    }
-
     for (uint32_t i = aTrackInfo->mStartFragmentTrack;
          i < aTrackInfo->mEndFragmentTrack + 1;
          i++) {
       // Since line indexes are 1-based, calculate a 1-based value
       // for this track to simplify some calculations.
       const uint32_t line1Index = i + 1;
 
       startOfNextTrack = (i < aTrackInfo->mEndFragmentTrack) ?
@@ -147,66 +132,60 @@ GridLines::SetLineInfo(const ComputedGri
       if (i >= (aTrackInfo->mRepeatFirstTrack +
                 aTrackInfo->mNumLeadingImplicitTracks) &&
           repeatIndex < numRepeatTracks) {
         numAddedLines += AppendRemovedAutoFits(aTrackInfo,
                                                aLineInfo,
                                                lastTrackEdge,
                                                repeatIndex,
                                                numRepeatTracks,
-                                               leadingTrackCount,
                                                lineNames);
       }
 
       RefPtr<GridLine> line = new GridLine(this);
       mLines.AppendElement(line);
       MOZ_ASSERT(line1Index > 0, "line1Index must be positive.");
       bool isBeforeFirstExplicit =
         (line1Index <= aTrackInfo->mNumLeadingImplicitTracks);
-      bool isAfterLastExplicit = line1Index > (leadingTrackCount + 1);
       // Calculate an actionable line number for this line, that could be used
       // in a css grid property to align a grid item or area at that line.
       // For implicit lines that appear before line 1, report a number of 0.
       // We can't report negative indexes, because those have a different
       // meaning in the css grid spec (negative indexes are negative-1-based
       // from the end of the grid decreasing towards the front).
       uint32_t lineNumber = isBeforeFirstExplicit ? 0 :
-        (line1Index + numAddedLines - aTrackInfo->mNumLeadingImplicitTracks);
-
-      // The negativeNumber is counted back from the leadingTrackCount.
-      int32_t lineNegativeNumber = isAfterLastExplicit ? 0 :
-        (line1Index + numAddedLines - (leadingTrackCount + 1));
+        (line1Index - aTrackInfo->mNumLeadingImplicitTracks + numAddedLines);
       GridDeclaration lineType =
-        (isBeforeFirstExplicit || isAfterLastExplicit)
+        (isBeforeFirstExplicit ||
+         line1Index > (aTrackInfo->mNumLeadingImplicitTracks +
+                       aTrackInfo->mNumExplicitTracks + 1))
          ? GridDeclaration::Implicit
          : GridDeclaration::Explicit;
       line->SetLineValues(
         lineNames,
         nsPresContext::AppUnitsToDoubleCSSPixels(lastTrackEdge),
         nsPresContext::AppUnitsToDoubleCSSPixels(startOfNextTrack -
                                                  lastTrackEdge),
         lineNumber,
-        lineNegativeNumber,
         lineType
       );
 
       if (i < aTrackInfo->mEndFragmentTrack) {
         lastTrackEdge = aTrackInfo->mPositions[i] + aTrackInfo->mSizes[i];
       }
     }
   }
 }
 
 uint32_t
 GridLines::AppendRemovedAutoFits(const ComputedGridTrackInfo* aTrackInfo,
                                  const ComputedGridLineInfo* aLineInfo,
                                  nscoord aLastTrackEdge,
                                  uint32_t& aRepeatIndex,
                                  uint32_t aNumRepeatTracks,
-                                 uint32_t aNumLeadingTracks,
                                  nsTArray<nsString>& aLineNames)
 {
   // Check to see if lineNames contains ALL of the before line names.
   bool alreadyHasBeforeLineNames = true;
   for (const auto& beforeName : aLineInfo->mNamesBefore) {
     if (!aLineNames.Contains(beforeName)) {
       alreadyHasBeforeLineNames = false;
       break;
@@ -241,39 +220,23 @@ GridLines::AppendRemovedAutoFits(const C
     // If this is the second or later time through, or didn't already
     // have before names, add them.
     if (linesAdded > 0 || !alreadyHasBeforeLineNames) {
       aLineNames.AppendElements(aLineInfo->mNamesBefore);
     }
 
     RefPtr<GridLine> line = new GridLine(this);
     mLines.AppendElement(line);
-
-    // Time to calculate the line numbers. For the positive numbers
-    // we count with a 1-based index from mRepeatFirstTrack. Although
-    // this number is the index of the first repeat track AFTER all
-    // the leading implicit tracks, that's still what we want since
-    // all those leading implicit tracks have line number 0.
     uint32_t lineNumber = aTrackInfo->mRepeatFirstTrack +
                           aRepeatIndex + 1;
-
-    // The negative number does have to account for the leading
-    // implicit tracks. We've been passed aNumLeadingTracks which is
-    // the total of the leading implicit tracks plus the explicit
-    // tracks. So all we have to do is subtract that number from the
-    // 0-based index of this track.
-    int32_t lineNegativeNumber = (aTrackInfo->mNumLeadingImplicitTracks +
-                                  aTrackInfo->mRepeatFirstTrack +
-                                  aRepeatIndex) - aNumLeadingTracks;
     line->SetLineValues(
       aLineNames,
       nsPresContext::AppUnitsToDoubleCSSPixels(aLastTrackEdge),
       nsPresContext::AppUnitsToDoubleCSSPixels(0),
       lineNumber,
-      lineNegativeNumber,
       GridDeclaration::Explicit
     );
 
     // No matter what, the next line should have the after names associated
     // with it. If we go through the loop again, the before names will also
     // be added.
     aLineNames = aLineInfo->mNamesAfter;
     aRepeatIndex++;
--- a/dom/grid/GridLines.h
+++ b/dom/grid/GridLines.h
@@ -45,17 +45,16 @@ public:
                    bool aIsRow);
 
 protected:
   uint32_t AppendRemovedAutoFits(const ComputedGridTrackInfo* aTrackInfo,
                                  const ComputedGridLineInfo* aLineInfo,
                                  nscoord aLastTrackEdge,
                                  uint32_t& aRepeatIndex,
                                  uint32_t aNumRepeatTracks,
-                                 uint32_t aNumLeadingTracks,
                                  nsTArray<nsString>& aLineNames);
 
   RefPtr<GridDimension> mParent;
   nsTArray<RefPtr<GridLine>> mLines;
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/grid/test/chrome/test_grid_implicit.html
+++ b/dom/grid/test/chrome/test_grid_implicit.html
@@ -262,32 +262,21 @@ function runTests() {
       0,
       0,
       1,
       2,
       3,
       4,
       5,
     ];
-    let expectedNegativeNumber = [
-      -7,
-      -6,
-      -5,
-      -4,
-      -3,
-      -2,
-      -1,
-      0,
-    ];
 
     for (let i = 0; i < grid.cols.lines.length; i++) {
       let line = grid.cols.lines[i];
       is(line.type, expectedType[i], "Line index " + i + " has expected type.");
       is(line.number, expectedNumber[i], "Line index " + i + " has expected number.");
-      is(line.negativeNumber, expectedNegativeNumber[i], "Line index " + i + " has expected negative number.");
     }
   }
 
   SimpleTest.finish();
 }
 </script>
 </head>
 <body onLoad="runTests();">
--- a/dom/grid/test/chrome/test_grid_line_numbers.html
+++ b/dom/grid/test/chrome/test_grid_line_numbers.html
@@ -13,110 +13,89 @@ body {
   grid-gap: 0px;
   background-color: #f00;
 }
 .wrapper > div {
   background-color: #444;
   color: #fff;
 }
 .repeatColumns {
-  width: 400px;
+  width: 600px;
   grid-auto-columns: 50px;
   grid-template-columns: repeat(auto-fit, 100px);
 }
 .repeatRows {
-  height: 400px;
+  height: 600px;
   grid-auto-rows: 50px;
   grid-template-rows: repeat(auto-fit, 100px);
 }
 </style>
 
 <script>
 'use strict';
 
 SimpleTest.waitForExplicitFinish();
 
 function testLines(elementName, lines, expectedValues) {
   is(lines.count, expectedValues.count, elementName + " has expected number of lines.");
   for (let i = 0; i < lines.length; i++) {
     is(lines[i].number, expectedValues[i].number, elementName + " line index " + i + " has expected number.");
-    is(lines[i].negativeNumber, expectedValues[i].negativeNumber, elementName + " line index " + i + " has expected negativeNumber.");
   }
 }
 
 function runTests() {
   let grid;
   let lines;
   let expectedValues;
 
   grid = document.getElementById("gridWithColumns").getGridFragments()[0];
   lines = grid.cols.lines;
   expectedValues = [
-    { "number": 0,
-      "negativeNumber": -9 },
-    { "number": 0,
-      "negativeNumber": -8 },
-    { "number": 0,
-      "negativeNumber": -7 },
-    { "number": 0,
-      "negativeNumber": -6 },
-    { "number": 1,
-      "negativeNumber": -5 },
-    { "number": 2,
-      "negativeNumber": -4 },
-    { "number": 3,
-      "negativeNumber": -3 },
-    { "number": 4,
-      "negativeNumber": -2 },
-    { "number": 5,
-      "negativeNumber": -1 },
-    { "number": 6,
-      "negativeNumber": 0 },
+    { "number": 0 },
+    { "number": 0 },
+    { "number": 1 },
+    { "number": 2 },
+    { "number": 3 },
+    { "number": 4 },
+    { "number": 5 },
+    { "number": 6 },
+    { "number": 7 },
+    { "number": 8 },
   ];
   testLines("gridWithColumns", lines, expectedValues);
 
-
   grid = document.getElementById("gridWithRows").getGridFragments()[0];
   lines = grid.rows.lines;
   expectedValues = [
-    { "number": 0,
-      "negativeNumber": -9 },
-    { "number": 0,
-      "negativeNumber": -8 },
-    { "number": 0,
-      "negativeNumber": -7 },
-    { "number": 0,
-      "negativeNumber": -6 },
-    { "number": 1,
-      "negativeNumber": -5 },
-    { "number": 2,
-      "negativeNumber": -4 },
-    { "number": 3,
-      "negativeNumber": -3 },
-    { "number": 4,
-      "negativeNumber": -2 },
-    { "number": 5,
-      "negativeNumber": -1 },
-    { "number": 6,
-      "negativeNumber": 0 },
+    { "number": 0 },
+    { "number": 0 },
+    { "number": 1 },
+    { "number": 2 },
+    { "number": 3 },
+    { "number": 4 },
+    { "number": 5 },
+    { "number": 6 },
+    { "number": 7 },
+    { "number": 8 },
   ];
   testLines("gridWithRows", lines, expectedValues);
 
   SimpleTest.finish();
 }
 </script>
 </head>
 <body onLoad="runTests();">
 
 <div id="gridWithColumns" class="wrapper repeatColumns">
 <div style="grid-column: -9">A</div>
-<div style="grid-column: 2">B</div>
-<div style="grid-column: 5">C</div>
+<div style="grid-column: 4">B</div>
+<div style="grid-column: 7">C</div>
 </div>
 
 <div id="gridWithRows" class="wrapper repeatRows">
-<div style="grid-row: span 4 / 1">A</div>
-<div style="grid-row: 3">B</div>
-<div style="grid-row: 4 / span 2">C</div>
+<div style="grid-row: span 3 / 2">A</div>
+<div style="grid-row: 4">B</div>
+<div style="grid-row: 5">C</div>
+<div style="grid-row: span 2 / 8">D</div>
 </div>
 
 </body>
 </html>
--- a/dom/grid/test/chrome/test_grid_lines.html
+++ b/dom/grid/test/chrome/test_grid_lines.html
@@ -42,19 +42,18 @@ function runTests() {
 
     if (grid.cols.lines.length == 5) {
       // test column line position
       is(grid.cols.lines[1].start, 50, "Grid column line 2 position is as expected.");
 
       // test column line width
       is(grid.cols.lines[1].breadth, 10, "Grid column line 2 width is as expected.");
 
-      // test column line numbers, positive and negative
-      is(grid.cols.lines[3].number, 4, "Grid column line 4 positive number is as expected.");
-      is(grid.cols.lines[3].negativeNumber, -2, "Grid column line 4 negative number is as expected.");
+      // test column line number
+      is(grid.cols.lines[3].number, 4, "Grid column line 4 number is as expected.");
 
       // test column line names
       is(grid.cols.lines[0].names.length, 0, "Grid column line 1 has no names.");
 
       is(grid.cols.lines[1].names.length, 2, "Grid column line 2 has 2 names.");
       isnot(grid.cols.lines[1].names.indexOf("first"), -1,
         "Grid column line 2 has the name 'first'."
       );
--- a/dom/grid/test/chrome/test_grid_repeats.html
+++ b/dom/grid/test/chrome/test_grid_repeats.html
@@ -7,17 +7,16 @@
 <style>
 body {
   margin: 40px;
 }
 .wrapper {
   display: grid;
   width: 600px;
   grid-gap: 0px;
-  grid-auto-column: 50px;
   background-color: #f00;
 }
 .grid1 {
   grid-template-columns: 50px 0px repeat(auto-fit, 100px);
 }
 .grid2 {
   grid-template-columns: 50px 0px [real-before] repeat(auto-fit, [before] 100px [after]) [real-after] 0px [final];
 }
@@ -40,20 +39,16 @@ body {
   grid-template-columns: [real-before] repeat(auto-fit, [before] 1000px [after]) [real-after];
 }
 .grid9 {
   grid-template-columns: [real-before] repeat(auto-fit, 100px [after]) [real-after];
 }
 .grid10 {
   grid-template-columns: [real-before] repeat(auto-fit, [before] 100px) [real-after];
 }
-.grid11 {
-  grid-template-columns: repeat(auto-fit, 100px);
-}
-
 .box {
   background-color: #444;
   color: #fff;
 }
 .a {
   grid-column: auto;
 }
 .b {
@@ -63,78 +58,47 @@ body {
   grid-column: 6;
 }
 .d {
   grid-column: 7;
 }
 .e {
   grid-column: 5;
 }
-.f {
-  grid-column: -9;
-}
 
 </style>
 
 <script>
 'use strict';
 
 SimpleTest.waitForExplicitFinish();
 
 function testLines(elementName, grid, expectedValues) {
   for (let i = 0; i < grid.cols.lines.length; i++) {
-    // 'number' is optional.
-    if (typeof(expectedValues[i].number) != "undefined") {
-      is(grid.cols.lines[i].number, expectedValues[i].number, elementName + " line " + (i + 1) + " has expected number.");
-    } else {
-      // If 'number' is omitted, assume that first line is line 1 and increase from there.
-      is(grid.cols.lines[i].number, (i + 1), elementName + " line " + (i + 1) + " has expected number.");
-    }
-
-    // 'negativeNumber' is optional.
-    if (typeof(expectedValues[i].negativeNumber) != "undefined") {
-      // Check for the supplied number.
-      is(grid.cols.lines[i].negativeNumber, expectedValues[i].negativeNumber, elementName + " line " + (i + 1) + " has expected negativeNumber.");
-    }
-
-    // 'start' is optional.
-    if (typeof(expectedValues[i].start) != "undefined") {
-      is(grid.cols.lines[i].start, expectedValues[i].start, elementName + " line " + (i + 1) + " has expected start.");
-    }
-
-    // 'breadth' is optional.
-    if (typeof(expectedValues[i].breadth) != "undefined") {
-      is(grid.cols.lines[i].breadth, 0, elementName + " line " + (i + 1) + " has zero breadth.");
-    }
-
-    // 'names' is optional.
-    if (typeof(expectedValues[i].names) != "undefined") {
-      is(grid.cols.lines[i].names + "", expectedValues[i].names, elementName + " line " + (i + 1) + " has expected names.");
-    }
+    is(grid.cols.lines[i].number, (i + 1), elementName + " line " + (i + 1) + " has expected number.");
+    is(grid.cols.lines[i].start, expectedValues[i].start, elementName + " line " + (i + 1) + " has expected start.");
+    is(grid.cols.lines[i].breadth, 0, elementName + " line " + (i + 1) + " has zero breadth.");
+    is(grid.cols.lines[i].names + "", expectedValues[i].names, elementName + " line " + (i + 1) + " has expected names.");
   }
 }
 
 function runTests() {
-  let wrapper;
-  let grid;
-  let expectedValues;
-
-  wrapper = document.getElementById("wrapper1");
-  grid = wrapper.getGridFragments()[0];
+  let wrapper = document.getElementById("wrapper1");
+  let grid = wrapper.getGridFragments()[0];
 
   // test auto-fit count
   is(grid.cols.tracks.length, 7, "Grid column track array reports removed auto-fit columns.");
 
   // test resolved value of grid-template-columns
   let templateColumnsText = getComputedStyle(wrapper).gridTemplateColumns;
   is(templateColumnsText, "50px 0px 0px 100px 0px 0px 0px",
     "Resolved value of grid-template-columns reports removed auto-fits as '0px'.");
 
   // test starts, breadths, and states
-  expectedValues = [
+  let expectedValues = [
     { "start": 0,
       "breadth": 50,
       "state": "static" },
     { "start": 50,
       "breadth": 0,
       "state": "static" },
     { "start": 50,
       "breadth": 0,
@@ -327,45 +291,16 @@ function runTests() {
       "names": "before" },
     { "start": 200,
       "names": "before" },
     { "start": 200,
       "names": "real-after" },
   ];
   testLines("wrapper10", grid, expectedValues);
 
-
-  wrapper = document.getElementById("wrapper11");
-  grid = wrapper.getGridFragments()[0];
-
-  // test line numbers and negativeNumbers
-  expectedValues = [
-    { "number": 0,
-      "negativeNumber": -9 },
-    { "number": 0,
-      "negativeNumber": -8 },
-    { "number": 1,
-      "negativeNumber": -7 },
-    { "number": 2,
-      "negativeNumber": -6 },
-    { "number": 3,
-      "negativeNumber": -5 },
-    { "number": 4,
-      "negativeNumber": -4 },
-    { "number": 5,
-      "negativeNumber": -3 },
-    { "number": 6,
-      "negativeNumber": -2 },
-    { "number": 7,
-      "negativeNumber": -1 },
-    { "number": 8,
-      "negativeNumber": 0 },
-  ];
-  testLines("wrapper11", grid, expectedValues);
-
   SimpleTest.finish();
 }
 </script>
 </head>
 <body onLoad="runTests();">
 
   <div id="wrapper1" class="wrapper grid1">
     <div id="boxB" class="box b">B</div>
@@ -414,17 +349,10 @@ function runTests() {
   </div>
 
   <br/>
   <div id="wrapper10" class="wrapper grid10">
     <div id="boxB" class="box b">B</div>
     <div id="boxE" class="box e">E</div>
   </div>
 
-  <br/>
-  <div id="wrapper11" class="wrapper grid11">
-    <div id="boxF" class="box f">F</div>
-    <div id="boxB" class="box b">B</div>
-    <div id="boxD" class="box d">D</div>
-  </div>
-
 </body>
 </html>
--- a/dom/webidl/Grid.webidl
+++ b/dom/webidl/Grid.webidl
@@ -66,33 +66,19 @@ interface GridLine
    * properties.
    * https://drafts.csswg.org/css-grid/#gutters
    */
   readonly attribute double breadth;
 
   readonly attribute GridDeclaration type;
 
   /**
-   * Number is the 1-indexed index of the line in flow order. The
-   * first explicit line has number 1, and numbers increment by 1 for
-   * each line after that. Lines before the first explicit line
-   * have number 0, which is not a valid addressable line number, and
-   * should be filtered out by callers.
+   * Number is the 1-indexed index of the line in flow order.
    */
   readonly attribute unsigned long number;
-
-  /**
-   * NegativeNumber is the 1-indexed index of the line in reverse
-   * flow order. The last explicit line has negativeNumber -1, and
-   * negativeNumbers decrement by 1 for each line before that.
-   * Lines after the last explicit line have negativeNumber 0, which
-   * is not a valid addressable line number, and should be filtered
-   * out by callers.
-   */
-  readonly attribute long negativeNumber;
 };
 
 [ChromeOnly]
 interface GridTracks
 {
   readonly attribute unsigned long length;
 
   /**