This is purely refactoring in preparation for allowing print documents to have a set of cache domains which is different to the global set.
The free functions DomainsAreActive and RequestDomainsIfInactive are turned into methods on DocAccessibleParent, and a new EffectiveCacheDomains accessor is added on both DocAccessible and DocAccessibleParent.
The original DomainsAreActive free function remains because it's still required by PlatformShouldTrackFocusedAccLocation on Mac, and passing a DocAccessibleParent to that is awkward.
Differential Revision: https://phabricator.services.mozilla.com/D299959
Previously, UIA requested certain cache domains just by firing events, even if no client cared about those events.
This happened because unlike MSAA/IA2 win events, many UIA events include information about the thing that is changing; e.g. a name change event includes the new name.
In addition, live region events are based on other events (name change, text inserted, text removed) and thus need to query whether the element is a live region, which requires additional domains.
this caused our caching granularity tests to break, since those deliberately request only specific domains.
Firing core events caused us to fire UIA events (even if a UIA client didn't actually query us), which in turn caused us to request domains the test doesn't expect.
Less critical (but still important), this meant that these domains would always have been enabled as soon as an event is fired.
That's not great, since it somewhat defeats the point of caching granularity.
As mentioned in the previous patch, checking UiaClientsAreListening() is not sufficient to mitigate this in most cases.
The ideal solution is perhaps to avoid firing those events in the first place.
However, that would require checking for specific domains in the UIA code, which seems fragile if we change what domains are required for existing core methods, add new core methods, etc.
Also, we should probably really be avoiding these events at the core level, rather than requiring OS specific code to filter these out.
Instead, as a more straightforward solution, this patch adds a CacheDomainActivationBlocker RAII class to prevent requesting of new domains.
This is used specifically when firing UIA events.
The events we fire won't contain all the data they should, but that's okay because no client likely cares yet.
We still use explicit client queries (plus a list of known clients) as a signal to request new domains, after which the events will contain information from all the domains that are now active.
This approach could also easily be used on other platforms where needed.
Differential Revision: https://phabricator.services.mozilla.com/D245373
This revision adds code that will make it simple to request new cache domains as
as response to assistive technology queries.
Differential Revision: https://phabricator.services.mozilla.com/D220038