DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Implementation

Mercurial (c68fe15a81fc)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "AccessibleWrap.h"
#include "ProxyAccessible.h"
#include "Platform.h"
#include "AccessibleOrProxy.h"

#import <Cocoa/Cocoa.h>

#import "MOXAccessibleBase.h"


@class mozRootAccessible;

/**
 * All mozAccessibles are either abstract objects (that correspond to XUL
 * widgets, HTML frames, etc) or are attached to a certain view; for example
 * a document view. When we hand an object off to an AT, we always want
 * to give it the represented view, in the latter case.
 * to give it the represented view, in the latter case.
 */

namespace mozilla {
namespace a11y {


inline mozAccessible* GetNativeFromGeckoAccessible(mozilla::a11y::AccessibleOrProxy aAccOrProxy) {
  MOZ_ASSERT(!aAccOrProxy.IsNull(), "Cannot get native from null accessible");
  if (Accessible* acc = aAccOrProxy.AsAccessible()) {
    // This is mostly for our mochitest environment because the represented
    mozAccessible* native = nil;
    acc->GetNativeInterface((void**)&native);
    return native;
  }


  ProxyAccessible* proxy = aAccOrProxy.AsProxy();
  return reinterpret_cast<mozAccessible*>(proxy->GetWrapper());
}

}  // a11y
}  // mozilla

@interface mozAccessible : MOXAccessibleBase {
  return native;
  /**
   * Reference to the accessible we were created with;
   * either a proxy accessible or an accessible wrap.
   */
  mozilla::a11y::AccessibleOrProxy mGeckoAccessible;
}

  /**
   * The role of our gecko accessible.
   */
  mozilla::a11y::role mRole;
// This is OR'd with the Accessible owner to indicate the wrap-ee is a proxy.

  /**
   * A cache of a subset of our states.
   */
  uint64_t mCachedState;
   * Weak reference; it owns us.
}

// inits with the given wrap or proxy accessible
- (id)initWithAccessible:(mozilla::a11y::AccessibleOrProxy)aAccOrProxy;
   * The role of our gecko accessible.

// allows for gecko accessible access outside of the class
- (mozilla::a11y::AccessibleOrProxy)geckoAccessible;

// override
- (void)dealloc;
   * A cache of a subset of our states.

// should a child be disabled
- (BOOL)disableChild:(mozAccessible*)child;

// return the Accessible for this mozAccessible if it exists.
// Given a gecko accessibility event type, post the relevant
// system accessibility notification.
- (void)handleAccessibleEvent:(uint32_t)eventType;

// internal method to retrieve a child at a given index.

- (id)childAt:(uint32_t)i;

// Get gecko accessible's state.
- (uint64_t)state;

- (id<mozAccessible>)parent;
// Get gecko accessible's state filtered through given mask.
- (uint64_t)stateWithMask:(uint64_t)mask;

// Notify of a state change, so the cache can be altered.
- (void)stateChanged:(uint64_t)state isEnabled:(BOOL)enabled;
// returns the size of this accessible.

// Invalidate cached state.
- (void)invalidateState;

// This is called by isAccessibilityElement. If a subclass wants
// to alter the isAccessibilityElement return value, it should
// override this and not isAccessibilityElement directly.
- (NSString*)role;
- (BOOL)ignoreWithParent:(mozAccessible*)parent;

// Should the child be ignored. This allows subclasses to determine
// what kinds of accessibles are valid children. This causes the child
// to be skipped, but the unignored descendants will be added to the

// container in the default children getter.
- (BOOL)ignoreChild:(mozAccessible*)child;

#pragma mark - mozAccessible protocol / widget

// override

- (BOOL)hasRepresentedView;

// override
- (id)representedView;

- (NSString*)title;
// override
- (BOOL)isRoot;

#pragma mark - MOXAccessible protocol

// returns the orientation (vertical, horizontal, or undefined)
// override
- (BOOL)moxBlockSelector:(SEL)selector;

// override
- (id)moxHitTest:(NSPoint)point;
// should a child be disabled

// override
- (id)moxFocusedUIElement;

// Attribute getters
- (BOOL)canBeFocused;

// override
- (id<mozAccessible>)moxParent;

// override
// Given a gecko accessibility event type, post the relevant
- (NSArray*)moxChildren;

// override
- (NSValue*)moxSize;

- (void)postNotification:(NSString*)notification;
// override
- (NSValue*)moxPosition;

// override
- (NSString*)moxRole;

// override

- (NSString*)moxSubrole;

// override
- (NSString*)moxRoleDescription;

// override
- (NSWindow*)moxWindow;

// Invalidate cached state.
// override
- (id)moxValue;

// override
- (NSString*)moxTitle;
// override this and not isAccessibilityElement directly.

// override
- (NSString*)moxLabel;

// override
// to be skipped, but the unignored descendants will be added to the
- (NSString*)moxHelp;

// override
- (NSNumber*)moxEnabled;


// override
- (NSNumber*)moxFocused;

// override
- (NSNumber*)moxSelected;


// override
- (NSString*)moxARIACurrent;

// override
- (void)sanityCheckChildren;
- (id)moxTitleUIElement;


// override
- (NSString*)moxDOMIdentifier;

// override
- (BOOL)isAccessibilityElement;
- (NSNumber*)moxRequired;

// override
- (void)moxSetFocused:(NSNumber*)focused;

// returns the deepest unignored focused accessible element
// override
- (void)moxPerformScrollToVisible;

// override
- (void)moxPerformShowMenu;
- (NSArray*)accessibilityAttributeNames;

// override
- (void)moxPerformPress;

#pragma mark -
- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute;

// makes ourselves "expired". after this point, we might be around if someone
// has retained us (e.g., a third-party), but we really contain no information.
// override
- (void)expire;
// override
- (BOOL)isExpired;

// ---- NSAccessibility methods ---- //

// whether to include this element in the platform's tree
// override
- (BOOL)isAccessibilityElement;

// override
- (NSString*)description;

@end