tor-browser

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

mozAccessible.h (5981B)


      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 #ifndef _MozAccessible_H_
      9 #define _MozAccessible_H_
     10 
     11 #include "AccessibleWrap.h"
     12 #include "RemoteAccessible.h"
     13 
     14 #import <Cocoa/Cocoa.h>
     15 
     16 #import "MOXAccessibleBase.h"
     17 
     18 @class mozRootAccessible;
     19 
     20 /**
     21 * All mozAccessibles are either abstract objects (that correspond to XUL
     22 * widgets, HTML frames, etc) or are attached to a certain view; for example
     23 * a document view. When we hand an object off to an AT, we always want
     24 * to give it the represented view, in the latter case.
     25 */
     26 
     27 namespace mozilla {
     28 namespace a11y {
     29 
     30 inline mozAccessible* GetNativeFromGeckoAccessible(
     31    mozilla::a11y::Accessible* aAcc) {
     32  if (!aAcc) {
     33    return nil;
     34  }
     35  if (LocalAccessible* acc = aAcc->AsLocal()) {
     36    mozAccessible* native = nil;
     37    acc->GetNativeInterface((void**)&native);
     38    return native;
     39  }
     40 
     41  RemoteAccessible* proxy = aAcc->AsRemote();
     42  return reinterpret_cast<mozAccessible*>(proxy->GetWrapper());
     43 }
     44 
     45 // Checked state values some accessibles return as AXValue.
     46 enum CheckedState {
     47  kUncheckable = -1,
     48  kUnchecked = 0,
     49  kChecked = 1,
     50  kMixed = 2
     51 };
     52 
     53 }  // namespace a11y
     54 }  // namespace mozilla
     55 
     56 @interface mozAccessible : MOXAccessibleBase {
     57  /**
     58   * Reference to the accessible we were created with;
     59   * either a proxy accessible or an accessible wrap.
     60   */
     61  mozilla::a11y::Accessible* mGeckoAccessible;
     62 
     63  /**
     64   * The role of our gecko accessible.
     65   */
     66  mozilla::a11y::role mRole;
     67 
     68  nsStaticAtom* mARIARole;
     69 
     70  bool mIsLiveRegion;
     71 }
     72 
     73 // inits with the given wrap or proxy accessible
     74 - (id)initWithAccessible:(mozilla::a11y::Accessible*)aAcc;
     75 
     76 // allows for gecko accessible access outside of the class
     77 - (mozilla::a11y::Accessible*)geckoAccessible;
     78 
     79 // override
     80 - (void)dealloc;
     81 
     82 // should a child be disabled
     83 - (BOOL)disableChild:(mozAccessible*)child;
     84 
     85 // Given a gecko accessibility event type, post the relevant
     86 // system accessibility notification.
     87 // Note: when overriding or adding new events, make sure your events aren't
     88 // filtered out in Platform::PlatformEvent or AccessibleWrap::HandleAccEvent!
     89 - (void)handleAccessibleEvent:(uint32_t)eventType;
     90 
     91 - (void)maybePostValidationErrorChanged;
     92 
     93 // internal method to retrieve a child at a given index.
     94 - (id)childAt:(uint32_t)i;
     95 
     96 // Get gecko accessible's state.
     97 - (uint64_t)state;
     98 
     99 // Get gecko accessible's state filtered through given mask.
    100 - (uint64_t)stateWithMask:(uint64_t)mask;
    101 
    102 // Notify of a state change, so notifications can be fired.
    103 - (void)stateChanged:(uint64_t)state isEnabled:(BOOL)enabled;
    104 
    105 // Get top level (tab) web area.
    106 - (mozAccessible*)topWebArea;
    107 
    108 // Handle a role change
    109 - (void)handleRoleChanged:(mozilla::a11y::role)newRole;
    110 
    111 // Get ARIA role
    112 - (nsStaticAtom*)ARIARole;
    113 
    114 // Get array of related mozAccessibles
    115 - (NSArray<mozAccessible*>*)getRelationsByType:
    116    (mozilla::a11y::RelationType)relationType;
    117 
    118 #pragma mark - mozAccessible protocol / widget
    119 
    120 // override
    121 - (BOOL)hasRepresentedView;
    122 
    123 // override
    124 - (id)representedView;
    125 
    126 // override
    127 - (BOOL)isRoot;
    128 
    129 #pragma mark - MOXAccessible protocol
    130 
    131 // override
    132 - (BOOL)moxBlockSelector:(SEL)selector;
    133 
    134 // override
    135 - (id)moxHitTest:(NSPoint)point;
    136 
    137 // override
    138 - (id)moxFocusedUIElement;
    139 
    140 - (id<MOXTextMarkerSupport>)moxTextMarkerDelegate;
    141 
    142 - (BOOL)moxIsLiveRegion;
    143 
    144 // Attribute getters
    145 
    146 // override
    147 - (id<mozAccessible>)moxParent;
    148 
    149 // override
    150 - (NSArray*)moxChildren;
    151 
    152 // override
    153 - (NSValue*)moxSize;
    154 
    155 // override
    156 - (NSValue*)moxPosition;
    157 
    158 // override
    159 - (NSString*)moxRole;
    160 
    161 // override
    162 - (NSString*)moxSubrole;
    163 
    164 // override
    165 - (NSString*)moxRoleDescription;
    166 
    167 // override
    168 - (NSWindow*)moxWindow;
    169 
    170 // override
    171 - (id)moxValue;
    172 
    173 // override
    174 - (NSString*)moxTitle;
    175 
    176 // override
    177 - (NSString*)moxLabel;
    178 
    179 // override
    180 - (NSString*)moxHelp;
    181 
    182 // override
    183 - (NSArray*)moxCustomContent;
    184 
    185 // override
    186 - (NSArray*)moxCustomActions;
    187 
    188 // override
    189 - (NSNumber*)moxEnabled;
    190 
    191 // override
    192 - (NSString*)moxInvalid;
    193 
    194 // override
    195 - (NSString*)moxErrorMessageElements;
    196 
    197 // override
    198 - (NSNumber*)moxFocused;
    199 
    200 // override
    201 - (NSNumber*)moxSelected;
    202 
    203 // override
    204 - (NSNumber*)moxExpanded;
    205 
    206 // override
    207 - (NSValue*)moxFrame;
    208 
    209 // override
    210 - (NSString*)moxARIACurrent;
    211 
    212 // override
    213 - (NSNumber*)moxARIAAtomic;
    214 
    215 // override
    216 - (NSString*)moxARIALive;
    217 
    218 // override
    219 - (NSNumber*)moxARIAPosInSet;
    220 
    221 // override
    222 - (NSNumber*)moxARIASetSize;
    223 
    224 // override
    225 - (NSString*)moxARIARelevant;
    226 
    227 // override
    228 - (NSString*)moxPlaceholderValue;
    229 
    230 // override
    231 - (id)moxTitleUIElement;
    232 
    233 // override
    234 - (NSString*)moxDOMIdentifier;
    235 
    236 // override
    237 - (NSNumber*)moxRequired;
    238 
    239 // override
    240 - (NSNumber*)moxElementBusy;
    241 
    242 // override
    243 - (NSArray*)moxLinkedUIElements;
    244 
    245 // override
    246 - (NSArray*)moxARIAControls;
    247 
    248 // override
    249 - (id)moxEditableAncestor;
    250 
    251 // override
    252 - (id)moxHighestEditableAncestor;
    253 
    254 // override
    255 - (id)moxFocusableAncestor;
    256 
    257 // override
    258 - (NSString*)moxLanguage;
    259 
    260 // override
    261 - (NSString*)moxKeyShortcutsValue;
    262 
    263 #ifndef RELEASE_OR_BETA
    264 // override
    265 - (NSString*)moxMozDebugDescription;
    266 #endif
    267 
    268 // override
    269 - (NSArray*)moxUIElementsForSearchPredicate:(NSDictionary*)searchPredicate;
    270 
    271 // override
    272 - (NSNumber*)moxUIElementCountForSearchPredicate:(NSDictionary*)searchPredicate;
    273 
    274 // override
    275 - (void)moxSetFocused:(NSNumber*)focused;
    276 
    277 // override
    278 - (void)moxPerformScrollToVisible;
    279 
    280 // override
    281 - (void)moxPerformShowMenu;
    282 
    283 // override
    284 - (void)moxPerformPress;
    285 
    286 // override
    287 - (BOOL)moxIgnoreWithParent:(mozAccessible*)parent;
    288 
    289 // override
    290 - (BOOL)moxIgnoreChild:(mozAccessible*)child;
    291 
    292 #pragma mark -
    293 
    294 // makes ourselves "expired". after this point, we might be around if someone
    295 // has retained us (e.g., a third-party), but we really contain no information.
    296 // override
    297 - (void)expire;
    298 // override
    299 - (BOOL)isExpired;
    300 
    301 @end
    302 
    303 #endif