2 /* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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
;
71 #pragma mark - AttributeGetters
74 - (NSArray
* _Nullable
)moxUnignoredChildren
;
77 - (id _Nullable
)moxUnignoredParent
;
80 - (NSString
* _Nullable
)moxRole
;
83 - (NSString
* _Nullable
)moxRoleDescription
;
86 - (NSString
* _Nullable
)moxSubrole
;
89 - (NSString
* _Nullable
)moxTitle
;
92 - (NSString
* _Nullable
)moxLabel
;
95 - (NSString
* _Nullable
)moxHelp
;
98 - (id _Nullable
)moxValue
;
100 // AXValueDescription
101 - (NSString
* _Nullable
)moxValueDescription
;
104 - (NSValue
* _Nullable
)moxSize
;
107 - (NSValue
* _Nullable
)moxPosition
;
110 - (NSNumber
* _Nullable
)moxEnabled
;
113 - (NSNumber
* _Nullable
)moxFocused
;
116 - (id _Nullable
)moxWindow
;
119 - (NSValue
* _Nullable
)moxFrame
;
122 - (id _Nullable
)moxTitleUIElement
;
124 // AXTopLevelUIElement
125 - (id _Nullable
)moxTopLevelUIElement
;
128 - (NSNumber
* _Nullable
)moxHasPopup
;
131 - (NSString
* _Nullable
)moxARIACurrent
;
134 - (NSNumber
* _Nullable
)moxSelected
;
137 - (NSNumber
* _Nullable
)moxRequired
;
140 - (NSNumber
* _Nullable
)moxElementBusy
;
142 // AXLinkedUIElements
143 - (NSArray
* _Nullable
)moxLinkedUIElements
;
146 - (NSArray
* _Nullable
)moxARIAControls
;
149 - (NSString
* _Nullable
)moxDOMIdentifier
;
152 - (NSURL
* _Nullable
)moxURL
;
155 - (NSArray
* _Nullable
)moxLinkUIElements
;
158 - (NSString
* _Nullable
)moxPopupValue
;
161 - (NSNumber
* _Nullable
)moxVisited
;
164 - (NSNumber
* _Nullable
)moxExpanded
;
167 - (NSNumber
* _Nullable
)moxMain
;
170 - (NSNumber
* _Nullable
)moxMinimized
;
172 // AXSelectedChildren
173 - (NSArray
* _Nullable
)moxSelectedChildren
;
176 - (NSArray
* _Nullable
)moxTabs
;
179 - (NSArray
* _Nullable
)moxContents
;
182 - (NSString
* _Nullable
)moxOrientation
;
184 // AXMenuItemMarkChar
185 - (NSString
* _Nullable
)moxMenuItemMarkChar
;
188 - (NSNumber
* _Nullable
)moxLoaded
;
191 - (NSNumber
* _Nullable
)moxLoadingProgress
;
194 - (id _Nullable
)moxMinValue
;
197 - (id _Nullable
)moxMaxValue
;
199 // Webkit also implements the following:
200 // // AXCaretBrowsingEnabled
201 // - (NSString* _Nullable)moxCaretBrowsingEnabled;
204 // - (NSString* _Nullable)moxLayoutCount;
207 // - (NSString* _Nullable)moxWebSessionID;
209 // // AXPreventKeyboardDOMEventDispatch
210 // - (NSString* _Nullable)moxPreventKeyboardDOMEventDispatch;
215 - (NSNumber
* _Nullable
)moxRowCount
;
218 - (NSNumber
* _Nullable
)moxColumnCount
;
221 - (NSArray
* _Nullable
)moxRows
;
224 - (NSArray
* _Nullable
)moxColumns
;
227 - (NSNumber
* _Nullable
)moxIndex
;
230 - (NSValue
* _Nullable
)moxRowIndexRange
;
232 // AXColumnIndexRange
233 - (NSValue
* _Nullable
)moxColumnIndexRange
;
235 // AXRowHeaderUIElements
236 - (NSArray
* _Nullable
)moxRowHeaderUIElements
;
238 // AXColumnHeaderUIElements
239 - (NSArray
* _Nullable
)moxColumnHeaderUIElements
;
242 - (NSString
* _Nullable
)moxIdentifier
;
245 - (NSArray
* _Nullable
)moxVisibleChildren
;
247 // Outline Attributes
250 - (NSNumber
* _Nullable
)moxDisclosing
;
253 - (id _Nullable
)moxDisclosedByRow
;
256 - (NSNumber
* _Nullable
)moxDisclosureLevel
;
259 - (NSArray
* _Nullable
)moxDisclosedRows
;
262 - (NSArray
* _Nullable
)moxSelectedRows
;
265 - (NSNumber
* _Nullable
)moxARIAPosInSet
;
268 - (NSNumber
* _Nullable
)moxARIASetSize
;
272 // AXMathRootRadicand
273 - (id _Nullable
)moxMathRootRadicand
;
276 - (id _Nullable
)moxMathRootIndex
;
278 // AXMathFractionNumerator
279 - (id _Nullable
)moxMathFractionNumerator
;
281 // AXMathFractionDenominator
282 - (id _Nullable
)moxMathFractionDenominator
;
284 // AXMathLineThickness
285 - (NSNumber
* _Nullable
)moxMathLineThickness
;
288 - (id _Nullable
)moxMathBase
;
291 - (id _Nullable
)moxMathSubscript
;
294 - (id _Nullable
)moxMathSuperscript
;
297 - (id _Nullable
)moxMathUnder
;
300 - (id _Nullable
)moxMathOver
;
303 - (NSString
* _Nullable
)moxInvalid
;
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
;
330 - (NSNumber
* _Nullable
)moxARIAAtomic
;
333 - (NSString
* _Nullable
)moxARIALive
;
336 - (NSString
* _Nullable
)moxARIARelevant
;
338 // AXPlaceholderValue
339 - (NSString
* _Nullable
)moxPlaceholderValue
;
341 // AXMozDebugDescription
342 - (NSString
* _Nullable
)moxMozDebugDescription
;
344 #pragma mark - AttributeSetters
347 - (void)moxSetDisclosing
:(NSNumber
* _Nullable
)disclosing
;
350 - (void)moxSetValue
:(id _Nullable
)value
;
353 - (void)moxSetFocused
:(NSNumber
* _Nullable
)focused
;
356 - (void)moxSetSelected
:(NSNumber
* _Nullable
)selected
;
358 // AXSelectedChildren
359 - (void)moxSetSelectedChildren
:(NSArray
* _Nullable
)selectedChildren
;
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
373 - (void)moxPerformPress
;
376 - (void)moxPerformShowMenu
;
379 - (void)moxPerformScrollToVisible
;
382 - (void)moxPerformIncrement
;
385 - (void)moxPerformDecrement
;
387 #pragma mark - ParameterizedAttributeGetters
390 - (NSNumber
* _Nullable
)moxLineForIndex
:(NSNumber
* _Nonnull
)index
;
393 - (NSValue
* _Nullable
)moxRangeForLine
:(NSNumber
* _Nonnull
)line
;
396 - (NSString
* _Nullable
)moxStringForRange
:(NSValue
* _Nonnull
)range
;
398 // AXRangeForPosition
399 - (NSValue
* _Nullable
)moxRangeForPosition
:(NSValue
* _Nonnull
)position
;
402 - (NSValue
* _Nullable
)moxRangeForIndex
:(NSNumber
* _Nonnull
)index
;
405 - (NSValue
* _Nullable
)moxBoundsForRange
:(NSValue
* _Nonnull
)range
;
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
;
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
440 - (AXTextMarkerRef _Nullable
)moxStartTextMarker
;
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
;