Adding do_QueryInterface() wrapper for nsCOMPtr carpool. r=scc a=sar

This commit is contained in:
mcafee%netscape.com 1999-02-17 02:08:00 +00:00
Родитель cca2821cab
Коммит 3ece48d719
12 изменённых файлов: 52 добавлений и 51 удалений

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

@ -185,7 +185,7 @@ nsresult nsContentIterator::Init(nsIDOMRange* aRange)
aRange->GetStartParent(getter_AddRefs(dN)); aRange->GetStartParent(getter_AddRefs(dN));
if (!dN) if (!dN)
return NS_ERROR_ILLEGAL_VALUE; return NS_ERROR_ILLEGAL_VALUE;
cN = dN; cN = do_QueryInterface(dN);
if (!cN) if (!cN)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@ -232,7 +232,7 @@ nsresult nsContentIterator::Init(nsIDOMRange* aRange)
aRange->GetEndParent(getter_AddRefs(dN)); aRange->GetEndParent(getter_AddRefs(dN));
if (!dN) if (!dN)
return NS_ERROR_ILLEGAL_VALUE; return NS_ERROR_ILLEGAL_VALUE;
cN = dN; cN = do_QueryInterface(dN);
if (!cN) if (!cN)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@ -507,7 +507,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange)
aRange->GetStartParent(getter_AddRefs(dN)); aRange->GetStartParent(getter_AddRefs(dN));
if (!dN) if (!dN)
return NS_ERROR_ILLEGAL_VALUE; return NS_ERROR_ILLEGAL_VALUE;
cN = dN; cN = do_QueryInterface(dN);
if (!cN) if (!cN)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@ -572,7 +572,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange)
aRange->GetEndParent(getter_AddRefs(dN)); aRange->GetEndParent(getter_AddRefs(dN));
if (!dN) if (!dN)
return NS_ERROR_ILLEGAL_VALUE; return NS_ERROR_ILLEGAL_VALUE;
cN = dN; cN = do_QueryInterface(dN);
if (!cN) if (!cN)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;

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

@ -501,8 +501,8 @@ nsGenericDOMDataNode::ConvertContentToXIF(nsXIFConverter& aConverter) const
nsCOMPtr<nsIContent> startContent; nsCOMPtr<nsIContent> startContent;
nsCOMPtr<nsIContent> endContent; nsCOMPtr<nsIContent> endContent;
startContent = startNode; startContent = do_QueryInterface(startNode);
endContent = endNode; endContent = do_QueryInterface(endNode);
nsString buffer; nsString buffer;

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

@ -218,7 +218,7 @@ PRBool GetNodeBracketPoints(nsIContent* aNode,
// end of the root node, becasue it has no parent. // end of the root node, becasue it has no parent.
// so instead represent it by (node,0) and (node,numChildren) // so instead represent it by (node,0) and (node,numChildren)
*outParent = aNode; *outParent = aNode;
nsCOMPtr<nsIContent> cN(*outParent); nsCOMPtr<nsIContent> cN(do_QueryInterface(*outParent));
if (!cN) if (!cN)
return false; return false;
cN->ChildCount(indx); cN->ChildCount(indx);
@ -229,7 +229,7 @@ PRBool GetNodeBracketPoints(nsIContent* aNode,
} }
else else
{ {
nsCOMPtr<nsIContent> cN(*outParent); nsCOMPtr<nsIContent> cN(do_QueryInterface(*outParent));
if (!NS_SUCCEEDED(cN->IndexOf(aNode, indx))) if (!NS_SUCCEEDED(cN->IndexOf(aNode, indx)))
return false; return false;
*outStartOffset = indx; *outStartOffset = indx;
@ -1251,7 +1251,7 @@ nsRange::CloneSibsAndParents(nsCOMPtr<nsIDOMNode> parentNode, PRInt32 nodeOffset
// Make clone of parent: // Make clone of parent:
if (parentNode == commonParent || !parentNode) if (parentNode == commonParent || !parentNode)
{ {
parentClone = docfrag; parentClone = do_QueryInterface(docfrag);
} }
else else
{ {

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

@ -255,14 +255,14 @@ void nsCaret::DrawCaret()
domSelection->GetFocusNodeAndOffset(getter_doesnt_AddRef(focusNode), &focusOffset); domSelection->GetFocusNodeAndOffset(getter_doesnt_AddRef(focusNode), &focusOffset);
// is this a text node? // is this a text node?
nsCOMPtr<nsIDOMCharacterData> nodeAsText(focusNode); nsCOMPtr<nsIDOMCharacterData> nodeAsText(do_QueryInterface(focusNode));
if (nodeAsText) if (nodeAsText)
{ {
PRInt32 contentOffset = focusOffset; PRInt32 contentOffset = focusOffset;
if (focusNode) if (focusNode)
{ {
nsCOMPtr<nsIContent>contentNode(focusNode); nsCOMPtr<nsIContent>contentNode(do_QueryInterface(focusNode));
if (contentNode) if (contentNode)
{ {

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

@ -255,14 +255,14 @@ void nsCaret::DrawCaret()
domSelection->GetFocusNodeAndOffset(getter_doesnt_AddRef(focusNode), &focusOffset); domSelection->GetFocusNodeAndOffset(getter_doesnt_AddRef(focusNode), &focusOffset);
// is this a text node? // is this a text node?
nsCOMPtr<nsIDOMCharacterData> nodeAsText(focusNode); nsCOMPtr<nsIDOMCharacterData> nodeAsText(do_QueryInterface(focusNode));
if (nodeAsText) if (nodeAsText)
{ {
PRInt32 contentOffset = focusOffset; PRInt32 contentOffset = focusOffset;
if (focusNode) if (focusNode)
{ {
nsCOMPtr<nsIContent>contentNode(focusNode); nsCOMPtr<nsIContent>contentNode(do_QueryInterface(focusNode));
if (contentNode) if (contentNode)
{ {

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

@ -185,7 +185,7 @@ nsresult nsContentIterator::Init(nsIDOMRange* aRange)
aRange->GetStartParent(getter_AddRefs(dN)); aRange->GetStartParent(getter_AddRefs(dN));
if (!dN) if (!dN)
return NS_ERROR_ILLEGAL_VALUE; return NS_ERROR_ILLEGAL_VALUE;
cN = dN; cN = do_QueryInterface(dN);
if (!cN) if (!cN)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@ -232,7 +232,7 @@ nsresult nsContentIterator::Init(nsIDOMRange* aRange)
aRange->GetEndParent(getter_AddRefs(dN)); aRange->GetEndParent(getter_AddRefs(dN));
if (!dN) if (!dN)
return NS_ERROR_ILLEGAL_VALUE; return NS_ERROR_ILLEGAL_VALUE;
cN = dN; cN = do_QueryInterface(dN);
if (!cN) if (!cN)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@ -507,7 +507,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange)
aRange->GetStartParent(getter_AddRefs(dN)); aRange->GetStartParent(getter_AddRefs(dN));
if (!dN) if (!dN)
return NS_ERROR_ILLEGAL_VALUE; return NS_ERROR_ILLEGAL_VALUE;
cN = dN; cN = do_QueryInterface(dN);
if (!cN) if (!cN)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@ -572,7 +572,7 @@ nsresult nsContentSubtreeIterator::Init(nsIDOMRange* aRange)
aRange->GetEndParent(getter_AddRefs(dN)); aRange->GetEndParent(getter_AddRefs(dN));
if (!dN) if (!dN)
return NS_ERROR_ILLEGAL_VALUE; return NS_ERROR_ILLEGAL_VALUE;
cN = dN; cN = do_QueryInterface(dN);
if (!cN) if (!cN)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;

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

@ -501,8 +501,8 @@ nsGenericDOMDataNode::ConvertContentToXIF(nsXIFConverter& aConverter) const
nsCOMPtr<nsIContent> startContent; nsCOMPtr<nsIContent> startContent;
nsCOMPtr<nsIContent> endContent; nsCOMPtr<nsIContent> endContent;
startContent = startNode; startContent = do_QueryInterface(startNode);
endContent = endNode; endContent = do_QueryInterface(endNode);
nsString buffer; nsString buffer;

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

@ -218,7 +218,7 @@ PRBool GetNodeBracketPoints(nsIContent* aNode,
// end of the root node, becasue it has no parent. // end of the root node, becasue it has no parent.
// so instead represent it by (node,0) and (node,numChildren) // so instead represent it by (node,0) and (node,numChildren)
*outParent = aNode; *outParent = aNode;
nsCOMPtr<nsIContent> cN(*outParent); nsCOMPtr<nsIContent> cN(do_QueryInterface(*outParent));
if (!cN) if (!cN)
return false; return false;
cN->ChildCount(indx); cN->ChildCount(indx);
@ -229,7 +229,7 @@ PRBool GetNodeBracketPoints(nsIContent* aNode,
} }
else else
{ {
nsCOMPtr<nsIContent> cN(*outParent); nsCOMPtr<nsIContent> cN(do_QueryInterface(*outParent));
if (!NS_SUCCEEDED(cN->IndexOf(aNode, indx))) if (!NS_SUCCEEDED(cN->IndexOf(aNode, indx)))
return false; return false;
*outStartOffset = indx; *outStartOffset = indx;
@ -1251,7 +1251,7 @@ nsRange::CloneSibsAndParents(nsCOMPtr<nsIDOMNode> parentNode, PRInt32 nodeOffset
// Make clone of parent: // Make clone of parent:
if (parentNode == commonParent || !parentNode) if (parentNode == commonParent || !parentNode)
{ {
parentClone = docfrag; parentClone = do_QueryInterface(docfrag);
} }
else else
{ {

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

@ -522,7 +522,7 @@ nsRangeList::HandleKeyEvent(nsIFocusTracker *aTracker, nsGUIEvent *aGuiEvent, ns
nsCOMPtr<nsIContent> content; nsCOMPtr<nsIContent> content;
if (NS_FAILED(aFrame->GetContent(getter_AddRefs(content))) || !content) if (NS_FAILED(aFrame->GetContent(getter_AddRefs(content))) || !content)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIDOMNode> domnode(content); nsCOMPtr<nsIDOMNode> domnode(do_QueryInterface(content));
if (!domnode) if (!domnode)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@ -634,10 +634,10 @@ compareFrames(nsIFrame *aBegin, nsIFrame *aEnd)
return 0; return 0;
nsCOMPtr<nsIContent> beginContent; nsCOMPtr<nsIContent> beginContent;
if (NS_SUCCEEDED(aBegin->GetContent(getter_AddRefs(beginContent))) && beginContent){ if (NS_SUCCEEDED(aBegin->GetContent(getter_AddRefs(beginContent))) && beginContent){
nsCOMPtr<nsIDOMNode>beginNode (beginContent); nsCOMPtr<nsIDOMNode>beginNode (do_QueryInterface(beginContent));
nsCOMPtr<nsIContent> endContent; nsCOMPtr<nsIContent> endContent;
if (NS_SUCCEEDED(aEnd->GetContent(getter_AddRefs(endContent))) && endContent){ if (NS_SUCCEEDED(aEnd->GetContent(getter_AddRefs(endContent))) && endContent){
nsCOMPtr<nsIDOMNode>endNode (endContent); nsCOMPtr<nsIDOMNode>endNode (do_QueryInterface(endContent));
PRBool storage; PRBool storage;
PRInt32 int1; PRInt32 int1;
PRInt32 int2; PRInt32 int2;
@ -700,7 +700,7 @@ nsRangeList::TakeFocus(nsIFocusTracker *aTracker, nsIFrame *aFrame, PRInt32 aOff
nsCOMPtr<nsIContent> content; nsCOMPtr<nsIContent> content;
nsCOMPtr<nsIDOMNode> domNode; nsCOMPtr<nsIDOMNode> domNode;
if (NS_SUCCEEDED(aFrame->GetContent(getter_AddRefs(content))) && content){ if (NS_SUCCEEDED(aFrame->GetContent(getter_AddRefs(content))) && content){
domNode = content; domNode = do_QueryInterface(content);
nsCOMPtr<nsIDOMNode> parent; nsCOMPtr<nsIDOMNode> parent;
nsCOMPtr<nsIDOMNode> parent2; nsCOMPtr<nsIDOMNode> parent2;
if (NS_FAILED(domNode->GetParentNode(getter_AddRefs(parent))) || !parent) if (NS_FAILED(domNode->GetParentNode(getter_AddRefs(parent))) || !parent)
@ -752,11 +752,11 @@ nsRangeList::TakeFocus(nsIFocusTracker *aTracker, nsIFrame *aFrame, PRInt32 aOff
else if (frame){ //we need to check to see what the order is. else if (frame){ //we need to check to see what the order is.
nsCOMPtr<nsIContent>oldContent; nsCOMPtr<nsIContent>oldContent;
if (NS_SUCCEEDED(frame->GetContent(getter_AddRefs(oldContent))) && oldContent){ if (NS_SUCCEEDED(frame->GetContent(getter_AddRefs(oldContent))) && oldContent){
nsCOMPtr<nsIDOMNode> oldDomNode(oldContent); nsCOMPtr<nsIDOMNode> oldDomNode(do_QueryInterface(oldContent));
if (oldDomNode && (oldDomNode == GetFocusNode())) { if (oldDomNode && (oldDomNode == GetFocusNode())) {
nsCOMPtr<nsIContent> anchorContent; nsCOMPtr<nsIContent> anchorContent;
if (NS_SUCCEEDED(anchor->GetContent(getter_AddRefs(anchorContent))) && anchorContent){ if (NS_SUCCEEDED(anchor->GetContent(getter_AddRefs(anchorContent))) && anchorContent){
nsCOMPtr<nsIDOMNode>anchorDomNode(anchorContent); nsCOMPtr<nsIDOMNode>anchorDomNode(do_QueryInterface(anchorContent));
if (anchorDomNode && anchorDomNode == GetAnchorNode()) { if (anchorDomNode && anchorDomNode == GetAnchorNode()) {
@ -919,10 +919,10 @@ nsRangeList::ResetSelection(nsIFocusTracker *aTracker, nsIFrame *aStartFrame)
range->GetStartOffset(&startOffset); range->GetStartOffset(&startOffset);
range->GetEndParent(getter_AddRefs(endNode)); range->GetEndParent(getter_AddRefs(endNode));
range->GetEndOffset(&endOffset); range->GetEndOffset(&endOffset);
nsCOMPtr<nsIContent> startContent(startNode); nsCOMPtr<nsIContent> startContent(do_QueryInterface(startNode));
result = findFrameFromContent(aStartFrame, startContent,PR_TRUE); result = findFrameFromContent(aStartFrame, startContent,PR_TRUE);
if (result){ if (result){
nsCOMPtr<nsIContent> endContent(endNode); nsCOMPtr<nsIContent> endContent(do_QueryInterface(endNode));
if (endContent == startContent){ if (endContent == startContent){
if (startContent == frameContent) if (startContent == frameContent)
frameOffset = GetFocusOffset(); frameOffset = GetFocusOffset();
@ -995,7 +995,7 @@ nsresult nsRangeList::NotifySelectionListeners()
for (PRInt32 i = 0; i < mSelectionListeners->Count();i++) for (PRInt32 i = 0; i < mSelectionListeners->Count();i++)
{ {
nsCOMPtr<nsISupports> thisEntry(mSelectionListeners->ElementAt(i)); nsCOMPtr<nsISupports> thisEntry(mSelectionListeners->ElementAt(i));
nsCOMPtr<nsIDOMSelectionListener> thisListener(thisEntry); nsCOMPtr<nsIDOMSelectionListener> thisListener(do_QueryInterface(thisEntry));
if (thisListener) if (thisListener)
thisListener->NotifySelectionChanged(); thisListener->NotifySelectionChanged();
} }

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

@ -175,6 +175,6 @@ nsCOMPtr<nsIDOMNode> nsBaseAppCore::GetParentNodeFromDOMDoc(nsIDOMDocument * aDO
nsCOMPtr<nsIDOMElement> element; nsCOMPtr<nsIDOMElement> element;
aDOMDoc->GetDocumentElement(getter_AddRefs(element)); aDOMDoc->GetDocumentElement(getter_AddRefs(element));
if (element) if (element)
return nsCOMPtr<nsIDOMNode>(element); return nsCOMPtr<nsIDOMNode>(do_QueryInterface(element));
return node; return node;
} // nsToolbarCore::GetParentNodeFromDOMDoc } // nsToolbarCore::GetParentNodeFromDOMDoc

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

@ -388,7 +388,7 @@ nsCOMPtr<nsIDOMNode> nsWebShellWindow::FindNamedParentFromDoc(nsIDOMDocument * a
if (!element) if (!element)
return node; return node;
nsCOMPtr<nsIDOMNode> parent(element); nsCOMPtr<nsIDOMNode> parent(do_QueryInterface(element));
if (!parent) if (!parent)
return node; return node;
@ -571,7 +571,7 @@ void nsWebShellWindow::LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWi
aDOMDoc->GetDocumentElement(getter_AddRefs(element)); aDOMDoc->GetDocumentElement(getter_AddRefs(element));
if (!element) if (!element)
return; return;
nsCOMPtr<nsIDOMNode> window(element); nsCOMPtr<nsIDOMNode> window(do_QueryInterface(element));
nsresult rv; nsresult rv;
int endCount = 0; int endCount = 0;
@ -593,7 +593,7 @@ void nsWebShellWindow::LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWi
nsCOMPtr<nsIDOMNode> menuNode; nsCOMPtr<nsIDOMNode> menuNode;
menubarNode->GetFirstChild(getter_AddRefs(menuNode)); menubarNode->GetFirstChild(getter_AddRefs(menuNode));
while (menuNode) { while (menuNode) {
nsCOMPtr<nsIDOMElement> menuElement(menuNode); nsCOMPtr<nsIDOMElement> menuElement(do_QueryInterface(menuNode));
if (menuElement) { if (menuElement) {
nsString menuNodeType; nsString menuNodeType;
nsString menuName; nsString menuName;
@ -618,7 +618,8 @@ void nsWebShellWindow::LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWi
nsCOMPtr<nsIDOMNode> menuitemNode; nsCOMPtr<nsIDOMNode> menuitemNode;
menuNode->GetFirstChild(getter_AddRefs(menuitemNode)); menuNode->GetFirstChild(getter_AddRefs(menuitemNode));
while (menuitemNode) { while (menuitemNode) {
nsCOMPtr<nsIDOMElement> menuitemElement(menuitemNode); nsCOMPtr<nsIDOMElement>
menuitemElement(do_QueryInterface(menuitemNode));
if (menuitemElement) { if (menuitemElement) {
nsString menuitemNodeType; nsString menuitemNodeType;
nsString menuitemName; nsString menuitemName;
@ -789,7 +790,7 @@ nsCOMPtr<nsIDOMNode> nsWebShellWindow::GetParentNodeFromDOMDoc(nsIDOMDocument *
nsCOMPtr<nsIDOMElement> element; nsCOMPtr<nsIDOMElement> element;
aDOMDoc->GetDocumentElement(getter_AddRefs(element)); aDOMDoc->GetDocumentElement(getter_AddRefs(element));
if (element) if (element)
return nsCOMPtr<nsIDOMNode>(element); return nsCOMPtr<nsIDOMNode>(do_QueryInterface(element));
return node; return node;
} // nsWebShellWindow::GetParentNodeFromDOMDoc } // nsWebShellWindow::GetParentNodeFromDOMDoc
@ -809,14 +810,14 @@ nsCOMPtr<nsIDOMDocument> nsWebShellWindow::GetNamedDOMDoc(const nsString & aWebS
if (!cv) if (!cv)
return domDoc; return domDoc;
nsCOMPtr<nsIDocumentViewer> docv(cv); nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(cv));
if (!docv) if (!docv)
return domDoc; return domDoc;
nsCOMPtr<nsIDocument> doc; nsCOMPtr<nsIDocument> doc;
docv->GetDocument(*getter_AddRefs(doc)); docv->GetDocument(*getter_AddRefs(doc));
if (doc) if (doc)
return nsCOMPtr<nsIDOMDocument>(doc); return nsCOMPtr<nsIDOMDocument>(do_QueryInterface(doc));
return domDoc; return domDoc;
} // nsWebShellWindow::GetNamedDOMDoc } // nsWebShellWindow::GetNamedDOMDoc
@ -925,7 +926,7 @@ NS_IMETHODIMP nsWebShellWindow::OnConnectionsComplete()
nsCOMPtr<nsIDOMNode> statusNode(FindNamedDOMNode(nsAutoString("#text"), parent, count, 7)); nsCOMPtr<nsIDOMNode> statusNode(FindNamedDOMNode(nsAutoString("#text"), parent, count, 7));
if (!statusNode) if (!statusNode)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMCharacterData> charData(statusNode); nsCOMPtr<nsIDOMCharacterData> charData(do_QueryInterface(statusNode));
if (!charData) if (!charData)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
mStatusText = charData; mStatusText = charData;
@ -988,17 +989,17 @@ nsWebShellWindow::GetDOMNodeFromWebShell(nsIWebShell *aShell)
nsCOMPtr<nsIContentViewer> cv; nsCOMPtr<nsIContentViewer> cv;
aShell->GetContentViewer(getter_AddRefs(cv)); aShell->GetContentViewer(getter_AddRefs(cv));
if (cv) { if (cv) {
nsCOMPtr<nsIDocumentViewer> docv(cv); nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(cv));
if (docv) { if (docv) {
nsCOMPtr<nsIDocument> doc; nsCOMPtr<nsIDocument> doc;
docv->GetDocument(*getter_AddRefs(doc)); docv->GetDocument(*getter_AddRefs(doc));
if (doc) { if (doc) {
nsCOMPtr<nsIDOMDocument> domdoc(doc); nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(doc));
if (domdoc) { if (domdoc) {
nsCOMPtr<nsIDOMElement> element; nsCOMPtr<nsIDOMElement> element;
domdoc->GetDocumentElement(getter_AddRefs(element)); domdoc->GetDocumentElement(getter_AddRefs(element));
if (element) if (element)
node = element; node = do_QueryInterface(element);
} }
} }
} }
@ -1021,7 +1022,7 @@ void nsWebShellWindow::LoadCommandsInWebShell(nsIWebShell *aShell)
nsCOMPtr<nsIDOMNode> webshellNode = GetDOMNodeFromWebShell(aShell); nsCOMPtr<nsIDOMNode> webshellNode = GetDOMNodeFromWebShell(aShell);
if (!webshellNode) if (!webshellNode)
return; return;
nsCOMPtr<nsIDOMElement> webshellElement(webshellNode); nsCOMPtr<nsIDOMElement> webshellElement(do_QueryInterface(webshellNode));
if (!webshellElement) if (!webshellElement)
return; return;
@ -1035,7 +1036,7 @@ void nsWebShellWindow::LoadCommandsInWebShell(nsIWebShell *aShell)
nsCOMPtr<nsIDOMNode> commandRoot; nsCOMPtr<nsIDOMNode> commandRoot;
if (NS_FAILED(commandRootList->Item(rootCtr, getter_AddRefs(commandRoot)))) if (NS_FAILED(commandRootList->Item(rootCtr, getter_AddRefs(commandRoot))))
break; break;
nsCOMPtr<nsIDOMElement> commandRootElement(commandRoot); nsCOMPtr<nsIDOMElement> commandRootElement(do_QueryInterface(commandRoot));
if (!commandRootElement) if (!commandRootElement)
break; break;
@ -1073,7 +1074,7 @@ void nsWebShellWindow::LoadCommandsInWebShell(nsIWebShell *aShell)
void void
nsWebShellWindow::MakeOneCommand(nsIWebShell *aShell, nsCOMPtr<nsIDOMNode> aCommand) nsWebShellWindow::MakeOneCommand(nsIWebShell *aShell, nsCOMPtr<nsIDOMNode> aCommand)
{ {
nsCOMPtr<nsIDOMElement> cmdElement(aCommand); nsCOMPtr<nsIDOMElement> cmdElement(do_QueryInterface(aCommand));
if (!cmdElement) if (!cmdElement)
return; return;
@ -1112,7 +1113,7 @@ nsWebShellWindow::ConnectCommandsToWidgetsByType(nsIWebShell *aShell, nsString &
nsCOMPtr<nsIDOMNode> webshellNode = GetDOMNodeFromWebShell(aShell); nsCOMPtr<nsIDOMNode> webshellNode = GetDOMNodeFromWebShell(aShell);
if (!webshellNode) if (!webshellNode)
return; return;
nsCOMPtr<nsIDOMElement> webshellElement(webshellNode); nsCOMPtr<nsIDOMElement> webshellElement(do_QueryInterface(webshellNode));
if (!webshellElement) if (!webshellElement)
return; return;

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

@ -150,12 +150,12 @@ NS_IMETHODIMP nsXULCommand::SetEnabled(PRBool aIsEnabled)
PRInt32 i, n = mSrcWidgets.Count(); PRInt32 i, n = mSrcWidgets.Count();
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
nsCOMPtr<nsIDOMNode> node = dont_AddRef(NS_STATIC_CAST(nsIDOMNode*,mSrcWidgets.ElementAt(i))); nsCOMPtr<nsIDOMNode> node = dont_AddRef(NS_STATIC_CAST(nsIDOMNode*,mSrcWidgets.ElementAt(i)));
nsCOMPtr<nsIDOMHTMLInputElement> input ( node ); nsCOMPtr<nsIDOMHTMLInputElement> input ( do_QueryInterface(node) );
//*** rewrite this part to set an attribute on a nsIDOMElement //*** rewrite this part to set an attribute on a nsIDOMElement
if ( input ) { if ( input ) {
input->SetDisabled(aIsEnabled); input->SetDisabled(aIsEnabled);
} else { } else {
nsCOMPtr<nsIDOMHTMLButtonElement> btn ( node ); nsCOMPtr<nsIDOMHTMLButtonElement> btn ( do_QueryInterface(node) );
if ( btn ) if ( btn )
btn->SetDisabled(!aIsEnabled); btn->SetDisabled(!aIsEnabled);
} }
@ -330,7 +330,7 @@ nsresult nsXULCommand::KeyUp(nsIDOMEvent* aKeyEvent)
if (nsIDOMEvent::VK_RETURN != type) { if (nsIDOMEvent::VK_RETURN != type) {
return NS_OK; return NS_OK;
} }
nsCOMPtr<nsIDOMHTMLInputElement> input ( mDOMElement ); nsCOMPtr<nsIDOMHTMLInputElement> input ( do_QueryInterface(mDOMElement) );
if ( input ) { if ( input ) {
nsAutoString value; nsAutoString value;
input->GetValue(value); input->GetValue(value);