| 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 PLATFORM(GTK) |
| 40 | typedef struct _WebKitAccessible WebKitAccessible; |
| 41 | typedef struct _WebKitAccessible AccessibilityObjectWrapper; |
| 42 | #elif PLATFORM(WPE) |
| 43 | class AccessibilityObjectWrapper : public RefCounted<AccessibilityObjectWrapper> { }; |
| 44 | #else |
| 45 | class AccessibilityObjectWrapper; |
| 46 | #endif |
| 47 | |
| 48 | namespace WebCore { |
| 49 | |
| 50 | typedef unsigned AXID; |
| 51 | extern const AXID InvalidAXID; |
| 52 | typedef unsigned AXIsolatedTreeID; |
| 53 | |
| 54 | enum class AccessibilityRole { |
| 55 | Annotation = 1, |
| 56 | Application, |
| 57 | ApplicationAlert, |
| 58 | ApplicationAlertDialog, |
| 59 | ApplicationDialog, |
| 60 | ApplicationGroup, |
| 61 | ApplicationLog, |
| 62 | ApplicationMarquee, |
| 63 | ApplicationStatus, |
| 64 | ApplicationTextGroup, |
| 65 | ApplicationTimer, |
| 66 | Audio, |
| 67 | Blockquote, |
| 68 | Browser, |
| 69 | BusyIndicator, |
| 70 | Button, |
| 71 | Canvas, |
| 72 | Caption, |
| 73 | Cell, |
| 74 | CheckBox, |
| 75 | ColorWell, |
| 76 | Column, |
| 77 | ColumnHeader, |
| 78 | ComboBox, |
| 79 | Definition, |
| 80 | DescriptionList, |
| 81 | DescriptionListTerm, |
| 82 | DescriptionListDetail, |
| 83 | Details, |
| 84 | Directory, |
| 85 | DisclosureTriangle, |
| 86 | Div, |
| 87 | Document, |
| 88 | DocumentArticle, |
| 89 | DocumentMath, |
| 90 | DocumentNote, |
| 91 | Drawer, |
| 92 | EditableText, |
| 93 | Feed, |
| 94 | Figure, |
| 95 | , |
| 96 | , |
| 97 | Form, |
| 98 | GraphicsDocument, |
| 99 | GraphicsObject, |
| 100 | GraphicsSymbol, |
| 101 | Grid, |
| 102 | GridCell, |
| 103 | Group, |
| 104 | GrowArea, |
| 105 | Heading, |
| 106 | HelpTag, |
| 107 | HorizontalRule, |
| 108 | Ignored, |
| 109 | Inline, |
| 110 | Image, |
| 111 | ImageMap, |
| 112 | ImageMapLink, |
| 113 | Incrementor, |
| 114 | Label, |
| 115 | LandmarkBanner, |
| 116 | LandmarkComplementary, |
| 117 | LandmarkContentInfo, |
| 118 | LandmarkDocRegion, |
| 119 | LandmarkMain, |
| 120 | LandmarkNavigation, |
| 121 | LandmarkRegion, |
| 122 | LandmarkSearch, |
| 123 | Legend, |
| 124 | Link, |
| 125 | List, |
| 126 | ListBox, |
| 127 | ListBoxOption, |
| 128 | ListItem, |
| 129 | ListMarker, |
| 130 | Mark, |
| 131 | MathElement, |
| 132 | Matte, |
| 133 | , |
| 134 | , |
| 135 | , |
| 136 | , |
| 137 | , |
| 138 | , |
| 139 | , |
| 140 | , |
| 141 | Meter, |
| 142 | Outline, |
| 143 | Paragraph, |
| 144 | , |
| 145 | Pre, |
| 146 | Presentational, |
| 147 | ProgressIndicator, |
| 148 | RadioButton, |
| 149 | RadioGroup, |
| 150 | , |
| 151 | Row, |
| 152 | RowGroup, |
| 153 | RubyBase, |
| 154 | RubyBlock, |
| 155 | RubyInline, |
| 156 | RubyRun, |
| 157 | RubyText, |
| 158 | Ruler, |
| 159 | RulerMarker, |
| 160 | ScrollArea, |
| 161 | ScrollBar, |
| 162 | SearchField, |
| 163 | Sheet, |
| 164 | Slider, |
| 165 | SliderThumb, |
| 166 | SpinButton, |
| 167 | SpinButtonPart, |
| 168 | SplitGroup, |
| 169 | Splitter, |
| 170 | StaticText, |
| 171 | Summary, |
| 172 | Switch, |
| 173 | SystemWide, |
| 174 | SVGRoot, |
| 175 | SVGText, |
| 176 | SVGTSpan, |
| 177 | SVGTextPath, |
| 178 | TabGroup, |
| 179 | TabList, |
| 180 | TabPanel, |
| 181 | Tab, |
| 182 | Table, |
| 183 | , |
| 184 | TextArea, |
| 185 | TextGroup, |
| 186 | Term, |
| 187 | Time, |
| 188 | Tree, |
| 189 | TreeGrid, |
| 190 | TreeItem, |
| 191 | TextField, |
| 192 | ToggleButton, |
| 193 | Toolbar, |
| 194 | Unknown, |
| 195 | UserInterfaceTooltip, |
| 196 | ValueIndicator, |
| 197 | Video, |
| 198 | WebApplication, |
| 199 | WebArea, |
| 200 | WebCoreLink, |
| 201 | Window, |
| 202 | }; |
| 203 | |
| 204 | class AccessibilityObjectInterface { |
| 205 | public: |
| 206 | virtual ~AccessibilityObjectInterface() = default; |
| 207 | |
| 208 | virtual bool isMediaControlLabel() const = 0; |
| 209 | virtual AccessibilityRole roleValue() const = 0; |
| 210 | virtual bool isAttachment() const = 0; |
| 211 | virtual bool isLink() const = 0; |
| 212 | virtual bool isImageMapLink() const = 0; |
| 213 | virtual bool isImage() const = 0; |
| 214 | virtual bool isFileUploadButton() const = 0; |
| 215 | virtual bool isTree() const = 0; |
| 216 | virtual bool isTreeItem() const = 0; |
| 217 | virtual bool isScrollbar() const = 0; |
| 218 | virtual bool accessibilityIsIgnored() const = 0; |
| 219 | virtual FloatRect relativeFrame() const = 0; |
| 220 | virtual AccessibilityObjectInterface* parentObjectInterfaceUnignored() const = 0; |
| 221 | virtual AccessibilityObjectInterface* focusedUIElement() const = 0; |
| 222 | virtual bool isAccessibilityObject() const { return false; } |
| 223 | |
| 224 | #if PLATFORM(COCOA) |
| 225 | virtual String speechHintAttributeValue() const = 0; |
| 226 | virtual String descriptionAttributeValue() const = 0; |
| 227 | virtual String helpTextAttributeValue() const = 0; |
| 228 | virtual String titleAttributeValue() const = 0; |
| 229 | #endif |
| 230 | |
| 231 | virtual AccessibilityObjectWrapper* wrapper() const = 0; |
| 232 | virtual AccessibilityObjectInterface* accessibilityHitTest(const IntPoint&) const = 0; |
| 233 | virtual void updateChildrenIfNecessary() = 0; |
| 234 | }; |
| 235 | |
| 236 | } // namespace WebCore |
| 237 | |