Bug 1877642 - Disable browser_fullscreen-tab-close-race.js on apple_silicon !debug...
[gecko.git] / accessible / ios / AccessibleWrap.mm
blob576e854c60aedfc8d21cf5e38b9ec140e0f763d3
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 //-----------------------------------------------------
15 // construction
16 //-----------------------------------------------------
17 AccessibleWrap::AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc)
18     : LocalAccessible(aContent, aDoc),
19       mNativeObject(nil),
20       mNativeInited(false) {}
22 void AccessibleWrap::Shutdown() {
23   // this ensures we will not try to re-create the native object.
24   mNativeInited = true;
26   // we really intend to access the member directly.
27   if (mNativeObject) {
28     [mNativeObject expire];
29     [mNativeObject release];
30     mNativeObject = nil;
31   }
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];
40   }
42   mNativeInited = true;
44   return mNativeObject;
47 void AccessibleWrap::GetNativeInterface(void** aOutInterface) {
48   *aOutInterface = static_cast<void*>(GetNativeObject());