зеркало из 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
|
// override, final
|
||||||
- (id)accessibilityFocusedUIElement;
|
- (id)accessibilityFocusedUIElement;
|
||||||
|
|
||||||
|
// override, final
|
||||||
|
- (NSValue*)accessibilityFrame;
|
||||||
|
|
||||||
// override, final
|
// override, final
|
||||||
- (BOOL)isAccessibilityElement;
|
- (BOOL)isAccessibilityElement;
|
||||||
|
|
||||||
|
|
|
@ -384,6 +384,12 @@ mozilla::LogModule* GetMacAccessibilityLog() {
|
||||||
NS_OBJC_END_TRY_BLOCK_RETURN(nil);
|
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 {
|
- (BOOL)isAccessibilityElement {
|
||||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,9 @@
|
||||||
// AXWindow
|
// AXWindow
|
||||||
- (id _Nullable)moxWindow;
|
- (id _Nullable)moxWindow;
|
||||||
|
|
||||||
|
// AXFrame
|
||||||
|
- (NSValue* _Nullable)moxFrame;
|
||||||
|
|
||||||
// AXTitleUIElement
|
// AXTitleUIElement
|
||||||
- (id _Nullable)moxTitleUIElement;
|
- (id _Nullable)moxTitleUIElement;
|
||||||
|
|
||||||
|
|
|
@ -193,6 +193,9 @@ inline mozAccessible* GetNativeFromGeckoAccessible(
|
||||||
// override
|
// override
|
||||||
- (NSNumber*)moxSelected;
|
- (NSNumber*)moxSelected;
|
||||||
|
|
||||||
|
// override
|
||||||
|
- (NSValue*)moxFrame;
|
||||||
|
|
||||||
// override
|
// override
|
||||||
- (NSString*)moxARIACurrent;
|
- (NSString*)moxARIACurrent;
|
||||||
|
|
||||||
|
|
|
@ -354,35 +354,16 @@ static const uint64_t kCacheInitialized = ((uint64_t)0x1) << 63;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSValue*)moxPosition {
|
- (NSValue*)moxPosition {
|
||||||
MOZ_ASSERT(!mGeckoAccessible.IsNull());
|
CGRect frame = [[self moxFrame] rectValue];
|
||||||
|
|
||||||
nsIntRect rect = mGeckoAccessible.IsAccessible()
|
return [NSValue valueWithPoint:NSMakePoint(frame.origin.x, frame.origin.y)];
|
||||||
? 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];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSValue*)moxSize {
|
- (NSValue*)moxSize {
|
||||||
MOZ_ASSERT(!mGeckoAccessible.IsNull());
|
CGRect frame = [[self moxFrame] rectValue];
|
||||||
|
|
||||||
nsIntRect rect = mGeckoAccessible.IsAccessible()
|
return
|
||||||
? mGeckoAccessible.AsAccessible()->Bounds()
|
[NSValue valueWithSize:NSMakeSize(frame.size.width, frame.size.height)];
|
||||||
: 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)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)moxRole {
|
- (NSString*)moxRole {
|
||||||
|
@ -712,6 +693,25 @@ struct RoleDescrComparator {
|
||||||
return @NO;
|
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 {
|
- (NSString*)moxARIACurrent {
|
||||||
if (![self stateWithMask:states::CURRENT]) {
|
if (![self stateWithMask:states::CURRENT]) {
|
||||||
return nil;
|
return nil;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче