Bug 1460940 - Remove nsIDOMDocument uses in dom/xslt/. r?bz
MozReview-Commit-ID: Ap0TrNI9eqC
--- a/dom/xslt/xml/txXMLParser.cpp
+++ b/dom/xslt/xml/txXMLParser.cpp
@@ -3,17 +3,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "txXMLParser.h"
#include "txURIUtils.h"
#include "txXPathTreeWalker.h"
#include "nsIDocument.h"
-#include "nsIDOMDocument.h"
#include "nsSyncLoadService.h"
#include "nsNetUtil.h"
#include "nsIURI.h"
#include "nsIPrincipal.h"
nsresult
txParseDocumentFromURI(const nsAString& aHref,
const txXPathNode& aLoader,
@@ -47,17 +46,16 @@ txParseDocumentFromURI(const nsAString&
if (NS_FAILED(rv)) {
aErrMsg.AppendLiteral("Document load of ");
aErrMsg.Append(aHref);
aErrMsg.AppendLiteral(" failed.");
return NS_FAILED(rv) ? rv : NS_ERROR_FAILURE;
}
- nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(theDocument);
- *aResult = txXPathNativeNode::createXPathNode(domDocument);
+ *aResult = txXPathNativeNode::createXPathNode(theDocument);
if (!*aResult) {
NS_RELEASE(theDocument);
return NS_ERROR_FAILURE;
}
return NS_OK;
}
--- a/dom/xslt/xpath/XPathEvaluator.cpp
+++ b/dom/xslt/xpath/XPathEvaluator.cpp
@@ -10,17 +10,16 @@
#include "mozilla/dom/XPathExpression.h"
#include "XPathResult.h"
#include "nsContentCID.h"
#include "txExpr.h"
#include "txExprParser.h"
#include "nsError.h"
#include "txURIUtils.h"
#include "nsIDocument.h"
-#include "nsIDOMDocument.h"
#include "nsDOMString.h"
#include "nsNameSpaceManager.h"
#include "nsContentUtils.h"
#include "txIXPathContext.h"
#include "mozilla/dom/XPathEvaluatorBinding.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/XPathNSResolverBinding.h"
--- a/dom/xslt/xpath/XPathExpression.cpp
+++ b/dom/xslt/xpath/XPathExpression.cpp
@@ -4,17 +4,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Move.h"
#include "XPathExpression.h"
#include "txExpr.h"
#include "txExprResult.h"
#include "txIXPathContext.h"
#include "nsError.h"
-#include "nsIDOMDocument.h"
#include "nsINode.h"
#include "XPathResult.h"
#include "txURIUtils.h"
#include "txXPathTreeWalker.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Text.h"
#include "mozilla/dom/XPathResultBinding.h"
--- a/dom/xslt/xpath/XPathResult.cpp
+++ b/dom/xslt/xpath/XPathResult.cpp
@@ -5,17 +5,16 @@
#include "XPathResult.h"
#include "txExprResult.h"
#include "txNodeSet.h"
#include "nsError.h"
#include "mozilla/dom/Attr.h"
#include "mozilla/dom/Element.h"
#include "nsIDOMNode.h"
-#include "nsIDOMDocument.h"
#include "nsDOMString.h"
#include "txXPathTreeWalker.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/dom/XPathResultBinding.h"
namespace mozilla {
namespace dom {
--- a/dom/xslt/xpath/txMozillaXPathTreeWalker.cpp
+++ b/dom/xslt/xpath/txMozillaXPathTreeWalker.cpp
@@ -1,17 +1,16 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "txXPathTreeWalker.h"
#include "nsAtom.h"
#include "nsIAttribute.h"
-#include "nsIDOMDocument.h"
#include "nsINode.h"
#include "nsPrintfCString.h"
#include "nsReadableUtils.h"
#include "nsString.h"
#include "nsTextFragment.h"
#include "txXMLUtils.h"
#include "txLog.h"
#include "nsUnicharUtils.h"
@@ -677,20 +676,19 @@ txXPathNativeNode::createXPathNode(nsINo
}
}
return new txXPathNode(aNode, index, root);
}
/* static */
txXPathNode*
-txXPathNativeNode::createXPathNode(nsIDOMDocument* aDocument)
+txXPathNativeNode::createXPathNode(nsIDocument* aDocument)
{
- nsCOMPtr<nsIDocument> document = do_QueryInterface(aDocument);
- return new txXPathNode(document);
+ return new txXPathNode(aDocument);
}
/* static */
nsINode*
txXPathNativeNode::getNode(const txXPathNode& aNode)
{
if (!aNode.isAttribute()) {
return aNode.mNode;
--- a/dom/xslt/xpath/txXPathTreeWalker.h
+++ b/dom/xslt/xpath/txXPathTreeWalker.h
@@ -7,17 +7,16 @@
#define txXPathTreeWalker_h__
#include "txCore.h"
#include "txXPathNode.h"
#include "nsIContentInlines.h"
#include "nsTArray.h"
class nsAtom;
-class nsIDOMDocument;
class txXPathTreeWalker
{
public:
txXPathTreeWalker(const txXPathTreeWalker& aOther);
explicit txXPathTreeWalker(const txXPathNode& aNode);
bool getAttr(nsAtom* aLocalName, int32_t aNSID, nsAString& aValue) const;
@@ -92,17 +91,17 @@ public:
class txXPathNativeNode
{
public:
static txXPathNode* createXPathNode(nsINode* aNode,
bool aKeepRootAlive = false);
static txXPathNode* createXPathNode(nsIContent* aContent,
bool aKeepRootAlive = false);
- static txXPathNode* createXPathNode(nsIDOMDocument* aDocument);
+ static txXPathNode* createXPathNode(nsIDocument* aDocument);
static nsINode* getNode(const txXPathNode& aNode);
static nsresult getNode(const txXPathNode& aNode, nsIDOMNode** aResult)
{
return CallQueryInterface(getNode(aNode), aResult);
}
static nsIContent* getContent(const txXPathNode& aNode);
static nsIDocument* getDocument(const txXPathNode& aNode);
static void addRef(const txXPathNode& aNode)
--- a/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
+++ b/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
@@ -1,17 +1,16 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsCOMArray.h"
#include "nsIAuthPrompt.h"
#include "nsIDOMNode.h"
-#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIExpatSink.h"
#include "nsIChannelEventSink.h"
#include "nsIInterfaceRequestor.h"
#include "nsILoadGroup.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsIRequestObserver.h"
--- a/dom/xslt/xslt/txMozillaTextOutput.cpp
+++ b/dom/xslt/xslt/txMozillaTextOutput.cpp
@@ -2,17 +2,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "txMozillaTextOutput.h"
#include "nsContentCID.h"
#include "nsIContent.h"
#include "nsIDocument.h"
-#include "nsIDOMDocument.h"
#include "nsIDocumentTransformer.h"
#include "nsCharsetSource.h"
#include "nsIPrincipal.h"
#include "txURIUtils.h"
#include "nsContentCreatorFunctions.h"
#include "nsContentUtils.h"
#include "nsGkAtoms.h"
#include "mozilla/Encoding.h"
@@ -245,19 +244,19 @@ txMozillaTextOutput::startElement(nsAtom
nsresult
txMozillaTextOutput::startElement(nsAtom* aPrefix, const nsAString& aName,
const int32_t aNsID)
{
return NS_OK;
}
-void txMozillaTextOutput::getOutputDocument(nsIDOMDocument** aDocument)
+void txMozillaTextOutput::getOutputDocument(nsIDocument** aDocument)
{
- CallQueryInterface(mDocument, aDocument);
+ NS_IF_ADDREF(*aDocument = mDocument);
}
nsresult
txMozillaTextOutput::createXHTMLElement(nsAtom* aName, Element** aResult)
{
nsCOMPtr<Element> element = mDocument->CreateHTMLElement(aName);
element.forget(aResult);
return NS_OK;
--- a/dom/xslt/xslt/txMozillaXMLOutput.cpp
+++ b/dom/xslt/xslt/txMozillaXMLOutput.cpp
@@ -2,17 +2,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "txMozillaXMLOutput.h"
#include "nsIDocument.h"
#include "nsIDocShell.h"
-#include "nsIDOMDocument.h"
#include "nsIScriptElement.h"
#include "nsCharsetSource.h"
#include "nsIRefreshURI.h"
#include "nsPIDOMWindow.h"
#include "nsIContent.h"
#include "nsContentCID.h"
#include "nsUnicharUtils.h"
#include "nsGkAtoms.h"
@@ -358,19 +357,19 @@ txMozillaXMLOutput::endElement()
mCurrentNode = parent;
mTableState =
static_cast<TableState>(NS_PTR_TO_INT32(mTableStateStack.pop()));
return NS_OK;
}
-void txMozillaXMLOutput::getOutputDocument(nsIDOMDocument** aDocument)
+void txMozillaXMLOutput::getOutputDocument(nsIDocument** aDocument)
{
- CallQueryInterface(mDocument, aDocument);
+ NS_IF_ADDREF(*aDocument = mDocument);
}
nsresult
txMozillaXMLOutput::processingInstruction(const nsString& aTarget, const nsString& aData)
{
nsresult rv = closePrevious(true);
NS_ENSURE_SUCCESS(rv, rv);
--- a/dom/xslt/xslt/txMozillaXMLOutput.h
+++ b/dom/xslt/xslt/txMozillaXMLOutput.h
@@ -12,17 +12,16 @@
#include "txOutputFormat.h"
#include "nsCOMArray.h"
#include "nsICSSLoaderObserver.h"
#include "txStack.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/Element.h"
class nsIContent;
-class nsIDOMDocument;
class nsAtom;
class nsITransformObserver;
class nsNodeInfoManager;
class nsIDocument;
class nsINode;
namespace mozilla {
namespace dom {
--- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
+++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
@@ -4,17 +4,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "txMozillaXSLTProcessor.h"
#include "nsContentCID.h"
#include "nsError.h"
#include "nsIChannel.h"
#include "mozilla/dom/Element.h"
#include "nsIDocument.h"
-#include "nsIDOMDocument.h"
#include "nsIIOService.h"
#include "nsILoadGroup.h"
#include "nsIStringBundle.h"
#include "nsIURI.h"
#include "nsMemory.h"
#include "XPathResult.h"
#include "txExecutionState.h"
#include "txMozillaTextOutput.h"
@@ -672,19 +671,18 @@ txMozillaXSLTProcessor::TransformToDoc(n
if (NS_SUCCEEDED(rv)) {
rv = endRv;
}
if (NS_SUCCEEDED(rv)) {
if (aResult) {
txAOutputXMLEventHandler* handler =
static_cast<txAOutputXMLEventHandler*>(es.mOutputHandler);
- nsCOMPtr<nsIDOMDocument> result;
- handler->getOutputDocument(getter_AddRefs(result));
- nsCOMPtr<nsIDocument> doc = do_QueryInterface(result);
+ nsCOMPtr<nsIDocument> doc;
+ handler->getOutputDocument(getter_AddRefs(doc));
MOZ_ASSERT(doc->GetReadyStateEnum() ==
nsIDocument::READYSTATE_INTERACTIVE, "Bad readyState");
doc->SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE);
doc.forget(aResult);
}
}
else if (mObserver) {
// XXX set up context information, bug 204655
--- a/dom/xslt/xslt/txXMLEventHandler.h
+++ b/dom/xslt/xslt/txXMLEventHandler.h
@@ -8,17 +8,17 @@
#include "txCore.h"
#include "nsAtom.h"
#define kTXNameSpaceURI "http://www.mozilla.org/TransforMiix"
#define kTXWrapper "transformiix:result"
class txOutputFormat;
-class nsIDOMDocument;
+class nsIDocument;
/**
* An interface for handling XML documents, loosely modeled
* after Dave Megginson's SAX 1.0 API.
*/
class txAXMLEventHandler
{
@@ -144,21 +144,21 @@ public:
class txAOutputXMLEventHandler : public txAXMLEventHandler
{
public:
/**
* Gets the Mozilla output document
*
* @param aDocument the Mozilla output document
*/
- virtual void getOutputDocument(nsIDOMDocument** aDocument) = 0;
+ virtual void getOutputDocument(nsIDocument** aDocument) = 0;
};
#define TX_DECL_TXAOUTPUTXMLEVENTHANDLER \
- virtual void getOutputDocument(nsIDOMDocument** aDocument) override;
+ virtual void getOutputDocument(nsIDocument** aDocument) override;
/**
* Interface used to create the appropriate outputhandler
*/
class txAOutputHandlerFactory
{
public:
virtual ~txAOutputHandlerFactory() {}