зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1783096: Attempt to fetch tag from aFields if TagName() is null r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D153798
This commit is contained in:
Родитель
1972b3b710
Коммит
2469d25ec9
|
@ -696,12 +696,27 @@ nsTArray<bool> RemoteAccessibleBase<Derived>::PreProcessRelations(
|
|||
AccAttributes* aFields) {
|
||||
nsTArray<bool> updateTracker(ArrayLength(kRelationTypeAtoms));
|
||||
for (auto const& data : kRelationTypeAtoms) {
|
||||
if (data.mValidTag && TagName() != data.mValidTag) {
|
||||
// If the relation we're currently processing only applies to specific
|
||||
// elements, and we are not one of them, do no pre-processing. Also,
|
||||
// note in our updateTracker that we should do no post-processing.
|
||||
updateTracker.AppendElement(false);
|
||||
continue;
|
||||
if (data.mValidTag) {
|
||||
// The relation we're currently processing only applies to particular
|
||||
// elements. Check to see if we're one of them.
|
||||
nsAtom* tag = TagName();
|
||||
if (!tag) {
|
||||
// TagName() returns null on an initial cache push -- check aFields
|
||||
// for a tag name instead.
|
||||
if (auto maybeTag =
|
||||
aFields->GetAttribute<RefPtr<nsAtom>>(nsGkAtoms::tag)) {
|
||||
tag = *maybeTag;
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(
|
||||
tag || IsTextLeaf(),
|
||||
"Could not fetch tag via TagName() or from initial cache push!");
|
||||
if (tag != data.mValidTag) {
|
||||
// If this rel doesn't apply to us, do no pre-processing. Also,
|
||||
// note in our updateTracker that we should do no post-processing.
|
||||
updateTracker.AppendElement(false);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
nsStaticAtom* const relAtom = data.mAtom;
|
||||
|
|
|
@ -264,3 +264,18 @@ addAccessibleTask(
|
|||
},
|
||||
{ iframe: true, remoteIframe: true }
|
||||
);
|
||||
|
||||
/**
|
||||
* Test rel caching for <label> element with existing "for" attribute.
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`data:text/html,<label id="label" for="input">label</label><input id="input">`,
|
||||
async function(browser, accDoc) {
|
||||
const input = findAccessibleChildByID(accDoc, "input");
|
||||
const label = findAccessibleChildByID(accDoc, "label");
|
||||
|
||||
await testCachedRelation(input, RELATION_LABELLED_BY, label);
|
||||
await testCachedRelation(label, RELATION_LABEL_FOR, input);
|
||||
},
|
||||
{ iframe: true, remoteIframe: true }
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче