Bug 1416350 Part 2: Correct logic for Grid API line numbering with leading implicit tracks.
MozReview-Commit-ID: 4tiwdqhb5hb
--- a/dom/grid/GridLines.cpp
+++ b/dom/grid/GridLines.cpp
@@ -124,17 +124,18 @@ GridLines::SetLineInfo(const ComputedGri
}
}
if (haveNameToAdd && !lineNames.Contains(nameToAdd)) {
lineNames.AppendElement(nameToAdd);
}
}
- if (i >= aTrackInfo->mRepeatFirstTrack &&
+ if (i >= (aTrackInfo->mRepeatFirstTrack +
+ aTrackInfo->mNumLeadingImplicitTracks) &&
repeatIndex < numRepeatTracks) {
numAddedLines += AppendRemovedAutoFits(aTrackInfo,
aLineInfo,
lastTrackEdge,
repeatIndex,
numRepeatTracks,
lineNames);
}
@@ -219,21 +220,18 @@ 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);
- MOZ_ASSERT(aTrackInfo->mRepeatFirstTrack >=
- aTrackInfo->mNumLeadingImplicitTracks,
- "We shouldn't have a repeat track within the implicit tracks.");
- uint32_t lineNumber = aTrackInfo->mRepeatFirstTrack -
- aTrackInfo->mNumLeadingImplicitTracks + aRepeatIndex + 1;
+ uint32_t lineNumber = aTrackInfo->mRepeatFirstTrack +
+ aRepeatIndex + 1;
line->SetLineValues(
aLineNames,
nsPresContext::AppUnitsToDoubleCSSPixels(aLastTrackEdge),
nsPresContext::AppUnitsToDoubleCSSPixels(0),
lineNumber,
GridDeclaration::Explicit
);