Bug 1223568: Don't let fallback alignment values break flexbox special-case for "justify-content: stretch". r=mats
authorDaniel Holbert <dholbert@cs.stanford.edu>
Wed, 11 Nov 2015 14:42:21 -0800
changeset 272155 93f6fc8cc5d062b41e6e1d64330f84d435f47034
parent 272154 c5780f2a10e8de3171e12f080d99f62a0c6ca1a5
child 272156 c1935f0c639b3c52a0046d1eab7888fbda65325a
push id67893
push userdholbert@mozilla.com
push dateWed, 11 Nov 2015 22:42:47 +0000
treeherdermozilla-inbound@93f6fc8cc5d0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1223568
milestone45.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 1223568: Don't let fallback alignment values break flexbox special-case for "justify-content: stretch". r=mats
layout/generic/crashtests/1223568-1.html
layout/generic/crashtests/1223568-2.html
layout/generic/crashtests/crashtests.list
layout/style/nsStyleStruct.cpp
new file mode 100644
--- /dev/null
+++ b/layout/generic/crashtests/1223568-1.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<div style="display:flex; justify-content: stretch end">a
new file mode 100644
--- /dev/null
+++ b/layout/generic/crashtests/1223568-2.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+<span style="justify-content: stretch end true; display: inline-flex;"><span style="writing-mode: vertical-rl; display: -moz-inline-box;">f</span></span>
+</body>
+</html>
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -584,16 +584,18 @@ pref(layout.css.grid.enabled,true) load 
 load 1157011.html
 load 1169420-1.html
 load 1169420-2.html
 load 1183431.html
 load 1221112-1.html
 load 1221112-2.html
 load 1221874-1.html
 load 1222783.xhtml
+load 1223568-1.html
+load 1223568-2.html
 load first-letter-638937-1.html
 load first-letter-638937-2.html
 pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) asserts(1-100) load font-inflation-762332.html # bug 762332
 load outline-on-frameset.xhtml
 load text-overflow-bug666751-1.html
 load text-overflow-bug666751-2.html
 load text-overflow-bug670564.xhtml
 load text-overflow-bug671796.xhtml
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -1737,19 +1737,23 @@ nsStylePosition::ComputedAlignSelf(const
 }
 
 uint16_t
 nsStylePosition::ComputedJustifyContent(const nsStyleDisplay* aDisplay) const
 {
   switch (aDisplay->mDisplay) {
     case NS_STYLE_DISPLAY_FLEX:
     case NS_STYLE_DISPLAY_INLINE_FLEX:
+      // For flex containers, css-align-3 says the justify-content value
+      // "'stretch' computes to 'flex-start'."
+      // https://drafts.csswg.org/css-align-3/#propdef-justify-content
       // XXX maybe map 'auto' too? (ISSUE 8 in the spec)
       // https://drafts.csswg.org/css-align-3/#content-distribution
-      if (mJustifyContent == NS_STYLE_JUSTIFY_STRETCH) {
+      if ((mJustifyContent & NS_STYLE_ALIGN_ALL_BITS) ==
+          NS_STYLE_JUSTIFY_STRETCH) {
         return NS_STYLE_JUSTIFY_FLEX_START;
       }
       break;
   }
   uint8_t val = mJustifyContent & NS_STYLE_JUSTIFY_ALL_BITS;
   val = MapLeftRightToStart(val, eLogicalAxisInline, aDisplay);
   uint8_t fallback = mJustifyContent >> NS_STYLE_JUSTIFY_ALL_SHIFT;
   fallback = MapLeftRightToStart(fallback, eLogicalAxisInline, aDisplay);