Bug 377800 Too many warnings in console for accessibilityr=surkov.alexander

This commit is contained in:
ginn.chen@sun.com 2007-06-08 02:09:24 -07:00
Родитель 4616663331
Коммит 4a8bbe11c1
16 изменённых файлов: 218 добавлений и 204 удалений

Просмотреть файл

@ -39,7 +39,6 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include "nsMai.h"
#include "nsAccessibleWrap.h" #include "nsAccessibleWrap.h"
#include "nsAccessibleEventData.h" #include "nsAccessibleEventData.h"
#include "nsString.h" #include "nsString.h"
@ -391,6 +390,16 @@ nsAccessibleWrap::GetAtkObject(void)
return NS_STATIC_CAST(AtkObject *, atkObj); return NS_STATIC_CAST(AtkObject *, atkObj);
} }
// Get AtkObject from nsIAccessible interface
/* static */
AtkObject *
nsAccessibleWrap::GetAtkObject(nsIAccessible * acc)
{
void *atkObjPtr = nsnull;
acc->GetNativeInterface(&atkObjPtr);
return atkObjPtr ? ATK_OBJECT(atkObjPtr) : nsnull;
}
/* private */ /* private */
PRUint16 PRUint16
nsAccessibleWrap::CreateMaiInterfaces(void) nsAccessibleWrap::CreateMaiInterfaces(void)
@ -707,24 +716,20 @@ finalizeCB(GObject *aObj)
const gchar * const gchar *
getNameCB(AtkObject *aAtkObj) getNameCB(AtkObject *aAtkObj)
{ {
if (NS_FAILED(CheckMaiAtkObject(aAtkObj))) { nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
return nsnull; if (!accWrap) {
return nsnull;
} }
nsAutoString uniName;
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
/* nsIAccessible is responsible for the non-NULL name */ /* nsIAccessible is responsible for the non-NULL name */
nsAutoString uniName;
nsresult rv = accWrap->GetName(uniName); nsresult rv = accWrap->GetName(uniName);
NS_ENSURE_SUCCESS(rv, nsnull); NS_ENSURE_SUCCESS(rv, nsnull);
if (uniName.Length() > 0) { NS_ConvertUTF8toUTF16 objName(aAtkObj->name);
NS_ConvertUTF8toUTF16 objName(aAtkObj->name); if (!uniName.Equals(objName)) {
if (!uniName.Equals(objName)) { atk_object_set_name(aAtkObj,
atk_object_set_name(aAtkObj, NS_ConvertUTF16toUTF8(uniName).get());
NS_ConvertUTF16toUTF8(uniName).get());
}
} }
return aAtkObj->name; return aAtkObj->name;
} }
@ -732,24 +737,20 @@ getNameCB(AtkObject *aAtkObj)
const gchar * const gchar *
getDescriptionCB(AtkObject *aAtkObj) getDescriptionCB(AtkObject *aAtkObj)
{ {
if (NS_FAILED(CheckMaiAtkObject(aAtkObj))) { nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
return nsnull; if (!accWrap) {
return nsnull;
} }
if (!aAtkObj->description) { /* nsIAccessible is responsible for the non-NULL description */
gint len; nsAutoString uniDesc;
nsAutoString uniDesc; nsresult rv = accWrap->GetDescription(uniDesc);
NS_ENSURE_SUCCESS(rv, nsnull);
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj); NS_ConvertUTF8toUTF16 objDesc(aAtkObj->description);
if (!uniDesc.Equals(objDesc)) {
/* nsIAccessible is responsible for the non-NULL description */ atk_object_set_description(aAtkObj,
nsresult rv = accWrap->GetDescription(uniDesc); NS_ConvertUTF16toUTF8(uniDesc).get());
NS_ENSURE_SUCCESS(rv, nsnull);
len = uniDesc.Length();
if (len > 0) {
atk_object_set_description(aAtkObj,
NS_ConvertUTF16toUTF8(uniDesc).get());
}
} }
return aAtkObj->description; return aAtkObj->description;
} }
@ -757,18 +758,16 @@ getDescriptionCB(AtkObject *aAtkObj)
AtkRole AtkRole
getRoleCB(AtkObject *aAtkObj) getRoleCB(AtkObject *aAtkObj)
{ {
if (NS_FAILED(CheckMaiAtkObject(aAtkObj))) { nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
return ATK_ROLE_INVALID; if (!accWrap) {
return ATK_ROLE_INVALID;
} }
#ifdef DEBUG_A11Y #ifdef DEBUG_A11Y
nsAccessibleWrap *testAccWrap = GetAccessibleWrap(aAtkObj); NS_ASSERTION(nsAccessible::IsTextInterfaceSupportCorrect(accWrap), "Does not support nsIAccessibleText when it should");
NS_ASSERTION(nsAccessible::IsTextInterfaceSupportCorrect(testAccWrap), "Does not support nsIAccessibleText when it should");
#endif #endif
if (aAtkObj->role == ATK_ROLE_INVALID) { if (aAtkObj->role == ATK_ROLE_INVALID) {
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
PRUint32 accRole, atkRole; PRUint32 accRole, atkRole;
nsresult rv = accWrap->GetFinalRole(&accRole); nsresult rv = accWrap->GetFinalRole(&accRole);
NS_ENSURE_SUCCESS(rv, ATK_ROLE_INVALID); NS_ENSURE_SUCCESS(rv, ATK_ROLE_INVALID);
@ -821,32 +820,27 @@ GetAttributeSet(nsIAccessible* aAccessible)
AtkAttributeSet * AtkAttributeSet *
getAttributesCB(AtkObject *aAtkObj) getAttributesCB(AtkObject *aAtkObj)
{ {
if (NS_FAILED(CheckMaiAtkObject(aAtkObj))) {
return nsnull;
}
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj); nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
return GetAttributeSet(accWrap); return accWrap ? GetAttributeSet(accWrap) : nsnull;
} }
AtkObject * AtkObject *
getParentCB(AtkObject *aAtkObj) getParentCB(AtkObject *aAtkObj)
{ {
if (NS_FAILED(CheckMaiAtkObject(aAtkObj))) { if (!aAtkObj->accessible_parent) {
return nsnull; nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
} if (!accWrap) {
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj); return nsnull;
}
nsCOMPtr<nsIAccessible> accParent; nsCOMPtr<nsIAccessible> accParent;
nsresult rv = accWrap->GetParent(getter_AddRefs(accParent)); nsresult rv = accWrap->GetParent(getter_AddRefs(accParent));
if (NS_FAILED(rv) || !accParent) if (NS_FAILED(rv) || !accParent)
return nsnull; return nsnull;
void *parentAtkObj = nsnull; atk_object_set_parent(aAtkObj,
accParent->GetNativeInterface(&parentAtkObj); nsAccessibleWrap::GetAtkObject(accParent));
if (parentAtkObj && !aAtkObj->accessible_parent) {
atk_object_set_parent(aAtkObj, ATK_OBJECT(parentAtkObj));
} }
return aAtkObj->accessible_parent; return aAtkObj->accessible_parent;
} }
@ -854,10 +848,10 @@ getParentCB(AtkObject *aAtkObj)
gint gint
getChildCountCB(AtkObject *aAtkObj) getChildCountCB(AtkObject *aAtkObj)
{ {
if (NS_FAILED(CheckMaiAtkObject(aAtkObj))) {
return 0;
}
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj); nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap) {
return 0;
}
PRInt32 count = 0; PRInt32 count = 0;
nsCOMPtr<nsIAccessibleHyperText> hyperText; nsCOMPtr<nsIAccessibleHyperText> hyperText;
@ -888,10 +882,10 @@ refChildCB(AtkObject *aAtkObj, gint aChildIndex)
// Either we can cache the last accessed child so that we can just GetNextSibling() // Either we can cache the last accessed child so that we can just GetNextSibling()
// or we should cache an array of children in each nsAccessible // or we should cache an array of children in each nsAccessible
// (instead of mNextSibling on the children) // (instead of mNextSibling on the children)
if (NS_FAILED(CheckMaiAtkObject(aAtkObj))) {
return nsnull;
}
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj); nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap) {
return nsnull;
}
nsresult rv; nsresult rv;
nsCOMPtr<nsIAccessible> accChild; nsCOMPtr<nsIAccessible> accChild;
@ -914,14 +908,12 @@ refChildCB(AtkObject *aAtkObj, gint aChildIndex)
if (NS_FAILED(rv) || !accChild) if (NS_FAILED(rv) || !accChild)
return nsnull; return nsnull;
void* childAtkObjPtr = nsnull; AtkObject* childAtkObj = nsAccessibleWrap::GetAtkObject(accChild);
accChild->GetNativeInterface(&childAtkObjPtr);
NS_ASSERTION(childAtkObjPtr, "Fail to get AtkObj"); NS_ASSERTION(childAtkObj, "Fail to get AtkObj");
if (!childAtkObjPtr) if (!childAtkObj)
return nsnull; return nsnull;
AtkObject* childAtkObj = ATK_OBJECT(childAtkObjPtr);
//this will addref parent //this will addref parent
atk_object_set_parent(childAtkObj, aAtkObj); atk_object_set_parent(childAtkObj, aAtkObj);
g_object_ref(childAtkObj); g_object_ref(childAtkObj);
@ -933,10 +925,10 @@ getIndexInParentCB(AtkObject *aAtkObj)
{ {
// We don't use nsIAccessible::GetIndexInParent() because // We don't use nsIAccessible::GetIndexInParent() because
// for ATK we don't want to include text leaf nodes as children // for ATK we don't want to include text leaf nodes as children
if (NS_FAILED(CheckMaiAtkObject(aAtkObj))) {
return -1;
}
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj); nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap) {
return -1;
}
nsCOMPtr<nsIAccessible> parent; nsCOMPtr<nsIAccessible> parent;
accWrap->GetParent(getter_AddRefs(parent)); accWrap->GetParent(getter_AddRefs(parent));
@ -1000,14 +992,13 @@ refStateSetCB(AtkObject *aAtkObj)
AtkStateSet *state_set = nsnull; AtkStateSet *state_set = nsnull;
state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj); state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj);
if (NS_FAILED(CheckMaiAtkObject(aAtkObj))) { nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap) {
TranslateStates(nsIAccessibleStates::EXT_STATE_DEFUNCT, TranslateStates(nsIAccessibleStates::EXT_STATE_DEFUNCT,
gAtkStateMapExt, state_set); gAtkStateMapExt, state_set);
return state_set; return state_set;
} }
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
// Map states // Map states
PRUint32 accState = 0, accExtState = 0; PRUint32 accState = 0, accExtState = 0;
nsresult rv = accWrap->GetFinalState(&accState, &accExtState); nsresult rv = accWrap->GetFinalState(&accState, &accExtState);
@ -1025,10 +1016,10 @@ refRelationSetCB(AtkObject *aAtkObj)
AtkRelationSet *relation_set = nsnull; AtkRelationSet *relation_set = nsnull;
relation_set = ATK_OBJECT_CLASS(parent_class)->ref_relation_set(aAtkObj); relation_set = ATK_OBJECT_CLASS(parent_class)->ref_relation_set(aAtkObj);
if (NS_FAILED(CheckMaiAtkObject(aAtkObj))) {
return relation_set;
}
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj); nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap) {
return relation_set;
}
AtkObject *accessible_array[1]; AtkObject *accessible_array[1];
AtkRelation* relation; AtkRelation* relation;
@ -1054,9 +1045,7 @@ refRelationSetCB(AtkObject *aAtkObj)
nsIAccessible* accRelated; nsIAccessible* accRelated;
nsresult rv = accWrap->GetAccessibleRelated(relationType[i], &accRelated); nsresult rv = accWrap->GetAccessibleRelated(relationType[i], &accRelated);
if (NS_SUCCEEDED(rv) && accRelated) { if (NS_SUCCEEDED(rv) && accRelated) {
void *relatedAtkObj = nsnull; accessible_array[0] = nsAccessibleWrap::GetAtkObject(accRelated);
accRelated->GetNativeInterface(&relatedAtkObj);
accessible_array[0] = ATK_OBJECT(relatedAtkObj);
relation = atk_relation_new(accessible_array, 1, relation = atk_relation_new(accessible_array, 1,
NS_STATIC_CAST(AtkRelationType, relationType[i])); NS_STATIC_CAST(AtkRelationType, relationType[i]));
atk_relation_set_add(relation_set, relation); atk_relation_set_add(relation_set, relation);
@ -1067,38 +1056,28 @@ refRelationSetCB(AtkObject *aAtkObj)
return relation_set; return relation_set;
} }
// Check if aAtkObj is a valid MaiAtkObject // Check if aAtkObj is a valid MaiAtkObject, and return the nsAccessibleWrap
nsresult // for it.
CheckMaiAtkObject(AtkObject *aAtkObj) nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)
{ {
NS_ENSURE_ARG(IS_MAI_OBJECT(aAtkObj)); NS_ENSURE_TRUE(IS_MAI_OBJECT(aAtkObj), nsnull);
nsAccessibleWrap * tmpAccWrap = GetAccessibleWrap(aAtkObj); nsAccessibleWrap *tmpAccWrap = MAI_ATK_OBJECT(aAtkObj)->accWrap;
// Check if AccessibleWrap was deconstructed // Check if AccessibleWrap was deconstructed
if (tmpAccWrap == nsnull) { if (tmpAccWrap == nsnull) {
return NS_ERROR_NULL_POINTER; return nsnull;
} }
NS_ENSURE_TRUE(tmpAccWrap->GetAtkObject() == aAtkObj, nsnull);
nsRefPtr<nsApplicationAccessibleWrap> appAccWrap = nsRefPtr<nsApplicationAccessibleWrap> appAccWrap =
nsAccessNode::GetApplicationAccessible(); nsAccessNode::GetApplicationAccessible();
nsAccessibleWrap* tmpAppAccWrap = nsAccessibleWrap* tmpAppAccWrap =
NS_STATIC_CAST(nsAccessibleWrap*, appAccWrap.get()); NS_STATIC_CAST(nsAccessibleWrap*, appAccWrap.get());
if (tmpAppAccWrap != tmpAccWrap && !tmpAccWrap->IsValidObject()) if (tmpAppAccWrap != tmpAccWrap && !tmpAccWrap->IsValidObject())
return NS_ERROR_INVALID_POINTER; return nsnull;
NS_ENSURE_TRUE(tmpAccWrap->GetAtkObject() == aAtkObj, NS_ERROR_FAILURE);
return NS_OK;
}
// Check if aAtkObj is a valid MaiAtkObject, and return the nsAccessibleWrap
// for it.
nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)
{
NS_ENSURE_TRUE(IS_MAI_OBJECT(aAtkObj), nsnull);
nsAccessibleWrap * tmpAccWrap = MAI_ATK_OBJECT(aAtkObj)->accWrap;
NS_ENSURE_TRUE(tmpAccWrap != nsnull, nsnull);
NS_ENSURE_TRUE(tmpAccWrap->GetAtkObject() == aAtkObj, nsnull);
return tmpAccWrap; return tmpAccWrap;
} }
@ -1112,14 +1091,12 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
aEvent->GetAccessible(getter_AddRefs(accessible)); aEvent->GetAccessible(getter_AddRefs(accessible));
NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE); NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
void *atkObjPtr = nsnull;
accessible->GetNativeInterface(&atkObjPtr);
PRUint32 type = 0; PRUint32 type = 0;
rv = aEvent->GetEventType(&type); rv = aEvent->GetEventType(&type);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
AtkObject *atkObj = ATK_OBJECT(atkObjPtr); AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(accessible);
// We don't create ATK objects for nsIAccessible plain text leaves, // We don't create ATK objects for nsIAccessible plain text leaves,
// just return NS_OK in such case // just return NS_OK in such case
if (!atkObj) { if (!atkObj) {

Просмотреть файл

@ -100,6 +100,7 @@ public:
NS_IMETHOD FireAccessibleEvent(nsIAccessibleEvent *aEvent); NS_IMETHOD FireAccessibleEvent(nsIAccessibleEvent *aEvent);
AtkObject * GetAtkObject(void); AtkObject * GetAtkObject(void);
static AtkObject * GetAtkObject(nsIAccessible * acc);
PRBool IsValidObject(); PRBool IsValidObject();

Просмотреть файл

@ -591,9 +591,9 @@ nsApplicationAccessibleWrap::AddRootAccessible(nsIAccessible *aRootAccWrap)
nsresult rv = nsApplicationAccessible::AddRootAccessible(aRootAccWrap); nsresult rv = nsApplicationAccessible::AddRootAccessible(aRootAccWrap);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
void* atkAccessible; AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aRootAccWrap);
aRootAccWrap->GetNativeInterface(&atkAccessible); atk_object_set_parent(atkAccessible, mAtkObject);
atk_object_set_parent((AtkObject*)atkAccessible, mAtkObject);
PRUint32 count = 0; PRUint32 count = 0;
mChildren->GetLength(&count); mChildren->GetLength(&count);
g_signal_emit_by_name(mAtkObject, "children_changed::add", count - 1, g_signal_emit_by_name(mAtkObject, "children_changed::add", count - 1,
@ -624,9 +624,8 @@ nsApplicationAccessibleWrap::RemoveRootAccessible(nsIAccessible *aRootAccWrap)
nsCOMPtr<nsIWeakReference> weakPtr = do_GetWeakReference(aRootAccWrap); nsCOMPtr<nsIWeakReference> weakPtr = do_GetWeakReference(aRootAccWrap);
rv = mChildren->IndexOf(0, weakPtr, &index); rv = mChildren->IndexOf(0, weakPtr, &index);
void* atkAccessible; AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aRootAccWrap);
aRootAccWrap->GetNativeInterface(&atkAccessible); atk_object_set_parent(atkAccessible, NULL);
atk_object_set_parent((AtkObject*)atkAccessible, NULL);
g_signal_emit_by_name(mAtkObject, "children_changed::remove", index, g_signal_emit_by_name(mAtkObject, "children_changed::remove", index,
atkAccessible, NULL); atkAccessible, NULL);

Просмотреть файл

@ -78,17 +78,18 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
MAI_LOG_DEBUG(("\n\nReceived event: aEvent=%u, obj=0x%x, data=0x%x \n", MAI_LOG_DEBUG(("\n\nReceived event: aEvent=%u, obj=0x%x, data=0x%x \n",
aEvent, aAccessible, aEventData)); aEvent, aAccessible, aEventData));
void *atkObjPtr = nsnull;
aAccessible->GetNativeInterface(&atkObjPtr); AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(aAccessible);
// We don't create ATK objects for nsIAccessible plain text leaves, // We don't create ATK objects for nsIAccessible plain text leaves,
// just return NS_OK in such case // just return NS_OK in such case
if (!atkObjPtr) { if (!atkObj) {
NS_ASSERTION(aEvent == nsIAccessibleEvent::EVENT_SHOW || NS_ASSERTION(aEvent == nsIAccessibleEvent::EVENT_SHOW ||
aEvent == nsIAccessibleEvent::EVENT_HIDE, aEvent == nsIAccessibleEvent::EVENT_HIDE,
"Event other than SHOW and HIDE fired for plain text leaves"); "Event other than SHOW and HIDE fired for plain text leaves");
return NS_OK; return NS_OK;
} }
AtkObject *atkObj = ATK_OBJECT(atkObjPtr);
nsAccessibleWrap *accWrap = GetAccessibleWrap(atkObj); nsAccessibleWrap *accWrap = GetAccessibleWrap(atkObj);
AtkTableChange * pAtkTableChange = nsnull; AtkTableChange * pAtkTableChange = nsnull;

Просмотреть файл

@ -81,7 +81,6 @@ PR_END_MACRO
MAI_TYPE_ATK_OBJECT, \ MAI_TYPE_ATK_OBJECT, \
MaiAtkObjectClass)) MaiAtkObjectClass))
GType mai_atk_object_get_type(void); GType mai_atk_object_get_type(void);
nsresult CheckMaiAtkObject(AtkObject *aAtkObj);
nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj); nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj);
#endif /* __NS_MAI_H__ */ #endif /* __NS_MAI_H__ */

Просмотреть файл

@ -246,13 +246,9 @@ getObjectCB(AtkHyperlink *aLink, gint aLinkIndex)
accHyperlink->GetObject(aLinkIndex, getter_AddRefs(accObj)); accHyperlink->GetObject(aLinkIndex, getter_AddRefs(accObj));
NS_ENSURE_TRUE(accObj, nsnull); NS_ENSURE_TRUE(accObj, nsnull);
void *atkObj = nsnull; AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(accObj);
accObj->GetNativeInterface(&atkObj);
if (!atkObj) {
return nsnull;
}
//no need to add ref it, because it is "get" not "ref" //no need to add ref it, because it is "get" not "ref"
return ATK_OBJECT(atkObj); return atkObj;
} }
gint gint

Просмотреть файл

@ -59,7 +59,8 @@ gboolean
doActionCB(AtkAction *aAction, gint aActionIndex) doActionCB(AtkAction *aAction, gint aActionIndex)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsresult rv = accWrap->DoAction(aActionIndex); nsresult rv = accWrap->DoAction(aActionIndex);
return (NS_FAILED(rv)) ? FALSE : TRUE; return (NS_FAILED(rv)) ? FALSE : TRUE;
@ -69,7 +70,8 @@ gint
getActionCountCB(AtkAction *aAction) getActionCountCB(AtkAction *aAction)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, 0); if (!accWrap)
return 0;
PRUint8 num = 0; PRUint8 num = 0;
nsresult rv = accWrap->GetNumActions(&num); nsresult rv = accWrap->GetNumActions(&num);
@ -80,7 +82,8 @@ const gchar *
getActionDescriptionCB(AtkAction *aAction, gint aActionIndex) getActionDescriptionCB(AtkAction *aAction, gint aActionIndex)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsAutoString description; nsAutoString description;
nsresult rv = accWrap->GetActionDescription(aActionIndex, description); nsresult rv = accWrap->GetActionDescription(aActionIndex, description);
@ -92,7 +95,8 @@ const gchar *
getActionNameCB(AtkAction *aAction, gint aActionIndex) getActionNameCB(AtkAction *aAction, gint aActionIndex)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsAutoString autoStr; nsAutoString autoStr;
nsresult rv = accWrap->GetActionName(aActionIndex, autoStr); nsresult rv = accWrap->GetActionName(aActionIndex, autoStr);
@ -104,7 +108,8 @@ const gchar *
getKeyBindingCB(AtkAction *aAction, gint aActionIndex) getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
//return all KeyBindings including accesskey and shortcut //return all KeyBindings including accesskey and shortcut
nsAutoString allKeyBinding; nsAutoString allKeyBinding;

Просмотреть файл

@ -69,7 +69,8 @@ refAccessibleAtPointCB(AtkComponent *aComponent,
AtkCoordType aCoordType) AtkCoordType aCoordType)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
// or ATK_XY_SCREEN what is definition this in nsIAccessible ??? // or ATK_XY_SCREEN what is definition this in nsIAccessible ???
if (aCoordType == ATK_XY_WINDOW) { if (aCoordType == ATK_XY_WINDOW) {
@ -82,13 +83,10 @@ refAccessibleAtPointCB(AtkComponent *aComponent,
return nsnull; return nsnull;
} }
void *atkObjPtr = nsnull; AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(pointAcc);
pointAcc->GetNativeInterface(&atkObjPtr); if (atkObj) {
if (!atkObjPtr) { g_object_ref(atkObj);
return nsnull;
} }
AtkObject *atkObj = ATK_OBJECT(atkObjPtr);
g_object_ref(atkObj);
return atkObj; return atkObj;
} }
@ -151,7 +149,8 @@ gboolean
grabFocusCB(AtkComponent *aComponent) grabFocusCB(AtkComponent *aComponent)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsresult rv = accWrap->TakeFocus(); nsresult rv = accWrap->TakeFocus();
return (NS_FAILED(rv)) ? FALSE : TRUE; return (NS_FAILED(rv)) ? FALSE : TRUE;

Просмотреть файл

@ -67,7 +67,8 @@ const gchar *
getDocumentLocaleCB(AtkDocument *aDocument) getDocumentLocaleCB(AtkDocument *aDocument)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessNode> docAccessNode; nsCOMPtr<nsIAccessNode> docAccessNode;
accWrap->QueryInterface(NS_GET_IID(nsIAccessNode), accWrap->QueryInterface(NS_GET_IID(nsIAccessNode),
@ -86,7 +87,8 @@ const gchar *
getDocumentTypeCB(AtkDocument *aDocument) getDocumentTypeCB(AtkDocument *aDocument)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleDocument> accDocument; nsCOMPtr<nsIAccessibleDocument> accDocument;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleDocument), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleDocument),
@ -113,7 +115,8 @@ AtkAttributeSet *
getDocumentAttributesCB(AtkDocument *aDocument) getDocumentAttributesCB(AtkDocument *aDocument)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleDocument> accDocument; nsCOMPtr<nsIAccessibleDocument> accDocument;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleDocument), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleDocument),
@ -147,7 +150,8 @@ getDocumentAttributeValueCB(AtkDocument *aDocument,
const gchar *aAttrName) const gchar *aAttrName)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleDocument> accDocument; nsCOMPtr<nsIAccessibleDocument> accDocument;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleDocument), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleDocument),

Просмотреть файл

@ -65,7 +65,8 @@ setRunAttributesCB(AtkEditableText *aText, AtkAttributeSet *aAttribSet,
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleEditableText> accText; nsCOMPtr<nsIAccessibleEditableText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),

Просмотреть файл

@ -53,7 +53,8 @@ AtkHyperlink*
getHyperlinkCB(AtkHyperlinkImpl *aImpl) getHyperlinkCB(AtkHyperlinkImpl *aImpl)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aImpl)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aImpl));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleHyperLink> accHyperlink; nsCOMPtr<nsIAccessibleHyperLink> accHyperlink;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperLink), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperLink),

Просмотреть файл

@ -55,9 +55,9 @@ hypertextInterfaceInitCB(AtkHypertextIface *aIface)
AtkHyperlink * AtkHyperlink *
getLinkCB(AtkHypertext *aText, gint aLinkIndex) getLinkCB(AtkHypertext *aText, gint aLinkIndex)
{ {
nsresult rv;
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleHyperText> hyperText; nsCOMPtr<nsIAccessibleHyperText> hyperText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperText),
@ -65,14 +65,13 @@ getLinkCB(AtkHypertext *aText, gint aLinkIndex)
NS_ENSURE_TRUE(hyperText, nsnull); NS_ENSURE_TRUE(hyperText, nsnull);
nsCOMPtr<nsIAccessibleHyperLink> hyperLink; nsCOMPtr<nsIAccessibleHyperLink> hyperLink;
rv = hyperText->GetLink(aLinkIndex, getter_AddRefs(hyperLink)); nsresult rv = hyperText->GetLink(aLinkIndex, getter_AddRefs(hyperLink));
if (NS_FAILED(rv) || !hyperLink) if (NS_FAILED(rv) || !hyperLink)
return nsnull; return nsnull;
nsCOMPtr<nsIAccessible> hyperLinkAcc(do_QueryInterface(hyperLink)); nsCOMPtr<nsIAccessible> hyperLinkAcc(do_QueryInterface(hyperLink));
void *hyperLinkAtkObj = nsnull; AtkObject *hyperLinkAtkObj = nsAccessibleWrap::GetAtkObject(hyperLinkAcc);
hyperLinkAcc->GetNativeInterface(&hyperLinkAtkObj); nsAccessibleWrap *accChild = GetAccessibleWrap(hyperLinkAtkObj);
nsAccessibleWrap *accChild = GetAccessibleWrap(ATK_OBJECT(hyperLinkAtkObj));
NS_ENSURE_TRUE(accChild, nsnull); NS_ENSURE_TRUE(accChild, nsnull);
MaiHyperlink *maiHyperlink = accChild->GetMaiHyperlink(); MaiHyperlink *maiHyperlink = accChild->GetMaiHyperlink();
@ -84,7 +83,8 @@ gint
getLinkCountCB(AtkHypertext *aText) getLinkCountCB(AtkHypertext *aText)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, -1); if (!accWrap)
return -1;
nsCOMPtr<nsIAccessibleHyperText> accHyperlink; nsCOMPtr<nsIAccessibleHyperText> accHyperlink;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperText),
@ -102,7 +102,8 @@ gint
getLinkIndexCB(AtkHypertext *aText, gint aCharIndex) getLinkIndexCB(AtkHypertext *aText, gint aCharIndex)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, -1); if (!accWrap)
return -1;
nsCOMPtr<nsIAccessibleHyperText> accHyperlink; nsCOMPtr<nsIAccessibleHyperText> accHyperlink;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperText),

Просмотреть файл

@ -60,7 +60,8 @@ gboolean
addSelectionCB(AtkSelection *aSelection, gint i) addSelectionCB(AtkSelection *aSelection, gint i)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleSelectable> accSelection; nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
@ -74,7 +75,8 @@ gboolean
clearSelectionCB(AtkSelection *aSelection) clearSelectionCB(AtkSelection *aSelection)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleSelectable> accSelection; nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
@ -88,7 +90,8 @@ AtkObject *
refSelectionCB(AtkSelection *aSelection, gint i) refSelectionCB(AtkSelection *aSelection, gint i)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleSelectable> accSelection; nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
@ -100,13 +103,11 @@ refSelectionCB(AtkSelection *aSelection, gint i)
if (!accSelect) { if (!accSelect) {
return nsnull; return nsnull;
} }
void *atkObjPtr = nsnull;
accSelect->GetNativeInterface(&atkObjPtr); AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(accSelect);
if (!atkObjPtr) { if (atkObj) {
return nsnull; g_object_ref(atkObj);
} }
AtkObject *atkObj = ATK_OBJECT(atkObjPtr);
g_object_ref(atkObj);
return atkObj; return atkObj;
} }
@ -114,7 +115,8 @@ gint
getSelectionCountCB(AtkSelection *aSelection) getSelectionCountCB(AtkSelection *aSelection)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, -1); if (!accWrap)
return -1;
nsCOMPtr<nsIAccessibleSelectable> accSelection; nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
@ -130,7 +132,8 @@ gboolean
isChildSelectedCB(AtkSelection *aSelection, gint i) isChildSelectedCB(AtkSelection *aSelection, gint i)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleSelectable> accSelection; nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
@ -146,7 +149,8 @@ gboolean
removeSelectionCB(AtkSelection *aSelection, gint i) removeSelectionCB(AtkSelection *aSelection, gint i)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleSelectable> accSelection; nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
@ -161,7 +165,8 @@ gboolean
selectAllSelectionCB(AtkSelection *aSelection) selectAllSelectionCB(AtkSelection *aSelection)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleSelectable> accSelection; nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),

Просмотреть файл

@ -72,7 +72,8 @@ AtkObject*
refAtCB(AtkTable *aTable, gint aRow, gint aColumn) refAtCB(AtkTable *aTable, gint aRow, gint aColumn)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -84,13 +85,10 @@ refAtCB(AtkTable *aTable, gint aRow, gint aColumn)
if (NS_FAILED(rv) || !cell) if (NS_FAILED(rv) || !cell)
return nsnull; return nsnull;
void *cellAtkObjPtr = nsnull; AtkObject *cellAtkObj = nsAccessibleWrap::GetAtkObject(cell);
cell->GetNativeInterface(&cellAtkObjPtr); if (cellAtkObj) {
if (!cellAtkObjPtr) g_object_ref(cellAtkObj);
return nsnull; }
AtkObject *cellAtkObj = ATK_OBJECT(cellAtkObjPtr);
g_object_ref(cellAtkObj);
return cellAtkObj; return cellAtkObj;
} }
@ -98,7 +96,8 @@ gint
getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn) getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1); if (!accWrap)
return -1;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -116,7 +115,8 @@ gint
getColumnAtIndexCB(AtkTable *aTable, gint aIndex) getColumnAtIndexCB(AtkTable *aTable, gint aIndex)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1); if (!accWrap)
return -1;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -134,7 +134,8 @@ gint
getRowAtIndexCB(AtkTable *aTable, gint aIndex) getRowAtIndexCB(AtkTable *aTable, gint aIndex)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1); if (!accWrap)
return -1;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -152,7 +153,8 @@ gint
getColumnCountCB(AtkTable *aTable) getColumnCountCB(AtkTable *aTable)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1); if (!accWrap)
return -1;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -170,7 +172,8 @@ gint
getRowCountCB(AtkTable *aTable) getRowCountCB(AtkTable *aTable)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1); if (!accWrap)
return -1;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -189,7 +192,8 @@ getColumnExtentAtCB(AtkTable *aTable,
gint aRow, gint aColumn) gint aRow, gint aColumn)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1); if (!accWrap)
return -1;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -208,7 +212,8 @@ getRowExtentAtCB(AtkTable *aTable,
gint aRow, gint aColumn) gint aRow, gint aColumn)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1); if (!accWrap)
return -1;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -226,7 +231,8 @@ AtkObject*
getCaptionCB(AtkTable *aTable) getCaptionCB(AtkTable *aTable)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -238,16 +244,15 @@ getCaptionCB(AtkTable *aTable)
if (NS_FAILED(rv) || !caption) if (NS_FAILED(rv) || !caption)
return nsnull; return nsnull;
void *captionAtkObj = nsnull; return nsAccessibleWrap::GetAtkObject(caption);
caption->GetNativeInterface(&captionAtkObj);
return ATK_OBJECT(captionAtkObj);
} }
const gchar* const gchar*
getColumnDescriptionCB(AtkTable *aTable, gint aColumn) getColumnDescriptionCB(AtkTable *aTable, gint aColumn)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -265,7 +270,8 @@ AtkObject*
getColumnHeaderCB(AtkTable *aTable, gint aColumn) getColumnHeaderCB(AtkTable *aTable, gint aColumn)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -290,16 +296,15 @@ getColumnHeaderCB(AtkTable *aTable, gint aColumn)
header->CellRefAt(0, aColumn, getter_AddRefs(accHeader)); header->CellRefAt(0, aColumn, getter_AddRefs(accHeader));
NS_ENSURE_TRUE(accHeader, nsnull); NS_ENSURE_TRUE(accHeader, nsnull);
void *headerAtkObj = nsnull; return nsAccessibleWrap::GetAtkObject(accHeader);
accHeader->GetNativeInterface(&headerAtkObj);
return ATK_OBJECT(headerAtkObj);
} }
const gchar* const gchar*
getRowDescriptionCB(AtkTable *aTable, gint aRow) getRowDescriptionCB(AtkTable *aTable, gint aRow)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -317,7 +322,8 @@ AtkObject*
getRowHeaderCB(AtkTable *aTable, gint aRow) getRowHeaderCB(AtkTable *aTable, gint aRow)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -331,9 +337,7 @@ getRowHeaderCB(AtkTable *aTable, gint aRow)
nsCOMPtr<nsIAccessible> accHeader(do_QueryInterface(header)); nsCOMPtr<nsIAccessible> accHeader(do_QueryInterface(header));
NS_ENSURE_TRUE(accHeader, nsnull); NS_ENSURE_TRUE(accHeader, nsnull);
void *headerAtkObj = nsnull; return nsAccessibleWrap::GetAtkObject(accHeader);
accHeader->GetNativeInterface(&headerAtkObj);
return ATK_OBJECT(headerAtkObj);
} }
AtkObject* AtkObject*
@ -347,7 +351,8 @@ gint
getSelectedColumnsCB(AtkTable *aTable, gint **aSelected) getSelectedColumnsCB(AtkTable *aTable, gint **aSelected)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, 0); if (!accWrap)
return 0;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -381,7 +386,8 @@ gint
getSelectedRowsCB(AtkTable *aTable, gint **aSelected) getSelectedRowsCB(AtkTable *aTable, gint **aSelected)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, 0); if (!accWrap)
return 0;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -415,7 +421,8 @@ gboolean
isColumnSelectedCB(AtkTable *aTable, gint aColumn) isColumnSelectedCB(AtkTable *aTable, gint aColumn)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -431,7 +438,8 @@ gboolean
isRowSelectedCB(AtkTable *aTable, gint aRow) isRowSelectedCB(AtkTable *aTable, gint aRow)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
@ -447,7 +455,8 @@ gboolean
isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn) isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleTable> accTable; nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),

Просмотреть файл

@ -89,7 +89,8 @@ gchar *
getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset) getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -113,7 +114,8 @@ getTextAfterOffsetCB(AtkText *aText, gint aOffset,
gint *aStartOffset, gint *aEndOffset) gint *aStartOffset, gint *aEndOffset)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -141,7 +143,8 @@ getTextAtOffsetCB(AtkText *aText, gint aOffset,
gint *aStartOffset, gint *aEndOffset) gint *aStartOffset, gint *aEndOffset)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -167,7 +170,8 @@ gunichar
getCharacterAtOffsetCB(AtkText *aText, gint aOffset) getCharacterAtOffsetCB(AtkText *aText, gint aOffset)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, 0); if (!accWrap)
return 0;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -196,7 +200,8 @@ getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
gint *aStartOffset, gint *aEndOffset) gint *aStartOffset, gint *aEndOffset)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -222,7 +227,8 @@ gint
getCaretOffsetCB(AtkText *aText) getCaretOffsetCB(AtkText *aText)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, 0); if (!accWrap)
return 0;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -240,7 +246,8 @@ getRunAttributesCB(AtkText *aText, gint aOffset,
gint *aEndOffset) gint *aEndOffset)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -341,7 +348,8 @@ gint
getCharacterCountCB(AtkText *aText) getCharacterCountCB(AtkText *aText)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, 0); if (!accWrap)
return 0;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -359,7 +367,8 @@ getOffsetAtPointCB(AtkText *aText,
AtkCoordType aCoords) AtkCoordType aCoords)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, -1); if (!accWrap)
return -1;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -381,7 +390,8 @@ gint
getTextSelectionCountCB(AtkText *aText) getTextSelectionCountCB(AtkText *aText)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -398,7 +408,8 @@ getTextSelectionCB(AtkText *aText, gint aSelectionNum,
gint *aStartOffset, gint *aEndOffset) gint *aStartOffset, gint *aEndOffset)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull); if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -424,7 +435,8 @@ addTextSelectionCB(AtkText *aText,
gint aEndOffset) gint aEndOffset)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -441,7 +453,8 @@ removeTextSelectionCB(AtkText *aText,
gint aSelectionNum) gint aSelectionNum)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -458,7 +471,8 @@ setTextSelectionCB(AtkText *aText, gint aSelectionNum,
gint aStartOffset, gint aEndOffset) gint aStartOffset, gint aEndOffset)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
@ -474,7 +488,8 @@ gboolean
setCaretOffsetCB(AtkText *aText, gint aOffset) setCaretOffsetCB(AtkText *aText, gint aOffset)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleText> accText; nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),

Просмотреть файл

@ -142,7 +142,8 @@ gboolean
setCurrentValueCB(AtkValue *obj, const GValue *value) setCurrentValueCB(AtkValue *obj, const GValue *value)
{ {
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj)); nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
NS_ENSURE_TRUE(accWrap, FALSE); if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleValue> accValue; nsCOMPtr<nsIAccessibleValue> accValue;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue), accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),