mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-15 06:20:41 +00:00
Bug 1029104 - Convert XPathExpression to WebIDL bindings, move files and rename class. r=bz.
--HG-- rename : dom/xslt/xpath/nsXPathExpression.cpp => dom/xslt/xpath/XPathExpression.cpp rename : dom/xslt/xpath/nsXPathExpression.h => dom/xslt/xpath/XPathExpression.h extra : rebase_source : bedd3da79f1a4c2df19cfe3e9b68f1270b0b5688
This commit is contained in:
parent
0fe9268fa3
commit
f857218f32
@ -7,7 +7,7 @@
|
||||
#include "mozilla/Move.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsXPathExpression.h"
|
||||
#include "mozilla/dom/XPathExpression.h"
|
||||
#include "nsXPathNSResolver.h"
|
||||
#include "XPathResult.h"
|
||||
#include "nsContentCID.h"
|
||||
@ -129,7 +129,7 @@ XPathEvaluator::CreateExpression(const nsAString & aExpression,
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> document = do_QueryReferent(mDocument);
|
||||
|
||||
*aResult = new nsXPathExpression(Move(expression), mRecycler, document);
|
||||
*aResult = new XPathExpression(Move(expression), mRecycler, document);
|
||||
if (!*aResult) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/Move.h"
|
||||
#include "nsXPathExpression.h"
|
||||
#include "XPathExpression.h"
|
||||
#include "txExpr.h"
|
||||
#include "txExprResult.h"
|
||||
#include "nsError.h"
|
||||
@ -15,26 +15,28 @@
|
||||
#include "txURIUtils.h"
|
||||
#include "txXPathTreeWalker.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using mozilla::Move;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(nsXPathExpression, mDocument)
|
||||
DOMCI_DATA(XPathExpression, mozilla::dom::XPathExpression)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXPathExpression)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXPathExpression)
|
||||
NS_IMPL_CYCLE_COLLECTION(XPathExpression, mDocument)
|
||||
|
||||
DOMCI_DATA(XPathExpression, nsXPathExpression)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(XPathExpression)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(XPathExpression)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXPathExpression)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(XPathExpression)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMXPathExpression)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSXPathExpression)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathExpression)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XPathExpression)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsXPathExpression::nsXPathExpression(nsAutoPtr<Expr>&& aExpression,
|
||||
txResultRecycler* aRecycler,
|
||||
nsIDOMDocument *aDocument)
|
||||
XPathExpression::XPathExpression(nsAutoPtr<Expr>&& aExpression,
|
||||
txResultRecycler* aRecycler,
|
||||
nsIDOMDocument *aDocument)
|
||||
: mExpression(Move(aExpression)),
|
||||
mRecycler(aRecycler),
|
||||
mDocument(aDocument)
|
||||
@ -42,21 +44,21 @@ nsXPathExpression::nsXPathExpression(nsAutoPtr<Expr>&& aExpression,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPathExpression::Evaluate(nsIDOMNode *aContextNode,
|
||||
uint16_t aType,
|
||||
nsISupports *aInResult,
|
||||
nsISupports **aResult)
|
||||
XPathExpression::Evaluate(nsIDOMNode *aContextNode,
|
||||
uint16_t aType,
|
||||
nsISupports *aInResult,
|
||||
nsISupports **aResult)
|
||||
{
|
||||
return EvaluateWithContext(aContextNode, 1, 1, aType, aInResult, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPathExpression::EvaluateWithContext(nsIDOMNode *aContextNode,
|
||||
uint32_t aContextPosition,
|
||||
uint32_t aContextSize,
|
||||
uint16_t aType,
|
||||
nsISupports *aInResult,
|
||||
nsISupports **aResult)
|
||||
XPathExpression::EvaluateWithContext(nsIDOMNode *aContextNode,
|
||||
uint32_t aContextPosition,
|
||||
uint32_t aContextSize,
|
||||
uint16_t aType,
|
||||
nsISupports *aInResult,
|
||||
nsISupports **aResult)
|
||||
{
|
||||
nsCOMPtr<nsINode> context = do_QueryInterface(aContextNode);
|
||||
NS_ENSURE_ARG(context);
|
||||
@ -150,53 +152,63 @@ nsXPathExpression::EvaluateWithContext(nsIDOMNode *aContextNode,
|
||||
}
|
||||
|
||||
/*
|
||||
* Implementation of the txIEvalContext private to nsXPathExpression
|
||||
* Implementation of the txIEvalContext private to XPathExpression
|
||||
* EvalContextImpl bases on only one context node and no variables
|
||||
*/
|
||||
|
||||
nsresult
|
||||
nsXPathExpression::EvalContextImpl::getVariable(int32_t aNamespace,
|
||||
nsIAtom* aLName,
|
||||
txAExprResult*& aResult)
|
||||
XPathExpression::EvalContextImpl::getVariable(int32_t aNamespace,
|
||||
nsIAtom* aLName,
|
||||
txAExprResult*& aResult)
|
||||
{
|
||||
aResult = 0;
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
bool nsXPathExpression::EvalContextImpl::isStripSpaceAllowed(const txXPathNode& aNode)
|
||||
bool
|
||||
XPathExpression::EvalContextImpl::isStripSpaceAllowed(const txXPathNode& aNode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void* nsXPathExpression::EvalContextImpl::getPrivateContext()
|
||||
void*
|
||||
XPathExpression::EvalContextImpl::getPrivateContext()
|
||||
{
|
||||
// we don't have a private context here.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
txResultRecycler* nsXPathExpression::EvalContextImpl::recycler()
|
||||
txResultRecycler*
|
||||
XPathExpression::EvalContextImpl::recycler()
|
||||
{
|
||||
return mRecycler;
|
||||
}
|
||||
|
||||
void nsXPathExpression::EvalContextImpl::receiveError(const nsAString& aMsg,
|
||||
nsresult aRes)
|
||||
void
|
||||
XPathExpression::EvalContextImpl::receiveError(const nsAString& aMsg,
|
||||
nsresult aRes)
|
||||
{
|
||||
mLastError = aRes;
|
||||
// forward aMsg to console service?
|
||||
}
|
||||
|
||||
const txXPathNode& nsXPathExpression::EvalContextImpl::getContextNode()
|
||||
const txXPathNode&
|
||||
XPathExpression::EvalContextImpl::getContextNode()
|
||||
{
|
||||
return mContextNode;
|
||||
}
|
||||
|
||||
uint32_t nsXPathExpression::EvalContextImpl::size()
|
||||
uint32_t
|
||||
XPathExpression::EvalContextImpl::size()
|
||||
{
|
||||
return mContextSize;
|
||||
}
|
||||
|
||||
uint32_t nsXPathExpression::EvalContextImpl::position()
|
||||
uint32_t
|
||||
XPathExpression::EvalContextImpl::position()
|
||||
{
|
||||
return mContextPosition;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
@ -3,8 +3,8 @@
|
||||
* 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/. */
|
||||
|
||||
#ifndef nsXPathExpression_h__
|
||||
#define nsXPathExpression_h__
|
||||
#ifndef mozilla_dom_XPathExpression_h
|
||||
#define mozilla_dom_XPathExpression_h
|
||||
|
||||
#include "nsIDOMXPathExpression.h"
|
||||
#include "nsIDOMNSXPathExpression.h"
|
||||
@ -17,19 +17,22 @@
|
||||
class Expr;
|
||||
class txXPathNode;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
/**
|
||||
* A class for evaluating an XPath expression string
|
||||
*/
|
||||
class nsXPathExpression MOZ_FINAL : public nsIDOMXPathExpression,
|
||||
public nsIDOMNSXPathExpression
|
||||
class XPathExpression MOZ_FINAL : public nsIDOMXPathExpression,
|
||||
public nsIDOMNSXPathExpression
|
||||
{
|
||||
public:
|
||||
nsXPathExpression(nsAutoPtr<Expr>&& aExpression, txResultRecycler* aRecycler,
|
||||
nsIDOMDocument *aDocument);
|
||||
XPathExpression(nsAutoPtr<Expr>&& aExpression, txResultRecycler* aRecycler,
|
||||
nsIDOMDocument *aDocument);
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXPathExpression,
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(XPathExpression,
|
||||
nsIDOMXPathExpression)
|
||||
|
||||
// nsIDOMXPathExpression interface
|
||||
@ -75,4 +78,7 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* mozilla_dom_XPathExpression_h */
|
@ -6,11 +6,11 @@
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'XPathEvaluator.h',
|
||||
'XPathExpression.h',
|
||||
'XPathResult.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'nsXPathExpression.cpp',
|
||||
'nsXPathNSResolver.cpp',
|
||||
'txBooleanExpr.cpp',
|
||||
'txBooleanResult.cpp',
|
||||
@ -47,6 +47,7 @@ UNIFIED_SOURCES += [
|
||||
'txXPathOptimizer.cpp',
|
||||
'txXPCOMExtensionFunction.cpp',
|
||||
'XPathEvaluator.cpp',
|
||||
'XPathExpression.cpp',
|
||||
'XPathResult.cpp',
|
||||
]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user