Bug 1689912 - Reset aState.mHasRenderedLegend for the entire ConstructFieldSetFrame. r=emilio
authorMats Palmgren <mats@mozilla.com>
Mon, 01 Feb 2021 14:59:17 +0000
changeset 3480214 2d9969ccca29c2f0828b7d86c871fa6e9de13bf0
parent 3480213 210d77edc40e8a3b3da3c45f258325e180273881
child 3480215 c5d0c46c6bc2a43a6bc9e45f7dc54655393d95ce
push id648815
push userwptsync@mozilla.com
push dateMon, 01 Feb 2021 17:48:27 +0000
treeherdertry@abfb9840bad0 [default view] [failures only]
reviewersemilio
bugs1689912
milestone87.0a1
Bug 1689912 - Reset aState.mHasRenderedLegend for the entire ConstructFieldSetFrame. r=emilio Differential Revision: https://phabricator.services.mozilla.com/D103607
layout/base/crashtests/1689912.html
layout/base/crashtests/crashtests.list
layout/base/nsCSSFrameConstructor.cpp
new file mode 100644
--- /dev/null
+++ b/layout/base/crashtests/1689912.html
@@ -0,0 +1,19 @@
+<fieldset>
+<fieldset></fieldset>
+<legend></legend>
+</fieldset>
+
+<fieldset>
+<fieldset style="overflow-x:auto"></fieldset>
+<legend></legend>
+</fieldset>
+
+<fieldset>
+<fieldset style="overflow-x:auto; columns:2"></fieldset>
+<legend></legend>
+</fieldset>
+
+<fieldset>
+<fieldset style="columns:2"></fieldset>
+<legend></legend>
+</fieldset>
--- a/layout/base/crashtests/crashtests.list
+++ b/layout/base/crashtests/crashtests.list
@@ -550,8 +550,9 @@ load 1578844-1.html
 load 1578844-2.html
 load 1579953-1.html
 load 1580576.html
 load 1586600.html
 load 1599518.html
 load 1599532.html
 pref(layout.accessiblecaret.enabled,true) load 1606492.html
 load 1676301-1.html
+load 1689912.html
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2971,16 +2971,18 @@ void nsCSSFrameConstructor::InitializeSe
   // Set the scrolled frame's initial child lists
   scrolledFrame->SetInitialChildList(kPrincipalList, childList);
 }
 
 nsIFrame* nsCSSFrameConstructor::ConstructFieldSetFrame(
     nsFrameConstructorState& aState, FrameConstructionItem& aItem,
     nsContainerFrame* aParentFrame, const nsStyleDisplay* aStyleDisplay,
     nsFrameList& aFrameList) {
+  AutoRestore<bool> savedHasRenderedLegend(aState.mHasRenderedLegend);
+  aState.mHasRenderedLegend = false;
   nsIContent* const content = aItem.mContent;
   ComputedStyle* const computedStyle = aItem.mComputedStyle;
 
   nsContainerFrame* fieldsetFrame =
       NS_NewFieldSetFrame(mPresShell, computedStyle);
 
   // Initialize it
   InitAndRestoreFrame(aState, content,
@@ -3048,22 +3050,18 @@ nsIFrame* nsCSSFrameConstructor::Constru
   nsFrameList childList;
 
   contentFrameTop->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);
   if (fieldsetFrame->IsAbsPosContainingBlock()) {
     aState.PushAbsoluteContainingBlock(contentFrameTop, fieldsetFrame,
                                        absoluteSaveState);
   }
 
-  {
-    AutoRestore<bool> savedHasRenderedLegend(aState.mHasRenderedLegend);
-    aState.mHasRenderedLegend = false;
-    ProcessChildren(aState, content, computedStyle, contentFrame, true,
-                    childList, true);
-  }
+  ProcessChildren(aState, content, computedStyle, contentFrame, true, childList,
+                  true);
   nsFrameList fieldsetKids;
   fieldsetKids.AppendFrame(nullptr,
                            scrollFrame ? scrollFrame : contentFrameTop);
 
   if (!MayNeedToCreateColumnSpanSiblings(contentFrame, childList)) {
     // Set the inner frame's initial child lists.
     contentFrame->SetInitialChildList(kPrincipalList, childList);
   } else {