Index: content/browser/accessibility/browser_accessibility_cocoa.mm |
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm |
index 66b7826286b40da35b41bd17463a42284a48cdd5..8891ab2cc740fc10fece115c71f30c35b2890422 100644 |
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm |
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm |
@@ -287,6 +287,7 @@ NSDictionary* attributeToMethodNameMap = nil; |
{ @"AXARIALive", @"ariaLive" }, |
{ @"AXARIARelevant", @"ariaRelevant" }, |
{ @"AXInvalid", @"invalid" }, |
+ { @"AXLinkedUIElements", @"linkedUIElements" }, |
David Tseng
2014/03/12 00:30:56
This is a native OS X attribute,s o let's use
NSAc
aboxhall
2014/03/12 17:50:47
Done.
|
{ @"AXLoaded", @"loaded" }, |
{ @"AXLoadingProgress", @"loadingProgress" }, |
{ @"AXRequired", @"required" }, |
@@ -851,9 +852,49 @@ NSDictionary* attributeToMethodNameMap = nil; |
if (titleElement) |
return titleElement->ToBrowserAccessibilityCocoa(); |
} |
+ std::vector<int32> labelledby_ids = |
+ browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_LABELLEDBY_IDS); |
+ if (labelledby_ids.size() == 1) { |
David Tseng
2014/03/12 00:30:56
This is an interesting case.
Mac, unfortunately,
aboxhall
2014/03/12 17:50:47
I don't completely follow, sorry. The spec says:
I
David Tseng
2014/03/12 18:30:17
No; this is Mac specific:
NSString *const NSAccess
aboxhall
2014/03/12 20:51:47
Added TODO as discussed.
|
+ BrowserAccessibility* titleElement = |
+ browserAccessibility_->manager()->GetFromRendererID(labelledby_ids[0]); |
+ if (titleElement) |
+ return titleElement->ToBrowserAccessibilityCocoa(); |
+ } |
+ |
return nil; |
} |
+- (NSArray*)linkedUIElements { |
David Tseng
2014/03/12 00:30:56
Keep these methods sorted.
aboxhall
2014/03/12 17:50:47
Done.
|
+ NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; |
+ const std::vector<int32>& ownsIds = |
+ browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_OWNS_IDS); |
dmazzoni
2014/03/11 23:37:52
These are all analogous, maybe a helper function t
aboxhall
2014/03/12 17:50:47
Done.
|
+ for (size_t i = 0; i < ownsIds.size(); ++i) { |
+ BrowserAccessibility* ownsElement = |
+ browserAccessibility_->manager()->GetFromRendererID(ownsIds[i]); |
+ if (ownsElement) |
+ [ret addObject:ownsElement->ToBrowserAccessibilityCocoa()]; |
+ } |
+ const std::vector<int32>& controlsIds = |
+ browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_CONTROLS_IDS); |
+ for (size_t i = 0; i < controlsIds.size(); ++i) { |
+ BrowserAccessibility* controlsElement = |
+ browserAccessibility_->manager()->GetFromRendererID(controlsIds[i]); |
+ if (controlsElement) |
+ [ret addObject:controlsElement->ToBrowserAccessibilityCocoa()]; |
+ } |
+ const std::vector<int32>& flowtoIds = |
+ browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_FLOWTO_IDS); |
+ for (size_t i = 0; i < flowtoIds.size(); ++i) { |
+ BrowserAccessibility* flowtoElement = |
+ browserAccessibility_->manager()->GetFromRendererID(flowtoIds[i]); |
+ if (flowtoElement) |
+ [ret addObject:flowtoElement->ToBrowserAccessibilityCocoa()]; |
+ } |
+ if ([ret count] == 0) |
+ return nil; |
+ return ret; |
+} |
+ |
- (NSString*)url { |
StringAttribute urlAttribute = |
[[self role] isEqualToString:@"AXWebArea"] ? |
@@ -1257,6 +1298,7 @@ NSDictionary* attributeToMethodNameMap = nil; |
@"AXInvalid", |
@"AXRequired", |
@"AXVisited", |
+ @"AXLinkedUIElements", |
David Tseng
2014/03/12 00:30:56
Ditto.
aboxhall
2014/03/12 17:50:47
Done.
aboxhall
2014/03/12 17:50:47
Done.
|
nil]; |
// Specific role attributes. |
@@ -1356,8 +1398,8 @@ NSDictionary* attributeToMethodNameMap = nil; |
} |
// Title UI Element. |
- if (browserAccessibility_->HasIntAttribute( |
- ui::AX_ATTR_TITLE_UI_ELEMENT)) { |
+ if (browserAccessibility_->HasIntAttribute(ui::AX_ATTR_TITLE_UI_ELEMENT) || |
+ browserAccessibility_->HasIntListAttribute(ui::AX_ATTR_LABELLEDBY_IDS)) { |
David Tseng
2014/03/12 00:30:56
Technically, only if there's exactly one labelled
aboxhall
2014/03/12 17:50:47
True. I'll change it, but would there be an issue
David Tseng
2014/03/12 18:30:17
Well, a client could request the attributes suppor
|
[ret addObjectsFromArray:[NSArray arrayWithObjects: |
NSAccessibilityTitleUIElementAttribute, |
nil]]; |