diff --git a/accessible/mac/mozAccessible.h b/accessible/mac/mozAccessible.h index 6d7db3fe9863..d1424ba142da 100644 --- a/accessible/mac/mozAccessible.h +++ b/accessible/mac/mozAccessible.h @@ -114,6 +114,9 @@ static const uintptr_t IS_PROXY = 1; // the accessible description (help text) of this particular instance. - (NSString*)help; +// returns the orientation (vertical, horizontal, or undefined) +- (NSString*)orientation; + - (BOOL)isEnabled; // information about focus. diff --git a/accessible/mac/mozAccessible.mm b/accessible/mac/mozAccessible.mm index 29d70764702b..8bd24463d3f5 100644 --- a/accessible/mac/mozAccessible.mm +++ b/accessible/mac/mozAccessible.mm @@ -323,6 +323,9 @@ ConvertToNSArray(nsTArray& aArray) } if ([attribute isEqualToString:NSAccessibilityHelpAttribute]) return [self help]; + if ([attribute isEqualToString:NSAccessibilityOrientationAttribute]) + return [self orientation]; + if ([attribute isEqualToString:NSAccessibilityDOMIdentifierAttribute]) { nsAutoString id; if (accWrap) @@ -1067,6 +1070,28 @@ struct RoleDescrComparator NS_OBJC_END_TRY_ABORT_BLOCK_NIL; } +- (NSString*)orientation +{ + NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; + + uint64_t state; + if (AccessibleWrap* accWrap = [self getGeckoAccessible]) + state = accWrap->InteractiveState(); + else if (ProxyAccessible* proxy = [self getProxyAccessible]) + state = proxy->State(); + else + state = 0; + + if (state & states::HORIZONTAL) + return NSAccessibilityHorizontalOrientationValue; + if (state & states::VERTICAL) + return NSAccessibilityVerticalOrientationValue; + + return NSAccessibilityUnknownOrientationValue; + + NS_OBJC_END_TRY_ABORT_BLOCK_NIL; +} + // objc-style description (from NSObject); not to be confused with the accessible description above. - (NSString*)description {