2012-01-24 02:37:21 +04:00
|
|
|
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
|
|
|
*/
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2012-01-24 02:37:21 +04:00
|
|
|
|
|
|
|
#import "mozHTMLAccessible.h"
|
|
|
|
|
2012-12-21 07:16:44 +04:00
|
|
|
#import "Accessible-inl.h"
|
2012-05-31 12:04:41 +04:00
|
|
|
#import "HyperTextAccessible.h"
|
2012-01-24 02:37:21 +04:00
|
|
|
|
2012-01-27 19:50:04 +04:00
|
|
|
#import "nsCocoaUtils.h"
|
|
|
|
|
2012-01-24 02:37:21 +04:00
|
|
|
@implementation mozHeadingAccessible
|
|
|
|
|
2020-05-29 01:41:13 +03:00
|
|
|
- (NSString*)moxTitle {
|
2012-06-30 01:12:16 +04:00
|
|
|
nsAutoString title;
|
2020-05-27 18:50:47 +03:00
|
|
|
if (Accessible* acc = mGeckoAccessible.AsAccessible()) {
|
2015-08-06 04:55:15 +03:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
// XXX use the flattening API when there are available
|
|
|
|
// see bug 768298
|
2020-05-27 18:50:47 +03:00
|
|
|
acc->GetContent()->GetTextContent(title, rv);
|
|
|
|
} else if (ProxyAccessible* proxy = mGeckoAccessible.AsProxy()) {
|
2015-08-06 04:55:15 +03:00
|
|
|
proxy->Title(title);
|
|
|
|
}
|
2012-06-30 01:12:16 +04:00
|
|
|
|
|
|
|
return nsCocoaUtils::ToNSString(title);
|
|
|
|
}
|
|
|
|
|
2020-05-29 01:41:13 +03:00
|
|
|
- (id)moxValue {
|
2020-03-10 21:32:38 +03:00
|
|
|
GroupPos groupPos;
|
2020-05-27 18:50:47 +03:00
|
|
|
if (Accessible* acc = mGeckoAccessible.AsAccessible()) {
|
|
|
|
groupPos = acc->GroupPosition();
|
|
|
|
} else if (ProxyAccessible* proxy = mGeckoAccessible.AsProxy()) {
|
2020-03-10 21:32:38 +03:00
|
|
|
groupPos = proxy->GroupPosition();
|
2015-08-06 04:55:15 +03:00
|
|
|
}
|
2012-01-24 02:37:21 +04:00
|
|
|
|
2020-03-10 21:32:38 +03:00
|
|
|
return [NSNumber numberWithInt:groupPos.level];
|
2012-01-24 02:37:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
2012-01-27 19:50:04 +04:00
|
|
|
|
|
|
|
@implementation mozLinkAccessible
|
|
|
|
|
2020-05-29 01:41:13 +03:00
|
|
|
- (NSString*)moxValue {
|
2012-07-12 04:22:28 +04:00
|
|
|
return @"";
|
|
|
|
}
|
|
|
|
|
2020-05-29 01:41:21 +03:00
|
|
|
- (NSURL*)moxURL {
|
2012-01-27 19:50:04 +04:00
|
|
|
nsAutoString value;
|
2020-05-27 18:50:47 +03:00
|
|
|
if (Accessible* acc = mGeckoAccessible.AsAccessible()) {
|
|
|
|
acc->Value(value);
|
|
|
|
} else if (ProxyAccessible* proxy = mGeckoAccessible.AsProxy()) {
|
2015-08-06 04:55:15 +03:00
|
|
|
proxy->Value(value);
|
|
|
|
}
|
2012-01-27 19:50:04 +04:00
|
|
|
|
|
|
|
NSString* urlString = value.IsEmpty() ? nil : nsCocoaUtils::ToNSString(value);
|
|
|
|
if (!urlString) return nil;
|
|
|
|
|
|
|
|
return [NSURL URLWithString:urlString];
|
|
|
|
}
|
|
|
|
|
2020-05-29 01:41:21 +03:00
|
|
|
- (NSNumber*)moxVisited {
|
|
|
|
return @([self stateWithMask:states::TRAVERSED] != 0);
|
|
|
|
}
|
|
|
|
|
2020-05-29 01:41:13 +03:00
|
|
|
- (NSString*)moxRole {
|
2020-04-24 17:36:36 +03:00
|
|
|
// If this is not LINKED, just expose this as a generic group accessible.
|
|
|
|
// Chrome and Safari expose this as a childless AXStaticText, but
|
|
|
|
// the HTML Accessibility API Mappings spec says this should be an AXGroup.
|
|
|
|
if (![self stateWithMask:states::LINKED]) {
|
|
|
|
return NSAccessibilityGroupRole;
|
|
|
|
}
|
|
|
|
|
2020-05-29 01:41:13 +03:00
|
|
|
return [super moxRole];
|
2020-04-24 17:36:36 +03:00
|
|
|
}
|
|
|
|
|
2012-01-27 19:50:04 +04:00
|
|
|
@end
|
2020-05-29 01:41:06 +03:00
|
|
|
|
|
|
|
@implementation MOXSummaryAccessible
|
|
|
|
|
|
|
|
- (NSNumber*)moxExpanded {
|
|
|
|
return @([self stateWithMask:states::EXPANDED] != 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|