mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1614834 - Advertise and implement AXScrollToVisible. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D63580 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
b7f5563eb0
commit
9701de3f19
@ -41,6 +41,8 @@ using namespace mozilla::a11y;
|
||||
#define NSAccessibilityMathUnderAttribute @"AXMathUnder"
|
||||
#define NSAccessibilityMathOverAttribute @"AXMathOver"
|
||||
#define NSAccessibilityMathLineThicknessAttribute @"AXMathLineThickness"
|
||||
#define NSAccessibilityScrollToVisibleAction @"AXScrollToVisible"
|
||||
|
||||
// XXX WebKit also defines the following attributes.
|
||||
// See bugs 1176970 and 1176983.
|
||||
// - NSAccessibilityMathFencedOpenAttribute @"AXMathFencedOpen"
|
||||
@ -476,7 +478,7 @@ static inline NSMutableArray* ConvertToNSArray(nsTArray<ProxyAccessible*>& aArra
|
||||
}
|
||||
|
||||
- (NSArray*)accessibilityActionNames {
|
||||
return nil;
|
||||
return @[NSAccessibilityScrollToVisibleAction];
|
||||
}
|
||||
|
||||
- (NSString*)accessibilityActionDescription:(NSString*)action {
|
||||
@ -523,6 +525,15 @@ static inline NSMutableArray* ConvertToNSArray(nsTArray<ProxyAccessible*>& aArra
|
||||
}
|
||||
|
||||
- (void)accessibilityPerformAction:(NSString*)action {
|
||||
if ([action isEqualToString:NSAccessibilityScrollToVisibleAction]) {
|
||||
RefPtr<AccessibleWrap> accWrap = [self getGeckoAccessible];
|
||||
ProxyAccessible* proxy = [self getProxyAccessible];
|
||||
if (accWrap) {
|
||||
accWrap->ScrollTo(nsIAccessibleScrollType::SCROLL_TYPE_ANYWHERE);
|
||||
} else if (proxy) {
|
||||
proxy->ScrollTo(nsIAccessibleScrollType::SCROLL_TYPE_ANYWHERE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (id)accessibilityFocusedUIElement {
|
||||
|
@ -79,13 +79,17 @@ enum CheckboxValue {
|
||||
- (NSArray*)accessibilityActionNames {
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
NSArray* actions = [super accessibilityActionNames];
|
||||
if ([self isEnabled]) {
|
||||
if ([self hasPopup])
|
||||
return
|
||||
[NSArray arrayWithObjects:NSAccessibilityPressAction, NSAccessibilityShowMenuAction, nil];
|
||||
return [NSArray arrayWithObject:NSAccessibilityPressAction];
|
||||
// VoiceOver expects the press action to be the first in the list.
|
||||
if ([self hasPopup]) {
|
||||
return [@[ NSAccessibilityPressAction, NSAccessibilityShowMenuAction ]
|
||||
arrayByAddingObjectsFromArray:actions];
|
||||
}
|
||||
return [@[ NSAccessibilityPressAction ] arrayByAddingObjectsFromArray:actions];
|
||||
}
|
||||
return nil;
|
||||
|
||||
return actions;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
@ -116,6 +120,8 @@ enum CheckboxValue {
|
||||
// once msaa and atk have merged better, they will implement
|
||||
// the action needed to show the menu.
|
||||
[self click];
|
||||
} else {
|
||||
[super accessibilityPerformAction:action];
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
|
Loading…
Reference in New Issue
Block a user