2005-11-02 07:35:22 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2005-11-02 07:35:22 +00:00
|
|
|
|
2013-08-23 21:11:30 +00:00
|
|
|
#ifndef mozilla_dom_XPathEvaluator_h
|
|
|
|
#define mozilla_dom_XPathEvaluator_h
|
2005-11-02 07:35:22 +00:00
|
|
|
|
|
|
|
#include "nsIDOMXPathEvaluator.h"
|
2005-11-02 07:39:53 +00:00
|
|
|
#include "nsIWeakReference.h"
|
2005-11-02 07:40:48 +00:00
|
|
|
#include "nsAutoPtr.h"
|
2006-07-13 14:21:53 +00:00
|
|
|
#include "nsString.h"
|
2012-06-19 02:30:09 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-12-14 19:10:49 +00:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2013-07-04 15:39:24 +00:00
|
|
|
#include "nsIDocument.h"
|
2012-12-14 19:10:49 +00:00
|
|
|
|
2013-08-23 21:11:30 +00:00
|
|
|
class nsINode;
|
2013-09-02 16:01:55 +00:00
|
|
|
class txIParseContext;
|
2013-07-04 15:39:24 +00:00
|
|
|
class txResultRecycler;
|
2013-08-23 21:11:30 +00:00
|
|
|
|
2012-12-03 16:07:49 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2013-08-23 21:11:30 +00:00
|
|
|
|
2012-12-03 16:07:49 +00:00
|
|
|
class GlobalObject;
|
2014-06-27 19:39:50 +00:00
|
|
|
class XPathExpression;
|
2014-10-14 14:27:24 +00:00
|
|
|
class XPathNSResolver;
|
2013-07-04 15:40:06 +00:00
|
|
|
class XPathResult;
|
2005-11-02 07:35:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A class for evaluating an XPath expression string
|
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
class XPathEvaluator final : public nsIDOMXPathEvaluator
|
2005-11-02 07:35:22 +00:00
|
|
|
{
|
2014-06-23 19:56:07 +00:00
|
|
|
~XPathEvaluator();
|
|
|
|
|
2005-11-02 07:35:22 +00:00
|
|
|
public:
|
2014-09-02 00:49:25 +00:00
|
|
|
explicit XPathEvaluator(nsIDocument* aDocument = nullptr);
|
2005-11-02 07:42:45 +00:00
|
|
|
|
2013-07-04 15:39:24 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
2005-11-02 07:35:22 +00:00
|
|
|
|
|
|
|
// nsIDOMXPathEvaluator interface
|
|
|
|
NS_DECL_NSIDOMXPATHEVALUATOR
|
|
|
|
|
2012-12-14 19:10:49 +00:00
|
|
|
// WebIDL API
|
Bug 1117172 part 2. Change the non-wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, Codegen.py, and
StructuredClone.cpp. The rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/WrapObject\((JSContext *\* *(?:aCx|cx)),(\s*)(JS::MutableHandle<JSObject\*> aReflector)/WrapObject(\1,\2JS::Handle<JSObject*> aGivenProto,\2\3/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx)), this, aReflector/\1, this, aGivenProto, aReflector/'
2015-03-19 14:13:32 +00:00
|
|
|
bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
|
2014-03-15 19:00:15 +00:00
|
|
|
nsIDocument* GetParentObject()
|
2013-07-04 15:39:24 +00:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
2014-03-15 19:00:15 +00:00
|
|
|
return doc;
|
2013-07-04 15:39:24 +00:00
|
|
|
}
|
2013-08-23 21:11:30 +00:00
|
|
|
static already_AddRefed<XPathEvaluator>
|
|
|
|
Constructor(const GlobalObject& aGlobal, ErrorResult& rv);
|
2014-06-27 19:39:50 +00:00
|
|
|
XPathExpression*
|
2012-12-14 19:10:49 +00:00
|
|
|
CreateExpression(const nsAString& aExpression,
|
2014-10-14 14:27:24 +00:00
|
|
|
XPathNSResolver* aResolver,
|
2013-08-23 21:11:30 +00:00
|
|
|
ErrorResult& rv);
|
2013-09-02 16:01:55 +00:00
|
|
|
XPathExpression*
|
|
|
|
CreateExpression(const nsAString& aExpression,
|
|
|
|
nsINode* aResolver,
|
|
|
|
ErrorResult& aRv);
|
2014-10-14 14:27:24 +00:00
|
|
|
nsINode* CreateNSResolver(nsINode& aNodeResolver)
|
|
|
|
{
|
|
|
|
return &aNodeResolver;
|
|
|
|
}
|
2013-07-04 15:40:06 +00:00
|
|
|
already_AddRefed<XPathResult>
|
|
|
|
Evaluate(JSContext* aCx, const nsAString& aExpression,
|
2014-11-04 09:20:08 +00:00
|
|
|
nsINode& aContextNode, XPathNSResolver* aResolver,
|
2013-07-04 15:40:06 +00:00
|
|
|
uint16_t aType, JS::Handle<JSObject*> aResult,
|
|
|
|
ErrorResult& rv);
|
2005-11-02 07:35:22 +00:00
|
|
|
private:
|
2013-09-02 16:01:55 +00:00
|
|
|
XPathExpression*
|
|
|
|
CreateExpression(const nsAString& aExpression,
|
|
|
|
txIParseContext* aContext,
|
|
|
|
nsIDocument* aDocument,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2005-11-02 07:39:53 +00:00
|
|
|
nsWeakPtr mDocument;
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<txResultRecycler> mRecycler;
|
2005-11-02 07:35:22 +00:00
|
|
|
};
|
|
|
|
|
2013-04-08 21:04:21 +00:00
|
|
|
inline nsISupports*
|
2013-08-23 21:11:30 +00:00
|
|
|
ToSupports(XPathEvaluator* e)
|
2013-04-08 21:04:21 +00:00
|
|
|
{
|
|
|
|
return static_cast<nsIDOMXPathEvaluator*>(e);
|
|
|
|
}
|
|
|
|
|
2005-11-02 07:35:22 +00:00
|
|
|
/* d0a75e02-b5e7-11d5-a7f2-df109fb8a1fc */
|
|
|
|
#define TRANSFORMIIX_XPATH_EVALUATOR_CID \
|
|
|
|
{ 0xd0a75e02, 0xb5e7, 0x11d5, { 0xa7, 0xf2, 0xdf, 0x10, 0x9f, 0xb8, 0xa1, 0xfc } }
|
|
|
|
|
2013-08-23 21:11:30 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_XPathEvaluator_h */
|