Bug 973390: Call SetPrimaryFrame for root element *after* processing its children, to fix assertion & for consistency with behavior on other elements. r=bz
authorDaniel Holbert <dholbert@cs.stanford.edu>
Wed, 19 Feb 2014 08:36:03 -0800
changeset 169885 b7057eb401fa08dd65f50cd71c72ec97f9352046
parent 169884 3f443622555e5bf0b4b901b2359b03f935981c5a
child 169886 abce7c294e389be130a5af01a1ad87349c2edb96
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersbz
bugs973390
milestone30.0a1
Bug 973390: Call SetPrimaryFrame for root element *after* processing its children, to fix assertion & for consistency with behavior on other elements. r=bz
layout/base/crashtests/973390-1.html
layout/base/crashtests/crashtests.list
layout/base/nsCSSFrameConstructor.cpp
new file mode 100644
--- /dev/null
+++ b/layout/base/crashtests/973390-1.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html style="display: flex;">
+<head>
+<meta charset="UTF-8">
+</head>
+<body style="display: table-cell;"></body>
+</html>
--- a/layout/base/crashtests/crashtests.list
+++ b/layout/base/crashtests/crashtests.list
@@ -422,8 +422,9 @@ pref(layers.force-active,true) load 8596
 load 866588.html
 load 897852.html
 asserts(4-6) load 898913.html # bug 847368
 load 931464.html
 load 936988-1.html
 load 931460-1.html
 load 935765-1.html
 load 942690.html
+load 973390-1.html
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2458,19 +2458,16 @@ nsCSSFrameConstructor::ConstructDocEleme
                    nullptr);
     newFrame = frameItems.FirstChild();
     NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames");
   }
 
   MOZ_ASSERT(newFrame);
   MOZ_ASSERT(contentFrame);
 
-  // set the primary frame
-  aDocElement->SetPrimaryFrame(contentFrame);
-
   NS_ASSERTION(processChildren ? !mRootElementFrame :
                  mRootElementFrame == contentFrame,
                "unexpected mRootElementFrame");
   mRootElementFrame = contentFrame;
 
   // Figure out which frame has the main style for the document element,
   // assigning it to mRootElementStyleFrame.
   // Backgrounds should be propagated from that frame to the viewport.
@@ -2491,16 +2488,19 @@ nsCSSFrameConstructor::ConstructDocEleme
     // Use a null PendingBinding, since our binding is not in fact pending.
     ProcessChildren(state, aDocElement, styleContext, contentFrame, true,
                     childItems, false, nullptr);
 
     // Set the initial child lists
     contentFrame->SetInitialChildList(kPrincipalList, childItems);
   }
 
+  // set the primary frame
+  aDocElement->SetPrimaryFrame(contentFrame);
+
   SetInitialSingleChild(mDocElementContainingBlock, newFrame);
 
   return newFrame;
 }
 
 
 nsIFrame*
 nsCSSFrameConstructor::ConstructRootFrame()