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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 bool isAriaPressedDefined; | 525 bool isAriaPressedDefined; |
526 bool isMixed; | 526 bool isMixed; |
527 browserAccessibility_->GetAriaTristate("aria-pressed", | 527 browserAccessibility_->GetAriaTristate("aria-pressed", |
528 &isAriaPressedDefined, | 528 &isAriaPressedDefined, |
529 &isMixed); | 529 &isMixed); |
530 if (isAriaPressedDefined) | 530 if (isAriaPressedDefined) |
531 return NSAccessibilityCheckBoxRole; | 531 return NSAccessibilityCheckBoxRole; |
532 else | 532 else |
533 return NSAccessibilityButtonRole; | 533 return NSAccessibilityButtonRole; |
534 } | 534 } |
| 535 |
| 536 // If this is a web area for a presentational iframe, give it a role of |
| 537 // something other than WebArea so that the fact that it's a separate doc |
| 538 // is not exposed to AT. |
| 539 if (browserAccessibility_->IsWebAreaForPresentationalIframe()) |
| 540 return NSAccessibilityGroupRole; |
| 541 |
535 return [AXPlatformNodeCocoa nativeRoleFromAXRole:role]; | 542 return [AXPlatformNodeCocoa nativeRoleFromAXRole:role]; |
536 } | 543 } |
537 | 544 |
538 // Returns a string indicating the role description of this object. | 545 // Returns a string indicating the role description of this object. |
539 - (NSString*)roleDescription { | 546 - (NSString*)roleDescription { |
540 NSString* role = [self role]; | 547 NSString* role = [self role]; |
541 | 548 |
542 ContentClient* content_client = content::GetContentClient(); | 549 ContentClient* content_client = content::GetContentClient(); |
543 | 550 |
544 // The following descriptions are specific to webkit. | 551 // The following descriptions are specific to webkit. |
545 if ([role isEqualToString:@"AXWebArea"]) { | 552 if ([role isEqualToString:@"AXWebArea"]) { |
546 return base::SysUTF16ToNSString(content_client->GetLocalizedString( | 553 return base::SysUTF16ToNSString(content_client->GetLocalizedString( |
547 IDS_AX_ROLE_WEB_AREA)); | 554 IDS_AX_ROLE_WEB_AREA)); |
548 } | 555 } |
549 | 556 |
550 if ([role isEqualToString:@"NSAccessibilityLinkRole"]) { | 557 if ([role isEqualToString:@"NSAccessibilityLinkRole"]) { |
551 return base::SysUTF16ToNSString(content_client->GetLocalizedString( | 558 return base::SysUTF16ToNSString(content_client->GetLocalizedString( |
552 IDS_AX_ROLE_LINK)); | 559 IDS_AX_ROLE_LINK)); |
553 } | 560 } |
554 | 561 |
555 if ([role isEqualToString:@"AXHeading"]) { | 562 if ([role isEqualToString:@"AXHeading"]) { |
556 return base::SysUTF16ToNSString(content_client->GetLocalizedString( | 563 return base::SysUTF16ToNSString(content_client->GetLocalizedString( |
557 IDS_AX_ROLE_HEADING)); | 564 IDS_AX_ROLE_HEADING)); |
558 } | 565 } |
559 | 566 |
560 if ([role isEqualToString:NSAccessibilityGroupRole] || | 567 if (([role isEqualToString:NSAccessibilityGroupRole] || |
561 [role isEqualToString:NSAccessibilityRadioButtonRole]) { | 568 [role isEqualToString:NSAccessibilityRadioButtonRole]) && |
| 569 !browserAccessibility_->IsWebAreaForPresentationalIframe()) { |
562 std::string role; | 570 std::string role; |
563 if (browserAccessibility_->GetHtmlAttribute("role", &role)) { | 571 if (browserAccessibility_->GetHtmlAttribute("role", &role)) { |
564 ui::AXRole internalRole = [self internalRole]; | 572 ui::AXRole internalRole = [self internalRole]; |
565 if ((internalRole != ui::AX_ROLE_GROUP && | 573 if ((internalRole != ui::AX_ROLE_GROUP && |
566 internalRole != ui::AX_ROLE_LIST_ITEM) || | 574 internalRole != ui::AX_ROLE_LIST_ITEM) || |
567 internalRole == ui::AX_ROLE_TAB) { | 575 internalRole == ui::AX_ROLE_TAB) { |
568 // TODO(dtseng): This is not localized; see crbug/84814. | 576 // TODO(dtseng): This is not localized; see crbug/84814. |
569 return base::SysUTF8ToNSString(role); | 577 return base::SysUTF8ToNSString(role); |
570 } | 578 } |
571 } | 579 } |
(...skipping 938 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 |