Bug 1237754 part 1 - [css-grid][css-align] Make 'align/justify-content:normal' behave as 'stretch' for Grid containers. r=dholbert
authorMats Palmgren <mats@mozilla.com>
Sun, 17 Jan 2016 19:44:05 +0100
changeset 281912 f49d6b3581ed5aca2fefd4abfd3776af7eaafab1
parent 281911 283da1a207eefa41bd45c8a6a37973f18d53f0c6
child 281913 e555b1530ebbbf9b79c982590b094613e823116c
push id70966
push usermpalmgren@mozilla.com
push dateWed, 27 Jan 2016 16:02:27 +0000
treeherdermozilla-inbound@be1d458a17b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1237754
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1237754 part 1 - [css-grid][css-align] Make 'align/justify-content:normal' behave as 'stretch' for Grid containers. r=dholbert Change due to CSSWG decision: https://lists.w3.org/Archives/Public/www-style/2016Jan/0031.html Later clarified that the decision also applies to justify-content here: https://lists.w3.org/Archives/Public/www-style/2016Jan/0130.html
layout/generic/nsGridContainerFrame.cpp
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -2931,25 +2931,27 @@ nsGridContainerFrame::Tracks::AlignJusti
   const LogicalSize&     aContainerSize)
 {
   if (mSizes.IsEmpty()) {
     return;
   }
 
   const bool isAlign = mAxis == eLogicalAxisBlock;
   auto stylePos = aReflowState.mStylePosition;
-  const auto valueAndFallback = isAlign ?
-    stylePos->ComputedAlignContent() :
-    stylePos->ComputedJustifyContent();
+  auto valueAndFallback = isAlign ? stylePos->ComputedAlignContent() :
+                                    stylePos->ComputedJustifyContent();
   WritingMode wm = aReflowState.GetWritingMode();
   bool overflowSafe;
   auto alignment = ::GetAlignJustifyValue(valueAndFallback, wm, isAlign,
                                           &overflowSafe);
   if (alignment == NS_STYLE_ALIGN_NORMAL) {
-    alignment = NS_STYLE_ALIGN_START;
+    MOZ_ASSERT(valueAndFallback == NS_STYLE_ALIGN_NORMAL,
+               "*-content:normal cannot be specified with explicit fallback");
+    alignment = NS_STYLE_ALIGN_STRETCH;
+    valueAndFallback = alignment; // we may need a fallback for 'stretch' below
   }
 
   // Compute the free space and count auto-sized tracks.
   size_t numAutoTracks = 0;
   nscoord space;
   if (alignment != NS_STYLE_ALIGN_START) {
     nscoord trackSizeSum = 0;
     for (const TrackSize& sz : mSizes) {