зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1706910: Implement AXFrame, accessibilityFrame for VoiceOver r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D113585
This commit is contained in:
Родитель
5272e5d351
Коммит
ab5a074a02
|
@ -78,6 +78,9 @@ inline id<mozAccessible> GetObjectOrRepresentedView(id<mozAccessible> aObject) {
|
|||
// override, final
|
||||
- (id)accessibilityFocusedUIElement;
|
||||
|
||||
// override, final
|
||||
- (NSValue*)accessibilityFrame;
|
||||
|
||||
// override, final
|
||||
- (BOOL)isAccessibilityElement;
|
||||
|
||||
|
|
|
@ -384,6 +384,12 @@ mozilla::LogModule* GetMacAccessibilityLog() {
|
|||
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
|
||||
}
|
||||
|
||||
- (NSValue*)accessibilityFrame {
|
||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||
return [self isSelectorSupported:@selector(moxFrame)] ? [self moxFrame] : nil;
|
||||
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
|
||||
}
|
||||
|
||||
- (BOOL)isAccessibilityElement {
|
||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||
|
||||
|
|
|
@ -111,6 +111,9 @@
|
|||
// AXWindow
|
||||
- (id _Nullable)moxWindow;
|
||||
|
||||
// AXFrame
|
||||
- (NSValue* _Nullable)moxFrame;
|
||||
|
||||
// AXTitleUIElement
|
||||
- (id _Nullable)moxTitleUIElement;
|
||||
|
||||
|
|
|
@ -193,6 +193,9 @@ inline mozAccessible* GetNativeFromGeckoAccessible(
|
|||
// override
|
||||
- (NSNumber*)moxSelected;
|
||||
|
||||
// override
|
||||
- (NSValue*)moxFrame;
|
||||
|
||||
// override
|
||||
- (NSString*)moxARIACurrent;
|
||||
|
||||
|
|
|
@ -354,35 +354,16 @@ static const uint64_t kCacheInitialized = ((uint64_t)0x1) << 63;
|
|||
}
|
||||
|
||||
- (NSValue*)moxPosition {
|
||||
MOZ_ASSERT(!mGeckoAccessible.IsNull());
|
||||
CGRect frame = [[self moxFrame] rectValue];
|
||||
|
||||
nsIntRect rect = mGeckoAccessible.IsAccessible()
|
||||
? mGeckoAccessible.AsAccessible()->Bounds()
|
||||
: mGeckoAccessible.AsProxy()->Bounds();
|
||||
|
||||
NSScreen* mainView = [[NSScreen screens] objectAtIndex:0];
|
||||
CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mainView);
|
||||
NSPoint p =
|
||||
NSMakePoint(static_cast<CGFloat>(rect.x) / scaleFactor,
|
||||
[mainView frame].size.height -
|
||||
static_cast<CGFloat>(rect.y + rect.height) / scaleFactor);
|
||||
|
||||
return [NSValue valueWithPoint:p];
|
||||
return [NSValue valueWithPoint:NSMakePoint(frame.origin.x, frame.origin.y)];
|
||||
}
|
||||
|
||||
- (NSValue*)moxSize {
|
||||
MOZ_ASSERT(!mGeckoAccessible.IsNull());
|
||||
CGRect frame = [[self moxFrame] rectValue];
|
||||
|
||||
nsIntRect rect = mGeckoAccessible.IsAccessible()
|
||||
? mGeckoAccessible.AsAccessible()->Bounds()
|
||||
: mGeckoAccessible.AsProxy()->Bounds();
|
||||
|
||||
CGFloat scaleFactor =
|
||||
nsCocoaUtils::GetBackingScaleFactor([[NSScreen screens] objectAtIndex:0]);
|
||||
return [NSValue
|
||||
valueWithSize:NSMakeSize(
|
||||
static_cast<CGFloat>(rect.width) / scaleFactor,
|
||||
static_cast<CGFloat>(rect.height) / scaleFactor)];
|
||||
return
|
||||
[NSValue valueWithSize:NSMakeSize(frame.size.width, frame.size.height)];
|
||||
}
|
||||
|
||||
- (NSString*)moxRole {
|
||||
|
@ -712,6 +693,25 @@ struct RoleDescrComparator {
|
|||
return @NO;
|
||||
}
|
||||
|
||||
- (NSValue*)moxFrame {
|
||||
MOZ_ASSERT(!mGeckoAccessible.IsNull());
|
||||
|
||||
nsIntRect rect = mGeckoAccessible.IsAccessible()
|
||||
? mGeckoAccessible.AsAccessible()->Bounds()
|
||||
: mGeckoAccessible.AsProxy()->Bounds();
|
||||
NSScreen* mainView = [[NSScreen screens] objectAtIndex:0];
|
||||
CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mainView);
|
||||
|
||||
return [NSValue
|
||||
valueWithRect:NSMakeRect(
|
||||
static_cast<CGFloat>(rect.x) / scaleFactor,
|
||||
[mainView frame].size.height -
|
||||
static_cast<CGFloat>(rect.y + rect.height) /
|
||||
scaleFactor,
|
||||
static_cast<CGFloat>(rect.width) / scaleFactor,
|
||||
static_cast<CGFloat>(rect.height) / scaleFactor)];
|
||||
}
|
||||
|
||||
- (NSString*)moxARIACurrent {
|
||||
if (![self stateWithMask:states::CURRENT]) {
|
||||
return nil;
|
||||
|
|
Загрузка…
Ссылка в новой задаче