Bug 1728442 - P3: Push description to cache. r=Jamie

Rely on name/description changes.

Differential Revision: https://phabricator.services.mozilla.com/D124235
This commit is contained in:
Eitan Isaacson 2021-09-02 18:06:52 +00:00
parent 338d221423
commit e233a15fc7
2 changed files with 12 additions and 3 deletions

View File

@ -12,7 +12,7 @@ namespace a11y {
class CacheDomain { class CacheDomain {
public: public:
static constexpr uint64_t Name = ((uint64_t)0x1) << 0; static constexpr uint64_t NameAndDescription = ((uint64_t)0x1) << 0;
static constexpr uint64_t Value = ((uint64_t)0x1) << 1; static constexpr uint64_t Value = ((uint64_t)0x1) << 1;
static constexpr uint64_t Bounds = ((uint64_t)0x1) << 2; static constexpr uint64_t Bounds = ((uint64_t)0x1) << 2;
static constexpr uint64_t All = ~((uint64_t)0x0); static constexpr uint64_t All = ~((uint64_t)0x0);

View File

@ -957,8 +957,9 @@ nsresult LocalAccessible::HandleAccEvent(AccEvent* aEvent) {
break; break;
} }
#endif #endif
case nsIAccessibleEvent::EVENT_DESCRIPTION_CHANGE:
case nsIAccessibleEvent::EVENT_NAME_CHANGE: { case nsIAccessibleEvent::EVENT_NAME_CHANGE: {
SendCacheUpdate(CacheDomain::Name); SendCacheUpdate(CacheDomain::NameAndDescription);
ipcDoc->SendEvent(id, aEvent->GetEventType()); ipcDoc->SendEvent(id, aEvent->GetEventType());
break; break;
} }
@ -3019,7 +3020,7 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
uint64_t aCacheDomain, CacheUpdateType aUpdateType) { uint64_t aCacheDomain, CacheUpdateType aUpdateType) {
RefPtr<AccAttributes> fields = new AccAttributes(); RefPtr<AccAttributes> fields = new AccAttributes();
if (aCacheDomain & CacheDomain::Name) { if (aCacheDomain & CacheDomain::NameAndDescription) {
nsAutoString name; nsAutoString name;
int32_t nameFlag = Name(name); int32_t nameFlag = Name(name);
if (nameFlag != eNameOK) { if (nameFlag != eNameOK) {
@ -3033,6 +3034,14 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
} else if (aUpdateType == CacheUpdateType::Update) { } else if (aUpdateType == CacheUpdateType::Update) {
fields->SetAttribute(nsGkAtoms::name, DeleteEntry()); fields->SetAttribute(nsGkAtoms::name, DeleteEntry());
} }
nsAutoString description;
Description(description);
if (!description.IsEmpty()) {
fields->SetAttribute(nsGkAtoms::description, description);
} else if (aUpdateType == CacheUpdateType::Update) {
fields->SetAttribute(nsGkAtoms::description, DeleteEntry());
}
} }
if ((aCacheDomain & CacheDomain::Value) && HasNumericValue()) { if ((aCacheDomain & CacheDomain::Value) && HasNumericValue()) {