Fix WipeContainingBlock() to work in more cases. Bug 291902, bug 296086, bug

285964, bug 310933, r+sr=dbaron
This commit is contained in:
bzbarsky%mit.edu 2005-10-16 15:21:05 +00:00
Родитель 75a7867512
Коммит 41ba4b6dae
1 изменённых файлов: 14 добавлений и 2 удалений

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

@ -13146,6 +13146,18 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
tmp.SetFrames(aState.mFloatedItems.childList); tmp.SetFrames(aState.mFloatedItems.childList);
tmp.DestroyFrames(presContext); tmp.DestroyFrames(presContext);
aState.mFloatedItems.childList = nsnull; aState.mFloatedItems.childList = nsnull;
// If we don't have a containing block, try to find our closest non-inline
// ancestor. We're guaranteed to have one, since
// nsStyleContext::ApplyStyleFixups enforces that the root is display:none,
// display:table, or display:block.
if (!aContainingBlock) {
aContainingBlock = aFrame;
do {
aContainingBlock = aContainingBlock->GetParent();
NS_ASSERTION(aContainingBlock, "Must have non-inline frame as root!");
} while (IsInlineFrame(aContainingBlock));
}
// Tell parent of the containing block to reformulate the // Tell parent of the containing block to reformulate the
// entire block. This is painful and definitely not optimal // entire block. This is painful and definitely not optimal
@ -13169,8 +13181,8 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
if (parentContainer) { if (parentContainer) {
ReinsertContent(parentContainer, blockContent); ReinsertContent(parentContainer, blockContent);
} }
else { else if (blockContent->GetCurrentDoc() == mDocument) {
NS_ERROR("uh oh. the block we need to reframe has no parent!"); ReconstructDocElementHierarchy();
} }
return PR_TRUE; return PR_TRUE;
} }