tor-browser

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

MUIRootAccessible.mm (1221B)


      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 #include "RootAccessibleWrap.h"
      9 
     10 #import "MUIRootAccessible.h"
     11 #import <UIKit/UIScreen.h>
     12 
     13 using namespace mozilla::a11y;
     14 
     15 static id<MUIRootAccessibleProtocol> getNativeViewFromRootAccessible(
     16    LocalAccessible* aAccessible) {
     17  RootAccessibleWrap* root =
     18      static_cast<RootAccessibleWrap*>(aAccessible->AsRoot());
     19  id<MUIRootAccessibleProtocol> nativeView = nil;
     20  root->GetNativeWidget((void**)&nativeView);
     21  return nativeView;
     22 }
     23 
     24 #pragma mark -
     25 
     26 @implementation MUIRootAccessible
     27 
     28 - (id)initWithAccessible:(mozilla::a11y::Accessible*)aAcc {
     29  MOZ_ASSERT(!aAcc->IsRemote(), "MUIRootAccessible is never remote");
     30 
     31  mParallelView = getNativeViewFromRootAccessible(aAcc->AsLocal());
     32 
     33  return [super initWithAccessible:aAcc];
     34 }
     35 
     36 - (BOOL)hasRepresentedView {
     37  return YES;
     38 }
     39 
     40 // this will return our parallel UIView.
     41 - (id)representedView {
     42  return mParallelView;
     43 }
     44 
     45 @end