Bug 1757126 part 3: Push AccessKey to the parent process cache. r=morgan

Differential Revision: https://phabricator.services.mozilla.com/D151201
This commit is contained in:
James Teh 2022-07-14 05:48:16 +00:00
Родитель 2d82055fe8
Коммит 96dc8466b6
2 изменённых файлов: 25 добавлений и 2 удалений

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

@ -88,11 +88,18 @@ class KeyBinding {
KeyBinding() : mKey(0), mModifierMask(0) {}
KeyBinding(uint32_t aKey, uint32_t aModifierMask)
: mKey(aKey), mModifierMask(aModifierMask) {}
explicit KeyBinding(uint64_t aSerialized) : mSerialized(aSerialized) {}
inline bool IsEmpty() const { return !mKey; }
inline uint32_t Key() const { return mKey; }
inline uint32_t ModifierMask() const { return mModifierMask; }
/**
* Serialize this KeyBinding to a uint64_t for use in the parent process
* cache. This is simpler than custom IPDL serialization for this simple case.
*/
uint64_t Serialize() { return mSerialized; }
enum Format { ePlatformFormat, eAtkFormat };
/**
@ -118,8 +125,13 @@ class KeyBinding {
void ToPlatformFormat(nsAString& aValue) const;
void ToAtkFormat(nsAString& aValue) const;
uint32_t mKey;
uint32_t mModifierMask;
union {
struct {
uint32_t mKey;
uint32_t mModifierMask;
};
uint64_t mSerialized;
};
};
class Accessible {

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

@ -1467,6 +1467,10 @@ void LocalAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
SendCache(CacheDomain::GroupInfo, CacheUpdateType::Update);
return;
}
if (aAttribute == nsGkAtoms::accesskey) {
mDoc->QueueCacheUpdate(this, CacheDomain::Actions);
}
}
void LocalAccessible::ARIAGroupPosition(int32_t* aLevel, int32_t* aSetSize,
@ -3516,6 +3520,13 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
fields->SetAttribute(nsGkAtoms::longdesc, DeleteEntry());
}
}
KeyBinding accessKey = AccessKey();
if (!accessKey.IsEmpty()) {
fields->SetAttribute(nsGkAtoms::accesskey, accessKey.Serialize());
} else if (aUpdateType == CacheUpdateType::Update) {
fields->SetAttribute(nsGkAtoms::accesskey, DeleteEntry());
}
}
if (aCacheDomain & CacheDomain::Style) {