Bug 921174 part 5: Assert that nsHTMLButtonControlFrame has exactly one child, and it's the button-content frame. r=bz

This commit is contained in:
Daniel Holbert
2013-09-26 23:43:16 -07:00
parent 302a1b4e20
commit 0fc848f00a

View File

@@ -10,6 +10,7 @@
#include "nsPresContext.h"
#include "nsGkAtoms.h"
#include "nsButtonFrameRenderer.h"
#include "nsCSSAnonBoxes.h"
#include "nsFormControlFrame.h"
#include "nsINameSpaceManager.h"
#include "nsStyleSet.h"
@@ -180,6 +181,13 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
// Reflow the child
nsIFrame* firstKid = mFrames.FirstChild();
MOZ_ASSERT(firstKid, "Button should have a child frame for its contents");
MOZ_ASSERT(!firstKid->GetNextSibling(),
"Button should have exactly one child frame");
MOZ_ASSERT(firstKid->StyleContext()->GetPseudo() ==
nsCSSAnonBoxes::buttonContent,
"Button's child frame has unexpected pseudo type!");
// XXXbz Eventually we may want to check-and-bail if
// !aReflowState.ShouldReflowAllKids() &&
// !NS_SUBTREE_DIRTY(firstKid).