зеркало из https://github.com/mozilla/pjs.git
Bug 85422. Since nsIContent::GetDocument() may now sometimes return a null document back-pointer due to paint suppression, be extra paraniod with a sprinkle of null-check fairy dust. r=brendan, sr=attinasi
This commit is contained in:
Родитель
88720ed1d1
Коммит
9ca563d1bc
|
@ -1252,10 +1252,13 @@ nsBindingManager::WalkRules(nsIStyleSet* aStyleSet,
|
|||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
nsCOMPtr<nsIHTMLContentContainer> container(do_QueryInterface(document));
|
||||
nsCOMPtr<nsIHTMLCSSStyleSheet> inlineSheet;
|
||||
container->GetInlineStyleSheet(getter_AddRefs(inlineSheet));
|
||||
nsCOMPtr<nsIStyleRuleProcessor> inlineCSS(do_QueryInterface(inlineSheet));
|
||||
(*aFunc)((nsISupports*)(inlineCSS.get()), aData);
|
||||
if (container) {
|
||||
nsCOMPtr<nsIHTMLCSSStyleSheet> inlineSheet;
|
||||
container->GetInlineStyleSheet(getter_AddRefs(inlineSheet));
|
||||
nsCOMPtr<nsIStyleRuleProcessor> inlineCSS(do_QueryInterface(inlineSheet));
|
||||
if (inlineCSS)
|
||||
(*aFunc)((nsISupports*)(inlineCSS.get()), aData);
|
||||
}
|
||||
}
|
||||
|
||||
// Null out our mCurrentStyleRoot.
|
||||
|
|
|
@ -698,6 +698,10 @@ nsXBLBinding::GenerateAnonymousContent()
|
|||
if (hasContent || hasInsertionPoints) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
mBoundElement->GetDocument(*getter_AddRefs(doc));
|
||||
|
||||
// XXX doc will be null if we're in the midst of paint suppression.
|
||||
if (! doc)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
|
|
@ -633,6 +633,11 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsAReadableString& aURL,
|
|||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
// XXX document may be null if we're in the midst of paint suppression
|
||||
if (!document)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
document->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
||||
|
@ -730,6 +735,11 @@ nsXBLService::FlushStyleBindings(nsIContent* aContent)
|
|||
{
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
// XXX doc will be null if we're in the midst of paint suppression.
|
||||
if (! document)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
document->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
||||
|
@ -791,9 +801,11 @@ nsXBLService::GetXBLDocumentInfo(const nsCString& aURLStr, nsIContent* aBoundEle
|
|||
// The second line of defense is the binding manager's document table.
|
||||
nsCOMPtr<nsIDocument> boundDocument;
|
||||
aBoundElement->GetDocument(*getter_AddRefs(boundDocument));
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
boundDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
bindingManager->GetXBLDocumentInfo(aURLStr, aResult);
|
||||
if (boundDocument) {
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
boundDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
bindingManager->GetXBLDocumentInfo(aURLStr, aResult);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -291,7 +291,9 @@ nsXBLWindowHandler::WalkHandlersInternal(nsIDOMEvent* aEvent, nsIAtom* aEventTyp
|
|||
nsCOMPtr<nsIDocument> doc;
|
||||
elt->GetDocument(*getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(doc));
|
||||
domDoc->GetElementById(command, getter_AddRefs(commandElt));
|
||||
if (domDoc)
|
||||
domDoc->GetElementById(command, getter_AddRefs(commandElt));
|
||||
|
||||
if (!commandElt) {
|
||||
NS_ASSERTION(PR_FALSE, "A XUL <key> is observing a command that doesn't exist. Unable to execute key binding!\n");
|
||||
return NS_OK;
|
||||
|
|
|
@ -838,12 +838,21 @@ struct ChildIterator
|
|||
PRUint32 mLength;
|
||||
nsCOMPtr<nsIDOMNodeList> mNodes;
|
||||
|
||||
ChildIterator(nsIContent* aContent)
|
||||
ChildIterator(nsIContent* aContent, nsIDocument* aDocument)
|
||||
:mContent(aContent), mIndex(0), mLength(0), mNodes(nsnull)
|
||||
{
|
||||
NS_PRECONDITION(aContent != nsnull, "no content");
|
||||
NS_PRECONDITION(aDocument != nsnull, "no document");
|
||||
|
||||
aDocument->GetBindingManager(getter_AddRefs(mBindingManager));
|
||||
|
||||
#ifdef DEBUG
|
||||
// Verify that the frame ctor's document is the same as the
|
||||
// content element's document.
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContent->GetDocument(*getter_AddRefs(doc));
|
||||
doc->GetBindingManager(getter_AddRefs(mBindingManager));
|
||||
mContent->GetDocument(*getter_AddRefs(doc));
|
||||
NS_ASSERTION(doc.get() == aDocument, "content doc != frame ctor doc");
|
||||
#endif
|
||||
|
||||
// Retrieve the anonymous content that we should build.
|
||||
mBindingManager->GetXBLChildNodesFor(mContent, getter_AddRefs(mNodes));
|
||||
|
@ -1557,9 +1566,6 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
|||
nsIFrame* containerFrame;
|
||||
nsFrameItems childFrames;
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
if (NS_STYLE_DISPLAY_BLOCK == display->mDisplay) {
|
||||
NS_NewBlockFrame(aPresShell, &containerFrame);
|
||||
} else {
|
||||
|
@ -1589,7 +1595,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
|||
|
||||
// Create a frame
|
||||
nsresult result;
|
||||
result = CreateGeneratedFrameFor(aPresContext, document, containerFrame,
|
||||
result = CreateGeneratedFrameFor(aPresContext, mDocument, containerFrame,
|
||||
aContent, textStyleContext,
|
||||
styleContent, contentIndex, &frame);
|
||||
if (NS_SUCCEEDED(result) && frame) {
|
||||
|
@ -3112,7 +3118,7 @@ nsCSSFrameConstructor::TableProcessChildren(nsIPresShell* aPresShell,
|
|||
nsCOMPtr<nsIStyleContext> parentStyleContext;
|
||||
aParentFrame->GetStyleContext(getter_AddRefs(parentStyleContext));
|
||||
|
||||
ChildIterator iterator(aContent);
|
||||
ChildIterator iterator(aContent, mDocument);
|
||||
while (iterator.HasMoreChildren()) {
|
||||
nsCOMPtr<nsIContent> childContent;
|
||||
iterator.NextChild(getter_AddRefs(childContent));
|
||||
|
@ -3435,8 +3441,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
// build a scrollframe
|
||||
if (!isPaginated && isScrollable) {
|
||||
nsIFrame* newScrollFrame = nsnull;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aDocElement->GetDocument(*getter_AddRefs(document));
|
||||
nsCOMPtr<nsIStyleContext> newContext;
|
||||
|
||||
BeginBuildingScrollFrame( aPresShell, aPresContext,
|
||||
|
@ -3445,7 +3449,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
styleContext,
|
||||
aParentFrame,
|
||||
nsLayoutAtoms::scrolledContentPseudo,
|
||||
document,
|
||||
mDocument,
|
||||
PR_FALSE,
|
||||
scrollFrame,
|
||||
newContext,
|
||||
|
@ -3666,17 +3670,13 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
*/
|
||||
|
||||
// Set up our style rule observer.
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aDocElement->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
if (bindingManager) {
|
||||
nsCOMPtr<nsIStyleRuleSupplier> ruleSupplier(do_QueryInterface(bindingManager));
|
||||
nsCOMPtr<nsIStyleSet> set;
|
||||
aPresShell->GetStyleSet(getter_AddRefs(set));
|
||||
set->SetStyleRuleSupplier(ruleSupplier);
|
||||
}
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
if (bindingManager) {
|
||||
nsCOMPtr<nsIStyleRuleSupplier> ruleSupplier(do_QueryInterface(bindingManager));
|
||||
nsCOMPtr<nsIStyleSet> set;
|
||||
aPresShell->GetStyleSet(getter_AddRefs(set));
|
||||
set->SetStyleRuleSupplier(ruleSupplier);
|
||||
}
|
||||
|
||||
// --------- BUILD VIEWPORT -----------
|
||||
|
@ -3839,8 +3839,6 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
|
||||
|
||||
nsIFrame* newScrollableFrame = nsnull;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aDocElement->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
BeginBuildingScrollFrame( aPresShell,
|
||||
aPresContext,
|
||||
|
@ -3849,7 +3847,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
styleContext,
|
||||
viewportFrame,
|
||||
rootPseudo,
|
||||
document,
|
||||
mDocument,
|
||||
PR_TRUE,
|
||||
newFrame,
|
||||
rootPseudoStyle,
|
||||
|
@ -5232,13 +5230,8 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell,
|
|||
|
||||
}
|
||||
#endif
|
||||
// get the document
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsresult rv = aParent->GetDocument(*getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv) || !doc)
|
||||
return rv;
|
||||
|
||||
return CreateAnonymousFrames(aPresShell, aPresContext, aState, aParent, doc, aNewFrame, aChildItems);
|
||||
return CreateAnonymousFrames(aPresShell, aPresContext, aState, aParent, mDocument, aNewFrame, aChildItems);
|
||||
}
|
||||
|
||||
// after the node has been constructed and initialized create any
|
||||
|
@ -5886,10 +5879,8 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
// Process the child content if requested
|
||||
nsFrameItems childItems;
|
||||
if (processChildren || processAnonymousChildren) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContent->GetDocument(*getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
if (processChildren) {
|
||||
bindingManager->ShouldBuildChildFrames(aContent, &processChildren);
|
||||
if (processChildren)
|
||||
|
@ -6108,8 +6099,7 @@ nsCSSFrameConstructor::BuildScrollFrame (nsIPresShell* aPresShell,
|
|||
nsIFrame* aScrollPortFrame)
|
||||
{
|
||||
nsIFrame *scrollFrame;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
nsCOMPtr<nsIStyleContext> scrolledContentStyle;
|
||||
|
||||
|
||||
|
@ -6119,7 +6109,7 @@ nsCSSFrameConstructor::BuildScrollFrame (nsIPresShell* aPresShell,
|
|||
aContentStyle,
|
||||
aParentFrame,
|
||||
nsLayoutAtoms::scrolledContentPseudo,
|
||||
document,
|
||||
mDocument,
|
||||
PR_FALSE,
|
||||
aNewFrame,
|
||||
scrolledContentStyle,
|
||||
|
@ -7700,23 +7690,20 @@ nsCSSFrameConstructor::AppendFrames(nsIPresContext* aPresContext,
|
|||
|
||||
static nsIFrame*
|
||||
FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild)
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild)
|
||||
{
|
||||
NS_PRECONDITION(aDocument, "null document from content element in FindPreviousAnonymousSibling");
|
||||
nsIFrame* prevSibling = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContainer->GetDocument(*getter_AddRefs(doc));
|
||||
NS_ASSERTION(doc, "null document from content element in FindPreviousAnonymousSibling");
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(doc));
|
||||
NS_ASSERTION(xblDoc, "null xblDoc for content element in FindPreviousAnonymousSibling");
|
||||
if (xblDoc) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContainer));
|
||||
xblDoc->GetAnonymousNodes(elt, getter_AddRefs(nodeList));
|
||||
}
|
||||
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(aDocument));
|
||||
NS_ASSERTION(xblDoc, "null xblDoc for content element in FindPreviousAnonymousSibling");
|
||||
if (xblDoc) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContainer));
|
||||
xblDoc->GetAnonymousNodes(elt, getter_AddRefs(nodeList));
|
||||
}
|
||||
if (nodeList) {
|
||||
PRUint32 ctr,listLength;
|
||||
|
@ -7769,23 +7756,21 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
|
|||
|
||||
static nsIFrame*
|
||||
FindNextAnonymousSibling(nsIPresShell* aPresShell,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild)
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild)
|
||||
{
|
||||
NS_PRECONDITION(aDocument, "null document from content element in FindNextAnonymousSibling");
|
||||
|
||||
nsIFrame* nextSibling = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContainer->GetDocument(*getter_AddRefs(doc));
|
||||
NS_ASSERTION(doc, "null document from content element in FindNextAnonymousSibling");
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(doc));
|
||||
NS_ASSERTION(xblDoc, "null xblDoc for content element in FindNextAnonymousSibling");
|
||||
if (xblDoc) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContainer));
|
||||
xblDoc->GetAnonymousNodes(elt, getter_AddRefs(nodeList));
|
||||
}
|
||||
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(aDocument));
|
||||
NS_ASSERTION(xblDoc, "null xblDoc for content element in FindNextAnonymousSibling");
|
||||
if (xblDoc) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContainer));
|
||||
xblDoc->GetAnonymousNodes(elt, getter_AddRefs(nodeList));
|
||||
}
|
||||
if (nodeList) {
|
||||
PRUint32 ctr,listLength;
|
||||
|
@ -7945,17 +7930,12 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
|
|||
|
||||
#ifdef INCLUDE_XUL
|
||||
if (aContainer) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
PRInt32 namespaceID;
|
||||
aContainer->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
bindingManager->ResolveTag(aContainer, &namespaceID, getter_AddRefs(tag));
|
||||
}
|
||||
else
|
||||
aContainer->GetTag(*getter_AddRefs(tag));
|
||||
bindingManager->ResolveTag(aContainer, &namespaceID, getter_AddRefs(tag));
|
||||
|
||||
PRBool treeChildren = tag && tag.get() == nsXULAtoms::treechildren;
|
||||
PRBool treeItem = tag && tag.get() == nsXULAtoms::treeitem;
|
||||
|
@ -8403,17 +8383,12 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
|||
|
||||
#ifdef INCLUDE_XUL
|
||||
if (aContainer) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
PRInt32 namespaceID;
|
||||
aContainer->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
bindingManager->ResolveTag(aContainer, &namespaceID, getter_AddRefs(tag));
|
||||
}
|
||||
else
|
||||
aContainer->GetTag(*getter_AddRefs(tag));
|
||||
bindingManager->ResolveTag(aContainer, &namespaceID, getter_AddRefs(tag));
|
||||
|
||||
PRBool treeChildren = tag && tag.get() == nsXULAtoms::treechildren;
|
||||
PRBool treeItem = tag && tag.get() == nsXULAtoms::treeitem;
|
||||
|
@ -8570,7 +8545,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
|||
|
||||
// Find the frame that precedes the insertion point.
|
||||
nsIFrame* prevSibling = (aIndexInContainer == -1) ?
|
||||
FindPreviousAnonymousSibling(shell, aContainer, aChild) :
|
||||
FindPreviousAnonymousSibling(shell, mDocument, aContainer, aChild) :
|
||||
FindPreviousSibling(shell, aContainer, aIndexInContainer);
|
||||
|
||||
nsIFrame* nextSibling = nsnull;
|
||||
|
@ -8579,7 +8554,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
|||
// If there is no previous sibling, then find the frame that follows
|
||||
if (nsnull == prevSibling) {
|
||||
nextSibling = (aIndexInContainer == -1) ?
|
||||
FindNextAnonymousSibling(shell, aContainer, aChild) :
|
||||
FindNextAnonymousSibling(shell, mDocument, aContainer, aChild) :
|
||||
FindNextSibling(shell, aContainer, aIndexInContainer);
|
||||
}
|
||||
|
||||
|
@ -9127,17 +9102,12 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
|
|||
|
||||
#ifdef INCLUDE_XUL
|
||||
if (aContainer) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
PRInt32 namespaceID;
|
||||
aContainer->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
bindingManager->ResolveTag(aContainer, &namespaceID, getter_AddRefs(tag));
|
||||
}
|
||||
else
|
||||
aContainer->GetTag(*getter_AddRefs(tag));
|
||||
bindingManager->ResolveTag(aContainer, &namespaceID, getter_AddRefs(tag));
|
||||
|
||||
PRBool treeChildren = tag && tag.get() == nsXULAtoms::treechildren;
|
||||
PRBool treeItem = tag && tag.get() == nsXULAtoms::treeitem;
|
||||
|
@ -9975,18 +9945,12 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
|
|||
// content from being removed and re-inserted (which is what would
|
||||
// happen otherwise).
|
||||
if (!primaryFrame && !reframe) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
||||
PRInt32 namespaceID;
|
||||
bindingManager->ResolveTag(aContent, &namespaceID, getter_AddRefs(tag));
|
||||
}
|
||||
else
|
||||
aContent->GetTag(*getter_AddRefs(tag));
|
||||
PRInt32 namespaceID;
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
bindingManager->ResolveTag(aContent, &namespaceID, getter_AddRefs(tag));
|
||||
|
||||
if (tag && (tag.get() == nsXULAtoms::treechildren ||
|
||||
(tag.get() == nsXULAtoms::treeitem && aAttribute != nsXULAtoms::open) ||
|
||||
|
@ -10303,10 +10267,8 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
|
|||
NS_RELEASE(domData);
|
||||
|
||||
// Set aContent as the parent content and set the document object
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
altTextContent->SetParent(aContent);
|
||||
altTextContent->SetDocument(document, PR_TRUE, PR_TRUE);
|
||||
altTextContent->SetDocument(mDocument, PR_TRUE, PR_TRUE);
|
||||
|
||||
// Create either an inline frame, block frame, or area frame
|
||||
nsIFrame* containerFrame;
|
||||
|
@ -11520,7 +11482,7 @@ nsCSSFrameConstructor::ProcessChildren(nsIPresShell* aPresShell,
|
|||
nsPseudoFrames priorPseudoFrames;
|
||||
aState.mPseudoFrames.Reset(&priorPseudoFrames);
|
||||
|
||||
ChildIterator iterator(aContent);
|
||||
ChildIterator iterator(aContent, mDocument);
|
||||
while (iterator.HasMoreChildren()) {
|
||||
nsCOMPtr<nsIContent> childContent;
|
||||
iterator.NextChild(getter_AddRefs(childContent));
|
||||
|
@ -12677,7 +12639,7 @@ nsCSSFrameConstructor::ProcessBlockChildren(nsIPresShell* aPresShell,
|
|||
}
|
||||
|
||||
// Iterate the child content objects and construct frames
|
||||
ChildIterator iterator(aContent);
|
||||
ChildIterator iterator(aContent, mDocument);
|
||||
while (iterator.HasMoreChildren()) {
|
||||
nsCOMPtr<nsIContent> childContent;
|
||||
iterator.NextChild(getter_AddRefs(childContent));
|
||||
|
@ -12974,7 +12936,7 @@ nsCSSFrameConstructor::ProcessInlineChildren(nsIPresShell* aPresShell,
|
|||
|
||||
// Iterate the child content objects and construct frames
|
||||
PRBool allKidsInline = PR_TRUE;
|
||||
ChildIterator iterator(aContent);
|
||||
ChildIterator iterator(aContent, mDocument);
|
||||
while (iterator.HasMoreChildren()) {
|
||||
nsCOMPtr<nsIContent> childContent;
|
||||
iterator.NextChild(getter_AddRefs(childContent));
|
||||
|
|
|
@ -1428,7 +1428,7 @@ nsImageFrame::GetBaseURI(nsIURI **aURI)
|
|||
nsCOMPtr<nsIDocument> doc;
|
||||
if (mContent) {
|
||||
rv = mContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (doc) {
|
||||
doc->GetBaseURL(*getter_AddRefs(baseURI));
|
||||
}
|
||||
}
|
||||
|
@ -1489,7 +1489,7 @@ nsImageFrame::CanLoadImage(nsIURI *aURI)
|
|||
nsCOMPtr<nsIDocument> document;
|
||||
if (mContent) {
|
||||
rv = mContent->GetDocument(*getter_AddRefs(document));
|
||||
if (NS_FAILED(rv)) {
|
||||
if (! document) {
|
||||
NS_ASSERTION(0, "expecting a document");
|
||||
return shouldLoad;
|
||||
}
|
||||
|
|
|
@ -1043,6 +1043,9 @@ nsObjectFrame::InstantiatePlugin(nsIPresContext* aPresContext,
|
|||
rv = shell->GetDocument(getter_AddRefs(document));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (! document)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalScript;
|
||||
rv = document->GetScriptGlobalObject(getter_AddRefs(globalScript));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1222,12 +1225,10 @@ nsObjectFrame::GetBaseURL(nsIURI* &aURL)
|
|||
}
|
||||
else
|
||||
{
|
||||
nsIDocument* doc = nsnull;
|
||||
if (NS_SUCCEEDED(mContent->GetDocument(doc)))
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
mContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc)
|
||||
doc->GetBaseURL(aURL);
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -1428,7 +1428,7 @@ nsImageFrame::GetBaseURI(nsIURI **aURI)
|
|||
nsCOMPtr<nsIDocument> doc;
|
||||
if (mContent) {
|
||||
rv = mContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (doc) {
|
||||
doc->GetBaseURL(*getter_AddRefs(baseURI));
|
||||
}
|
||||
}
|
||||
|
@ -1489,7 +1489,7 @@ nsImageFrame::CanLoadImage(nsIURI *aURI)
|
|||
nsCOMPtr<nsIDocument> document;
|
||||
if (mContent) {
|
||||
rv = mContent->GetDocument(*getter_AddRefs(document));
|
||||
if (NS_FAILED(rv)) {
|
||||
if (! document) {
|
||||
NS_ASSERTION(0, "expecting a document");
|
||||
return shouldLoad;
|
||||
}
|
||||
|
|
|
@ -1043,6 +1043,9 @@ nsObjectFrame::InstantiatePlugin(nsIPresContext* aPresContext,
|
|||
rv = shell->GetDocument(getter_AddRefs(document));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (! document)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalScript;
|
||||
rv = document->GetScriptGlobalObject(getter_AddRefs(globalScript));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1222,12 +1225,10 @@ nsObjectFrame::GetBaseURL(nsIURI* &aURL)
|
|||
}
|
||||
else
|
||||
{
|
||||
nsIDocument* doc = nsnull;
|
||||
if (NS_SUCCEEDED(mContent->GetDocument(doc)))
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
mContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc)
|
||||
doc->GetBaseURL(aURL);
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -838,12 +838,21 @@ struct ChildIterator
|
|||
PRUint32 mLength;
|
||||
nsCOMPtr<nsIDOMNodeList> mNodes;
|
||||
|
||||
ChildIterator(nsIContent* aContent)
|
||||
ChildIterator(nsIContent* aContent, nsIDocument* aDocument)
|
||||
:mContent(aContent), mIndex(0), mLength(0), mNodes(nsnull)
|
||||
{
|
||||
NS_PRECONDITION(aContent != nsnull, "no content");
|
||||
NS_PRECONDITION(aDocument != nsnull, "no document");
|
||||
|
||||
aDocument->GetBindingManager(getter_AddRefs(mBindingManager));
|
||||
|
||||
#ifdef DEBUG
|
||||
// Verify that the frame ctor's document is the same as the
|
||||
// content element's document.
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContent->GetDocument(*getter_AddRefs(doc));
|
||||
doc->GetBindingManager(getter_AddRefs(mBindingManager));
|
||||
mContent->GetDocument(*getter_AddRefs(doc));
|
||||
NS_ASSERTION(doc.get() == aDocument, "content doc != frame ctor doc");
|
||||
#endif
|
||||
|
||||
// Retrieve the anonymous content that we should build.
|
||||
mBindingManager->GetXBLChildNodesFor(mContent, getter_AddRefs(mNodes));
|
||||
|
@ -1557,9 +1566,6 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
|||
nsIFrame* containerFrame;
|
||||
nsFrameItems childFrames;
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
if (NS_STYLE_DISPLAY_BLOCK == display->mDisplay) {
|
||||
NS_NewBlockFrame(aPresShell, &containerFrame);
|
||||
} else {
|
||||
|
@ -1589,7 +1595,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
|||
|
||||
// Create a frame
|
||||
nsresult result;
|
||||
result = CreateGeneratedFrameFor(aPresContext, document, containerFrame,
|
||||
result = CreateGeneratedFrameFor(aPresContext, mDocument, containerFrame,
|
||||
aContent, textStyleContext,
|
||||
styleContent, contentIndex, &frame);
|
||||
if (NS_SUCCEEDED(result) && frame) {
|
||||
|
@ -3112,7 +3118,7 @@ nsCSSFrameConstructor::TableProcessChildren(nsIPresShell* aPresShell,
|
|||
nsCOMPtr<nsIStyleContext> parentStyleContext;
|
||||
aParentFrame->GetStyleContext(getter_AddRefs(parentStyleContext));
|
||||
|
||||
ChildIterator iterator(aContent);
|
||||
ChildIterator iterator(aContent, mDocument);
|
||||
while (iterator.HasMoreChildren()) {
|
||||
nsCOMPtr<nsIContent> childContent;
|
||||
iterator.NextChild(getter_AddRefs(childContent));
|
||||
|
@ -3435,8 +3441,6 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
// build a scrollframe
|
||||
if (!isPaginated && isScrollable) {
|
||||
nsIFrame* newScrollFrame = nsnull;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aDocElement->GetDocument(*getter_AddRefs(document));
|
||||
nsCOMPtr<nsIStyleContext> newContext;
|
||||
|
||||
BeginBuildingScrollFrame( aPresShell, aPresContext,
|
||||
|
@ -3445,7 +3449,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
styleContext,
|
||||
aParentFrame,
|
||||
nsLayoutAtoms::scrolledContentPseudo,
|
||||
document,
|
||||
mDocument,
|
||||
PR_FALSE,
|
||||
scrollFrame,
|
||||
newContext,
|
||||
|
@ -3666,17 +3670,13 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
*/
|
||||
|
||||
// Set up our style rule observer.
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aDocElement->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
if (bindingManager) {
|
||||
nsCOMPtr<nsIStyleRuleSupplier> ruleSupplier(do_QueryInterface(bindingManager));
|
||||
nsCOMPtr<nsIStyleSet> set;
|
||||
aPresShell->GetStyleSet(getter_AddRefs(set));
|
||||
set->SetStyleRuleSupplier(ruleSupplier);
|
||||
}
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
if (bindingManager) {
|
||||
nsCOMPtr<nsIStyleRuleSupplier> ruleSupplier(do_QueryInterface(bindingManager));
|
||||
nsCOMPtr<nsIStyleSet> set;
|
||||
aPresShell->GetStyleSet(getter_AddRefs(set));
|
||||
set->SetStyleRuleSupplier(ruleSupplier);
|
||||
}
|
||||
|
||||
// --------- BUILD VIEWPORT -----------
|
||||
|
@ -3839,8 +3839,6 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
|
||||
|
||||
nsIFrame* newScrollableFrame = nsnull;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aDocElement->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
BeginBuildingScrollFrame( aPresShell,
|
||||
aPresContext,
|
||||
|
@ -3849,7 +3847,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
styleContext,
|
||||
viewportFrame,
|
||||
rootPseudo,
|
||||
document,
|
||||
mDocument,
|
||||
PR_TRUE,
|
||||
newFrame,
|
||||
rootPseudoStyle,
|
||||
|
@ -5232,13 +5230,8 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell,
|
|||
|
||||
}
|
||||
#endif
|
||||
// get the document
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsresult rv = aParent->GetDocument(*getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv) || !doc)
|
||||
return rv;
|
||||
|
||||
return CreateAnonymousFrames(aPresShell, aPresContext, aState, aParent, doc, aNewFrame, aChildItems);
|
||||
return CreateAnonymousFrames(aPresShell, aPresContext, aState, aParent, mDocument, aNewFrame, aChildItems);
|
||||
}
|
||||
|
||||
// after the node has been constructed and initialized create any
|
||||
|
@ -5886,10 +5879,8 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
// Process the child content if requested
|
||||
nsFrameItems childItems;
|
||||
if (processChildren || processAnonymousChildren) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContent->GetDocument(*getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
if (processChildren) {
|
||||
bindingManager->ShouldBuildChildFrames(aContent, &processChildren);
|
||||
if (processChildren)
|
||||
|
@ -6108,8 +6099,7 @@ nsCSSFrameConstructor::BuildScrollFrame (nsIPresShell* aPresShell,
|
|||
nsIFrame* aScrollPortFrame)
|
||||
{
|
||||
nsIFrame *scrollFrame;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
nsCOMPtr<nsIStyleContext> scrolledContentStyle;
|
||||
|
||||
|
||||
|
@ -6119,7 +6109,7 @@ nsCSSFrameConstructor::BuildScrollFrame (nsIPresShell* aPresShell,
|
|||
aContentStyle,
|
||||
aParentFrame,
|
||||
nsLayoutAtoms::scrolledContentPseudo,
|
||||
document,
|
||||
mDocument,
|
||||
PR_FALSE,
|
||||
aNewFrame,
|
||||
scrolledContentStyle,
|
||||
|
@ -7700,23 +7690,20 @@ nsCSSFrameConstructor::AppendFrames(nsIPresContext* aPresContext,
|
|||
|
||||
static nsIFrame*
|
||||
FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild)
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild)
|
||||
{
|
||||
NS_PRECONDITION(aDocument, "null document from content element in FindPreviousAnonymousSibling");
|
||||
nsIFrame* prevSibling = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContainer->GetDocument(*getter_AddRefs(doc));
|
||||
NS_ASSERTION(doc, "null document from content element in FindPreviousAnonymousSibling");
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(doc));
|
||||
NS_ASSERTION(xblDoc, "null xblDoc for content element in FindPreviousAnonymousSibling");
|
||||
if (xblDoc) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContainer));
|
||||
xblDoc->GetAnonymousNodes(elt, getter_AddRefs(nodeList));
|
||||
}
|
||||
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(aDocument));
|
||||
NS_ASSERTION(xblDoc, "null xblDoc for content element in FindPreviousAnonymousSibling");
|
||||
if (xblDoc) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContainer));
|
||||
xblDoc->GetAnonymousNodes(elt, getter_AddRefs(nodeList));
|
||||
}
|
||||
if (nodeList) {
|
||||
PRUint32 ctr,listLength;
|
||||
|
@ -7769,23 +7756,21 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
|
|||
|
||||
static nsIFrame*
|
||||
FindNextAnonymousSibling(nsIPresShell* aPresShell,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild)
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild)
|
||||
{
|
||||
NS_PRECONDITION(aDocument, "null document from content element in FindNextAnonymousSibling");
|
||||
|
||||
nsIFrame* nextSibling = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContainer->GetDocument(*getter_AddRefs(doc));
|
||||
NS_ASSERTION(doc, "null document from content element in FindNextAnonymousSibling");
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(doc));
|
||||
NS_ASSERTION(xblDoc, "null xblDoc for content element in FindNextAnonymousSibling");
|
||||
if (xblDoc) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContainer));
|
||||
xblDoc->GetAnonymousNodes(elt, getter_AddRefs(nodeList));
|
||||
}
|
||||
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(aDocument));
|
||||
NS_ASSERTION(xblDoc, "null xblDoc for content element in FindNextAnonymousSibling");
|
||||
if (xblDoc) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContainer));
|
||||
xblDoc->GetAnonymousNodes(elt, getter_AddRefs(nodeList));
|
||||
}
|
||||
if (nodeList) {
|
||||
PRUint32 ctr,listLength;
|
||||
|
@ -7945,17 +7930,12 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
|
|||
|
||||
#ifdef INCLUDE_XUL
|
||||
if (aContainer) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
PRInt32 namespaceID;
|
||||
aContainer->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
bindingManager->ResolveTag(aContainer, &namespaceID, getter_AddRefs(tag));
|
||||
}
|
||||
else
|
||||
aContainer->GetTag(*getter_AddRefs(tag));
|
||||
bindingManager->ResolveTag(aContainer, &namespaceID, getter_AddRefs(tag));
|
||||
|
||||
PRBool treeChildren = tag && tag.get() == nsXULAtoms::treechildren;
|
||||
PRBool treeItem = tag && tag.get() == nsXULAtoms::treeitem;
|
||||
|
@ -8403,17 +8383,12 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
|||
|
||||
#ifdef INCLUDE_XUL
|
||||
if (aContainer) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
PRInt32 namespaceID;
|
||||
aContainer->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
bindingManager->ResolveTag(aContainer, &namespaceID, getter_AddRefs(tag));
|
||||
}
|
||||
else
|
||||
aContainer->GetTag(*getter_AddRefs(tag));
|
||||
bindingManager->ResolveTag(aContainer, &namespaceID, getter_AddRefs(tag));
|
||||
|
||||
PRBool treeChildren = tag && tag.get() == nsXULAtoms::treechildren;
|
||||
PRBool treeItem = tag && tag.get() == nsXULAtoms::treeitem;
|
||||
|
@ -8570,7 +8545,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
|||
|
||||
// Find the frame that precedes the insertion point.
|
||||
nsIFrame* prevSibling = (aIndexInContainer == -1) ?
|
||||
FindPreviousAnonymousSibling(shell, aContainer, aChild) :
|
||||
FindPreviousAnonymousSibling(shell, mDocument, aContainer, aChild) :
|
||||
FindPreviousSibling(shell, aContainer, aIndexInContainer);
|
||||
|
||||
nsIFrame* nextSibling = nsnull;
|
||||
|
@ -8579,7 +8554,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
|||
// If there is no previous sibling, then find the frame that follows
|
||||
if (nsnull == prevSibling) {
|
||||
nextSibling = (aIndexInContainer == -1) ?
|
||||
FindNextAnonymousSibling(shell, aContainer, aChild) :
|
||||
FindNextAnonymousSibling(shell, mDocument, aContainer, aChild) :
|
||||
FindNextSibling(shell, aContainer, aIndexInContainer);
|
||||
}
|
||||
|
||||
|
@ -9127,17 +9102,12 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
|
|||
|
||||
#ifdef INCLUDE_XUL
|
||||
if (aContainer) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
PRInt32 namespaceID;
|
||||
aContainer->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
bindingManager->ResolveTag(aContainer, &namespaceID, getter_AddRefs(tag));
|
||||
}
|
||||
else
|
||||
aContainer->GetTag(*getter_AddRefs(tag));
|
||||
bindingManager->ResolveTag(aContainer, &namespaceID, getter_AddRefs(tag));
|
||||
|
||||
PRBool treeChildren = tag && tag.get() == nsXULAtoms::treechildren;
|
||||
PRBool treeItem = tag && tag.get() == nsXULAtoms::treeitem;
|
||||
|
@ -9975,18 +9945,12 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
|
|||
// content from being removed and re-inserted (which is what would
|
||||
// happen otherwise).
|
||||
if (!primaryFrame && !reframe) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
doc->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
||||
PRInt32 namespaceID;
|
||||
bindingManager->ResolveTag(aContent, &namespaceID, getter_AddRefs(tag));
|
||||
}
|
||||
else
|
||||
aContent->GetTag(*getter_AddRefs(tag));
|
||||
PRInt32 namespaceID;
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
bindingManager->ResolveTag(aContent, &namespaceID, getter_AddRefs(tag));
|
||||
|
||||
if (tag && (tag.get() == nsXULAtoms::treechildren ||
|
||||
(tag.get() == nsXULAtoms::treeitem && aAttribute != nsXULAtoms::open) ||
|
||||
|
@ -10303,10 +10267,8 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
|
|||
NS_RELEASE(domData);
|
||||
|
||||
// Set aContent as the parent content and set the document object
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
altTextContent->SetParent(aContent);
|
||||
altTextContent->SetDocument(document, PR_TRUE, PR_TRUE);
|
||||
altTextContent->SetDocument(mDocument, PR_TRUE, PR_TRUE);
|
||||
|
||||
// Create either an inline frame, block frame, or area frame
|
||||
nsIFrame* containerFrame;
|
||||
|
@ -11520,7 +11482,7 @@ nsCSSFrameConstructor::ProcessChildren(nsIPresShell* aPresShell,
|
|||
nsPseudoFrames priorPseudoFrames;
|
||||
aState.mPseudoFrames.Reset(&priorPseudoFrames);
|
||||
|
||||
ChildIterator iterator(aContent);
|
||||
ChildIterator iterator(aContent, mDocument);
|
||||
while (iterator.HasMoreChildren()) {
|
||||
nsCOMPtr<nsIContent> childContent;
|
||||
iterator.NextChild(getter_AddRefs(childContent));
|
||||
|
@ -12677,7 +12639,7 @@ nsCSSFrameConstructor::ProcessBlockChildren(nsIPresShell* aPresShell,
|
|||
}
|
||||
|
||||
// Iterate the child content objects and construct frames
|
||||
ChildIterator iterator(aContent);
|
||||
ChildIterator iterator(aContent, mDocument);
|
||||
while (iterator.HasMoreChildren()) {
|
||||
nsCOMPtr<nsIContent> childContent;
|
||||
iterator.NextChild(getter_AddRefs(childContent));
|
||||
|
@ -12974,7 +12936,7 @@ nsCSSFrameConstructor::ProcessInlineChildren(nsIPresShell* aPresShell,
|
|||
|
||||
// Iterate the child content objects and construct frames
|
||||
PRBool allKidsInline = PR_TRUE;
|
||||
ChildIterator iterator(aContent);
|
||||
ChildIterator iterator(aContent, mDocument);
|
||||
while (iterator.HasMoreChildren()) {
|
||||
nsCOMPtr<nsIContent> childContent;
|
||||
iterator.NextChild(getter_AddRefs(childContent));
|
||||
|
|
Загрузка…
Ссылка в новой задаче