Bug 187209, role for toplevel should be "frame".

patch by simford.dong@sun.com r=bolian. This is NOT for default build.
This commit is contained in:
bolian.yin%sun.com 2003-01-08 10:13:19 +00:00
Родитель b443430dc8
Коммит 6993ff2f55
8 изменённых файлов: 62 добавлений и 28 удалений

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

@ -217,6 +217,17 @@ MaiAppRoot::GetDescription(void)
return atkObject->description;
}
PRUint32
MaiAppRoot::GetRole(void)
{
AtkObject *atkObject = (AtkObject*)mMaiAtkObject;
if (!atkObject->role)
atk_object_set_role(atkObject, ATK_ROLE_APPLICATION);
return atkObject->role;
}
MaiObject *
MaiAppRoot::GetParent(void)
{

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

@ -77,6 +77,7 @@ public:
virtual gchar *GetName(void);
virtual gchar *GetDescription(void);
virtual PRUint32 GetRole(void);
virtual MaiObject *GetParent(void);
virtual gint GetChildCount(void);
virtual MaiObject *RefChild(gint aChildIndex);

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

@ -59,6 +59,7 @@ static void finalizeCB(GObject *aObj);
/* callbacks for AtkObject virtual functions */
static const gchar* getNameCB (AtkObject *aObj);
static const gchar* getDescriptionCB (AtkObject *aObj);
static AtkRole getRoleCB(AtkObject *aObj);
static AtkObject* getParentCB(AtkObject *aObj);
static gint getChildCountCB(AtkObject *aObj);
static AtkObject* refChildCB(AtkObject *aObj, gint aChildIndex);
@ -172,7 +173,7 @@ MaiObject::GetNSAccessible(void)
* GetName x
* GetDescription x
* GetParent x
* GetRole
* GetRole x
* GetRelationSet
* GetLayer
*/
@ -233,6 +234,24 @@ MaiObject::GetDescription(void)
return atkObject->description;
}
PRUint32
MaiObject::GetRole(void)
{
g_return_val_if_fail(mAccessible != NULL, 0);
PRUint32 accRole;
nsresult rv = mAccessible->GetAccRole(&accRole);
if (NS_FAILED(rv))
return 0;
//the cross-platform Accessible object return the same value for
//both "ATK_ROLE_MENU_ITEM" and "ATK_ROLE_MENU"
if ((accRole == ATK_ROLE_MENU_ITEM) && (GetChildCount()))
accRole = ATK_ROLE_MENU;
return accRole;
}
gint
MaiObject::GetChildCount(void)
{
@ -293,6 +312,7 @@ classInitCB(AtkObjectClass *aClass)
aClass->get_n_children = getChildCountCB;
aClass->ref_child = refChildCB;
aClass->get_index_in_parent = getIndexInParentCB;
aClass->get_role = getRoleCB;
aClass->initialize = initializeCB;
@ -356,6 +376,21 @@ getDescriptionCB(AtkObject *aObj)
return maiObject->GetDescription();
}
AtkRole
getRoleCB(AtkObject *aObj)
{
MAI_CHECK_ATK_OBJECT_RETURN_VAL_IF_FAIL(aObj, ATK_ROLE_INVALID);
if (aObj->role != ATK_ROLE_INVALID)
return aObj->role;
MaiObject *maiObject = MAI_ATK_OBJECT(aObj)->maiObject;
AtkRole atkRole = NS_STATIC_CAST(AtkRole, maiObject->GetRole());
aObj->role = atkRole;
return atkRole;
}
AtkObject *
getParentCB(AtkObject *aObj)
{

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

@ -144,6 +144,7 @@ public:
*/
virtual gchar *GetName(void);
virtual gchar *GetDescription(void);
virtual PRUint32 GetRole(void);
virtual MaiObject *GetParent(void) = 0;
virtual gint GetChildCount(void);
virtual MaiObject *RefChild(gint aChildIndex);

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

@ -145,6 +145,17 @@ MaiTopLevel::Create(nsIAccessible *aAcc)
return maiTopLevel;
}
PRUint32
MaiTopLevel::GetRole(void)
{
AtkObject *atkObject = (AtkObject*)mMaiAtkObject;
if (!atkObject->role)
atk_object_set_role(atkObject, ATK_ROLE_FRAME);
return atkObject->role;
}
//////////////////////////////////////////////////////////////////////
// See the comments in
// MaiWidget::CreateAndCache(nsIAccessible *aAcc);

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

@ -59,6 +59,8 @@ public:
virtual void Finalize(void);
virtual PRUint32 GetRole(void);
static MaiTopLevel * Create(nsIAccessible *aAcc);
NS_DECL_ISUPPORTS

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

@ -70,7 +70,6 @@ void finalizeCB(GObject *aObj);
/* more callbacks for atkobject */
static AtkStateSet* refStateSetCB(AtkObject *aObj);
static AtkRole getRoleCB(AtkObject *aObj);
G_END_DECLS
@ -514,15 +513,6 @@ MaiWidget::RefStateSet()
return (NS_FAILED(rv)) ? 0 : accState;
}
PRUint32
MaiWidget::GetRole()
{
g_return_val_if_fail(mAccessible != NULL, 0);
PRUint32 accRole;
nsresult rv = mAccessible->GetAccRole(&accRole);
return (NS_FAILED(rv)) ? 0 : accRole;
}
/* static functions */
gchar *
@ -571,7 +561,6 @@ classInitCB(AtkObjectClass *aClass)
parent_class = g_type_class_peek_parent(aClass);
aClass->ref_state_set = refStateSetCB;
aClass->get_role = getRoleCB;
// aClass->initialize = initializeCB;
@ -638,17 +627,3 @@ refStateSetCB(AtkObject *aObj)
return state_set;
}
AtkRole
getRoleCB(AtkObject *aObj)
{
MAI_ATK_WIDGET_RETURN_VAL_IF_FAIL(aObj, ATK_ROLE_INVALID);
if (aObj->role != ATK_ROLE_INVALID)
return aObj->role;
MaiWidget *maiWidget = NS_STATIC_CAST(MaiWidget*,
MAI_ATK_OBJECT(aObj)->maiObject);
AtkRole atkRole = NS_STATIC_CAST(AtkRole, maiWidget->GetRole());
aObj->role = atkRole;
return atkRole;
}

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

@ -93,7 +93,6 @@ public:
virtual guint GetNSAccessibleUniqueID();
MaiInterface *GetMaiInterface(MaiInterfaceType aInterfacefaceType);
AtkRole GetAtkRole();
static MaiWidget *CreateAndCache(nsIAccessible *aAcc);
void ChildrenChange(AtkChildrenChange *event);
public:
@ -107,7 +106,6 @@ public:
virtual gint GetIndexInParent();
/* new ones */
virtual PRUint32 RefStateSet();
virtual PRUint32 GetRole();
private:
/* Interfaces */