no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / accessible / mac / MOXAccessibleProtocol.h
blobe3535c1628e8c13ee0ca53c16f7a270e66558cf5
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 // AXMozDebugDescription
339 - (NSString* _Nullable)moxMozDebugDescription;
341 #pragma mark - AttributeSetters
343 // AXDisclosing
344 - (void)moxSetDisclosing:(NSNumber* _Nullable)disclosing;
346 // AXValue
347 - (void)moxSetValue:(id _Nullable)value;
349 // AXFocused
350 - (void)moxSetFocused:(NSNumber* _Nullable)focused;
352 // AXSelected
353 - (void)moxSetSelected:(NSNumber* _Nullable)selected;
355 // AXSelectedChildren
356 - (void)moxSetSelectedChildren:(NSArray* _Nullable)selectedChildren;
358 // AXSelectedText
359 - (void)moxSetSelectedText:(NSString* _Nullable)selectedText;
361 // AXSelectedTextRange
362 - (void)moxSetSelectedTextRange:(NSValue* _Nullable)selectedTextRange;
364 // AXVisibleCharacterRange
365 - (void)moxSetVisibleCharacterRange:(NSValue* _Nullable)visibleCharacterRange;
367 #pragma mark - Actions
369 // AXPress
370 - (void)moxPerformPress;
372 // AXShowMenu
373 - (void)moxPerformShowMenu;
375 // AXScrollToVisible
376 - (void)moxPerformScrollToVisible;
378 // AXIncrement
379 - (void)moxPerformIncrement;
381 // AXDecrement
382 - (void)moxPerformDecrement;
384 #pragma mark - ParameterizedAttributeGetters
386 // AXLineForIndex
387 - (NSNumber* _Nullable)moxLineForIndex:(NSNumber* _Nonnull)index;
389 // AXRangeForLine
390 - (NSValue* _Nullable)moxRangeForLine:(NSNumber* _Nonnull)line;
392 // AXStringForRange
393 - (NSString* _Nullable)moxStringForRange:(NSValue* _Nonnull)range;
395 // AXRangeForPosition
396 - (NSValue* _Nullable)moxRangeForPosition:(NSValue* _Nonnull)position;
398 // AXRangeForIndex
399 - (NSValue* _Nullable)moxRangeForIndex:(NSNumber* _Nonnull)index;
401 // AXBoundsForRange
402 - (NSValue* _Nullable)moxBoundsForRange:(NSValue* _Nonnull)range;
404 // AXRTFForRange
405 - (NSData* _Nullable)moxRTFForRange:(NSValue* _Nonnull)range;
407 // AXStyleRangeForIndex
408 - (NSValue* _Nullable)moxStyleRangeForIndex:(NSNumber* _Nonnull)index;
410 // AXAttributedStringForRange
411 - (NSAttributedString* _Nullable)moxAttributedStringForRange:
412 (NSValue* _Nonnull)range;
414 // AXUIElementsForSearchPredicate
415 - (NSArray* _Nullable)moxUIElementsForSearchPredicate:
416 (NSDictionary* _Nonnull)searchPredicate;
418 // AXUIElementCountForSearchPredicate
419 - (NSNumber* _Nullable)moxUIElementCountForSearchPredicate:
420 (NSDictionary* _Nonnull)searchPredicate;
422 // AXCellForColumnAndRow
423 - (id _Nullable)moxCellForColumnAndRow:(NSArray* _Nonnull)columnAndRow;
425 // AXIndexForChildUIElement
426 - (NSNumber* _Nullable)moxIndexForChildUIElement:(id _Nonnull)child;
428 @end
430 // This protocol maps text marker and text marker range parameters to
431 // methods. It is implemented by a delegate of a MOXAccessible.
432 @protocol MOXTextMarkerSupport
434 #pragma mark - TextAttributeGetters
436 // AXStartTextMarker
437 - (AXTextMarkerRef _Nullable)moxStartTextMarker;
439 // AXEndTextMarker
440 - (AXTextMarkerRef _Nullable)moxEndTextMarker;
442 // AXSelectedTextMarkerRange
443 - (AXTextMarkerRangeRef _Nullable)moxSelectedTextMarkerRange;
445 #pragma mark - ParameterizedTextAttributeGetters
447 // AXLengthForTextMarkerRange
448 - (NSNumber* _Nullable)moxLengthForTextMarkerRange:
449 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
451 // AXStringForTextMarkerRange
452 - (NSString* _Nullable)moxStringForTextMarkerRange:
453 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
455 // AXTextMarkerRangeForUnorderedTextMarkers
456 - (AXTextMarkerRangeRef _Nullable)moxTextMarkerRangeForUnorderedTextMarkers:
457 (NSArray* _Nonnull)textMarkers;
459 // AXLeftWordTextMarkerRangeForTextMarker
460 - (AXTextMarkerRangeRef _Nullable)moxLeftWordTextMarkerRangeForTextMarker:
461 (AXTextMarkerRef _Nonnull)textMarker;
463 // AXRightWordTextMarkerRangeForTextMarker
464 - (AXTextMarkerRangeRef _Nullable)moxRightWordTextMarkerRangeForTextMarker:
465 (AXTextMarkerRef _Nonnull)textMarker;
467 // AXStartTextMarkerForTextMarkerRange
468 - (AXTextMarkerRef _Nullable)moxStartTextMarkerForTextMarkerRange:
469 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
471 // AXEndTextMarkerForTextMarkerRange
472 - (AXTextMarkerRef _Nullable)moxEndTextMarkerForTextMarkerRange:
473 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
475 // AXNextTextMarkerForTextMarker
476 - (AXTextMarkerRef _Nullable)moxNextTextMarkerForTextMarker:
477 (AXTextMarkerRef _Nonnull)textMarker;
479 // AXPreviousTextMarkerForTextMarker
480 - (AXTextMarkerRef _Nullable)moxPreviousTextMarkerForTextMarker:
481 (AXTextMarkerRef _Nonnull)textMarker;
483 // AXAttributedStringForTextMarkerRange
484 - (NSAttributedString* _Nullable)moxAttributedStringForTextMarkerRange:
485 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
487 // AXBoundsForTextMarkerRange
488 - (NSValue* _Nullable)moxBoundsForTextMarkerRange:
489 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
491 // AXIndexForTextMarker
492 - (NSNumber* _Nullable)moxIndexForTextMarker:
493 (AXTextMarkerRef _Nonnull)textMarker;
495 // AXTextMarkerForIndex
496 - (AXTextMarkerRef _Nullable)moxTextMarkerForIndex:(NSNumber* _Nonnull)index;
498 // AXUIElementForTextMarker
499 - (id _Nullable)moxUIElementForTextMarker:(AXTextMarkerRef _Nonnull)textMarker;
501 // AXTextMarkerRangeForUIElement
502 - (AXTextMarkerRangeRef _Nullable)moxTextMarkerRangeForUIElement:
503 (id _Nonnull)element;
505 // AXLineTextMarkerRangeForTextMarker
506 - (AXTextMarkerRangeRef _Nullable)moxLineTextMarkerRangeForTextMarker:
507 (AXTextMarkerRef _Nonnull)textMarker;
509 // AXLeftLineTextMarkerRangeForTextMarker
510 - (AXTextMarkerRangeRef _Nullable)moxLeftLineTextMarkerRangeForTextMarker:
511 (AXTextMarkerRef _Nonnull)textMarker;
513 // AXRightLineTextMarkerRangeForTextMarker
514 - (AXTextMarkerRangeRef _Nullable)moxRightLineTextMarkerRangeForTextMarker:
515 (AXTextMarkerRef _Nonnull)textMarker;
517 // AXParagraphTextMarkerRangeForTextMarker
518 - (AXTextMarkerRangeRef _Nullable)moxParagraphTextMarkerRangeForTextMarker:
519 (AXTextMarkerRef _Nonnull)textMarker;
521 // AXStyleTextMarkerRangeForTextMarker
522 - (AXTextMarkerRangeRef _Nullable)moxStyleTextMarkerRangeForTextMarker:
523 (AXTextMarkerRef _Nonnull)textMarker;
525 // AXMozDebugDescriptionForTextMarker
526 - (NSString* _Nullable)moxMozDebugDescriptionForTextMarker:
527 (AXTextMarkerRef _Nonnull)textMarker;
529 // AXMozDebugDescriptionForTextMarkerRange
530 - (NSString* _Nullable)moxMozDebugDescriptionForTextMarkerRange:
531 (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
533 #pragma mark - TextAttributeSetters
535 // AXSelectedTextMarkerRange
536 - (void)moxSetSelectedTextMarkerRange:(id _Nullable)textMarkerRange;
538 @end