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)
This commit is contained in:
Bogdan Tara 2017-12-04 21:58:13 +02:00
Родитель ff8de48862
Коммит 09195ba0cc
9 изменённых файлов: 42 добавлений и 210 удалений

Просмотреть файл

@ -70,25 +70,17 @@ 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;
}

Просмотреть файл

@ -42,13 +42,11 @@ public:
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:
@ -58,7 +56,6 @@ protected:
double mBreadth;
GridDeclaration mType;
uint32_t mNumber;
int32_t mNegativeNumber;
};
} // namespace dom

Просмотреть файл

@ -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<nsString>& aLineNames)
{
// Check to see if lineNames contains ALL of the before line names.
@ -246,29 +225,13 @@ GridLines::AppendRemovedAutoFits(const ComputedGridTrackInfo* aTrackInfo,
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
);

Просмотреть файл

@ -50,7 +50,6 @@ protected:
nscoord aLastTrackEdge,
uint32_t& aRepeatIndex,
uint32_t aNumRepeatTracks,
uint32_t aNumLeadingTracks,
nsTArray<nsString>& aLineNames);
RefPtr<GridDimension> mParent;

Просмотреть файл

@ -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.");
}
}

Просмотреть файл

@ -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() {
<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>

Просмотреть файл

@ -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.");

Просмотреть файл

@ -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;
}
</style>
@ -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();
}
</script>
@ -419,12 +354,5 @@ function runTests() {
<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>

Просмотреть файл

@ -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]