forked from mirrors/gecko-dev
Backed out changeset d5975ef266e6 (bug 1305428) for causing bc failures @ accessible/tests/browser/<...> CLOSED TREE
This commit is contained in:
parent
114a00145b
commit
30c9f381bc
3 changed files with 57 additions and 4 deletions
|
|
@ -744,8 +744,22 @@ LayoutDeviceIntRect LocalAccessible::Bounds() const {
|
||||||
void LocalAccessible::SetSelected(bool aSelect) {
|
void LocalAccessible::SetSelected(bool aSelect) {
|
||||||
if (!HasOwnContent()) return;
|
if (!HasOwnContent()) return;
|
||||||
|
|
||||||
if (nsAccUtils::GetSelectableContainer(this, State()) && aSelect) {
|
LocalAccessible* select = nsAccUtils::GetSelectableContainer(this, State());
|
||||||
TakeFocus();
|
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;
|
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(
|
role LocalAccessible::FindNextValidARIARole(
|
||||||
std::initializer_list<nsStaticAtom*> aRolesToSkip) const {
|
std::initializer_list<nsStaticAtom*> aRolesToSkip) const {
|
||||||
|
|
@ -3035,7 +3069,15 @@ LocalAccessible* LocalAccessible::CurrentItem() const {
|
||||||
return nullptr;
|
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 {
|
LocalAccessible* LocalAccessible::ContainerWidget() const {
|
||||||
if (HasARIARole() && mContent->HasID()) {
|
if (HasARIARole() && mContent->HasID()) {
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,16 @@ const valueTests = [
|
||||||
id: "slider",
|
id: "slider",
|
||||||
expected: ["5", 5, 0, 7, 0],
|
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",
|
desc: "Value should change when @aria-valuenow is updated",
|
||||||
id: "slider",
|
id: "slider",
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@
|
||||||
gQueue.push(new takeFocusInvoker("aria-link"));
|
gQueue.push(new takeFocusInvoker("aria-link"));
|
||||||
gQueue.push(new takeFocusInvoker("aria-link2"));
|
gQueue.push(new takeFocusInvoker("aria-link2"));
|
||||||
gQueue.push(new takeFocusInvoker("link"));
|
gQueue.push(new takeFocusInvoker("link"));
|
||||||
|
gQueue.push(new takeFocusInvoker("item2"));
|
||||||
gQueue.push(new takeFocusInvoker(document));
|
gQueue.push(new takeFocusInvoker(document));
|
||||||
gQueue.push(new takeFocusInvoker("lb_item2"));
|
gQueue.push(new takeFocusInvoker("lb_item2"));
|
||||||
gQueue.push(new takeFocusInvoker(document));
|
gQueue.push(new takeFocusInvoker(document));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue