Bug 798020: Reduce severity of fatal assert about unconstrained-width flexbox, since gigantic widths in web content can reach our "unconstrained" sentinel value, and it's not actually dangerous. r=dbaron
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 16 Oct 2012 19:04:23 -0700
changeset 110631 e03f63abb826e42f90a43a5166dcdd961a83d79c
parent 110630 9343aa86ae7ebde5a865fa3da0ab22f5d7047e82
child 110632 5c67076a5a05e625fa4f56845fbfce9b5159e5c2
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersdbaron
bugs798020
milestone19.0a1
Bug 798020: Reduce severity of fatal assert about unconstrained-width flexbox, since gigantic widths in web content can reach our "unconstrained" sentinel value, and it's not actually dangerous. r=dbaron
layout/generic/crashtests/798020-1.html
layout/generic/crashtests/crashtests.list
layout/generic/nsFlexContainerFrame.cpp
new file mode 100644
--- /dev/null
+++ b/layout/generic/crashtests/798020-1.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<html>
+<body style="letter-spacing: 693626589697em;"><div style="display: inline-flex;">data</div></body>
+</html>
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -388,8 +388,9 @@ load 700031.xhtml
 load 718516.html
 load first-letter-638937.html
 load first-letter-638937-2.html
 test-pref(layout.css.flexbox.enabled,true) load 737313-1.html
 test-pref(layout.css.flexbox.enabled,true) load 737313-2.html
 test-pref(layout.css.flexbox.enabled,true) load 737313-3.html
 load 762764-1.html
 load 786740-1.html
+asserts(8) test-pref(layout.css.flexbox.enabled,true) load 798020-1.html
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -1785,19 +1785,19 @@ nsFlexContainerFrame::ComputeFlexContain
   // If we've got a finite computed main-size, use that.
   nscoord mainSize =
     aAxisTracker.GetMainComponent(nsSize(aReflowState.ComputedWidth(),
                                          aReflowState.ComputedHeight()));
   if (mainSize != NS_UNCONSTRAINEDSIZE) {
     return mainSize;
   }
 
-  MOZ_ASSERT(!IsAxisHorizontal(aAxisTracker.GetMainAxis()),
-             "Computed width should always be constrained, so horizontal "
-             "flex containers should always have a constrained main-size");
+  NS_WARN_IF_FALSE(!IsAxisHorizontal(aAxisTracker.GetMainAxis()),
+                   "Computed width should always be constrained, so horizontal "
+                   "flex containers should have a constrained main-size");
 
   // Otherwise, use the sum of our items' hypothetical main sizes, clamped
   // to our computed min/max main-size properties.
   mainSize = 0;
   for (uint32_t i = 0; i < aItems.Length(); ++i) {
     mainSize +=
       aItems[i].GetMainSize() +
       aItems[i].GetMarginBorderPaddingSizeInAxis(aAxisTracker.GetMainAxis());