tor-browser

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

MUIAccessible.h (1969B)


      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 _MUIAccessible_H_
      9 #define _MUIAccessible_H_
     10 
     11 #import <Foundation/Foundation.h>
     12 #import <UIKit/UIAccessibility.h>
     13 
     14 #include "AccessibleWrap.h"
     15 #include "RemoteAccessible.h"
     16 
     17 @class MUIAccessible;
     18 
     19 namespace mozilla {
     20 namespace a11y {
     21 
     22 inline MUIAccessible* _Nullable GetNativeFromGeckoAccessible(
     23    mozilla::a11y::Accessible* _Nullable aAcc) {
     24  if (!aAcc) {
     25    return nil;
     26  }
     27  if (LocalAccessible* localAcc = aAcc->AsLocal()) {
     28    MUIAccessible* native = nil;
     29    localAcc->GetNativeInterface((void**)&native);
     30    return native;
     31  }
     32 
     33  RemoteAccessible* remoteAcc = aAcc->AsRemote();
     34  return reinterpret_cast<MUIAccessible*>(remoteAcc->GetWrapper());
     35 }
     36 
     37 }  // namespace a11y
     38 }  // namespace mozilla
     39 
     40 @interface MUIAccessible : NSObject {
     41  mozilla::a11y::Accessible* mGeckoAccessible;
     42 }
     43 
     44 // inits with the given accessible
     45 - (nonnull id)initWithAccessible:(nonnull mozilla::a11y::Accessible*)aAcc;
     46 
     47 // allows for gecko accessible access outside of the class
     48 - (mozilla::a11y::Accessible* _Nullable)geckoAccessible;
     49 
     50 - (void)expire;
     51 
     52 // override
     53 - (void)dealloc;
     54 
     55 // UIAccessibility
     56 - (BOOL)isAccessibilityElement;
     57 - (nullable NSString*)accessibilityLabel;
     58 - (nullable NSString*)accessibilityHint;
     59 - (CGRect)accessibilityFrame;
     60 - (nullable NSString*)accessibilityValue;
     61 - (uint64_t)accessibilityTraits;
     62 
     63 // UIAccessibilityContainer
     64 - (NSInteger)accessibilityElementCount;
     65 - (nullable id)accessibilityElementAtIndex:(NSInteger)index;
     66 - (NSInteger)indexOfAccessibilityElement:(nonnull id)element;
     67 - (nullable NSArray*)accessibilityElements;
     68 - (UIAccessibilityContainerType)accessibilityContainerType;
     69 
     70 @end
     71 
     72 #endif