1 | /* |
2 | * Copyright (C) 2019 Apple Inc. All rights reserved. |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions |
6 | * are met: |
7 | * 1. Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. |
9 | * 2. Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. |
12 | * |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
23 | * THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ |
25 | |
26 | #pragma once |
27 | |
28 | #include "LayoutRect.h" |
29 | #include <wtf/RefCounted.h> |
30 | |
31 | #if PLATFORM(WIN) |
32 | #include "AccessibilityObjectWrapperWin.h" |
33 | #include "COMPtr.h" |
34 | #endif |
35 | |
36 | #if PLATFORM(COCOA) |
37 | OBJC_CLASS WebAccessibilityObjectWrapper; |
38 | typedef WebAccessibilityObjectWrapper AccessibilityObjectWrapper; |
39 | #elif USE(ATK) |
40 | typedef struct _WebKitAccessible WebKitAccessible; |
41 | typedef struct _WebKitAccessible AccessibilityObjectWrapper; |
42 | #else |
43 | class AccessibilityObjectWrapper; |
44 | #endif |
45 | |
46 | namespace WebCore { |
47 | |
48 | typedef unsigned AXID; |
49 | extern const AXID InvalidAXID; |
50 | typedef unsigned AXIsolatedTreeID; |
51 | |
52 | enum class AccessibilityRole { |
53 | Annotation = 1, |
54 | Application, |
55 | ApplicationAlert, |
56 | ApplicationAlertDialog, |
57 | ApplicationDialog, |
58 | ApplicationGroup, |
59 | ApplicationLog, |
60 | ApplicationMarquee, |
61 | ApplicationStatus, |
62 | ApplicationTextGroup, |
63 | ApplicationTimer, |
64 | Audio, |
65 | Blockquote, |
66 | Browser, |
67 | BusyIndicator, |
68 | Button, |
69 | Canvas, |
70 | Caption, |
71 | Cell, |
72 | CheckBox, |
73 | ColorWell, |
74 | Column, |
75 | ColumnHeader, |
76 | ComboBox, |
77 | Definition, |
78 | DescriptionList, |
79 | DescriptionListTerm, |
80 | DescriptionListDetail, |
81 | Details, |
82 | Directory, |
83 | DisclosureTriangle, |
84 | Div, |
85 | Document, |
86 | DocumentArticle, |
87 | DocumentMath, |
88 | DocumentNote, |
89 | Drawer, |
90 | EditableText, |
91 | Feed, |
92 | Figure, |
93 | , |
94 | , |
95 | Form, |
96 | GraphicsDocument, |
97 | GraphicsObject, |
98 | GraphicsSymbol, |
99 | Grid, |
100 | GridCell, |
101 | Group, |
102 | GrowArea, |
103 | Heading, |
104 | HelpTag, |
105 | HorizontalRule, |
106 | Ignored, |
107 | Inline, |
108 | Image, |
109 | ImageMap, |
110 | ImageMapLink, |
111 | Incrementor, |
112 | Label, |
113 | LandmarkBanner, |
114 | LandmarkComplementary, |
115 | LandmarkContentInfo, |
116 | LandmarkDocRegion, |
117 | LandmarkMain, |
118 | LandmarkNavigation, |
119 | LandmarkRegion, |
120 | LandmarkSearch, |
121 | Legend, |
122 | Link, |
123 | List, |
124 | ListBox, |
125 | ListBoxOption, |
126 | ListItem, |
127 | ListMarker, |
128 | Mark, |
129 | MathElement, |
130 | Matte, |
131 | , |
132 | , |
133 | , |
134 | , |
135 | , |
136 | , |
137 | , |
138 | , |
139 | Meter, |
140 | Outline, |
141 | Paragraph, |
142 | , |
143 | Pre, |
144 | Presentational, |
145 | ProgressIndicator, |
146 | RadioButton, |
147 | RadioGroup, |
148 | , |
149 | Row, |
150 | RowGroup, |
151 | RubyBase, |
152 | RubyBlock, |
153 | RubyInline, |
154 | RubyRun, |
155 | RubyText, |
156 | Ruler, |
157 | RulerMarker, |
158 | ScrollArea, |
159 | ScrollBar, |
160 | SearchField, |
161 | Sheet, |
162 | Slider, |
163 | SliderThumb, |
164 | SpinButton, |
165 | SpinButtonPart, |
166 | SplitGroup, |
167 | Splitter, |
168 | StaticText, |
169 | Summary, |
170 | Switch, |
171 | SystemWide, |
172 | SVGRoot, |
173 | SVGText, |
174 | SVGTSpan, |
175 | SVGTextPath, |
176 | TabGroup, |
177 | TabList, |
178 | TabPanel, |
179 | Tab, |
180 | Table, |
181 | , |
182 | TextArea, |
183 | TextGroup, |
184 | Term, |
185 | Time, |
186 | Tree, |
187 | TreeGrid, |
188 | TreeItem, |
189 | TextField, |
190 | ToggleButton, |
191 | Toolbar, |
192 | Unknown, |
193 | UserInterfaceTooltip, |
194 | ValueIndicator, |
195 | Video, |
196 | WebApplication, |
197 | WebArea, |
198 | WebCoreLink, |
199 | Window, |
200 | }; |
201 | |
202 | class AccessibilityObjectInterface { |
203 | public: |
204 | virtual ~AccessibilityObjectInterface() = default; |
205 | |
206 | virtual bool isMediaControlLabel() const = 0; |
207 | virtual AccessibilityRole roleValue() const = 0; |
208 | virtual bool isAttachment() const = 0; |
209 | virtual bool isLink() const = 0; |
210 | virtual bool isImageMapLink() const = 0; |
211 | virtual bool isImage() const = 0; |
212 | virtual bool isFileUploadButton() const = 0; |
213 | virtual bool isTree() const = 0; |
214 | virtual bool isTreeItem() const = 0; |
215 | virtual bool isScrollbar() const = 0; |
216 | virtual bool accessibilityIsIgnored() const = 0; |
217 | virtual FloatRect relativeFrame() const = 0; |
218 | virtual AccessibilityObjectInterface* parentObjectInterfaceUnignored() const = 0; |
219 | virtual AccessibilityObjectInterface* focusedUIElement() const = 0; |
220 | virtual bool isAccessibilityObject() const { return false; } |
221 | |
222 | #if PLATFORM(COCOA) |
223 | virtual String speechHintAttributeValue() const = 0; |
224 | virtual String descriptionAttributeValue() const = 0; |
225 | virtual String helpTextAttributeValue() const = 0; |
226 | virtual String titleAttributeValue() const = 0; |
227 | #endif |
228 | |
229 | virtual AccessibilityObjectWrapper* wrapper() const = 0; |
230 | virtual AccessibilityObjectInterface* accessibilityHitTest(const IntPoint&) const = 0; |
231 | virtual void updateChildrenIfNecessary() = 0; |
232 | }; |
233 | |
234 | } // namespace WebCore |
235 | |