Bug 473390 part 3. Move some HTML frame construction assertions out of the frame constructor and into the relevant frame creation methods. r+sr=roc
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 19 Jan 2009 13:31:31 -0500
changeset 23940 ea0963a0bf01265ec67715ce559ed71d8a4fdbde
parent 23939 84e613c14c717fa9d460e4c7467a9ab4b761499c
child 23941 2ce70aa933a40cc80f6f7b4df874d4bf56af1b12
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
bugs473390
milestone1.9.2a1pre
Bug 473390 part 3. Move some HTML frame construction assertions out of the frame constructor and into the relevant frame creation methods. r+sr=roc
layout/base/nsCSSFrameConstructor.cpp
layout/forms/nsLegendFrame.cpp
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsSpacerFrame.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -5381,47 +5381,39 @@ nsCSSFrameConstructor::ConstructHTMLFram
                                 aTag, aStyleContext, newFrame,
                                 aFrameItems, display, frameHasBeenInitialized);
     NS_ASSERTION(nsPlaceholderFrame::GetRealFrameFor(aFrameItems.lastChild) ==
                  newFrame,
                  "Frame didn't get added to aFrameItems?");
     addedToFrameList = PR_TRUE;
   }
   else if (nsGkAtoms::legend == aTag) {
-    NS_ASSERTION(!display->IsAbsolutelyPositioned() && !display->IsFloating(),
-                 "Legends should not be positioned and should not float");
-    
     if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
       ProcessPseudoFrames(aState, aFrameItems); 
     }
     newFrame = NS_NewLegendFrame(mPresShell, aStyleContext);
     triedFrame = PR_TRUE;
   }
   else if (nsGkAtoms::frameset == aTag) {
-    NS_ASSERTION(!display->IsAbsolutelyPositioned() && !display->IsFloating(),
-                 "Framesets should not be positioned and should not float");
-    
     if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
       ProcessPseudoFrames(aState, aFrameItems); 
     }
    
     newFrame = NS_NewHTMLFramesetFrame(mPresShell, aStyleContext);
     triedFrame = PR_TRUE;
   }
   else if (nsGkAtoms::iframe == aTag) {
     if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
       ProcessPseudoFrames(aState, aFrameItems); 
     }
     
     newFrame = NS_NewSubDocumentFrame(mPresShell, aStyleContext);
     triedFrame = PR_TRUE;
   }
   else if (nsGkAtoms::spacer == aTag) {
-    NS_ASSERTION(!display->IsAbsolutelyPositioned() && !display->IsFloating(),
-                 "Spacers should not be positioned and should not float");
     if (!aHasPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
       ProcessPseudoFrames(aState, aFrameItems); 
     }
     newFrame = NS_NewSpacerFrame(mPresShell, aStyleContext);
     triedFrame = PR_TRUE;
   }
   else if (nsGkAtoms::button == aTag) {
     rv = ConstructButtonFrame(aState, aContent, aParentFrame,
--- a/layout/forms/nsLegendFrame.cpp
+++ b/layout/forms/nsLegendFrame.cpp
@@ -50,16 +50,22 @@
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsFont.h"
 #include "nsFormControlFrame.h"
 
 nsIFrame*
 NS_NewLegendFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
+#ifdef DEBUG
+  const nsStyleDisplay* disp = aContext->GetStyleDisplay();
+  NS_ASSERTION(!disp->IsAbsolutelyPositioned() && !disp->IsFloating(),
+               "Legends should not be positioned and should not float");
+#endif
+
   nsIFrame* f = new (aPresShell) nsLegendFrame(aContext);
   if (f) {
     f->AddStateBits(NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
   }
   return f;
 }
 
 nsIAtom*
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -1599,16 +1599,22 @@ nsHTMLFramesetFrame::EndMouseDrag(nsPres
     }
   }
   gDragInProgress = PR_FALSE;
 }  
 
 nsIFrame*
 NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
+#ifdef DEBUG
+  const nsStyleDisplay* disp = aContext->GetStyleDisplay();
+  NS_ASSERTION(!disp->IsAbsolutelyPositioned() && !disp->IsFloating(),
+               "Framesets should not be positioned and should not float");
+#endif
+
   return new (aPresShell) nsHTMLFramesetFrame(aContext);
 }
 
 /*******************************************************************************
  * nsHTMLFramesetBorderFrame
  ******************************************************************************/
 nsHTMLFramesetBorderFrame::nsHTMLFramesetBorderFrame(nsStyleContext* aContext,
                                                      PRInt32 aWidth,
--- a/layout/generic/nsSpacerFrame.cpp
+++ b/layout/generic/nsSpacerFrame.cpp
@@ -68,16 +68,22 @@ protected:
   SpacerFrame(nsStyleContext* aContext) : nsFrame(aContext) {}
   virtual ~SpacerFrame();
   void GetDesiredSize(nsHTMLReflowMetrics& aMetrics, nsSize aPercentBase);
 };
 
 nsIFrame*
 NS_NewSpacerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
+#ifdef DEBUG
+  const nsStyleDisplay* disp = aContext->GetStyleDisplay();
+  NS_ASSERTION(!disp->IsAbsolutelyPositioned() && !disp->IsFloating(),
+               "Spacers should not be positioned and should not float");
+#endif
+
   return new (aPresShell) SpacerFrame(aContext);
 }
 
 SpacerFrame::~SpacerFrame()
 {
 }
 
 /* virtual */ nscoord