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 удалений

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

@ -13147,6 +13147,18 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
tmp.DestroyFrames(presContext);
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
// entire block. This is painful and definitely not optimal
// but it will *always* get the right answer.
@ -13169,8 +13181,8 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
if (parentContainer) {
ReinsertContent(parentContainer, blockContent);
}
else {
NS_ERROR("uh oh. the block we need to reframe has no parent!");
else if (blockContent->GetCurrentDoc() == mDocument) {
ReconstructDocElementHierarchy();
}
return PR_TRUE;
}