From 09195ba0ccd0332093205f2e925035a06893c663 Mon Sep 17 00:00:00 2001 From: Bogdan Tara Date: Mon, 4 Dec 2017 21:58:13 +0200 Subject: [PATCH] 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 | 8 -- dom/grid/GridLine.h | 3 - dom/grid/GridLines.cpp | 45 +--------- dom/grid/GridLines.h | 1 - dom/grid/test/chrome/test_grid_implicit.html | 11 --- .../test/chrome/test_grid_line_numbers.html | 77 ++++++----------- dom/grid/test/chrome/test_grid_lines.html | 5 +- dom/grid/test/chrome/test_grid_repeats.html | 86 ++----------------- dom/webidl/Grid.webidl | 16 +--- 9 files changed, 42 insertions(+), 210 deletions(-) diff --git a/dom/grid/GridLine.cpp b/dom/grid/GridLine.cpp index 70c249c7e6f2..8e1e5ed7ced8 100644 --- a/dom/grid/GridLine.cpp +++ b/dom/grid/GridLine.cpp @@ -70,25 +70,17 @@ GridLine::Number() const return mNumber; } -int32_t -GridLine::NegativeNumber() const -{ - return mNegativeNumber; -} - void GridLine::SetLineValues(const nsTArray& 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; } diff --git a/dom/grid/GridLine.h b/dom/grid/GridLine.h index fe0054932f90..858f9d5e0322 100644 --- a/dom/grid/GridLine.h +++ b/dom/grid/GridLine.h @@ -42,13 +42,11 @@ public: double Breadth() const; GridDeclaration Type() const; uint32_t Number() const; - int32_t NegativeNumber() const; void SetLineValues(const nsTArray& aNames, double aStart, double aBreadth, uint32_t aNumber, - int32_t aNegativeNumber, GridDeclaration aType); protected: @@ -58,7 +56,6 @@ protected: double mBreadth; GridDeclaration mType; uint32_t mNumber; - int32_t mNegativeNumber; }; } // namespace dom diff --git a/dom/grid/GridLines.cpp b/dom/grid/GridLines.cpp index 7c29ec24e179..898885346449 100644 --- a/dom/grid/GridLines.cpp +++ b/dom/grid/GridLines.cpp @@ -87,21 +87,6 @@ GridLines::SetLineInfo(const ComputedGridTrackInfo* aTrackInfo, 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++) { @@ -152,7 +137,6 @@ GridLines::SetLineInfo(const ComputedGridTrackInfo* aTrackInfo, lastTrackEdge, repeatIndex, numRepeatTracks, - leadingTrackCount, lineNames); } @@ -161,7 +145,6 @@ GridLines::SetLineInfo(const ComputedGridTrackInfo* aTrackInfo, 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. @@ -169,13 +152,11 @@ GridLines::SetLineInfo(const ComputedGridTrackInfo* aTrackInfo, // 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( @@ -184,7 +165,6 @@ GridLines::SetLineInfo(const ComputedGridTrackInfo* aTrackInfo, nsPresContext::AppUnitsToDoubleCSSPixels(startOfNextTrack - lastTrackEdge), lineNumber, - lineNegativeNumber, lineType ); @@ -201,7 +181,6 @@ GridLines::AppendRemovedAutoFits(const ComputedGridTrackInfo* aTrackInfo, nscoord aLastTrackEdge, uint32_t& aRepeatIndex, uint32_t aNumRepeatTracks, - uint32_t aNumLeadingTracks, nsTArray& aLineNames) { // Check to see if lineNames contains ALL of the before line names. @@ -246,29 +225,13 @@ GridLines::AppendRemovedAutoFits(const ComputedGridTrackInfo* aTrackInfo, RefPtr 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 ); diff --git a/dom/grid/GridLines.h b/dom/grid/GridLines.h index 9b6cf45c9a49..921168204057 100644 --- a/dom/grid/GridLines.h +++ b/dom/grid/GridLines.h @@ -50,7 +50,6 @@ protected: nscoord aLastTrackEdge, uint32_t& aRepeatIndex, uint32_t aNumRepeatTracks, - uint32_t aNumLeadingTracks, nsTArray& aLineNames); RefPtr mParent; diff --git a/dom/grid/test/chrome/test_grid_implicit.html b/dom/grid/test/chrome/test_grid_implicit.html index 1907617b666f..8baa6ee3af4d 100644 --- a/dom/grid/test/chrome/test_grid_implicit.html +++ b/dom/grid/test/chrome/test_grid_implicit.html @@ -267,22 +267,11 @@ function runTests() { 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."); } } diff --git a/dom/grid/test/chrome/test_grid_line_numbers.html b/dom/grid/test/chrome/test_grid_line_numbers.html index 719b5ad68679..c8e5226b6056 100644 --- a/dom/grid/test/chrome/test_grid_line_numbers.html +++ b/dom/grid/test/chrome/test_grid_line_numbers.html @@ -18,12 +18,12 @@ body { 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); } @@ -38,7 +38,6 @@ 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."); } } @@ -50,53 +49,32 @@ function runTests() { 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); @@ -108,14 +86,15 @@ function runTests() {
A
-
B
-
C
+
B
+
C
-
A
-
B
-
C
+
A
+
B
+
C
+
D
diff --git a/dom/grid/test/chrome/test_grid_lines.html b/dom/grid/test/chrome/test_grid_lines.html index 766350bcda78..53c1fcb0a1f9 100644 --- a/dom/grid/test/chrome/test_grid_lines.html +++ b/dom/grid/test/chrome/test_grid_lines.html @@ -47,9 +47,8 @@ function runTests() { // 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."); diff --git a/dom/grid/test/chrome/test_grid_repeats.html b/dom/grid/test/chrome/test_grid_repeats.html index aa8795071b32..7b27a835eabf 100644 --- a/dom/grid/test/chrome/test_grid_repeats.html +++ b/dom/grid/test/chrome/test_grid_repeats.html @@ -12,7 +12,6 @@ body { display: grid; width: 600px; grid-gap: 0px; - grid-auto-column: 50px; background-color: #f00; } .grid1 { @@ -45,10 +44,6 @@ body { .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; @@ -68,9 +63,6 @@ body { .e { grid-column: 5; } -.f { - grid-column: -9; -} @@ -81,44 +73,16 @@ 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."); @@ -129,7 +93,7 @@ function runTests() { "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" }, @@ -332,35 +296,6 @@ function runTests() { ]; 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(); } @@ -419,12 +354,5 @@ function runTests() {
E
-
-
-
F
-
B
-
D
-
- diff --git a/dom/webidl/Grid.webidl b/dom/webidl/Grid.webidl index 0b5dbf23991d..b10de93832db 100644 --- a/dom/webidl/Grid.webidl +++ b/dom/webidl/Grid.webidl @@ -71,23 +71,9 @@ interface GridLine 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]