Bug 415944. Avoid screen readers speaking password text. r=surkov, a=schrep

This commit is contained in:
aaronleventhal@moonset.net 2008-02-11 04:22:56 -08:00
Родитель 07f5e80b75
Коммит cc760cd2c9
1 изменённых файлов: 12 добавлений и 3 удалений

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

@ -343,6 +343,9 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
PRInt32 startOffset = aStartOffset;
PRInt32 endOffset = aEndOffset;
// XXX this prevents text interface usage on <input type="password">
// but work is needed on aria-secret (which may be removed)
PRBool isPassword = (Role(this) == nsIAccessibleRole::ROLE_PASSWORD_TEXT);
// Clear out parameters and set up loop
if (aText) {
@ -433,10 +436,16 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
aEndOffset = endOffset;
}
if (aText) {
if (isPassword) {
for (PRInt32 count = startOffset; count < substringEndOffset; count ++)
*aText += '*'; // Show *'s only for password text
}
else {
nsCOMPtr<nsPIAccessible> pAcc(do_QueryInterface(accessible));
pAcc->AppendTextTo(*aText, startOffset,
substringEndOffset - startOffset);
}
}
if (aBoundsRect) { // Caller wants the bounds of the text
aBoundsRect->UnionRect(*aBoundsRect,
GetBoundsForString(primaryFrame, startOffset,