| 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 "content/browser/accessibility/browser_accessibility_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 6 | 6 |
| 7 #include <UIAutomationClient.h> | 7 #include <UIAutomationClient.h> |
| 8 #include <UIAutomationCoreApi.h> | 8 #include <UIAutomationCoreApi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 3784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3795 break; | 3795 break; |
| 3796 case ui::AX_ARIA_CURRENT_STATE_TIME: | 3796 case ui::AX_ARIA_CURRENT_STATE_TIME: |
| 3797 win_attributes_->ia2_attributes.push_back(L"current:time"); | 3797 win_attributes_->ia2_attributes.push_back(L"current:time"); |
| 3798 break; | 3798 break; |
| 3799 } | 3799 } |
| 3800 } | 3800 } |
| 3801 | 3801 |
| 3802 // Expose table cell index. | 3802 // Expose table cell index. |
| 3803 if (IsCellOrTableHeaderRole()) { | 3803 if (IsCellOrTableHeaderRole()) { |
| 3804 BrowserAccessibility* table = PlatformGetParent(); | 3804 BrowserAccessibility* table = PlatformGetParent(); |
| 3805 while (table && table->GetRole() != ui::AX_ROLE_TABLE) | 3805 while (table && !table->IsTableOrGridOrTreeGridRole()) |
| 3806 table = table->PlatformGetParent(); | 3806 table = table->PlatformGetParent(); |
| 3807 if (table) { | 3807 if (table) { |
| 3808 const std::vector<int32_t>& unique_cell_ids = | 3808 const std::vector<int32_t>& unique_cell_ids = |
| 3809 table->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); | 3809 table->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); |
| 3810 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { | 3810 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { |
| 3811 if (unique_cell_ids[i] == GetId()) { | 3811 if (unique_cell_ids[i] == GetId()) { |
| 3812 win_attributes_->ia2_attributes.push_back( | 3812 win_attributes_->ia2_attributes.push_back( |
| 3813 base::string16(L"table-cell-index:") + base::IntToString16(i)); | 3813 base::string16(L"table-cell-index:") + base::IntToString16(i)); |
| 3814 } | 3814 } |
| 3815 } | 3815 } |
| (...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5530 case ui::AX_ROLE_SVG_ROOT: | 5530 case ui::AX_ROLE_SVG_ROOT: |
| 5531 ia_role = ROLE_SYSTEM_GRAPHIC; | 5531 ia_role = ROLE_SYSTEM_GRAPHIC; |
| 5532 break; | 5532 break; |
| 5533 case ui::AX_ROLE_SWITCH: | 5533 case ui::AX_ROLE_SWITCH: |
| 5534 role_name = L"switch"; | 5534 role_name = L"switch"; |
| 5535 ia2_role = IA2_ROLE_TOGGLE_BUTTON; | 5535 ia2_role = IA2_ROLE_TOGGLE_BUTTON; |
| 5536 break; | 5536 break; |
| 5537 case ui::AX_ROLE_TAB: | 5537 case ui::AX_ROLE_TAB: |
| 5538 ia_role = ROLE_SYSTEM_PAGETAB; | 5538 ia_role = ROLE_SYSTEM_PAGETAB; |
| 5539 break; | 5539 break; |
| 5540 case ui::AX_ROLE_TABLE: { | 5540 case ui::AX_ROLE_TABLE: |
| 5541 base::string16 aria_role = GetString16Attribute( | 5541 ia_role = ROLE_SYSTEM_TABLE; |
| 5542 ui::AX_ATTR_ROLE); | |
| 5543 if (aria_role == L"treegrid") { | |
| 5544 ia_role = ROLE_SYSTEM_OUTLINE; | |
| 5545 } else { | |
| 5546 ia_role = ROLE_SYSTEM_TABLE; | |
| 5547 } | |
| 5548 break; | 5542 break; |
| 5549 } | |
| 5550 case ui::AX_ROLE_TABLE_HEADER_CONTAINER: | 5543 case ui::AX_ROLE_TABLE_HEADER_CONTAINER: |
| 5551 ia_role = ROLE_SYSTEM_GROUPING; | 5544 ia_role = ROLE_SYSTEM_GROUPING; |
| 5552 ia2_role = IA2_ROLE_SECTION; | 5545 ia2_role = IA2_ROLE_SECTION; |
| 5553 ia_state |= STATE_SYSTEM_READONLY; | 5546 ia_state |= STATE_SYSTEM_READONLY; |
| 5554 break; | 5547 break; |
| 5555 case ui::AX_ROLE_TAB_LIST: | 5548 case ui::AX_ROLE_TAB_LIST: |
| 5556 ia_role = ROLE_SYSTEM_PAGETABLIST; | 5549 ia_role = ROLE_SYSTEM_PAGETABLIST; |
| 5557 break; | 5550 break; |
| 5558 case ui::AX_ROLE_TAB_PANEL: | 5551 case ui::AX_ROLE_TAB_PANEL: |
| 5559 ia_role = ROLE_SYSTEM_PROPERTYPAGE; | 5552 ia_role = ROLE_SYSTEM_PROPERTYPAGE; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5661 BrowserAccessibility* container = item->PlatformGetParent(); | 5654 BrowserAccessibility* container = item->PlatformGetParent(); |
| 5662 if (container && container->GetRole() == ui::AX_ROLE_GROUP) { | 5655 if (container && container->GetRole() == ui::AX_ROLE_GROUP) { |
| 5663 // If parent was a rowgroup, we need to look at the grandparent | 5656 // If parent was a rowgroup, we need to look at the grandparent |
| 5664 container = container->PlatformGetParent(); | 5657 container = container->PlatformGetParent(); |
| 5665 } | 5658 } |
| 5666 | 5659 |
| 5667 if (!container) { | 5660 if (!container) { |
| 5668 return false; | 5661 return false; |
| 5669 } | 5662 } |
| 5670 | 5663 |
| 5671 const ui::AXRole role = container->GetRole(); | 5664 return container->GetRole() == ui::AX_ROLE_TREE_GRID; |
| 5672 return role == ui::AX_ROLE_TREE_GRID || | |
| 5673 (role == ui::AX_ROLE_TABLE && | |
| 5674 container->GetString16Attribute(ui::AX_ATTR_ROLE) == L"treegrid"); | |
| 5675 } | 5665 } |
| 5676 | 5666 |
| 5677 BrowserAccessibilityWin* ToBrowserAccessibilityWin(BrowserAccessibility* obj) { | 5667 BrowserAccessibilityWin* ToBrowserAccessibilityWin(BrowserAccessibility* obj) { |
| 5678 DCHECK(!obj || obj->IsNative()); | 5668 DCHECK(!obj || obj->IsNative()); |
| 5679 return static_cast<BrowserAccessibilityWin*>(obj); | 5669 return static_cast<BrowserAccessibilityWin*>(obj); |
| 5680 } | 5670 } |
| 5681 | 5671 |
| 5682 const BrowserAccessibilityWin* | 5672 const BrowserAccessibilityWin* |
| 5683 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5673 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
| 5684 DCHECK(!obj || obj->IsNative()); | 5674 DCHECK(!obj || obj->IsNative()); |
| 5685 return static_cast<const BrowserAccessibilityWin*>(obj); | 5675 return static_cast<const BrowserAccessibilityWin*>(obj); |
| 5686 } | 5676 } |
| 5687 | 5677 |
| 5688 } // namespace content | 5678 } // namespace content |
| OLD | NEW |