| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <execinfo.h> | 5 #include <execinfo.h> |
| 6 | 6 |
| 7 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 7 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 bool isAriaPressedDefined; | 533 bool isAriaPressedDefined; |
| 534 bool isMixed; | 534 bool isMixed; |
| 535 browserAccessibility_->GetAriaTristate("aria-pressed", | 535 browserAccessibility_->GetAriaTristate("aria-pressed", |
| 536 &isAriaPressedDefined, | 536 &isAriaPressedDefined, |
| 537 &isMixed); | 537 &isMixed); |
| 538 if (isAriaPressedDefined) | 538 if (isAriaPressedDefined) |
| 539 return NSAccessibilityCheckBoxRole; | 539 return NSAccessibilityCheckBoxRole; |
| 540 else | 540 else |
| 541 return NSAccessibilityButtonRole; | 541 return NSAccessibilityButtonRole; |
| 542 } | 542 } |
| 543 |
| 544 // If this is a web area for a presentational iframe, give it a role of |
| 545 // something other than WebArea so that the fact that it's a separate doc |
| 546 // is not exposed to AT. |
| 547 if (browserAccessibility_->IsWebAreaForPresentationalIframe()) |
| 548 return NSAccessibilityGroupRole; |
| 549 |
| 543 return [AXPlatformNodeCocoa nativeRoleFromAXRole:role]; | 550 return [AXPlatformNodeCocoa nativeRoleFromAXRole:role]; |
| 544 } | 551 } |
| 545 | 552 |
| 546 // Returns a string indicating the role description of this object. | 553 // Returns a string indicating the role description of this object. |
| 547 - (NSString*)roleDescription { | 554 - (NSString*)roleDescription { |
| 548 NSString* role = [self role]; | 555 NSString* role = [self role]; |
| 549 | 556 |
| 550 ContentClient* content_client = content::GetContentClient(); | 557 ContentClient* content_client = content::GetContentClient(); |
| 551 | 558 |
| 552 // The following descriptions are specific to webkit. | 559 // The following descriptions are specific to webkit. |
| 553 if ([role isEqualToString:@"AXWebArea"]) { | 560 if ([role isEqualToString:@"AXWebArea"]) { |
| 554 return base::SysUTF16ToNSString(content_client->GetLocalizedString( | 561 return base::SysUTF16ToNSString(content_client->GetLocalizedString( |
| 555 IDS_AX_ROLE_WEB_AREA)); | 562 IDS_AX_ROLE_WEB_AREA)); |
| 556 } | 563 } |
| 557 | 564 |
| 558 if ([role isEqualToString:@"NSAccessibilityLinkRole"]) { | 565 if ([role isEqualToString:@"NSAccessibilityLinkRole"]) { |
| 559 return base::SysUTF16ToNSString(content_client->GetLocalizedString( | 566 return base::SysUTF16ToNSString(content_client->GetLocalizedString( |
| 560 IDS_AX_ROLE_LINK)); | 567 IDS_AX_ROLE_LINK)); |
| 561 } | 568 } |
| 562 | 569 |
| 563 if ([role isEqualToString:@"AXHeading"]) { | 570 if ([role isEqualToString:@"AXHeading"]) { |
| 564 return base::SysUTF16ToNSString(content_client->GetLocalizedString( | 571 return base::SysUTF16ToNSString(content_client->GetLocalizedString( |
| 565 IDS_AX_ROLE_HEADING)); | 572 IDS_AX_ROLE_HEADING)); |
| 566 } | 573 } |
| 567 | 574 |
| 568 if ([role isEqualToString:NSAccessibilityGroupRole] || | 575 if (([role isEqualToString:NSAccessibilityGroupRole] || |
| 569 [role isEqualToString:NSAccessibilityRadioButtonRole]) { | 576 [role isEqualToString:NSAccessibilityRadioButtonRole]) && |
| 577 !browserAccessibility_->IsWebAreaForPresentationalIframe()) { |
| 570 std::string role; | 578 std::string role; |
| 571 if (browserAccessibility_->GetHtmlAttribute("role", &role)) { | 579 if (browserAccessibility_->GetHtmlAttribute("role", &role)) { |
| 572 ui::AXRole internalRole = [self internalRole]; | 580 ui::AXRole internalRole = [self internalRole]; |
| 573 if ((internalRole != ui::AX_ROLE_GROUP && | 581 if ((internalRole != ui::AX_ROLE_GROUP && |
| 574 internalRole != ui::AX_ROLE_LIST_ITEM) || | 582 internalRole != ui::AX_ROLE_LIST_ITEM) || |
| 575 internalRole == ui::AX_ROLE_TAB) { | 583 internalRole == ui::AX_ROLE_TAB) { |
| 576 // TODO(dtseng): This is not localized; see crbug/84814. | 584 // TODO(dtseng): This is not localized; see crbug/84814. |
| 577 return base::SysUTF8ToNSString(role); | 585 return base::SysUTF8ToNSString(role); |
| 578 } | 586 } |
| 579 } | 587 } |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 return [super hash]; | 1518 return [super hash]; |
| 1511 return browserAccessibility_->GetId(); | 1519 return browserAccessibility_->GetId(); |
| 1512 } | 1520 } |
| 1513 | 1521 |
| 1514 - (BOOL)accessibilityShouldUseUniqueId { | 1522 - (BOOL)accessibilityShouldUseUniqueId { |
| 1515 return YES; | 1523 return YES; |
| 1516 } | 1524 } |
| 1517 | 1525 |
| 1518 @end | 1526 @end |
| 1519 | 1527 |
| OLD | NEW |