Line data Source code
1 : /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
2 : /* vim: set ts=2 et sw=2 tw=40: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef A11Y_AOM_ACCESSIBLENODE_H
8 : #define A11Y_AOM_ACCESSIBLENODE_H
9 :
10 : #include "nsWrapperCache.h"
11 : #include "mozilla/ErrorResult.h"
12 : #include "mozilla/dom/BindingDeclarations.h"
13 :
14 : class nsINode;
15 :
16 : namespace mozilla {
17 :
18 : namespace a11y {
19 : class Accessible;
20 : }
21 :
22 : namespace dom {
23 :
24 : class DOMStringList;
25 : struct ParentObject;
26 :
27 : class AccessibleNode : public nsISupports,
28 : public nsWrapperCache
29 : {
30 : public:
31 : explicit AccessibleNode(nsINode* aNode);
32 :
33 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS;
34 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AccessibleNode);
35 :
36 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override final;
37 : virtual dom::ParentObject GetParentObject() const final;
38 :
39 : void GetRole(nsAString& aRole);
40 : void GetStates(nsTArray<nsString>& aStates);
41 : void GetAttributes(nsTArray<nsString>& aAttributes);
42 : nsINode* GetDOMNode();
43 :
44 : bool Is(const Sequence<nsString>& aFlavors);
45 : bool Has(const Sequence<nsString>& aAttributes);
46 : void Get(JSContext* cx, const nsAString& aAttribute,
47 : JS::MutableHandle<JS::Value> aValue,
48 : ErrorResult& aRv);
49 :
50 : a11y::Accessible* Internal() const { return mIntl; }
51 :
52 : protected:
53 : AccessibleNode(const AccessibleNode& aCopy) = delete;
54 : AccessibleNode& operator=(const AccessibleNode& aCopy) = delete;
55 : virtual ~AccessibleNode();
56 :
57 : RefPtr<a11y::Accessible> mIntl;
58 : RefPtr<nsINode> mDOMNode;
59 : RefPtr<dom::DOMStringList> mStates;
60 : };
61 :
62 : } // dom
63 : } // mozilla
64 :
65 :
66 : #endif // A11Y_JSAPI_ACCESSIBLENODE
|