Bug 1768219: Don't walk ancestors on all Accessibles to find an action when serialising the IPC tree. r=eeejay

This was causing a performance regression.
We now only do this for text leaf and image Accessibles, which gets us back to where we were before bug 1395181.
This means we can't support "click ancestor" on ATK.
There weren't requests for this on ATK anyway.
In future, we can probably support this using the information in the cache.

Differential Revision: https://phabricator.services.mozilla.com/D146528
This commit is contained in:
James Teh 2022-05-17 06:31:45 +00:00
Родитель 3ead02cee1
Коммит 592446771c
2 изменённых файлов: 12 добавлений и 3 удалений

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

@ -511,6 +511,8 @@ class LocalAccessible : public nsISupports, public Accessible {
//////////////////////////////////////////////////////////////////////////////
// ActionAccessible
virtual bool HasPrimaryAction() const override;
virtual uint8_t ActionCount() const override;
virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
@ -981,8 +983,6 @@ class LocalAccessible : public nsISupports, public Accessible {
virtual AccGroupInfo* GetOrCreateGroupInfo() override;
virtual bool HasPrimaryAction() const override;
virtual void ARIAGroupPosition(int32_t* aLevel, int32_t* aSetSize,
int32_t* aPosInSet) const override;

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

@ -51,7 +51,16 @@ void DocAccessibleChildBase::SerializeTree(nsTArray<LocalAccessible*>& aTree,
// XXX: We need to do this because this requires a state check.
genericTypes |= eNumericValue;
}
if (acc->ActionCount()) {
if (acc->IsTextLeaf() || acc->IsImage()) {
// Ideally, we'd set eActionable for any Accessible with an ancedstor
// action. However, that requires an ancestor walk which is too expensive
// here. eActionable is only used by ATK. For now, we only expose ancestor
// actions on text leaf and image Accessibles. This means that we don't
// support "click ancestor" for ATK.
if (acc->ActionCount()) {
genericTypes |= eActionable;
}
} else if (acc->HasPrimaryAction()) {
genericTypes |= eActionable;
}