mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1198336 - P3: Implement AXLiveRegionSearchKey. r=morgan
I think VoiceOver uses this to pull in all live regions so it can check for deletions when they change later on. Differential Revision: https://phabricator.services.mozilla.com/D96293
This commit is contained in:
parent
61086eeb1a
commit
5950c43ca4
@ -329,6 +329,13 @@ using namespace mozilla::a11y;
|
||||
: RotorMacRoleRule(@"AXTextField");
|
||||
[matches addObjectsFromArray:[self getMatchesForRule:rule]];
|
||||
}
|
||||
|
||||
if ([key isEqualToString:@"AXLiveRegionSearchKey"]) {
|
||||
RotorLiveRegionRule rule = mImmediateDescendantsOnly
|
||||
? RotorLiveRegionRule(geckoRootAcc)
|
||||
: RotorLiveRegionRule();
|
||||
[matches addObjectsFromArray:[self getMatchesForRule:rule]];
|
||||
}
|
||||
}
|
||||
|
||||
return matches;
|
||||
|
@ -112,3 +112,12 @@ class RotorHeadingLevelRule : public RotorRoleRule {
|
||||
private:
|
||||
int32_t mLevel;
|
||||
};
|
||||
|
||||
class RotorLiveRegionRule : public RotorRule {
|
||||
public:
|
||||
explicit RotorLiveRegionRule(AccessibleOrProxy& aDirectDescendantsFrom)
|
||||
: RotorRule(aDirectDescendantsFrom) {}
|
||||
explicit RotorLiveRegionRule() : RotorRule() {}
|
||||
|
||||
uint16_t Match(const AccessibleOrProxy& aAccOrProxy) override;
|
||||
};
|
||||
|
@ -307,3 +307,15 @@ uint16_t RotorHeadingLevelRule::Match(const AccessibleOrProxy& aAccOrProxy) {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
uint16_t RotorLiveRegionRule::Match(const AccessibleOrProxy& aAccOrProxy) {
|
||||
uint16_t result = RotorRule::Match(aAccOrProxy);
|
||||
|
||||
if ((result & nsIAccessibleTraversalRule::FILTER_MATCH)) {
|
||||
mozAccessible* nativeMatch = GetNativeFromGeckoAccessible(aAccOrProxy);
|
||||
if (![nativeMatch moxIsLiveRegion]) {
|
||||
result &= ~nsIAccessibleTraversalRule::FILTER_MATCH;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -99,22 +99,22 @@ addAccessibleTask(
|
||||
<div id="status" role="status"></div>
|
||||
<output id="output"></output>`;
|
||||
});
|
||||
await loadComplete;
|
||||
let webArea = (await loadComplete)[0];
|
||||
|
||||
liveRegionRemoved = waitForEvent(EVENT_LIVE_REGION_REMOVED, "status");
|
||||
await SpecialPowers.spawn(browser, [], () => {
|
||||
content.document
|
||||
.getElementById("status")
|
||||
.setAttribute("aria-live", "off");
|
||||
});
|
||||
await liveRegionRemoved;
|
||||
|
||||
liveRegionRemoved = waitForEvent(EVENT_LIVE_REGION_REMOVED, "output");
|
||||
await SpecialPowers.spawn(browser, [], () => {
|
||||
content.document
|
||||
.getElementById("output")
|
||||
.setAttribute("aria-live", "off");
|
||||
});
|
||||
await liveRegionRemoved;
|
||||
is(webArea.getAttributeValue("AXRole"), "AXWebArea", "web area yeah");
|
||||
const searchPred = {
|
||||
AXSearchKey: "AXLiveRegionSearchKey",
|
||||
AXResultsLimit: -1,
|
||||
AXDirection: "AXDirectionNext",
|
||||
};
|
||||
const liveRegions = webArea.getParameterizedAttributeValue(
|
||||
"AXUIElementsForSearchPredicate",
|
||||
NSDictionary(searchPred)
|
||||
);
|
||||
Assert.deepEqual(
|
||||
liveRegions.map(r => r.getAttributeValue("AXDOMIdentifier")),
|
||||
["region-1", "region-2", "status", "output"],
|
||||
"SearchPredicate returned all live regions"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user