Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / dom / xslt / xpath / XPathExpression.h
blobe041649395abe713da1fc709ce3e172548a7716d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_dom_XPathExpression_h
7 #define mozilla_dom_XPathExpression_h
9 #include "nsCycleCollectionParticipant.h"
10 #include "nsIWeakReferenceUtils.h"
11 #include "mozilla/Attributes.h"
12 #include "mozilla/dom/NonRefcountedDOMObject.h"
13 #include "mozilla/dom/XPathExpressionBinding.h"
14 #include "mozilla/UniquePtr.h"
16 class Expr;
18 class nsINode;
19 class txResultRecycler;
21 namespace mozilla::dom {
23 class Document;
24 class XPathResult;
26 /**
27 * A class for evaluating an XPath expression string
29 class XPathExpression final : public NonRefcountedDOMObject {
30 public:
31 XPathExpression(mozilla::UniquePtr<Expr>&& aExpression,
32 txResultRecycler* aRecycler, Document* aDocument);
33 ~XPathExpression();
35 bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
36 JS::MutableHandle<JSObject*> aReflector) {
37 return XPathExpression_Binding::Wrap(aCx, this, aGivenProto, aReflector);
40 already_AddRefed<XPathResult> Evaluate(JSContext* aCx, nsINode& aContextNode,
41 uint16_t aType,
42 JS::Handle<JSObject*> aInResult,
43 ErrorResult& aRv) {
44 return EvaluateWithContext(aCx, aContextNode, 1, 1, aType, aInResult, aRv);
46 already_AddRefed<XPathResult> EvaluateWithContext(
47 JSContext* aCx, nsINode& aContextNode, uint32_t aContextPosition,
48 uint32_t aContextSize, uint16_t aType, JS::Handle<JSObject*> aInResult,
49 ErrorResult& aRv);
50 already_AddRefed<XPathResult> Evaluate(nsINode& aContextNode, uint16_t aType,
51 XPathResult* aInResult,
52 ErrorResult& aRv) {
53 return EvaluateWithContext(aContextNode, 1, 1, aType, aInResult, aRv);
55 already_AddRefed<XPathResult> EvaluateWithContext(
56 nsINode& aContextNode, uint32_t aContextPosition, uint32_t aContextSize,
57 uint16_t aType, XPathResult* aInResult, ErrorResult& aRv);
59 private:
60 mozilla::UniquePtr<Expr> mExpression;
61 RefPtr<txResultRecycler> mRecycler;
62 nsWeakPtr mDocument;
63 bool mCheckDocument;
66 } // namespace mozilla::dom
68 #endif /* mozilla_dom_XPathExpression_h */