Skip to content

Commit

Permalink
Bug 1618712 - Use GroupPosition for heading levels in mac. r=morgan,nika
Browse files Browse the repository at this point in the history
We were using the wrong Accessible method to get the level. We also need to swap IPDL methods to use the right one.

Differential Revision: https://phabricator.services.mozilla.com/D65645
  • Loading branch information
eeejay committed Mar 10, 2020
1 parent 04f4db8 commit 13b14ef
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion accessible/ipc/ProxyAccessibleShared.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ nsAtom* LandmarkRole() const;

nsStaticAtom* ARIARoleAtom() const;

int32_t GetLevelInternal();
mozilla::a11y::GroupPos GroupPosition();
void ScrollTo(uint32_t aScrollType);
void ScrollToPoint(uint32_t aScrollType, int32_t aX, int32_t aY);

Expand Down
11 changes: 8 additions & 3 deletions accessible/ipc/other/DocAccessibleChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,17 @@ mozilla::ipc::IPCResult DocAccessibleChild::RecvARIARoleAtom(
return IPC_OK();
}

mozilla::ipc::IPCResult DocAccessibleChild::RecvGetLevelInternal(
const uint64_t& aID, int32_t* aLevel) {
mozilla::ipc::IPCResult DocAccessibleChild::RecvGroupPosition(
const uint64_t& aID, int32_t* aLevel, int32_t* aSimilarItemsInGroup,
int32_t* aPositionInGroup) {
Accessible* acc = IdToAccessible(aID);
if (acc) {
*aLevel = acc->GetLevelInternal();
GroupPos groupPos = acc->GroupPosition();
*aLevel = groupPos.level;
*aSimilarItemsInGroup = groupPos.setSize;
*aPositionInGroup = groupPos.posInSet;
}

return IPC_OK();
}

Expand Down
5 changes: 3 additions & 2 deletions accessible/ipc/other/DocAccessibleChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ class DocAccessibleChild : public DocAccessibleChildBase {
virtual mozilla::ipc::IPCResult RecvARIARoleAtom(const uint64_t& aID,
nsString* aRole) override;

virtual mozilla::ipc::IPCResult RecvGetLevelInternal(
const uint64_t& aID, int32_t* aLevel) override;
virtual mozilla::ipc::IPCResult RecvGroupPosition(
const uint64_t& aID, int32_t* aLevel, int32_t* aSimilarItemsInGroup,
int32_t* aPositionInGroup) override;

virtual mozilla::ipc::IPCResult RecvAttributes(
const uint64_t& aID, nsTArray<Attribute>* aAttributes) override;
Expand Down
3 changes: 2 additions & 1 deletion accessible/ipc/other/PDocAccessible.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ child:
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 GetLevelInternal(uint64_t aID) returns(int32_t aLevel);
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);
async ScrollToPoint(uint64_t aID, uint32_t aScrollType, int32_t aX,
int32_t aY);
Expand Down
9 changes: 5 additions & 4 deletions accessible/ipc/other/ProxyAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ nsStaticAtom* ProxyAccessible::ARIARoleAtom() const {
return NS_GetStaticAtom(role);
}

int32_t ProxyAccessible::GetLevelInternal() {
int32_t level = 0;
Unused << mDoc->SendGetLevelInternal(mID, &level);
return level;
GroupPos ProxyAccessible::GroupPosition() {
GroupPos groupPos;
Unused << mDoc->SendGroupPosition(mID, &groupPos.level, &groupPos.setSize,
&groupPos.posInSet);
return groupPos;
}

void ProxyAccessible::ScrollTo(uint32_t aScrollType) {
Expand Down
8 changes: 4 additions & 4 deletions accessible/mac/mozHTMLAccessible.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ - (NSString*)title {
}

- (id)value {
uint32_t level = 0;
GroupPos groupPos;
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
level = accWrap->GetLevelInternal();
groupPos = accWrap->GroupPosition();
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
level = proxy->GetLevelInternal();
groupPos = proxy->GroupPosition();
}

return [NSNumber numberWithInt:level];
return [NSNumber numberWithInt:groupPos.level];
}

@end
Expand Down
9 changes: 6 additions & 3 deletions accessible/xpcom/xpcAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,12 @@ xpcAccessible::GroupPosition(int32_t* aGroupLevel,
NS_ENSURE_ARG_POINTER(aPositionInGroup);
*aPositionInGroup = 0;

if (!Intl()) return NS_ERROR_FAILURE;

GroupPos groupPos = Intl()->GroupPosition();
GroupPos groupPos;
if (Accessible* acc = IntlGeneric().AsAccessible()) {
groupPos = acc->GroupPosition();
} else {
groupPos = IntlGeneric().AsProxy()->GroupPosition();
}

*aGroupLevel = groupPos.level;
*aSimilarItemsInGroup = groupPos.setSize;
Expand Down
4 changes: 2 additions & 2 deletions ipc/ipdl/sync-messages.ini
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ platform = notwin
[PDocAccessible::ARIARoleAtom]
description = Legacy a11y IPC
platform = notwin
[PDocAccessible::GetLevelInternal]
description = Legacy a11y IPC
[PDocAccessible::GroupPosition]
description = Legacy a11y IPC. Platform accessibility APIs need to query content synchronously for information.
platform = notwin
[PDocAccessible::CaretLineNumber]
description = Legacy a11y IPC
Expand Down

0 comments on commit 13b14ef

Please sign in to comment.