Bug 205772, Use GetNativeInterface in nsIAccessible to return Native AtkObject for the Accessible

r=aaronl. Accessibility Gtk2 Bug, is not for Mozilla Default Build
This commit is contained in:
bolian.yin%sun.com 2003-05-21 03:32:55 +00:00
parent e1c24882db
commit f869a4b186
4 changed files with 44 additions and 27 deletions

View File

@ -196,22 +196,32 @@ nsAccessibleWrap::~nsAccessibleWrap()
delete mInterfaces[index];
}
NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
{
*aOutAccessible = nsnull;
if (!mMaiAtkObject) {
CreateMaiInterfaces();
mMaiAtkObject =
NS_REINTERPRET_CAST(AtkObject *,
g_object_new(GetMaiAtkType(), NULL));
NS_ENSURE_TRUE(mMaiAtkObject, NS_ERROR_OUT_OF_MEMORY);
atk_object_initialize(mMaiAtkObject, this);
mMaiAtkObject->role = ATK_ROLE_INVALID;
mMaiAtkObject->layer = ATK_LAYER_INVALID;
}
*aOutAccessible = mMaiAtkObject;
return NS_OK;
}
AtkObject *
nsAccessibleWrap::GetAtkObject(void)
{
if (mMaiAtkObject)
return mMaiAtkObject;
CreateMaiInterfaces();
mMaiAtkObject =
NS_REINTERPRET_CAST(AtkObject *,
g_object_new(GetMaiAtkType(), NULL));
NS_ENSURE_TRUE(mMaiAtkObject, nsnull);
atk_object_initialize(mMaiAtkObject, this);
mMaiAtkObject->role = ATK_ROLE_INVALID;
mMaiAtkObject->layer = ATK_LAYER_INVALID;
return mMaiAtkObject;
void *atkObj = nsnull;
GetNativeInterface(&atkObj);
return NS_STATIC_CAST(AtkObject *, atkObj);
}
/* private */

View File

@ -74,7 +74,10 @@ public:
#endif
public:
virtual AtkObject *GetAtkObject(void);
// return the atk object for this nsAccessibleWrap
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
AtkObject * GetAtkObject(void);
MaiInterface *GetMaiInterface(PRInt16 aIfaceType);
static void TranslateStates(PRUint32 aAccState,

View File

@ -656,21 +656,23 @@ NS_IMETHODIMP nsAppRootAccessible::GetAccPreviousSibling(nsIAccessible * *aAccPr
return NS_OK;
}
AtkObject *
nsAppRootAccessible::GetAtkObject(void)
NS_IMETHODIMP nsAppRootAccessible::GetNativeInterface(void **aOutAccessible)
{
if (mMaiAtkObject)
return mMaiAtkObject;
*aOutAccessible = nsnull;
mMaiAtkObject =
NS_REINTERPRET_CAST(AtkObject *,
g_object_new(MAI_TYPE_ATK_OBJECT, NULL));
NS_ENSURE_TRUE(mMaiAtkObject, nsnull);
if (!mMaiAtkObject) {
mMaiAtkObject =
NS_REINTERPRET_CAST(AtkObject *,
g_object_new(MAI_TYPE_ATK_OBJECT, NULL));
NS_ENSURE_TRUE(mMaiAtkObject, NS_ERROR_OUT_OF_MEMORY);
atk_object_initialize(mMaiAtkObject, this);
mMaiAtkObject->role = ATK_ROLE_INVALID;
mMaiAtkObject->layer = ATK_LAYER_INVALID;
return mMaiAtkObject;
atk_object_initialize(mMaiAtkObject, this);
mMaiAtkObject->role = ATK_ROLE_INVALID;
mMaiAtkObject->layer = ATK_LAYER_INVALID;
}
*aOutAccessible = mMaiAtkObject;
return NS_OK;
}
nsresult

View File

@ -88,7 +88,9 @@ public:
NS_IMETHOD GetAccFirstChild(nsIAccessible * *aAccFirstChild);
NS_IMETHOD GetAccChildCount(PRInt32 *aAccChildCount);
virtual AtkObject *GetAtkObject(void);
// return the atk object for app root accessible
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
nsresult AddRootAccessible(nsRootAccessibleWrap *aRootAccWrap);
nsresult RemoveRootAccessible(nsRootAccessibleWrap *aRootAccWrap);
private: