зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1376303 - Expose aria-orientation via NSAccessibilityOrientationAttribute. r=MarcoZ
Add orientation() method to the macOS accessibility wrapper, mapping states::Horizontal to NSAccessibilityHorizontalOrientationValue, states::NSAccessibilityVerticalOrientationValue and the absence of both to NSAccessibilityUnknownOrientationValue.
This commit is contained in:
Родитель
cb111ebec5
Коммит
68f6fdc9bf
|
@ -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.
|
||||
|
|
|
@ -323,6 +323,9 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& 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
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче