|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "RootAccessibleWrap.h" |
|
7 |
|
8 #include "mozDocAccessible.h" |
|
9 |
|
10 #include "nsCOMPtr.h" |
|
11 #include "nsObjCExceptions.h" |
|
12 #include "nsIFrame.h" |
|
13 #include "nsView.h" |
|
14 #include "nsIWidget.h" |
|
15 |
|
16 using namespace mozilla::a11y; |
|
17 |
|
18 RootAccessibleWrap:: |
|
19 RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent, |
|
20 nsIPresShell* aPresShell) : |
|
21 RootAccessible(aDocument, aRootContent, aPresShell) |
|
22 { |
|
23 } |
|
24 |
|
25 RootAccessibleWrap::~RootAccessibleWrap() |
|
26 { |
|
27 } |
|
28 |
|
29 Class |
|
30 RootAccessibleWrap::GetNativeType() |
|
31 { |
|
32 NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; |
|
33 |
|
34 return [mozRootAccessible class]; |
|
35 |
|
36 NS_OBJC_END_TRY_ABORT_BLOCK_NIL; |
|
37 } |
|
38 |
|
39 void |
|
40 RootAccessibleWrap::GetNativeWidget(void** aOutView) |
|
41 { |
|
42 nsIFrame *frame = GetFrame(); |
|
43 if (frame) { |
|
44 nsView *view = frame->GetViewExternal(); |
|
45 if (view) { |
|
46 nsIWidget *widget = view->GetWidget(); |
|
47 if (widget) { |
|
48 *aOutView = (void**)widget->GetNativeData (NS_NATIVE_WIDGET); |
|
49 NS_ASSERTION (*aOutView, |
|
50 "Couldn't get the native NSView parent we need to connect the accessibility hierarchy!"); |
|
51 } |
|
52 } |
|
53 } |
|
54 } |