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/. */
6 #include "AccessibleWrap.h"
7 #include "LocalAccessible-inl.h"
9 #import "MUIAccessible.h"
10 #import "MUIRootAccessible.h"
12 using namespace mozilla::a11y;
14 //-----------------------------------------------------
16 //-----------------------------------------------------
17 AccessibleWrap::AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc)
18 : LocalAccessible(aContent, aDoc),
20 mNativeInited(false) {}
22 void AccessibleWrap::Shutdown() {
23 // this ensures we will not try to re-create the native object.
26 // we really intend to access the member directly.
28 [mNativeObject expire];
29 [mNativeObject release];
33 LocalAccessible::Shutdown();
36 id AccessibleWrap::GetNativeObject() {
37 if (!mNativeInited && !IsDefunct()) {
38 Class type = IsRoot() ? [MUIRootAccessible class] : [MUIAccessible class];
39 mNativeObject = [[type alloc] initWithAccessible:this];
47 void AccessibleWrap::GetNativeInterface(void** aOutInterface) {
48 *aOutInterface = static_cast<void*>(GetNativeObject());