зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1802297: Don't fire show events for the initial a11y tree push. r=eeejay
After bug 1779156, show events were fired from RecvCache, rather than from RecvShowEvent. This was done to ensure that cache data was available when the event was fired. However, because RecvCache fired a show event for every initial cache push, this meant that it also fired one for the document itself, plus all the document's initial direct children. Firing an event for the document caused problems for ATK, since the parent was null for all top level documents. This also meant we were firing a lot of unnecessary show events, which could be a performance problem for documents with a lot of initial direct children. To fix this, provide an explicit argument to PDocAccessible::Cache specifying whether to dispatch a show event or not. This replaces the existing aFinal argument, which was never used. Differential Revision: https://phabricator.services.mozilla.com/D163192
This commit is contained in:
Родитель
af7548c6d5
Коммит
09faad9a85
|
@ -449,7 +449,7 @@ void nsAccessibilityService::NotifyOfResolutionChange(
|
|||
RefPtr<AccAttributes> fields = new AccAttributes();
|
||||
fields->SetAttribute(nsGkAtoms::resolution, aResolution);
|
||||
data.AppendElement(mozilla::a11y::CacheData(0, fields));
|
||||
document->IPCDoc()->SendCache(CacheUpdateType::Update, data, true);
|
||||
document->IPCDoc()->SendCache(CacheUpdateType::Update, data, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ void nsAccessibilityService::NotifyOfDevPixelRatioChange(
|
|||
fields->SetAttribute(nsGkAtoms::_moz_device_pixel_ratio,
|
||||
aAppUnitsPerDevPixel);
|
||||
data.AppendElement(mozilla::a11y::CacheData(0, fields));
|
||||
document->IPCDoc()->SendCache(CacheUpdateType::Update, data, true);
|
||||
document->IPCDoc()->SendCache(CacheUpdateType::Update, data, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1501,7 +1501,7 @@ void DocAccessible::ProcessQueuedCacheUpdates() {
|
|||
}
|
||||
|
||||
if (data.Length()) {
|
||||
IPCDoc()->SendCache(CacheUpdateType::Update, data, true);
|
||||
IPCDoc()->SendCache(CacheUpdateType::Update, data, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3088,7 +3088,7 @@ void LocalAccessible::SendCache(uint64_t aCacheDomain,
|
|||
BundleFieldsForCache(aCacheDomain, aUpdateType);
|
||||
nsTArray<CacheData> data;
|
||||
data.AppendElement(CacheData(ID(), fields));
|
||||
ipcDoc->SendCache(aUpdateType, data, true);
|
||||
ipcDoc->SendCache(aUpdateType, data, false);
|
||||
|
||||
if (profiler_thread_is_being_profiled_for_markers()) {
|
||||
nsAutoCString updateTypeStr;
|
||||
|
|
|
@ -109,7 +109,7 @@ void DocAccessibleChildBase::InsertIntoIpcTree(LocalAccessible* aParent,
|
|||
cache.AppendElement(CacheData(id, fields));
|
||||
}
|
||||
}
|
||||
Unused << SendCache(CacheUpdateType::Initial, cache, true);
|
||||
Unused << SendCache(CacheUpdateType::Initial, cache, !aSuppressShowEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -622,7 +622,7 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvScrollingEvent(
|
|||
|
||||
mozilla::ipc::IPCResult DocAccessibleParent::RecvCache(
|
||||
const mozilla::a11y::CacheUpdateType& aUpdateType,
|
||||
nsTArray<CacheData>&& aData, const bool& aFinal) {
|
||||
nsTArray<CacheData>&& aData, const bool& aDispatchShowEvent) {
|
||||
ACQUIRE_ANDROID_LOCK
|
||||
if (mShutdown) {
|
||||
return IPC_OK();
|
||||
|
@ -638,12 +638,17 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvCache(
|
|||
remote->ApplyCache(aUpdateType, entry.Fields());
|
||||
}
|
||||
|
||||
if (aUpdateType == CacheUpdateType::Initial && !aData.IsEmpty()) {
|
||||
if (aDispatchShowEvent && !aData.IsEmpty()) {
|
||||
// We might need to dispatch a show event for an initial cache push. We
|
||||
// should never dispatch a show event for a (non-initial) cache update.
|
||||
MOZ_ASSERT(aUpdateType == CacheUpdateType::Initial);
|
||||
RemoteAccessible* target = GetAccessible(aData.ElementAt(0).ID());
|
||||
if (!target) {
|
||||
MOZ_ASSERT_UNREACHABLE("No remote found for initial cache push!");
|
||||
return IPC_OK();
|
||||
}
|
||||
// We never dispatch a show event for the doc itself.
|
||||
MOZ_ASSERT(!target->IsDoc() && target->RemoteParent());
|
||||
|
||||
ProxyShowHideEvent(target, target->RemoteParent(), true, false);
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ class DocAccessibleParent : public RemoteAccessible,
|
|||
|
||||
virtual mozilla::ipc::IPCResult RecvCache(
|
||||
const mozilla::a11y::CacheUpdateType& aUpdateType,
|
||||
nsTArray<CacheData>&& aData, const bool& aFinal) override;
|
||||
nsTArray<CacheData>&& aData, const bool& aDispatchShowEvent) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvSelectedAccessiblesChanged(
|
||||
nsTArray<uint64_t>&& aSelectedIDs,
|
||||
|
|
|
@ -130,10 +130,11 @@ parent:
|
|||
|
||||
/*
|
||||
* Cache The World
|
||||
* aFinal is false when paginating cache into several pushes,
|
||||
* and then true on the final push.
|
||||
* aDispatchShowEvent is true when a show event with the first accessible in
|
||||
* the cache list as the target should be dispatched after the cache is
|
||||
* populated. The show event will have a from-user flag value of false.
|
||||
*/
|
||||
async Cache(CacheUpdateType aUpdateType, CacheData[] aData, bool aFinal);
|
||||
async Cache(CacheUpdateType aUpdateType, CacheData[] aData, bool aDispatchShowEvent);
|
||||
|
||||
/*
|
||||
* Lists of accessibles that either gained or lost a selected state.
|
||||
|
|
|
@ -97,10 +97,11 @@ parent:
|
|||
|
||||
/*
|
||||
* Cache The World
|
||||
* aFinal is false when paginating cache into several pushes,
|
||||
* and then true on the final push.
|
||||
* aDispatchShowEvent is true when a show event with the first accessible in
|
||||
* the cache list as the target should be dispatched after the cache is
|
||||
* populated. The show event will have a from-user flag value of false.
|
||||
*/
|
||||
async Cache(CacheUpdateType aUpdateType, CacheData[] aData, bool aFinal);
|
||||
async Cache(CacheUpdateType aUpdateType, CacheData[] aData, bool aDispatchShowEvent);
|
||||
|
||||
/*
|
||||
* Lists of accessibles that either gained or lost a selected state.
|
||||
|
|
Загрузка…
Ссылка в новой задаче