зеркало из https://github.com/mozilla/pjs.git
Bug 160792. Active Accessibility: If title different from name, put it in description. Put the title in the name if there is no name. r=kyle, sr=jst
This commit is contained in:
Родитель
5b87b25e09
Коммит
a13df9feb3
|
@ -492,6 +492,30 @@ NS_IMETHODIMP nsAccessible::GetAccName(nsAString& _retval)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::GetAccDescription(nsAString& aDescription)
|
||||
{
|
||||
// There are 3 conditions that make an accessible have no accDescription:
|
||||
// 1. it's a text node; or
|
||||
// 2. it doesn't have an accName; or
|
||||
// 3. its title attribute equals to its accName nsAutoString name;
|
||||
nsCOMPtr<nsITextContent> textContent(do_QueryInterface(mDOMNode));
|
||||
if (!textContent) {
|
||||
nsAutoString name;
|
||||
GetAccName(name);
|
||||
if (!name.IsEmpty()) {
|
||||
// If there's already a name, we'll expose a description.if it's different than the name
|
||||
// If there is no name, then we know the title should really be exposed there
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
if (elt)
|
||||
elt->GetAttribute(NS_LITERAL_STRING("title"), aDescription);
|
||||
if (!elt || aDescription == name)
|
||||
aDescription.Truncate();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::GetAccKeyboardShortcut(nsAString& _retval)
|
||||
{
|
||||
static PRInt32 gGeneralAccesskeyModifier = -1; // magic value of -1 indicates unitialized state
|
||||
|
|
|
@ -79,6 +79,7 @@ public:
|
|||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccId(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccKeyboardShortcut(nsAString& _retval);
|
||||
NS_IMETHOD GetAccDescription(nsAString& _retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
|
@ -148,7 +149,7 @@ class nsAccessibleTreeWalker {
|
|||
public:
|
||||
nsAccessibleTreeWalker(nsIWeakReference* aShell, nsIDOMNode* aContent,
|
||||
PRInt32 aCachedSiblingIndex, nsIDOMNodeList *aCachedSiblingList, PRBool mWalkAnonymousContent);
|
||||
~nsAccessibleTreeWalker();
|
||||
virtual ~nsAccessibleTreeWalker();
|
||||
|
||||
NS_IMETHOD GetNextSibling();
|
||||
NS_IMETHOD GetPreviousSibling();
|
||||
|
|
|
@ -225,6 +225,11 @@ NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(nsAString& _retval)
|
|||
nsAutoString name;
|
||||
button->GetValue(name);
|
||||
name.CompressWhitespace();
|
||||
if (name.IsEmpty()) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
elt->GetAttribute(NS_LITERAL_STRING("title"), name);
|
||||
}
|
||||
|
||||
_retval.Assign(name);
|
||||
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче