/src/mozilla-central/accessible/generic/BaseAccessibles.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 2; 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/. */ |
5 | | |
6 | | #ifndef mozilla_a11y_BaseAccessibles_h__ |
7 | | #define mozilla_a11y_BaseAccessibles_h__ |
8 | | |
9 | | #include "AccessibleWrap.h" |
10 | | #include "HyperTextAccessibleWrap.h" |
11 | | |
12 | | class nsIContent; |
13 | | |
14 | | /** |
15 | | * This file contains a number of classes that are used as base |
16 | | * classes for the different accessibility implementations of |
17 | | * the HTML and XUL widget sets. --jgaunt |
18 | | */ |
19 | | |
20 | | namespace mozilla { |
21 | | namespace a11y { |
22 | | |
23 | | /** |
24 | | * Leaf version of DOM Accessible -- has no children |
25 | | */ |
26 | | class LeafAccessible : public AccessibleWrap |
27 | | { |
28 | | public: |
29 | | |
30 | | LeafAccessible(nsIContent* aContent, DocAccessible* aDoc); |
31 | | |
32 | | // nsISupports |
33 | | NS_INLINE_DECL_REFCOUNTING_INHERITED(LeafAccessible, AccessibleWrap) |
34 | | |
35 | | // Accessible |
36 | | virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY, |
37 | | EWhichChildAtPoint aWhichChild) override; |
38 | | bool InsertChildAt(uint32_t aIndex, Accessible* aChild) final; |
39 | | bool RemoveChild(Accessible* aChild) final; |
40 | | |
41 | | virtual bool IsAcceptableChild(nsIContent* aEl) const override; |
42 | | |
43 | | protected: |
44 | 0 | virtual ~LeafAccessible() {} |
45 | | }; |
46 | | |
47 | | /** |
48 | | * Used for text or image accessible nodes contained by link accessibles or |
49 | | * accessibles for nodes with registered click event handler. It knows how to |
50 | | * report the state of the host link (traveled or not) and can activate (click) |
51 | | * the host accessible programmatically. |
52 | | */ |
53 | | class LinkableAccessible : public AccessibleWrap |
54 | | { |
55 | | public: |
56 | | enum { eAction_Jump = 0 }; |
57 | | |
58 | | LinkableAccessible(nsIContent* aContent, DocAccessible* aDoc) : |
59 | | AccessibleWrap(aContent, aDoc) |
60 | 0 | { |
61 | 0 | } |
62 | | |
63 | | NS_INLINE_DECL_REFCOUNTING_INHERITED(LinkableAccessible, AccessibleWrap) |
64 | | |
65 | | // Accessible |
66 | | virtual void Value(nsString& aValue) const override; |
67 | | virtual uint64_t NativeLinkState() const override; |
68 | | virtual void TakeFocus() const override; |
69 | | |
70 | | // ActionAccessible |
71 | | virtual uint8_t ActionCount() const override; |
72 | | virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override; |
73 | | virtual bool DoAction(uint8_t index) const override; |
74 | | virtual KeyBinding AccessKey() const override; |
75 | | |
76 | | // ActionAccessible helpers |
77 | | const Accessible* ActionWalk(bool* aIsLink = nullptr, |
78 | | bool* aIsOnclick = nullptr, |
79 | | bool* aIsLabelWithControl = nullptr) const; |
80 | | // HyperLinkAccessible |
81 | | virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex) const override; |
82 | | |
83 | | protected: |
84 | 0 | virtual ~LinkableAccessible() {} |
85 | | |
86 | | }; |
87 | | |
88 | | /** |
89 | | * A simple accessible that gets its enumerated role. |
90 | | */ |
91 | | template<a11y::role R> |
92 | | class EnumRoleAccessible : public AccessibleWrap |
93 | | { |
94 | | public: |
95 | | EnumRoleAccessible(nsIContent* aContent, DocAccessible* aDoc) : |
96 | 0 | AccessibleWrap(aContent, aDoc) { } Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)69>::EnumRoleAccessible(nsIContent*, mozilla::a11y::DocAccessible*) Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)16>::EnumRoleAccessible(nsIContent*, mozilla::a11y::DocAccessible*) Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)107>::EnumRoleAccessible(nsIContent*, mozilla::a11y::DocAccessible*) Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)20>::EnumRoleAccessible(nsIContent*, mozilla::a11y::DocAccessible*) Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)40>::EnumRoleAccessible(nsIContent*, mozilla::a11y::DocAccessible*) Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)53>::EnumRoleAccessible(nsIContent*, mozilla::a11y::DocAccessible*) |
97 | | |
98 | | NS_IMETHOD QueryInterface(REFNSIID aIID, void** aPtr) override |
99 | 0 | { return Accessible::QueryInterface(aIID, aPtr); } Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)69>::QueryInterface(nsID const&, void**) Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)16>::QueryInterface(nsID const&, void**) Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)107>::QueryInterface(nsID const&, void**) Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)20>::QueryInterface(nsID const&, void**) Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)40>::QueryInterface(nsID const&, void**) Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)53>::QueryInterface(nsID const&, void**) |
100 | | |
101 | | // Accessible |
102 | 0 | virtual a11y::role NativeRole() const override { return R; } Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)69>::NativeRole() const Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)16>::NativeRole() const Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)107>::NativeRole() const Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)20>::NativeRole() const Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)40>::NativeRole() const Unexecuted instantiation: mozilla::a11y::EnumRoleAccessible<(mozilla::a11y::roles::Role)53>::NativeRole() const |
103 | | |
104 | | protected: |
105 | | virtual ~EnumRoleAccessible() { } |
106 | | }; |
107 | | |
108 | | |
109 | | /** |
110 | | * A wrapper accessible around native accessible to connect it with |
111 | | * crossplatform accessible tree. |
112 | | */ |
113 | | class DummyAccessible : public AccessibleWrap |
114 | | { |
115 | | public: |
116 | | explicit DummyAccessible(DocAccessible* aDocument = nullptr) : |
117 | 0 | AccessibleWrap(nullptr, aDocument) { } |
118 | | |
119 | | uint64_t NativeState() const final; |
120 | | uint64_t NativeInteractiveState() const final; |
121 | | uint64_t NativeLinkState() const final; |
122 | | bool NativelyUnavailable() const final; |
123 | | void ApplyARIAState(uint64_t* aState) const final; |
124 | | |
125 | | protected: |
126 | 0 | virtual ~DummyAccessible() { } |
127 | | }; |
128 | | |
129 | | } // namespace a11y |
130 | | } // namespace mozilla |
131 | | |
132 | | #endif |