Bug 1416350 Part 2: Correct logic for Grid API line numbering with leading implicit tracks. draft
authorBrad Werth <bwerth@mozilla.com>
Fri, 10 Nov 2017 09:46:22 -0800
changeset 704785 257eb0a7c540295535c72059f77f314e34b1533e
parent 704784 3761c05aecb41490c58db151a3e36df152bfb3c0
child 704786 3a0978c89c294765d78d313e6727fe85e0459e93
push id91240
push userbwerth@mozilla.com
push dateTue, 28 Nov 2017 23:44:52 +0000
bugs1416350
milestone59.0a1
Bug 1416350 Part 2: Correct logic for Grid API line numbering with leading implicit tracks. MozReview-Commit-ID: 4tiwdqhb5hb
dom/grid/GridLines.cpp
--- 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
     );