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 // AXMozDebugDescription
339 - (NSString
* _Nullable
)moxMozDebugDescription
;
341 #pragma mark - AttributeSetters
344 - (void)moxSetDisclosing
:(NSNumber
* _Nullable
)disclosing
;
347 - (void)moxSetValue
:(id _Nullable
)value
;
350 - (void)moxSetFocused
:(NSNumber
* _Nullable
)focused
;
353 - (void)moxSetSelected
:(NSNumber
* _Nullable
)selected
;
355 // AXSelectedChildren
356 - (void)moxSetSelectedChildren
:(NSArray
* _Nullable
)selectedChildren
;
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
370 - (void)moxPerformPress
;
373 - (void)moxPerformShowMenu
;
376 - (void)moxPerformScrollToVisible
;
379 - (void)moxPerformIncrement
;
382 - (void)moxPerformDecrement
;
384 #pragma mark - ParameterizedAttributeGetters
387 - (NSNumber
* _Nullable
)moxLineForIndex
:(NSNumber
* _Nonnull
)index
;
390 - (NSValue
* _Nullable
)moxRangeForLine
:(NSNumber
* _Nonnull
)line
;
393 - (NSString
* _Nullable
)moxStringForRange
:(NSValue
* _Nonnull
)range
;
395 // AXRangeForPosition
396 - (NSValue
* _Nullable
)moxRangeForPosition
:(NSValue
* _Nonnull
)position
;
399 - (NSValue
* _Nullable
)moxRangeForIndex
:(NSNumber
* _Nonnull
)index
;
402 - (NSValue
* _Nullable
)moxBoundsForRange
:(NSValue
* _Nonnull
)range
;
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
;
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
437 - (AXTextMarkerRef _Nullable
)moxStartTextMarker
;
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
;