Backed out changeset d5975ef266e6 (bug 1305428) for causing bc failures @ accessible/tests/browser/<...> CLOSED TREE

This commit is contained in:
Sandor Molnar 2024-03-19 12:49:04 +02:00
Родитель 114a00145b
Коммит 30c9f381bc
3 изменённых файлов: 57 добавлений и 4 удалений

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

@ -744,8 +744,22 @@ LayoutDeviceIntRect LocalAccessible::Bounds() const {
void LocalAccessible::SetSelected(bool aSelect) {
if (!HasOwnContent()) return;
if (nsAccUtils::GetSelectableContainer(this, State()) && aSelect) {
TakeFocus();
LocalAccessible* select = nsAccUtils::GetSelectableContainer(this, State());
if (select) {
if (select->State() & states::MULTISELECTABLE) {
if (mContent->IsElement() && ARIARoleMap()) {
if (aSelect) {
mContent->AsElement()->SetAttr(
kNameSpaceID_None, nsGkAtoms::aria_selected, u"true"_ns, true);
} else {
mContent->AsElement()->UnsetAttr(kNameSpaceID_None,
nsGkAtoms::aria_selected, true);
}
}
return;
}
if (aSelect) TakeFocus();
}
}
@ -1805,7 +1819,27 @@ double LocalAccessible::CurValue() const {
return checkValue;
}
bool LocalAccessible::SetCurValue(double aValue) { return false; }
bool LocalAccessible::SetCurValue(double aValue) {
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
if (!roleMapEntry || roleMapEntry->valueRule == eNoValue) return false;
const uint32_t kValueCannotChange = states::READONLY | states::UNAVAILABLE;
if (State() & kValueCannotChange) return false;
double checkValue = MinValue();
if (!std::isnan(checkValue) && aValue < checkValue) return false;
checkValue = MaxValue();
if (!std::isnan(checkValue) && aValue > checkValue) return false;
nsAutoString strValue;
strValue.AppendFloat(aValue);
if (!mContent->IsElement()) return true;
return NS_SUCCEEDED(mContent->AsElement()->SetAttr(
kNameSpaceID_None, nsGkAtoms::aria_valuenow, strValue, true));
}
role LocalAccessible::FindNextValidARIARole(
std::initializer_list<nsStaticAtom*> aRolesToSkip) const {
@ -3035,7 +3069,15 @@ LocalAccessible* LocalAccessible::CurrentItem() const {
return nullptr;
}
void LocalAccessible::SetCurrentItem(const LocalAccessible* aItem) {}
void LocalAccessible::SetCurrentItem(const LocalAccessible* aItem) {
nsAtom* id = aItem->GetContent()->GetID();
if (id) {
nsAutoString idStr;
id->ToString(idStr);
mContent->AsElement()->SetAttr(
kNameSpaceID_None, nsGkAtoms::aria_activedescendant, idStr, true);
}
}
LocalAccessible* LocalAccessible::ContainerWidget() const {
if (HasARIARole() && mContent->HasID()) {

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

@ -45,6 +45,16 @@ const valueTests = [
id: "slider",
expected: ["5", 5, 0, 7, 0],
},
{
desc: "Value should change when currentValue is called",
id: "slider",
async action(browser, acc) {
acc.QueryInterface(nsIAccessibleValue);
acc.currentValue = 4;
},
waitFor: EVENT_VALUE_CHANGE,
expected: ["4", 4, 0, 7, 0],
},
{
desc: "Value should change when @aria-valuenow is updated",
id: "slider",

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

@ -48,6 +48,7 @@
gQueue.push(new takeFocusInvoker("aria-link"));
gQueue.push(new takeFocusInvoker("aria-link2"));
gQueue.push(new takeFocusInvoker("link"));
gQueue.push(new takeFocusInvoker("item2"));
gQueue.push(new takeFocusInvoker(document));
gQueue.push(new takeFocusInvoker("lb_item2"));
gQueue.push(new takeFocusInvoker(document));