зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1787686: Expose the URL of a link as its value, as well as the value of text/image leaf descendants. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D155810
This commit is contained in:
Родитель
ace46d35c3
Коммит
551e1f9ba8
|
@ -1367,6 +1367,10 @@ void LocalAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
|
|||
SendCache(CacheDomain::Actions, CacheUpdateType::Update);
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::href) {
|
||||
mDoc->QueueCacheUpdate(this, CacheDomain::Value);
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_controls ||
|
||||
aAttribute == nsGkAtoms::aria_flowto) {
|
||||
mDoc->QueueCacheUpdate(this, CacheDomain::Relations);
|
||||
|
@ -3149,6 +3153,7 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
|
|||
// 1. Accessible is an HTML input type that holds a number.
|
||||
// 2. Accessible has a numeric value and an aria-valuetext.
|
||||
// 3. Accessible is an HTML input type that holds text.
|
||||
// 4. Accessible is a link, in which case value is the target URL.
|
||||
// ... for all other cases we divine the value remotely.
|
||||
bool cacheValueText = false;
|
||||
if (HasNumericValue()) {
|
||||
|
@ -3161,7 +3166,7 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
|
|||
mContent->AsElement()->HasAttr(
|
||||
kNameSpaceID_None, nsGkAtoms::aria_valuetext));
|
||||
} else {
|
||||
cacheValueText = IsTextField();
|
||||
cacheValueText = IsTextField() || IsHTMLLink();
|
||||
}
|
||||
|
||||
if (cacheValueText) {
|
||||
|
|
|
@ -276,6 +276,17 @@ void RemoteAccessibleBase<Derived>::Value(nsString& aValue) const {
|
|||
if (option) {
|
||||
option->Name(aValue);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsTextLeaf() || IsImage()) {
|
||||
if (const Accessible* actionAcc = ActionAncestor()) {
|
||||
if (const_cast<Accessible*>(actionAcc)->State() & states::LINKED) {
|
||||
// Text and image descendants of links expose the link URL as the
|
||||
// value.
|
||||
return actionAcc->Value(aValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,3 +212,37 @@ addAccessibleTask(
|
|||
},
|
||||
{ iframe: true, remoteIframe: true }
|
||||
);
|
||||
|
||||
/**
|
||||
* Test caching of link URL values.
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`<a id="link" href="https://example.com/">Test</a>`,
|
||||
async function(browser, docAcc) {
|
||||
const link = findAccessibleChildByID(docAcc, "link");
|
||||
is(link.value, "https://example.com/", "link initial value correct");
|
||||
const textLeaf = link.firstChild;
|
||||
is(textLeaf.value, "https://example.com/", "link initial value correct");
|
||||
|
||||
info("Changing link href");
|
||||
await invokeSetAttribute(browser, "link", "href", "https://example.net/");
|
||||
await untilCacheIs(
|
||||
() => link.value,
|
||||
"https://example.net/",
|
||||
"link value correct after change"
|
||||
);
|
||||
|
||||
info("Removing link href");
|
||||
await invokeSetAttribute(browser, "link", "href");
|
||||
await untilCacheIs(() => link.value, "", "link value empty after removal");
|
||||
|
||||
info("Setting link href");
|
||||
await invokeSetAttribute(browser, "link", "href", "https://example.com/");
|
||||
await untilCacheIs(
|
||||
() => link.value,
|
||||
"https://example.com/",
|
||||
"link value correct after change"
|
||||
);
|
||||
},
|
||||
{ chrome: true, topLevel: true, iframe: true, remoteIframe: true }
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче