mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 748601 - nsMaiInterfaceText.cpp should check internal role not atk role, r=tbsaunde, f=surkov
This commit is contained in:
parent
6090d71f96
commit
e93f14bea3
@ -729,8 +729,21 @@ getRoleCB(AtkObject *aAtkObj)
|
||||
if (aAtkObj->role != ATK_ROLE_INVALID)
|
||||
return aAtkObj->role;
|
||||
|
||||
return aAtkObj->role =
|
||||
static_cast<AtkRole>(nsAccessibleWrap::AtkRoleFor(accWrap->Role()));
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
|
||||
case roles::geckoRole: \
|
||||
aAtkObj->role = atkRole; \
|
||||
break;
|
||||
|
||||
switch (accWrap->Role()) {
|
||||
#include "RoleMap.h"
|
||||
default:
|
||||
MOZ_NOT_REACHED("Unknown role.");
|
||||
aAtkObj->role = ATK_ROLE_UNKNOWN;
|
||||
};
|
||||
|
||||
#undef ROLE
|
||||
|
||||
return aAtkObj->role;
|
||||
}
|
||||
|
||||
AtkAttributeSet*
|
||||
@ -1390,20 +1403,3 @@ nsAccessibleWrap::FireAtkShowHideEvent(AccEvent* aEvent,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsAccessibleWrap::AtkRoleFor(role aRole)
|
||||
{
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
|
||||
case roles::geckoRole: \
|
||||
return atkRole;
|
||||
|
||||
switch (aRole) {
|
||||
#include "RoleMap.h"
|
||||
default:
|
||||
MOZ_NOT_REACHED("Unknown role.");
|
||||
return ATK_ROLE_UNKNOWN;
|
||||
}
|
||||
|
||||
#undef ROLE
|
||||
}
|
||||
|
@ -116,11 +116,6 @@ public:
|
||||
return returnedString.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function mapping from cross platform roles to ATK roles.
|
||||
*/
|
||||
static PRUint32 AtkRoleFor(mozilla::a11y::role aRole);
|
||||
|
||||
protected:
|
||||
virtual nsresult FirePlatformEvent(AccEvent* aEvent);
|
||||
|
||||
|
@ -45,17 +45,18 @@
|
||||
|
||||
#include "nsIPersistentProperties2.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
AtkAttributeSet* ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes);
|
||||
|
||||
static void
|
||||
ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
|
||||
{
|
||||
// convert each char to "*" when it's "password text"
|
||||
PRUint32 atkRole = nsAccessibleWrap::AtkRoleFor(accWrap->NativeRole());
|
||||
if (atkRole == ATK_ROLE_PASSWORD_TEXT) {
|
||||
for (PRUint32 i = 0; i < aString.Length(); i++)
|
||||
aString.Replace(i, 1, NS_LITERAL_STRING("*"));
|
||||
}
|
||||
// convert each char to "*" when it's "password text"
|
||||
if (accWrap->NativeRole() == roles::PASSWORD_TEXT) {
|
||||
for (PRUint32 i = 0; i < aString.Length(); i++)
|
||||
aString.Replace(i, 1, NS_LITERAL_STRING("*"));
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
@ -142,29 +143,29 @@ getTextAtOffsetCB(AtkText *aText, gint aOffset,
|
||||
}
|
||||
|
||||
static gunichar
|
||||
getCharacterAtOffsetCB(AtkText *aText, gint aOffset)
|
||||
getCharacterAtOffsetCB(AtkText* aText, gint aOffset)
|
||||
{
|
||||
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
if (!accWrap)
|
||||
return 0;
|
||||
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
|
||||
if (!accWrap)
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, 0);
|
||||
nsCOMPtr<nsIAccessibleText> accText;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
|
||||
getter_AddRefs(accText));
|
||||
NS_ENSURE_TRUE(accText, 0);
|
||||
|
||||
/* PRUnichar is unsigned short in Mozilla */
|
||||
/* gnuichar is guint32 in glib */
|
||||
PRUnichar uniChar;
|
||||
nsresult rv =
|
||||
accText->GetCharacterAtOffset(aOffset, &uniChar);
|
||||
// PRUnichar is unsigned short in Mozilla
|
||||
// gnuichar is guint32 in glib
|
||||
PRUnichar uniChar = 0;
|
||||
nsresult rv = accText->GetCharacterAtOffset(aOffset, &uniChar);
|
||||
if (NS_FAILED(rv))
|
||||
return 0;
|
||||
|
||||
// convert char to "*" when it's "password text"
|
||||
PRUint32 atkRole = nsAccessibleWrap::AtkRoleFor(accWrap->NativeRole());
|
||||
if (atkRole == ATK_ROLE_PASSWORD_TEXT)
|
||||
uniChar = '*';
|
||||
// Convert char to "*" when it's "password text".
|
||||
if (accWrap->NativeRole() == roles::PASSWORD_TEXT)
|
||||
uniChar = '*';
|
||||
|
||||
return (NS_FAILED(rv)) ? 0 : static_cast<gunichar>(uniChar);
|
||||
return static_cast<gunichar>(uniChar);
|
||||
}
|
||||
|
||||
static gchar*
|
||||
|
Loading…
Reference in New Issue
Block a user