Bug 1758811 - P3: Don't push cache when gecko cache is available. r=Jamie

This requires a little bit of decoupling of dispatching
WINDOW_CONTENT_CHANGED events when the content changes.

Differential Revision: https://phabricator.services.mozilla.com/D140751
This commit is contained in:
Eitan Isaacson 2022-03-11 18:55:43 +00:00
Родитель cc41ebcd33
Коммит 946b487baa
4 изменённых файлов: 34 добавлений и 1 удалений

Просмотреть файл

@ -28,6 +28,7 @@
#include "mozilla/a11y/PDocAccessibleChild.h"
#include "mozilla/jni/GeckoBundleUtils.h"
#include "mozilla/StaticPrefs_accessibility.h"
// icu TRUE conflicting with java::sdk::Boolean::TRUE()
// https://searchfox.org/mozilla-central/rev/ce02064d8afc8673cef83c92896ee873bd35e7ae/intl/icu/source/common/unicode/umachine.h#265
@ -213,6 +214,9 @@ nsresult AccessibleWrap::HandleAccEvent(AccEvent* aEvent) {
if (state & states::BUSY) {
sessionAcc->SendWindowStateChangedEvent(accessible);
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
sessionAcc->SendWindowContentChangedEvent();
}
}
break;
}
@ -229,6 +233,12 @@ nsresult AccessibleWrap::HandleAccEvent(AccEvent* aEvent) {
event->Priority());
break;
}
case nsIAccessibleEvent::EVENT_REORDER: {
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
sessionAcc->SendWindowContentChangedEvent();
}
break;
}
default:
break;
}

Просмотреть файл

@ -18,6 +18,7 @@
#include "TraversalRule.h"
#include "mozilla/PresShell.h"
#include "mozilla/a11y/DocAccessiblePlatformExtChild.h"
#include "mozilla/StaticPrefs_accessibility.h"
using namespace mozilla;
using namespace mozilla::a11y;
@ -201,6 +202,9 @@ void DocAccessibleWrap::CacheViewportCallback(nsITimer* aTimer,
}
void DocAccessibleWrap::CacheViewport(bool aCachePivotBoundaries) {
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
return;
}
mCachePivotBoundaries |= aCachePivotBoundaries;
if (VirtualViewID() == kNoID && !mCacheRefreshTimer) {
NS_NewTimerWithFuncCallback(getter_AddRefs(mCacheRefreshTimer),
@ -225,6 +229,10 @@ DocAccessibleWrap* DocAccessibleWrap::GetTopLevelContentDoc(
}
void DocAccessibleWrap::CacheFocusPath(AccessibleWrap* aAccessible) {
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
return;
}
mFocusPath.Clear();
if (IPCAccessibilityActive()) {
DocAccessibleChild* ipcDoc = IPCDoc();
@ -263,6 +271,10 @@ void DocAccessibleWrap::CacheFocusPath(AccessibleWrap* aAccessible) {
}
void DocAccessibleWrap::UpdateFocusPathBounds() {
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
return;
}
if (!mFocusPath.Count()) {
return;
}

Просмотреть файл

@ -10,6 +10,7 @@
#include "SessionAccessibility.h"
#include "mozilla/a11y/RemoteAccessible.h"
#include "mozilla/Components.h"
#include "mozilla/StaticPrefs_accessibility.h"
#include "nsIAccessibleEvent.h"
#include "nsIAccessiblePivot.h"
#include "nsIStringBundle.h"
@ -64,6 +65,13 @@ void a11y::ProxyEvent(RemoteAccessible* aTarget, uint32_t aEventType) {
case nsIAccessibleEvent::EVENT_FOCUS:
sessionAcc->SendFocusEvent(WrapperFor(aTarget));
break;
case nsIAccessibleEvent::EVENT_REORDER:
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
sessionAcc->SendWindowContentChangedEvent();
}
break;
default:
break;
}
}
@ -96,6 +104,9 @@ void a11y::ProxyStateChangeEvent(RemoteAccessible* aTarget, uint64_t aState,
if (aState & states::BUSY) {
sessionAcc->SendWindowStateChangedEvent(WrapperFor(aTarget));
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
sessionAcc->SendWindowContentChangedEvent();
}
}
}

Просмотреть файл

@ -275,6 +275,7 @@ void SessionAccessibility::SendScrollingEvent(AccessibleWrap* aAccessible,
mSessionAccessibility->SendEvent(
java::sdk::AccessibilityEvent::TYPE_VIEW_SCROLLED, virtualViewId,
aAccessible->AndroidClass(), eventInfo);
SendWindowContentChangedEvent();
}
void SessionAccessibility::SendWindowContentChangedEvent() {
@ -485,7 +486,6 @@ void SessionAccessibility::UpdateCachedBounds(
}
mSessionAccessibility->UpdateCachedBounds(infos);
SendWindowContentChangedEvent();
}
void SessionAccessibility::UpdateAccessibleFocusBoundaries(