tor-browser

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

MOXAccessibleBase.h (3752B)


      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 #import <Cocoa/Cocoa.h>
      9 
     10 #import "mozAccessibleProtocol.h"
     11 #import "MOXAccessibleProtocol.h"
     12 
     13 #include "Platform.h"
     14 
     15 inline id<mozAccessible> GetObjectOrRepresentedView(id<mozAccessible> aObject) {
     16  if (!mozilla::a11y::ShouldA11yBeEnabled()) {
     17    // If platform a11y is not enabled, don't return represented view.
     18    // This is mostly for our mochitest environment because the represented
     19    // ChildView checks `ShouldA11yBeEnabled` before proxying accessibility
     20    // methods to mozAccessibles.
     21    return aObject;
     22  }
     23 
     24  return [aObject hasRepresentedView] ? [aObject representedView] : aObject;
     25 }
     26 
     27 @interface MOXAccessibleBase : NSObject <mozAccessible, MOXAccessible> {
     28  BOOL mIsExpired;
     29 }
     30 
     31 #pragma mark - mozAccessible/widget
     32 
     33 // override
     34 - (BOOL)hasRepresentedView;
     35 
     36 // override
     37 - (id)representedView;
     38 
     39 // override
     40 - (BOOL)isRoot;
     41 
     42 #pragma mark - mozAccessible/NSAccessibility
     43 
     44 // The methods below interface with the platform through NSAccessibility.
     45 // They should not be called directly or overridden in subclasses.
     46 
     47 // override, final
     48 - (NSArray*)accessibilityAttributeNames;
     49 
     50 // override, final
     51 - (id)accessibilityAttributeValue:(NSString*)attribute;
     52 
     53 // override, final
     54 - (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute;
     55 
     56 // override, final
     57 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute;
     58 
     59 // override, final
     60 - (NSArray*)accessibilityActionNames;
     61 
     62 // override, final
     63 - (void)accessibilityPerformAction:(NSString*)action;
     64 
     65 // override, final
     66 - (NSString*)accessibilityActionDescription:(NSString*)action;
     67 
     68 // override, final
     69 - (NSArray*)accessibilityParameterizedAttributeNames;
     70 
     71 // override, final
     72 - (id)accessibilityAttributeValue:(NSString*)attribute
     73                     forParameter:(id)parameter;
     74 
     75 // override, final
     76 - (id)accessibilityHitTest:(NSPoint)point;
     77 
     78 // override, final
     79 - (id)accessibilityFocusedUIElement;
     80 
     81 // override, final
     82 - (NSArray*)accessibilityCustomActions;
     83 
     84 // override, final
     85 - (BOOL)isAccessibilityElement;
     86 
     87 // final
     88 - (BOOL)accessibilityNotifiesWhenDestroyed;
     89 
     90 #pragma mark - AXCustomContentProvider protocol
     91 
     92 - (NSArray*)accessibilityCustomContent;
     93 
     94 #pragma mark - MOXAccessible protocol
     95 
     96 // override
     97 - (id)moxHitTest:(NSPoint)point;
     98 
     99 // override
    100 - (id)moxFocusedUIElement;
    101 
    102 // override
    103 - (NSArray*)moxCustomActions;
    104 
    105 // override
    106 - (void)moxPostNotification:(NSString*)notification;
    107 
    108 // override
    109 - (void)moxPostNotification:(NSString*)notification
    110               withUserInfo:(NSDictionary*)userInfo;
    111 
    112 // override
    113 - (BOOL)moxBlockSelector:(SEL)selector;
    114 
    115 // override
    116 - (NSArray*)moxUnignoredChildren;
    117 
    118 // override
    119 - (NSArray*)moxChildren;
    120 
    121 // override
    122 - (id<mozAccessible>)moxUnignoredParent;
    123 
    124 // override
    125 - (id<mozAccessible>)moxParent;
    126 
    127 // override
    128 - (NSNumber*)moxIndexForChildUIElement:(id)child;
    129 
    130 // override
    131 - (id)moxTopLevelUIElement;
    132 
    133 // override
    134 - (id<MOXTextMarkerSupport>)moxTextMarkerDelegate;
    135 
    136 // override
    137 - (BOOL)moxIsLiveRegion;
    138 
    139 // override
    140 - (BOOL)moxIsTextField;
    141 
    142 // override
    143 - (id<MOXAccessible>)moxFindAncestor:(BOOL (^)(id<MOXAccessible> moxAcc,
    144                                               BOOL* stop))findBlock;
    145 
    146 // override
    147 - (NSArray*)moxCustomContent;
    148 
    149 #pragma mark -
    150 
    151 - (NSString*)description;
    152 
    153 - (BOOL)isExpired;
    154 
    155 // makes ourselves "expired". after this point, we might be around if someone
    156 // has retained us (e.g., a third-party), but we really contain no information.
    157 - (void)expire;
    158 
    159 @end