Bug 874418: Assert that placeholders are reflowed before their out-of-flows. r=bz

This commit is contained in:
Daniel Holbert 2013-05-21 12:15:57 -04:00
Родитель b5c2e54e41
Коммит f5aa7013db
1 изменённых файлов: 32 добавлений и 0 удалений

Просмотреть файл

@ -97,6 +97,38 @@ nsPlaceholderFrame::Reflow(nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
#ifdef DEBUG
// We should be getting reflowed before our out-of-flow.
// If this is our first reflow, and our out-of-flow has already received its
// first reflow (before us), complain.
// XXXdholbert This "look for a previous continuation or IB-split sibling"
// code could use nsLayoutUtils::GetPrevContinuationOrSpecialSibling(), if
// we ever add a function like that. (We currently have a "Next" version.)
if ((GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
!(mOutOfFlowFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
// Unfortunately, this can currently happen when the placeholder is in a
// later continuation or later IB-split sibling than its out-of-flow (as
// is the case in some of our existing unit tests). So for now, in that
// case, we'll warn instead of asserting.
bool isInContinuationOrIBSplit = false;
nsIFrame* ancestor = this;
while ((ancestor = ancestor->GetParent())) {
if (ancestor->GetPrevContinuation() ||
ancestor->Properties().Get(IBSplitSpecialPrevSibling())) {
isInContinuationOrIBSplit = true;
break;
}
}
if (isInContinuationOrIBSplit) {
NS_WARNING("Out-of-flow frame got reflowed before its placeholder");
} else {
NS_ERROR("Out-of-flow frame got reflowed before its placeholder");
}
}
#endif
DO_GLOBAL_REFLOW_COUNT("nsPlaceholderFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
aDesiredSize.width = 0;