|
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_DECL_ISUPPORTS_INHERITED |
|
34 |
|
35 // Accessible |
|
36 virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY, |
|
37 EWhichChildAtPoint aWhichChild); |
|
38 virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL; |
|
39 virtual bool RemoveChild(Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL; |
|
40 |
|
41 protected: |
|
42 |
|
43 // Accessible |
|
44 virtual void CacheChildren(); |
|
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 |
|
60 NS_DECL_ISUPPORTS_INHERITED |
|
61 |
|
62 // nsIAccessible |
|
63 NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); |
|
64 NS_IMETHOD DoAction(uint8_t index); |
|
65 NS_IMETHOD TakeFocus(); |
|
66 |
|
67 // Accessible |
|
68 virtual void Shutdown(); |
|
69 virtual void Value(nsString& aValue); |
|
70 virtual uint64_t NativeLinkState() const; |
|
71 |
|
72 // ActionAccessible |
|
73 virtual uint8_t ActionCount(); |
|
74 virtual KeyBinding AccessKey() const; |
|
75 |
|
76 // HyperLinkAccessible |
|
77 virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex); |
|
78 |
|
79 protected: |
|
80 // Accessible |
|
81 virtual void BindToParent(Accessible* aParent, uint32_t aIndexInParent); |
|
82 virtual void UnbindFromParent(); |
|
83 |
|
84 /** |
|
85 * Parent accessible that provides an action for this linkable accessible. |
|
86 */ |
|
87 Accessible* mActionAcc; |
|
88 bool mIsLink; |
|
89 bool mIsOnclick; |
|
90 }; |
|
91 |
|
92 /** |
|
93 * A simple accessible that gets its enumerated role passed into constructor. |
|
94 */ |
|
95 class EnumRoleAccessible : public AccessibleWrap |
|
96 { |
|
97 public: |
|
98 EnumRoleAccessible(nsIContent* aContent, DocAccessible* aDoc, |
|
99 a11y::role aRole); |
|
100 virtual ~EnumRoleAccessible() { } |
|
101 |
|
102 NS_DECL_ISUPPORTS_INHERITED |
|
103 |
|
104 // Accessible |
|
105 virtual a11y::role NativeRole(); |
|
106 |
|
107 protected: |
|
108 a11y::role mRole; |
|
109 }; |
|
110 |
|
111 |
|
112 /** |
|
113 * A wrapper accessible around native accessible to connect it with |
|
114 * crossplatform accessible tree. |
|
115 */ |
|
116 class DummyAccessible : public AccessibleWrap |
|
117 { |
|
118 public: |
|
119 DummyAccessible() : AccessibleWrap(nullptr, nullptr) { } |
|
120 virtual ~DummyAccessible() { } |
|
121 |
|
122 virtual uint64_t NativeState() MOZ_OVERRIDE MOZ_FINAL; |
|
123 virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE MOZ_FINAL; |
|
124 virtual uint64_t NativeLinkState() const MOZ_OVERRIDE MOZ_FINAL; |
|
125 virtual bool NativelyUnavailable() const MOZ_OVERRIDE MOZ_FINAL; |
|
126 virtual void ApplyARIAState(uint64_t* aState) const MOZ_OVERRIDE MOZ_FINAL; |
|
127 }; |
|
128 |
|
129 } // namespace a11y |
|
130 } // namespace mozilla |
|
131 |
|
132 #endif |