Bug 1050412 part 2: Assert about frame type before static_casting, and drop useless null-check. r=tn

This commit is contained in:
Daniel Holbert 2014-08-07 22:07:16 -07:00
parent 405e80dc03
commit 39bd7337db

View File

@ -255,10 +255,11 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
// Set Page Number Info
int32_t pageNum = 1;
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
nsPageFrame * pf = static_cast<nsPageFrame*>(e.get());
if (pf != nullptr) {
pf->SetPageNumInfo(pageNum, pageTot);
}
MOZ_ASSERT(e.get()->GetType() == nsGkAtoms::pageFrame,
"only expecting nsPageFrame children. Other children will make "
"this static_cast bogus & probably violate other assumptions");
nsPageFrame* pf = static_cast<nsPageFrame*>(e.get());
pf->SetPageNumInfo(pageNum, pageTot);
pageNum++;
}