Bug 1314664 part 1 - [css-grid] Don't include percentage tracks in the back-computed intrinsic size equation. r=dholbert a=jcristau
authorMats Palmgren <mats@mozilla.com>
Tue, 20 Dec 2016 23:56:34 +0100
changeset 353156 346b243ed5dbec61471e110096e1ea13a58f06df
parent 353155 28b0bf479ac00e1a5444ccff74bcd8b5737ce35f
child 353157 2cae3655368c3bf1ef5d792f25cdc6a6af432b2a
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert, jcristau
bugs1314664
milestone52.0a2
Bug 1314664 part 1 - [css-grid] Don't include percentage tracks in the back-computed intrinsic size equation. r=dholbert a=jcristau
layout/generic/nsGridContainerFrame.cpp
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -4953,41 +4953,31 @@ nsGridContainerFrame::Tracks::AlignJusti
 }
 
 nscoord
 nsGridContainerFrame::Tracks::BackComputedIntrinsicSize(
   const TrackSizingFunctions& aFunctions,
   const nsStyleCoord& aGridGap) const
 {
   // Sum up the current sizes (where percentage tracks were treated as 'auto')
-  // in 'size' and a sum of percentages in 'percent'.
+  // in 'size'.
   nscoord size = 0;
-  float percent = 0.0f;
-  bool hasPercent = mStateUnion & TrackSize::eIndefinitePercentMinSizing;
   for (size_t i = 0, len = mSizes.Length(); i < len; ++i) {
-    const nscoord trackSize = mSizes[i].mBase;
-    nscoord length;
-    float p;
-    if (hasPercent &&
-        ::GetPercentSizeParts(aFunctions.MinSizingFor(i), &length, &p)) {
-      size += std::max(length, trackSize);
-      percent += p;
-    } else {
-      size += trackSize;
-    }
-  }
-
-  // Add grid-gap contributions to 'size' and 'percent'.
+    size += mSizes[i].mBase;
+  }
+
+  // Add grid-gap contributions to 'size' and calculate a 'percent' sum.
+  float percent = 0.0f;
   size_t numTracks = mSizes.Length();
   if (numTracks > 1) {
     const size_t gridGapCount = numTracks - 1;
     nscoord gridGapLength;
     float gridGapPercent;
     if (::GetPercentSizeParts(aGridGap, &gridGapLength, &gridGapPercent)) {
-      percent += gridGapCount * gridGapPercent;
+      percent = gridGapCount * gridGapPercent;
     } else {
       gridGapLength = aGridGap.ToLength();
     }
     size += gridGapCount * gridGapLength;
   }
 
   return std::max(0, nsLayoutUtils::AddPercents(size, percent));
 }