ConstructDocElementFrame can return null if the XBL hasn't loaded yet. Handle

that XBL loading later by changing how XBL triggers the frame construction and
making it possible to recreate the doc element hierarchy even if there is no
doc element frame.  Bug 366207, r=sicking, sr=roc
This commit is contained in:
bzbarsky%mit.edu 2007-01-13 03:32:31 +00:00
Родитель d20bde6ab3
Коммит 661f32547b
2 изменённых файлов: 20 добавлений и 27 удалений

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

@ -174,13 +174,6 @@ public:
if (!ready)
return;
// XXX Deal with layered bindings. For example, mBoundElement may be anonymous content.
// Now do a ContentInserted notification to cause the frames to get installed finally,
nsIContent* parent = mBoundElement->GetParent();
PRInt32 index = 0;
if (parent)
index = parent->IndexOf(mBoundElement);
// If |mBoundElement| is (in addition to having binding |mBinding|)
// also a descendant of another element with binding |mBinding|,
// then we might have just constructed it due to the
@ -199,8 +192,7 @@ public:
shell->FrameManager()->GetUndisplayedContent(mBoundElement);
if (!sc) {
nsCOMPtr<nsIDocumentObserver> obs(do_QueryInterface(shell));
obs->ContentInserted(doc, parent, mBoundElement, index);
shell->RecreateFramesFor(mBoundElement);
}
}
}

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

@ -7638,26 +7638,27 @@ nsCSSFrameConstructor::ReconstructDocElementHierarchyInternal()
// XXXbz So why can't we reuse ContentRemoved?
nsIFrame* docParentFrame = docElementFrame->GetParent();
NS_ASSERTION(docElementFrame->GetParent() == mDocElementContainingBlock,
"Unexpected doc element parent frame");
NS_ASSERTION(docParentFrame, "should have a parent frame");
if (docParentFrame) {
// Remove the old document element hieararchy
rv = state.mFrameManager->RemoveFrame(docParentFrame, nsnull,
docElementFrame);
if (NS_SUCCEEDED(rv)) {
// Create the new document element hierarchy
nsIFrame* newChild;
rv = ConstructDocElementFrame(state, rootContent,
docParentFrame, &newChild);
if (NS_SUCCEEDED(rv)) {
rv = state.mFrameManager->InsertFrames(docParentFrame, nsnull,
nsnull, newChild);
}
}
// Remove the old document element hieararchy
rv = state.mFrameManager->RemoveFrame(mDocElementContainingBlock,
nsnull, docElementFrame);
if (NS_FAILED(rv)) {
return rv;
}
}
// Create the new document element hierarchy
nsIFrame* newChild;
rv = ConstructDocElementFrame(state, rootContent,
mDocElementContainingBlock, &newChild);
// newChild could be null even if |rv| is success, thanks to XBL.
if (NS_SUCCEEDED(rv) && newChild) {
rv = state.mFrameManager->InsertFrames(mDocElementContainingBlock,
nsnull, nsnull, newChild);
}
}
}