2 /* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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"
14 #include "nsObjCExceptions.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();
39 nsView* view = frame->GetView();
41 nsIWidget* widget = view->GetWidget();
43 *aOutView = (void**)widget->GetNativeData(NS_NATIVE_WIDGET);
45 *aOutView || gfxPlatform::IsHeadless(),
46 "Couldn't get the native NSView parent we need to connect the "
47 "accessibility hierarchy!");