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 #include "SDKDeclarations.h"
10 @protocol MOXTextMarkerSupport
;
11 @protocol mozAccessible
;
13 // This protocol's primary use is for abstracting the NSAccessibility informal
14 // protocol into a formal internal API. Conforming classes get to choose a
15 // subset of the optional methods to implement. Those methods will be mapped to
16 // NSAccessibility attributes or actions. A conforming class can implement
17 // moxBlockSelector to control which of its implemented methods should be
18 // exposed to NSAccessibility.
20 @protocol MOXAccessible
22 // The deepest descendant of the accessible subtree that contains the specified
23 // point. Forwarded from accessibilityHitTest.
24 - (id _Nullable
)moxHitTest
:(NSPoint
)point
;
26 // The deepest descendant of the accessible subtree that has the focus.
27 // Forwarded from accessibilityFocusedUIElement.
28 - (id _Nullable
)moxFocusedUIElement
;
30 // Sends a notification to any observing assistive applications.
31 - (void)moxPostNotification
:(NSString
* _Nonnull
)notification
;
33 - (void)moxPostNotification
:(NSString
* _Nonnull
)notification
34 withUserInfo
:(NSDictionary
* _Nullable
)userInfo
;
36 // Return YES if selector should be considered not supported.
37 // Used in implementations such as:
38 // - accessibilityAttributeNames
39 // - accessibilityActionNames
40 // - accessibilityIsAttributeSettable
41 - (BOOL
)moxBlockSelector
:(SEL _Nonnull
)selector
;
43 // Returns a list of all children, doesn't do ignore filtering.
44 - (NSArray
* _Nullable
)moxChildren
;
46 // Returns our parent, doesn't do ignore filtering.
47 - (id
<mozAccessible
> _Nullable
)moxParent
;
49 // This is called by isAccessibilityElement. If a subclass wants
50 // to alter the isAccessibilityElement return value, it must
51 // override this and not isAccessibilityElement directly.
52 - (BOOL
)moxIgnoreWithParent
:(id
<MOXAccessible
> _Nullable
)parent
;
54 // Should the child be ignored. This allows subclasses to determine
55 // what kinds of accessibles are valid children. This causes the child
56 // to be skipped, but the unignored descendants will be added to the
57 // container in the default children getter.
58 - (BOOL
)moxIgnoreChild
:(id
<MOXAccessible
> _Nullable
)child
;
60 // Return text delegate if it exists.
61 - (id
<MOXTextMarkerSupport
> _Nullable
)moxTextMarkerDelegate
;
63 // Return true if this accessible is a live region
64 - (BOOL
)moxIsLiveRegion
;
66 // Find the nearest ancestor that returns true with the given block function
67 - (id
<MOXAccessible
> _Nullable
)moxFindAncestor
:
68 (BOOL (^_Nonnull
)(id
<MOXAccessible
> _Nonnull moxAcc
,
69 BOOL
* _Nonnull stop
))findBlock
;
73 #pragma mark - AttributeGetters
76 - (NSArray
* _Nullable
)moxUnignoredChildren
;
79 - (id _Nullable
)moxUnignoredParent
;
82 - (NSString
* _Nullable
)moxRole
;
85 - (NSString
* _Nullable
)moxRoleDescription
;
88 - (NSString
* _Nullable
)moxSubrole
;
91 - (NSString
* _Nullable
)moxTitle
;
94 - (NSString
* _Nullable
)moxLabel
;
97 - (NSString
* _Nullable
)moxHelp
;
100 - (id _Nullable
)moxValue
;
102 // AXValueDescription
103 - (NSString
* _Nullable
)moxValueDescription
;
106 - (NSValue
* _Nullable
)moxSize
;
109 - (NSValue
* _Nullable
)moxPosition
;
112 - (NSNumber
* _Nullable
)moxEnabled
;
115 - (NSNumber
* _Nullable
)moxFocused
;
118 - (id _Nullable
)moxWindow
;
121 - (NSValue
* _Nullable
)moxFrame
;
124 - (id _Nullable
)moxTitleUIElement
;
126 // AXTopLevelUIElement
127 - (id _Nullable
)moxTopLevelUIElement
;
130 - (NSNumber
* _Nullable
)moxHasPopup
;
133 - (NSString
* _Nullable
)moxARIACurrent
;
136 - (NSNumber
* _Nullable
)moxSelected
;
139 - (NSNumber
* _Nullable
)moxRequired
;
142 - (NSNumber
* _Nullable
)moxElementBusy
;
144 // AXLinkedUIElements
145 - (NSArray
* _Nullable
)moxLinkedUIElements
;
148 - (NSArray
* _Nullable
)moxARIAControls
;
151 - (NSString
* _Nullable
)moxDOMIdentifier
;
154 - (NSURL
* _Nullable
)moxURL
;
157 - (NSArray
* _Nullable
)moxLinkUIElements
;
160 - (NSString
* _Nullable
)moxPopupValue
;
163 - (NSNumber
* _Nullable
)moxVisited
;
166 - (NSNumber
* _Nullable
)moxExpanded
;
169 - (NSNumber
* _Nullable
)moxMain
;
172 - (NSNumber
* _Nullable
)moxMinimized
;
174 // AXSelectedChildren
175 - (NSArray
* _Nullable
)moxSelectedChildren
;
178 - (NSArray
* _Nullable
)moxTabs
;
181 - (NSArray
* _Nullable
)moxContents
;
184 - (NSString
* _Nullable
)moxOrientation
;
186 // AXMenuItemMarkChar
187 - (NSString
* _Nullable
)moxMenuItemMarkChar
;
190 - (NSNumber
* _Nullable
)moxLoaded
;
193 - (NSNumber
* _Nullable
)moxLoadingProgress
;
196 - (id _Nullable
)moxMinValue
;
199 - (id _Nullable
)moxMaxValue
;
201 // Webkit also implements the following:
202 // // AXCaretBrowsingEnabled
203 // - (NSString* _Nullable)moxCaretBrowsingEnabled;
206 // - (NSString* _Nullable)moxLayoutCount;
209 // - (NSString* _Nullable)moxWebSessionID;
211 // // AXPreventKeyboardDOMEventDispatch
212 // - (NSString* _Nullable)moxPreventKeyboardDOMEventDispatch;
217 - (NSNumber
* _Nullable
)moxRowCount
;
220 - (NSNumber
* _Nullable
)moxColumnCount
;
223 - (NSArray
* _Nullable
)moxRows
;
226 - (NSArray
* _Nullable
)moxColumns
;
229 - (NSNumber
* _Nullable
)moxIndex
;
232 - (NSValue
* _Nullable
)moxRowIndexRange
;
234 // AXColumnIndexRange
235 - (NSValue
* _Nullable
)moxColumnIndexRange
;
237 // AXRowHeaderUIElements
238 - (NSArray
* _Nullable
)moxRowHeaderUIElements
;
240 // AXColumnHeaderUIElements
241 - (NSArray
* _Nullable
)moxColumnHeaderUIElements
;
244 - (NSString
* _Nullable
)moxIdentifier
;
247 - (NSArray
* _Nullable
)moxVisibleChildren
;
249 // Outline Attributes
252 - (NSNumber
* _Nullable
)moxDisclosing
;
255 - (id _Nullable
)moxDisclosedByRow
;
258 - (NSNumber
* _Nullable
)moxDisclosureLevel
;
261 - (NSArray
* _Nullable
)moxDisclosedRows
;
264 - (NSArray
* _Nullable
)moxSelectedRows
;
268 // AXMathRootRadicand
269 - (id _Nullable
)moxMathRootRadicand
;
272 - (id _Nullable
)moxMathRootIndex
;
274 // AXMathFractionNumerator
275 - (id _Nullable
)moxMathFractionNumerator
;
277 // AXMathFractionDenominator
278 - (id _Nullable
)moxMathFractionDenominator
;
280 // AXMathLineThickness
281 - (NSNumber
* _Nullable
)moxMathLineThickness
;
284 - (id _Nullable
)moxMathBase
;
287 - (id _Nullable
)moxMathSubscript
;
290 - (id _Nullable
)moxMathSuperscript
;
293 - (id _Nullable
)moxMathUnder
;
296 - (id _Nullable
)moxMathOver
;
299 - (NSString
* _Nullable
)moxInvalid
;
302 - (NSString
* _Nullable
)moxSelectedText
;
304 // AXSelectedTextRange
305 - (NSValue
* _Nullable
)moxSelectedTextRange
;
307 // AXNumberOfCharacters
308 - (NSNumber
* _Nullable
)moxNumberOfCharacters
;
310 // AXVisibleCharacterRange
311 - (NSValue
* _Nullable
)moxVisibleCharacterRange
;
313 // AXInsertionPointLineNumber
314 - (NSNumber
* _Nullable
)moxInsertionPointLineNumber
;
316 // AXEditableAncestor
317 - (id _Nullable
)moxEditableAncestor
;
319 // AXHighestEditableAncestor
320 - (id _Nullable
)moxHighestEditableAncestor
;
322 // AXFocusableAncestor
323 - (id _Nullable
)moxFocusableAncestor
;
326 - (NSNumber
* _Nullable
)moxARIAAtomic
;
329 - (NSString
* _Nullable
)moxARIALive
;
332 - (NSString
* _Nullable
)moxARIARelevant
;
334 // AXMozDebugDescription
335 - (NSString
* _Nullable
)moxMozDebugDescription
;
337 #pragma mark - AttributeSetters
340 - (void)moxSetDisclosing
:(NSNumber
* _Nullable
)disclosing
;
343 - (void)moxSetValue
:(id _Nullable
)value
;
346 - (void)moxSetFocused
:(NSNumber
* _Nullable
)focused
;
349 - (void)moxSetSelected
:(NSNumber
* _Nullable
)selected
;
351 // AXSelectedChildren
352 - (void)moxSetSelectedChildren
:(NSArray
* _Nullable
)selectedChildren
;
355 - (void)moxSetSelectedText
:(NSString
* _Nullable
)selectedText
;
357 // AXSelectedTextRange
358 - (void)moxSetSelectedTextRange
:(NSValue
* _Nullable
)selectedTextRange
;
360 // AXVisibleCharacterRange
361 - (void)moxSetVisibleCharacterRange
:(NSValue
* _Nullable
)visibleCharacterRange
;
363 #pragma mark - Actions
366 - (void)moxPerformPress
;
369 - (void)moxPerformShowMenu
;
372 - (void)moxPerformScrollToVisible
;
375 - (void)moxPerformIncrement
;
378 - (void)moxPerformDecrement
;
380 #pragma mark - ParameterizedAttributeGetters
383 - (NSNumber
* _Nullable
)moxLineForIndex
:(NSNumber
* _Nonnull
)index
;
386 - (NSValue
* _Nullable
)moxRangeForLine
:(NSNumber
* _Nonnull
)line
;
389 - (NSString
* _Nullable
)moxStringForRange
:(NSValue
* _Nonnull
)range
;
391 // AXRangeForPosition
392 - (NSValue
* _Nullable
)moxRangeForPosition
:(NSValue
* _Nonnull
)position
;
395 - (NSValue
* _Nullable
)moxRangeForIndex
:(NSNumber
* _Nonnull
)index
;
398 - (NSValue
* _Nullable
)moxBoundsForRange
:(NSValue
* _Nonnull
)range
;
401 - (NSData
* _Nullable
)moxRTFForRange
:(NSValue
* _Nonnull
)range
;
403 // AXStyleRangeForIndex
404 - (NSValue
* _Nullable
)moxStyleRangeForIndex
:(NSNumber
* _Nonnull
)index
;
406 // AXAttributedStringForRange
407 - (NSAttributedString
* _Nullable
)moxAttributedStringForRange
:
408 (NSValue
* _Nonnull
)range
;
410 // AXUIElementsForSearchPredicate
411 - (NSArray
* _Nullable
)moxUIElementsForSearchPredicate
:
412 (NSDictionary
* _Nonnull
)searchPredicate
;
414 // AXUIElementCountForSearchPredicate
415 - (NSNumber
* _Nullable
)moxUIElementCountForSearchPredicate
:
416 (NSDictionary
* _Nonnull
)searchPredicate
;
418 // AXCellForColumnAndRow
419 - (id _Nullable
)moxCellForColumnAndRow
:(NSArray
* _Nonnull
)columnAndRow
;
421 // AXIndexForChildUIElement
422 - (NSNumber
* _Nullable
)moxIndexForChildUIElement
:(id _Nonnull
)child
;
426 // This protocol maps text marker and text marker range parameters to
427 // methods. It is implemented by a delegate of a MOXAccessible.
428 @protocol MOXTextMarkerSupport
430 #pragma mark - TextAttributeGetters
433 - (AXTextMarkerRef _Nullable
)moxStartTextMarker
;
436 - (AXTextMarkerRef _Nullable
)moxEndTextMarker
;
438 // AXSelectedTextMarkerRange
439 - (AXTextMarkerRangeRef _Nullable
)moxSelectedTextMarkerRange
;
441 #pragma mark - ParameterizedTextAttributeGetters
443 // AXLengthForTextMarkerRange
444 - (NSNumber
* _Nullable
)moxLengthForTextMarkerRange
:
445 (AXTextMarkerRangeRef _Nonnull
)textMarkerRange
;
447 // AXStringForTextMarkerRange
448 - (NSString
* _Nullable
)moxStringForTextMarkerRange
:
449 (AXTextMarkerRangeRef _Nonnull
)textMarkerRange
;
451 // AXTextMarkerRangeForUnorderedTextMarkers
452 - (AXTextMarkerRangeRef _Nullable
)moxTextMarkerRangeForUnorderedTextMarkers
:
453 (NSArray
* _Nonnull
)textMarkers
;
455 // AXLeftWordTextMarkerRangeForTextMarker
456 - (AXTextMarkerRangeRef _Nullable
)moxLeftWordTextMarkerRangeForTextMarker
:
457 (AXTextMarkerRef _Nonnull
)textMarker
;
459 // AXRightWordTextMarkerRangeForTextMarker
460 - (AXTextMarkerRangeRef _Nullable
)moxRightWordTextMarkerRangeForTextMarker
:
461 (AXTextMarkerRef _Nonnull
)textMarker
;
463 // AXStartTextMarkerForTextMarkerRange
464 - (AXTextMarkerRef _Nullable
)moxStartTextMarkerForTextMarkerRange
:
465 (AXTextMarkerRangeRef _Nonnull
)textMarkerRange
;
467 // AXEndTextMarkerForTextMarkerRange
468 - (AXTextMarkerRef _Nullable
)moxEndTextMarkerForTextMarkerRange
:
469 (AXTextMarkerRangeRef _Nonnull
)textMarkerRange
;
471 // AXNextTextMarkerForTextMarker
472 - (AXTextMarkerRef _Nullable
)moxNextTextMarkerForTextMarker
:
473 (AXTextMarkerRef _Nonnull
)textMarker
;
475 // AXPreviousTextMarkerForTextMarker
476 - (AXTextMarkerRef _Nullable
)moxPreviousTextMarkerForTextMarker
:
477 (AXTextMarkerRef _Nonnull
)textMarker
;
479 // AXAttributedStringForTextMarkerRange
480 - (NSAttributedString
* _Nullable
)moxAttributedStringForTextMarkerRange
:
481 (AXTextMarkerRangeRef _Nonnull
)textMarkerRange
;
483 // AXBoundsForTextMarkerRange
484 - (NSValue
* _Nullable
)moxBoundsForTextMarkerRange
:
485 (AXTextMarkerRangeRef _Nonnull
)textMarkerRange
;
487 // AXIndexForTextMarker
488 - (NSNumber
* _Nullable
)moxIndexForTextMarker
:
489 (AXTextMarkerRef _Nonnull
)textMarker
;
491 // AXTextMarkerForIndex
492 - (AXTextMarkerRef _Nullable
)moxTextMarkerForIndex
:(NSNumber
* _Nonnull
)index
;
494 // AXUIElementForTextMarker
495 - (id _Nullable
)moxUIElementForTextMarker
:(AXTextMarkerRef _Nonnull
)textMarker
;
497 // AXTextMarkerRangeForUIElement
498 - (AXTextMarkerRangeRef _Nullable
)moxTextMarkerRangeForUIElement
:
499 (id _Nonnull
)element
;
501 // AXLineTextMarkerRangeForTextMarker
502 - (AXTextMarkerRangeRef _Nullable
)moxLineTextMarkerRangeForTextMarker
:
503 (AXTextMarkerRef _Nonnull
)textMarker
;
505 // AXLeftLineTextMarkerRangeForTextMarker
506 - (AXTextMarkerRangeRef _Nullable
)moxLeftLineTextMarkerRangeForTextMarker
:
507 (AXTextMarkerRef _Nonnull
)textMarker
;
509 // AXRightLineTextMarkerRangeForTextMarker
510 - (AXTextMarkerRangeRef _Nullable
)moxRightLineTextMarkerRangeForTextMarker
:
511 (AXTextMarkerRef _Nonnull
)textMarker
;
513 // AXParagraphTextMarkerRangeForTextMarker
514 - (AXTextMarkerRangeRef _Nullable
)moxParagraphTextMarkerRangeForTextMarker
:
515 (AXTextMarkerRef _Nonnull
)textMarker
;
517 // AXStyleTextMarkerRangeForTextMarker
518 - (AXTextMarkerRangeRef _Nullable
)moxStyleTextMarkerRangeForTextMarker
:
519 (AXTextMarkerRef _Nonnull
)textMarker
;
521 // AXMozDebugDescriptionForTextMarker
522 - (NSString
* _Nullable
)moxMozDebugDescriptionForTextMarker
:
523 (AXTextMarkerRef _Nonnull
)textMarker
;
525 // AXMozDebugDescriptionForTextMarkerRange
526 - (NSString
* _Nullable
)moxMozDebugDescriptionForTextMarkerRange
:
527 (AXTextMarkerRangeRef _Nonnull
)textMarkerRange
;
529 #pragma mark - TextAttributeSetters
531 // AXSelectedTextMarkerRange
532 - (void)moxSetSelectedTextMarkerRange
:(id _Nullable
)textMarkerRange
;