tor-browser

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

RootAccessibleWrap.mm (1377B)


      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 #include "mozRootAccessible.h"
     11 
     12 #include "gfxPlatform.h"
     13 #include "nsCOMPtr.h"
     14 #include "nsObjCExceptions.h"
     15 #include "nsIFrame.h"
     16 #include "nsIWidget.h"
     17 
     18 using namespace mozilla;
     19 using namespace mozilla::a11y;
     20 
     21 RootAccessibleWrap::RootAccessibleWrap(dom::Document* aDocument,
     22                                       PresShell* aPresShell)
     23    : RootAccessible(aDocument, aPresShell) {}
     24 
     25 RootAccessibleWrap::~RootAccessibleWrap() {}
     26 
     27 Class RootAccessibleWrap::GetNativeType() {
     28  NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
     29 
     30  return [mozRootAccessible class];
     31 
     32  NS_OBJC_END_TRY_BLOCK_RETURN(nil);
     33 }
     34 
     35 void RootAccessibleWrap::GetNativeWidget(void** aOutView) {
     36  if (nsIFrame* frame = GetFrame()) {
     37    if (nsIWidget* widget = frame->GetOwnWidget()) {
     38      *aOutView = (void**)widget->GetNativeData(NS_NATIVE_WIDGET);
     39      MOZ_ASSERT(*aOutView || gfxPlatform::IsHeadless(),
     40                 "Couldn't get the native NSView parent we need to connect the "
     41                 "accessibility hierarchy!");
     42    }
     43  }
     44 }