mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07: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
bd5d23028e
commit
41a6dc5302
@ -7,7 +7,7 @@
|
|||||||
#include "mozilla/Move.h"
|
#include "mozilla/Move.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIAtom.h"
|
#include "nsIAtom.h"
|
||||||
#include "nsXPathExpression.h"
|
#include "mozilla/dom/XPathExpression.h"
|
||||||
#include "nsXPathNSResolver.h"
|
#include "nsXPathNSResolver.h"
|
||||||
#include "XPathResult.h"
|
#include "XPathResult.h"
|
||||||
#include "nsContentCID.h"
|
#include "nsContentCID.h"
|
||||||
@ -129,7 +129,7 @@ XPathEvaluator::CreateExpression(const nsAString & aExpression,
|
|||||||
|
|
||||||
nsCOMPtr<nsIDOMDocument> document = do_QueryReferent(mDocument);
|
nsCOMPtr<nsIDOMDocument> document = do_QueryReferent(mDocument);
|
||||||
|
|
||||||
*aResult = new nsXPathExpression(Move(expression), mRecycler, document);
|
*aResult = new XPathExpression(Move(expression), mRecycler, document);
|
||||||
if (!*aResult) {
|
if (!*aResult) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "mozilla/Move.h"
|
#include "mozilla/Move.h"
|
||||||
#include "nsXPathExpression.h"
|
#include "XPathExpression.h"
|
||||||
#include "txExpr.h"
|
#include "txExpr.h"
|
||||||
#include "txExprResult.h"
|
#include "txExprResult.h"
|
||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
@ -15,26 +15,28 @@
|
|||||||
#include "txURIUtils.h"
|
#include "txURIUtils.h"
|
||||||
#include "txXPathTreeWalker.h"
|
#include "txXPathTreeWalker.h"
|
||||||
|
|
||||||
using namespace mozilla::dom;
|
|
||||||
using mozilla::Move;
|
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_COLLECTION(XPathExpression, mDocument)
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXPathExpression)
|
|
||||||
|
|
||||||
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(nsIDOMXPathExpression)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSXPathExpression)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNSXPathExpression)
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathExpression)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathExpression)
|
||||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XPathExpression)
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XPathExpression)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
nsXPathExpression::nsXPathExpression(nsAutoPtr<Expr>&& aExpression,
|
XPathExpression::XPathExpression(nsAutoPtr<Expr>&& aExpression,
|
||||||
txResultRecycler* aRecycler,
|
txResultRecycler* aRecycler,
|
||||||
nsIDOMDocument *aDocument)
|
nsIDOMDocument *aDocument)
|
||||||
: mExpression(Move(aExpression)),
|
: mExpression(Move(aExpression)),
|
||||||
mRecycler(aRecycler),
|
mRecycler(aRecycler),
|
||||||
mDocument(aDocument)
|
mDocument(aDocument)
|
||||||
@ -42,21 +44,21 @@ nsXPathExpression::nsXPathExpression(nsAutoPtr<Expr>&& aExpression,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsXPathExpression::Evaluate(nsIDOMNode *aContextNode,
|
XPathExpression::Evaluate(nsIDOMNode *aContextNode,
|
||||||
uint16_t aType,
|
uint16_t aType,
|
||||||
nsISupports *aInResult,
|
nsISupports *aInResult,
|
||||||
nsISupports **aResult)
|
nsISupports **aResult)
|
||||||
{
|
{
|
||||||
return EvaluateWithContext(aContextNode, 1, 1, aType, aInResult, aResult);
|
return EvaluateWithContext(aContextNode, 1, 1, aType, aInResult, aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsXPathExpression::EvaluateWithContext(nsIDOMNode *aContextNode,
|
XPathExpression::EvaluateWithContext(nsIDOMNode *aContextNode,
|
||||||
uint32_t aContextPosition,
|
uint32_t aContextPosition,
|
||||||
uint32_t aContextSize,
|
uint32_t aContextSize,
|
||||||
uint16_t aType,
|
uint16_t aType,
|
||||||
nsISupports *aInResult,
|
nsISupports *aInResult,
|
||||||
nsISupports **aResult)
|
nsISupports **aResult)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsINode> context = do_QueryInterface(aContextNode);
|
nsCOMPtr<nsINode> context = do_QueryInterface(aContextNode);
|
||||||
NS_ENSURE_ARG(context);
|
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
|
* EvalContextImpl bases on only one context node and no variables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsXPathExpression::EvalContextImpl::getVariable(int32_t aNamespace,
|
XPathExpression::EvalContextImpl::getVariable(int32_t aNamespace,
|
||||||
nsIAtom* aLName,
|
nsIAtom* aLName,
|
||||||
txAExprResult*& aResult)
|
txAExprResult*& aResult)
|
||||||
{
|
{
|
||||||
aResult = 0;
|
aResult = 0;
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsXPathExpression::EvalContextImpl::isStripSpaceAllowed(const txXPathNode& aNode)
|
bool
|
||||||
|
XPathExpression::EvalContextImpl::isStripSpaceAllowed(const txXPathNode& aNode)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* nsXPathExpression::EvalContextImpl::getPrivateContext()
|
void*
|
||||||
|
XPathExpression::EvalContextImpl::getPrivateContext()
|
||||||
{
|
{
|
||||||
// we don't have a private context here.
|
// we don't have a private context here.
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
txResultRecycler* nsXPathExpression::EvalContextImpl::recycler()
|
txResultRecycler*
|
||||||
|
XPathExpression::EvalContextImpl::recycler()
|
||||||
{
|
{
|
||||||
return mRecycler;
|
return mRecycler;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsXPathExpression::EvalContextImpl::receiveError(const nsAString& aMsg,
|
void
|
||||||
nsresult aRes)
|
XPathExpression::EvalContextImpl::receiveError(const nsAString& aMsg,
|
||||||
|
nsresult aRes)
|
||||||
{
|
{
|
||||||
mLastError = aRes;
|
mLastError = aRes;
|
||||||
// forward aMsg to console service?
|
// forward aMsg to console service?
|
||||||
}
|
}
|
||||||
|
|
||||||
const txXPathNode& nsXPathExpression::EvalContextImpl::getContextNode()
|
const txXPathNode&
|
||||||
|
XPathExpression::EvalContextImpl::getContextNode()
|
||||||
{
|
{
|
||||||
return mContextNode;
|
return mContextNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nsXPathExpression::EvalContextImpl::size()
|
uint32_t
|
||||||
|
XPathExpression::EvalContextImpl::size()
|
||||||
{
|
{
|
||||||
return mContextSize;
|
return mContextSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nsXPathExpression::EvalContextImpl::position()
|
uint32_t
|
||||||
|
XPathExpression::EvalContextImpl::position()
|
||||||
{
|
{
|
||||||
return mContextPosition;
|
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
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef nsXPathExpression_h__
|
#ifndef mozilla_dom_XPathExpression_h
|
||||||
#define nsXPathExpression_h__
|
#define mozilla_dom_XPathExpression_h
|
||||||
|
|
||||||
#include "nsIDOMXPathExpression.h"
|
#include "nsIDOMXPathExpression.h"
|
||||||
#include "nsIDOMNSXPathExpression.h"
|
#include "nsIDOMNSXPathExpression.h"
|
||||||
@ -17,19 +17,22 @@
|
|||||||
class Expr;
|
class Expr;
|
||||||
class txXPathNode;
|
class txXPathNode;
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class for evaluating an XPath expression string
|
* A class for evaluating an XPath expression string
|
||||||
*/
|
*/
|
||||||
class nsXPathExpression MOZ_FINAL : public nsIDOMXPathExpression,
|
class XPathExpression MOZ_FINAL : public nsIDOMXPathExpression,
|
||||||
public nsIDOMNSXPathExpression
|
public nsIDOMNSXPathExpression
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsXPathExpression(nsAutoPtr<Expr>&& aExpression, txResultRecycler* aRecycler,
|
XPathExpression(nsAutoPtr<Expr>&& aExpression, txResultRecycler* aRecycler,
|
||||||
nsIDOMDocument *aDocument);
|
nsIDOMDocument *aDocument);
|
||||||
|
|
||||||
// nsISupports interface
|
// nsISupports interface
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXPathExpression,
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(XPathExpression,
|
||||||
nsIDOMXPathExpression)
|
nsIDOMXPathExpression)
|
||||||
|
|
||||||
// nsIDOMXPathExpression interface
|
// nsIDOMXPathExpression interface
|
||||||
@ -75,4 +78,7 @@ private:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif /* mozilla_dom_XPathExpression_h */
|
@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
EXPORTS.mozilla.dom += [
|
EXPORTS.mozilla.dom += [
|
||||||
'XPathEvaluator.h',
|
'XPathEvaluator.h',
|
||||||
|
'XPathExpression.h',
|
||||||
'XPathResult.h',
|
'XPathResult.h',
|
||||||
]
|
]
|
||||||
|
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'nsXPathExpression.cpp',
|
|
||||||
'nsXPathNSResolver.cpp',
|
'nsXPathNSResolver.cpp',
|
||||||
'txBooleanExpr.cpp',
|
'txBooleanExpr.cpp',
|
||||||
'txBooleanResult.cpp',
|
'txBooleanResult.cpp',
|
||||||
@ -47,6 +47,7 @@ UNIFIED_SOURCES += [
|
|||||||
'txXPathOptimizer.cpp',
|
'txXPathOptimizer.cpp',
|
||||||
'txXPCOMExtensionFunction.cpp',
|
'txXPCOMExtensionFunction.cpp',
|
||||||
'XPathEvaluator.cpp',
|
'XPathEvaluator.cpp',
|
||||||
|
'XPathExpression.cpp',
|
||||||
'XPathResult.cpp',
|
'XPathResult.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user