no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / accessible / mac / RootAccessibleWrap.mm
blobe3d3da922471bf2f3dd63c1a7e7c21cacd58b03d
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/. */
8 #include "RootAccessibleWrap.h"
10 #include "mozRootAccessible.h"
12 #include "gfxPlatform.h"
13 #include "nsCOMPtr.h"
14 #include "nsObjCExceptions.h"
15 #include "nsIFrame.h"
16 #include "nsView.h"
17 #include "nsIWidget.h"
19 using namespace mozilla;
20 using namespace mozilla::a11y;
22 RootAccessibleWrap::RootAccessibleWrap(dom::Document* aDocument,
23                                        PresShell* aPresShell)
24     : RootAccessible(aDocument, aPresShell) {}
26 RootAccessibleWrap::~RootAccessibleWrap() {}
28 Class RootAccessibleWrap::GetNativeType() {
29   NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
31   return [mozRootAccessible class];
33   NS_OBJC_END_TRY_BLOCK_RETURN(nil);
36 void RootAccessibleWrap::GetNativeWidget(void** aOutView) {
37   nsIFrame* frame = GetFrame();
38   if (frame) {
39     nsView* view = frame->GetView();
40     if (view) {
41       nsIWidget* widget = view->GetWidget();
42       if (widget) {
43         *aOutView = (void**)widget->GetNativeData(NS_NATIVE_WIDGET);
44         MOZ_ASSERT(
45             *aOutView || gfxPlatform::IsHeadless(),
46             "Couldn't get the native NSView parent we need to connect the "
47             "accessibility hierarchy!");
48       }
49     }
50   }