From 965646877db76ec88abf08d5ece506d1aee74b30 Mon Sep 17 00:00:00 2001 From: Eitan Isaacson Date: Tue, 4 Jan 2022 21:01:38 +0000 Subject: [PATCH] Bug 1737944 - P11: When cache is enabled, calculate group info remotely and add it to attributes. r=Jamie Differential Revision: https://phabricator.services.mozilla.com/D134214 --- accessible/ipc/RemoteAccessibleBase.cpp | 16 ++++++++++++++++ accessible/ipc/other/RemoteAccessible.cpp | 4 ++++ accessible/ipc/win/RemoteAccessible.cpp | 9 +++++++++ 3 files changed, 29 insertions(+) diff --git a/accessible/ipc/RemoteAccessibleBase.cpp b/accessible/ipc/RemoteAccessibleBase.cpp index 2767d218ecc2..3389872074b1 100644 --- a/accessible/ipc/RemoteAccessibleBase.cpp +++ b/accessible/ipc/RemoteAccessibleBase.cpp @@ -484,7 +484,23 @@ already_AddRefed RemoteAccessibleBase::Attributes() { mCachedFields->GetAttribute>(nsGkAtoms::tag)) { attributes->SetAttribute(nsGkAtoms::tag, *tag); } + + GroupPos groupPos = GroupPosition(); + nsAccUtils::SetAccGroupAttrs(attributes, groupPos.level, groupPos.setSize, + groupPos.posInSet); + + bool hierarchical = false; + uint32_t itemCount = AccGroupInfo::TotalItemCount(this, &hierarchical); + if (itemCount) { + attributes->SetAttribute(nsGkAtoms::child_item_count, + static_cast(itemCount)); + } + + if (hierarchical) { + attributes->SetAttribute(nsGkAtoms::tree, true); + } } + return attributes.forget(); } diff --git a/accessible/ipc/other/RemoteAccessible.cpp b/accessible/ipc/other/RemoteAccessible.cpp index 19f54df06028..d81f61b029ee 100644 --- a/accessible/ipc/other/RemoteAccessible.cpp +++ b/accessible/ipc/other/RemoteAccessible.cpp @@ -136,6 +136,10 @@ nsStaticAtom* RemoteAccessible::ARIARoleAtom() const { } GroupPos RemoteAccessible::GroupPosition() { + if (StaticPrefs::accessibility_cache_enabled_AtStartup()) { + return RemoteAccessibleBase::GroupPosition(); + } + GroupPos groupPos; Unused << mDoc->SendGroupPosition(mID, &groupPos.level, &groupPos.setSize, &groupPos.posInSet); diff --git a/accessible/ipc/win/RemoteAccessible.cpp b/accessible/ipc/win/RemoteAccessible.cpp index 19a323914c29..070090d96e55 100644 --- a/accessible/ipc/win/RemoteAccessible.cpp +++ b/accessible/ipc/win/RemoteAccessible.cpp @@ -859,5 +859,14 @@ Accessible* RemoteAccessible::ChildAtPoint( return proxy; } +GroupPos RemoteAccessible::GroupPosition() { + if (StaticPrefs::accessibility_cache_enabled_AtStartup()) { + return RemoteAccessibleBase::GroupPosition(); + } + + // This is only supported when cache is enabled. + return GroupPos(); +} + } // namespace a11y } // namespace mozilla