Bug 1600367 - Check that the available space is constrained before setting Incomplete status. r=TYLin
authorMats Palmgren <mats@mozilla.com>
Mon, 02 Dec 2019 16:43:06 +0000
changeset 504888 e7e3f263eeb388a20fffa8fb5017e0d5a86e31d1
parent 504887 1ea6d897b8681285278db919dee4ab476c7b6247
child 504889 af6b936aa160b9a173069b91794d86f2d8397a8f
push id102022
push usermpalmgren@mozilla.com
push dateMon, 02 Dec 2019 16:46:19 +0000
treeherderautoland@e7e3f263eeb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersTYLin
bugs1600367
milestone72.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 1600367 - Check that the available space is constrained before setting Incomplete status. r=TYLin The testcase doesn't have a fragmentainer at all so we should never set Incomplete status in this case. I added an assertion that would have caught this. I also made the baseline methods deal with a null inner frame for good measure. Differential Revision: https://phabricator.services.mozilla.com/D55389
layout/forms/crashtests/1600367.html
layout/forms/crashtests/crashtests.list
layout/forms/nsFieldSetFrame.cpp
new file mode 100644
--- /dev/null
+++ b/layout/forms/crashtests/1600367.html
@@ -0,0 +1,8 @@
+<style>
+FIELDSET {
+  border: 35482ex groove ! important;
+  all: unset;
+}
+</style>
+<i style="font-size-adjust: 113;" readonly>
+<fieldset>
--- a/layout/forms/crashtests/crashtests.list
+++ b/layout/forms/crashtests/crashtests.list
@@ -68,8 +68,9 @@ load 1388230-1.html
 load 1388230-2.html
 load 1405830.html
 load 1418477.html
 load 1432853.html
 asserts(1-4) load 1460787-1.html
 load 1464165-1.html
 load 1471157.html
 load 1488219.html
+load 1600367.html
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -735,16 +735,17 @@ void nsFieldSetFrame::Reflow(nsPresConte
             ? aReflowInput.ApplyMinMaxBSize(0)
             : aReflowInput.ComputedBSize();
     finalSize.BSize(wm) =
         contentBoxBSize +
         aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm);
   }
 
   if (aStatus.IsComplete() &&
+      aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE &&
       finalSize.BSize(wm) > aReflowInput.AvailableBSize() &&
       border.BEnd(wm) > 0 && aReflowInput.AvailableBSize() > border.BEnd(wm)) {
     // Our end border doesn't fit but it should fit in the next column/page.
     if (MOZ_UNLIKELY(avoidBreakInside)) {
       aDesiredSize.SetSize(wm, LogicalSize(wm));
       aStatus.SetInlineLineBreakBeforeAndReset();
       return;
     } else {
@@ -752,16 +753,18 @@ void nsFieldSetFrame::Reflow(nsPresConte
           StyleBoxDecorationBreak::Slice) {
         finalSize.BSize(wm) -= border.BEnd(wm);
       }
       aStatus.SetIncomplete();
     }
   }
 
   if (!aStatus.IsComplete()) {
+    MOZ_ASSERT(aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE,
+               "must be Complete in an unconstrained available block-size");
     // Stretch our BSize to fill the fragmentainer.
     finalSize.BSize(wm) =
         std::max(finalSize.BSize(wm), aReflowInput.AvailableBSize());
   }
   aDesiredSize.SetSize(wm, finalSize);
   aDesiredSize.SetOverflowAreasToDesiredBounds();
 
   if (legend) {
@@ -825,16 +828,19 @@ nscoord nsFieldSetFrame::GetLogicalBasel
 bool nsFieldSetFrame::GetVerticalAlignBaseline(WritingMode aWM,
                                                nscoord* aBaseline) const {
   if (StyleDisplay()->IsContainLayout()) {
     // If we are layout-contained, our child 'inner' should not
     // affect how we calculate our baseline.
     return false;
   }
   nsIFrame* inner = GetInner();
+  if (MOZ_UNLIKELY(!inner)) {
+    return false;
+  }
   MOZ_ASSERT(!inner->GetWritingMode().IsOrthogonalTo(aWM));
   if (!inner->GetVerticalAlignBaseline(aWM, aBaseline)) {
     return false;
   }
   nscoord innerBStart = inner->BStart(aWM, GetSize());
   *aBaseline += innerBStart;
   return true;
 }
@@ -843,16 +849,19 @@ bool nsFieldSetFrame::GetNaturalBaseline
     WritingMode aWM, BaselineSharingGroup aBaselineGroup,
     nscoord* aBaseline) const {
   if (StyleDisplay()->IsContainLayout()) {
     // If we are layout-contained, our child 'inner' should not
     // affect how we calculate our baseline.
     return false;
   }
   nsIFrame* inner = GetInner();
+  if (MOZ_UNLIKELY(!inner)) {
+    return false;
+  }
   MOZ_ASSERT(!inner->GetWritingMode().IsOrthogonalTo(aWM));
   if (!inner->GetNaturalBaselineBOffset(aWM, aBaselineGroup, aBaseline)) {
     return false;
   }
   nscoord innerBStart = inner->BStart(aWM, GetSize());
   if (aBaselineGroup == BaselineSharingGroup::First) {
     *aBaseline += innerBStart;
   } else {