mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1794634 - Stop using ARIARoleAtom sync message and remove it. r=morgan
Add role map index to RoleChangedEvent so remote doc accessibles have an ARIA role defined. Differential Revision: https://phabricator.services.mozilla.com/D159067
This commit is contained in:
parent
d531f63b7c
commit
9b3628d6a4
@ -149,7 +149,8 @@ class TextRangeData;
|
||||
void ProxyTextSelectionChangeEvent(RemoteAccessible* aTarget,
|
||||
const nsTArray<TextRangeData>& aSelection);
|
||||
|
||||
void ProxyRoleChangedEvent(RemoteAccessible* aTarget, const a11y::role& aRole);
|
||||
void ProxyRoleChangedEvent(RemoteAccessible* aTarget, const a11y::role& aRole,
|
||||
uint8_t aRoleMapEntryIndex);
|
||||
#endif
|
||||
|
||||
} // namespace a11y
|
||||
|
@ -1773,7 +1773,7 @@ bool DocAccessible::UpdateAccessibleOnAttrChange(dom::Element* aElement,
|
||||
if (mContent == aElement) {
|
||||
SetRoleMapEntryForDoc(aElement);
|
||||
if (mIPCDoc) {
|
||||
mIPCDoc->SendRoleChangedEvent(Role());
|
||||
mIPCDoc->SendRoleChangedEvent(Role(), mRoleMapEntryIndex);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1826,7 +1826,7 @@ void DocAccessible::UpdateRootElIfNeeded() {
|
||||
mContent = rootEl;
|
||||
SetRoleMapEntryForDoc(rootEl);
|
||||
if (mIPCDoc) {
|
||||
mIPCDoc->SendRoleChangedEvent(Role());
|
||||
mIPCDoc->SendRoleChangedEvent(Role(), mRoleMapEntryIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -763,16 +763,17 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvTextSelectionChangeEvent(
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult DocAccessibleParent::RecvRoleChangedEvent(
|
||||
const a11y::role& aRole) {
|
||||
const a11y::role& aRole, const uint8_t& aRoleMapEntryIndex) {
|
||||
ACQUIRE_ANDROID_LOCK
|
||||
if (mShutdown) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mRole = aRole;
|
||||
mRoleMapEntryIndex = aRoleMapEntryIndex;
|
||||
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
ProxyRoleChangedEvent(this, aRole);
|
||||
ProxyRoleChangedEvent(this, aRole, aRoleMapEntryIndex);
|
||||
#endif
|
||||
|
||||
return IPC_OK();
|
||||
|
@ -162,7 +162,8 @@ class DocAccessibleParent : public RemoteAccessible,
|
||||
virtual mozilla::ipc::IPCResult RecvTextSelectionChangeEvent(
|
||||
const uint64_t& aID, nsTArray<TextRangeData>&& aSelection) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvRoleChangedEvent(const a11y::role& aRole) final;
|
||||
mozilla::ipc::IPCResult RecvRoleChangedEvent(
|
||||
const a11y::role& aRole, const uint8_t& aRoleMapEntryIndex) final;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvBindChildDoc(
|
||||
PDocAccessibleParent* aChildDoc, const uint64_t& aID) override;
|
||||
|
@ -52,8 +52,6 @@ virtual Relation RelationByType(RelationType aType) const override;
|
||||
|
||||
bool IsSearchbox() const;
|
||||
|
||||
nsStaticAtom* ARIARoleAtom() const;
|
||||
|
||||
virtual mozilla::a11y::GroupPos GroupPosition() override;
|
||||
void ScrollToPoint(uint32_t aScrollType, int32_t aX, int32_t aY);
|
||||
|
||||
|
@ -205,22 +205,6 @@ mozilla::ipc::IPCResult DocAccessibleChild::RecvLandmarkRole(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult DocAccessibleChild::RecvARIARoleAtom(
|
||||
const uint64_t& aID, nsString* aRole) {
|
||||
LocalAccessible* acc = IdToAccessible(aID);
|
||||
if (!acc) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
if (const nsRoleMapEntry* roleMap = acc->ARIARoleMap()) {
|
||||
if (nsStaticAtom* roleAtom = roleMap->roleAtom) {
|
||||
roleAtom->ToString(*aRole);
|
||||
}
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult DocAccessibleChild::RecvGroupPosition(
|
||||
const uint64_t& aID, int32_t* aLevel, int32_t* aSimilarItemsInGroup,
|
||||
int32_t* aPositionInGroup) {
|
||||
|
@ -82,9 +82,6 @@ class DocAccessibleChild : public DocAccessibleChildBase {
|
||||
virtual mozilla::ipc::IPCResult RecvLandmarkRole(
|
||||
const uint64_t& aID, nsString* aLandmark) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvARIARoleAtom(const uint64_t& aID,
|
||||
nsString* aRole) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvGroupPosition(
|
||||
const uint64_t& aID, int32_t* aLevel, int32_t* aSimilarItemsInGroup,
|
||||
int32_t* aPositionInGroup) override;
|
||||
|
@ -103,7 +103,7 @@ parent:
|
||||
async TextChangeEvent(uint64_t aID, nsString aStr, int32_t aStart, uint32_t aLen,
|
||||
bool aIsInsert, bool aFromUser);
|
||||
async SelectionEvent(uint64_t aID, uint64_t aWidgetID, uint32_t aType);
|
||||
async RoleChangedEvent(role aRole);
|
||||
async RoleChangedEvent(role aRole, uint8_t aRoleMapEntryIndex);
|
||||
async VirtualCursorChangeEvent(uint64_t aID,
|
||||
uint64_t aOldPosition,
|
||||
int32_t aOldStartOffset, int32_t aOldEndOffset,
|
||||
@ -174,7 +174,6 @@ child:
|
||||
[Nested=inside_sync] sync Relations(uint64_t aID) returns(RelationTargets[] relations);
|
||||
[Nested=inside_sync] sync IsSearchbox(uint64_t aID) returns(bool retval);
|
||||
[Nested=inside_sync] sync LandmarkRole(uint64_t aID) returns(nsString landmark);
|
||||
[Nested=inside_sync] sync ARIARoleAtom(uint64_t aID) returns(nsString ariaRole);
|
||||
[Nested=inside_sync] sync GroupPosition(uint64_t aID)
|
||||
returns(int32_t groupLevel, int32_t similarItemsInGroup, int32_t positionInGroup);
|
||||
async ScrollTo(uint64_t aID, uint32_t aScrollType);
|
||||
|
@ -133,12 +133,6 @@ nsAtom* RemoteAccessible::LandmarkRole() const {
|
||||
return NS_GetStaticAtom(landmark);
|
||||
}
|
||||
|
||||
nsStaticAtom* RemoteAccessible::ARIARoleAtom() const {
|
||||
nsString role;
|
||||
Unused << mDoc->SendARIARoleAtom(mID, &role);
|
||||
return NS_GetStaticAtom(role);
|
||||
}
|
||||
|
||||
GroupPos RemoteAccessible::GroupPosition() {
|
||||
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
|
||||
return RemoteAccessibleBase<RemoteAccessible>::GroupPosition();
|
||||
|
@ -256,12 +256,14 @@ bool DocAccessibleChild::SendSelectionEvent(const uint64_t& aID,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DocAccessibleChild::SendRoleChangedEvent(const a11y::role& aRole) {
|
||||
bool DocAccessibleChild::SendRoleChangedEvent(const a11y::role& aRole,
|
||||
uint8_t aRoleMapEntryIndex) {
|
||||
if (IsConstructedInParentProcess()) {
|
||||
return PDocAccessibleChild::SendRoleChangedEvent(aRole);
|
||||
return PDocAccessibleChild::SendRoleChangedEvent(aRole, aRoleMapEntryIndex);
|
||||
}
|
||||
|
||||
PushDeferredEvent(MakeUnique<SerializedRoleChanged>(this, aRole));
|
||||
PushDeferredEvent(
|
||||
MakeUnique<SerializedRoleChanged>(this, aRole, aRoleMapEntryIndex));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,8 @@ class DocAccessibleChild : public DocAccessibleChildBase {
|
||||
const bool aDoSync = false);
|
||||
bool SendSelectionEvent(const uint64_t& aID, const uint64_t& aWidgetID,
|
||||
const uint32_t& aType);
|
||||
bool SendRoleChangedEvent(const a11y::role& aRole);
|
||||
bool SendRoleChangedEvent(const a11y::role& aRole,
|
||||
uint8_t aRoleMapEntryIndex);
|
||||
bool SendScrollingEvent(const uint64_t& aID, const uint64_t& aType,
|
||||
const uint32_t& aScrollX, const uint32_t& aScrollY,
|
||||
const uint32_t& aMaxScrollX,
|
||||
@ -258,14 +259,17 @@ class DocAccessibleChild : public DocAccessibleChildBase {
|
||||
|
||||
struct SerializedRoleChanged final : public DeferredEvent {
|
||||
explicit SerializedRoleChanged(DocAccessibleChild* aTarget,
|
||||
a11y::role aRole)
|
||||
: DeferredEvent(aTarget), mRole(aRole) {}
|
||||
a11y::role aRole, uint8_t aRoleMapEntryIndex)
|
||||
: DeferredEvent(aTarget),
|
||||
mRole(aRole),
|
||||
mRoleMapEntryIndex(aRoleMapEntryIndex) {}
|
||||
|
||||
void Dispatch(DocAccessibleChild* aIPCDoc) override {
|
||||
Unused << aIPCDoc->SendRoleChangedEvent(mRole);
|
||||
Unused << aIPCDoc->SendRoleChangedEvent(mRole, mRoleMapEntryIndex);
|
||||
}
|
||||
|
||||
a11y::role mRole;
|
||||
uint8_t mRoleMapEntryIndex;
|
||||
};
|
||||
|
||||
struct SerializedScrolling final : public DeferredEvent {
|
||||
|
@ -75,7 +75,7 @@ parent:
|
||||
sync SyncTextChangeEvent(uint64_t aID, nsString aStr, int32_t aStart,
|
||||
uint32_t aLen, bool aIsInsert, bool aFromUser);
|
||||
async SelectionEvent(uint64_t aID, uint64_t aWidgetID, uint32_t aType);
|
||||
async RoleChangedEvent(role aRole);
|
||||
async RoleChangedEvent(role aRole, uint8_t aRoleMapEntryIndex);
|
||||
async FocusEvent(uint64_t aID, LayoutDeviceIntRect aCaretRect);
|
||||
async VirtualCursorChangeEvent(uint64_t aID,
|
||||
uint64_t aOldPosition,
|
||||
|
@ -181,7 +181,8 @@ void ProxyTextSelectionChangeEvent(RemoteAccessible* aTarget,
|
||||
}
|
||||
}
|
||||
|
||||
void ProxyRoleChangedEvent(RemoteAccessible* aTarget, const a11y::role& aRole) {
|
||||
void ProxyRoleChangedEvent(RemoteAccessible* aTarget, const a11y::role& aRole,
|
||||
uint8_t aRoleMapEntryIndex) {
|
||||
if (mozAccessible* wrapper = GetNativeFromGeckoAccessible(aTarget)) {
|
||||
[wrapper handleRoleChanged:aRole];
|
||||
}
|
||||
|
@ -370,23 +370,12 @@ static const uint64_t kCacheInitialized = ((uint64_t)0x1) << 63;
|
||||
- (nsStaticAtom*)ARIARole {
|
||||
MOZ_ASSERT(mGeckoAccessible);
|
||||
|
||||
if (LocalAccessible* acc = mGeckoAccessible->AsLocal()) {
|
||||
if (acc->HasARIARole()) {
|
||||
const nsRoleMapEntry* roleMap = acc->ARIARoleMap();
|
||||
return roleMap->roleAtom;
|
||||
}
|
||||
|
||||
return nsGkAtoms::_empty;
|
||||
if (mGeckoAccessible->HasARIARole()) {
|
||||
const nsRoleMapEntry* roleMap = mGeckoAccessible->ARIARoleMap();
|
||||
return roleMap->roleAtom;
|
||||
}
|
||||
|
||||
if (!mARIARole) {
|
||||
mARIARole = mGeckoAccessible->AsRemote()->ARIARoleAtom();
|
||||
if (!mARIARole) {
|
||||
mARIARole = nsGkAtoms::_empty;
|
||||
}
|
||||
}
|
||||
|
||||
return mARIARole;
|
||||
return nsGkAtoms::_empty;
|
||||
}
|
||||
|
||||
- (NSString*)moxSubrole {
|
||||
|
Loading…
Reference in New Issue
Block a user