tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

MOXAccessibleProtocol.h (14459B)


      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/. */
      7 
      8 @protocol MOXTextMarkerSupport;
      9 @protocol mozAccessible;
     10 
     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.
     17 
     18 @protocol MOXAccessible
     19 
     20 // The deepest descendant of the accessible subtree that contains the specified
     21 // point. Forwarded from accessibilityHitTest.
     22 - (id _Nullable)moxHitTest:(NSPoint)point;
     23 
     24 // The deepest descendant of the accessible subtree that has the focus.
     25 // Forwarded from accessibilityFocusedUIElement.
     26 - (id _Nullable)moxFocusedUIElement;
     27 
     28 // Retrieve a list of custom actions.
     29 - (NSArray* _Nullable)moxCustomActions;
     30 
     31 // Sends a notification to any observing assistive applications.
     32 - (void)moxPostNotification:(NSString* _Nonnull)notification;
     33 
     34 - (void)moxPostNotification:(NSString* _Nonnull)notification
     35               withUserInfo:(NSDictionary* _Nullable)userInfo;
     36 
     37 // Return YES if selector should be considered not supported.
     38 // Used in implementations such as:
     39 // - accessibilityAttributeNames
     40 // - accessibilityActionNames
     41 // - accessibilityIsAttributeSettable
     42 - (BOOL)moxBlockSelector:(SEL _Nonnull)selector;
     43 
     44 // Returns a list of all children, doesn't do ignore filtering.
     45 - (NSArray* _Nullable)moxChildren;
     46 
     47 // Returns our parent, doesn't do ignore filtering.
     48 - (id<mozAccessible> _Nullable)moxParent;
     49 
     50 // This is called by isAccessibilityElement. If a subclass wants
     51 // to alter the isAccessibilityElement return value, it must
     52 // override this and not isAccessibilityElement directly.
     53 - (BOOL)moxIgnoreWithParent:(id<MOXAccessible> _Nullable)parent;
     54 
     55 // Should the child be ignored. This allows subclasses to determine
     56 // what kinds of accessibles are valid children. This causes the child
     57 // to be skipped, but the unignored descendants will be added to the
     58 // container in the default children getter.
     59 - (BOOL)moxIgnoreChild:(id<MOXAccessible> _Nullable)child;
     60 
     61 // Return text delegate if it exists.
     62 - (id<MOXTextMarkerSupport> _Nullable)moxTextMarkerDelegate;
     63 
     64 // Return true if this accessible is a live region
     65 - (BOOL)moxIsLiveRegion;
     66 
     67 - (BOOL)moxIsTextField;
     68 
     69 // Find the nearest ancestor that returns true with the given block function
     70 - (id<MOXAccessible> _Nullable)moxFindAncestor:
     71    (BOOL (^_Nonnull)(id<MOXAccessible> _Nonnull moxAcc,
     72                      BOOL* _Nonnull stop))findBlock;
     73 
     74 @optional
     75 
     76 #pragma mark - AttributeGetters
     77 
     78 // AXChildren
     79 - (NSArray* _Nullable)moxUnignoredChildren;
     80 
     81 // AXParent
     82 - (id _Nullable)moxUnignoredParent;
     83 
     84 // AXRole
     85 - (NSString* _Nullable)moxRole;
     86 
     87 // AXRoleDescription
     88 - (NSString* _Nullable)moxRoleDescription;
     89 
     90 // AXSubrole
     91 - (NSString* _Nullable)moxSubrole;
     92 
     93 // AXTitle
     94 - (NSString* _Nullable)moxTitle;
     95 
     96 // AXDescription
     97 - (NSString* _Nullable)moxLabel;
     98 
     99 // AXHelp
    100 - (NSString* _Nullable)moxHelp;
    101 
    102 // AXValue
    103 - (id _Nullable)moxValue;
    104 
    105 // AXValueDescription
    106 - (NSString* _Nullable)moxValueDescription;
    107 
    108 // AXSize
    109 - (NSValue* _Nullable)moxSize;
    110 
    111 // AXPosition
    112 - (NSValue* _Nullable)moxPosition;
    113 
    114 // AXEnabled
    115 - (NSNumber* _Nullable)moxEnabled;
    116 
    117 // AXErrorMessageElements
    118 - (NSArray* _Nullable)moxErrorMessageElements;
    119 
    120 // AXFocused
    121 - (NSNumber* _Nullable)moxFocused;
    122 
    123 // AXWindow
    124 - (id _Nullable)moxWindow;
    125 
    126 // AXFrame
    127 - (NSValue* _Nullable)moxFrame;
    128 
    129 // AXTitleUIElement
    130 - (id _Nullable)moxTitleUIElement;
    131 
    132 // AXTopLevelUIElement
    133 - (id _Nullable)moxTopLevelUIElement;
    134 
    135 // AXHasPopup
    136 - (NSNumber* _Nullable)moxHasPopup;
    137 
    138 // AXARIACurrent
    139 - (NSString* _Nullable)moxARIACurrent;
    140 
    141 // AXSelected
    142 - (NSNumber* _Nullable)moxSelected;
    143 
    144 // AXRequired
    145 - (NSNumber* _Nullable)moxRequired;
    146 
    147 // AXElementBusy
    148 - (NSNumber* _Nullable)moxElementBusy;
    149 
    150 // AXLinkedUIElements
    151 - (NSArray* _Nullable)moxLinkedUIElements;
    152 
    153 // AXARIAControls
    154 - (NSArray* _Nullable)moxARIAControls;
    155 
    156 // AXDOMIdentifier
    157 - (NSString* _Nullable)moxDOMIdentifier;
    158 
    159 // AXURL
    160 - (NSURL* _Nullable)moxURL;
    161 
    162 // AXLinkUIElements
    163 - (NSArray* _Nullable)moxLinkUIElements;
    164 
    165 // AXPopupValue
    166 - (NSString* _Nullable)moxPopupValue;
    167 
    168 // AXVisited
    169 - (NSNumber* _Nullable)moxVisited;
    170 
    171 // AXExpanded
    172 - (NSNumber* _Nullable)moxExpanded;
    173 
    174 // AXMain
    175 - (NSNumber* _Nullable)moxMain;
    176 
    177 // AXMinimized
    178 - (NSNumber* _Nullable)moxMinimized;
    179 
    180 // AXSelectedChildren
    181 - (NSArray* _Nullable)moxSelectedChildren;
    182 
    183 // AXTabs
    184 - (NSArray* _Nullable)moxTabs;
    185 
    186 // AXContents
    187 - (NSArray* _Nullable)moxContents;
    188 
    189 // AXOrientation
    190 - (NSString* _Nullable)moxOrientation;
    191 
    192 // AXMenuItemMarkChar
    193 - (NSString* _Nullable)moxMenuItemMarkChar;
    194 
    195 // AXLoaded
    196 - (NSNumber* _Nullable)moxLoaded;
    197 
    198 // AXLoadingProgress
    199 - (NSNumber* _Nullable)moxLoadingProgress;
    200 
    201 // AXMinValue
    202 - (id _Nullable)moxMinValue;
    203 
    204 // AXMaxValue
    205 - (id _Nullable)moxMaxValue;
    206 
    207 // Webkit also implements the following:
    208 // // AXCaretBrowsingEnabled
    209 // - (NSString* _Nullable)moxCaretBrowsingEnabled;
    210 
    211 // // AXLayoutCount
    212 // - (NSString* _Nullable)moxLayoutCount;
    213 
    214 // // AXWebSessionID
    215 // - (NSString* _Nullable)moxWebSessionID;
    216 
    217 // // AXPreventKeyboardDOMEventDispatch
    218 // - (NSString* _Nullable)moxPreventKeyboardDOMEventDispatch;
    219 
    220 // Table Attributes
    221 
    222 // AXRowCount
    223 - (NSNumber* _Nullable)moxRowCount;
    224 
    225 // AXColumnCount
    226 - (NSNumber* _Nullable)moxColumnCount;
    227 
    228 // AXRows
    229 - (NSArray* _Nullable)moxRows;
    230 
    231 // AXColumns
    232 - (NSArray* _Nullable)moxColumns;
    233 
    234 // AXIndex
    235 - (NSNumber* _Nullable)moxIndex;
    236 
    237 // AXRowIndexRange
    238 - (NSValue* _Nullable)moxRowIndexRange;
    239 
    240 // AXColumnIndexRange
    241 - (NSValue* _Nullable)moxColumnIndexRange;
    242 
    243 // AXRowHeaderUIElements
    244 - (NSArray* _Nullable)moxRowHeaderUIElements;
    245 
    246 // AXColumnHeaderUIElements
    247 - (NSArray* _Nullable)moxColumnHeaderUIElements;
    248 
    249 // AXIdentifier
    250 - (NSString* _Nullable)moxIdentifier;
    251 
    252 // AXVisibleChildren
    253 - (NSArray* _Nullable)moxVisibleChildren;
    254 
    255 // Outline Attributes
    256 
    257 // AXDisclosing
    258 - (NSNumber* _Nullable)moxDisclosing;
    259 
    260 // AXDisclosedByRow
    261 - (id _Nullable)moxDisclosedByRow;
    262 
    263 // AXDisclosureLevel
    264 - (NSNumber* _Nullable)moxDisclosureLevel;
    265 
    266 // AXDisclosedRows
    267 - (NSArray* _Nullable)moxDisclosedRows;
    268 
    269 // AXSelectedRows
    270 - (NSArray* _Nullable)moxSelectedRows;
    271 
    272 // AXARIAPosInSet
    273 - (NSNumber* _Nullable)moxARIAPosInSet;
    274 
    275 // AXARIASetSize
    276 - (NSNumber* _Nullable)moxARIASetSize;
    277 
    278 // Math Attributes
    279 
    280 // AXMathRootRadicand
    281 - (id _Nullable)moxMathRootRadicand;
    282 
    283 // AXMathRootIndex
    284 - (id _Nullable)moxMathRootIndex;
    285 
    286 // AXMathFractionNumerator
    287 - (id _Nullable)moxMathFractionNumerator;
    288 
    289 // AXMathFractionDenominator
    290 - (id _Nullable)moxMathFractionDenominator;
    291 
    292 // AXMathLineThickness
    293 - (NSNumber* _Nullable)moxMathLineThickness;
    294 
    295 // AXMathBase
    296 - (id _Nullable)moxMathBase;
    297 
    298 // AXMathSubscript
    299 - (id _Nullable)moxMathSubscript;
    300 
    301 // AXMathSuperscript
    302 - (id _Nullable)moxMathSuperscript;
    303 
    304 // AXMathUnder
    305 - (id _Nullable)moxMathUnder;
    306 
    307 // AXMathOver
    308 - (id _Nullable)moxMathOver;
    309 
    310 // AXInvalid
    311 - (NSString* _Nullable)moxInvalid;
    312 
    313 // AXSelectedText
    314 - (NSString* _Nullable)moxSelectedText;
    315 
    316 // AXSelectedTextRange
    317 - (NSValue* _Nullable)moxSelectedTextRange;
    318 
    319 // AXNumberOfCharacters
    320 - (NSNumber* _Nullable)moxNumberOfCharacters;
    321 
    322 // AXVisibleCharacterRange
    323 - (NSValue* _Nullable)moxVisibleCharacterRange;
    324 
    325 // AXInsertionPointLineNumber
    326 - (NSNumber* _Nullable)moxInsertionPointLineNumber;
    327 
    328 // AXEditableAncestor
    329 - (id _Nullable)moxEditableAncestor;
    330 
    331 // AXHighestEditableAncestor
    332 - (id _Nullable)moxHighestEditableAncestor;
    333 
    334 // AXFocusableAncestor
    335 - (id _Nullable)moxFocusableAncestor;
    336 
    337 // AXARIAAtomic
    338 - (NSNumber* _Nullable)moxARIAAtomic;
    339 
    340 // AXARIALive
    341 - (NSString* _Nullable)moxARIALive;
    342 
    343 // AXARIARelevant
    344 - (NSString* _Nullable)moxARIARelevant;
    345 
    346 // AXPlaceholderValue
    347 - (NSString* _Nullable)moxPlaceholderValue;
    348 
    349 // AXLanguage
    350 - (NSString* _Nullable)moxLanguage;
    351 
    352 // AXKeyShortcutsValue
    353 - (NSString* _Nullable)moxKeyShortcutsValue;
    354 
    355 // AXCustomContent
    356 - (NSArray* _Nullable)moxCustomContent;
    357 
    358 // AXMozDebugDescription
    359 - (NSString* _Nullable)moxMozDebugDescription;
    360 
    361 #pragma mark - AttributeSetters
    362 
    363 // AXDisclosing
    364 - (void)moxSetDisclosing:(NSNumber* _Nullable)disclosing;
    365 
    366 // AXValue
    367 - (void)moxSetValue:(id _Nullable)value;
    368 
    369 // AXFocused
    370 - (void)moxSetFocused:(NSNumber* _Nullable)focused;
    371 
    372 // AXSelected
    373 - (void)moxSetSelected:(NSNumber* _Nullable)selected;
    374 
    375 // AXSelectedChildren
    376 - (void)moxSetSelectedChildren:(NSArray* _Nullable)selectedChildren;
    377 
    378 // AXSelectedText
    379 - (void)moxSetSelectedText:(NSString* _Nullable)selectedText;
    380 
    381 // AXSelectedTextRange
    382 - (void)moxSetSelectedTextRange:(NSValue* _Nullable)selectedTextRange;
    383 
    384 // AXVisibleCharacterRange
    385 - (void)moxSetVisibleCharacterRange:(NSValue* _Nullable)visibleCharacterRange;
    386 
    387 #pragma mark - Actions
    388 
    389 // AXPress
    390 - (void)moxPerformPress;
    391 
    392 // AXShowMenu
    393 - (void)moxPerformShowMenu;
    394 
    395 // AXScrollToVisible
    396 - (void)moxPerformScrollToVisible;
    397 
    398 // AXIncrement
    399 - (void)moxPerformIncrement;
    400 
    401 // AXDecrement
    402 - (void)moxPerformDecrement;
    403 
    404 #pragma mark - ParameterizedAttributeGetters
    405 
    406 // AXLineForIndex
    407 - (NSNumber* _Nullable)moxLineForIndex:(NSNumber* _Nonnull)index;
    408 
    409 // AXRangeForLine
    410 - (NSValue* _Nullable)moxRangeForLine:(NSNumber* _Nonnull)line;
    411 
    412 // AXStringForRange
    413 - (NSString* _Nullable)moxStringForRange:(NSValue* _Nonnull)range;
    414 
    415 // AXRangeForPosition
    416 - (NSValue* _Nullable)moxRangeForPosition:(NSValue* _Nonnull)position;
    417 
    418 // AXRangeForIndex
    419 - (NSValue* _Nullable)moxRangeForIndex:(NSNumber* _Nonnull)index;
    420 
    421 // AXBoundsForRange
    422 - (NSValue* _Nullable)moxBoundsForRange:(NSValue* _Nonnull)range;
    423 
    424 // AXRTFForRange
    425 - (NSData* _Nullable)moxRTFForRange:(NSValue* _Nonnull)range;
    426 
    427 // AXStyleRangeForIndex
    428 - (NSValue* _Nullable)moxStyleRangeForIndex:(NSNumber* _Nonnull)index;
    429 
    430 // AXAttributedStringForRange
    431 - (NSAttributedString* _Nullable)moxAttributedStringForRange:
    432    (NSValue* _Nonnull)range;
    433 
    434 // AXUIElementsForSearchPredicate
    435 - (NSArray* _Nullable)moxUIElementsForSearchPredicate:
    436    (NSDictionary* _Nonnull)searchPredicate;
    437 
    438 // AXUIElementCountForSearchPredicate
    439 - (NSNumber* _Nullable)moxUIElementCountForSearchPredicate:
    440    (NSDictionary* _Nonnull)searchPredicate;
    441 
    442 // AXCellForColumnAndRow
    443 - (id _Nullable)moxCellForColumnAndRow:(NSArray* _Nonnull)columnAndRow;
    444 
    445 // AXIndexForChildUIElement
    446 - (NSNumber* _Nullable)moxIndexForChildUIElement:(id _Nonnull)child;
    447 
    448 @end
    449 
    450 // This protocol maps text marker and text marker range parameters to
    451 // methods. It is implemented by a delegate of a MOXAccessible.
    452 @protocol MOXTextMarkerSupport
    453 
    454 #pragma mark - TextAttributeGetters
    455 
    456 // AXStartTextMarker
    457 - (AXTextMarkerRef _Nullable)moxStartTextMarker;
    458 
    459 // AXEndTextMarker
    460 - (AXTextMarkerRef _Nullable)moxEndTextMarker;
    461 
    462 // AXSelectedTextMarkerRange
    463 - (AXTextMarkerRangeRef _Nullable)moxSelectedTextMarkerRange;
    464 
    465 #pragma mark - ParameterizedTextAttributeGetters
    466 
    467 // AXLengthForTextMarkerRange
    468 - (NSNumber* _Nullable)moxLengthForTextMarkerRange:
    469    (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
    470 
    471 // AXStringForTextMarkerRange
    472 - (NSString* _Nullable)moxStringForTextMarkerRange:
    473    (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
    474 
    475 // AXTextMarkerRangeForUnorderedTextMarkers
    476 - (AXTextMarkerRangeRef _Nullable)moxTextMarkerRangeForUnorderedTextMarkers:
    477    (NSArray* _Nonnull)textMarkers;
    478 
    479 // AXLeftWordTextMarkerRangeForTextMarker
    480 - (AXTextMarkerRangeRef _Nullable)moxLeftWordTextMarkerRangeForTextMarker:
    481    (AXTextMarkerRef _Nonnull)textMarker;
    482 
    483 // AXRightWordTextMarkerRangeForTextMarker
    484 - (AXTextMarkerRangeRef _Nullable)moxRightWordTextMarkerRangeForTextMarker:
    485    (AXTextMarkerRef _Nonnull)textMarker;
    486 
    487 // AXStartTextMarkerForTextMarkerRange
    488 - (AXTextMarkerRef _Nullable)moxStartTextMarkerForTextMarkerRange:
    489    (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
    490 
    491 // AXEndTextMarkerForTextMarkerRange
    492 - (AXTextMarkerRef _Nullable)moxEndTextMarkerForTextMarkerRange:
    493    (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
    494 
    495 // AXNextTextMarkerForTextMarker
    496 - (AXTextMarkerRef _Nullable)moxNextTextMarkerForTextMarker:
    497    (AXTextMarkerRef _Nonnull)textMarker;
    498 
    499 // AXPreviousTextMarkerForTextMarker
    500 - (AXTextMarkerRef _Nullable)moxPreviousTextMarkerForTextMarker:
    501    (AXTextMarkerRef _Nonnull)textMarker;
    502 
    503 // AXAttributedStringForTextMarkerRange
    504 - (NSAttributedString* _Nullable)moxAttributedStringForTextMarkerRange:
    505    (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
    506 
    507 // AXBoundsForTextMarkerRange
    508 - (NSValue* _Nullable)moxBoundsForTextMarkerRange:
    509    (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
    510 
    511 // AXIndexForTextMarker
    512 - (NSNumber* _Nullable)moxIndexForTextMarker:
    513    (AXTextMarkerRef _Nonnull)textMarker;
    514 
    515 // AXTextMarkerForIndex
    516 - (AXTextMarkerRef _Nullable)moxTextMarkerForIndex:(NSNumber* _Nonnull)index;
    517 
    518 // AXUIElementForTextMarker
    519 - (id _Nullable)moxUIElementForTextMarker:(AXTextMarkerRef _Nonnull)textMarker;
    520 
    521 // AXTextMarkerRangeForUIElement
    522 - (AXTextMarkerRangeRef _Nullable)moxTextMarkerRangeForUIElement:
    523    (id _Nonnull)element;
    524 
    525 // AXLineTextMarkerRangeForTextMarker
    526 - (AXTextMarkerRangeRef _Nullable)moxLineTextMarkerRangeForTextMarker:
    527    (AXTextMarkerRef _Nonnull)textMarker;
    528 
    529 // AXLeftLineTextMarkerRangeForTextMarker
    530 - (AXTextMarkerRangeRef _Nullable)moxLeftLineTextMarkerRangeForTextMarker:
    531    (AXTextMarkerRef _Nonnull)textMarker;
    532 
    533 // AXRightLineTextMarkerRangeForTextMarker
    534 - (AXTextMarkerRangeRef _Nullable)moxRightLineTextMarkerRangeForTextMarker:
    535    (AXTextMarkerRef _Nonnull)textMarker;
    536 
    537 // AXParagraphTextMarkerRangeForTextMarker
    538 - (AXTextMarkerRangeRef _Nullable)moxParagraphTextMarkerRangeForTextMarker:
    539    (AXTextMarkerRef _Nonnull)textMarker;
    540 
    541 // AXStyleTextMarkerRangeForTextMarker
    542 - (AXTextMarkerRangeRef _Nullable)moxStyleTextMarkerRangeForTextMarker:
    543    (AXTextMarkerRef _Nonnull)textMarker;
    544 
    545 // AXMozDebugDescriptionForTextMarker
    546 - (NSString* _Nullable)moxMozDebugDescriptionForTextMarker:
    547    (AXTextMarkerRef _Nonnull)textMarker;
    548 
    549 // AXMozDebugDescriptionForTextMarkerRange
    550 - (NSString* _Nullable)moxMozDebugDescriptionForTextMarkerRange:
    551    (AXTextMarkerRangeRef _Nonnull)textMarkerRange;
    552 
    553 #pragma mark - TextAttributeSetters
    554 
    555 // AXSelectedTextMarkerRange
    556 - (void)moxSetSelectedTextMarkerRange:(id _Nullable)textMarkerRange;
    557 
    558 @end