Bug 1628415 part 1: Remove use of nsIDOMXULSelectControlItemElement::label in Accessible. r=MarcoZ

This was only used for richlistitems, but the richlistitem implementation of this property did the wrong thing in several cases.
The a11y engine's label computation code generally does a better job.
Where the label does need to be overridden in specific cases, we should use ARIA instead.

Differential Revision: https://phabricator.services.mozilla.com/D74370
This commit is contained in:
James Teh 2020-05-08 04:24:42 +00:00
parent 52f3956037
commit ba3de78b7e

View File

@ -757,18 +757,12 @@ void Accessible::XULElmName(DocAccessible* aDocument, nsIContent* aElm,
*/
// CASE #1 (via label attribute) -- great majority of the cases
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemEl =
aElm->AsElement()->AsXULSelectControlItem();
if (itemEl) {
itemEl->GetLabel(aName);
} else {
// Use @label if this is not a select control element, which uses label
// attribute to indicate, which option is selected.
nsCOMPtr<nsIDOMXULSelectControlElement> select =
aElm->AsElement()->AsXULSelectControl();
if (!select) {
aElm->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
}
// Only do this if this is not a select control element, which uses label
// attribute to indicate, which option is selected.
nsCOMPtr<nsIDOMXULSelectControlElement> select =
aElm->AsElement()->AsXULSelectControl();
if (!select) {
aElm->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
}
// CASES #2 and #3 ------ label as a child or <label control="id" ... >