Skip to content

Commit

Permalink
Bug 1171995 - Part 6: Handle proxies in mozAccessible accessibilityHi…
Browse files Browse the repository at this point in the history
…tTest and accessibilityFocusedUIElement r=tbsaunde
  • Loading branch information
lorienhu committed Jul 16, 2015
1 parent 76fffae commit 81c4b13
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions accessible/mac/mozAccessible.mm
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,8 @@ - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute
- (id)accessibilityHitTest:(NSPoint)point
{
AccessibleWrap* accWrap = [self getGeckoAccessible];
if (!accWrap)
ProxyAccessible* proxy = [self getProxyAccessible];
if (!accWrap && !proxy)
return nil;

// Convert the given screen-global point in the cocoa coordinate system (with
Expand All @@ -692,16 +693,22 @@ - (id)accessibilityHitTest:(NSPoint)point
nsIntPoint geckoPoint = nsCocoaUtils::
CocoaPointsToDevPixels(tmpPoint, nsCocoaUtils::GetBackingScaleFactor(mainView));

Accessible* child =
accWrap->ChildAtPoint(geckoPoint.x, geckoPoint.y,
Accessible::eDeepestChild);

if (child) {
mozAccessible* nativeChild = GetNativeFromGeckoAccessible(child);
if (nativeChild)
return GetClosestInterestingAccessible(nativeChild);
mozAccessible* nativeChild = nil;
if (accWrap) {
Accessible* child = accWrap->ChildAtPoint(geckoPoint.x, geckoPoint.y,
Accessible::eDeepestChild);
if (child)
nativeChild = GetNativeFromGeckoAccessible(child);
} else if (proxy) {
ProxyAccessible* child = proxy->ChildAtPoint(geckoPoint.x, geckoPoint.y,
Accessible::eDeepestChild);
if (child)
nativeChild = GetNativeFromProxy(child);
}

if (nativeChild)
return GetClosestInterestingAccessible(nativeChild);

// if we didn't find anything, return ourself (or the first unignored ancestor).
return GetClosestInterestingAccessible(self);
}
Expand All @@ -725,16 +732,24 @@ - (void)accessibilityPerformAction:(NSString*)action
- (id)accessibilityFocusedUIElement
{
AccessibleWrap* accWrap = [self getGeckoAccessible];
if (!accWrap)
ProxyAccessible* proxy = [self getProxyAccessible];
if (!accWrap && !proxy)
return nil;

Accessible* focusedGeckoChild = accWrap->FocusedChild();
if (focusedGeckoChild) {
mozAccessible *focusedChild = GetNativeFromGeckoAccessible(focusedGeckoChild);
if (focusedChild)
return GetClosestInterestingAccessible(focusedChild);
mozAccessible* focusedChild = nil;
if (accWrap) {
Accessible* focusedGeckoChild = accWrap->FocusedChild();
if (focusedGeckoChild)
focusedChild = GetNativeFromGeckoAccessible(focusedGeckoChild);
} else if (proxy) {
ProxyAccessible* focusedGeckoChild = proxy->FocusedChild();
if (focusedGeckoChild)
focusedChild = GetNativeFromProxy(focusedGeckoChild);
}

if (focusedChild)
return GetClosestInterestingAccessible(focusedChild);

// return ourself if we can't get a native focused child.
return GetClosestInterestingAccessible(self);
}
Expand Down

0 comments on commit 81c4b13

Please sign in to comment.