Bug 1648341: Handle eHasValueMinMaxIfFocusable correctly in Accessible::Value. r=MarcoZ

Previously, this returned a value if the ARIA value rule was not eNoValue, which covered eHasValueMinMaxIfFocusable.
However, eHasValueMinMaxIfFocusable needs the focusable state to be checked.
Rather than checking the value rule directly, just use HasNumericValue(), which already knows how to handle this.

Differential Revision: https://phabricator.services.mozilla.com/D81483
This commit is contained in:
James Teh 2020-06-29 05:22:00 +00:00
Родитель 0398ff5ec9
Коммит bb33c7f919
2 изменённых файлов: 6 добавлений и 8 удалений

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

@ -1304,12 +1304,7 @@ void Accessible::ApplyARIAState(uint64_t* aState) const {
}
void Accessible::Value(nsString& aValue) const {
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
if ((roleMapEntry && roleMapEntry->valueRule != eNoValue) ||
// Bug 1475376: aria-valuetext should also be supported for implicit ARIA
// roles; e.g. <input type="range">.
HasNumericValue()) {
if (HasNumericValue()) {
// aria-valuenow is a number, and aria-valuetext is the optional text
// equivalent. For the string value, we will try the optional text
// equivalent first.
@ -1329,6 +1324,7 @@ void Accessible::Value(nsString& aValue) const {
return;
}
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
if (!roleMapEntry) {
return;
}

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

@ -145,8 +145,10 @@
testValue("range", "6", 6, 0, 10, 1);
// Test that elements which should not expose values do not
var accSeparator = getAccessible("separator", [nsIAccessibleValue], null, DONOTFAIL_IF_NO_INTERFACE);
ok(!accSeparator, "value interface is not exposed for separator");
let separatorVal = getAccessible("separator", [nsIAccessibleValue], null, DONOTFAIL_IF_NO_INTERFACE);
ok(!separatorVal, "value interface is not exposed for separator");
let separatorAcc = getAccessible("separator");
ok(!separatorAcc.value, "Value text is not exposed for separator");
// Test value change events
gQueue = new eventQueue();