no bug - Correct some typos in the comments. a=typo-fix
[gecko.git] / accessible / mac / MOXAccessibleProtocol.h
blob51ad3ccef4b9976c6a79f0245a4edfdada6025e0
1 /* clang-format off */
2 /* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* clang-format on */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 @protocol MOXTextMarkerSupport;
9 @protocol mozAccessible;
11 // This protocol's primary use is for abstracting the NSAccessibility informal
12 // protocol into a formal internal API. Conforming classes get to choose a
13 // subset of the optional methods to implement. Those methods will be mapped to
14 // NSAccessibility attributes or actions. A conforming class can implement
15 // moxBlockSelector to control which of its implemented methods should be
16 // exposed to NSAccessibility.
18 @protocol MOXAccessible
20 // The deepest descendant of the accessible subtree that contains the specified
21 // point. Forwarded from accessibilityHitTest.
22 - (id _Nullable)moxHitTest:(NSPoint)point;
24 // The deepest descendant of the accessible subtree that has the focus.
25 // Forwarded from accessibilityFocusedUIElement.
26 - (id _Nullable)moxFocusedUIElement;
28 // Sends a notification to any observing assistive applications.
29 - (void)moxPostNotification:(NSString* _Nonnull)notification;
31 - (void)moxPostNotification:(NSString* _Nonnull)notification
32 withUserInfo:(NSDictionary* _Nullable)userInfo;
34 // Return YES if selector should be considered not supported.
35 // Used in implementations such as:
36 // - accessibilityAttributeNames
37 // - accessibilityActionNames
38 // - accessibilityIsAttributeSettable
39 - (BOOL)moxBlockSelector:(SEL _Nonnull)selector;
41 // Returns a list of all children, doesn't do ignore filtering.
42 - (NSArray* _Nullable)moxChildren;
44 // Returns our parent, doesn't do ignore filtering.
45 - (id<mozAccessible> _Nullable)moxParent;
47 // This is called by isAccessibilityElement. If a subclass wants
48 // to alter the isAccessibilityElement return value, it must
49 // override this and not isAccessibilityElement directly.
50 - (BOOL)moxIgnoreWithParent:(id<MOXAccessible> _Nullable)parent;
52 // Should the child be ignored. This allows subclasses to determine
53 // what kinds of accessibles are valid children. This causes the child
54 // to be skipped, but the unignored descendants will be added to the
55 // container in the default children getter.
56 - (BOOL)moxIgnoreChild:(id<MOXAccessible> _Nullable)child;
58 // Return text delegate if it exists.
59 - (id<MOXTextMarkerSupport> _Nullable)moxTextMarkerDelegate;
61 // Return true if this accessible is a live region
62 - (BOOL)moxIsLiveRegion;
64 // Find the nearest ancestor that returns true with the given block function
65 - (id<MOXAccessible> _Nullable)moxFindAncestor:
66 (BOOL (^_Nonnull)(id<MOXAccessible> _Nonnull moxAcc,
67 BOOL* _Nonnull stop))findBlock;
69 @optional
71 #pragma mark - AttributeGetters
73 // AXChildren
74 - (NSArray* _Nullable)moxUnignoredChildren;
76 // AXParent
77 - (id _Nullable)moxUnignoredParent;
79 // AXRole
80 - (NSString* _Nullable)moxRole;
82 // AXRoleDescription
83 - (NSString* _Nullable)moxRoleDescription;
85 // AXSubrole
86 - (NSString* _Nullable)moxSubrole;
88 // AXTitle
89 - (NSString* _Nullable)moxTitle;
91 // AXDescription
92 - (NSString* _Nullable)moxLabel;
94 // AXHelp
95 - (NSString* _Nullable)moxHelp;
97 // AXValue
98 - (id _Nullable)moxValue;
100 // AXValueDescription
101 - (NSString* _Nullable)moxValueDescription;
103 // AXSize
104 - (NSValue* _Nullable)moxSize;
106 // AXPosition
107 - (NSValue* _Nullable)moxPosition;
109 // AXEnabled
110 - (NSNumber* _Nullable)moxEnabled;
112 // AXFocused
113 - (NSNumber* _Nullable)moxFocused;
115 // AXWindow
116 - (id _Nullable)moxWindow;
118 // AXFrame
119 - (NSValue* _Nullable)moxFrame;
121 // AXTitleUIElement
122 - (id _Nullable)moxTitleUIElement;
124 // AXTopLevelUIElement
125 - (id _Nullable)moxTopLevelUIElement;
127 // AXHasPopup
128 - (NSNumber* _Nullable)moxHasPopup;
130 // AXARIACurrent
131 - (NSString* _Nullable)moxARIACurrent;
133 // AXSelected
134 - (NSNumber* _Nullable)moxSelected;
136 // AXRequired
137 - (NSNumber* _Nullable)moxRequired;
139 // AXElementBusy
140 - (NSNumber* _Nullable)moxElementBusy;
142 // AXLinkedUIElements
143 - (NSArray* _Nullable)moxLinkedUIElements;
145 // AXARIAControls
146 - (NSArray* _Nullable)moxARIAControls;
148 // AXDOMIdentifier
149 - (NSString* _Nullable)moxDOMIdentifier;
151 // AXURL
152 - (NSURL* _Nullable)moxURL;
154 // AXLinkUIElements
155 - (NSArray* _Nullable)moxLinkUIElements;
157 // AXPopupValue
158 - (NSString* _Nullable)moxPopupValue;
160 // AXVisited
161 - (NSNumber* _Nullable)moxVisited;
163 // AXExpanded
164 - (NSNumber* _Nullable)moxExpanded;
166 // AXMain
167 - (NSNumber* _Nullable)moxMain;
169 // AXMinimized
170 - (NSNumber* _Nullable)moxMinimized;
172 // AXSelectedChildren
173 - (NSArray* _Nullable)moxSelectedChildren;
175 // AXTabs
176 - (NSArray* _Nullable)moxTabs;
178 // AXContents
179 - (NSArray* _Nullable)moxContents;
181 // AXOrientation
182 - (NSString* _Nullable)moxOrientation;
184 // AXMenuItemMarkChar
185 - (NSString* _Nullable)moxMenuItemMarkChar;
187 // AXLoaded
188 - (NSNumber* _Nullable)moxLoaded;
190 // AXLoadingProgress
191 - (NSNumber* _Nullable)moxLoadingProgress;
193 // AXMinValue
194 - (id _Nullable)moxMinValue;
196 // AXMaxValue
197 - (id _Nullable)moxMaxValue;
199 // Webkit also implements the following:
200 // // AXCaretBrowsingEnabled
201 // - (NSString* _Nullable)moxCaretBrowsingEnabled;
203 // // AXLayoutCount
204 // - (NSString* _Nullable)moxLayoutCount;
206 // // AXWebSessionID
207 // - (NSString* _Nullable)moxWebSessionID;
209 // // AXPreventKeyboardDOMEventDispatch
210 // - (NSString* _Nullable)moxPreventKeyboardDOMEventDispatch;
212 // Table Attributes
214 // AXRowCount
215 - (NSNumber* _Nullable)moxRowCount;
217 // AXColumnCount
218 - (NSNumber* _Nullable)moxColumnCount;
220 // AXRows
221 - (NSArray* _Nullable)moxRows;
223 // AXColumns
224 - (NSArray* _Nullable)moxColumns;
226 // AXIndex
227 - (NSNumber* _Nullable)moxIndex;
229 // AXRowIndexRange
230 - (NSValue* _Nullable)moxRowIndexRange;
232 // AXColumnIndexRange
233 - (NSValue* _Nullable)moxColumnIndexRange;
235 // AXRowHeaderUIElements
236 - (NSArray* _Nullable)moxRowHeaderUIElements;
238 // AXColumnHeaderUIElements
239 - (NSArray* _Nullable)moxColumnHeaderUIElements;
241 // AXIdentifier
242 - (NSString* _Nullable)moxIdentifier;
244 // AXVisibleChildren
245 - (NSArray* _Nullable)moxVisibleChildren;
247 // Outline Attributes
249 // AXDisclosing
250 - (NSNumber* _Nullable)moxDisclosing;
252 // AXDisclosedByRow
253 - (id _Nullable)moxDisclosedByRow;
255 // AXDisclosureLevel
256 - (NSNumber* _Nullable)moxDisclosureLevel;
258 // AXDisclosedRows
259 - (NSArray* _Nullable)moxDisclosedRows;
261 // AXSelectedRows
262 - (NSArray* _Nullable)moxSelectedRows;
264 // AXARIAPosInSet
265 - (NSNumber* _Nullable)moxARIAPosInSet;
267 // AXARIASetSize
268 - (NSNumber* _Nullable)moxARIASetSize;
270 // Math Attributes
272 // AXMathRootRadicand
273 - (id _Nullable)moxMathRootRadicand;
275 // AXMathRootIndex
276 - (id _Nullable)moxMathRootIndex;
278 // AXMathFractionNumerator
279 - (id _Nullable)moxMathFractionNumerator;
281 // AXMathFractionDenominator
282 - (id _Nullable)moxMathFractionDenominator;
284 // AXMathLineThickness
285 - (NSNumber* _Nullable)moxMathLineThickness;
287 // AXMathBase
288 - (id _Nullable)moxMathBase;
290 // AXMathSubscript
291 - (id _Nullable)moxMathSubscript;
293 // AXMathSuperscript
294 - (id _Nullable)moxMathSuperscript;
296 // AXMathUnder
297 - (id _Nullable)moxMathUnder;
299 // AXMathOver
300 - (id _Nullable)moxMathOver;
302 // AXInvalid
303 - (NSString* _Nullable)moxInvalid;
305 // AXSelectedText
306 - (NSString* _Nullable)moxSelectedText;
308 // AXSelectedTextRange
309 - (NSValue* _Nullable)moxSelectedTextRange;
311 // AXNumberOfCharacters
312 - (NSNumber* _Nullable)moxNumberOfCharacters;
314 // AXVisibleCharacterRange
315 - (NSValue* _Nullable)moxVisibleCharacterRange;
317 // AXInsertionPointLineNumber
318 - (NSNumber* _Nullable)moxInsertionPointLineNumber;
320 // AXEditableAncestor
321 - (id _Nullable)moxEditableAncestor;
323 // AXHighestEditableAncestor
324 - (id _Nullable)moxHighestEditableAncestor;
326 // AXFocusableAncestor
327 - (id _Nullable)moxFocusableAncestor;
329 // AXARIAAtomic
330 - (NSNumber* _Nullable)moxARIAAtomic;
332 // AXARIALive
333 - (NSString* _Nullable)moxARIALive;
335 // AXARIARelevant
336 - (NSString* _Nullable)moxARIARelevant;
338 // AXPlaceholderValue
339 - (NSString* _Nullable)moxPlaceholderValue;
341 // AXMozDebugDescription
342 - (NSString* _Nullable)moxMozDebugDescription;
344 #pragma mark - AttributeSetters
346 // AXDisclosing
347 - (void)moxSetDisclosing:(NSNumber* _Nullable)disclosing;
349 // AXValue
350 - (void)moxSetValue:(id _Nullable)value;
352 // AXFocused
353 - (void)moxSetFocused:(NSNumber* _Nullable)focused;
355 // AXSelected
356 - (void)moxSetSelected:(NSNumber* _Nullable)selected;
358 // AXSelectedChildren
359 - (void)moxSetSelectedChildren:(NSArray* _Nullable)selectedChildren;
361 // AXSelectedText
362 - (void)moxSetSelectedText:(NSString* _Nullable)selectedText;
364 // AXSelectedTextRange
365 - (void)moxSetSelectedTextRange:(NSValue* _Nullable)selectedTextRange;
367 // AXVisibleCharacterRange
368 - (void)moxSetVisibleCharacterRange:(NSValue* _Nullable)visibleCharacterRange;
370 #pragma mark - Actions
372 // AXPress
373 - (void)moxPerformPress;
375 // AXShowMenu
376 - (void)moxPerformShowMenu;
378 // AXScrollToVisible
379 - (void)moxPerformScrollToVisible;
381 // AXIncrement
382 - (void)moxPerformIncrement;
384 // AXDecrement
385 - (void)moxPerformDecrement;
387 #pragma mark - ParameterizedAttributeGetters
389 // AXLineForIndex
390 - (NSNumber* _Nullable)moxLineForIndex:(NSNumber* _Nonnull)index;
392 // AXRangeForLine
393 - (NSValue* _Nullable)moxRangeForLine:(NSNumber* _Nonnull)line;
395 // AXStringForRange
396 - (NSString* _Nullable)moxStringForRange:(NSValue* _Nonnull)range;
398 // AXRangeForPosition
399 - (NSValue* _Nullable)moxRangeForPosition:(NSValue* _Nonnull)position;
401 // AXRangeForIndex
402 - (NSValue* _Nullable)moxRangeForIndex:(NSNumber* _Nonnull)index;
404 // AXBoundsForRange
405 - (NSValue* _Nullable)moxBoundsForRange:(NSValue* _Nonnull)range;
407 // AXRTFForRange
408 - (NSData* _Nullable)moxRTFForRange:(NSValue* _Nonnull)range;
410 // AXStyleRangeForIndex
411 - (NSValue* _Nullable)moxStyleRangeForIndex:(NSNumber* _Nonnull)index;
413 // AXAttributedStringForRange
414 - (NSAttributedString* _Nullable)moxAttributedStringForRange:
415 (NSValue* _Nonnull)range;
417 // AXUIElementsForSearchPredicate
418 - (NSArray* _Nullable)moxUIElementsForSearchPredicate:
419 (NSDictionary* _Nonnull)searchPredicate;
421 // AXUIElementCountForSearchPredicate
422 - (NSNumber* _Nullable)moxUIElementCountForSearchPredicate:
423 (NSDictionary* _Nonnull)searchPredicate;
425 // AXCellForColumnAndRow
426 - (id _Nullable)moxCellForColumnAndRow:(NSArray* _Nonnull)columnAndRow;
428 // AXIndexForChildUIElement
429 - (NSNumber* _Nullable)moxIndexForChildUIElement:(id _Nonnull)child;
431 @end
433 // This protocol maps text marker and text marker range parameters to
434 // methods. It is implemented by a delegate of a MOXAccessible.
435 @protocol MOXTextMarkerSupport
437 #pragma mark - TextAttributeGetters
439 // AXStartTextMarker
440 - (AXTextMarkerRef _Nullable)moxStartTextMarker;
442 // AXEndTextMarker
443 - (AXTextMarkerRef _Nullable)moxEndTextMarker;
445 // AXSelectedTextMarkerRange
446 - (AXTextMarkerRangeRef _Nullable)moxSelectedTextMarkerRange;
448 #pragma mark - ParameterizedTextAttributeGetters
450 // AXLengthForTextMarkerRange
451 - (NSNumber* _Nullable)moxLengthForTextMarkerRange:
452 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
454 // AXStringForTextMarkerRange
455 - (NSString* _Nullable)moxStringForTextMarkerRange:
456 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
458 // AXTextMarkerRangeForUnorderedTextMarkers
459 - (AXTextMarkerRangeRef _Nullable)moxTextMarkerRangeForUnorderedTextMarkers:
460 (NSArray* _Nonnull)textMarkers;
462 // AXLeftWordTextMarkerRangeForTextMarker
463 - (AXTextMarkerRangeRef _Nullable)moxLeftWordTextMarkerRangeForTextMarker:
464 (AXTextMarkerRef _Nonnull)textMarker;
466 // AXRightWordTextMarkerRangeForTextMarker
467 - (AXTextMarkerRangeRef _Nullable)moxRightWordTextMarkerRangeForTextMarker:
468 (AXTextMarkerRef _Nonnull)textMarker;
470 // AXStartTextMarkerForTextMarkerRange
471 - (AXTextMarkerRef _Nullable)moxStartTextMarkerForTextMarkerRange:
472 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
474 // AXEndTextMarkerForTextMarkerRange
475 - (AXTextMarkerRef _Nullable)moxEndTextMarkerForTextMarkerRange:
476 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
478 // AXNextTextMarkerForTextMarker
479 - (AXTextMarkerRef _Nullable)moxNextTextMarkerForTextMarker:
480 (AXTextMarkerRef _Nonnull)textMarker;
482 // AXPreviousTextMarkerForTextMarker
483 - (AXTextMarkerRef _Nullable)moxPreviousTextMarkerForTextMarker:
484 (AXTextMarkerRef _Nonnull)textMarker;
486 // AXAttributedStringForTextMarkerRange
487 - (NSAttributedString* _Nullable)moxAttributedStringForTextMarkerRange:
488 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
490 // AXBoundsForTextMarkerRange
491 - (NSValue* _Nullable)moxBoundsForTextMarkerRange:
492 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
494 // AXIndexForTextMarker
495 - (NSNumber* _Nullable)moxIndexForTextMarker:
496 (AXTextMarkerRef _Nonnull)textMarker;
498 // AXTextMarkerForIndex
499 - (AXTextMarkerRef _Nullable)moxTextMarkerForIndex:(NSNumber* _Nonnull)index;
501 // AXUIElementForTextMarker
502 - (id _Nullable)moxUIElementForTextMarker:(AXTextMarkerRef _Nonnull)textMarker;
504 // AXTextMarkerRangeForUIElement
505 - (AXTextMarkerRangeRef _Nullable)moxTextMarkerRangeForUIElement:
506 (id _Nonnull)element;
508 // AXLineTextMarkerRangeForTextMarker
509 - (AXTextMarkerRangeRef _Nullable)moxLineTextMarkerRangeForTextMarker:
510 (AXTextMarkerRef _Nonnull)textMarker;
512 // AXLeftLineTextMarkerRangeForTextMarker
513 - (AXTextMarkerRangeRef _Nullable)moxLeftLineTextMarkerRangeForTextMarker:
514 (AXTextMarkerRef _Nonnull)textMarker;
516 // AXRightLineTextMarkerRangeForTextMarker
517 - (AXTextMarkerRangeRef _Nullable)moxRightLineTextMarkerRangeForTextMarker:
518 (AXTextMarkerRef _Nonnull)textMarker;
520 // AXParagraphTextMarkerRangeForTextMarker
521 - (AXTextMarkerRangeRef _Nullable)moxParagraphTextMarkerRangeForTextMarker:
522 (AXTextMarkerRef _Nonnull)textMarker;
524 // AXStyleTextMarkerRangeForTextMarker
525 - (AXTextMarkerRangeRef _Nullable)moxStyleTextMarkerRangeForTextMarker:
526 (AXTextMarkerRef _Nonnull)textMarker;
528 // AXMozDebugDescriptionForTextMarker
529 - (NSString* _Nullable)moxMozDebugDescriptionForTextMarker:
530 (AXTextMarkerRef _Nonnull)textMarker;
532 // AXMozDebugDescriptionForTextMarkerRange
533 - (NSString* _Nullable)moxMozDebugDescriptionForTextMarkerRange:
534 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
536 #pragma mark - TextAttributeSetters
538 // AXSelectedTextMarkerRange
539 - (void)moxSetSelectedTextMarkerRange:(id _Nullable)textMarkerRange;
541 @end