зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1730949: Send initial cache update for doc accessibles if accessibility.cache.enabled r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D125743
This commit is contained in:
Родитель
270493cb07
Коммит
b45f079410
|
@ -1446,6 +1446,13 @@ void DocAccessible::DoInitialUpdate() {
|
|||
DocAccessibleChild* ipcDoc = IPCDoc();
|
||||
MOZ_ASSERT(ipcDoc);
|
||||
if (ipcDoc) {
|
||||
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
|
||||
// If we're caching, we should send an initial update for this document
|
||||
// and its attributes. Each acc contained in this doc will have its
|
||||
// initial update sent in `InsertIntoIpcTree`.
|
||||
SendCache(CacheDomain::All, CacheUpdateType::Initial);
|
||||
}
|
||||
|
||||
for (auto idx = 0U; idx < mChildren.Length(); idx++) {
|
||||
ipcDoc->InsertIntoIpcTree(this, mChildren.ElementAt(idx), idx, true);
|
||||
}
|
||||
|
|
|
@ -959,12 +959,12 @@ nsresult LocalAccessible::HandleAccEvent(AccEvent* aEvent) {
|
|||
#endif
|
||||
case nsIAccessibleEvent::EVENT_DESCRIPTION_CHANGE:
|
||||
case nsIAccessibleEvent::EVENT_NAME_CHANGE: {
|
||||
SendCacheUpdate(CacheDomain::NameAndDescription);
|
||||
SendCache(CacheDomain::NameAndDescription, CacheUpdateType::Update);
|
||||
ipcDoc->SendEvent(id, aEvent->GetEventType());
|
||||
break;
|
||||
}
|
||||
case nsIAccessibleEvent::EVENT_VALUE_CHANGE: {
|
||||
SendCacheUpdate(CacheDomain::Value);
|
||||
SendCache(CacheDomain::Value, CacheUpdateType::Update);
|
||||
ipcDoc->SendEvent(id, aEvent->GetEventType());
|
||||
break;
|
||||
}
|
||||
|
@ -1236,7 +1236,7 @@ void LocalAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
|
|||
(aAttribute == nsGkAtoms::aria_valuemax ||
|
||||
aAttribute == nsGkAtoms::aria_valuemin || aAttribute == nsGkAtoms::min ||
|
||||
aAttribute == nsGkAtoms::max || aAttribute == nsGkAtoms::step)) {
|
||||
SendCacheUpdate(CacheDomain::Value);
|
||||
SendCache(CacheDomain::Value, CacheUpdateType::Update);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1256,7 +1256,7 @@ void LocalAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
|
|||
} else {
|
||||
// We need to update the cache here since we won't get an event if
|
||||
// aria-valuenow is shadowed by aria-valuetext.
|
||||
SendCacheUpdate(CacheDomain::Value);
|
||||
SendCache(CacheDomain::Value, CacheUpdateType::Update);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -2996,7 +2996,8 @@ AccGroupInfo* LocalAccessible::GetGroupInfo() const {
|
|||
return mBits.groupInfo;
|
||||
}
|
||||
|
||||
void LocalAccessible::SendCacheUpdate(uint64_t aCacheDomain) {
|
||||
void LocalAccessible::SendCache(uint64_t aCacheDomain,
|
||||
CacheUpdateType aUpdateType) {
|
||||
if (!StaticPrefs::accessibility_cache_enabled_AtStartup()) {
|
||||
return;
|
||||
}
|
||||
|
@ -3009,11 +3010,11 @@ void LocalAccessible::SendCacheUpdate(uint64_t aCacheDomain) {
|
|||
MOZ_ASSERT(ipcDoc);
|
||||
|
||||
RefPtr<AccAttributes> fields =
|
||||
BundleFieldsForCache(aCacheDomain, CacheUpdateType::Update);
|
||||
BundleFieldsForCache(aCacheDomain, aUpdateType);
|
||||
nsTArray<CacheData> data;
|
||||
data.AppendElement(
|
||||
CacheData(IsDoc() ? 0 : reinterpret_cast<uint64_t>(UniqueID()), fields));
|
||||
ipcDoc->SendCache(CacheUpdateType::Update, data, true);
|
||||
ipcDoc->SendCache(aUpdateType, data, true);
|
||||
}
|
||||
|
||||
already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
|
||||
|
|
|
@ -1073,8 +1073,10 @@ class LocalAccessible : public nsISupports, public Accessible {
|
|||
|
||||
/**
|
||||
* Push fields to cache.
|
||||
* aCacheDomain - describes which fields to bundle and ultimately send
|
||||
* aUpdate - describes whether this is an initial or subsequent update
|
||||
*/
|
||||
void SendCacheUpdate(uint64_t aCacheDomain);
|
||||
void SendCache(uint64_t aCacheDomain, CacheUpdateType aUpdate);
|
||||
|
||||
// Data Members
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
|
|
Загрузка…
Ссылка в новой задаче