Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: content/browser/accessibility/browser_accessibility_win.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 STDMETHODIMP BrowserAccessibilityWin::get_accHelpTopic(BSTR* help_file, 593 STDMETHODIMP BrowserAccessibilityWin::get_accHelpTopic(BSTR* help_file,
594 VARIANT var_id, 594 VARIANT var_id,
595 LONG* topic_id) { 595 LONG* topic_id) {
596 return E_NOTIMPL; 596 return E_NOTIMPL;
597 } 597 }
598 598
599 STDMETHODIMP BrowserAccessibilityWin::get_accSelection(VARIANT* selected) { 599 STDMETHODIMP BrowserAccessibilityWin::get_accSelection(VARIANT* selected) {
600 if (!instance_active_) 600 if (!instance_active_)
601 return E_FAIL; 601 return E_FAIL;
602 602
603 if (role_ != WebKit::WebAXRoleListBox) 603 if (role_ != blink::WebAXRoleListBox)
604 return E_NOTIMPL; 604 return E_NOTIMPL;
605 605
606 unsigned long selected_count = 0; 606 unsigned long selected_count = 0;
607 for (size_t i = 0; i < children_.size(); ++i) { 607 for (size_t i = 0; i < children_.size(); ++i) {
608 if (children_[i]->HasState(WebKit::WebAXStateSelected)) 608 if (children_[i]->HasState(blink::WebAXStateSelected))
609 ++selected_count; 609 ++selected_count;
610 } 610 }
611 611
612 if (selected_count == 0) { 612 if (selected_count == 0) {
613 selected->vt = VT_EMPTY; 613 selected->vt = VT_EMPTY;
614 return S_OK; 614 return S_OK;
615 } 615 }
616 616
617 if (selected_count == 1) { 617 if (selected_count == 1) {
618 for (size_t i = 0; i < children_.size(); ++i) { 618 for (size_t i = 0; i < children_.size(); ++i) {
619 if (children_[i]->HasState(WebKit::WebAXStateSelected)) { 619 if (children_[i]->HasState(blink::WebAXStateSelected)) {
620 selected->vt = VT_DISPATCH; 620 selected->vt = VT_DISPATCH;
621 selected->pdispVal = 621 selected->pdispVal =
622 children_[i]->ToBrowserAccessibilityWin()->NewReference(); 622 children_[i]->ToBrowserAccessibilityWin()->NewReference();
623 return S_OK; 623 return S_OK;
624 } 624 }
625 } 625 }
626 } 626 }
627 627
628 // Multiple items are selected. 628 // Multiple items are selected.
629 base::win::EnumVariant* enum_variant = 629 base::win::EnumVariant* enum_variant =
630 new base::win::EnumVariant(selected_count); 630 new base::win::EnumVariant(selected_count);
631 enum_variant->AddRef(); 631 enum_variant->AddRef();
632 unsigned long index = 0; 632 unsigned long index = 0;
633 for (size_t i = 0; i < children_.size(); ++i) { 633 for (size_t i = 0; i < children_.size(); ++i) {
634 if (children_[i]->HasState(WebKit::WebAXStateSelected)) { 634 if (children_[i]->HasState(blink::WebAXStateSelected)) {
635 enum_variant->ItemAt(index)->vt = VT_DISPATCH; 635 enum_variant->ItemAt(index)->vt = VT_DISPATCH;
636 enum_variant->ItemAt(index)->pdispVal = 636 enum_variant->ItemAt(index)->pdispVal =
637 children_[i]->ToBrowserAccessibilityWin()->NewReference(); 637 children_[i]->ToBrowserAccessibilityWin()->NewReference();
638 ++index; 638 ++index;
639 } 639 }
640 } 640 }
641 selected->vt = VT_UNKNOWN; 641 selected->vt = VT_UNKNOWN;
642 selected->punkVal = static_cast<IUnknown*>( 642 selected->punkVal = static_cast<IUnknown*>(
643 static_cast<base::win::IUnknownImpl*>(enum_variant)); 643 static_cast<base::win::IUnknownImpl*>(enum_variant));
644 return S_OK; 644 return S_OK;
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( 865 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition(
866 LONG* group_level, 866 LONG* group_level,
867 LONG* similar_items_in_group, 867 LONG* similar_items_in_group,
868 LONG* position_in_group) { 868 LONG* position_in_group) {
869 if (!instance_active_) 869 if (!instance_active_)
870 return E_FAIL; 870 return E_FAIL;
871 871
872 if (!group_level || !similar_items_in_group || !position_in_group) 872 if (!group_level || !similar_items_in_group || !position_in_group)
873 return E_INVALIDARG; 873 return E_INVALIDARG;
874 874
875 if (role_ == WebKit::WebAXRoleListBoxOption && 875 if (role_ == blink::WebAXRoleListBoxOption &&
876 parent_ && 876 parent_ &&
877 parent_->role() == WebKit::WebAXRoleListBox) { 877 parent_->role() == blink::WebAXRoleListBox) {
878 *group_level = 0; 878 *group_level = 0;
879 *similar_items_in_group = parent_->PlatformChildCount(); 879 *similar_items_in_group = parent_->PlatformChildCount();
880 *position_in_group = index_in_parent_ + 1; 880 *position_in_group = index_in_parent_ + 1;
881 return S_OK; 881 return S_OK;
882 } 882 }
883 883
884 return E_NOTIMPL; 884 return E_NOTIMPL;
885 } 885 }
886 886
887 // 887 //
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 1126
1127 if (column < 0 || column >= columns) 1127 if (column < 0 || column >= columns)
1128 return E_INVALIDARG; 1128 return E_INVALIDARG;
1129 1129
1130 const std::vector<int32>& cell_ids = GetIntListAttribute( 1130 const std::vector<int32>& cell_ids = GetIntListAttribute(
1131 AccessibilityNodeData::ATTR_CELL_IDS); 1131 AccessibilityNodeData::ATTR_CELL_IDS);
1132 for (int i = 0; i < rows; ++i) { 1132 for (int i = 0; i < rows; ++i) {
1133 int cell_id = cell_ids[i * columns + column]; 1133 int cell_id = cell_ids[i * columns + column];
1134 BrowserAccessibilityWin* cell = static_cast<BrowserAccessibilityWin*>( 1134 BrowserAccessibilityWin* cell = static_cast<BrowserAccessibilityWin*>(
1135 manager_->GetFromRendererID(cell_id)); 1135 manager_->GetFromRendererID(cell_id));
1136 if (cell && cell->role_ == WebKit::WebAXRoleColumnHeader) { 1136 if (cell && cell->role_ == blink::WebAXRoleColumnHeader) {
1137 string16 cell_name = cell->GetString16Attribute( 1137 string16 cell_name = cell->GetString16Attribute(
1138 AccessibilityNodeData::ATTR_NAME); 1138 AccessibilityNodeData::ATTR_NAME);
1139 if (cell_name.size() > 0) { 1139 if (cell_name.size() > 0) {
1140 *description = SysAllocString(cell_name.c_str()); 1140 *description = SysAllocString(cell_name.c_str());
1141 return S_OK; 1141 return S_OK;
1142 } 1142 }
1143 1143
1144 return cell->GetStringAttributeAsBstr( 1144 return cell->GetStringAttributeAsBstr(
1145 AccessibilityNodeData::ATTR_DESCRIPTION, description); 1145 AccessibilityNodeData::ATTR_DESCRIPTION, description);
1146 } 1146 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 1313
1314 if (row < 0 || row >= rows) 1314 if (row < 0 || row >= rows)
1315 return E_INVALIDARG; 1315 return E_INVALIDARG;
1316 1316
1317 const std::vector<int32>& cell_ids = GetIntListAttribute( 1317 const std::vector<int32>& cell_ids = GetIntListAttribute(
1318 AccessibilityNodeData::ATTR_CELL_IDS); 1318 AccessibilityNodeData::ATTR_CELL_IDS);
1319 for (int i = 0; i < columns; ++i) { 1319 for (int i = 0; i < columns; ++i) {
1320 int cell_id = cell_ids[row * columns + i]; 1320 int cell_id = cell_ids[row * columns + i];
1321 BrowserAccessibilityWin* cell = 1321 BrowserAccessibilityWin* cell =
1322 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); 1322 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin();
1323 if (cell && cell->role_ == WebKit::WebAXRoleRowHeader) { 1323 if (cell && cell->role_ == blink::WebAXRoleRowHeader) {
1324 string16 cell_name = cell->GetString16Attribute( 1324 string16 cell_name = cell->GetString16Attribute(
1325 AccessibilityNodeData::ATTR_NAME); 1325 AccessibilityNodeData::ATTR_NAME);
1326 if (cell_name.size() > 0) { 1326 if (cell_name.size() > 0) {
1327 *description = SysAllocString(cell_name.c_str()); 1327 *description = SysAllocString(cell_name.c_str());
1328 return S_OK; 1328 return S_OK;
1329 } 1329 }
1330 1330
1331 return cell->GetStringAttributeAsBstr( 1331 return cell->GetStringAttributeAsBstr(
1332 AccessibilityNodeData::ATTR_DESCRIPTION, description); 1332 AccessibilityNodeData::ATTR_DESCRIPTION, description);
1333 } 1333 }
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 1636
1637 *n_column_header_cells = 0; 1637 *n_column_header_cells = 0;
1638 1638
1639 int column; 1639 int column;
1640 if (!GetIntAttribute( 1640 if (!GetIntAttribute(
1641 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { 1641 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &column)) {
1642 return S_FALSE; 1642 return S_FALSE;
1643 } 1643 }
1644 1644
1645 BrowserAccessibility* table = parent(); 1645 BrowserAccessibility* table = parent();
1646 while (table && table->role() != WebKit::WebAXRoleTable) 1646 while (table && table->role() != blink::WebAXRoleTable)
1647 table = table->parent(); 1647 table = table->parent();
1648 if (!table) { 1648 if (!table) {
1649 NOTREACHED(); 1649 NOTREACHED();
1650 return S_FALSE; 1650 return S_FALSE;
1651 } 1651 }
1652 1652
1653 int columns; 1653 int columns;
1654 int rows; 1654 int rows;
1655 if (!table->GetIntAttribute( 1655 if (!table->GetIntAttribute(
1656 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || 1656 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) ||
1657 !table->GetIntAttribute( 1657 !table->GetIntAttribute(
1658 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows)) { 1658 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows)) {
1659 return S_FALSE; 1659 return S_FALSE;
1660 } 1660 }
1661 if (columns <= 0 || rows <= 0 || column < 0 || column >= columns) 1661 if (columns <= 0 || rows <= 0 || column < 0 || column >= columns)
1662 return S_FALSE; 1662 return S_FALSE;
1663 1663
1664 const std::vector<int32>& cell_ids = table->GetIntListAttribute( 1664 const std::vector<int32>& cell_ids = table->GetIntListAttribute(
1665 AccessibilityNodeData::ATTR_CELL_IDS); 1665 AccessibilityNodeData::ATTR_CELL_IDS);
1666 1666
1667 for (int i = 0; i < rows; ++i) { 1667 for (int i = 0; i < rows; ++i) {
1668 int cell_id = cell_ids[i * columns + column]; 1668 int cell_id = cell_ids[i * columns + column];
1669 BrowserAccessibilityWin* cell = 1669 BrowserAccessibilityWin* cell =
1670 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); 1670 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin();
1671 if (cell && cell->role_ == WebKit::WebAXRoleColumnHeader) 1671 if (cell && cell->role_ == blink::WebAXRoleColumnHeader)
1672 (*n_column_header_cells)++; 1672 (*n_column_header_cells)++;
1673 } 1673 }
1674 1674
1675 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( 1675 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc(
1676 (*n_column_header_cells) * sizeof(cell_accessibles[0]))); 1676 (*n_column_header_cells) * sizeof(cell_accessibles[0])));
1677 int index = 0; 1677 int index = 0;
1678 for (int i = 0; i < rows; ++i) { 1678 for (int i = 0; i < rows; ++i) {
1679 int cell_id = cell_ids[i * columns + column]; 1679 int cell_id = cell_ids[i * columns + column];
1680 BrowserAccessibilityWin* cell = 1680 BrowserAccessibilityWin* cell =
1681 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); 1681 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin();
1682 if (cell && cell->role_ == WebKit::WebAXRoleColumnHeader) { 1682 if (cell && cell->role_ == blink::WebAXRoleColumnHeader) {
1683 (*cell_accessibles)[index] = 1683 (*cell_accessibles)[index] =
1684 static_cast<IAccessible*>(cell->NewReference()); 1684 static_cast<IAccessible*>(cell->NewReference());
1685 ++index; 1685 ++index;
1686 } 1686 }
1687 } 1687 }
1688 1688
1689 return S_OK; 1689 return S_OK;
1690 } 1690 }
1691 1691
1692 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long* column_index) { 1692 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long* column_index) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 1735
1736 *n_row_header_cells = 0; 1736 *n_row_header_cells = 0;
1737 1737
1738 int row; 1738 int row;
1739 if (!GetIntAttribute( 1739 if (!GetIntAttribute(
1740 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &row)) { 1740 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &row)) {
1741 return S_FALSE; 1741 return S_FALSE;
1742 } 1742 }
1743 1743
1744 BrowserAccessibility* table = parent(); 1744 BrowserAccessibility* table = parent();
1745 while (table && table->role() != WebKit::WebAXRoleTable) 1745 while (table && table->role() != blink::WebAXRoleTable)
1746 table = table->parent(); 1746 table = table->parent();
1747 if (!table) { 1747 if (!table) {
1748 NOTREACHED(); 1748 NOTREACHED();
1749 return S_FALSE; 1749 return S_FALSE;
1750 } 1750 }
1751 1751
1752 int columns; 1752 int columns;
1753 int rows; 1753 int rows;
1754 if (!table->GetIntAttribute( 1754 if (!table->GetIntAttribute(
1755 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || 1755 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) ||
1756 !table->GetIntAttribute( 1756 !table->GetIntAttribute(
1757 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows)) { 1757 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows)) {
1758 return S_FALSE; 1758 return S_FALSE;
1759 } 1759 }
1760 if (columns <= 0 || rows <= 0 || row < 0 || row >= rows) 1760 if (columns <= 0 || rows <= 0 || row < 0 || row >= rows)
1761 return S_FALSE; 1761 return S_FALSE;
1762 1762
1763 const std::vector<int32>& cell_ids = table->GetIntListAttribute( 1763 const std::vector<int32>& cell_ids = table->GetIntListAttribute(
1764 AccessibilityNodeData::ATTR_CELL_IDS); 1764 AccessibilityNodeData::ATTR_CELL_IDS);
1765 1765
1766 for (int i = 0; i < columns; ++i) { 1766 for (int i = 0; i < columns; ++i) {
1767 int cell_id = cell_ids[row * columns + i]; 1767 int cell_id = cell_ids[row * columns + i];
1768 BrowserAccessibilityWin* cell = 1768 BrowserAccessibilityWin* cell =
1769 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); 1769 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin();
1770 if (cell && cell->role_ == WebKit::WebAXRoleRowHeader) 1770 if (cell && cell->role_ == blink::WebAXRoleRowHeader)
1771 (*n_row_header_cells)++; 1771 (*n_row_header_cells)++;
1772 } 1772 }
1773 1773
1774 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( 1774 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc(
1775 (*n_row_header_cells) * sizeof(cell_accessibles[0]))); 1775 (*n_row_header_cells) * sizeof(cell_accessibles[0])));
1776 int index = 0; 1776 int index = 0;
1777 for (int i = 0; i < columns; ++i) { 1777 for (int i = 0; i < columns; ++i) {
1778 int cell_id = cell_ids[row * columns + i]; 1778 int cell_id = cell_ids[row * columns + i];
1779 BrowserAccessibilityWin* cell = 1779 BrowserAccessibilityWin* cell =
1780 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); 1780 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin();
1781 if (cell && cell->role_ == WebKit::WebAXRoleRowHeader) { 1781 if (cell && cell->role_ == blink::WebAXRoleRowHeader) {
1782 (*cell_accessibles)[index] = 1782 (*cell_accessibles)[index] =
1783 static_cast<IAccessible*>(cell->NewReference()); 1783 static_cast<IAccessible*>(cell->NewReference());
1784 ++index; 1784 ++index;
1785 } 1785 }
1786 } 1786 }
1787 1787
1788 return S_OK; 1788 return S_OK;
1789 } 1789 }
1790 1790
1791 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long* row_index) { 1791 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long* row_index) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 if (!table) 1860 if (!table)
1861 return E_INVALIDARG; 1861 return E_INVALIDARG;
1862 1862
1863 1863
1864 int row; 1864 int row;
1865 int column; 1865 int column;
1866 GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &row); 1866 GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &row);
1867 GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &column); 1867 GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &column);
1868 1868
1869 BrowserAccessibility* find_table = parent(); 1869 BrowserAccessibility* find_table = parent();
1870 while (find_table && find_table->role() != WebKit::WebAXRoleTable) 1870 while (find_table && find_table->role() != blink::WebAXRoleTable)
1871 find_table = find_table->parent(); 1871 find_table = find_table->parent();
1872 if (!find_table) { 1872 if (!find_table) {
1873 NOTREACHED(); 1873 NOTREACHED();
1874 return S_FALSE; 1874 return S_FALSE;
1875 } 1875 }
1876 1876
1877 *table = static_cast<IAccessibleTable*>( 1877 *table = static_cast<IAccessibleTable*>(
1878 find_table->ToBrowserAccessibilityWin()->NewReference()); 1878 find_table->ToBrowserAccessibilityWin()->NewReference());
1879 1879
1880 return S_OK; 1880 return S_OK;
(...skipping 15 matching lines...) Expand all
1896 } 1896 }
1897 1897
1898 STDMETHODIMP BrowserAccessibilityWin::get_caretOffset(LONG* offset) { 1898 STDMETHODIMP BrowserAccessibilityWin::get_caretOffset(LONG* offset) {
1899 if (!instance_active_) 1899 if (!instance_active_)
1900 return E_FAIL; 1900 return E_FAIL;
1901 1901
1902 if (!offset) 1902 if (!offset)
1903 return E_INVALIDARG; 1903 return E_INVALIDARG;
1904 1904
1905 *offset = 0; 1905 *offset = 0;
1906 if (role_ == WebKit::WebAXRoleTextField || 1906 if (role_ == blink::WebAXRoleTextField ||
1907 role_ == WebKit::WebAXRoleTextArea) { 1907 role_ == blink::WebAXRoleTextArea) {
1908 int sel_start = 0; 1908 int sel_start = 0;
1909 if (GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_START, 1909 if (GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_START,
1910 &sel_start)) 1910 &sel_start))
1911 *offset = sel_start; 1911 *offset = sel_start;
1912 } 1912 }
1913 1913
1914 return S_OK; 1914 return S_OK;
1915 } 1915 }
1916 1916
1917 STDMETHODIMP BrowserAccessibilityWin::get_nSelections(LONG* n_selections) { 1917 STDMETHODIMP BrowserAccessibilityWin::get_nSelections(LONG* n_selections) {
1918 if (!instance_active_) 1918 if (!instance_active_)
1919 return E_FAIL; 1919 return E_FAIL;
1920 1920
1921 if (!n_selections) 1921 if (!n_selections)
1922 return E_INVALIDARG; 1922 return E_INVALIDARG;
1923 1923
1924 *n_selections = 0; 1924 *n_selections = 0;
1925 if (role_ == WebKit::WebAXRoleTextField || 1925 if (role_ == blink::WebAXRoleTextField ||
1926 role_ == WebKit::WebAXRoleTextArea) { 1926 role_ == blink::WebAXRoleTextArea) {
1927 int sel_start = 0; 1927 int sel_start = 0;
1928 int sel_end = 0; 1928 int sel_end = 0;
1929 if (GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_START, 1929 if (GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_START,
1930 &sel_start) && 1930 &sel_start) &&
1931 GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_END, &sel_end) && 1931 GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_END, &sel_end) &&
1932 sel_start != sel_end) 1932 sel_start != sel_end)
1933 *n_selections = 1; 1933 *n_selections = 1;
1934 } 1934 }
1935 1935
1936 return S_OK; 1936 return S_OK;
1937 } 1937 }
1938 1938
1939 STDMETHODIMP BrowserAccessibilityWin::get_selection(LONG selection_index, 1939 STDMETHODIMP BrowserAccessibilityWin::get_selection(LONG selection_index,
1940 LONG* start_offset, 1940 LONG* start_offset,
1941 LONG* end_offset) { 1941 LONG* end_offset) {
1942 if (!instance_active_) 1942 if (!instance_active_)
1943 return E_FAIL; 1943 return E_FAIL;
1944 1944
1945 if (!start_offset || !end_offset || selection_index != 0) 1945 if (!start_offset || !end_offset || selection_index != 0)
1946 return E_INVALIDARG; 1946 return E_INVALIDARG;
1947 1947
1948 *start_offset = 0; 1948 *start_offset = 0;
1949 *end_offset = 0; 1949 *end_offset = 0;
1950 if (role_ == WebKit::WebAXRoleTextField || 1950 if (role_ == blink::WebAXRoleTextField ||
1951 role_ == WebKit::WebAXRoleTextArea) { 1951 role_ == blink::WebAXRoleTextArea) {
1952 int sel_start = 0; 1952 int sel_start = 0;
1953 int sel_end = 0; 1953 int sel_end = 0;
1954 if (GetIntAttribute( 1954 if (GetIntAttribute(
1955 AccessibilityNodeData::ATTR_TEXT_SEL_START, &sel_start) && 1955 AccessibilityNodeData::ATTR_TEXT_SEL_START, &sel_start) &&
1956 GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_END, &sel_end)) { 1956 GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_END, &sel_end)) {
1957 *start_offset = sel_start; 1957 *start_offset = sel_start;
1958 *end_offset = sel_end; 1958 *end_offset = sel_end;
1959 } 1959 }
1960 } 1960 }
1961 1961
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
2794 2794
2795 // Expose the "display" and "tag" attributes. 2795 // Expose the "display" and "tag" attributes.
2796 StringAttributeToIA2(AccessibilityNodeData::ATTR_DISPLAY, "display"); 2796 StringAttributeToIA2(AccessibilityNodeData::ATTR_DISPLAY, "display");
2797 StringAttributeToIA2(AccessibilityNodeData::ATTR_HTML_TAG, "tag"); 2797 StringAttributeToIA2(AccessibilityNodeData::ATTR_HTML_TAG, "tag");
2798 StringAttributeToIA2(AccessibilityNodeData::ATTR_ROLE, "xml-roles"); 2798 StringAttributeToIA2(AccessibilityNodeData::ATTR_ROLE, "xml-roles");
2799 2799
2800 // Expose "level" attribute for headings, trees, etc. 2800 // Expose "level" attribute for headings, trees, etc.
2801 IntAttributeToIA2(AccessibilityNodeData::ATTR_HIERARCHICAL_LEVEL, "level"); 2801 IntAttributeToIA2(AccessibilityNodeData::ATTR_HIERARCHICAL_LEVEL, "level");
2802 2802
2803 // Expose the set size and position in set for listbox options. 2803 // Expose the set size and position in set for listbox options.
2804 if (role_ == WebKit::WebAXRoleListBoxOption && 2804 if (role_ == blink::WebAXRoleListBoxOption &&
2805 parent_ && 2805 parent_ &&
2806 parent_->role() == WebKit::WebAXRoleListBox) { 2806 parent_->role() == blink::WebAXRoleListBox) {
2807 ia2_attributes_.push_back( 2807 ia2_attributes_.push_back(
2808 L"setsize:" + base::IntToString16(parent_->PlatformChildCount())); 2808 L"setsize:" + base::IntToString16(parent_->PlatformChildCount()));
2809 ia2_attributes_.push_back( 2809 ia2_attributes_.push_back(
2810 L"setsize:" + base::IntToString16(index_in_parent_ + 1)); 2810 L"setsize:" + base::IntToString16(index_in_parent_ + 1));
2811 } 2811 }
2812 2812
2813 if (ia_role_ == ROLE_SYSTEM_CHECKBUTTON || 2813 if (ia_role_ == ROLE_SYSTEM_CHECKBUTTON ||
2814 ia_role_ == ROLE_SYSTEM_RADIOBUTTON || 2814 ia_role_ == ROLE_SYSTEM_RADIOBUTTON ||
2815 ia2_role_ == IA2_ROLE_TOGGLE_BUTTON) { 2815 ia2_role_ == IA2_ROLE_TOGGLE_BUTTON) {
2816 ia2_attributes_.push_back(L"checkable:true"); 2816 ia2_attributes_.push_back(L"checkable:true");
(...skipping 18 matching lines...) Expand all
2835 // Expose slider value. 2835 // Expose slider value.
2836 if (ia_role_ == ROLE_SYSTEM_PROGRESSBAR || 2836 if (ia_role_ == ROLE_SYSTEM_PROGRESSBAR ||
2837 ia_role_ == ROLE_SYSTEM_SCROLLBAR || 2837 ia_role_ == ROLE_SYSTEM_SCROLLBAR ||
2838 ia_role_ == ROLE_SYSTEM_SLIDER) { 2838 ia_role_ == ROLE_SYSTEM_SLIDER) {
2839 ia2_attributes_.push_back(L"valuetext:" + GetValueText()); 2839 ia2_attributes_.push_back(L"valuetext:" + GetValueText());
2840 } 2840 }
2841 2841
2842 // Expose table cell index. 2842 // Expose table cell index.
2843 if (ia_role_ == ROLE_SYSTEM_CELL) { 2843 if (ia_role_ == ROLE_SYSTEM_CELL) {
2844 BrowserAccessibility* table = parent(); 2844 BrowserAccessibility* table = parent();
2845 while (table && table->role() != WebKit::WebAXRoleTable) 2845 while (table && table->role() != blink::WebAXRoleTable)
2846 table = table->parent(); 2846 table = table->parent();
2847 if (table) { 2847 if (table) {
2848 const std::vector<int32>& unique_cell_ids = table->GetIntListAttribute( 2848 const std::vector<int32>& unique_cell_ids = table->GetIntListAttribute(
2849 AccessibilityNodeData::ATTR_UNIQUE_CELL_IDS); 2849 AccessibilityNodeData::ATTR_UNIQUE_CELL_IDS);
2850 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { 2850 for (size_t i = 0; i < unique_cell_ids.size(); ++i) {
2851 if (unique_cell_ids[i] == renderer_id_) { 2851 if (unique_cell_ids[i] == renderer_id_) {
2852 ia2_attributes_.push_back( 2852 ia2_attributes_.push_back(
2853 string16(L"table-cell-index:") + base::IntToString16(i)); 2853 string16(L"table-cell-index:") + base::IntToString16(i));
2854 } 2854 }
2855 } 2855 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2905 description = help; 2905 description = help;
2906 help.clear(); 2906 help.clear();
2907 } 2907 }
2908 if (!description.empty() && name_.empty() && !title_elem_id) { 2908 if (!description.empty() && name_.empty() && !title_elem_id) {
2909 name_ = description; 2909 name_ = description;
2910 description.clear(); 2910 description.clear();
2911 } 2911 }
2912 2912
2913 // If it's a text field, also consider the placeholder. 2913 // If it's a text field, also consider the placeholder.
2914 std::string placeholder; 2914 std::string placeholder;
2915 if (role_ == WebKit::WebAXRoleTextField && 2915 if (role_ == blink::WebAXRoleTextField &&
2916 HasState(WebKit::WebAXStateFocusable) && 2916 HasState(blink::WebAXStateFocusable) &&
2917 GetHtmlAttribute("placeholder", &placeholder)) { 2917 GetHtmlAttribute("placeholder", &placeholder)) {
2918 if (name_.empty() && !title_elem_id) { 2918 if (name_.empty() && !title_elem_id) {
2919 name_ = placeholder; 2919 name_ = placeholder;
2920 } else if (description.empty()) { 2920 } else if (description.empty()) {
2921 description = placeholder; 2921 description = placeholder;
2922 } 2922 }
2923 } 2923 }
2924 2924
2925 SetStringAttribute(AccessibilityNodeData::ATTR_DESCRIPTION, description); 2925 SetStringAttribute(AccessibilityNodeData::ATTR_DESCRIPTION, description);
2926 SetStringAttribute(AccessibilityNodeData::ATTR_HELP, help); 2926 SetStringAttribute(AccessibilityNodeData::ATTR_HELP, help);
2927 2927
2928 // On Windows, the value of a document should be its url. 2928 // On Windows, the value of a document should be its url.
2929 if (role_ == WebKit::WebAXRoleRootWebArea || 2929 if (role_ == blink::WebAXRoleRootWebArea ||
2930 role_ == WebKit::WebAXRoleWebArea) { 2930 role_ == blink::WebAXRoleWebArea) {
2931 GetStringAttribute(AccessibilityNodeData::ATTR_DOC_URL, &value_); 2931 GetStringAttribute(AccessibilityNodeData::ATTR_DOC_URL, &value_);
2932 } 2932 }
2933 2933
2934 // For certain roles (listbox option, static text, and list marker) 2934 // For certain roles (listbox option, static text, and list marker)
2935 // WebKit stores the main accessible text in the "value" - swap it so 2935 // WebKit stores the main accessible text in the "value" - swap it so
2936 // that it's the "name". 2936 // that it's the "name".
2937 if (name_.empty() && 2937 if (name_.empty() &&
2938 (role_ == WebKit::WebAXRoleListBoxOption || 2938 (role_ == blink::WebAXRoleListBoxOption ||
2939 role_ == WebKit::WebAXRoleStaticText || 2939 role_ == blink::WebAXRoleStaticText ||
2940 role_ == WebKit::WebAXRoleListMarker)) { 2940 role_ == blink::WebAXRoleListMarker)) {
2941 name_.swap(value_); 2941 name_.swap(value_);
2942 } 2942 }
2943 2943
2944 // If this doesn't have a value and is linked then set its value to the url 2944 // If this doesn't have a value and is linked then set its value to the url
2945 // attribute. This allows screen readers to read an empty link's destination. 2945 // attribute. This allows screen readers to read an empty link's destination.
2946 if (value_.empty() && (ia_state_ & STATE_SYSTEM_LINKED)) 2946 if (value_.empty() && (ia_state_ & STATE_SYSTEM_LINKED))
2947 GetStringAttribute(AccessibilityNodeData::ATTR_URL, &value_); 2947 GetStringAttribute(AccessibilityNodeData::ATTR_URL, &value_);
2948 2948
2949 // Clear any old relationships between this node and other nodes. 2949 // Clear any old relationships between this node and other nodes.
2950 for (size_t i = 0; i < relations_.size(); ++i) 2950 for (size_t i = 0; i < relations_.size(); ++i)
(...skipping 16 matching lines...) Expand all
2967 2967
2968 void BrowserAccessibilityWin::PostInitialize() { 2968 void BrowserAccessibilityWin::PostInitialize() {
2969 BrowserAccessibility::PostInitialize(); 2969 BrowserAccessibility::PostInitialize();
2970 2970
2971 // Construct the hypertext for this node. 2971 // Construct the hypertext for this node.
2972 hyperlink_offset_to_index_.clear(); 2972 hyperlink_offset_to_index_.clear();
2973 hyperlinks_.clear(); 2973 hyperlinks_.clear();
2974 hypertext_.clear(); 2974 hypertext_.clear();
2975 for (unsigned int i = 0; i < PlatformChildCount(); ++i) { 2975 for (unsigned int i = 0; i < PlatformChildCount(); ++i) {
2976 BrowserAccessibility* child = PlatformGetChild(i); 2976 BrowserAccessibility* child = PlatformGetChild(i);
2977 if (child->role() == WebKit::WebAXRoleStaticText) { 2977 if (child->role() == blink::WebAXRoleStaticText) {
2978 hypertext_ += UTF8ToUTF16(child->name()); 2978 hypertext_ += UTF8ToUTF16(child->name());
2979 } else { 2979 } else {
2980 hyperlink_offset_to_index_[hypertext_.size()] = hyperlinks_.size(); 2980 hyperlink_offset_to_index_[hypertext_.size()] = hyperlinks_.size();
2981 hypertext_ += kEmbeddedCharacter; 2981 hypertext_ += kEmbeddedCharacter;
2982 hyperlinks_.push_back(i); 2982 hyperlinks_.push_back(i);
2983 } 2983 }
2984 } 2984 }
2985 DCHECK_EQ(hyperlink_offset_to_index_.size(), hyperlinks_.size()); 2985 DCHECK_EQ(hyperlink_offset_to_index_.size(), hyperlinks_.size());
2986 2986
2987 // Fire an event when an alert first appears. 2987 // Fire an event when an alert first appears.
2988 if (role_ == WebKit::WebAXRoleAlert && first_time_) 2988 if (role_ == blink::WebAXRoleAlert && first_time_)
2989 manager_->NotifyAccessibilityEvent(WebKit::WebAXEventAlert, this); 2989 manager_->NotifyAccessibilityEvent(blink::WebAXEventAlert, this);
2990 2990
2991 // Fire events if text has changed. 2991 // Fire events if text has changed.
2992 string16 text = TextForIAccessibleText(); 2992 string16 text = TextForIAccessibleText();
2993 if (previous_text_ != text) { 2993 if (previous_text_ != text) {
2994 if (!previous_text_.empty() && !text.empty()) { 2994 if (!previous_text_.empty() && !text.empty()) {
2995 manager_->NotifyAccessibilityEvent( 2995 manager_->NotifyAccessibilityEvent(
2996 WebKit::WebAXEventShow, this); 2996 blink::WebAXEventShow, this);
2997 } 2997 }
2998 2998
2999 // TODO(dmazzoni): Look into HIDE events, too. 2999 // TODO(dmazzoni): Look into HIDE events, too.
3000 3000
3001 old_text_ = previous_text_; 3001 old_text_ = previous_text_;
3002 previous_text_ = text; 3002 previous_text_ = text;
3003 } 3003 }
3004 3004
3005 // Fire events if the state has changed. 3005 // Fire events if the state has changed.
3006 if (!first_time_ && ia_state_ != old_ia_state_) { 3006 if (!first_time_ && ia_state_ != old_ia_state_) {
3007 BrowserAccessibilityManagerWin* manager = 3007 BrowserAccessibilityManagerWin* manager =
3008 manager_->ToBrowserAccessibilityManagerWin(); 3008 manager_->ToBrowserAccessibilityManagerWin();
3009 3009
3010 // Normally focus events are handled elsewhere, however 3010 // Normally focus events are handled elsewhere, however
3011 // focus for managed descendants is platform-specific. 3011 // focus for managed descendants is platform-specific.
3012 // Fire a focus event if the focused descendant in a multi-select 3012 // Fire a focus event if the focused descendant in a multi-select
3013 // list box changes. 3013 // list box changes.
3014 if (role_ == WebKit::WebAXRoleListBoxOption && 3014 if (role_ == blink::WebAXRoleListBoxOption &&
3015 (ia_state_ & STATE_SYSTEM_FOCUSABLE) && 3015 (ia_state_ & STATE_SYSTEM_FOCUSABLE) &&
3016 (ia_state_ & STATE_SYSTEM_SELECTABLE) && 3016 (ia_state_ & STATE_SYSTEM_SELECTABLE) &&
3017 (ia_state_ & STATE_SYSTEM_FOCUSED) && 3017 (ia_state_ & STATE_SYSTEM_FOCUSED) &&
3018 !(old_ia_state_ & STATE_SYSTEM_FOCUSED)) { 3018 !(old_ia_state_ & STATE_SYSTEM_FOCUSED)) {
3019 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_FOCUS, unique_id_win()); 3019 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_FOCUS, unique_id_win());
3020 } 3020 }
3021 3021
3022 if ((ia_state_ & STATE_SYSTEM_SELECTED) && 3022 if ((ia_state_ & STATE_SYSTEM_SELECTED) &&
3023 !(old_ia_state_ & STATE_SYSTEM_SELECTED)) { 3023 !(old_ia_state_ & STATE_SYSTEM_SELECTED)) {
3024 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_SELECTIONADD, 3024 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_SELECTIONADD,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
3125 if (value.empty() && 3125 if (value.empty() &&
3126 GetFloatAttribute(AccessibilityNodeData::ATTR_VALUE_FOR_RANGE, &fval)) { 3126 GetFloatAttribute(AccessibilityNodeData::ATTR_VALUE_FOR_RANGE, &fval)) {
3127 value = UTF8ToUTF16(base::DoubleToString(fval)); 3127 value = UTF8ToUTF16(base::DoubleToString(fval));
3128 } 3128 }
3129 return value; 3129 return value;
3130 } 3130 }
3131 3131
3132 string16 BrowserAccessibilityWin::TextForIAccessibleText() { 3132 string16 BrowserAccessibilityWin::TextForIAccessibleText() {
3133 if (IsEditableText()) 3133 if (IsEditableText())
3134 return UTF8ToUTF16(value_); 3134 return UTF8ToUTF16(value_);
3135 return (role_ == WebKit::WebAXRoleStaticText) ? 3135 return (role_ == blink::WebAXRoleStaticText) ?
3136 UTF8ToUTF16(name_) : hypertext_; 3136 UTF8ToUTF16(name_) : hypertext_;
3137 } 3137 }
3138 3138
3139 void BrowserAccessibilityWin::HandleSpecialTextOffset(const string16& text, 3139 void BrowserAccessibilityWin::HandleSpecialTextOffset(const string16& text,
3140 LONG* offset) { 3140 LONG* offset) {
3141 if (*offset == IA2_TEXT_OFFSET_LENGTH) 3141 if (*offset == IA2_TEXT_OFFSET_LENGTH)
3142 *offset = static_cast<LONG>(text.size()); 3142 *offset = static_cast<LONG>(text.size());
3143 else if (*offset == IA2_TEXT_OFFSET_CARET) 3143 else if (*offset == IA2_TEXT_OFFSET_CARET)
3144 get_caretOffset(offset); 3144 get_caretOffset(offset);
3145 } 3145 }
(...skipping 29 matching lines...) Expand all
3175 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromRendererID( 3175 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromRendererID(
3176 int32 renderer_id) { 3176 int32 renderer_id) {
3177 return manager_->GetFromRendererID(renderer_id)->ToBrowserAccessibilityWin(); 3177 return manager_->GetFromRendererID(renderer_id)->ToBrowserAccessibilityWin();
3178 } 3178 }
3179 3179
3180 void BrowserAccessibilityWin::InitRoleAndState() { 3180 void BrowserAccessibilityWin::InitRoleAndState() {
3181 ia_state_ = 0; 3181 ia_state_ = 0;
3182 ia2_state_ = IA2_STATE_OPAQUE; 3182 ia2_state_ = IA2_STATE_OPAQUE;
3183 ia2_attributes_.clear(); 3183 ia2_attributes_.clear();
3184 3184
3185 if (HasState(WebKit::WebAXStateBusy)) 3185 if (HasState(blink::WebAXStateBusy))
3186 ia_state_ |= STATE_SYSTEM_BUSY; 3186 ia_state_ |= STATE_SYSTEM_BUSY;
3187 if (HasState(WebKit::WebAXStateChecked)) 3187 if (HasState(blink::WebAXStateChecked))
3188 ia_state_ |= STATE_SYSTEM_CHECKED; 3188 ia_state_ |= STATE_SYSTEM_CHECKED;
3189 if (HasState(WebKit::WebAXStateCollapsed)) 3189 if (HasState(blink::WebAXStateCollapsed))
3190 ia_state_ |= STATE_SYSTEM_COLLAPSED; 3190 ia_state_ |= STATE_SYSTEM_COLLAPSED;
3191 if (HasState(WebKit::WebAXStateExpanded)) 3191 if (HasState(blink::WebAXStateExpanded))
3192 ia_state_ |= STATE_SYSTEM_EXPANDED; 3192 ia_state_ |= STATE_SYSTEM_EXPANDED;
3193 if (HasState(WebKit::WebAXStateFocusable)) 3193 if (HasState(blink::WebAXStateFocusable))
3194 ia_state_ |= STATE_SYSTEM_FOCUSABLE; 3194 ia_state_ |= STATE_SYSTEM_FOCUSABLE;
3195 if (HasState(WebKit::WebAXStateHaspopup)) 3195 if (HasState(blink::WebAXStateHaspopup))
3196 ia_state_ |= STATE_SYSTEM_HASPOPUP; 3196 ia_state_ |= STATE_SYSTEM_HASPOPUP;
3197 if (HasState(WebKit::WebAXStateHovered)) 3197 if (HasState(blink::WebAXStateHovered))
3198 ia_state_ |= STATE_SYSTEM_HOTTRACKED; 3198 ia_state_ |= STATE_SYSTEM_HOTTRACKED;
3199 if (HasState(WebKit::WebAXStateIndeterminate)) 3199 if (HasState(blink::WebAXStateIndeterminate))
3200 ia_state_ |= STATE_SYSTEM_INDETERMINATE; 3200 ia_state_ |= STATE_SYSTEM_INDETERMINATE;
3201 if (HasState(WebKit::WebAXStateInvisible)) 3201 if (HasState(blink::WebAXStateInvisible))
3202 ia_state_ |= STATE_SYSTEM_INVISIBLE; 3202 ia_state_ |= STATE_SYSTEM_INVISIBLE;
3203 if (HasState(WebKit::WebAXStateLinked)) 3203 if (HasState(blink::WebAXStateLinked))
3204 ia_state_ |= STATE_SYSTEM_LINKED; 3204 ia_state_ |= STATE_SYSTEM_LINKED;
3205 if (HasState(WebKit::WebAXStateMultiselectable)) { 3205 if (HasState(blink::WebAXStateMultiselectable)) {
3206 ia_state_ |= STATE_SYSTEM_EXTSELECTABLE; 3206 ia_state_ |= STATE_SYSTEM_EXTSELECTABLE;
3207 ia_state_ |= STATE_SYSTEM_MULTISELECTABLE; 3207 ia_state_ |= STATE_SYSTEM_MULTISELECTABLE;
3208 } 3208 }
3209 // TODO(ctguil): Support STATE_SYSTEM_EXTSELECTABLE/accSelect. 3209 // TODO(ctguil): Support STATE_SYSTEM_EXTSELECTABLE/accSelect.
3210 if (HasState(WebKit::WebAXStateOffscreen)) 3210 if (HasState(blink::WebAXStateOffscreen))
3211 ia_state_ |= STATE_SYSTEM_OFFSCREEN; 3211 ia_state_ |= STATE_SYSTEM_OFFSCREEN;
3212 if (HasState(WebKit::WebAXStatePressed)) 3212 if (HasState(blink::WebAXStatePressed))
3213 ia_state_ |= STATE_SYSTEM_PRESSED; 3213 ia_state_ |= STATE_SYSTEM_PRESSED;
3214 if (HasState(WebKit::WebAXStateProtected)) 3214 if (HasState(blink::WebAXStateProtected))
3215 ia_state_ |= STATE_SYSTEM_PROTECTED; 3215 ia_state_ |= STATE_SYSTEM_PROTECTED;
3216 if (HasState(WebKit::WebAXStateRequired)) 3216 if (HasState(blink::WebAXStateRequired))
3217 ia2_state_ |= IA2_STATE_REQUIRED; 3217 ia2_state_ |= IA2_STATE_REQUIRED;
3218 if (HasState(WebKit::WebAXStateSelectable)) 3218 if (HasState(blink::WebAXStateSelectable))
3219 ia_state_ |= STATE_SYSTEM_SELECTABLE; 3219 ia_state_ |= STATE_SYSTEM_SELECTABLE;
3220 if (HasState(WebKit::WebAXStateSelected)) 3220 if (HasState(blink::WebAXStateSelected))
3221 ia_state_ |= STATE_SYSTEM_SELECTED; 3221 ia_state_ |= STATE_SYSTEM_SELECTED;
3222 if (HasState(WebKit::WebAXStateVisited)) 3222 if (HasState(blink::WebAXStateVisited))
3223 ia_state_ |= STATE_SYSTEM_TRAVERSED; 3223 ia_state_ |= STATE_SYSTEM_TRAVERSED;
3224 if (!HasState(WebKit::WebAXStateEnabled)) 3224 if (!HasState(blink::WebAXStateEnabled))
3225 ia_state_ |= STATE_SYSTEM_UNAVAILABLE; 3225 ia_state_ |= STATE_SYSTEM_UNAVAILABLE;
3226 if (HasState(WebKit::WebAXStateVertical)) { 3226 if (HasState(blink::WebAXStateVertical)) {
3227 ia2_state_ |= IA2_STATE_VERTICAL; 3227 ia2_state_ |= IA2_STATE_VERTICAL;
3228 } else { 3228 } else {
3229 ia2_state_ |= IA2_STATE_HORIZONTAL; 3229 ia2_state_ |= IA2_STATE_HORIZONTAL;
3230 } 3230 }
3231 if (HasState(WebKit::WebAXStateVisited)) 3231 if (HasState(blink::WebAXStateVisited))
3232 ia_state_ |= STATE_SYSTEM_TRAVERSED; 3232 ia_state_ |= STATE_SYSTEM_TRAVERSED;
3233 3233
3234 // WebKit marks everything as readonly unless it's editable text, so if it's 3234 // WebKit marks everything as readonly unless it's editable text, so if it's
3235 // not readonly, mark it as editable now. The final computation of the 3235 // not readonly, mark it as editable now. The final computation of the
3236 // READONLY state for MSAA is below, after the switch. 3236 // READONLY state for MSAA is below, after the switch.
3237 if (!HasState(WebKit::WebAXStateReadonly)) 3237 if (!HasState(blink::WebAXStateReadonly))
3238 ia2_state_ |= IA2_STATE_EDITABLE; 3238 ia2_state_ |= IA2_STATE_EDITABLE;
3239 3239
3240 string16 invalid; 3240 string16 invalid;
3241 if (GetHtmlAttribute("aria-invalid", &invalid)) 3241 if (GetHtmlAttribute("aria-invalid", &invalid))
3242 ia2_state_ |= IA2_STATE_INVALID_ENTRY; 3242 ia2_state_ |= IA2_STATE_INVALID_ENTRY;
3243 3243
3244 if (GetBoolAttribute(AccessibilityNodeData::ATTR_BUTTON_MIXED)) 3244 if (GetBoolAttribute(AccessibilityNodeData::ATTR_BUTTON_MIXED))
3245 ia_state_ |= STATE_SYSTEM_MIXED; 3245 ia_state_ |= STATE_SYSTEM_MIXED;
3246 3246
3247 if (GetBoolAttribute(AccessibilityNodeData::ATTR_CAN_SET_VALUE)) 3247 if (GetBoolAttribute(AccessibilityNodeData::ATTR_CAN_SET_VALUE))
3248 ia2_state_ |= IA2_STATE_EDITABLE; 3248 ia2_state_ |= IA2_STATE_EDITABLE;
3249 3249
3250 string16 html_tag = GetString16Attribute( 3250 string16 html_tag = GetString16Attribute(
3251 AccessibilityNodeData::ATTR_HTML_TAG); 3251 AccessibilityNodeData::ATTR_HTML_TAG);
3252 ia_role_ = 0; 3252 ia_role_ = 0;
3253 ia2_role_ = 0; 3253 ia2_role_ = 0;
3254 switch (role_) { 3254 switch (role_) {
3255 case WebKit::WebAXRoleAlert: 3255 case blink::WebAXRoleAlert:
3256 ia_role_ = ROLE_SYSTEM_ALERT; 3256 ia_role_ = ROLE_SYSTEM_ALERT;
3257 break; 3257 break;
3258 case WebKit::WebAXRoleAlertDialog: 3258 case blink::WebAXRoleAlertDialog:
3259 ia_role_ = ROLE_SYSTEM_DIALOG; 3259 ia_role_ = ROLE_SYSTEM_DIALOG;
3260 break; 3260 break;
3261 case WebKit::WebAXRoleApplication: 3261 case blink::WebAXRoleApplication:
3262 ia_role_ = ROLE_SYSTEM_APPLICATION; 3262 ia_role_ = ROLE_SYSTEM_APPLICATION;
3263 break; 3263 break;
3264 case WebKit::WebAXRoleArticle: 3264 case blink::WebAXRoleArticle:
3265 ia_role_ = ROLE_SYSTEM_GROUPING; 3265 ia_role_ = ROLE_SYSTEM_GROUPING;
3266 ia2_role_ = IA2_ROLE_SECTION; 3266 ia2_role_ = IA2_ROLE_SECTION;
3267 ia_state_ |= STATE_SYSTEM_READONLY; 3267 ia_state_ |= STATE_SYSTEM_READONLY;
3268 break; 3268 break;
3269 case WebKit::WebAXRoleBusyIndicator: 3269 case blink::WebAXRoleBusyIndicator:
3270 ia_role_ = ROLE_SYSTEM_ANIMATION; 3270 ia_role_ = ROLE_SYSTEM_ANIMATION;
3271 ia_state_ |= STATE_SYSTEM_READONLY; 3271 ia_state_ |= STATE_SYSTEM_READONLY;
3272 break; 3272 break;
3273 case WebKit::WebAXRoleButton: 3273 case blink::WebAXRoleButton:
3274 ia_role_ = ROLE_SYSTEM_PUSHBUTTON; 3274 ia_role_ = ROLE_SYSTEM_PUSHBUTTON;
3275 bool is_aria_pressed_defined; 3275 bool is_aria_pressed_defined;
3276 bool is_mixed; 3276 bool is_mixed;
3277 if (GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed)) 3277 if (GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed))
3278 ia_state_ |= STATE_SYSTEM_PRESSED; 3278 ia_state_ |= STATE_SYSTEM_PRESSED;
3279 if (is_aria_pressed_defined) 3279 if (is_aria_pressed_defined)
3280 ia2_role_ = IA2_ROLE_TOGGLE_BUTTON; 3280 ia2_role_ = IA2_ROLE_TOGGLE_BUTTON;
3281 if (is_mixed) 3281 if (is_mixed)
3282 ia_state_ |= STATE_SYSTEM_MIXED; 3282 ia_state_ |= STATE_SYSTEM_MIXED;
3283 break; 3283 break;
3284 case WebKit::WebAXRoleCanvas: 3284 case blink::WebAXRoleCanvas:
3285 if (GetBoolAttribute(AccessibilityNodeData::ATTR_CANVAS_HAS_FALLBACK)) { 3285 if (GetBoolAttribute(AccessibilityNodeData::ATTR_CANVAS_HAS_FALLBACK)) {
3286 role_name_ = L"canvas"; 3286 role_name_ = L"canvas";
3287 ia2_role_ = IA2_ROLE_CANVAS; 3287 ia2_role_ = IA2_ROLE_CANVAS;
3288 } else { 3288 } else {
3289 ia_role_ = ROLE_SYSTEM_GRAPHIC; 3289 ia_role_ = ROLE_SYSTEM_GRAPHIC;
3290 } 3290 }
3291 break; 3291 break;
3292 case WebKit::WebAXRoleCell: 3292 case blink::WebAXRoleCell:
3293 ia_role_ = ROLE_SYSTEM_CELL; 3293 ia_role_ = ROLE_SYSTEM_CELL;
3294 break; 3294 break;
3295 case WebKit::WebAXRoleCheckBox: 3295 case blink::WebAXRoleCheckBox:
3296 ia_role_ = ROLE_SYSTEM_CHECKBUTTON; 3296 ia_role_ = ROLE_SYSTEM_CHECKBUTTON;
3297 break; 3297 break;
3298 case WebKit::WebAXRoleColorWell: 3298 case blink::WebAXRoleColorWell:
3299 ia_role_ = ROLE_SYSTEM_CLIENT; 3299 ia_role_ = ROLE_SYSTEM_CLIENT;
3300 ia2_role_ = IA2_ROLE_COLOR_CHOOSER; 3300 ia2_role_ = IA2_ROLE_COLOR_CHOOSER;
3301 break; 3301 break;
3302 case WebKit::WebAXRoleColumn: 3302 case blink::WebAXRoleColumn:
3303 ia_role_ = ROLE_SYSTEM_COLUMN; 3303 ia_role_ = ROLE_SYSTEM_COLUMN;
3304 ia_state_ |= STATE_SYSTEM_READONLY; 3304 ia_state_ |= STATE_SYSTEM_READONLY;
3305 break; 3305 break;
3306 case WebKit::WebAXRoleColumnHeader: 3306 case blink::WebAXRoleColumnHeader:
3307 ia_role_ = ROLE_SYSTEM_COLUMNHEADER; 3307 ia_role_ = ROLE_SYSTEM_COLUMNHEADER;
3308 ia_state_ |= STATE_SYSTEM_READONLY; 3308 ia_state_ |= STATE_SYSTEM_READONLY;
3309 break; 3309 break;
3310 case WebKit::WebAXRoleComboBox: 3310 case blink::WebAXRoleComboBox:
3311 ia_role_ = ROLE_SYSTEM_COMBOBOX; 3311 ia_role_ = ROLE_SYSTEM_COMBOBOX;
3312 break; 3312 break;
3313 case WebKit::WebAXRoleDiv: 3313 case blink::WebAXRoleDiv:
3314 role_name_ = L"div"; 3314 role_name_ = L"div";
3315 ia2_role_ = IA2_ROLE_SECTION; 3315 ia2_role_ = IA2_ROLE_SECTION;
3316 break; 3316 break;
3317 case WebKit::WebAXRoleDefinition: 3317 case blink::WebAXRoleDefinition:
3318 role_name_ = html_tag; 3318 role_name_ = html_tag;
3319 ia2_role_ = IA2_ROLE_PARAGRAPH; 3319 ia2_role_ = IA2_ROLE_PARAGRAPH;
3320 ia_state_ |= STATE_SYSTEM_READONLY; 3320 ia_state_ |= STATE_SYSTEM_READONLY;
3321 break; 3321 break;
3322 case WebKit::WebAXRoleDescriptionListDetail: 3322 case blink::WebAXRoleDescriptionListDetail:
3323 role_name_ = html_tag; 3323 role_name_ = html_tag;
3324 ia2_role_ = IA2_ROLE_PARAGRAPH; 3324 ia2_role_ = IA2_ROLE_PARAGRAPH;
3325 ia_state_ |= STATE_SYSTEM_READONLY; 3325 ia_state_ |= STATE_SYSTEM_READONLY;
3326 break; 3326 break;
3327 case WebKit::WebAXRoleDescriptionListTerm: 3327 case blink::WebAXRoleDescriptionListTerm:
3328 ia_role_ = ROLE_SYSTEM_LISTITEM; 3328 ia_role_ = ROLE_SYSTEM_LISTITEM;
3329 ia_state_ |= STATE_SYSTEM_READONLY; 3329 ia_state_ |= STATE_SYSTEM_READONLY;
3330 break; 3330 break;
3331 case WebKit::WebAXRoleDialog: 3331 case blink::WebAXRoleDialog:
3332 ia_role_ = ROLE_SYSTEM_DIALOG; 3332 ia_role_ = ROLE_SYSTEM_DIALOG;
3333 ia_state_ |= STATE_SYSTEM_READONLY; 3333 ia_state_ |= STATE_SYSTEM_READONLY;
3334 break; 3334 break;
3335 case WebKit::WebAXRoleDisclosureTriangle: 3335 case blink::WebAXRoleDisclosureTriangle:
3336 ia_role_ = ROLE_SYSTEM_OUTLINEBUTTON; 3336 ia_role_ = ROLE_SYSTEM_OUTLINEBUTTON;
3337 ia_state_ |= STATE_SYSTEM_READONLY; 3337 ia_state_ |= STATE_SYSTEM_READONLY;
3338 break; 3338 break;
3339 case WebKit::WebAXRoleDocument: 3339 case blink::WebAXRoleDocument:
3340 case WebKit::WebAXRoleRootWebArea: 3340 case blink::WebAXRoleRootWebArea:
3341 case WebKit::WebAXRoleWebArea: 3341 case blink::WebAXRoleWebArea:
3342 ia_role_ = ROLE_SYSTEM_DOCUMENT; 3342 ia_role_ = ROLE_SYSTEM_DOCUMENT;
3343 ia_state_ |= STATE_SYSTEM_READONLY; 3343 ia_state_ |= STATE_SYSTEM_READONLY;
3344 ia_state_ |= STATE_SYSTEM_FOCUSABLE; 3344 ia_state_ |= STATE_SYSTEM_FOCUSABLE;
3345 break; 3345 break;
3346 case WebKit::WebAXRoleEditableText: 3346 case blink::WebAXRoleEditableText:
3347 ia_role_ = ROLE_SYSTEM_TEXT; 3347 ia_role_ = ROLE_SYSTEM_TEXT;
3348 ia2_state_ |= IA2_STATE_SINGLE_LINE; 3348 ia2_state_ |= IA2_STATE_SINGLE_LINE;
3349 ia2_state_ |= IA2_STATE_EDITABLE; 3349 ia2_state_ |= IA2_STATE_EDITABLE;
3350 break; 3350 break;
3351 case WebKit::WebAXRoleForm: 3351 case blink::WebAXRoleForm:
3352 role_name_ = L"form"; 3352 role_name_ = L"form";
3353 ia2_role_ = IA2_ROLE_FORM; 3353 ia2_role_ = IA2_ROLE_FORM;
3354 break; 3354 break;
3355 case WebKit::WebAXRoleFooter: 3355 case blink::WebAXRoleFooter:
3356 ia_role_ = IA2_ROLE_FOOTER; 3356 ia_role_ = IA2_ROLE_FOOTER;
3357 ia_state_ |= STATE_SYSTEM_READONLY; 3357 ia_state_ |= STATE_SYSTEM_READONLY;
3358 break; 3358 break;
3359 case WebKit::WebAXRoleGrid: 3359 case blink::WebAXRoleGrid:
3360 ia_role_ = ROLE_SYSTEM_TABLE; 3360 ia_role_ = ROLE_SYSTEM_TABLE;
3361 ia_state_ |= STATE_SYSTEM_READONLY; 3361 ia_state_ |= STATE_SYSTEM_READONLY;
3362 break; 3362 break;
3363 case WebKit::WebAXRoleGroup: { 3363 case blink::WebAXRoleGroup: {
3364 string16 aria_role = GetString16Attribute( 3364 string16 aria_role = GetString16Attribute(
3365 AccessibilityNodeData::ATTR_ROLE); 3365 AccessibilityNodeData::ATTR_ROLE);
3366 if (aria_role == L"group" || html_tag == L"fieldset") { 3366 if (aria_role == L"group" || html_tag == L"fieldset") {
3367 ia_role_ = ROLE_SYSTEM_GROUPING; 3367 ia_role_ = ROLE_SYSTEM_GROUPING;
3368 } else if (html_tag == L"li") { 3368 } else if (html_tag == L"li") {
3369 ia_role_ = ROLE_SYSTEM_LISTITEM; 3369 ia_role_ = ROLE_SYSTEM_LISTITEM;
3370 } else { 3370 } else {
3371 if (html_tag.empty()) 3371 if (html_tag.empty())
3372 role_name_ = L"div"; 3372 role_name_ = L"div";
3373 else 3373 else
3374 role_name_ = html_tag; 3374 role_name_ = html_tag;
3375 ia2_role_ = IA2_ROLE_SECTION; 3375 ia2_role_ = IA2_ROLE_SECTION;
3376 } 3376 }
3377 ia_state_ |= STATE_SYSTEM_READONLY; 3377 ia_state_ |= STATE_SYSTEM_READONLY;
3378 break; 3378 break;
3379 } 3379 }
3380 case WebKit::WebAXRoleGrowArea: 3380 case blink::WebAXRoleGrowArea:
3381 ia_role_ = ROLE_SYSTEM_GRIP; 3381 ia_role_ = ROLE_SYSTEM_GRIP;
3382 ia_state_ |= STATE_SYSTEM_READONLY; 3382 ia_state_ |= STATE_SYSTEM_READONLY;
3383 break; 3383 break;
3384 case WebKit::WebAXRoleHeading: 3384 case blink::WebAXRoleHeading:
3385 role_name_ = html_tag; 3385 role_name_ = html_tag;
3386 ia2_role_ = IA2_ROLE_HEADING; 3386 ia2_role_ = IA2_ROLE_HEADING;
3387 ia_state_ |= STATE_SYSTEM_READONLY; 3387 ia_state_ |= STATE_SYSTEM_READONLY;
3388 break; 3388 break;
3389 case WebKit::WebAXRoleHorizontalRule: 3389 case blink::WebAXRoleHorizontalRule:
3390 ia_role_ = ROLE_SYSTEM_SEPARATOR; 3390 ia_role_ = ROLE_SYSTEM_SEPARATOR;
3391 break; 3391 break;
3392 case WebKit::WebAXRoleImage: 3392 case blink::WebAXRoleImage:
3393 ia_role_ = ROLE_SYSTEM_GRAPHIC; 3393 ia_role_ = ROLE_SYSTEM_GRAPHIC;
3394 ia_state_ |= STATE_SYSTEM_READONLY; 3394 ia_state_ |= STATE_SYSTEM_READONLY;
3395 break; 3395 break;
3396 case WebKit::WebAXRoleImageMap: 3396 case blink::WebAXRoleImageMap:
3397 role_name_ = html_tag; 3397 role_name_ = html_tag;
3398 ia2_role_ = IA2_ROLE_IMAGE_MAP; 3398 ia2_role_ = IA2_ROLE_IMAGE_MAP;
3399 ia_state_ |= STATE_SYSTEM_READONLY; 3399 ia_state_ |= STATE_SYSTEM_READONLY;
3400 break; 3400 break;
3401 case WebKit::WebAXRoleImageMapLink: 3401 case blink::WebAXRoleImageMapLink:
3402 ia_role_ = ROLE_SYSTEM_LINK; 3402 ia_role_ = ROLE_SYSTEM_LINK;
3403 ia_state_ |= STATE_SYSTEM_LINKED; 3403 ia_state_ |= STATE_SYSTEM_LINKED;
3404 ia_state_ |= STATE_SYSTEM_READONLY; 3404 ia_state_ |= STATE_SYSTEM_READONLY;
3405 break; 3405 break;
3406 case WebKit::WebAXRoleLabel: 3406 case blink::WebAXRoleLabel:
3407 ia_role_ = ROLE_SYSTEM_TEXT; 3407 ia_role_ = ROLE_SYSTEM_TEXT;
3408 ia2_role_ = IA2_ROLE_LABEL; 3408 ia2_role_ = IA2_ROLE_LABEL;
3409 break; 3409 break;
3410 case WebKit::WebAXRoleBanner: 3410 case blink::WebAXRoleBanner:
3411 case WebKit::WebAXRoleComplementary: 3411 case blink::WebAXRoleComplementary:
3412 case WebKit::WebAXRoleContentInfo: 3412 case blink::WebAXRoleContentInfo:
3413 case WebKit::WebAXRoleMain: 3413 case blink::WebAXRoleMain:
3414 case WebKit::WebAXRoleNavigation: 3414 case blink::WebAXRoleNavigation:
3415 case WebKit::WebAXRoleSearch: 3415 case blink::WebAXRoleSearch:
3416 ia_role_ = ROLE_SYSTEM_GROUPING; 3416 ia_role_ = ROLE_SYSTEM_GROUPING;
3417 ia2_role_ = IA2_ROLE_SECTION; 3417 ia2_role_ = IA2_ROLE_SECTION;
3418 ia_state_ |= STATE_SYSTEM_READONLY; 3418 ia_state_ |= STATE_SYSTEM_READONLY;
3419 break; 3419 break;
3420 case WebKit::WebAXRoleLink: 3420 case blink::WebAXRoleLink:
3421 ia_role_ = ROLE_SYSTEM_LINK; 3421 ia_role_ = ROLE_SYSTEM_LINK;
3422 ia_state_ |= STATE_SYSTEM_LINKED; 3422 ia_state_ |= STATE_SYSTEM_LINKED;
3423 break; 3423 break;
3424 case WebKit::WebAXRoleList: 3424 case blink::WebAXRoleList:
3425 ia_role_ = ROLE_SYSTEM_LIST; 3425 ia_role_ = ROLE_SYSTEM_LIST;
3426 ia_state_ |= STATE_SYSTEM_READONLY; 3426 ia_state_ |= STATE_SYSTEM_READONLY;
3427 break; 3427 break;
3428 case WebKit::WebAXRoleListBox: 3428 case blink::WebAXRoleListBox:
3429 ia_role_ = ROLE_SYSTEM_LIST; 3429 ia_role_ = ROLE_SYSTEM_LIST;
3430 break; 3430 break;
3431 case WebKit::WebAXRoleListBoxOption: 3431 case blink::WebAXRoleListBoxOption:
3432 ia_role_ = ROLE_SYSTEM_LISTITEM; 3432 ia_role_ = ROLE_SYSTEM_LISTITEM;
3433 if (ia_state_ & STATE_SYSTEM_SELECTABLE) { 3433 if (ia_state_ & STATE_SYSTEM_SELECTABLE) {
3434 ia_state_ |= STATE_SYSTEM_FOCUSABLE; 3434 ia_state_ |= STATE_SYSTEM_FOCUSABLE;
3435 if (HasState(WebKit::WebAXStateFocused)) 3435 if (HasState(blink::WebAXStateFocused))
3436 ia_state_ |= STATE_SYSTEM_FOCUSED; 3436 ia_state_ |= STATE_SYSTEM_FOCUSED;
3437 } 3437 }
3438 break; 3438 break;
3439 case WebKit::WebAXRoleListItem: 3439 case blink::WebAXRoleListItem:
3440 ia_role_ = ROLE_SYSTEM_LISTITEM; 3440 ia_role_ = ROLE_SYSTEM_LISTITEM;
3441 ia_state_ |= STATE_SYSTEM_READONLY; 3441 ia_state_ |= STATE_SYSTEM_READONLY;
3442 break; 3442 break;
3443 case WebKit::WebAXRoleListMarker: 3443 case blink::WebAXRoleListMarker:
3444 ia_role_ = ROLE_SYSTEM_TEXT; 3444 ia_role_ = ROLE_SYSTEM_TEXT;
3445 ia_state_ |= STATE_SYSTEM_READONLY; 3445 ia_state_ |= STATE_SYSTEM_READONLY;
3446 break; 3446 break;
3447 case WebKit::WebAXRoleMath: 3447 case blink::WebAXRoleMath:
3448 ia_role_ = ROLE_SYSTEM_EQUATION; 3448 ia_role_ = ROLE_SYSTEM_EQUATION;
3449 ia_state_ |= STATE_SYSTEM_READONLY; 3449 ia_state_ |= STATE_SYSTEM_READONLY;
3450 break; 3450 break;
3451 case WebKit::WebAXRoleMenu: 3451 case blink::WebAXRoleMenu:
3452 case WebKit::WebAXRoleMenuButton: 3452 case blink::WebAXRoleMenuButton:
3453 ia_role_ = ROLE_SYSTEM_MENUPOPUP; 3453 ia_role_ = ROLE_SYSTEM_MENUPOPUP;
3454 break; 3454 break;
3455 case WebKit::WebAXRoleMenuBar: 3455 case blink::WebAXRoleMenuBar:
3456 ia_role_ = ROLE_SYSTEM_MENUBAR; 3456 ia_role_ = ROLE_SYSTEM_MENUBAR;
3457 break; 3457 break;
3458 case WebKit::WebAXRoleMenuItem: 3458 case blink::WebAXRoleMenuItem:
3459 ia_role_ = ROLE_SYSTEM_MENUITEM; 3459 ia_role_ = ROLE_SYSTEM_MENUITEM;
3460 break; 3460 break;
3461 case WebKit::WebAXRoleMenuListPopup: 3461 case blink::WebAXRoleMenuListPopup:
3462 ia_role_ = ROLE_SYSTEM_CLIENT; 3462 ia_role_ = ROLE_SYSTEM_CLIENT;
3463 break; 3463 break;
3464 case WebKit::WebAXRoleMenuListOption: 3464 case blink::WebAXRoleMenuListOption:
3465 ia_role_ = ROLE_SYSTEM_LISTITEM; 3465 ia_role_ = ROLE_SYSTEM_LISTITEM;
3466 if (ia_state_ & STATE_SYSTEM_SELECTABLE) { 3466 if (ia_state_ & STATE_SYSTEM_SELECTABLE) {
3467 ia_state_ |= STATE_SYSTEM_FOCUSABLE; 3467 ia_state_ |= STATE_SYSTEM_FOCUSABLE;
3468 if (HasState(WebKit::WebAXStateFocused)) 3468 if (HasState(blink::WebAXStateFocused))
3469 ia_state_ |= STATE_SYSTEM_FOCUSED; 3469 ia_state_ |= STATE_SYSTEM_FOCUSED;
3470 } 3470 }
3471 break; 3471 break;
3472 case WebKit::WebAXRoleNote: 3472 case blink::WebAXRoleNote:
3473 ia_role_ = ROLE_SYSTEM_GROUPING; 3473 ia_role_ = ROLE_SYSTEM_GROUPING;
3474 ia2_role_ = IA2_ROLE_NOTE; 3474 ia2_role_ = IA2_ROLE_NOTE;
3475 ia_state_ |= STATE_SYSTEM_READONLY; 3475 ia_state_ |= STATE_SYSTEM_READONLY;
3476 break; 3476 break;
3477 case WebKit::WebAXRoleOutline: 3477 case blink::WebAXRoleOutline:
3478 ia_role_ = ROLE_SYSTEM_OUTLINE; 3478 ia_role_ = ROLE_SYSTEM_OUTLINE;
3479 ia_state_ |= STATE_SYSTEM_READONLY; 3479 ia_state_ |= STATE_SYSTEM_READONLY;
3480 break; 3480 break;
3481 case WebKit::WebAXRoleParagraph: 3481 case blink::WebAXRoleParagraph:
3482 role_name_ = L"P"; 3482 role_name_ = L"P";
3483 ia2_role_ = IA2_ROLE_PARAGRAPH; 3483 ia2_role_ = IA2_ROLE_PARAGRAPH;
3484 break; 3484 break;
3485 case WebKit::WebAXRolePopUpButton: 3485 case blink::WebAXRolePopUpButton:
3486 if (html_tag == L"select") { 3486 if (html_tag == L"select") {
3487 ia_role_ = ROLE_SYSTEM_COMBOBOX; 3487 ia_role_ = ROLE_SYSTEM_COMBOBOX;
3488 } else { 3488 } else {
3489 ia_role_ = ROLE_SYSTEM_BUTTONMENU; 3489 ia_role_ = ROLE_SYSTEM_BUTTONMENU;
3490 } 3490 }
3491 break; 3491 break;
3492 case WebKit::WebAXRoleProgressIndicator: 3492 case blink::WebAXRoleProgressIndicator:
3493 ia_role_ = ROLE_SYSTEM_PROGRESSBAR; 3493 ia_role_ = ROLE_SYSTEM_PROGRESSBAR;
3494 ia_state_ |= STATE_SYSTEM_READONLY; 3494 ia_state_ |= STATE_SYSTEM_READONLY;
3495 break; 3495 break;
3496 case WebKit::WebAXRoleRadioButton: 3496 case blink::WebAXRoleRadioButton:
3497 ia_role_ = ROLE_SYSTEM_RADIOBUTTON; 3497 ia_role_ = ROLE_SYSTEM_RADIOBUTTON;
3498 break; 3498 break;
3499 case WebKit::WebAXRoleRadioGroup: 3499 case blink::WebAXRoleRadioGroup:
3500 ia_role_ = ROLE_SYSTEM_GROUPING; 3500 ia_role_ = ROLE_SYSTEM_GROUPING;
3501 ia2_role_ = IA2_ROLE_SECTION; 3501 ia2_role_ = IA2_ROLE_SECTION;
3502 break; 3502 break;
3503 case WebKit::WebAXRoleRegion: 3503 case blink::WebAXRoleRegion:
3504 ia_role_ = ROLE_SYSTEM_GROUPING; 3504 ia_role_ = ROLE_SYSTEM_GROUPING;
3505 ia2_role_ = IA2_ROLE_SECTION; 3505 ia2_role_ = IA2_ROLE_SECTION;
3506 ia_state_ |= STATE_SYSTEM_READONLY; 3506 ia_state_ |= STATE_SYSTEM_READONLY;
3507 break; 3507 break;
3508 case WebKit::WebAXRoleRow: 3508 case blink::WebAXRoleRow:
3509 ia_role_ = ROLE_SYSTEM_ROW; 3509 ia_role_ = ROLE_SYSTEM_ROW;
3510 ia_state_ |= STATE_SYSTEM_READONLY; 3510 ia_state_ |= STATE_SYSTEM_READONLY;
3511 break; 3511 break;
3512 case WebKit::WebAXRoleRowHeader: 3512 case blink::WebAXRoleRowHeader:
3513 ia_role_ = ROLE_SYSTEM_ROWHEADER; 3513 ia_role_ = ROLE_SYSTEM_ROWHEADER;
3514 ia_state_ |= STATE_SYSTEM_READONLY; 3514 ia_state_ |= STATE_SYSTEM_READONLY;
3515 break; 3515 break;
3516 case WebKit::WebAXRoleRuler: 3516 case blink::WebAXRoleRuler:
3517 ia_role_ = ROLE_SYSTEM_CLIENT; 3517 ia_role_ = ROLE_SYSTEM_CLIENT;
3518 ia2_role_ = IA2_ROLE_RULER; 3518 ia2_role_ = IA2_ROLE_RULER;
3519 ia_state_ |= STATE_SYSTEM_READONLY; 3519 ia_state_ |= STATE_SYSTEM_READONLY;
3520 break; 3520 break;
3521 case WebKit::WebAXRoleScrollArea: 3521 case blink::WebAXRoleScrollArea:
3522 ia_role_ = ROLE_SYSTEM_CLIENT; 3522 ia_role_ = ROLE_SYSTEM_CLIENT;
3523 ia2_role_ = IA2_ROLE_SCROLL_PANE; 3523 ia2_role_ = IA2_ROLE_SCROLL_PANE;
3524 ia_state_ |= STATE_SYSTEM_READONLY; 3524 ia_state_ |= STATE_SYSTEM_READONLY;
3525 break; 3525 break;
3526 case WebKit::WebAXRoleScrollBar: 3526 case blink::WebAXRoleScrollBar:
3527 ia_role_ = ROLE_SYSTEM_SCROLLBAR; 3527 ia_role_ = ROLE_SYSTEM_SCROLLBAR;
3528 break; 3528 break;
3529 case WebKit::WebAXRoleSlider: 3529 case blink::WebAXRoleSlider:
3530 ia_role_ = ROLE_SYSTEM_SLIDER; 3530 ia_role_ = ROLE_SYSTEM_SLIDER;
3531 break; 3531 break;
3532 case WebKit::WebAXRoleSpinButton: 3532 case blink::WebAXRoleSpinButton:
3533 ia_role_ = ROLE_SYSTEM_SPINBUTTON; 3533 ia_role_ = ROLE_SYSTEM_SPINBUTTON;
3534 break; 3534 break;
3535 case WebKit::WebAXRoleSpinButtonPart: 3535 case blink::WebAXRoleSpinButtonPart:
3536 ia_role_ = ROLE_SYSTEM_PUSHBUTTON; 3536 ia_role_ = ROLE_SYSTEM_PUSHBUTTON;
3537 break; 3537 break;
3538 case WebKit::WebAXRoleSplitGroup: 3538 case blink::WebAXRoleSplitGroup:
3539 ia_role_ = ROLE_SYSTEM_CLIENT; 3539 ia_role_ = ROLE_SYSTEM_CLIENT;
3540 ia2_role_ = IA2_ROLE_SPLIT_PANE; 3540 ia2_role_ = IA2_ROLE_SPLIT_PANE;
3541 ia_state_ |= STATE_SYSTEM_READONLY; 3541 ia_state_ |= STATE_SYSTEM_READONLY;
3542 break; 3542 break;
3543 case WebKit::WebAXRoleAnnotation: 3543 case blink::WebAXRoleAnnotation:
3544 case WebKit::WebAXRoleStaticText: 3544 case blink::WebAXRoleStaticText:
3545 ia_role_ = ROLE_SYSTEM_TEXT; 3545 ia_role_ = ROLE_SYSTEM_TEXT;
3546 ia_state_ |= STATE_SYSTEM_READONLY; 3546 ia_state_ |= STATE_SYSTEM_READONLY;
3547 break; 3547 break;
3548 case WebKit::WebAXRoleStatus: 3548 case blink::WebAXRoleStatus:
3549 ia_role_ = ROLE_SYSTEM_STATUSBAR; 3549 ia_role_ = ROLE_SYSTEM_STATUSBAR;
3550 ia_state_ |= STATE_SYSTEM_READONLY; 3550 ia_state_ |= STATE_SYSTEM_READONLY;
3551 break; 3551 break;
3552 case WebKit::WebAXRoleSplitter: 3552 case blink::WebAXRoleSplitter:
3553 ia_role_ = ROLE_SYSTEM_SEPARATOR; 3553 ia_role_ = ROLE_SYSTEM_SEPARATOR;
3554 break; 3554 break;
3555 case WebKit::WebAXRoleSVGRoot: 3555 case blink::WebAXRoleSVGRoot:
3556 ia_role_ = ROLE_SYSTEM_GRAPHIC; 3556 ia_role_ = ROLE_SYSTEM_GRAPHIC;
3557 break; 3557 break;
3558 case WebKit::WebAXRoleTab: 3558 case blink::WebAXRoleTab:
3559 ia_role_ = ROLE_SYSTEM_PAGETAB; 3559 ia_role_ = ROLE_SYSTEM_PAGETAB;
3560 break; 3560 break;
3561 case WebKit::WebAXRoleTable: { 3561 case blink::WebAXRoleTable: {
3562 string16 aria_role = GetString16Attribute( 3562 string16 aria_role = GetString16Attribute(
3563 AccessibilityNodeData::ATTR_ROLE); 3563 AccessibilityNodeData::ATTR_ROLE);
3564 if (aria_role == L"treegrid") { 3564 if (aria_role == L"treegrid") {
3565 ia_role_ = ROLE_SYSTEM_OUTLINE; 3565 ia_role_ = ROLE_SYSTEM_OUTLINE;
3566 } else { 3566 } else {
3567 ia_role_ = ROLE_SYSTEM_TABLE; 3567 ia_role_ = ROLE_SYSTEM_TABLE;
3568 ia_state_ |= STATE_SYSTEM_READONLY; 3568 ia_state_ |= STATE_SYSTEM_READONLY;
3569 } 3569 }
3570 break; 3570 break;
3571 } 3571 }
3572 case WebKit::WebAXRoleTableHeaderContainer: 3572 case blink::WebAXRoleTableHeaderContainer:
3573 ia_role_ = ROLE_SYSTEM_GROUPING; 3573 ia_role_ = ROLE_SYSTEM_GROUPING;
3574 ia2_role_ = IA2_ROLE_SECTION; 3574 ia2_role_ = IA2_ROLE_SECTION;
3575 ia_state_ |= STATE_SYSTEM_READONLY; 3575 ia_state_ |= STATE_SYSTEM_READONLY;
3576 break; 3576 break;
3577 case WebKit::WebAXRoleTabList: 3577 case blink::WebAXRoleTabList:
3578 ia_role_ = ROLE_SYSTEM_PAGETABLIST; 3578 ia_role_ = ROLE_SYSTEM_PAGETABLIST;
3579 break; 3579 break;
3580 case WebKit::WebAXRoleTabPanel: 3580 case blink::WebAXRoleTabPanel:
3581 ia_role_ = ROLE_SYSTEM_PROPERTYPAGE; 3581 ia_role_ = ROLE_SYSTEM_PROPERTYPAGE;
3582 break; 3582 break;
3583 case WebKit::WebAXRoleToggleButton: 3583 case blink::WebAXRoleToggleButton:
3584 ia_role_ = ROLE_SYSTEM_PUSHBUTTON; 3584 ia_role_ = ROLE_SYSTEM_PUSHBUTTON;
3585 ia2_role_ = IA2_ROLE_TOGGLE_BUTTON; 3585 ia2_role_ = IA2_ROLE_TOGGLE_BUTTON;
3586 break; 3586 break;
3587 case WebKit::WebAXRoleTextArea: 3587 case blink::WebAXRoleTextArea:
3588 ia_role_ = ROLE_SYSTEM_TEXT; 3588 ia_role_ = ROLE_SYSTEM_TEXT;
3589 ia2_state_ |= IA2_STATE_MULTI_LINE; 3589 ia2_state_ |= IA2_STATE_MULTI_LINE;
3590 ia2_state_ |= IA2_STATE_EDITABLE; 3590 ia2_state_ |= IA2_STATE_EDITABLE;
3591 ia2_state_ |= IA2_STATE_SELECTABLE_TEXT; 3591 ia2_state_ |= IA2_STATE_SELECTABLE_TEXT;
3592 break; 3592 break;
3593 case WebKit::WebAXRoleTextField: 3593 case blink::WebAXRoleTextField:
3594 ia_role_ = ROLE_SYSTEM_TEXT; 3594 ia_role_ = ROLE_SYSTEM_TEXT;
3595 ia2_state_ |= IA2_STATE_SINGLE_LINE; 3595 ia2_state_ |= IA2_STATE_SINGLE_LINE;
3596 ia2_state_ |= IA2_STATE_EDITABLE; 3596 ia2_state_ |= IA2_STATE_EDITABLE;
3597 ia2_state_ |= IA2_STATE_SELECTABLE_TEXT; 3597 ia2_state_ |= IA2_STATE_SELECTABLE_TEXT;
3598 break; 3598 break;
3599 case WebKit::WebAXRoleTimer: 3599 case blink::WebAXRoleTimer:
3600 ia_role_ = ROLE_SYSTEM_CLOCK; 3600 ia_role_ = ROLE_SYSTEM_CLOCK;
3601 ia_state_ |= STATE_SYSTEM_READONLY; 3601 ia_state_ |= STATE_SYSTEM_READONLY;
3602 break; 3602 break;
3603 case WebKit::WebAXRoleToolbar: 3603 case blink::WebAXRoleToolbar:
3604 ia_role_ = ROLE_SYSTEM_TOOLBAR; 3604 ia_role_ = ROLE_SYSTEM_TOOLBAR;
3605 ia_state_ |= STATE_SYSTEM_READONLY; 3605 ia_state_ |= STATE_SYSTEM_READONLY;
3606 break; 3606 break;
3607 case WebKit::WebAXRoleUserInterfaceTooltip: 3607 case blink::WebAXRoleUserInterfaceTooltip:
3608 ia_role_ = ROLE_SYSTEM_TOOLTIP; 3608 ia_role_ = ROLE_SYSTEM_TOOLTIP;
3609 ia_state_ |= STATE_SYSTEM_READONLY; 3609 ia_state_ |= STATE_SYSTEM_READONLY;
3610 break; 3610 break;
3611 case WebKit::WebAXRoleTree: 3611 case blink::WebAXRoleTree:
3612 ia_role_ = ROLE_SYSTEM_OUTLINE; 3612 ia_role_ = ROLE_SYSTEM_OUTLINE;
3613 ia_state_ |= STATE_SYSTEM_READONLY; 3613 ia_state_ |= STATE_SYSTEM_READONLY;
3614 break; 3614 break;
3615 case WebKit::WebAXRoleTreeGrid: 3615 case blink::WebAXRoleTreeGrid:
3616 ia_role_ = ROLE_SYSTEM_OUTLINE; 3616 ia_role_ = ROLE_SYSTEM_OUTLINE;
3617 ia_state_ |= STATE_SYSTEM_READONLY; 3617 ia_state_ |= STATE_SYSTEM_READONLY;
3618 break; 3618 break;
3619 case WebKit::WebAXRoleTreeItem: 3619 case blink::WebAXRoleTreeItem:
3620 ia_role_ = ROLE_SYSTEM_OUTLINEITEM; 3620 ia_role_ = ROLE_SYSTEM_OUTLINEITEM;
3621 ia_state_ |= STATE_SYSTEM_READONLY; 3621 ia_state_ |= STATE_SYSTEM_READONLY;
3622 break; 3622 break;
3623 case WebKit::WebAXRoleWindow: 3623 case blink::WebAXRoleWindow:
3624 ia_role_ = ROLE_SYSTEM_WINDOW; 3624 ia_role_ = ROLE_SYSTEM_WINDOW;
3625 break; 3625 break;
3626 3626
3627 // TODO(dmazzoni): figure out the proper MSAA role for all of these. 3627 // TODO(dmazzoni): figure out the proper MSAA role for all of these.
3628 case WebKit::WebAXRoleBrowser: 3628 case blink::WebAXRoleBrowser:
3629 case WebKit::WebAXRoleDirectory: 3629 case blink::WebAXRoleDirectory:
3630 case WebKit::WebAXRoleDrawer: 3630 case blink::WebAXRoleDrawer:
3631 case WebKit::WebAXRoleHelpTag: 3631 case blink::WebAXRoleHelpTag:
3632 case WebKit::WebAXRoleIgnored: 3632 case blink::WebAXRoleIgnored:
3633 case WebKit::WebAXRoleIncrementor: 3633 case blink::WebAXRoleIncrementor:
3634 case WebKit::WebAXRoleLog: 3634 case blink::WebAXRoleLog:
3635 case WebKit::WebAXRoleMarquee: 3635 case blink::WebAXRoleMarquee:
3636 case WebKit::WebAXRoleMatte: 3636 case blink::WebAXRoleMatte:
3637 case WebKit::WebAXRolePresentational: 3637 case blink::WebAXRolePresentational:
3638 case WebKit::WebAXRoleRulerMarker: 3638 case blink::WebAXRoleRulerMarker:
3639 case WebKit::WebAXRoleSheet: 3639 case blink::WebAXRoleSheet:
3640 case WebKit::WebAXRoleSliderThumb: 3640 case blink::WebAXRoleSliderThumb:
3641 case WebKit::WebAXRoleSystemWide: 3641 case blink::WebAXRoleSystemWide:
3642 case WebKit::WebAXRoleValueIndicator: 3642 case blink::WebAXRoleValueIndicator:
3643 default: 3643 default:
3644 ia_role_ = ROLE_SYSTEM_CLIENT; 3644 ia_role_ = ROLE_SYSTEM_CLIENT;
3645 break; 3645 break;
3646 } 3646 }
3647 3647
3648 // Compute the final value of READONLY for MSAA. 3648 // Compute the final value of READONLY for MSAA.
3649 // 3649 //
3650 // We always set the READONLY state for elements that have the 3650 // We always set the READONLY state for elements that have the
3651 // aria-readonly attribute and for a few roles (in the switch above). 3651 // aria-readonly attribute and for a few roles (in the switch above).
3652 // We clear the READONLY state on focusable controls and on a document. 3652 // We clear the READONLY state on focusable controls and on a document.
3653 // Everything else, the majority of objects, do not have this state set. 3653 // Everything else, the majority of objects, do not have this state set.
3654 if (HasState(WebKit::WebAXStateFocusable) && 3654 if (HasState(blink::WebAXStateFocusable) &&
3655 ia_role_ != ROLE_SYSTEM_DOCUMENT) { 3655 ia_role_ != ROLE_SYSTEM_DOCUMENT) {
3656 ia_state_ &= ~(STATE_SYSTEM_READONLY); 3656 ia_state_ &= ~(STATE_SYSTEM_READONLY);
3657 } 3657 }
3658 if (!HasState(WebKit::WebAXStateReadonly)) 3658 if (!HasState(blink::WebAXStateReadonly))
3659 ia_state_ &= ~(STATE_SYSTEM_READONLY); 3659 ia_state_ &= ~(STATE_SYSTEM_READONLY);
3660 if (GetBoolAttribute(AccessibilityNodeData::ATTR_ARIA_READONLY)) 3660 if (GetBoolAttribute(AccessibilityNodeData::ATTR_ARIA_READONLY))
3661 ia_state_ |= STATE_SYSTEM_READONLY; 3661 ia_state_ |= STATE_SYSTEM_READONLY;
3662 3662
3663 // The role should always be set. 3663 // The role should always be set.
3664 DCHECK(!role_name_.empty() || ia_role_); 3664 DCHECK(!role_name_.empty() || ia_role_);
3665 3665
3666 // If we didn't explicitly set the IAccessible2 role, make it the same 3666 // If we didn't explicitly set the IAccessible2 role, make it the same
3667 // as the MSAA role. 3667 // as the MSAA role.
3668 if (!ia2_role_) 3668 if (!ia2_role_)
3669 ia2_role_ = ia_role_; 3669 ia2_role_ = ia_role_;
3670 } 3670 }
3671 3671
3672 } // namespace content 3672 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698