mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 482033 - get rid static cast conversions of Gecko roles to ATK roles, r=ginn.chen
This commit is contained in:
parent
f4dd725cc8
commit
b124621b45
@ -39,6 +39,8 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsMaiInterfaceAction.h"
|
||||
|
||||
#include "nsRoleMap.h"
|
||||
#include "nsString.h"
|
||||
|
||||
void
|
||||
@ -122,21 +124,22 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
accWrap->GetParent(getter_AddRefs(parentAccessible));
|
||||
if (parentAccessible) {
|
||||
PRUint32 role = nsAccUtils::RoleInternal(parentAccessible);
|
||||
PRUint32 geckoRole = nsAccUtils::RoleInternal(parentAccessible);
|
||||
PRUint32 atkRole = atkRoleMap[geckoRole];
|
||||
|
||||
if (role == ATK_ROLE_MENU_BAR) {
|
||||
if (atkRole == ATK_ROLE_MENU_BAR) {
|
||||
//it is topmenu, change from "Alt+f" to "f;<Alt>f"
|
||||
nsAutoString rightChar;
|
||||
accessKey.Right(rightChar, 1);
|
||||
allKeyBinding = rightChar + NS_LITERAL_STRING(";<Alt>") +
|
||||
rightChar;
|
||||
}
|
||||
else if ((role == ATK_ROLE_MENU) || (role == ATK_ROLE_MENU_ITEM)) {
|
||||
else if ((atkRole == ATK_ROLE_MENU) || (atkRole == ATK_ROLE_MENU_ITEM)) {
|
||||
//it is submenu, change from "s" to "s;<Alt>f:s"
|
||||
nsAutoString allKey = accessKey;
|
||||
nsCOMPtr<nsIAccessible> grandParentAcc = parentAccessible;
|
||||
|
||||
while ((grandParentAcc) && (role != ATK_ROLE_MENU_BAR)) {
|
||||
while ((grandParentAcc) && (atkRole != ATK_ROLE_MENU_BAR)) {
|
||||
nsAutoString grandParentKey;
|
||||
grandParentAcc->GetKeyboardShortcut(grandParentKey);
|
||||
|
||||
@ -148,7 +151,8 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
|
||||
|
||||
nsCOMPtr<nsIAccessible> tempAcc = grandParentAcc;
|
||||
tempAcc->GetParent(getter_AddRefs(grandParentAcc));
|
||||
role = nsAccUtils::RoleInternal(grandParentAcc);
|
||||
geckoRole = nsAccUtils::RoleInternal(grandParentAcc);
|
||||
atkRole = atkRoleMap[geckoRole];
|
||||
}
|
||||
allKeyBinding = accessKey + NS_LITERAL_STRING(";<Alt>") +
|
||||
allKey;
|
||||
|
@ -40,6 +40,8 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsMaiInterfaceText.h"
|
||||
|
||||
#include "nsRoleMap.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIPersistentProperties2.h"
|
||||
|
||||
@ -78,9 +80,10 @@ textInterfaceInitCB(AtkTextIface *aIface)
|
||||
void ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
|
||||
{
|
||||
// convert each char to "*" when it's "password text"
|
||||
PRUint32 accRole;
|
||||
PRUint32 accRole = 0;
|
||||
accWrap->GetRoleInternal(&accRole);
|
||||
if (static_cast<AtkRole>(accRole) == ATK_ROLE_PASSWORD_TEXT) {
|
||||
PRUint32 atkRole = atkRoleMap[accRole];
|
||||
if (atkRole == ATK_ROLE_PASSWORD_TEXT) {
|
||||
for (PRUint32 i = 0; i < aString.Length(); i++)
|
||||
aString.Replace(i, 1, NS_LITERAL_STRING("*"));
|
||||
}
|
||||
@ -188,9 +191,9 @@ getCharacterAtOffsetCB(AtkText *aText, gint aOffset)
|
||||
// convert char to "*" when it's "password text"
|
||||
PRUint32 accRole;
|
||||
accWrap->GetRoleInternal(&accRole);
|
||||
if (static_cast<AtkRole>(accRole) == ATK_ROLE_PASSWORD_TEXT) {
|
||||
PRUint32 atkRole = atkRoleMap[accRole];
|
||||
if (atkRole == ATK_ROLE_PASSWORD_TEXT)
|
||||
uniChar = '*';
|
||||
}
|
||||
|
||||
return (NS_FAILED(rv)) ? 0 : static_cast<gunichar>(uniChar);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user