зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1780878: [Part 1] Cache CONTROLLED_BY and CONTROLLER_FOR relations r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D152578
This commit is contained in:
Родитель
ad4df31fa0
Коммит
7467b0247a
|
@ -69,6 +69,10 @@ static constexpr RelationData kRelationTypeAtoms[] = {
|
|||
RelationType::LABEL_FOR},
|
||||
{nsGkAtoms::_for, nsGkAtoms::label, RelationType::LABEL_FOR,
|
||||
RelationType::LABELLED_BY},
|
||||
{nsGkAtoms::aria_controls, nullptr, RelationType::CONTROLLER_FOR,
|
||||
RelationType::CONTROLLED_BY},
|
||||
{nsGkAtoms::_for, nsGkAtoms::output, RelationType::CONTROLLED_BY,
|
||||
RelationType::CONTROLLER_FOR},
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
|
|
@ -1374,6 +1374,10 @@ void LocalAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
|
|||
SendCache(CacheDomain::Actions, CacheUpdateType::Update);
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_controls) {
|
||||
mDoc->QueueCacheUpdate(this, CacheDomain::Relations);
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::alt &&
|
||||
!elm->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_label) &&
|
||||
!elm->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_labelledby)) {
|
||||
|
|
|
@ -96,6 +96,19 @@ Relation HTMLOutputAccessible::RelationByType(RelationType aType) const {
|
|||
return rel;
|
||||
}
|
||||
|
||||
void HTMLOutputAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute,
|
||||
int32_t aModType,
|
||||
const nsAttrValue* aOldValue,
|
||||
uint64_t aOldState) {
|
||||
HyperTextAccessibleWrap::DOMAttributeChanged(aNameSpaceID, aAttribute,
|
||||
aModType, aOldValue, aOldState);
|
||||
|
||||
if (aAttribute == nsGkAtoms::_for) {
|
||||
mDoc->QueueCacheUpdate(this, CacheDomain::Relations);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// HTMLSummaryAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -84,6 +84,11 @@ class HTMLOutputAccessible : public HyperTextAccessibleWrap {
|
|||
// LocalAccessible
|
||||
virtual Relation RelationByType(RelationType aType) const override;
|
||||
|
||||
virtual void DOMAttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
||||
int32_t aModType,
|
||||
const nsAttrValue* aOldValue,
|
||||
uint64_t aOldState) override;
|
||||
|
||||
protected:
|
||||
virtual ~HTMLOutputAccessible() {}
|
||||
};
|
||||
|
|
|
@ -226,3 +226,25 @@ addAccessibleTask(
|
|||
},
|
||||
{ iframe: true, remoteIframe: true }
|
||||
);
|
||||
|
||||
/**
|
||||
* Test caching of relations with respect to output objects and their "for" attr.
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`
|
||||
<form oninput="host.value=parseInt(dependant1.value)+parseInt(dependant2.value)">
|
||||
<input type="number" id="dependant1" value="50"> +
|
||||
<input type="number" id="dependant2" value="25"> =
|
||||
<output name="host" id="host"></output>
|
||||
</form>`,
|
||||
async function(browser, accDoc) {
|
||||
await testRelated(
|
||||
browser,
|
||||
accDoc,
|
||||
"for",
|
||||
RELATION_CONTROLLED_BY,
|
||||
RELATION_CONTROLLER_FOR
|
||||
);
|
||||
},
|
||||
{ iframe: true, remoteIframe: true }
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче