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
;
10 // This protocol's primary use is for abstracting the NSAccessibility informal
11 // protocol into a formal internal API. Conforming classes get to choose a
12 // subset of the optional methods to implement. Those methods will be mapped to
13 // NSAccessibility attributes or actions. A conforming class can implement
14 // moxBlockSelector to control which of its implemented methods should be
15 // exposed to NSAccessibility.
17 @protocol MOXAccessible
19 // The deepest descendant of the accessible subtree that contains the specified
20 // point. Forwarded from accessibilityHitTest.
21 - (id _Nullable
)moxHitTest
:(NSPoint
)point
;
23 // The deepest descendant of the accessible subtree that has the focus.
24 // Forwarded from accessibilityFocusedUIElement.
25 - (id _Nullable
)moxFocusedUIElement
;
27 // Sends a notification to any observing assistive applications.
28 - (void)moxPostNotification
:(NSString
* _Nonnull
)notification
;
30 - (void)moxPostNotification
:(NSString
* _Nonnull
)notification
31 withUserInfo
:(NSDictionary
* _Nullable
)userInfo
;
33 // Return YES if selector should be considered not supported.
34 // Used in implementations such as:
35 // - accessibilityAttributeNames
36 // - accessibilityActionNames
37 // - accessibilityIsAttributeSettable
38 - (BOOL
)moxBlockSelector
:(SEL _Nonnull
)selector
;
40 // Returns a list of all children, doesn't do ignore filtering.
41 - (NSArray
* _Nullable
)moxChildren
;
43 // Returns our parent, doesn't do ignore filtering.
44 - (id
<mozAccessible
> _Nullable
)moxParent
;
46 // This is called by isAccessibilityElement. If a subclass wants
47 // to alter the isAccessibilityElement return value, it must
48 // override this and not isAccessibilityElement directly.
49 - (BOOL
)moxIgnoreWithParent
:(id
<MOXAccessible
> _Nullable
)parent
;
51 // Should the child be ignored. This allows subclasses to determine
52 // what kinds of accessibles are valid children. This causes the child
53 // to be skipped, but the unignored descendants will be added to the
54 // container in the default children getter.
55 - (BOOL
)moxIgnoreChild
:(id
<MOXAccessible
> _Nullable
)child
;
57 // Return text delegate if it exists.
58 - (id
<MOXTextMarkerSupport
> _Nullable
)moxTextMarkerDelegate
;
60 // Return true if this accessible is a live region
61 - (BOOL
)moxIsLiveRegion
;
63 // Find the nearest ancestor that returns true with the given block function
64 - (id
<MOXAccessible
> _Nullable
)moxFindAncestor
:
65 (BOOL (^_Nonnull
)(id
<MOXAccessible
> _Nonnull moxAcc
,
66 BOOL
* _Nonnull stop
))findBlock
;
70 #pragma mark - AttributeGetters
73 - (NSArray
* _Nullable
)moxUnignoredChildren
;
76 - (id _Nullable
)moxUnignoredParent
;
79 - (NSString
* _Nullable
)moxRole
;
82 - (NSString
* _Nullable
)moxRoleDescription
;
85 - (NSString
* _Nullable
)moxSubrole
;
88 - (NSString
* _Nullable
)moxTitle
;
91 - (NSString
* _Nullable
)moxLabel
;
94 - (NSString
* _Nullable
)moxHelp
;
97 - (id _Nullable
)moxValue
;
100 - (NSValue
* _Nullable
)moxSize
;
103 - (NSValue
* _Nullable
)moxPosition
;
106 - (NSNumber
* _Nullable
)moxEnabled
;
109 - (NSNumber
* _Nullable
)moxFocused
;
112 - (id _Nullable
)moxWindow
;
115 - (NSValue
* _Nullable
)moxFrame
;
118 - (id _Nullable
)moxTitleUIElement
;
120 // AXTopLevelUIElement
121 - (id _Nullable
)moxTopLevelUIElement
;
124 - (NSNumber
* _Nullable
)moxHasPopup
;
127 - (NSString
* _Nullable
)moxARIACurrent
;
130 - (NSNumber
* _Nullable
)moxSelected
;
133 - (NSNumber
* _Nullable
)moxRequired
;
136 - (NSNumber
* _Nullable
)moxElementBusy
;
138 // AXLinkedUIElements
139 - (NSArray
* _Nullable
)moxLinkedUIElements
;
142 - (NSArray
* _Nullable
)moxARIAControls
;
145 - (NSString
* _Nullable
)moxDOMIdentifier
;
148 - (NSURL
* _Nullable
)moxURL
;
151 - (NSArray
* _Nullable
)moxLinkUIElements
;
154 - (NSString
* _Nullable
)moxPopupValue
;
157 - (NSNumber
* _Nullable
)moxVisited
;
160 - (NSNumber
* _Nullable
)moxExpanded
;
163 - (NSNumber
* _Nullable
)moxMain
;
166 - (NSNumber
* _Nullable
)moxMinimized
;
168 // AXSelectedChildren
169 - (NSArray
* _Nullable
)moxSelectedChildren
;
172 - (NSArray
* _Nullable
)moxTabs
;
175 - (NSArray
* _Nullable
)moxContents
;
178 - (NSString
* _Nullable
)moxOrientation
;
180 // AXMenuItemMarkChar
181 - (NSString
* _Nullable
)moxMenuItemMarkChar
;
184 - (NSNumber
* _Nullable
)moxLoaded
;
187 - (NSNumber
* _Nullable
)moxLoadingProgress
;
189 // Webkit also implements the following:
190 // // AXCaretBrowsingEnabled
191 // - (NSString* _Nullable)moxCaretBrowsingEnabled;
194 // - (NSString* _Nullable)moxLayoutCount;
197 // - (NSString* _Nullable)moxWebSessionID;
199 // // AXPreventKeyboardDOMEventDispatch
200 // - (NSString* _Nullable)moxPreventKeyboardDOMEventDispatch;
205 - (NSNumber
* _Nullable
)moxRowCount
;
208 - (NSNumber
* _Nullable
)moxColumnCount
;
211 - (NSArray
* _Nullable
)moxRows
;
214 - (NSArray
* _Nullable
)moxColumns
;
217 - (NSNumber
* _Nullable
)moxIndex
;
220 - (NSValue
* _Nullable
)moxRowIndexRange
;
222 // AXColumnIndexRange
223 - (NSValue
* _Nullable
)moxColumnIndexRange
;
225 // AXRowHeaderUIElements
226 - (NSArray
* _Nullable
)moxRowHeaderUIElements
;
228 // AXColumnHeaderUIElements
229 - (NSArray
* _Nullable
)moxColumnHeaderUIElements
;
232 - (NSString
* _Nullable
)moxIdentifier
;
235 - (NSArray
* _Nullable
)moxVisibleChildren
;
237 // Outline Attributes
240 - (NSNumber
* _Nullable
)moxDisclosing
;
243 - (id _Nullable
)moxDisclosedByRow
;
246 - (NSNumber
* _Nullable
)moxDisclosureLevel
;
249 - (NSArray
* _Nullable
)moxDisclosedRows
;
252 - (NSArray
* _Nullable
)moxSelectedRows
;
256 // AXMathRootRadicand
257 - (id _Nullable
)moxMathRootRadicand
;
260 - (id _Nullable
)moxMathRootIndex
;
262 // AXMathFractionNumerator
263 - (id _Nullable
)moxMathFractionNumerator
;
265 // AXMathFractionDenominator
266 - (id _Nullable
)moxMathFractionDenominator
;
268 // AXMathLineThickness
269 - (NSNumber
* _Nullable
)moxMathLineThickness
;
272 - (id _Nullable
)moxMathBase
;
275 - (id _Nullable
)moxMathSubscript
;
278 - (id _Nullable
)moxMathSuperscript
;
281 - (id _Nullable
)moxMathUnder
;
284 - (id _Nullable
)moxMathOver
;
287 - (NSString
* _Nullable
)moxInvalid
;
290 - (NSString
* _Nullable
)moxSelectedText
;
292 // AXSelectedTextRange
293 - (NSValue
* _Nullable
)moxSelectedTextRange
;
295 // AXNumberOfCharacters
296 - (NSNumber
* _Nullable
)moxNumberOfCharacters
;
298 // AXVisibleCharacterRange
299 - (NSValue
* _Nullable
)moxVisibleCharacterRange
;
301 // AXInsertionPointLineNumber
302 - (NSNumber
* _Nullable
)moxInsertionPointLineNumber
;
304 // AXEditableAncestor
305 - (id _Nullable
)moxEditableAncestor
;
307 // AXHighestEditableAncestor
308 - (id _Nullable
)moxHighestEditableAncestor
;
310 // AXFocusableAncestor
311 - (id _Nullable
)moxFocusableAncestor
;
314 - (NSNumber
* _Nullable
)moxARIAAtomic
;
317 - (NSString
* _Nullable
)moxARIALive
;
320 - (NSString
* _Nullable
)moxARIARelevant
;
322 // AXMozDebugDescription
323 - (NSString
* _Nullable
)moxMozDebugDescription
;
325 #pragma mark - AttributeSetters
328 - (void)moxSetDisclosing
:(NSNumber
* _Nullable
)disclosing
;
331 - (void)moxSetValue
:(id _Nullable
)value
;
334 - (void)moxSetFocused
:(NSNumber
* _Nullable
)focused
;
337 - (void)moxSetSelected
:(NSNumber
* _Nullable
)selected
;
339 // AXSelectedChildren
340 - (void)moxSetSelectedChildren
:(NSArray
* _Nullable
)selectedChildren
;
343 - (void)moxSetSelectedText
:(NSString
* _Nullable
)selectedText
;
345 // AXSelectedTextRange
346 - (void)moxSetSelectedTextRange
:(NSValue
* _Nullable
)selectedTextRange
;
348 // AXVisibleCharacterRange
349 - (void)moxSetVisibleCharacterRange
:(NSValue
* _Nullable
)visibleCharacterRange
;
351 #pragma mark - Actions
354 - (void)moxPerformPress
;
357 - (void)moxPerformShowMenu
;
360 - (void)moxPerformScrollToVisible
;
363 - (void)moxPerformIncrement
;
366 - (void)moxPerformDecrement
;
368 #pragma mark - ParameterizedAttributeGetters
371 - (NSNumber
* _Nullable
)moxLineForIndex
:(NSNumber
* _Nonnull
)index
;
374 - (NSValue
* _Nullable
)moxRangeForLine
:(NSNumber
* _Nonnull
)line
;
377 - (NSString
* _Nullable
)moxStringForRange
:(NSValue
* _Nonnull
)range
;
379 // AXRangeForPosition
380 - (NSValue
* _Nullable
)moxRangeForPosition
:(NSValue
* _Nonnull
)position
;
383 - (NSValue
* _Nullable
)moxRangeForIndex
:(NSNumber
* _Nonnull
)index
;
386 - (NSValue
* _Nullable
)moxBoundsForRange
:(NSValue
* _Nonnull
)range
;
389 - (NSData
* _Nullable
)moxRTFForRange
:(NSValue
* _Nonnull
)range
;
391 // AXStyleRangeForIndex
392 - (NSValue
* _Nullable
)moxStyleRangeForIndex
:(NSNumber
* _Nonnull
)index
;
394 // AXAttributedStringForRange
395 - (NSAttributedString
* _Nullable
)moxAttributedStringForRange
:
396 (NSValue
* _Nonnull
)range
;
398 // AXUIElementsForSearchPredicate
399 - (NSArray
* _Nullable
)moxUIElementsForSearchPredicate
:
400 (NSDictionary
* _Nonnull
)searchPredicate
;
402 // AXUIElementCountForSearchPredicate
403 - (NSNumber
* _Nullable
)moxUIElementCountForSearchPredicate
:
404 (NSDictionary
* _Nonnull
)searchPredicate
;
406 // AXCellForColumnAndRow
407 - (id _Nullable
)moxCellForColumnAndRow
:(NSArray
* _Nonnull
)columnAndRow
;
409 // AXIndexForChildUIElement
410 - (NSNumber
* _Nullable
)moxIndexForChildUIElement
:(id _Nonnull
)child
;
414 // This protocol maps text marker and text marker range parameters to
415 // methods. It is implemented by a delegate of a MOXAccessible.
416 @protocol MOXTextMarkerSupport
418 #pragma mark - TextAttributeGetters
421 - (id _Nullable
)moxStartTextMarker
;
424 - (id _Nullable
)moxEndTextMarker
;
426 // AXSelectedTextMarkerRange
427 - (id _Nullable
)moxSelectedTextMarkerRange
;
429 #pragma mark - ParameterizedTextAttributeGetters
431 // AXLengthForTextMarkerRange
432 - (NSNumber
* _Nullable
)moxLengthForTextMarkerRange
:(id _Nonnull
)textMarkerRange
;
434 // AXStringForTextMarkerRange
435 - (NSString
* _Nullable
)moxStringForTextMarkerRange
:(id _Nonnull
)textMarkerRange
;
437 // AXTextMarkerRangeForUnorderedTextMarkers
438 - (id _Nullable
)moxTextMarkerRangeForUnorderedTextMarkers
:
439 (NSArray
* _Nonnull
)textMarkers
;
441 // AXLeftWordTextMarkerRangeForTextMarker
442 - (id _Nullable
)moxLeftWordTextMarkerRangeForTextMarker
:(id _Nonnull
)textMarker
;
444 // AXRightWordTextMarkerRangeForTextMarker
445 - (id _Nullable
)moxRightWordTextMarkerRangeForTextMarker
:
446 (id _Nonnull
)textMarker
;
448 // AXStartTextMarkerForTextMarkerRange
449 - (id _Nullable
)moxStartTextMarkerForTextMarkerRange
:
450 (id _Nonnull
)textMarkerRange
;
452 // AXEndTextMarkerForTextMarkerRange
453 - (id _Nullable
)moxEndTextMarkerForTextMarkerRange
:(id _Nonnull
)textMarkerRange
;
455 // AXNextTextMarkerForTextMarker
456 - (id _Nullable
)moxNextTextMarkerForTextMarker
:(id _Nonnull
)textMarker
;
458 // AXPreviousTextMarkerForTextMarker
459 - (id _Nullable
)moxPreviousTextMarkerForTextMarker
:(id _Nonnull
)textMarker
;
461 // AXAttributedStringForTextMarkerRange
462 - (NSAttributedString
* _Nullable
)moxAttributedStringForTextMarkerRange
:
463 (id _Nonnull
)textMarkerRange
;
465 // AXBoundsForTextMarkerRange
466 - (NSValue
* _Nullable
)moxBoundsForTextMarkerRange
:(id _Nonnull
)textMarkerRange
;
468 // AXIndexForTextMarker
469 - (NSNumber
* _Nullable
)moxIndexForTextMarker
:(id _Nonnull
)textMarker
;
471 // AXTextMarkerForIndex
472 - (id _Nullable
)moxTextMarkerForIndex
:(NSNumber
* _Nonnull
)index
;
474 // AXUIElementForTextMarker
475 - (id _Nullable
)moxUIElementForTextMarker
:(id _Nonnull
)textMarker
;
477 // AXTextMarkerRangeForUIElement
478 - (id _Nullable
)moxTextMarkerRangeForUIElement
:(id _Nonnull
)element
;
480 // AXLineTextMarkerRangeForTextMarker
481 - (id _Nullable
)moxLineTextMarkerRangeForTextMarker
:(id _Nonnull
)textMarker
;
483 // AXLeftLineTextMarkerRangeForTextMarker
484 - (id _Nullable
)moxLeftLineTextMarkerRangeForTextMarker
:(id _Nonnull
)textMarker
;
486 // AXRightLineTextMarkerRangeForTextMarker
487 - (id _Nullable
)moxRightLineTextMarkerRangeForTextMarker
:
488 (id _Nonnull
)textMarker
;
490 // AXParagraphTextMarkerRangeForTextMarker
491 - (id _Nullable
)moxParagraphTextMarkerRangeForTextMarker
:
492 (id _Nonnull
)textMarker
;
494 // AXStyleTextMarkerRangeForTextMarker
495 - (id _Nullable
)moxStyleTextMarkerRangeForTextMarker
:(id _Nonnull
)textMarker
;
497 // AXMozDebugDescriptionForTextMarker
498 - (NSString
* _Nullable
)moxMozDebugDescriptionForTextMarker
:
499 (id _Nonnull
)textMarker
;
501 // AXMozDebugDescriptionForTextMarkerRange
502 - (NSString
* _Nullable
)moxMozDebugDescriptionForTextMarkerRange
:
503 (id _Nonnull
)textMarkerRange
;
505 #pragma mark - TextAttributeSetters
507 // AXSelectedTextMarkerRange
508 - (void)moxSetSelectedTextMarkerRange
:(id _Nullable
)textMarkerRange
;