| 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 "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 return E_FAIL; | 373 return E_FAIL; |
| 374 | 374 |
| 375 if (!def_action) | 375 if (!def_action) |
| 376 return E_INVALIDARG; | 376 return E_INVALIDARG; |
| 377 | 377 |
| 378 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 378 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 379 if (!target) | 379 if (!target) |
| 380 return E_INVALIDARG; | 380 return E_INVALIDARG; |
| 381 | 381 |
| 382 return target->GetStringAttributeAsBstr( | 382 return target->GetStringAttributeAsBstr( |
| 383 AccessibilityNodeData::ATTR_SHORTCUT, def_action); | 383 ui::AX_ATTR_SHORTCUT, def_action); |
| 384 } | 384 } |
| 385 | 385 |
| 386 STDMETHODIMP BrowserAccessibilityWin::get_accDescription(VARIANT var_id, | 386 STDMETHODIMP BrowserAccessibilityWin::get_accDescription(VARIANT var_id, |
| 387 BSTR* desc) { | 387 BSTR* desc) { |
| 388 if (!instance_active()) | 388 if (!instance_active()) |
| 389 return E_FAIL; | 389 return E_FAIL; |
| 390 | 390 |
| 391 if (!desc) | 391 if (!desc) |
| 392 return E_INVALIDARG; | 392 return E_INVALIDARG; |
| 393 | 393 |
| 394 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 394 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 395 if (!target) | 395 if (!target) |
| 396 return E_INVALIDARG; | 396 return E_INVALIDARG; |
| 397 | 397 |
| 398 return target->GetStringAttributeAsBstr( | 398 return target->GetStringAttributeAsBstr( |
| 399 AccessibilityNodeData::ATTR_DESCRIPTION, desc); | 399 ui::AX_ATTR_DESCRIPTION, desc); |
| 400 } | 400 } |
| 401 | 401 |
| 402 STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) { | 402 STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) { |
| 403 if (!instance_active()) | 403 if (!instance_active()) |
| 404 return E_FAIL; | 404 return E_FAIL; |
| 405 | 405 |
| 406 if (!focus_child) | 406 if (!focus_child) |
| 407 return E_INVALIDARG; | 407 return E_INVALIDARG; |
| 408 | 408 |
| 409 BrowserAccessibilityWin* focus = static_cast<BrowserAccessibilityWin*>( | 409 BrowserAccessibilityWin* focus = static_cast<BrowserAccessibilityWin*>( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 426 return E_FAIL; | 426 return E_FAIL; |
| 427 | 427 |
| 428 if (!help) | 428 if (!help) |
| 429 return E_INVALIDARG; | 429 return E_INVALIDARG; |
| 430 | 430 |
| 431 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 431 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 432 if (!target) | 432 if (!target) |
| 433 return E_INVALIDARG; | 433 return E_INVALIDARG; |
| 434 | 434 |
| 435 return target->GetStringAttributeAsBstr( | 435 return target->GetStringAttributeAsBstr( |
| 436 AccessibilityNodeData::ATTR_HELP, help); | 436 ui::AX_ATTR_HELP, help); |
| 437 } | 437 } |
| 438 | 438 |
| 439 STDMETHODIMP BrowserAccessibilityWin::get_accKeyboardShortcut(VARIANT var_id, | 439 STDMETHODIMP BrowserAccessibilityWin::get_accKeyboardShortcut(VARIANT var_id, |
| 440 BSTR* acc_key) { | 440 BSTR* acc_key) { |
| 441 if (!instance_active()) | 441 if (!instance_active()) |
| 442 return E_FAIL; | 442 return E_FAIL; |
| 443 | 443 |
| 444 if (!acc_key) | 444 if (!acc_key) |
| 445 return E_INVALIDARG; | 445 return E_INVALIDARG; |
| 446 | 446 |
| 447 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 447 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 448 if (!target) | 448 if (!target) |
| 449 return E_INVALIDARG; | 449 return E_INVALIDARG; |
| 450 | 450 |
| 451 return target->GetStringAttributeAsBstr( | 451 return target->GetStringAttributeAsBstr( |
| 452 AccessibilityNodeData::ATTR_SHORTCUT, acc_key); | 452 ui::AX_ATTR_SHORTCUT, acc_key); |
| 453 } | 453 } |
| 454 | 454 |
| 455 STDMETHODIMP BrowserAccessibilityWin::get_accName(VARIANT var_id, BSTR* name) { | 455 STDMETHODIMP BrowserAccessibilityWin::get_accName(VARIANT var_id, BSTR* name) { |
| 456 if (!instance_active()) | 456 if (!instance_active()) |
| 457 return E_FAIL; | 457 return E_FAIL; |
| 458 | 458 |
| 459 if (!name) | 459 if (!name) |
| 460 return E_INVALIDARG; | 460 return E_INVALIDARG; |
| 461 | 461 |
| 462 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 462 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 463 if (!target) | 463 if (!target) |
| 464 return E_INVALIDARG; | 464 return E_INVALIDARG; |
| 465 | 465 |
| 466 std::string name_str = target->name(); | 466 std::string name_str = target->name(); |
| 467 | 467 |
| 468 // If the name is empty, see if it's labeled by another element. | 468 // If the name is empty, see if it's labeled by another element. |
| 469 if (name_str.empty()) { | 469 if (name_str.empty()) { |
| 470 int title_elem_id; | 470 int title_elem_id; |
| 471 if (target->GetIntAttribute(AccessibilityNodeData::ATTR_TITLE_UI_ELEMENT, | 471 if (target->GetIntAttribute(ui::AX_ATTR_TITLE_UI_ELEMENT, |
| 472 &title_elem_id)) { | 472 &title_elem_id)) { |
| 473 BrowserAccessibility* title_elem = | 473 BrowserAccessibility* title_elem = |
| 474 manager()->GetFromRendererID(title_elem_id); | 474 manager()->GetFromRendererID(title_elem_id); |
| 475 if (title_elem) | 475 if (title_elem) |
| 476 name_str = title_elem->GetTextRecursive(); | 476 name_str = title_elem->GetTextRecursive(); |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 | 479 |
| 480 if (name_str.empty()) | 480 if (name_str.empty()) |
| 481 return S_FALSE; | 481 return S_FALSE; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 target->ia_role() == ROLE_SYSTEM_SLIDER) { | 570 target->ia_role() == ROLE_SYSTEM_SLIDER) { |
| 571 base::string16 value_text = target->GetValueText(); | 571 base::string16 value_text = target->GetValueText(); |
| 572 *value = SysAllocString(value_text.c_str()); | 572 *value = SysAllocString(value_text.c_str()); |
| 573 DCHECK(*value); | 573 DCHECK(*value); |
| 574 return S_OK; | 574 return S_OK; |
| 575 } | 575 } |
| 576 | 576 |
| 577 // Expose color well value. | 577 // Expose color well value. |
| 578 if (target->ia2_role() == IA2_ROLE_COLOR_CHOOSER) { | 578 if (target->ia2_role() == IA2_ROLE_COLOR_CHOOSER) { |
| 579 int r = target->GetIntAttribute( | 579 int r = target->GetIntAttribute( |
| 580 AccessibilityNodeData::ATTR_COLOR_VALUE_RED); | 580 ui::AX_ATTR_COLOR_VALUE_RED); |
| 581 int g = target->GetIntAttribute( | 581 int g = target->GetIntAttribute( |
| 582 AccessibilityNodeData::ATTR_COLOR_VALUE_GREEN); | 582 ui::AX_ATTR_COLOR_VALUE_GREEN); |
| 583 int b = target->GetIntAttribute( | 583 int b = target->GetIntAttribute( |
| 584 AccessibilityNodeData::ATTR_COLOR_VALUE_BLUE); | 584 ui::AX_ATTR_COLOR_VALUE_BLUE); |
| 585 base::string16 value_text; | 585 base::string16 value_text; |
| 586 value_text = base::IntToString16((r * 100) / 255) + L"% red " + | 586 value_text = base::IntToString16((r * 100) / 255) + L"% red " + |
| 587 base::IntToString16((g * 100) / 255) + L"% green " + | 587 base::IntToString16((g * 100) / 255) + L"% green " + |
| 588 base::IntToString16((b * 100) / 255) + L"% blue"; | 588 base::IntToString16((b * 100) / 255) + L"% blue"; |
| 589 *value = SysAllocString(value_text.c_str()); | 589 *value = SysAllocString(value_text.c_str()); |
| 590 DCHECK(*value); | 590 DCHECK(*value); |
| 591 return S_OK; | 591 return S_OK; |
| 592 } | 592 } |
| 593 | 593 |
| 594 *value = SysAllocString(base::UTF8ToUTF16(target->value()).c_str()); | 594 *value = SysAllocString(base::UTF8ToUTF16(target->value()).c_str()); |
| 595 DCHECK(*value); | 595 DCHECK(*value); |
| 596 return S_OK; | 596 return S_OK; |
| 597 } | 597 } |
| 598 | 598 |
| 599 STDMETHODIMP BrowserAccessibilityWin::get_accHelpTopic(BSTR* help_file, | 599 STDMETHODIMP BrowserAccessibilityWin::get_accHelpTopic(BSTR* help_file, |
| 600 VARIANT var_id, | 600 VARIANT var_id, |
| 601 LONG* topic_id) { | 601 LONG* topic_id) { |
| 602 return E_NOTIMPL; | 602 return E_NOTIMPL; |
| 603 } | 603 } |
| 604 | 604 |
| 605 STDMETHODIMP BrowserAccessibilityWin::get_accSelection(VARIANT* selected) { | 605 STDMETHODIMP BrowserAccessibilityWin::get_accSelection(VARIANT* selected) { |
| 606 if (!instance_active()) | 606 if (!instance_active()) |
| 607 return E_FAIL; | 607 return E_FAIL; |
| 608 | 608 |
| 609 if (blink_role() != blink::WebAXRoleListBox) | 609 if (blink_role() != ui::AX_ROLE_LIST_BOX) |
| 610 return E_NOTIMPL; | 610 return E_NOTIMPL; |
| 611 | 611 |
| 612 unsigned long selected_count = 0; | 612 unsigned long selected_count = 0; |
| 613 for (size_t i = 0; i < children().size(); ++i) { | 613 for (size_t i = 0; i < children().size(); ++i) { |
| 614 if (children()[i]->HasState(blink::WebAXStateSelected)) | 614 if (children()[i]->HasState(ui::AX_STATE_SELECTED)) |
| 615 ++selected_count; | 615 ++selected_count; |
| 616 } | 616 } |
| 617 | 617 |
| 618 if (selected_count == 0) { | 618 if (selected_count == 0) { |
| 619 selected->vt = VT_EMPTY; | 619 selected->vt = VT_EMPTY; |
| 620 return S_OK; | 620 return S_OK; |
| 621 } | 621 } |
| 622 | 622 |
| 623 if (selected_count == 1) { | 623 if (selected_count == 1) { |
| 624 for (size_t i = 0; i < children().size(); ++i) { | 624 for (size_t i = 0; i < children().size(); ++i) { |
| 625 if (children()[i]->HasState(blink::WebAXStateSelected)) { | 625 if (children()[i]->HasState(ui::AX_STATE_SELECTED)) { |
| 626 selected->vt = VT_DISPATCH; | 626 selected->vt = VT_DISPATCH; |
| 627 selected->pdispVal = | 627 selected->pdispVal = |
| 628 children()[i]->ToBrowserAccessibilityWin()->NewReference(); | 628 children()[i]->ToBrowserAccessibilityWin()->NewReference(); |
| 629 return S_OK; | 629 return S_OK; |
| 630 } | 630 } |
| 631 } | 631 } |
| 632 } | 632 } |
| 633 | 633 |
| 634 // Multiple items are selected. | 634 // Multiple items are selected. |
| 635 base::win::EnumVariant* enum_variant = | 635 base::win::EnumVariant* enum_variant = |
| 636 new base::win::EnumVariant(selected_count); | 636 new base::win::EnumVariant(selected_count); |
| 637 enum_variant->AddRef(); | 637 enum_variant->AddRef(); |
| 638 unsigned long index = 0; | 638 unsigned long index = 0; |
| 639 for (size_t i = 0; i < children().size(); ++i) { | 639 for (size_t i = 0; i < children().size(); ++i) { |
| 640 if (children()[i]->HasState(blink::WebAXStateSelected)) { | 640 if (children()[i]->HasState(ui::AX_STATE_SELECTED)) { |
| 641 enum_variant->ItemAt(index)->vt = VT_DISPATCH; | 641 enum_variant->ItemAt(index)->vt = VT_DISPATCH; |
| 642 enum_variant->ItemAt(index)->pdispVal = | 642 enum_variant->ItemAt(index)->pdispVal = |
| 643 children()[i]->ToBrowserAccessibilityWin()->NewReference(); | 643 children()[i]->ToBrowserAccessibilityWin()->NewReference(); |
| 644 ++index; | 644 ++index; |
| 645 } | 645 } |
| 646 } | 646 } |
| 647 selected->vt = VT_UNKNOWN; | 647 selected->vt = VT_UNKNOWN; |
| 648 selected->punkVal = static_cast<IUnknown*>( | 648 selected->punkVal = static_cast<IUnknown*>( |
| 649 static_cast<base::win::IUnknownImpl*>(enum_variant)); | 649 static_cast<base::win::IUnknownImpl*>(enum_variant)); |
| 650 return S_OK; | 650 return S_OK; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( | 868 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( |
| 869 LONG* group_level, | 869 LONG* group_level, |
| 870 LONG* similar_items_in_group, | 870 LONG* similar_items_in_group, |
| 871 LONG* position_in_group) { | 871 LONG* position_in_group) { |
| 872 if (!instance_active()) | 872 if (!instance_active()) |
| 873 return E_FAIL; | 873 return E_FAIL; |
| 874 | 874 |
| 875 if (!group_level || !similar_items_in_group || !position_in_group) | 875 if (!group_level || !similar_items_in_group || !position_in_group) |
| 876 return E_INVALIDARG; | 876 return E_INVALIDARG; |
| 877 | 877 |
| 878 if (blink_role() == blink::WebAXRoleListBoxOption && | 878 if (blink_role() == ui::AX_ROLE_LIST_BOX_OPTION && |
| 879 parent() && | 879 parent() && |
| 880 parent()->role() == blink::WebAXRoleListBox) { | 880 parent()->role() == ui::AX_ROLE_LIST_BOX) { |
| 881 *group_level = 0; | 881 *group_level = 0; |
| 882 *similar_items_in_group = parent()->PlatformChildCount(); | 882 *similar_items_in_group = parent()->PlatformChildCount(); |
| 883 *position_in_group = index_in_parent() + 1; | 883 *position_in_group = index_in_parent() + 1; |
| 884 return S_OK; | 884 return S_OK; |
| 885 } | 885 } |
| 886 | 886 |
| 887 return E_NOTIMPL; | 887 return E_NOTIMPL; |
| 888 } | 888 } |
| 889 | 889 |
| 890 // | 890 // |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 // | 964 // |
| 965 | 965 |
| 966 STDMETHODIMP BrowserAccessibilityWin::get_description(BSTR* desc) { | 966 STDMETHODIMP BrowserAccessibilityWin::get_description(BSTR* desc) { |
| 967 if (!instance_active()) | 967 if (!instance_active()) |
| 968 return E_FAIL; | 968 return E_FAIL; |
| 969 | 969 |
| 970 if (!desc) | 970 if (!desc) |
| 971 return E_INVALIDARG; | 971 return E_INVALIDARG; |
| 972 | 972 |
| 973 return GetStringAttributeAsBstr( | 973 return GetStringAttributeAsBstr( |
| 974 AccessibilityNodeData::ATTR_DESCRIPTION, desc); | 974 ui::AX_ATTR_DESCRIPTION, desc); |
| 975 } | 975 } |
| 976 | 976 |
| 977 STDMETHODIMP BrowserAccessibilityWin::get_imagePosition( | 977 STDMETHODIMP BrowserAccessibilityWin::get_imagePosition( |
| 978 enum IA2CoordinateType coordinate_type, | 978 enum IA2CoordinateType coordinate_type, |
| 979 LONG* x, | 979 LONG* x, |
| 980 LONG* y) { | 980 LONG* y) { |
| 981 if (!instance_active()) | 981 if (!instance_active()) |
| 982 return E_FAIL; | 982 return E_FAIL; |
| 983 | 983 |
| 984 if (!x || !y) | 984 if (!x || !y) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 IUnknown** accessible) { | 1027 IUnknown** accessible) { |
| 1028 if (!instance_active()) | 1028 if (!instance_active()) |
| 1029 return E_FAIL; | 1029 return E_FAIL; |
| 1030 | 1030 |
| 1031 if (!accessible) | 1031 if (!accessible) |
| 1032 return E_INVALIDARG; | 1032 return E_INVALIDARG; |
| 1033 | 1033 |
| 1034 int columns; | 1034 int columns; |
| 1035 int rows; | 1035 int rows; |
| 1036 if (!GetIntAttribute( | 1036 if (!GetIntAttribute( |
| 1037 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1037 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1038 !GetIntAttribute( | 1038 !GetIntAttribute( |
| 1039 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows) || | 1039 ui::AX_ATTR_TABLE_ROW_COUNT, &rows) || |
| 1040 columns <= 0 || | 1040 columns <= 0 || |
| 1041 rows <= 0) { | 1041 rows <= 0) { |
| 1042 return S_FALSE; | 1042 return S_FALSE; |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 if (row < 0 || row >= rows || column < 0 || column >= columns) | 1045 if (row < 0 || row >= rows || column < 0 || column >= columns) |
| 1046 return E_INVALIDARG; | 1046 return E_INVALIDARG; |
| 1047 | 1047 |
| 1048 const std::vector<int32>& cell_ids = GetIntListAttribute( | 1048 const std::vector<int32>& cell_ids = GetIntListAttribute( |
| 1049 AccessibilityNodeData::ATTR_CELL_IDS); | 1049 ui::AX_ATTR_CELL_IDS); |
| 1050 DCHECK_EQ(columns * rows, static_cast<int>(cell_ids.size())); | 1050 DCHECK_EQ(columns * rows, static_cast<int>(cell_ids.size())); |
| 1051 | 1051 |
| 1052 int cell_id = cell_ids[row * columns + column]; | 1052 int cell_id = cell_ids[row * columns + column]; |
| 1053 BrowserAccessibilityWin* cell = GetFromRendererID(cell_id); | 1053 BrowserAccessibilityWin* cell = GetFromRendererID(cell_id); |
| 1054 if (cell) { | 1054 if (cell) { |
| 1055 *accessible = static_cast<IAccessible*>(cell->NewReference()); | 1055 *accessible = static_cast<IAccessible*>(cell->NewReference()); |
| 1056 return S_OK; | 1056 return S_OK; |
| 1057 } | 1057 } |
| 1058 | 1058 |
| 1059 *accessible = NULL; | 1059 *accessible = NULL; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1076 long* cell_index) { | 1076 long* cell_index) { |
| 1077 if (!instance_active()) | 1077 if (!instance_active()) |
| 1078 return E_FAIL; | 1078 return E_FAIL; |
| 1079 | 1079 |
| 1080 if (!cell_index) | 1080 if (!cell_index) |
| 1081 return E_INVALIDARG; | 1081 return E_INVALIDARG; |
| 1082 | 1082 |
| 1083 int columns; | 1083 int columns; |
| 1084 int rows; | 1084 int rows; |
| 1085 if (!GetIntAttribute( | 1085 if (!GetIntAttribute( |
| 1086 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1086 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1087 !GetIntAttribute( | 1087 !GetIntAttribute( |
| 1088 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows) || | 1088 ui::AX_ATTR_TABLE_ROW_COUNT, &rows) || |
| 1089 columns <= 0 || | 1089 columns <= 0 || |
| 1090 rows <= 0) { | 1090 rows <= 0) { |
| 1091 return S_FALSE; | 1091 return S_FALSE; |
| 1092 } | 1092 } |
| 1093 | 1093 |
| 1094 if (row < 0 || row >= rows || column < 0 || column >= columns) | 1094 if (row < 0 || row >= rows || column < 0 || column >= columns) |
| 1095 return E_INVALIDARG; | 1095 return E_INVALIDARG; |
| 1096 | 1096 |
| 1097 const std::vector<int32>& cell_ids = GetIntListAttribute( | 1097 const std::vector<int32>& cell_ids = GetIntListAttribute( |
| 1098 AccessibilityNodeData::ATTR_CELL_IDS); | 1098 ui::AX_ATTR_CELL_IDS); |
| 1099 const std::vector<int32>& unique_cell_ids = GetIntListAttribute( | 1099 const std::vector<int32>& unique_cell_ids = GetIntListAttribute( |
| 1100 AccessibilityNodeData::ATTR_UNIQUE_CELL_IDS); | 1100 ui::AX_ATTR_UNIQUE_CELL_IDS); |
| 1101 DCHECK_EQ(columns * rows, static_cast<int>(cell_ids.size())); | 1101 DCHECK_EQ(columns * rows, static_cast<int>(cell_ids.size())); |
| 1102 int cell_id = cell_ids[row * columns + column]; | 1102 int cell_id = cell_ids[row * columns + column]; |
| 1103 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { | 1103 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { |
| 1104 if (unique_cell_ids[i] == cell_id) { | 1104 if (unique_cell_ids[i] == cell_id) { |
| 1105 *cell_index = (long)i; | 1105 *cell_index = (long)i; |
| 1106 return S_OK; | 1106 return S_OK; |
| 1107 } | 1107 } |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 return S_FALSE; | 1110 return S_FALSE; |
| 1111 } | 1111 } |
| 1112 | 1112 |
| 1113 STDMETHODIMP BrowserAccessibilityWin::get_columnDescription(long column, | 1113 STDMETHODIMP BrowserAccessibilityWin::get_columnDescription(long column, |
| 1114 BSTR* description) { | 1114 BSTR* description) { |
| 1115 if (!instance_active()) | 1115 if (!instance_active()) |
| 1116 return E_FAIL; | 1116 return E_FAIL; |
| 1117 | 1117 |
| 1118 if (!description) | 1118 if (!description) |
| 1119 return E_INVALIDARG; | 1119 return E_INVALIDARG; |
| 1120 | 1120 |
| 1121 int columns; | 1121 int columns; |
| 1122 int rows; | 1122 int rows; |
| 1123 if (!GetIntAttribute( | 1123 if (!GetIntAttribute( |
| 1124 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1124 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1125 !GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows) || | 1125 !GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT, &rows) || |
| 1126 columns <= 0 || | 1126 columns <= 0 || |
| 1127 rows <= 0) { | 1127 rows <= 0) { |
| 1128 return S_FALSE; | 1128 return S_FALSE; |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 if (column < 0 || column >= columns) | 1131 if (column < 0 || column >= columns) |
| 1132 return E_INVALIDARG; | 1132 return E_INVALIDARG; |
| 1133 | 1133 |
| 1134 const std::vector<int32>& cell_ids = GetIntListAttribute( | 1134 const std::vector<int32>& cell_ids = GetIntListAttribute( |
| 1135 AccessibilityNodeData::ATTR_CELL_IDS); | 1135 ui::AX_ATTR_CELL_IDS); |
| 1136 for (int i = 0; i < rows; ++i) { | 1136 for (int i = 0; i < rows; ++i) { |
| 1137 int cell_id = cell_ids[i * columns + column]; | 1137 int cell_id = cell_ids[i * columns + column]; |
| 1138 BrowserAccessibilityWin* cell = static_cast<BrowserAccessibilityWin*>( | 1138 BrowserAccessibilityWin* cell = static_cast<BrowserAccessibilityWin*>( |
| 1139 manager()->GetFromRendererID(cell_id)); | 1139 manager()->GetFromRendererID(cell_id)); |
| 1140 if (cell && cell->blink_role() == blink::WebAXRoleColumnHeader) { | 1140 if (cell && cell->blink_role() == ui::AX_ROLE_COLUMN_HEADER) { |
| 1141 base::string16 cell_name = cell->GetString16Attribute( | 1141 base::string16 cell_name = cell->GetString16Attribute( |
| 1142 AccessibilityNodeData::ATTR_NAME); | 1142 ui::AX_ATTR_NAME); |
| 1143 if (cell_name.size() > 0) { | 1143 if (cell_name.size() > 0) { |
| 1144 *description = SysAllocString(cell_name.c_str()); | 1144 *description = SysAllocString(cell_name.c_str()); |
| 1145 return S_OK; | 1145 return S_OK; |
| 1146 } | 1146 } |
| 1147 | 1147 |
| 1148 return cell->GetStringAttributeAsBstr( | 1148 return cell->GetStringAttributeAsBstr( |
| 1149 AccessibilityNodeData::ATTR_DESCRIPTION, description); | 1149 ui::AX_ATTR_DESCRIPTION, description); |
| 1150 } | 1150 } |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 return S_FALSE; | 1153 return S_FALSE; |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 STDMETHODIMP BrowserAccessibilityWin::get_columnExtentAt( | 1156 STDMETHODIMP BrowserAccessibilityWin::get_columnExtentAt( |
| 1157 long row, | 1157 long row, |
| 1158 long column, | 1158 long column, |
| 1159 long* n_columns_spanned) { | 1159 long* n_columns_spanned) { |
| 1160 if (!instance_active()) | 1160 if (!instance_active()) |
| 1161 return E_FAIL; | 1161 return E_FAIL; |
| 1162 | 1162 |
| 1163 if (!n_columns_spanned) | 1163 if (!n_columns_spanned) |
| 1164 return E_INVALIDARG; | 1164 return E_INVALIDARG; |
| 1165 | 1165 |
| 1166 int columns; | 1166 int columns; |
| 1167 int rows; | 1167 int rows; |
| 1168 if (!GetIntAttribute( | 1168 if (!GetIntAttribute( |
| 1169 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1169 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1170 !GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows) || | 1170 !GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT, &rows) || |
| 1171 columns <= 0 || | 1171 columns <= 0 || |
| 1172 rows <= 0) { | 1172 rows <= 0) { |
| 1173 return S_FALSE; | 1173 return S_FALSE; |
| 1174 } | 1174 } |
| 1175 | 1175 |
| 1176 if (row < 0 || row >= rows || column < 0 || column >= columns) | 1176 if (row < 0 || row >= rows || column < 0 || column >= columns) |
| 1177 return E_INVALIDARG; | 1177 return E_INVALIDARG; |
| 1178 | 1178 |
| 1179 const std::vector<int32>& cell_ids = GetIntListAttribute( | 1179 const std::vector<int32>& cell_ids = GetIntListAttribute( |
| 1180 AccessibilityNodeData::ATTR_CELL_IDS); | 1180 ui::AX_ATTR_CELL_IDS); |
| 1181 int cell_id = cell_ids[row * columns + column]; | 1181 int cell_id = cell_ids[row * columns + column]; |
| 1182 BrowserAccessibilityWin* cell = static_cast<BrowserAccessibilityWin*>( | 1182 BrowserAccessibilityWin* cell = static_cast<BrowserAccessibilityWin*>( |
| 1183 manager()->GetFromRendererID(cell_id)); | 1183 manager()->GetFromRendererID(cell_id)); |
| 1184 int colspan; | 1184 int colspan; |
| 1185 if (cell && | 1185 if (cell && |
| 1186 cell->GetIntAttribute( | 1186 cell->GetIntAttribute( |
| 1187 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && | 1187 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && |
| 1188 colspan >= 1) { | 1188 colspan >= 1) { |
| 1189 *n_columns_spanned = colspan; | 1189 *n_columns_spanned = colspan; |
| 1190 return S_OK; | 1190 return S_OK; |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 return S_FALSE; | 1193 return S_FALSE; |
| 1194 } | 1194 } |
| 1195 | 1195 |
| 1196 STDMETHODIMP BrowserAccessibilityWin::get_columnHeader( | 1196 STDMETHODIMP BrowserAccessibilityWin::get_columnHeader( |
| 1197 IAccessibleTable** accessible_table, | 1197 IAccessibleTable** accessible_table, |
| 1198 long* starting_row_index) { | 1198 long* starting_row_index) { |
| 1199 // TODO(dmazzoni): implement | 1199 // TODO(dmazzoni): implement |
| 1200 return E_NOTIMPL; | 1200 return E_NOTIMPL; |
| 1201 } | 1201 } |
| 1202 | 1202 |
| 1203 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long cell_index, | 1203 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long cell_index, |
| 1204 long* column_index) { | 1204 long* column_index) { |
| 1205 if (!instance_active()) | 1205 if (!instance_active()) |
| 1206 return E_FAIL; | 1206 return E_FAIL; |
| 1207 | 1207 |
| 1208 if (!column_index) | 1208 if (!column_index) |
| 1209 return E_INVALIDARG; | 1209 return E_INVALIDARG; |
| 1210 | 1210 |
| 1211 const std::vector<int32>& unique_cell_ids = GetIntListAttribute( | 1211 const std::vector<int32>& unique_cell_ids = GetIntListAttribute( |
| 1212 AccessibilityNodeData::ATTR_UNIQUE_CELL_IDS); | 1212 ui::AX_ATTR_UNIQUE_CELL_IDS); |
| 1213 int cell_id_count = static_cast<int>(unique_cell_ids.size()); | 1213 int cell_id_count = static_cast<int>(unique_cell_ids.size()); |
| 1214 if (cell_index < 0) | 1214 if (cell_index < 0) |
| 1215 return E_INVALIDARG; | 1215 return E_INVALIDARG; |
| 1216 if (cell_index >= cell_id_count) | 1216 if (cell_index >= cell_id_count) |
| 1217 return S_FALSE; | 1217 return S_FALSE; |
| 1218 | 1218 |
| 1219 int cell_id = unique_cell_ids[cell_index]; | 1219 int cell_id = unique_cell_ids[cell_index]; |
| 1220 BrowserAccessibilityWin* cell = | 1220 BrowserAccessibilityWin* cell = |
| 1221 manager()->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1221 manager()->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1222 int col_index; | 1222 int col_index; |
| 1223 if (cell && | 1223 if (cell && |
| 1224 cell->GetIntAttribute( | 1224 cell->GetIntAttribute( |
| 1225 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &col_index)) { | 1225 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &col_index)) { |
| 1226 *column_index = col_index; | 1226 *column_index = col_index; |
| 1227 return S_OK; | 1227 return S_OK; |
| 1228 } | 1228 } |
| 1229 | 1229 |
| 1230 return S_FALSE; | 1230 return S_FALSE; |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 STDMETHODIMP BrowserAccessibilityWin::get_nColumns(long* column_count) { | 1233 STDMETHODIMP BrowserAccessibilityWin::get_nColumns(long* column_count) { |
| 1234 if (!instance_active()) | 1234 if (!instance_active()) |
| 1235 return E_FAIL; | 1235 return E_FAIL; |
| 1236 | 1236 |
| 1237 if (!column_count) | 1237 if (!column_count) |
| 1238 return E_INVALIDARG; | 1238 return E_INVALIDARG; |
| 1239 | 1239 |
| 1240 int columns; | 1240 int columns; |
| 1241 if (GetIntAttribute( | 1241 if (GetIntAttribute( |
| 1242 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns)) { | 1242 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns)) { |
| 1243 *column_count = columns; | 1243 *column_count = columns; |
| 1244 return S_OK; | 1244 return S_OK; |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 return S_FALSE; | 1247 return S_FALSE; |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 STDMETHODIMP BrowserAccessibilityWin::get_nRows(long* row_count) { | 1250 STDMETHODIMP BrowserAccessibilityWin::get_nRows(long* row_count) { |
| 1251 if (!instance_active()) | 1251 if (!instance_active()) |
| 1252 return E_FAIL; | 1252 return E_FAIL; |
| 1253 | 1253 |
| 1254 if (!row_count) | 1254 if (!row_count) |
| 1255 return E_INVALIDARG; | 1255 return E_INVALIDARG; |
| 1256 | 1256 |
| 1257 int rows; | 1257 int rows; |
| 1258 if (GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows)) { | 1258 if (GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT, &rows)) { |
| 1259 *row_count = rows; | 1259 *row_count = rows; |
| 1260 return S_OK; | 1260 return S_OK; |
| 1261 } | 1261 } |
| 1262 | 1262 |
| 1263 return S_FALSE; | 1263 return S_FALSE; |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedChildren(long* cell_count) { | 1266 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedChildren(long* cell_count) { |
| 1267 if (!instance_active()) | 1267 if (!instance_active()) |
| 1268 return E_FAIL; | 1268 return E_FAIL; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 BSTR* description) { | 1301 BSTR* description) { |
| 1302 if (!instance_active()) | 1302 if (!instance_active()) |
| 1303 return E_FAIL; | 1303 return E_FAIL; |
| 1304 | 1304 |
| 1305 if (!description) | 1305 if (!description) |
| 1306 return E_INVALIDARG; | 1306 return E_INVALIDARG; |
| 1307 | 1307 |
| 1308 int columns; | 1308 int columns; |
| 1309 int rows; | 1309 int rows; |
| 1310 if (!GetIntAttribute( | 1310 if (!GetIntAttribute( |
| 1311 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1311 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1312 !GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows) || | 1312 !GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT, &rows) || |
| 1313 columns <= 0 || | 1313 columns <= 0 || |
| 1314 rows <= 0) { | 1314 rows <= 0) { |
| 1315 return S_FALSE; | 1315 return S_FALSE; |
| 1316 } | 1316 } |
| 1317 | 1317 |
| 1318 if (row < 0 || row >= rows) | 1318 if (row < 0 || row >= rows) |
| 1319 return E_INVALIDARG; | 1319 return E_INVALIDARG; |
| 1320 | 1320 |
| 1321 const std::vector<int32>& cell_ids = GetIntListAttribute( | 1321 const std::vector<int32>& cell_ids = GetIntListAttribute( |
| 1322 AccessibilityNodeData::ATTR_CELL_IDS); | 1322 ui::AX_ATTR_CELL_IDS); |
| 1323 for (int i = 0; i < columns; ++i) { | 1323 for (int i = 0; i < columns; ++i) { |
| 1324 int cell_id = cell_ids[row * columns + i]; | 1324 int cell_id = cell_ids[row * columns + i]; |
| 1325 BrowserAccessibilityWin* cell = | 1325 BrowserAccessibilityWin* cell = |
| 1326 manager()->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1326 manager()->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1327 if (cell && cell->blink_role() == blink::WebAXRoleRowHeader) { | 1327 if (cell && cell->blink_role() == ui::AX_ROLE_ROW_HEADER) { |
| 1328 base::string16 cell_name = cell->GetString16Attribute( | 1328 base::string16 cell_name = cell->GetString16Attribute( |
| 1329 AccessibilityNodeData::ATTR_NAME); | 1329 ui::AX_ATTR_NAME); |
| 1330 if (cell_name.size() > 0) { | 1330 if (cell_name.size() > 0) { |
| 1331 *description = SysAllocString(cell_name.c_str()); | 1331 *description = SysAllocString(cell_name.c_str()); |
| 1332 return S_OK; | 1332 return S_OK; |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 return cell->GetStringAttributeAsBstr( | 1335 return cell->GetStringAttributeAsBstr( |
| 1336 AccessibilityNodeData::ATTR_DESCRIPTION, description); | 1336 ui::AX_ATTR_DESCRIPTION, description); |
| 1337 } | 1337 } |
| 1338 } | 1338 } |
| 1339 | 1339 |
| 1340 return S_FALSE; | 1340 return S_FALSE; |
| 1341 } | 1341 } |
| 1342 | 1342 |
| 1343 STDMETHODIMP BrowserAccessibilityWin::get_rowExtentAt(long row, | 1343 STDMETHODIMP BrowserAccessibilityWin::get_rowExtentAt(long row, |
| 1344 long column, | 1344 long column, |
| 1345 long* n_rows_spanned) { | 1345 long* n_rows_spanned) { |
| 1346 if (!instance_active()) | 1346 if (!instance_active()) |
| 1347 return E_FAIL; | 1347 return E_FAIL; |
| 1348 | 1348 |
| 1349 if (!n_rows_spanned) | 1349 if (!n_rows_spanned) |
| 1350 return E_INVALIDARG; | 1350 return E_INVALIDARG; |
| 1351 | 1351 |
| 1352 int columns; | 1352 int columns; |
| 1353 int rows; | 1353 int rows; |
| 1354 if (!GetIntAttribute( | 1354 if (!GetIntAttribute( |
| 1355 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1355 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1356 !GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows) || | 1356 !GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT, &rows) || |
| 1357 columns <= 0 || | 1357 columns <= 0 || |
| 1358 rows <= 0) { | 1358 rows <= 0) { |
| 1359 return S_FALSE; | 1359 return S_FALSE; |
| 1360 } | 1360 } |
| 1361 | 1361 |
| 1362 if (row < 0 || row >= rows || column < 0 || column >= columns) | 1362 if (row < 0 || row >= rows || column < 0 || column >= columns) |
| 1363 return E_INVALIDARG; | 1363 return E_INVALIDARG; |
| 1364 | 1364 |
| 1365 const std::vector<int32>& cell_ids = GetIntListAttribute( | 1365 const std::vector<int32>& cell_ids = GetIntListAttribute( |
| 1366 AccessibilityNodeData::ATTR_CELL_IDS); | 1366 ui::AX_ATTR_CELL_IDS); |
| 1367 int cell_id = cell_ids[row * columns + column]; | 1367 int cell_id = cell_ids[row * columns + column]; |
| 1368 BrowserAccessibilityWin* cell = | 1368 BrowserAccessibilityWin* cell = |
| 1369 manager()->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1369 manager()->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1370 int rowspan; | 1370 int rowspan; |
| 1371 if (cell && | 1371 if (cell && |
| 1372 cell->GetIntAttribute( | 1372 cell->GetIntAttribute( |
| 1373 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && | 1373 ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && |
| 1374 rowspan >= 1) { | 1374 rowspan >= 1) { |
| 1375 *n_rows_spanned = rowspan; | 1375 *n_rows_spanned = rowspan; |
| 1376 return S_OK; | 1376 return S_OK; |
| 1377 } | 1377 } |
| 1378 | 1378 |
| 1379 return S_FALSE; | 1379 return S_FALSE; |
| 1380 } | 1380 } |
| 1381 | 1381 |
| 1382 STDMETHODIMP BrowserAccessibilityWin::get_rowHeader( | 1382 STDMETHODIMP BrowserAccessibilityWin::get_rowHeader( |
| 1383 IAccessibleTable** accessible_table, | 1383 IAccessibleTable** accessible_table, |
| 1384 long* starting_column_index) { | 1384 long* starting_column_index) { |
| 1385 // TODO(dmazzoni): implement | 1385 // TODO(dmazzoni): implement |
| 1386 return E_NOTIMPL; | 1386 return E_NOTIMPL; |
| 1387 } | 1387 } |
| 1388 | 1388 |
| 1389 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long cell_index, | 1389 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long cell_index, |
| 1390 long* row_index) { | 1390 long* row_index) { |
| 1391 if (!instance_active()) | 1391 if (!instance_active()) |
| 1392 return E_FAIL; | 1392 return E_FAIL; |
| 1393 | 1393 |
| 1394 if (!row_index) | 1394 if (!row_index) |
| 1395 return E_INVALIDARG; | 1395 return E_INVALIDARG; |
| 1396 | 1396 |
| 1397 const std::vector<int32>& unique_cell_ids = GetIntListAttribute( | 1397 const std::vector<int32>& unique_cell_ids = GetIntListAttribute( |
| 1398 AccessibilityNodeData::ATTR_UNIQUE_CELL_IDS); | 1398 ui::AX_ATTR_UNIQUE_CELL_IDS); |
| 1399 int cell_id_count = static_cast<int>(unique_cell_ids.size()); | 1399 int cell_id_count = static_cast<int>(unique_cell_ids.size()); |
| 1400 if (cell_index < 0) | 1400 if (cell_index < 0) |
| 1401 return E_INVALIDARG; | 1401 return E_INVALIDARG; |
| 1402 if (cell_index >= cell_id_count) | 1402 if (cell_index >= cell_id_count) |
| 1403 return S_FALSE; | 1403 return S_FALSE; |
| 1404 | 1404 |
| 1405 int cell_id = unique_cell_ids[cell_index]; | 1405 int cell_id = unique_cell_ids[cell_index]; |
| 1406 BrowserAccessibilityWin* cell = | 1406 BrowserAccessibilityWin* cell = |
| 1407 manager()->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1407 manager()->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1408 int cell_row_index; | 1408 int cell_row_index; |
| 1409 if (cell && | 1409 if (cell && |
| 1410 cell->GetIntAttribute( | 1410 cell->GetIntAttribute( |
| 1411 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &cell_row_index)) { | 1411 ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &cell_row_index)) { |
| 1412 *row_index = cell_row_index; | 1412 *row_index = cell_row_index; |
| 1413 return S_OK; | 1413 return S_OK; |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 return S_FALSE; | 1416 return S_FALSE; |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 STDMETHODIMP BrowserAccessibilityWin::get_selectedChildren(long max_children, | 1419 STDMETHODIMP BrowserAccessibilityWin::get_selectedChildren(long max_children, |
| 1420 long** children, | 1420 long** children, |
| 1421 long* n_children) { | 1421 long* n_children) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 long* row_extents, | 1517 long* row_extents, |
| 1518 long* column_extents, | 1518 long* column_extents, |
| 1519 boolean* is_selected) { | 1519 boolean* is_selected) { |
| 1520 if (!instance_active()) | 1520 if (!instance_active()) |
| 1521 return E_FAIL; | 1521 return E_FAIL; |
| 1522 | 1522 |
| 1523 if (!row || !column || !row_extents || !column_extents || !is_selected) | 1523 if (!row || !column || !row_extents || !column_extents || !is_selected) |
| 1524 return E_INVALIDARG; | 1524 return E_INVALIDARG; |
| 1525 | 1525 |
| 1526 const std::vector<int32>& unique_cell_ids = GetIntListAttribute( | 1526 const std::vector<int32>& unique_cell_ids = GetIntListAttribute( |
| 1527 AccessibilityNodeData::ATTR_UNIQUE_CELL_IDS); | 1527 ui::AX_ATTR_UNIQUE_CELL_IDS); |
| 1528 int cell_id_count = static_cast<int>(unique_cell_ids.size()); | 1528 int cell_id_count = static_cast<int>(unique_cell_ids.size()); |
| 1529 if (index < 0) | 1529 if (index < 0) |
| 1530 return E_INVALIDARG; | 1530 return E_INVALIDARG; |
| 1531 if (index >= cell_id_count) | 1531 if (index >= cell_id_count) |
| 1532 return S_FALSE; | 1532 return S_FALSE; |
| 1533 | 1533 |
| 1534 int cell_id = unique_cell_ids[index]; | 1534 int cell_id = unique_cell_ids[index]; |
| 1535 BrowserAccessibilityWin* cell = | 1535 BrowserAccessibilityWin* cell = |
| 1536 manager()->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1536 manager()->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1537 int rowspan; | 1537 int rowspan; |
| 1538 int colspan; | 1538 int colspan; |
| 1539 if (cell && | 1539 if (cell && |
| 1540 cell->GetIntAttribute( | 1540 cell->GetIntAttribute( |
| 1541 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && | 1541 ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && |
| 1542 cell->GetIntAttribute( | 1542 cell->GetIntAttribute( |
| 1543 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && | 1543 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && |
| 1544 rowspan >= 1 && | 1544 rowspan >= 1 && |
| 1545 colspan >= 1) { | 1545 colspan >= 1) { |
| 1546 *row_extents = rowspan; | 1546 *row_extents = rowspan; |
| 1547 *column_extents = colspan; | 1547 *column_extents = colspan; |
| 1548 return S_OK; | 1548 return S_OK; |
| 1549 } | 1549 } |
| 1550 | 1550 |
| 1551 return S_FALSE; | 1551 return S_FALSE; |
| 1552 } | 1552 } |
| 1553 | 1553 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1613 STDMETHODIMP BrowserAccessibilityWin::get_columnExtent( | 1613 STDMETHODIMP BrowserAccessibilityWin::get_columnExtent( |
| 1614 long* n_columns_spanned) { | 1614 long* n_columns_spanned) { |
| 1615 if (!instance_active()) | 1615 if (!instance_active()) |
| 1616 return E_FAIL; | 1616 return E_FAIL; |
| 1617 | 1617 |
| 1618 if (!n_columns_spanned) | 1618 if (!n_columns_spanned) |
| 1619 return E_INVALIDARG; | 1619 return E_INVALIDARG; |
| 1620 | 1620 |
| 1621 int colspan; | 1621 int colspan; |
| 1622 if (GetIntAttribute( | 1622 if (GetIntAttribute( |
| 1623 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && | 1623 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && |
| 1624 colspan >= 1) { | 1624 colspan >= 1) { |
| 1625 *n_columns_spanned = colspan; | 1625 *n_columns_spanned = colspan; |
| 1626 return S_OK; | 1626 return S_OK; |
| 1627 } | 1627 } |
| 1628 | 1628 |
| 1629 return S_FALSE; | 1629 return S_FALSE; |
| 1630 } | 1630 } |
| 1631 | 1631 |
| 1632 STDMETHODIMP BrowserAccessibilityWin::get_columnHeaderCells( | 1632 STDMETHODIMP BrowserAccessibilityWin::get_columnHeaderCells( |
| 1633 IUnknown*** cell_accessibles, | 1633 IUnknown*** cell_accessibles, |
| 1634 long* n_column_header_cells) { | 1634 long* n_column_header_cells) { |
| 1635 if (!instance_active()) | 1635 if (!instance_active()) |
| 1636 return E_FAIL; | 1636 return E_FAIL; |
| 1637 | 1637 |
| 1638 if (!cell_accessibles || !n_column_header_cells) | 1638 if (!cell_accessibles || !n_column_header_cells) |
| 1639 return E_INVALIDARG; | 1639 return E_INVALIDARG; |
| 1640 | 1640 |
| 1641 *n_column_header_cells = 0; | 1641 *n_column_header_cells = 0; |
| 1642 | 1642 |
| 1643 int column; | 1643 int column; |
| 1644 if (!GetIntAttribute( | 1644 if (!GetIntAttribute( |
| 1645 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { | 1645 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { |
| 1646 return S_FALSE; | 1646 return S_FALSE; |
| 1647 } | 1647 } |
| 1648 | 1648 |
| 1649 BrowserAccessibility* table = parent(); | 1649 BrowserAccessibility* table = parent(); |
| 1650 while (table && table->role() != blink::WebAXRoleTable) | 1650 while (table && table->role() != ui::AX_ROLE_TABLE) |
| 1651 table = table->parent(); | 1651 table = table->parent(); |
| 1652 if (!table) { | 1652 if (!table) { |
| 1653 NOTREACHED(); | 1653 NOTREACHED(); |
| 1654 return S_FALSE; | 1654 return S_FALSE; |
| 1655 } | 1655 } |
| 1656 | 1656 |
| 1657 int columns; | 1657 int columns; |
| 1658 int rows; | 1658 int rows; |
| 1659 if (!table->GetIntAttribute( | 1659 if (!table->GetIntAttribute( |
| 1660 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1660 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1661 !table->GetIntAttribute( | 1661 !table->GetIntAttribute( |
| 1662 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows)) { | 1662 ui::AX_ATTR_TABLE_ROW_COUNT, &rows)) { |
| 1663 return S_FALSE; | 1663 return S_FALSE; |
| 1664 } | 1664 } |
| 1665 if (columns <= 0 || rows <= 0 || column < 0 || column >= columns) | 1665 if (columns <= 0 || rows <= 0 || column < 0 || column >= columns) |
| 1666 return S_FALSE; | 1666 return S_FALSE; |
| 1667 | 1667 |
| 1668 const std::vector<int32>& cell_ids = table->GetIntListAttribute( | 1668 const std::vector<int32>& cell_ids = table->GetIntListAttribute( |
| 1669 AccessibilityNodeData::ATTR_CELL_IDS); | 1669 ui::AX_ATTR_CELL_IDS); |
| 1670 | 1670 |
| 1671 for (int i = 0; i < rows; ++i) { | 1671 for (int i = 0; i < rows; ++i) { |
| 1672 int cell_id = cell_ids[i * columns + column]; | 1672 int cell_id = cell_ids[i * columns + column]; |
| 1673 BrowserAccessibilityWin* cell = | 1673 BrowserAccessibilityWin* cell = |
| 1674 manager()->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1674 manager()->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1675 if (cell && cell->blink_role() == blink::WebAXRoleColumnHeader) | 1675 if (cell && cell->blink_role() == ui::AX_ROLE_COLUMN_HEADER) |
| 1676 (*n_column_header_cells)++; | 1676 (*n_column_header_cells)++; |
| 1677 } | 1677 } |
| 1678 | 1678 |
| 1679 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( | 1679 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( |
| 1680 (*n_column_header_cells) * sizeof(cell_accessibles[0]))); | 1680 (*n_column_header_cells) * sizeof(cell_accessibles[0]))); |
| 1681 int index = 0; | 1681 int index = 0; |
| 1682 for (int i = 0; i < rows; ++i) { | 1682 for (int i = 0; i < rows; ++i) { |
| 1683 int cell_id = cell_ids[i * columns + column]; | 1683 int cell_id = cell_ids[i * columns + column]; |
| 1684 BrowserAccessibility* cell = manager()->GetFromRendererID(cell_id); | 1684 BrowserAccessibility* cell = manager()->GetFromRendererID(cell_id); |
| 1685 if (cell && cell->role() == blink::WebAXRoleColumnHeader) { | 1685 if (cell && cell->role() == ui::AX_ROLE_COLUMN_HEADER) { |
| 1686 (*cell_accessibles)[index] = static_cast<IAccessible*>( | 1686 (*cell_accessibles)[index] = static_cast<IAccessible*>( |
| 1687 cell->ToBrowserAccessibilityWin()->NewReference()); | 1687 cell->ToBrowserAccessibilityWin()->NewReference()); |
| 1688 ++index; | 1688 ++index; |
| 1689 } | 1689 } |
| 1690 } | 1690 } |
| 1691 | 1691 |
| 1692 return S_OK; | 1692 return S_OK; |
| 1693 } | 1693 } |
| 1694 | 1694 |
| 1695 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long* column_index) { | 1695 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long* column_index) { |
| 1696 if (!instance_active()) | 1696 if (!instance_active()) |
| 1697 return E_FAIL; | 1697 return E_FAIL; |
| 1698 | 1698 |
| 1699 if (!column_index) | 1699 if (!column_index) |
| 1700 return E_INVALIDARG; | 1700 return E_INVALIDARG; |
| 1701 | 1701 |
| 1702 int column; | 1702 int column; |
| 1703 if (GetIntAttribute( | 1703 if (GetIntAttribute( |
| 1704 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { | 1704 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { |
| 1705 *column_index = column; | 1705 *column_index = column; |
| 1706 return S_OK; | 1706 return S_OK; |
| 1707 } | 1707 } |
| 1708 | 1708 |
| 1709 return S_FALSE; | 1709 return S_FALSE; |
| 1710 } | 1710 } |
| 1711 | 1711 |
| 1712 STDMETHODIMP BrowserAccessibilityWin::get_rowExtent(long* n_rows_spanned) { | 1712 STDMETHODIMP BrowserAccessibilityWin::get_rowExtent(long* n_rows_spanned) { |
| 1713 if (!instance_active()) | 1713 if (!instance_active()) |
| 1714 return E_FAIL; | 1714 return E_FAIL; |
| 1715 | 1715 |
| 1716 if (!n_rows_spanned) | 1716 if (!n_rows_spanned) |
| 1717 return E_INVALIDARG; | 1717 return E_INVALIDARG; |
| 1718 | 1718 |
| 1719 int rowspan; | 1719 int rowspan; |
| 1720 if (GetIntAttribute( | 1720 if (GetIntAttribute( |
| 1721 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && | 1721 ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && |
| 1722 rowspan >= 1) { | 1722 rowspan >= 1) { |
| 1723 *n_rows_spanned = rowspan; | 1723 *n_rows_spanned = rowspan; |
| 1724 return S_OK; | 1724 return S_OK; |
| 1725 } | 1725 } |
| 1726 | 1726 |
| 1727 return S_FALSE; | 1727 return S_FALSE; |
| 1728 } | 1728 } |
| 1729 | 1729 |
| 1730 STDMETHODIMP BrowserAccessibilityWin::get_rowHeaderCells( | 1730 STDMETHODIMP BrowserAccessibilityWin::get_rowHeaderCells( |
| 1731 IUnknown*** cell_accessibles, | 1731 IUnknown*** cell_accessibles, |
| 1732 long* n_row_header_cells) { | 1732 long* n_row_header_cells) { |
| 1733 if (!instance_active()) | 1733 if (!instance_active()) |
| 1734 return E_FAIL; | 1734 return E_FAIL; |
| 1735 | 1735 |
| 1736 if (!cell_accessibles || !n_row_header_cells) | 1736 if (!cell_accessibles || !n_row_header_cells) |
| 1737 return E_INVALIDARG; | 1737 return E_INVALIDARG; |
| 1738 | 1738 |
| 1739 *n_row_header_cells = 0; | 1739 *n_row_header_cells = 0; |
| 1740 | 1740 |
| 1741 int row; | 1741 int row; |
| 1742 if (!GetIntAttribute( | 1742 if (!GetIntAttribute( |
| 1743 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &row)) { | 1743 ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row)) { |
| 1744 return S_FALSE; | 1744 return S_FALSE; |
| 1745 } | 1745 } |
| 1746 | 1746 |
| 1747 BrowserAccessibility* table = parent(); | 1747 BrowserAccessibility* table = parent(); |
| 1748 while (table && table->role() != blink::WebAXRoleTable) | 1748 while (table && table->role() != ui::AX_ROLE_TABLE) |
| 1749 table = table->parent(); | 1749 table = table->parent(); |
| 1750 if (!table) { | 1750 if (!table) { |
| 1751 NOTREACHED(); | 1751 NOTREACHED(); |
| 1752 return S_FALSE; | 1752 return S_FALSE; |
| 1753 } | 1753 } |
| 1754 | 1754 |
| 1755 int columns; | 1755 int columns; |
| 1756 int rows; | 1756 int rows; |
| 1757 if (!table->GetIntAttribute( | 1757 if (!table->GetIntAttribute( |
| 1758 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1758 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1759 !table->GetIntAttribute( | 1759 !table->GetIntAttribute( |
| 1760 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows)) { | 1760 ui::AX_ATTR_TABLE_ROW_COUNT, &rows)) { |
| 1761 return S_FALSE; | 1761 return S_FALSE; |
| 1762 } | 1762 } |
| 1763 if (columns <= 0 || rows <= 0 || row < 0 || row >= rows) | 1763 if (columns <= 0 || rows <= 0 || row < 0 || row >= rows) |
| 1764 return S_FALSE; | 1764 return S_FALSE; |
| 1765 | 1765 |
| 1766 const std::vector<int32>& cell_ids = table->GetIntListAttribute( | 1766 const std::vector<int32>& cell_ids = table->GetIntListAttribute( |
| 1767 AccessibilityNodeData::ATTR_CELL_IDS); | 1767 ui::AX_ATTR_CELL_IDS); |
| 1768 | 1768 |
| 1769 for (int i = 0; i < columns; ++i) { | 1769 for (int i = 0; i < columns; ++i) { |
| 1770 int cell_id = cell_ids[row * columns + i]; | 1770 int cell_id = cell_ids[row * columns + i]; |
| 1771 BrowserAccessibility* cell = manager()->GetFromRendererID(cell_id); | 1771 BrowserAccessibility* cell = manager()->GetFromRendererID(cell_id); |
| 1772 if (cell && cell->role() == blink::WebAXRoleRowHeader) | 1772 if (cell && cell->role() == ui::AX_ROLE_ROW_HEADER) |
| 1773 (*n_row_header_cells)++; | 1773 (*n_row_header_cells)++; |
| 1774 } | 1774 } |
| 1775 | 1775 |
| 1776 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( | 1776 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( |
| 1777 (*n_row_header_cells) * sizeof(cell_accessibles[0]))); | 1777 (*n_row_header_cells) * sizeof(cell_accessibles[0]))); |
| 1778 int index = 0; | 1778 int index = 0; |
| 1779 for (int i = 0; i < columns; ++i) { | 1779 for (int i = 0; i < columns; ++i) { |
| 1780 int cell_id = cell_ids[row * columns + i]; | 1780 int cell_id = cell_ids[row * columns + i]; |
| 1781 BrowserAccessibility* cell = manager()->GetFromRendererID(cell_id); | 1781 BrowserAccessibility* cell = manager()->GetFromRendererID(cell_id); |
| 1782 if (cell && cell->role() == blink::WebAXRoleRowHeader) { | 1782 if (cell && cell->role() == ui::AX_ROLE_ROW_HEADER) { |
| 1783 (*cell_accessibles)[index] = static_cast<IAccessible*>( | 1783 (*cell_accessibles)[index] = static_cast<IAccessible*>( |
| 1784 cell->ToBrowserAccessibilityWin()->NewReference()); | 1784 cell->ToBrowserAccessibilityWin()->NewReference()); |
| 1785 ++index; | 1785 ++index; |
| 1786 } | 1786 } |
| 1787 } | 1787 } |
| 1788 | 1788 |
| 1789 return S_OK; | 1789 return S_OK; |
| 1790 } | 1790 } |
| 1791 | 1791 |
| 1792 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long* row_index) { | 1792 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long* row_index) { |
| 1793 if (!instance_active()) | 1793 if (!instance_active()) |
| 1794 return E_FAIL; | 1794 return E_FAIL; |
| 1795 | 1795 |
| 1796 if (!row_index) | 1796 if (!row_index) |
| 1797 return E_INVALIDARG; | 1797 return E_INVALIDARG; |
| 1798 | 1798 |
| 1799 int row; | 1799 int row; |
| 1800 if (GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &row)) { | 1800 if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row)) { |
| 1801 *row_index = row; | 1801 *row_index = row; |
| 1802 return S_OK; | 1802 return S_OK; |
| 1803 } | 1803 } |
| 1804 return S_FALSE; | 1804 return S_FALSE; |
| 1805 } | 1805 } |
| 1806 | 1806 |
| 1807 STDMETHODIMP BrowserAccessibilityWin::get_isSelected(boolean* is_selected) { | 1807 STDMETHODIMP BrowserAccessibilityWin::get_isSelected(boolean* is_selected) { |
| 1808 if (!instance_active()) | 1808 if (!instance_active()) |
| 1809 return E_FAIL; | 1809 return E_FAIL; |
| 1810 | 1810 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1829 !row_extents || | 1829 !row_extents || |
| 1830 !column_extents || | 1830 !column_extents || |
| 1831 !is_selected) { | 1831 !is_selected) { |
| 1832 return E_INVALIDARG; | 1832 return E_INVALIDARG; |
| 1833 } | 1833 } |
| 1834 | 1834 |
| 1835 int row; | 1835 int row; |
| 1836 int column; | 1836 int column; |
| 1837 int rowspan; | 1837 int rowspan; |
| 1838 int colspan; | 1838 int colspan; |
| 1839 if (GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &row) && | 1839 if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row) && |
| 1840 GetIntAttribute( | 1840 GetIntAttribute( |
| 1841 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &column) && | 1841 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &column) && |
| 1842 GetIntAttribute( | 1842 GetIntAttribute( |
| 1843 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && | 1843 ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && |
| 1844 GetIntAttribute( | 1844 GetIntAttribute( |
| 1845 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_SPAN, &colspan)) { | 1845 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, &colspan)) { |
| 1846 *row_index = row; | 1846 *row_index = row; |
| 1847 *column_index = column; | 1847 *column_index = column; |
| 1848 *row_extents = rowspan; | 1848 *row_extents = rowspan; |
| 1849 *column_extents = colspan; | 1849 *column_extents = colspan; |
| 1850 *is_selected = false; | 1850 *is_selected = false; |
| 1851 return S_OK; | 1851 return S_OK; |
| 1852 } | 1852 } |
| 1853 | 1853 |
| 1854 return S_FALSE; | 1854 return S_FALSE; |
| 1855 } | 1855 } |
| 1856 | 1856 |
| 1857 STDMETHODIMP BrowserAccessibilityWin::get_table(IUnknown** table) { | 1857 STDMETHODIMP BrowserAccessibilityWin::get_table(IUnknown** table) { |
| 1858 if (!instance_active()) | 1858 if (!instance_active()) |
| 1859 return E_FAIL; | 1859 return E_FAIL; |
| 1860 | 1860 |
| 1861 if (!table) | 1861 if (!table) |
| 1862 return E_INVALIDARG; | 1862 return E_INVALIDARG; |
| 1863 | 1863 |
| 1864 | 1864 |
| 1865 int row; | 1865 int row; |
| 1866 int column; | 1866 int column; |
| 1867 GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &row); | 1867 GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row); |
| 1868 GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &column); | 1868 GetIntAttribute(ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &column); |
| 1869 | 1869 |
| 1870 BrowserAccessibility* find_table = parent(); | 1870 BrowserAccessibility* find_table = parent(); |
| 1871 while (find_table && find_table->role() != blink::WebAXRoleTable) | 1871 while (find_table && find_table->role() != ui::AX_ROLE_TABLE) |
| 1872 find_table = find_table->parent(); | 1872 find_table = find_table->parent(); |
| 1873 if (!find_table) { | 1873 if (!find_table) { |
| 1874 NOTREACHED(); | 1874 NOTREACHED(); |
| 1875 return S_FALSE; | 1875 return S_FALSE; |
| 1876 } | 1876 } |
| 1877 | 1877 |
| 1878 *table = static_cast<IAccessibleTable*>( | 1878 *table = static_cast<IAccessibleTable*>( |
| 1879 find_table->ToBrowserAccessibilityWin()->NewReference()); | 1879 find_table->ToBrowserAccessibilityWin()->NewReference()); |
| 1880 | 1880 |
| 1881 return S_OK; | 1881 return S_OK; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1897 } | 1897 } |
| 1898 | 1898 |
| 1899 STDMETHODIMP BrowserAccessibilityWin::get_caretOffset(LONG* offset) { | 1899 STDMETHODIMP BrowserAccessibilityWin::get_caretOffset(LONG* offset) { |
| 1900 if (!instance_active()) | 1900 if (!instance_active()) |
| 1901 return E_FAIL; | 1901 return E_FAIL; |
| 1902 | 1902 |
| 1903 if (!offset) | 1903 if (!offset) |
| 1904 return E_INVALIDARG; | 1904 return E_INVALIDARG; |
| 1905 | 1905 |
| 1906 *offset = 0; | 1906 *offset = 0; |
| 1907 if (blink_role() == blink::WebAXRoleTextField || | 1907 if (blink_role() == ui::AX_ROLE_TEXT_FIELD || |
| 1908 blink_role() == blink::WebAXRoleTextArea) { | 1908 blink_role() == ui::AX_ROLE_TEXT_AREA) { |
| 1909 int sel_start = 0; | 1909 int sel_start = 0; |
| 1910 if (GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_START, | 1910 if (GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, |
| 1911 &sel_start)) | 1911 &sel_start)) |
| 1912 *offset = sel_start; | 1912 *offset = sel_start; |
| 1913 } | 1913 } |
| 1914 | 1914 |
| 1915 return S_OK; | 1915 return S_OK; |
| 1916 } | 1916 } |
| 1917 | 1917 |
| 1918 STDMETHODIMP BrowserAccessibilityWin::get_characterExtents( | 1918 STDMETHODIMP BrowserAccessibilityWin::get_characterExtents( |
| 1919 LONG offset, | 1919 LONG offset, |
| 1920 enum IA2CoordinateType coordinate_type, | 1920 enum IA2CoordinateType coordinate_type, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 } | 1953 } |
| 1954 | 1954 |
| 1955 STDMETHODIMP BrowserAccessibilityWin::get_nSelections(LONG* n_selections) { | 1955 STDMETHODIMP BrowserAccessibilityWin::get_nSelections(LONG* n_selections) { |
| 1956 if (!instance_active()) | 1956 if (!instance_active()) |
| 1957 return E_FAIL; | 1957 return E_FAIL; |
| 1958 | 1958 |
| 1959 if (!n_selections) | 1959 if (!n_selections) |
| 1960 return E_INVALIDARG; | 1960 return E_INVALIDARG; |
| 1961 | 1961 |
| 1962 *n_selections = 0; | 1962 *n_selections = 0; |
| 1963 if (blink_role() == blink::WebAXRoleTextField || | 1963 if (blink_role() == ui::AX_ROLE_TEXT_FIELD || |
| 1964 blink_role() == blink::WebAXRoleTextArea) { | 1964 blink_role() == ui::AX_ROLE_TEXT_AREA) { |
| 1965 int sel_start = 0; | 1965 int sel_start = 0; |
| 1966 int sel_end = 0; | 1966 int sel_end = 0; |
| 1967 if (GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_START, | 1967 if (GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, |
| 1968 &sel_start) && | 1968 &sel_start) && |
| 1969 GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_END, &sel_end) && | 1969 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, &sel_end) && |
| 1970 sel_start != sel_end) | 1970 sel_start != sel_end) |
| 1971 *n_selections = 1; | 1971 *n_selections = 1; |
| 1972 } | 1972 } |
| 1973 | 1973 |
| 1974 return S_OK; | 1974 return S_OK; |
| 1975 } | 1975 } |
| 1976 | 1976 |
| 1977 STDMETHODIMP BrowserAccessibilityWin::get_selection(LONG selection_index, | 1977 STDMETHODIMP BrowserAccessibilityWin::get_selection(LONG selection_index, |
| 1978 LONG* start_offset, | 1978 LONG* start_offset, |
| 1979 LONG* end_offset) { | 1979 LONG* end_offset) { |
| 1980 if (!instance_active()) | 1980 if (!instance_active()) |
| 1981 return E_FAIL; | 1981 return E_FAIL; |
| 1982 | 1982 |
| 1983 if (!start_offset || !end_offset || selection_index != 0) | 1983 if (!start_offset || !end_offset || selection_index != 0) |
| 1984 return E_INVALIDARG; | 1984 return E_INVALIDARG; |
| 1985 | 1985 |
| 1986 *start_offset = 0; | 1986 *start_offset = 0; |
| 1987 *end_offset = 0; | 1987 *end_offset = 0; |
| 1988 if (blink_role() == blink::WebAXRoleTextField || | 1988 if (blink_role() == ui::AX_ROLE_TEXT_FIELD || |
| 1989 blink_role() == blink::WebAXRoleTextArea) { | 1989 blink_role() == ui::AX_ROLE_TEXT_AREA) { |
| 1990 int sel_start = 0; | 1990 int sel_start = 0; |
| 1991 int sel_end = 0; | 1991 int sel_end = 0; |
| 1992 if (GetIntAttribute( | 1992 if (GetIntAttribute( |
| 1993 AccessibilityNodeData::ATTR_TEXT_SEL_START, &sel_start) && | 1993 ui::AX_ATTR_TEXT_SEL_START, &sel_start) && |
| 1994 GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_END, &sel_end)) { | 1994 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, &sel_end)) { |
| 1995 *start_offset = sel_start; | 1995 *start_offset = sel_start; |
| 1996 *end_offset = sel_end; | 1996 *end_offset = sel_end; |
| 1997 } | 1997 } |
| 1998 } | 1998 } |
| 1999 | 1999 |
| 2000 return S_OK; | 2000 return S_OK; |
| 2001 } | 2001 } |
| 2002 | 2002 |
| 2003 STDMETHODIMP BrowserAccessibilityWin::get_text(LONG start_offset, | 2003 STDMETHODIMP BrowserAccessibilityWin::get_text(LONG start_offset, |
| 2004 LONG end_offset, | 2004 LONG end_offset, |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2304 | 2304 |
| 2305 STDMETHODIMP BrowserAccessibilityWin::get_currentValue(VARIANT* value) { | 2305 STDMETHODIMP BrowserAccessibilityWin::get_currentValue(VARIANT* value) { |
| 2306 if (!instance_active()) | 2306 if (!instance_active()) |
| 2307 return E_FAIL; | 2307 return E_FAIL; |
| 2308 | 2308 |
| 2309 if (!value) | 2309 if (!value) |
| 2310 return E_INVALIDARG; | 2310 return E_INVALIDARG; |
| 2311 | 2311 |
| 2312 float float_val; | 2312 float float_val; |
| 2313 if (GetFloatAttribute( | 2313 if (GetFloatAttribute( |
| 2314 AccessibilityNodeData::ATTR_VALUE_FOR_RANGE, &float_val)) { | 2314 ui::AX_ATTR_VALUE_FOR_RANGE, &float_val)) { |
| 2315 value->vt = VT_R8; | 2315 value->vt = VT_R8; |
| 2316 value->dblVal = float_val; | 2316 value->dblVal = float_val; |
| 2317 return S_OK; | 2317 return S_OK; |
| 2318 } | 2318 } |
| 2319 | 2319 |
| 2320 value->vt = VT_EMPTY; | 2320 value->vt = VT_EMPTY; |
| 2321 return S_FALSE; | 2321 return S_FALSE; |
| 2322 } | 2322 } |
| 2323 | 2323 |
| 2324 STDMETHODIMP BrowserAccessibilityWin::get_minimumValue(VARIANT* value) { | 2324 STDMETHODIMP BrowserAccessibilityWin::get_minimumValue(VARIANT* value) { |
| 2325 if (!instance_active()) | 2325 if (!instance_active()) |
| 2326 return E_FAIL; | 2326 return E_FAIL; |
| 2327 | 2327 |
| 2328 if (!value) | 2328 if (!value) |
| 2329 return E_INVALIDARG; | 2329 return E_INVALIDARG; |
| 2330 | 2330 |
| 2331 float float_val; | 2331 float float_val; |
| 2332 if (GetFloatAttribute(AccessibilityNodeData::ATTR_MIN_VALUE_FOR_RANGE, | 2332 if (GetFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE, |
| 2333 &float_val)) { | 2333 &float_val)) { |
| 2334 value->vt = VT_R8; | 2334 value->vt = VT_R8; |
| 2335 value->dblVal = float_val; | 2335 value->dblVal = float_val; |
| 2336 return S_OK; | 2336 return S_OK; |
| 2337 } | 2337 } |
| 2338 | 2338 |
| 2339 value->vt = VT_EMPTY; | 2339 value->vt = VT_EMPTY; |
| 2340 return S_FALSE; | 2340 return S_FALSE; |
| 2341 } | 2341 } |
| 2342 | 2342 |
| 2343 STDMETHODIMP BrowserAccessibilityWin::get_maximumValue(VARIANT* value) { | 2343 STDMETHODIMP BrowserAccessibilityWin::get_maximumValue(VARIANT* value) { |
| 2344 if (!instance_active()) | 2344 if (!instance_active()) |
| 2345 return E_FAIL; | 2345 return E_FAIL; |
| 2346 | 2346 |
| 2347 if (!value) | 2347 if (!value) |
| 2348 return E_INVALIDARG; | 2348 return E_INVALIDARG; |
| 2349 | 2349 |
| 2350 float float_val; | 2350 float float_val; |
| 2351 if (GetFloatAttribute(AccessibilityNodeData::ATTR_MAX_VALUE_FOR_RANGE, | 2351 if (GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, |
| 2352 &float_val)) { | 2352 &float_val)) { |
| 2353 value->vt = VT_R8; | 2353 value->vt = VT_R8; |
| 2354 value->dblVal = float_val; | 2354 value->dblVal = float_val; |
| 2355 return S_OK; | 2355 return S_OK; |
| 2356 } | 2356 } |
| 2357 | 2357 |
| 2358 value->vt = VT_EMPTY; | 2358 value->vt = VT_EMPTY; |
| 2359 return S_FALSE; | 2359 return S_FALSE; |
| 2360 } | 2360 } |
| 2361 | 2361 |
| 2362 STDMETHODIMP BrowserAccessibilityWin::setCurrentValue(VARIANT new_value) { | 2362 STDMETHODIMP BrowserAccessibilityWin::setCurrentValue(VARIANT new_value) { |
| 2363 // TODO(dmazzoni): Implement this. | 2363 // TODO(dmazzoni): Implement this. |
| 2364 return E_NOTIMPL; | 2364 return E_NOTIMPL; |
| 2365 } | 2365 } |
| 2366 | 2366 |
| 2367 // | 2367 // |
| 2368 // ISimpleDOMDocument methods. | 2368 // ISimpleDOMDocument methods. |
| 2369 // | 2369 // |
| 2370 | 2370 |
| 2371 STDMETHODIMP BrowserAccessibilityWin::get_URL(BSTR* url) { | 2371 STDMETHODIMP BrowserAccessibilityWin::get_URL(BSTR* url) { |
| 2372 if (!instance_active()) | 2372 if (!instance_active()) |
| 2373 return E_FAIL; | 2373 return E_FAIL; |
| 2374 | 2374 |
| 2375 if (!url) | 2375 if (!url) |
| 2376 return E_INVALIDARG; | 2376 return E_INVALIDARG; |
| 2377 | 2377 |
| 2378 return GetStringAttributeAsBstr(AccessibilityNodeData::ATTR_DOC_URL, url); | 2378 return GetStringAttributeAsBstr(ui::AX_ATTR_DOC_URL, url); |
| 2379 } | 2379 } |
| 2380 | 2380 |
| 2381 STDMETHODIMP BrowserAccessibilityWin::get_title(BSTR* title) { | 2381 STDMETHODIMP BrowserAccessibilityWin::get_title(BSTR* title) { |
| 2382 if (!instance_active()) | 2382 if (!instance_active()) |
| 2383 return E_FAIL; | 2383 return E_FAIL; |
| 2384 | 2384 |
| 2385 if (!title) | 2385 if (!title) |
| 2386 return E_INVALIDARG; | 2386 return E_INVALIDARG; |
| 2387 | 2387 |
| 2388 return GetStringAttributeAsBstr(AccessibilityNodeData::ATTR_DOC_TITLE, title); | 2388 return GetStringAttributeAsBstr(ui::AX_ATTR_DOC_TITLE, title); |
| 2389 } | 2389 } |
| 2390 | 2390 |
| 2391 STDMETHODIMP BrowserAccessibilityWin::get_mimeType(BSTR* mime_type) { | 2391 STDMETHODIMP BrowserAccessibilityWin::get_mimeType(BSTR* mime_type) { |
| 2392 if (!instance_active()) | 2392 if (!instance_active()) |
| 2393 return E_FAIL; | 2393 return E_FAIL; |
| 2394 | 2394 |
| 2395 if (!mime_type) | 2395 if (!mime_type) |
| 2396 return E_INVALIDARG; | 2396 return E_INVALIDARG; |
| 2397 | 2397 |
| 2398 return GetStringAttributeAsBstr( | 2398 return GetStringAttributeAsBstr( |
| 2399 AccessibilityNodeData::ATTR_DOC_MIMETYPE, mime_type); | 2399 ui::AX_ATTR_DOC_MIMETYPE, mime_type); |
| 2400 } | 2400 } |
| 2401 | 2401 |
| 2402 STDMETHODIMP BrowserAccessibilityWin::get_docType(BSTR* doc_type) { | 2402 STDMETHODIMP BrowserAccessibilityWin::get_docType(BSTR* doc_type) { |
| 2403 if (!instance_active()) | 2403 if (!instance_active()) |
| 2404 return E_FAIL; | 2404 return E_FAIL; |
| 2405 | 2405 |
| 2406 if (!doc_type) | 2406 if (!doc_type) |
| 2407 return E_INVALIDARG; | 2407 return E_INVALIDARG; |
| 2408 | 2408 |
| 2409 return GetStringAttributeAsBstr( | 2409 return GetStringAttributeAsBstr( |
| 2410 AccessibilityNodeData::ATTR_DOC_DOCTYPE, doc_type); | 2410 ui::AX_ATTR_DOC_DOCTYPE, doc_type); |
| 2411 } | 2411 } |
| 2412 | 2412 |
| 2413 // | 2413 // |
| 2414 // ISimpleDOMNode methods. | 2414 // ISimpleDOMNode methods. |
| 2415 // | 2415 // |
| 2416 | 2416 |
| 2417 STDMETHODIMP BrowserAccessibilityWin::get_nodeInfo( | 2417 STDMETHODIMP BrowserAccessibilityWin::get_nodeInfo( |
| 2418 BSTR* node_name, | 2418 BSTR* node_name, |
| 2419 short* name_space_id, | 2419 short* name_space_id, |
| 2420 BSTR* node_value, | 2420 BSTR* node_value, |
| 2421 unsigned int* num_children, | 2421 unsigned int* num_children, |
| 2422 unsigned int* unique_id, | 2422 unsigned int* unique_id, |
| 2423 unsigned short* node_type) { | 2423 unsigned short* node_type) { |
| 2424 if (!instance_active()) | 2424 if (!instance_active()) |
| 2425 return E_FAIL; | 2425 return E_FAIL; |
| 2426 | 2426 |
| 2427 if (!node_name || !name_space_id || !node_value || !num_children || | 2427 if (!node_name || !name_space_id || !node_value || !num_children || |
| 2428 !unique_id || !node_type) { | 2428 !unique_id || !node_type) { |
| 2429 return E_INVALIDARG; | 2429 return E_INVALIDARG; |
| 2430 } | 2430 } |
| 2431 | 2431 |
| 2432 base::string16 tag; | 2432 base::string16 tag; |
| 2433 if (GetString16Attribute(AccessibilityNodeData::ATTR_HTML_TAG, &tag)) | 2433 if (GetString16Attribute(ui::AX_ATTR_HTML_TAG, &tag)) |
| 2434 *node_name = SysAllocString(tag.c_str()); | 2434 *node_name = SysAllocString(tag.c_str()); |
| 2435 else | 2435 else |
| 2436 *node_name = NULL; | 2436 *node_name = NULL; |
| 2437 | 2437 |
| 2438 *name_space_id = 0; | 2438 *name_space_id = 0; |
| 2439 *node_value = SysAllocString(base::UTF8ToUTF16(value()).c_str()); | 2439 *node_value = SysAllocString(base::UTF8ToUTF16(value()).c_str()); |
| 2440 *num_children = PlatformChildCount(); | 2440 *num_children = PlatformChildCount(); |
| 2441 *unique_id = unique_id_win_; | 2441 *unique_id = unique_id_win_; |
| 2442 | 2442 |
| 2443 if (ia_role_ == ROLE_SYSTEM_DOCUMENT) { | 2443 if (ia_role_ == ROLE_SYSTEM_DOCUMENT) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2517 if (!instance_active()) | 2517 if (!instance_active()) |
| 2518 return E_FAIL; | 2518 return E_FAIL; |
| 2519 | 2519 |
| 2520 if (!style_properties || !style_values) | 2520 if (!style_properties || !style_values) |
| 2521 return E_INVALIDARG; | 2521 return E_INVALIDARG; |
| 2522 | 2522 |
| 2523 // We only cache a single style property for now: DISPLAY | 2523 // We only cache a single style property for now: DISPLAY |
| 2524 | 2524 |
| 2525 base::string16 display; | 2525 base::string16 display; |
| 2526 if (max_style_properties == 0 || | 2526 if (max_style_properties == 0 || |
| 2527 !GetString16Attribute(AccessibilityNodeData::ATTR_DISPLAY, &display)) { | 2527 !GetString16Attribute(ui::AX_ATTR_DISPLAY, &display)) { |
| 2528 *num_style_properties = 0; | 2528 *num_style_properties = 0; |
| 2529 return S_OK; | 2529 return S_OK; |
| 2530 } | 2530 } |
| 2531 | 2531 |
| 2532 *num_style_properties = 1; | 2532 *num_style_properties = 1; |
| 2533 style_properties[0] = SysAllocString(L"display"); | 2533 style_properties[0] = SysAllocString(L"display"); |
| 2534 style_values[0] = SysAllocString(display.c_str()); | 2534 style_values[0] = SysAllocString(display.c_str()); |
| 2535 | 2535 |
| 2536 return S_OK; | 2536 return S_OK; |
| 2537 } | 2537 } |
| 2538 | 2538 |
| 2539 STDMETHODIMP BrowserAccessibilityWin::get_computedStyleForProperties( | 2539 STDMETHODIMP BrowserAccessibilityWin::get_computedStyleForProperties( |
| 2540 unsigned short num_style_properties, | 2540 unsigned short num_style_properties, |
| 2541 boolean use_alternate_view, | 2541 boolean use_alternate_view, |
| 2542 BSTR* style_properties, | 2542 BSTR* style_properties, |
| 2543 BSTR* style_values) { | 2543 BSTR* style_values) { |
| 2544 if (!instance_active()) | 2544 if (!instance_active()) |
| 2545 return E_FAIL; | 2545 return E_FAIL; |
| 2546 | 2546 |
| 2547 if (!style_properties || !style_values) | 2547 if (!style_properties || !style_values) |
| 2548 return E_INVALIDARG; | 2548 return E_INVALIDARG; |
| 2549 | 2549 |
| 2550 // We only cache a single style property for now: DISPLAY | 2550 // We only cache a single style property for now: DISPLAY |
| 2551 | 2551 |
| 2552 for (unsigned short i = 0; i < num_style_properties; ++i) { | 2552 for (unsigned short i = 0; i < num_style_properties; ++i) { |
| 2553 base::string16 name = (LPCWSTR)style_properties[i]; | 2553 base::string16 name = (LPCWSTR)style_properties[i]; |
| 2554 StringToLowerASCII(&name); | 2554 StringToLowerASCII(&name); |
| 2555 if (name == L"display") { | 2555 if (name == L"display") { |
| 2556 base::string16 display = GetString16Attribute( | 2556 base::string16 display = GetString16Attribute( |
| 2557 AccessibilityNodeData::ATTR_DISPLAY); | 2557 ui::AX_ATTR_DISPLAY); |
| 2558 style_values[i] = SysAllocString(display.c_str()); | 2558 style_values[i] = SysAllocString(display.c_str()); |
| 2559 } else { | 2559 } else { |
| 2560 style_values[i] = NULL; | 2560 style_values[i] = NULL; |
| 2561 } | 2561 } |
| 2562 } | 2562 } |
| 2563 | 2563 |
| 2564 return S_OK; | 2564 return S_OK; |
| 2565 } | 2565 } |
| 2566 | 2566 |
| 2567 STDMETHODIMP BrowserAccessibilityWin::scrollTo(boolean placeTopLeft) { | 2567 STDMETHODIMP BrowserAccessibilityWin::scrollTo(boolean placeTopLeft) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2677 // | 2677 // |
| 2678 | 2678 |
| 2679 STDMETHODIMP BrowserAccessibilityWin::get_domText(BSTR* dom_text) { | 2679 STDMETHODIMP BrowserAccessibilityWin::get_domText(BSTR* dom_text) { |
| 2680 if (!instance_active()) | 2680 if (!instance_active()) |
| 2681 return E_FAIL; | 2681 return E_FAIL; |
| 2682 | 2682 |
| 2683 if (!dom_text) | 2683 if (!dom_text) |
| 2684 return E_INVALIDARG; | 2684 return E_INVALIDARG; |
| 2685 | 2685 |
| 2686 return GetStringAttributeAsBstr( | 2686 return GetStringAttributeAsBstr( |
| 2687 AccessibilityNodeData::ATTR_NAME, dom_text); | 2687 ui::AX_ATTR_NAME, dom_text); |
| 2688 } | 2688 } |
| 2689 | 2689 |
| 2690 STDMETHODIMP BrowserAccessibilityWin::get_clippedSubstringBounds( | 2690 STDMETHODIMP BrowserAccessibilityWin::get_clippedSubstringBounds( |
| 2691 unsigned int start_index, | 2691 unsigned int start_index, |
| 2692 unsigned int end_index, | 2692 unsigned int end_index, |
| 2693 int* out_x, | 2693 int* out_x, |
| 2694 int* out_y, | 2694 int* out_y, |
| 2695 int* out_width, | 2695 int* out_width, |
| 2696 int* out_height) { | 2696 int* out_height) { |
| 2697 // TODO(dmazzoni): fully support this API by intersecting the | 2697 // TODO(dmazzoni): fully support this API by intersecting the |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2891 // Private methods. | 2891 // Private methods. |
| 2892 // | 2892 // |
| 2893 | 2893 |
| 2894 // Initialize this object and mark it as active. | 2894 // Initialize this object and mark it as active. |
| 2895 void BrowserAccessibilityWin::PreInitialize() { | 2895 void BrowserAccessibilityWin::PreInitialize() { |
| 2896 BrowserAccessibility::PreInitialize(); | 2896 BrowserAccessibility::PreInitialize(); |
| 2897 | 2897 |
| 2898 InitRoleAndState(); | 2898 InitRoleAndState(); |
| 2899 | 2899 |
| 2900 // Expose the "display" and "tag" attributes. | 2900 // Expose the "display" and "tag" attributes. |
| 2901 StringAttributeToIA2(AccessibilityNodeData::ATTR_DISPLAY, "display"); | 2901 StringAttributeToIA2(ui::AX_ATTR_DISPLAY, "display"); |
| 2902 StringAttributeToIA2(AccessibilityNodeData::ATTR_HTML_TAG, "tag"); | 2902 StringAttributeToIA2(ui::AX_ATTR_HTML_TAG, "tag"); |
| 2903 StringAttributeToIA2(AccessibilityNodeData::ATTR_ROLE, "xml-roles"); | 2903 StringAttributeToIA2(ui::AX_ATTR_ROLE, "xml-roles"); |
| 2904 | 2904 |
| 2905 // Expose "level" attribute for headings, trees, etc. | 2905 // Expose "level" attribute for headings, trees, etc. |
| 2906 IntAttributeToIA2(AccessibilityNodeData::ATTR_HIERARCHICAL_LEVEL, "level"); | 2906 IntAttributeToIA2(ui::AX_ATTR_HIERARCHICAL_LEVEL, "level"); |
| 2907 | 2907 |
| 2908 // Expose the set size and position in set for listbox options. | 2908 // Expose the set size and position in set for listbox options. |
| 2909 if (blink_role() == blink::WebAXRoleListBoxOption && | 2909 if (blink_role() == ui::AX_ROLE_LIST_BOX_OPTION && |
| 2910 parent() && | 2910 parent() && |
| 2911 parent()->role() == blink::WebAXRoleListBox) { | 2911 parent()->role() == ui::AX_ROLE_LIST_BOX) { |
| 2912 ia2_attributes_.push_back( | 2912 ia2_attributes_.push_back( |
| 2913 L"setsize:" + base::IntToString16(parent()->PlatformChildCount())); | 2913 L"setsize:" + base::IntToString16(parent()->PlatformChildCount())); |
| 2914 ia2_attributes_.push_back( | 2914 ia2_attributes_.push_back( |
| 2915 L"setsize:" + base::IntToString16(index_in_parent() + 1)); | 2915 L"setsize:" + base::IntToString16(index_in_parent() + 1)); |
| 2916 } | 2916 } |
| 2917 | 2917 |
| 2918 if (ia_role_ == ROLE_SYSTEM_CHECKBUTTON || | 2918 if (ia_role_ == ROLE_SYSTEM_CHECKBUTTON || |
| 2919 ia_role_ == ROLE_SYSTEM_RADIOBUTTON || | 2919 ia_role_ == ROLE_SYSTEM_RADIOBUTTON || |
| 2920 ia2_role_ == IA2_ROLE_TOGGLE_BUTTON) { | 2920 ia2_role_ == IA2_ROLE_TOGGLE_BUTTON) { |
| 2921 ia2_attributes_.push_back(L"checkable:true"); | 2921 ia2_attributes_.push_back(L"checkable:true"); |
| 2922 } | 2922 } |
| 2923 | 2923 |
| 2924 // Expose live region attributes. | 2924 // Expose live region attributes. |
| 2925 StringAttributeToIA2(AccessibilityNodeData::ATTR_LIVE_STATUS, "live"); | 2925 StringAttributeToIA2(ui::AX_ATTR_LIVE_STATUS, "live"); |
| 2926 StringAttributeToIA2(AccessibilityNodeData::ATTR_LIVE_RELEVANT, "relevant"); | 2926 StringAttributeToIA2(ui::AX_ATTR_LIVE_RELEVANT, "relevant"); |
| 2927 BoolAttributeToIA2(AccessibilityNodeData::ATTR_LIVE_ATOMIC, "atomic"); | 2927 BoolAttributeToIA2(ui::AX_ATTR_LIVE_ATOMIC, "atomic"); |
| 2928 BoolAttributeToIA2(AccessibilityNodeData::ATTR_LIVE_BUSY, "busy"); | 2928 BoolAttributeToIA2(ui::AX_ATTR_LIVE_BUSY, "busy"); |
| 2929 | 2929 |
| 2930 // Expose container live region attributes. | 2930 // Expose container live region attributes. |
| 2931 StringAttributeToIA2(AccessibilityNodeData::ATTR_CONTAINER_LIVE_STATUS, | 2931 StringAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_STATUS, |
| 2932 "container-live"); | 2932 "container-live"); |
| 2933 StringAttributeToIA2(AccessibilityNodeData::ATTR_CONTAINER_LIVE_RELEVANT, | 2933 StringAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_RELEVANT, |
| 2934 "container-relevant"); | 2934 "container-relevant"); |
| 2935 BoolAttributeToIA2(AccessibilityNodeData::ATTR_CONTAINER_LIVE_ATOMIC, | 2935 BoolAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_ATOMIC, |
| 2936 "container-atomic"); | 2936 "container-atomic"); |
| 2937 BoolAttributeToIA2(AccessibilityNodeData::ATTR_CONTAINER_LIVE_BUSY, | 2937 BoolAttributeToIA2(ui::AX_ATTR_CONTAINER_LIVE_BUSY, |
| 2938 "container-busy"); | 2938 "container-busy"); |
| 2939 | 2939 |
| 2940 // Expose slider value. | 2940 // Expose slider value. |
| 2941 if (ia_role_ == ROLE_SYSTEM_PROGRESSBAR || | 2941 if (ia_role_ == ROLE_SYSTEM_PROGRESSBAR || |
| 2942 ia_role_ == ROLE_SYSTEM_SCROLLBAR || | 2942 ia_role_ == ROLE_SYSTEM_SCROLLBAR || |
| 2943 ia_role_ == ROLE_SYSTEM_SLIDER) { | 2943 ia_role_ == ROLE_SYSTEM_SLIDER) { |
| 2944 ia2_attributes_.push_back(L"valuetext:" + GetValueText()); | 2944 ia2_attributes_.push_back(L"valuetext:" + GetValueText()); |
| 2945 } | 2945 } |
| 2946 | 2946 |
| 2947 // Expose table cell index. | 2947 // Expose table cell index. |
| 2948 if (ia_role_ == ROLE_SYSTEM_CELL) { | 2948 if (ia_role_ == ROLE_SYSTEM_CELL) { |
| 2949 BrowserAccessibility* table = parent(); | 2949 BrowserAccessibility* table = parent(); |
| 2950 while (table && table->role() != blink::WebAXRoleTable) | 2950 while (table && table->role() != ui::AX_ROLE_TABLE) |
| 2951 table = table->parent(); | 2951 table = table->parent(); |
| 2952 if (table) { | 2952 if (table) { |
| 2953 const std::vector<int32>& unique_cell_ids = table->GetIntListAttribute( | 2953 const std::vector<int32>& unique_cell_ids = table->GetIntListAttribute( |
| 2954 AccessibilityNodeData::ATTR_UNIQUE_CELL_IDS); | 2954 ui::AX_ATTR_UNIQUE_CELL_IDS); |
| 2955 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { | 2955 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { |
| 2956 if (unique_cell_ids[i] == renderer_id()) { | 2956 if (unique_cell_ids[i] == renderer_id()) { |
| 2957 ia2_attributes_.push_back( | 2957 ia2_attributes_.push_back( |
| 2958 base::string16(L"table-cell-index:") + base::IntToString16(i)); | 2958 base::string16(L"table-cell-index:") + base::IntToString16(i)); |
| 2959 } | 2959 } |
| 2960 } | 2960 } |
| 2961 } | 2961 } |
| 2962 } | 2962 } |
| 2963 | 2963 |
| 2964 // The calculation of the accessible name of an element has been | 2964 // The calculation of the accessible name of an element has been |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2976 // page that labels this node. | 2976 // page that labels this node. |
| 2977 // description: accessible labels that override the default name: | 2977 // description: accessible labels that override the default name: |
| 2978 // aria-label or aria-labelledby or aria-describedby | 2978 // aria-label or aria-labelledby or aria-describedby |
| 2979 // help: the value of the "title" attribute | 2979 // help: the value of the "title" attribute |
| 2980 // | 2980 // |
| 2981 // On Windows, the logic we apply lets some fields take precedence and | 2981 // On Windows, the logic we apply lets some fields take precedence and |
| 2982 // always returns the primary name in "name" and the secondary name, | 2982 // always returns the primary name in "name" and the secondary name, |
| 2983 // if any, in "description". | 2983 // if any, in "description". |
| 2984 | 2984 |
| 2985 int title_elem_id = GetIntAttribute( | 2985 int title_elem_id = GetIntAttribute( |
| 2986 AccessibilityNodeData::ATTR_TITLE_UI_ELEMENT); | 2986 ui::AX_ATTR_TITLE_UI_ELEMENT); |
| 2987 std::string help = GetStringAttribute(AccessibilityNodeData::ATTR_HELP); | 2987 std::string help = GetStringAttribute(ui::AX_ATTR_HELP); |
| 2988 std::string description = GetStringAttribute( | 2988 std::string description = GetStringAttribute( |
| 2989 AccessibilityNodeData::ATTR_DESCRIPTION); | 2989 ui::AX_ATTR_DESCRIPTION); |
| 2990 | 2990 |
| 2991 // WebKit annoyingly puts the title in the description if there's no other | 2991 // WebKit annoyingly puts the title in the description if there's no other |
| 2992 // description, which just confuses the rest of the logic. Put it back. | 2992 // description, which just confuses the rest of the logic. Put it back. |
| 2993 // Now "help" is always the value of the "title" attribute, if present. | 2993 // Now "help" is always the value of the "title" attribute, if present. |
| 2994 std::string title_attr; | 2994 std::string title_attr; |
| 2995 if (GetHtmlAttribute("title", &title_attr) && | 2995 if (GetHtmlAttribute("title", &title_attr) && |
| 2996 description == title_attr && | 2996 description == title_attr && |
| 2997 help.empty()) { | 2997 help.empty()) { |
| 2998 help = description; | 2998 help = description; |
| 2999 description.clear(); | 2999 description.clear(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3010 description = help; | 3010 description = help; |
| 3011 help.clear(); | 3011 help.clear(); |
| 3012 } | 3012 } |
| 3013 if (!description.empty() && name().empty() && !title_elem_id) { | 3013 if (!description.empty() && name().empty() && !title_elem_id) { |
| 3014 set_name(description); | 3014 set_name(description); |
| 3015 description.clear(); | 3015 description.clear(); |
| 3016 } | 3016 } |
| 3017 | 3017 |
| 3018 // If it's a text field, also consider the placeholder. | 3018 // If it's a text field, also consider the placeholder. |
| 3019 std::string placeholder; | 3019 std::string placeholder; |
| 3020 if (blink_role() == blink::WebAXRoleTextField && | 3020 if (blink_role() == ui::AX_ROLE_TEXT_FIELD && |
| 3021 HasState(blink::WebAXStateFocusable) && | 3021 HasState(ui::AX_STATE_FOCUSABLE) && |
| 3022 GetHtmlAttribute("placeholder", &placeholder)) { | 3022 GetHtmlAttribute("placeholder", &placeholder)) { |
| 3023 if (name().empty() && !title_elem_id) { | 3023 if (name().empty() && !title_elem_id) { |
| 3024 set_name(placeholder); | 3024 set_name(placeholder); |
| 3025 } else if (description.empty()) { | 3025 } else if (description.empty()) { |
| 3026 description = placeholder; | 3026 description = placeholder; |
| 3027 } | 3027 } |
| 3028 } | 3028 } |
| 3029 | 3029 |
| 3030 SetStringAttribute(AccessibilityNodeData::ATTR_DESCRIPTION, description); | 3030 SetStringAttribute(ui::AX_ATTR_DESCRIPTION, description); |
| 3031 SetStringAttribute(AccessibilityNodeData::ATTR_HELP, help); | 3031 SetStringAttribute(ui::AX_ATTR_HELP, help); |
| 3032 | 3032 |
| 3033 // On Windows, the value of a document should be its url. | 3033 // On Windows, the value of a document should be its url. |
| 3034 if (blink_role() == blink::WebAXRoleRootWebArea || | 3034 if (blink_role() == ui::AX_ROLE_ROOT_WEB_AREA || |
| 3035 blink_role() == blink::WebAXRoleWebArea) { | 3035 blink_role() == ui::AX_ROLE_WEB_AREA) { |
| 3036 set_value(GetStringAttribute(AccessibilityNodeData::ATTR_DOC_URL)); | 3036 set_value(GetStringAttribute(ui::AX_ATTR_DOC_URL)); |
| 3037 } | 3037 } |
| 3038 | 3038 |
| 3039 // For certain roles (listbox option, static text, and list marker) | 3039 // For certain roles (listbox option, static text, and list marker) |
| 3040 // WebKit stores the main accessible text in the "value" - swap it so | 3040 // WebKit stores the main accessible text in the "value" - swap it so |
| 3041 // that it's the "name". | 3041 // that it's the "name". |
| 3042 if (name().empty() && | 3042 if (name().empty() && |
| 3043 (blink_role() == blink::WebAXRoleListBoxOption || | 3043 (blink_role() == ui::AX_ROLE_LIST_BOX_OPTION || |
| 3044 blink_role() == blink::WebAXRoleStaticText || | 3044 blink_role() == ui::AX_ROLE_STATIC_TEXT || |
| 3045 blink_role() == blink::WebAXRoleListMarker)) { | 3045 blink_role() == ui::AX_ROLE_LIST_MARKER)) { |
| 3046 std::string tmp = value(); | 3046 std::string tmp = value(); |
| 3047 set_value(name()); | 3047 set_value(name()); |
| 3048 set_name(tmp); | 3048 set_name(tmp); |
| 3049 } | 3049 } |
| 3050 | 3050 |
| 3051 // If this doesn't have a value and is linked then set its value to the url | 3051 // If this doesn't have a value and is linked then set its value to the url |
| 3052 // attribute. This allows screen readers to read an empty link's destination. | 3052 // attribute. This allows screen readers to read an empty link's destination. |
| 3053 if (value().empty() && (ia_state_ & STATE_SYSTEM_LINKED)) | 3053 if (value().empty() && (ia_state_ & STATE_SYSTEM_LINKED)) |
| 3054 set_value(GetStringAttribute(AccessibilityNodeData::ATTR_URL)); | 3054 set_value(GetStringAttribute(ui::AX_ATTR_URL)); |
| 3055 | 3055 |
| 3056 // Clear any old relationships between this node and other nodes. | 3056 // Clear any old relationships between this node and other nodes. |
| 3057 for (size_t i = 0; i < relations_.size(); ++i) | 3057 for (size_t i = 0; i < relations_.size(); ++i) |
| 3058 relations_[i]->Release(); | 3058 relations_[i]->Release(); |
| 3059 relations_.clear(); | 3059 relations_.clear(); |
| 3060 | 3060 |
| 3061 // Handle title UI element. | 3061 // Handle title UI element. |
| 3062 if (title_elem_id) { | 3062 if (title_elem_id) { |
| 3063 // Add a labelled by relationship. | 3063 // Add a labelled by relationship. |
| 3064 CComObject<BrowserAccessibilityRelation>* relation; | 3064 CComObject<BrowserAccessibilityRelation>* relation; |
| 3065 HRESULT hr = CComObject<BrowserAccessibilityRelation>::CreateInstance( | 3065 HRESULT hr = CComObject<BrowserAccessibilityRelation>::CreateInstance( |
| 3066 &relation); | 3066 &relation); |
| 3067 DCHECK(SUCCEEDED(hr)); | 3067 DCHECK(SUCCEEDED(hr)); |
| 3068 relation->AddRef(); | 3068 relation->AddRef(); |
| 3069 relation->Initialize(this, IA2_RELATION_LABELLED_BY); | 3069 relation->Initialize(this, IA2_RELATION_LABELLED_BY); |
| 3070 relation->AddTarget(title_elem_id); | 3070 relation->AddTarget(title_elem_id); |
| 3071 relations_.push_back(relation); | 3071 relations_.push_back(relation); |
| 3072 } | 3072 } |
| 3073 } | 3073 } |
| 3074 | 3074 |
| 3075 void BrowserAccessibilityWin::PostInitialize() { | 3075 void BrowserAccessibilityWin::PostInitialize() { |
| 3076 BrowserAccessibility::PostInitialize(); | 3076 BrowserAccessibility::PostInitialize(); |
| 3077 | 3077 |
| 3078 // Construct the hypertext for this node. | 3078 // Construct the hypertext for this node. |
| 3079 hyperlink_offset_to_index_.clear(); | 3079 hyperlink_offset_to_index_.clear(); |
| 3080 hyperlinks_.clear(); | 3080 hyperlinks_.clear(); |
| 3081 hypertext_.clear(); | 3081 hypertext_.clear(); |
| 3082 for (unsigned int i = 0; i < PlatformChildCount(); ++i) { | 3082 for (unsigned int i = 0; i < PlatformChildCount(); ++i) { |
| 3083 BrowserAccessibility* child = PlatformGetChild(i); | 3083 BrowserAccessibility* child = PlatformGetChild(i); |
| 3084 if (child->role() == blink::WebAXRoleStaticText) { | 3084 if (child->role() == ui::AX_ROLE_STATIC_TEXT) { |
| 3085 hypertext_ += base::UTF8ToUTF16(child->name()); | 3085 hypertext_ += base::UTF8ToUTF16(child->name()); |
| 3086 } else { | 3086 } else { |
| 3087 hyperlink_offset_to_index_[hypertext_.size()] = hyperlinks_.size(); | 3087 hyperlink_offset_to_index_[hypertext_.size()] = hyperlinks_.size(); |
| 3088 hypertext_ += kEmbeddedCharacter; | 3088 hypertext_ += kEmbeddedCharacter; |
| 3089 hyperlinks_.push_back(i); | 3089 hyperlinks_.push_back(i); |
| 3090 } | 3090 } |
| 3091 } | 3091 } |
| 3092 DCHECK_EQ(hyperlink_offset_to_index_.size(), hyperlinks_.size()); | 3092 DCHECK_EQ(hyperlink_offset_to_index_.size(), hyperlinks_.size()); |
| 3093 | 3093 |
| 3094 // Fire an event when an alert first appears. | 3094 // Fire an event when an alert first appears. |
| 3095 if (blink_role() == blink::WebAXRoleAlert && first_time_) | 3095 if (blink_role() == ui::AX_ROLE_ALERT && first_time_) |
| 3096 manager()->NotifyAccessibilityEvent(blink::WebAXEventAlert, this); | 3096 manager()->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, this); |
| 3097 | 3097 |
| 3098 // Fire events if text has changed. | 3098 // Fire events if text has changed. |
| 3099 base::string16 text = TextForIAccessibleText(); | 3099 base::string16 text = TextForIAccessibleText(); |
| 3100 if (previous_text_ != text) { | 3100 if (previous_text_ != text) { |
| 3101 if (!previous_text_.empty() && !text.empty()) { | 3101 if (!previous_text_.empty() && !text.empty()) { |
| 3102 manager()->NotifyAccessibilityEvent( | 3102 manager()->NotifyAccessibilityEvent( |
| 3103 blink::WebAXEventShow, this); | 3103 ui::AX_EVENT_SHOW, this); |
| 3104 } | 3104 } |
| 3105 | 3105 |
| 3106 // TODO(dmazzoni): Look into HIDE events, too. | 3106 // TODO(dmazzoni): Look into HIDE events, too. |
| 3107 | 3107 |
| 3108 old_text_ = previous_text_; | 3108 old_text_ = previous_text_; |
| 3109 previous_text_ = text; | 3109 previous_text_ = text; |
| 3110 } | 3110 } |
| 3111 | 3111 |
| 3112 BrowserAccessibilityManagerWin* manager = | 3112 BrowserAccessibilityManagerWin* manager = |
| 3113 this->manager()->ToBrowserAccessibilityManagerWin(); | 3113 this->manager()->ToBrowserAccessibilityManagerWin(); |
| 3114 | 3114 |
| 3115 // Fire events if the state has changed. | 3115 // Fire events if the state has changed. |
| 3116 if (!first_time_ && ia_state_ != old_ia_state_) { | 3116 if (!first_time_ && ia_state_ != old_ia_state_) { |
| 3117 // Normally focus events are handled elsewhere, however | 3117 // Normally focus events are handled elsewhere, however |
| 3118 // focus for managed descendants is platform-specific. | 3118 // focus for managed descendants is platform-specific. |
| 3119 // Fire a focus event if the focused descendant in a multi-select | 3119 // Fire a focus event if the focused descendant in a multi-select |
| 3120 // list box changes. | 3120 // list box changes. |
| 3121 if (blink_role() == blink::WebAXRoleListBoxOption && | 3121 if (blink_role() == ui::AX_ROLE_LIST_BOX_OPTION && |
| 3122 (ia_state_ & STATE_SYSTEM_FOCUSABLE) && | 3122 (ia_state_ & STATE_SYSTEM_FOCUSABLE) && |
| 3123 (ia_state_ & STATE_SYSTEM_SELECTABLE) && | 3123 (ia_state_ & STATE_SYSTEM_SELECTABLE) && |
| 3124 (ia_state_ & STATE_SYSTEM_FOCUSED) && | 3124 (ia_state_ & STATE_SYSTEM_FOCUSED) && |
| 3125 !(old_ia_state_ & STATE_SYSTEM_FOCUSED)) { | 3125 !(old_ia_state_ & STATE_SYSTEM_FOCUSED)) { |
| 3126 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_FOCUS, unique_id_win()); | 3126 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_FOCUS, unique_id_win()); |
| 3127 } | 3127 } |
| 3128 | 3128 |
| 3129 if ((ia_state_ & STATE_SYSTEM_SELECTED) && | 3129 if ((ia_state_ & STATE_SYSTEM_SELECTED) && |
| 3130 !(old_ia_state_ & STATE_SYSTEM_SELECTED)) { | 3130 !(old_ia_state_ & STATE_SYSTEM_SELECTED)) { |
| 3131 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_SELECTIONADD, | 3131 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_SELECTIONADD, |
| 3132 unique_id_win()); | 3132 unique_id_win()); |
| 3133 } else if (!(ia_state_ & STATE_SYSTEM_SELECTED) && | 3133 } else if (!(ia_state_ & STATE_SYSTEM_SELECTED) && |
| 3134 (old_ia_state_ & STATE_SYSTEM_SELECTED)) { | 3134 (old_ia_state_ & STATE_SYSTEM_SELECTED)) { |
| 3135 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_SELECTIONREMOVE, | 3135 manager->MaybeCallNotifyWinEvent(EVENT_OBJECT_SELECTIONREMOVE, |
| 3136 unique_id_win()); | 3136 unique_id_win()); |
| 3137 } | 3137 } |
| 3138 | 3138 |
| 3139 old_ia_state_ = ia_state_; | 3139 old_ia_state_ = ia_state_; |
| 3140 } | 3140 } |
| 3141 | 3141 |
| 3142 // Fire an event if this container object has scrolled. | 3142 // Fire an event if this container object has scrolled. |
| 3143 int sx = 0; | 3143 int sx = 0; |
| 3144 int sy = 0; | 3144 int sy = 0; |
| 3145 if (GetIntAttribute(AccessibilityNodeData::ATTR_SCROLL_X, &sx) && | 3145 if (GetIntAttribute(ui::AX_ATTR_SCROLL_X, &sx) && |
| 3146 GetIntAttribute(AccessibilityNodeData::ATTR_SCROLL_Y, &sy)) { | 3146 GetIntAttribute(ui::AX_ATTR_SCROLL_Y, &sy)) { |
| 3147 if (!first_time_ && | 3147 if (!first_time_ && |
| 3148 (sx != previous_scroll_x_ || sy != previous_scroll_y_)) { | 3148 (sx != previous_scroll_x_ || sy != previous_scroll_y_)) { |
| 3149 manager->MaybeCallNotifyWinEvent(EVENT_SYSTEM_SCROLLINGEND, | 3149 manager->MaybeCallNotifyWinEvent(EVENT_SYSTEM_SCROLLINGEND, |
| 3150 unique_id_win()); | 3150 unique_id_win()); |
| 3151 } | 3151 } |
| 3152 previous_scroll_x_ = sx; | 3152 previous_scroll_x_ = sx; |
| 3153 previous_scroll_y_ = sy; | 3153 previous_scroll_y_ = sy; |
| 3154 } | 3154 } |
| 3155 | 3155 |
| 3156 first_time_ = false; | 3156 first_time_ = false; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3189 return this; | 3189 return this; |
| 3190 | 3190 |
| 3191 if (child_id >= 1 && child_id <= static_cast<LONG>(PlatformChildCount())) | 3191 if (child_id >= 1 && child_id <= static_cast<LONG>(PlatformChildCount())) |
| 3192 return PlatformGetChild(child_id - 1)->ToBrowserAccessibilityWin(); | 3192 return PlatformGetChild(child_id - 1)->ToBrowserAccessibilityWin(); |
| 3193 | 3193 |
| 3194 return manager()->ToBrowserAccessibilityManagerWin()-> | 3194 return manager()->ToBrowserAccessibilityManagerWin()-> |
| 3195 GetFromUniqueIdWin(child_id); | 3195 GetFromUniqueIdWin(child_id); |
| 3196 } | 3196 } |
| 3197 | 3197 |
| 3198 HRESULT BrowserAccessibilityWin::GetStringAttributeAsBstr( | 3198 HRESULT BrowserAccessibilityWin::GetStringAttributeAsBstr( |
| 3199 AccessibilityNodeData::StringAttribute attribute, | 3199 ui::AXStringAttribute attribute, |
| 3200 BSTR* value_bstr) { | 3200 BSTR* value_bstr) { |
| 3201 base::string16 str; | 3201 base::string16 str; |
| 3202 | 3202 |
| 3203 if (!GetString16Attribute(attribute, &str)) | 3203 if (!GetString16Attribute(attribute, &str)) |
| 3204 return S_FALSE; | 3204 return S_FALSE; |
| 3205 | 3205 |
| 3206 if (str.empty()) | 3206 if (str.empty()) |
| 3207 return S_FALSE; | 3207 return S_FALSE; |
| 3208 | 3208 |
| 3209 *value_bstr = SysAllocString(str.c_str()); | 3209 *value_bstr = SysAllocString(str.c_str()); |
| 3210 DCHECK(*value_bstr); | 3210 DCHECK(*value_bstr); |
| 3211 | 3211 |
| 3212 return S_OK; | 3212 return S_OK; |
| 3213 } | 3213 } |
| 3214 | 3214 |
| 3215 void BrowserAccessibilityWin::StringAttributeToIA2( | 3215 void BrowserAccessibilityWin::StringAttributeToIA2( |
| 3216 AccessibilityNodeData::StringAttribute attribute, | 3216 ui::AXStringAttribute attribute, |
| 3217 const char* ia2_attr) { | 3217 const char* ia2_attr) { |
| 3218 base::string16 value; | 3218 base::string16 value; |
| 3219 if (GetString16Attribute(attribute, &value)) | 3219 if (GetString16Attribute(attribute, &value)) |
| 3220 ia2_attributes_.push_back(base::ASCIIToUTF16(ia2_attr) + L":" + value); | 3220 ia2_attributes_.push_back(base::ASCIIToUTF16(ia2_attr) + L":" + value); |
| 3221 } | 3221 } |
| 3222 | 3222 |
| 3223 void BrowserAccessibilityWin::BoolAttributeToIA2( | 3223 void BrowserAccessibilityWin::BoolAttributeToIA2( |
| 3224 AccessibilityNodeData::BoolAttribute attribute, | 3224 ui::AXBoolAttribute attribute, |
| 3225 const char* ia2_attr) { | 3225 const char* ia2_attr) { |
| 3226 bool value; | 3226 bool value; |
| 3227 if (GetBoolAttribute(attribute, &value)) { | 3227 if (GetBoolAttribute(attribute, &value)) { |
| 3228 ia2_attributes_.push_back((base::ASCIIToUTF16(ia2_attr) + L":") + | 3228 ia2_attributes_.push_back((base::ASCIIToUTF16(ia2_attr) + L":") + |
| 3229 (value ? L"true" : L"false")); | 3229 (value ? L"true" : L"false")); |
| 3230 } | 3230 } |
| 3231 } | 3231 } |
| 3232 | 3232 |
| 3233 void BrowserAccessibilityWin::IntAttributeToIA2( | 3233 void BrowserAccessibilityWin::IntAttributeToIA2( |
| 3234 AccessibilityNodeData::IntAttribute attribute, | 3234 ui::AXIntAttribute attribute, |
| 3235 const char* ia2_attr) { | 3235 const char* ia2_attr) { |
| 3236 int value; | 3236 int value; |
| 3237 if (GetIntAttribute(attribute, &value)) { | 3237 if (GetIntAttribute(attribute, &value)) { |
| 3238 ia2_attributes_.push_back(base::ASCIIToUTF16(ia2_attr) + L":" + | 3238 ia2_attributes_.push_back(base::ASCIIToUTF16(ia2_attr) + L":" + |
| 3239 base::IntToString16(value)); | 3239 base::IntToString16(value)); |
| 3240 } | 3240 } |
| 3241 } | 3241 } |
| 3242 | 3242 |
| 3243 base::string16 BrowserAccessibilityWin::GetValueText() { | 3243 base::string16 BrowserAccessibilityWin::GetValueText() { |
| 3244 float fval; | 3244 float fval; |
| 3245 base::string16 value = base::UTF8ToUTF16(this->value()); | 3245 base::string16 value = base::UTF8ToUTF16(this->value()); |
| 3246 | 3246 |
| 3247 if (value.empty() && | 3247 if (value.empty() && |
| 3248 GetFloatAttribute(AccessibilityNodeData::ATTR_VALUE_FOR_RANGE, &fval)) { | 3248 GetFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE, &fval)) { |
| 3249 value = base::UTF8ToUTF16(base::DoubleToString(fval)); | 3249 value = base::UTF8ToUTF16(base::DoubleToString(fval)); |
| 3250 } | 3250 } |
| 3251 return value; | 3251 return value; |
| 3252 } | 3252 } |
| 3253 | 3253 |
| 3254 base::string16 BrowserAccessibilityWin::TextForIAccessibleText() { | 3254 base::string16 BrowserAccessibilityWin::TextForIAccessibleText() { |
| 3255 if (IsEditableText()) | 3255 if (IsEditableText()) |
| 3256 return base::UTF8ToUTF16(value()); | 3256 return base::UTF8ToUTF16(value()); |
| 3257 return (blink_role() == blink::WebAXRoleStaticText) ? | 3257 return (blink_role() == ui::AX_ROLE_STATIC_TEXT) ? |
| 3258 base::UTF8ToUTF16(name()) : hypertext_; | 3258 base::UTF8ToUTF16(name()) : hypertext_; |
| 3259 } | 3259 } |
| 3260 | 3260 |
| 3261 void BrowserAccessibilityWin::HandleSpecialTextOffset( | 3261 void BrowserAccessibilityWin::HandleSpecialTextOffset( |
| 3262 const base::string16& text, | 3262 const base::string16& text, |
| 3263 LONG* offset) { | 3263 LONG* offset) { |
| 3264 if (*offset == IA2_TEXT_OFFSET_LENGTH) | 3264 if (*offset == IA2_TEXT_OFFSET_LENGTH) |
| 3265 *offset = static_cast<LONG>(text.size()); | 3265 *offset = static_cast<LONG>(text.size()); |
| 3266 else if (*offset == IA2_TEXT_OFFSET_CARET) | 3266 else if (*offset == IA2_TEXT_OFFSET_CARET) |
| 3267 get_caretOffset(offset); | 3267 get_caretOffset(offset); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3283 } | 3283 } |
| 3284 | 3284 |
| 3285 LONG BrowserAccessibilityWin::FindBoundary( | 3285 LONG BrowserAccessibilityWin::FindBoundary( |
| 3286 const base::string16& text, | 3286 const base::string16& text, |
| 3287 IA2TextBoundaryType ia2_boundary, | 3287 IA2TextBoundaryType ia2_boundary, |
| 3288 LONG start_offset, | 3288 LONG start_offset, |
| 3289 ui::TextBoundaryDirection direction) { | 3289 ui::TextBoundaryDirection direction) { |
| 3290 HandleSpecialTextOffset(text, &start_offset); | 3290 HandleSpecialTextOffset(text, &start_offset); |
| 3291 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); | 3291 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); |
| 3292 const std::vector<int32>& line_breaks = GetIntListAttribute( | 3292 const std::vector<int32>& line_breaks = GetIntListAttribute( |
| 3293 AccessibilityNodeData::ATTR_LINE_BREAKS); | 3293 ui::AX_ATTR_LINE_BREAKS); |
| 3294 return ui::FindAccessibleTextBoundary( | 3294 return ui::FindAccessibleTextBoundary( |
| 3295 text, line_breaks, boundary, start_offset, direction); | 3295 text, line_breaks, boundary, start_offset, direction); |
| 3296 } | 3296 } |
| 3297 | 3297 |
| 3298 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromRendererID( | 3298 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromRendererID( |
| 3299 int32 renderer_id) { | 3299 int32 renderer_id) { |
| 3300 return manager()->GetFromRendererID(renderer_id)->ToBrowserAccessibilityWin(); | 3300 return manager()->GetFromRendererID(renderer_id)->ToBrowserAccessibilityWin(); |
| 3301 } | 3301 } |
| 3302 | 3302 |
| 3303 void BrowserAccessibilityWin::InitRoleAndState() { | 3303 void BrowserAccessibilityWin::InitRoleAndState() { |
| 3304 ia_state_ = 0; | 3304 ia_state_ = 0; |
| 3305 ia2_state_ = IA2_STATE_OPAQUE; | 3305 ia2_state_ = IA2_STATE_OPAQUE; |
| 3306 ia2_attributes_.clear(); | 3306 ia2_attributes_.clear(); |
| 3307 | 3307 |
| 3308 if (HasState(blink::WebAXStateBusy)) | 3308 if (HasState(ui::AX_STATE_BUSY)) |
| 3309 ia_state_ |= STATE_SYSTEM_BUSY; | 3309 ia_state_ |= STATE_SYSTEM_BUSY; |
| 3310 if (HasState(blink::WebAXStateChecked)) | 3310 if (HasState(ui::AX_STATE_CHECKED)) |
| 3311 ia_state_ |= STATE_SYSTEM_CHECKED; | 3311 ia_state_ |= STATE_SYSTEM_CHECKED; |
| 3312 if (HasState(blink::WebAXStateCollapsed)) | 3312 if (HasState(ui::AX_STATE_COLLAPSED)) |
| 3313 ia_state_ |= STATE_SYSTEM_COLLAPSED; | 3313 ia_state_ |= STATE_SYSTEM_COLLAPSED; |
| 3314 if (HasState(blink::WebAXStateExpanded)) | 3314 if (HasState(ui::AX_STATE_EXPANDED)) |
| 3315 ia_state_ |= STATE_SYSTEM_EXPANDED; | 3315 ia_state_ |= STATE_SYSTEM_EXPANDED; |
| 3316 if (HasState(blink::WebAXStateFocusable)) | 3316 if (HasState(ui::AX_STATE_FOCUSABLE)) |
| 3317 ia_state_ |= STATE_SYSTEM_FOCUSABLE; | 3317 ia_state_ |= STATE_SYSTEM_FOCUSABLE; |
| 3318 if (HasState(blink::WebAXStateHaspopup)) | 3318 if (HasState(ui::AX_STATE_HASPOPUP)) |
| 3319 ia_state_ |= STATE_SYSTEM_HASPOPUP; | 3319 ia_state_ |= STATE_SYSTEM_HASPOPUP; |
| 3320 if (HasState(blink::WebAXStateHovered)) | 3320 if (HasState(ui::AX_STATE_HOVERED)) |
| 3321 ia_state_ |= STATE_SYSTEM_HOTTRACKED; | 3321 ia_state_ |= STATE_SYSTEM_HOTTRACKED; |
| 3322 if (HasState(blink::WebAXStateIndeterminate)) | 3322 if (HasState(ui::AX_STATE_INDETERMINATE)) |
| 3323 ia_state_ |= STATE_SYSTEM_INDETERMINATE; | 3323 ia_state_ |= STATE_SYSTEM_INDETERMINATE; |
| 3324 if (HasState(blink::WebAXStateInvisible)) | 3324 if (HasState(ui::AX_STATE_INVISIBLE)) |
| 3325 ia_state_ |= STATE_SYSTEM_INVISIBLE; | 3325 ia_state_ |= STATE_SYSTEM_INVISIBLE; |
| 3326 if (HasState(blink::WebAXStateLinked)) | 3326 if (HasState(ui::AX_STATE_LINKED)) |
| 3327 ia_state_ |= STATE_SYSTEM_LINKED; | 3327 ia_state_ |= STATE_SYSTEM_LINKED; |
| 3328 if (HasState(blink::WebAXStateMultiselectable)) { | 3328 if (HasState(ui::AX_STATE_MULTISELECTABLE)) { |
| 3329 ia_state_ |= STATE_SYSTEM_EXTSELECTABLE; | 3329 ia_state_ |= STATE_SYSTEM_EXTSELECTABLE; |
| 3330 ia_state_ |= STATE_SYSTEM_MULTISELECTABLE; | 3330 ia_state_ |= STATE_SYSTEM_MULTISELECTABLE; |
| 3331 } | 3331 } |
| 3332 // TODO(ctguil): Support STATE_SYSTEM_EXTSELECTABLE/accSelect. | 3332 // TODO(ctguil): Support STATE_SYSTEM_EXTSELECTABLE/accSelect. |
| 3333 if (HasState(blink::WebAXStateOffscreen)) | 3333 if (HasState(ui::AX_STATE_OFFSCREEN)) |
| 3334 ia_state_ |= STATE_SYSTEM_OFFSCREEN; | 3334 ia_state_ |= STATE_SYSTEM_OFFSCREEN; |
| 3335 if (HasState(blink::WebAXStatePressed)) | 3335 if (HasState(ui::AX_STATE_PRESSED)) |
| 3336 ia_state_ |= STATE_SYSTEM_PRESSED; | 3336 ia_state_ |= STATE_SYSTEM_PRESSED; |
| 3337 if (HasState(blink::WebAXStateProtected)) | 3337 if (HasState(ui::AX_STATE_PROTECTED)) |
| 3338 ia_state_ |= STATE_SYSTEM_PROTECTED; | 3338 ia_state_ |= STATE_SYSTEM_PROTECTED; |
| 3339 if (HasState(blink::WebAXStateRequired)) | 3339 if (HasState(ui::AX_STATE_REQUIRED)) |
| 3340 ia2_state_ |= IA2_STATE_REQUIRED; | 3340 ia2_state_ |= IA2_STATE_REQUIRED; |
| 3341 if (HasState(blink::WebAXStateSelectable)) | 3341 if (HasState(ui::AX_STATE_SELECTABLE)) |
| 3342 ia_state_ |= STATE_SYSTEM_SELECTABLE; | 3342 ia_state_ |= STATE_SYSTEM_SELECTABLE; |
| 3343 if (HasState(blink::WebAXStateSelected)) | 3343 if (HasState(ui::AX_STATE_SELECTED)) |
| 3344 ia_state_ |= STATE_SYSTEM_SELECTED; | 3344 ia_state_ |= STATE_SYSTEM_SELECTED; |
| 3345 if (HasState(blink::WebAXStateVisited)) | 3345 if (HasState(ui::AX_STATE_VISITED)) |
| 3346 ia_state_ |= STATE_SYSTEM_TRAVERSED; | 3346 ia_state_ |= STATE_SYSTEM_TRAVERSED; |
| 3347 if (!HasState(blink::WebAXStateEnabled)) | 3347 if (!HasState(ui::AX_STATE_ENABLED)) |
| 3348 ia_state_ |= STATE_SYSTEM_UNAVAILABLE; | 3348 ia_state_ |= STATE_SYSTEM_UNAVAILABLE; |
| 3349 if (HasState(blink::WebAXStateVertical)) { | 3349 if (HasState(ui::AX_STATE_VERTICAL)) { |
| 3350 ia2_state_ |= IA2_STATE_VERTICAL; | 3350 ia2_state_ |= IA2_STATE_VERTICAL; |
| 3351 } else { | 3351 } else { |
| 3352 ia2_state_ |= IA2_STATE_HORIZONTAL; | 3352 ia2_state_ |= IA2_STATE_HORIZONTAL; |
| 3353 } | 3353 } |
| 3354 if (HasState(blink::WebAXStateVisited)) | 3354 if (HasState(ui::AX_STATE_VISITED)) |
| 3355 ia_state_ |= STATE_SYSTEM_TRAVERSED; | 3355 ia_state_ |= STATE_SYSTEM_TRAVERSED; |
| 3356 | 3356 |
| 3357 // WebKit marks everything as readonly unless it's editable text, so if it's | 3357 // WebKit marks everything as readonly unless it's editable text, so if it's |
| 3358 // not readonly, mark it as editable now. The final computation of the | 3358 // not readonly, mark it as editable now. The final computation of the |
| 3359 // READONLY state for MSAA is below, after the switch. | 3359 // READONLY state for MSAA is below, after the switch. |
| 3360 if (!HasState(blink::WebAXStateReadonly)) | 3360 if (!HasState(ui::AX_STATE_READONLY)) |
| 3361 ia2_state_ |= IA2_STATE_EDITABLE; | 3361 ia2_state_ |= IA2_STATE_EDITABLE; |
| 3362 | 3362 |
| 3363 base::string16 invalid; | 3363 base::string16 invalid; |
| 3364 if (GetHtmlAttribute("aria-invalid", &invalid)) | 3364 if (GetHtmlAttribute("aria-invalid", &invalid)) |
| 3365 ia2_state_ |= IA2_STATE_INVALID_ENTRY; | 3365 ia2_state_ |= IA2_STATE_INVALID_ENTRY; |
| 3366 | 3366 |
| 3367 if (GetBoolAttribute(AccessibilityNodeData::ATTR_BUTTON_MIXED)) | 3367 if (GetBoolAttribute(ui::AX_ATTR_BUTTON_MIXED)) |
| 3368 ia_state_ |= STATE_SYSTEM_MIXED; | 3368 ia_state_ |= STATE_SYSTEM_MIXED; |
| 3369 | 3369 |
| 3370 if (GetBoolAttribute(AccessibilityNodeData::ATTR_CAN_SET_VALUE)) | 3370 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) |
| 3371 ia2_state_ |= IA2_STATE_EDITABLE; | 3371 ia2_state_ |= IA2_STATE_EDITABLE; |
| 3372 | 3372 |
| 3373 base::string16 html_tag = GetString16Attribute( | 3373 base::string16 html_tag = GetString16Attribute( |
| 3374 AccessibilityNodeData::ATTR_HTML_TAG); | 3374 ui::AX_ATTR_HTML_TAG); |
| 3375 ia_role_ = 0; | 3375 ia_role_ = 0; |
| 3376 ia2_role_ = 0; | 3376 ia2_role_ = 0; |
| 3377 switch (blink_role()) { | 3377 switch (blink_role()) { |
| 3378 case blink::WebAXRoleAlert: | 3378 case ui::AX_ROLE_ALERT: |
| 3379 ia_role_ = ROLE_SYSTEM_ALERT; | 3379 ia_role_ = ROLE_SYSTEM_ALERT; |
| 3380 break; | 3380 break; |
| 3381 case blink::WebAXRoleAlertDialog: | 3381 case ui::AX_ROLE_ALERT_DIALOG: |
| 3382 ia_role_ = ROLE_SYSTEM_DIALOG; | 3382 ia_role_ = ROLE_SYSTEM_DIALOG; |
| 3383 break; | 3383 break; |
| 3384 case blink::WebAXRoleApplication: | 3384 case ui::AX_ROLE_APPLICATION: |
| 3385 ia_role_ = ROLE_SYSTEM_APPLICATION; | 3385 ia_role_ = ROLE_SYSTEM_APPLICATION; |
| 3386 break; | 3386 break; |
| 3387 case blink::WebAXRoleArticle: | 3387 case ui::AX_ROLE_ARTICLE: |
| 3388 ia_role_ = ROLE_SYSTEM_GROUPING; | 3388 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3389 ia2_role_ = IA2_ROLE_SECTION; | 3389 ia2_role_ = IA2_ROLE_SECTION; |
| 3390 ia_state_ |= STATE_SYSTEM_READONLY; | 3390 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3391 break; | 3391 break; |
| 3392 case blink::WebAXRoleBusyIndicator: | 3392 case ui::AX_ROLE_BUSY_INDICATOR: |
| 3393 ia_role_ = ROLE_SYSTEM_ANIMATION; | 3393 ia_role_ = ROLE_SYSTEM_ANIMATION; |
| 3394 ia_state_ |= STATE_SYSTEM_READONLY; | 3394 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3395 break; | 3395 break; |
| 3396 case blink::WebAXRoleButton: | 3396 case ui::AX_ROLE_BUTTON: |
| 3397 ia_role_ = ROLE_SYSTEM_PUSHBUTTON; | 3397 ia_role_ = ROLE_SYSTEM_PUSHBUTTON; |
| 3398 bool is_aria_pressed_defined; | 3398 bool is_aria_pressed_defined; |
| 3399 bool is_mixed; | 3399 bool is_mixed; |
| 3400 if (GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed)) | 3400 if (GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed)) |
| 3401 ia_state_ |= STATE_SYSTEM_PRESSED; | 3401 ia_state_ |= STATE_SYSTEM_PRESSED; |
| 3402 if (is_aria_pressed_defined) | 3402 if (is_aria_pressed_defined) |
| 3403 ia2_role_ = IA2_ROLE_TOGGLE_BUTTON; | 3403 ia2_role_ = IA2_ROLE_TOGGLE_BUTTON; |
| 3404 if (is_mixed) | 3404 if (is_mixed) |
| 3405 ia_state_ |= STATE_SYSTEM_MIXED; | 3405 ia_state_ |= STATE_SYSTEM_MIXED; |
| 3406 break; | 3406 break; |
| 3407 case blink::WebAXRoleCanvas: | 3407 case ui::AX_ROLE_CANVAS: |
| 3408 if (GetBoolAttribute(AccessibilityNodeData::ATTR_CANVAS_HAS_FALLBACK)) { | 3408 if (GetBoolAttribute(ui::AX_ATTR_CANVAS_HAS_FALLBACK)) { |
| 3409 role_name_ = L"canvas"; | 3409 role_name_ = L"canvas"; |
| 3410 ia2_role_ = IA2_ROLE_CANVAS; | 3410 ia2_role_ = IA2_ROLE_CANVAS; |
| 3411 } else { | 3411 } else { |
| 3412 ia_role_ = ROLE_SYSTEM_GRAPHIC; | 3412 ia_role_ = ROLE_SYSTEM_GRAPHIC; |
| 3413 } | 3413 } |
| 3414 break; | 3414 break; |
| 3415 case blink::WebAXRoleCell: | 3415 case ui::AX_ROLE_CELL: |
| 3416 ia_role_ = ROLE_SYSTEM_CELL; | 3416 ia_role_ = ROLE_SYSTEM_CELL; |
| 3417 break; | 3417 break; |
| 3418 case blink::WebAXRoleCheckBox: | 3418 case ui::AX_ROLE_CHECK_BOX: |
| 3419 ia_role_ = ROLE_SYSTEM_CHECKBUTTON; | 3419 ia_role_ = ROLE_SYSTEM_CHECKBUTTON; |
| 3420 break; | 3420 break; |
| 3421 case blink::WebAXRoleColorWell: | 3421 case ui::AX_ROLE_COLOR_WELL: |
| 3422 ia_role_ = ROLE_SYSTEM_CLIENT; | 3422 ia_role_ = ROLE_SYSTEM_CLIENT; |
| 3423 ia2_role_ = IA2_ROLE_COLOR_CHOOSER; | 3423 ia2_role_ = IA2_ROLE_COLOR_CHOOSER; |
| 3424 break; | 3424 break; |
| 3425 case blink::WebAXRoleColumn: | 3425 case ui::AX_ROLE_COLUMN: |
| 3426 ia_role_ = ROLE_SYSTEM_COLUMN; | 3426 ia_role_ = ROLE_SYSTEM_COLUMN; |
| 3427 ia_state_ |= STATE_SYSTEM_READONLY; | 3427 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3428 break; | 3428 break; |
| 3429 case blink::WebAXRoleColumnHeader: | 3429 case ui::AX_ROLE_COLUMN_HEADER: |
| 3430 ia_role_ = ROLE_SYSTEM_COLUMNHEADER; | 3430 ia_role_ = ROLE_SYSTEM_COLUMNHEADER; |
| 3431 ia_state_ |= STATE_SYSTEM_READONLY; | 3431 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3432 break; | 3432 break; |
| 3433 case blink::WebAXRoleComboBox: | 3433 case ui::AX_ROLE_COMBO_BOX: |
| 3434 ia_role_ = ROLE_SYSTEM_COMBOBOX; | 3434 ia_role_ = ROLE_SYSTEM_COMBOBOX; |
| 3435 break; | 3435 break; |
| 3436 case blink::WebAXRoleDiv: | 3436 case ui::AX_ROLE_DIV: |
| 3437 role_name_ = L"div"; | 3437 role_name_ = L"div"; |
| 3438 ia2_role_ = IA2_ROLE_SECTION; | 3438 ia2_role_ = IA2_ROLE_SECTION; |
| 3439 break; | 3439 break; |
| 3440 case blink::WebAXRoleDefinition: | 3440 case ui::AX_ROLE_DEFINITION: |
| 3441 role_name_ = html_tag; | 3441 role_name_ = html_tag; |
| 3442 ia2_role_ = IA2_ROLE_PARAGRAPH; | 3442 ia2_role_ = IA2_ROLE_PARAGRAPH; |
| 3443 ia_state_ |= STATE_SYSTEM_READONLY; | 3443 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3444 break; | 3444 break; |
| 3445 case blink::WebAXRoleDescriptionListDetail: | 3445 case ui::AX_ROLE_DESCRIPTION_LIST_DETAIL: |
| 3446 role_name_ = html_tag; | 3446 role_name_ = html_tag; |
| 3447 ia2_role_ = IA2_ROLE_PARAGRAPH; | 3447 ia2_role_ = IA2_ROLE_PARAGRAPH; |
| 3448 ia_state_ |= STATE_SYSTEM_READONLY; | 3448 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3449 break; | 3449 break; |
| 3450 case blink::WebAXRoleDescriptionListTerm: | 3450 case ui::AX_ROLE_DESCRIPTION_LIST_TERM: |
| 3451 ia_role_ = ROLE_SYSTEM_LISTITEM; | 3451 ia_role_ = ROLE_SYSTEM_LISTITEM; |
| 3452 ia_state_ |= STATE_SYSTEM_READONLY; | 3452 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3453 break; | 3453 break; |
| 3454 case blink::WebAXRoleDialog: | 3454 case ui::AX_ROLE_DIALOG: |
| 3455 ia_role_ = ROLE_SYSTEM_DIALOG; | 3455 ia_role_ = ROLE_SYSTEM_DIALOG; |
| 3456 ia_state_ |= STATE_SYSTEM_READONLY; | 3456 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3457 break; | 3457 break; |
| 3458 case blink::WebAXRoleDisclosureTriangle: | 3458 case ui::AX_ROLE_DISCLOSURE_TRIANGLE: |
| 3459 ia_role_ = ROLE_SYSTEM_OUTLINEBUTTON; | 3459 ia_role_ = ROLE_SYSTEM_OUTLINEBUTTON; |
| 3460 ia_state_ |= STATE_SYSTEM_READONLY; | 3460 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3461 break; | 3461 break; |
| 3462 case blink::WebAXRoleDocument: | 3462 case ui::AX_ROLE_DOCUMENT: |
| 3463 case blink::WebAXRoleRootWebArea: | 3463 case ui::AX_ROLE_ROOT_WEB_AREA: |
| 3464 case blink::WebAXRoleWebArea: | 3464 case ui::AX_ROLE_WEB_AREA: |
| 3465 ia_role_ = ROLE_SYSTEM_DOCUMENT; | 3465 ia_role_ = ROLE_SYSTEM_DOCUMENT; |
| 3466 ia_state_ |= STATE_SYSTEM_READONLY; | 3466 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3467 ia_state_ |= STATE_SYSTEM_FOCUSABLE; | 3467 ia_state_ |= STATE_SYSTEM_FOCUSABLE; |
| 3468 break; | 3468 break; |
| 3469 case blink::WebAXRoleEditableText: | 3469 case ui::AX_ROLE_EDITABLE_TEXT: |
| 3470 ia_role_ = ROLE_SYSTEM_TEXT; | 3470 ia_role_ = ROLE_SYSTEM_TEXT; |
| 3471 ia2_state_ |= IA2_STATE_SINGLE_LINE; | 3471 ia2_state_ |= IA2_STATE_SINGLE_LINE; |
| 3472 ia2_state_ |= IA2_STATE_EDITABLE; | 3472 ia2_state_ |= IA2_STATE_EDITABLE; |
| 3473 break; | 3473 break; |
| 3474 case blink::WebAXRoleForm: | 3474 case ui::AX_ROLE_FORM: |
| 3475 role_name_ = L"form"; | 3475 role_name_ = L"form"; |
| 3476 ia2_role_ = IA2_ROLE_FORM; | 3476 ia2_role_ = IA2_ROLE_FORM; |
| 3477 break; | 3477 break; |
| 3478 case blink::WebAXRoleFooter: | 3478 case ui::AX_ROLE_FOOTER: |
| 3479 ia_role_ = IA2_ROLE_FOOTER; | 3479 ia_role_ = IA2_ROLE_FOOTER; |
| 3480 ia_state_ |= STATE_SYSTEM_READONLY; | 3480 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3481 break; | 3481 break; |
| 3482 case blink::WebAXRoleGrid: | 3482 case ui::AX_ROLE_GRID: |
| 3483 ia_role_ = ROLE_SYSTEM_TABLE; | 3483 ia_role_ = ROLE_SYSTEM_TABLE; |
| 3484 ia_state_ |= STATE_SYSTEM_READONLY; | 3484 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3485 break; | 3485 break; |
| 3486 case blink::WebAXRoleGroup: { | 3486 case ui::AX_ROLE_GROUP: { |
| 3487 base::string16 aria_role = GetString16Attribute( | 3487 base::string16 aria_role = GetString16Attribute( |
| 3488 AccessibilityNodeData::ATTR_ROLE); | 3488 ui::AX_ATTR_ROLE); |
| 3489 if (aria_role == L"group" || html_tag == L"fieldset") { | 3489 if (aria_role == L"group" || html_tag == L"fieldset") { |
| 3490 ia_role_ = ROLE_SYSTEM_GROUPING; | 3490 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3491 } else if (html_tag == L"li") { | 3491 } else if (html_tag == L"li") { |
| 3492 ia_role_ = ROLE_SYSTEM_LISTITEM; | 3492 ia_role_ = ROLE_SYSTEM_LISTITEM; |
| 3493 } else { | 3493 } else { |
| 3494 if (html_tag.empty()) | 3494 if (html_tag.empty()) |
| 3495 role_name_ = L"div"; | 3495 role_name_ = L"div"; |
| 3496 else | 3496 else |
| 3497 role_name_ = html_tag; | 3497 role_name_ = html_tag; |
| 3498 ia2_role_ = IA2_ROLE_SECTION; | 3498 ia2_role_ = IA2_ROLE_SECTION; |
| 3499 } | 3499 } |
| 3500 ia_state_ |= STATE_SYSTEM_READONLY; | 3500 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3501 break; | 3501 break; |
| 3502 } | 3502 } |
| 3503 case blink::WebAXRoleGrowArea: | 3503 case ui::AX_ROLE_GROW_AREA: |
| 3504 ia_role_ = ROLE_SYSTEM_GRIP; | 3504 ia_role_ = ROLE_SYSTEM_GRIP; |
| 3505 ia_state_ |= STATE_SYSTEM_READONLY; | 3505 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3506 break; | 3506 break; |
| 3507 case blink::WebAXRoleHeading: | 3507 case ui::AX_ROLE_HEADING: |
| 3508 role_name_ = html_tag; | 3508 role_name_ = html_tag; |
| 3509 ia2_role_ = IA2_ROLE_HEADING; | 3509 ia2_role_ = IA2_ROLE_HEADING; |
| 3510 ia_state_ |= STATE_SYSTEM_READONLY; | 3510 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3511 break; | 3511 break; |
| 3512 case blink::WebAXRoleHorizontalRule: | 3512 case ui::AX_ROLE_HORIZONTAL_RULE: |
| 3513 ia_role_ = ROLE_SYSTEM_SEPARATOR; | 3513 ia_role_ = ROLE_SYSTEM_SEPARATOR; |
| 3514 break; | 3514 break; |
| 3515 case blink::WebAXRoleImage: | 3515 case ui::AX_ROLE_IMAGE: |
| 3516 ia_role_ = ROLE_SYSTEM_GRAPHIC; | 3516 ia_role_ = ROLE_SYSTEM_GRAPHIC; |
| 3517 ia_state_ |= STATE_SYSTEM_READONLY; | 3517 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3518 break; | 3518 break; |
| 3519 case blink::WebAXRoleImageMap: | 3519 case ui::AX_ROLE_IMAGE_MAP: |
| 3520 role_name_ = html_tag; | 3520 role_name_ = html_tag; |
| 3521 ia2_role_ = IA2_ROLE_IMAGE_MAP; | 3521 ia2_role_ = IA2_ROLE_IMAGE_MAP; |
| 3522 ia_state_ |= STATE_SYSTEM_READONLY; | 3522 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3523 break; | 3523 break; |
| 3524 case blink::WebAXRoleImageMapLink: | 3524 case ui::AX_ROLE_IMAGE_MAP_LINK: |
| 3525 ia_role_ = ROLE_SYSTEM_LINK; | 3525 ia_role_ = ROLE_SYSTEM_LINK; |
| 3526 ia_state_ |= STATE_SYSTEM_LINKED; | 3526 ia_state_ |= STATE_SYSTEM_LINKED; |
| 3527 ia_state_ |= STATE_SYSTEM_READONLY; | 3527 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3528 break; | 3528 break; |
| 3529 case blink::WebAXRoleLabel: | 3529 case ui::AX_ROLE_LABEL: |
| 3530 ia_role_ = ROLE_SYSTEM_TEXT; | 3530 ia_role_ = ROLE_SYSTEM_TEXT; |
| 3531 ia2_role_ = IA2_ROLE_LABEL; | 3531 ia2_role_ = IA2_ROLE_LABEL; |
| 3532 break; | 3532 break; |
| 3533 case blink::WebAXRoleBanner: | 3533 case ui::AX_ROLE_BANNER: |
| 3534 case blink::WebAXRoleComplementary: | 3534 case ui::AX_ROLE_COMPLEMENTARY: |
| 3535 case blink::WebAXRoleContentInfo: | 3535 case ui::AX_ROLE_CONTENT_INFO: |
| 3536 case blink::WebAXRoleMain: | 3536 case ui::AX_ROLE_MAIN: |
| 3537 case blink::WebAXRoleNavigation: | 3537 case ui::AX_ROLE_NAVIGATION: |
| 3538 case blink::WebAXRoleSearch: | 3538 case ui::AX_ROLE_SEARCH: |
| 3539 ia_role_ = ROLE_SYSTEM_GROUPING; | 3539 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3540 ia2_role_ = IA2_ROLE_SECTION; | 3540 ia2_role_ = IA2_ROLE_SECTION; |
| 3541 ia_state_ |= STATE_SYSTEM_READONLY; | 3541 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3542 break; | 3542 break; |
| 3543 case blink::WebAXRoleLink: | 3543 case ui::AX_ROLE_LINK: |
| 3544 ia_role_ = ROLE_SYSTEM_LINK; | 3544 ia_role_ = ROLE_SYSTEM_LINK; |
| 3545 ia_state_ |= STATE_SYSTEM_LINKED; | 3545 ia_state_ |= STATE_SYSTEM_LINKED; |
| 3546 break; | 3546 break; |
| 3547 case blink::WebAXRoleList: | 3547 case ui::AX_ROLE_LIST: |
| 3548 ia_role_ = ROLE_SYSTEM_LIST; | 3548 ia_role_ = ROLE_SYSTEM_LIST; |
| 3549 ia_state_ |= STATE_SYSTEM_READONLY; | 3549 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3550 break; | 3550 break; |
| 3551 case blink::WebAXRoleListBox: | 3551 case ui::AX_ROLE_LIST_BOX: |
| 3552 ia_role_ = ROLE_SYSTEM_LIST; | 3552 ia_role_ = ROLE_SYSTEM_LIST; |
| 3553 break; | 3553 break; |
| 3554 case blink::WebAXRoleListBoxOption: | 3554 case ui::AX_ROLE_LIST_BOX_OPTION: |
| 3555 ia_role_ = ROLE_SYSTEM_LISTITEM; | 3555 ia_role_ = ROLE_SYSTEM_LISTITEM; |
| 3556 if (ia_state_ & STATE_SYSTEM_SELECTABLE) { | 3556 if (ia_state_ & STATE_SYSTEM_SELECTABLE) { |
| 3557 ia_state_ |= STATE_SYSTEM_FOCUSABLE; | 3557 ia_state_ |= STATE_SYSTEM_FOCUSABLE; |
| 3558 if (HasState(blink::WebAXStateFocused)) | 3558 if (HasState(ui::AX_STATE_FOCUSED)) |
| 3559 ia_state_ |= STATE_SYSTEM_FOCUSED; | 3559 ia_state_ |= STATE_SYSTEM_FOCUSED; |
| 3560 } | 3560 } |
| 3561 break; | 3561 break; |
| 3562 case blink::WebAXRoleListItem: | 3562 case ui::AX_ROLE_LIST_ITEM: |
| 3563 ia_role_ = ROLE_SYSTEM_LISTITEM; | 3563 ia_role_ = ROLE_SYSTEM_LISTITEM; |
| 3564 ia_state_ |= STATE_SYSTEM_READONLY; | 3564 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3565 break; | 3565 break; |
| 3566 case blink::WebAXRoleListMarker: | 3566 case ui::AX_ROLE_LIST_MARKER: |
| 3567 ia_role_ = ROLE_SYSTEM_TEXT; | 3567 ia_role_ = ROLE_SYSTEM_TEXT; |
| 3568 ia_state_ |= STATE_SYSTEM_READONLY; | 3568 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3569 break; | 3569 break; |
| 3570 case blink::WebAXRoleMath: | 3570 case ui::AX_ROLE_MATH_ELEMENT: |
| 3571 ia_role_ = ROLE_SYSTEM_EQUATION; | 3571 ia_role_ = ROLE_SYSTEM_EQUATION; |
| 3572 ia_state_ |= STATE_SYSTEM_READONLY; | 3572 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3573 break; | 3573 break; |
| 3574 case blink::WebAXRoleMenu: | 3574 case ui::AX_ROLE_MENU: |
| 3575 case blink::WebAXRoleMenuButton: | 3575 case ui::AX_ROLE_MENU_BUTTON: |
| 3576 ia_role_ = ROLE_SYSTEM_MENUPOPUP; | 3576 ia_role_ = ROLE_SYSTEM_MENUPOPUP; |
| 3577 break; | 3577 break; |
| 3578 case blink::WebAXRoleMenuBar: | 3578 case ui::AX_ROLE_MENU_BAR: |
| 3579 ia_role_ = ROLE_SYSTEM_MENUBAR; | 3579 ia_role_ = ROLE_SYSTEM_MENUBAR; |
| 3580 break; | 3580 break; |
| 3581 case blink::WebAXRoleMenuItem: | 3581 case ui::AX_ROLE_MENU_ITEM: |
| 3582 ia_role_ = ROLE_SYSTEM_MENUITEM; | 3582 ia_role_ = ROLE_SYSTEM_MENUITEM; |
| 3583 break; | 3583 break; |
| 3584 case blink::WebAXRoleMenuListPopup: | 3584 case ui::AX_ROLE_MENU_LIST_POPUP: |
| 3585 ia_role_ = ROLE_SYSTEM_CLIENT; | 3585 ia_role_ = ROLE_SYSTEM_CLIENT; |
| 3586 break; | 3586 break; |
| 3587 case blink::WebAXRoleMenuListOption: | 3587 case ui::AX_ROLE_MENU_LIST_OPTION: |
| 3588 ia_role_ = ROLE_SYSTEM_LISTITEM; | 3588 ia_role_ = ROLE_SYSTEM_LISTITEM; |
| 3589 if (ia_state_ & STATE_SYSTEM_SELECTABLE) { | 3589 if (ia_state_ & STATE_SYSTEM_SELECTABLE) { |
| 3590 ia_state_ |= STATE_SYSTEM_FOCUSABLE; | 3590 ia_state_ |= STATE_SYSTEM_FOCUSABLE; |
| 3591 if (HasState(blink::WebAXStateFocused)) | 3591 if (HasState(ui::AX_STATE_FOCUSED)) |
| 3592 ia_state_ |= STATE_SYSTEM_FOCUSED; | 3592 ia_state_ |= STATE_SYSTEM_FOCUSED; |
| 3593 } | 3593 } |
| 3594 break; | 3594 break; |
| 3595 case blink::WebAXRoleNote: | 3595 case ui::AX_ROLE_NOTE: |
| 3596 ia_role_ = ROLE_SYSTEM_GROUPING; | 3596 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3597 ia2_role_ = IA2_ROLE_NOTE; | 3597 ia2_role_ = IA2_ROLE_NOTE; |
| 3598 ia_state_ |= STATE_SYSTEM_READONLY; | 3598 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3599 break; | 3599 break; |
| 3600 case blink::WebAXRoleOutline: | 3600 case ui::AX_ROLE_OUTLINE: |
| 3601 ia_role_ = ROLE_SYSTEM_OUTLINE; | 3601 ia_role_ = ROLE_SYSTEM_OUTLINE; |
| 3602 ia_state_ |= STATE_SYSTEM_READONLY; | 3602 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3603 break; | 3603 break; |
| 3604 case blink::WebAXRoleParagraph: | 3604 case ui::AX_ROLE_PARAGRAPH: |
| 3605 role_name_ = L"P"; | 3605 role_name_ = L"P"; |
| 3606 ia2_role_ = IA2_ROLE_PARAGRAPH; | 3606 ia2_role_ = IA2_ROLE_PARAGRAPH; |
| 3607 break; | 3607 break; |
| 3608 case blink::WebAXRolePopUpButton: | 3608 case ui::AX_ROLE_POP_UP_BUTTON: |
| 3609 if (html_tag == L"select") { | 3609 if (html_tag == L"select") { |
| 3610 ia_role_ = ROLE_SYSTEM_COMBOBOX; | 3610 ia_role_ = ROLE_SYSTEM_COMBOBOX; |
| 3611 } else { | 3611 } else { |
| 3612 ia_role_ = ROLE_SYSTEM_BUTTONMENU; | 3612 ia_role_ = ROLE_SYSTEM_BUTTONMENU; |
| 3613 } | 3613 } |
| 3614 break; | 3614 break; |
| 3615 case blink::WebAXRoleProgressIndicator: | 3615 case ui::AX_ROLE_PROGRESS_INDICATOR: |
| 3616 ia_role_ = ROLE_SYSTEM_PROGRESSBAR; | 3616 ia_role_ = ROLE_SYSTEM_PROGRESSBAR; |
| 3617 ia_state_ |= STATE_SYSTEM_READONLY; | 3617 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3618 break; | 3618 break; |
| 3619 case blink::WebAXRoleRadioButton: | 3619 case ui::AX_ROLE_RADIO_BUTTON: |
| 3620 ia_role_ = ROLE_SYSTEM_RADIOBUTTON; | 3620 ia_role_ = ROLE_SYSTEM_RADIOBUTTON; |
| 3621 break; | 3621 break; |
| 3622 case blink::WebAXRoleRadioGroup: | 3622 case ui::AX_ROLE_RADIO_GROUP: |
| 3623 ia_role_ = ROLE_SYSTEM_GROUPING; | 3623 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3624 ia2_role_ = IA2_ROLE_SECTION; | 3624 ia2_role_ = IA2_ROLE_SECTION; |
| 3625 break; | 3625 break; |
| 3626 case blink::WebAXRoleRegion: | 3626 case ui::AX_ROLE_REGION: |
| 3627 ia_role_ = ROLE_SYSTEM_GROUPING; | 3627 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3628 ia2_role_ = IA2_ROLE_SECTION; | 3628 ia2_role_ = IA2_ROLE_SECTION; |
| 3629 ia_state_ |= STATE_SYSTEM_READONLY; | 3629 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3630 break; | 3630 break; |
| 3631 case blink::WebAXRoleRow: | 3631 case ui::AX_ROLE_ROW: |
| 3632 ia_role_ = ROLE_SYSTEM_ROW; | 3632 ia_role_ = ROLE_SYSTEM_ROW; |
| 3633 ia_state_ |= STATE_SYSTEM_READONLY; | 3633 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3634 break; | 3634 break; |
| 3635 case blink::WebAXRoleRowHeader: | 3635 case ui::AX_ROLE_ROW_HEADER: |
| 3636 ia_role_ = ROLE_SYSTEM_ROWHEADER; | 3636 ia_role_ = ROLE_SYSTEM_ROWHEADER; |
| 3637 ia_state_ |= STATE_SYSTEM_READONLY; | 3637 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3638 break; | 3638 break; |
| 3639 case blink::WebAXRoleRuler: | 3639 case ui::AX_ROLE_RULER: |
| 3640 ia_role_ = ROLE_SYSTEM_CLIENT; | 3640 ia_role_ = ROLE_SYSTEM_CLIENT; |
| 3641 ia2_role_ = IA2_ROLE_RULER; | 3641 ia2_role_ = IA2_ROLE_RULER; |
| 3642 ia_state_ |= STATE_SYSTEM_READONLY; | 3642 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3643 break; | 3643 break; |
| 3644 case blink::WebAXRoleScrollArea: | 3644 case ui::AX_ROLE_SCROLL_AREA: |
| 3645 ia_role_ = ROLE_SYSTEM_CLIENT; | 3645 ia_role_ = ROLE_SYSTEM_CLIENT; |
| 3646 ia2_role_ = IA2_ROLE_SCROLL_PANE; | 3646 ia2_role_ = IA2_ROLE_SCROLL_PANE; |
| 3647 ia_state_ |= STATE_SYSTEM_READONLY; | 3647 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3648 break; | 3648 break; |
| 3649 case blink::WebAXRoleScrollBar: | 3649 case ui::AX_ROLE_SCROLL_BAR: |
| 3650 ia_role_ = ROLE_SYSTEM_SCROLLBAR; | 3650 ia_role_ = ROLE_SYSTEM_SCROLLBAR; |
| 3651 break; | 3651 break; |
| 3652 case blink::WebAXRoleSlider: | 3652 case ui::AX_ROLE_SLIDER: |
| 3653 ia_role_ = ROLE_SYSTEM_SLIDER; | 3653 ia_role_ = ROLE_SYSTEM_SLIDER; |
| 3654 break; | 3654 break; |
| 3655 case blink::WebAXRoleSpinButton: | 3655 case ui::AX_ROLE_SPIN_BUTTON: |
| 3656 ia_role_ = ROLE_SYSTEM_SPINBUTTON; | 3656 ia_role_ = ROLE_SYSTEM_SPINBUTTON; |
| 3657 break; | 3657 break; |
| 3658 case blink::WebAXRoleSpinButtonPart: | 3658 case ui::AX_ROLE_SPIN_BUTTON_PART: |
| 3659 ia_role_ = ROLE_SYSTEM_PUSHBUTTON; | 3659 ia_role_ = ROLE_SYSTEM_PUSHBUTTON; |
| 3660 break; | 3660 break; |
| 3661 case blink::WebAXRoleSplitGroup: | 3661 case ui::AX_ROLE_SPLIT_GROUP: |
| 3662 ia_role_ = ROLE_SYSTEM_CLIENT; | 3662 ia_role_ = ROLE_SYSTEM_CLIENT; |
| 3663 ia2_role_ = IA2_ROLE_SPLIT_PANE; | 3663 ia2_role_ = IA2_ROLE_SPLIT_PANE; |
| 3664 ia_state_ |= STATE_SYSTEM_READONLY; | 3664 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3665 break; | 3665 break; |
| 3666 case blink::WebAXRoleAnnotation: | 3666 case ui::AX_ROLE_ANNOTATION: |
| 3667 case blink::WebAXRoleStaticText: | 3667 case ui::AX_ROLE_STATIC_TEXT: |
| 3668 ia_role_ = ROLE_SYSTEM_TEXT; | 3668 ia_role_ = ROLE_SYSTEM_TEXT; |
| 3669 ia_state_ |= STATE_SYSTEM_READONLY; | 3669 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3670 break; | 3670 break; |
| 3671 case blink::WebAXRoleStatus: | 3671 case ui::AX_ROLE_STATUS: |
| 3672 ia_role_ = ROLE_SYSTEM_STATUSBAR; | 3672 ia_role_ = ROLE_SYSTEM_STATUSBAR; |
| 3673 ia_state_ |= STATE_SYSTEM_READONLY; | 3673 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3674 break; | 3674 break; |
| 3675 case blink::WebAXRoleSplitter: | 3675 case ui::AX_ROLE_SPLITTER: |
| 3676 ia_role_ = ROLE_SYSTEM_SEPARATOR; | 3676 ia_role_ = ROLE_SYSTEM_SEPARATOR; |
| 3677 break; | 3677 break; |
| 3678 case blink::WebAXRoleSVGRoot: | 3678 case ui::AX_ROLE_SVG_ROOT: |
| 3679 ia_role_ = ROLE_SYSTEM_GRAPHIC; | 3679 ia_role_ = ROLE_SYSTEM_GRAPHIC; |
| 3680 break; | 3680 break; |
| 3681 case blink::WebAXRoleTab: | 3681 case ui::AX_ROLE_TAB: |
| 3682 ia_role_ = ROLE_SYSTEM_PAGETAB; | 3682 ia_role_ = ROLE_SYSTEM_PAGETAB; |
| 3683 break; | 3683 break; |
| 3684 case blink::WebAXRoleTable: { | 3684 case ui::AX_ROLE_TABLE: { |
| 3685 base::string16 aria_role = GetString16Attribute( | 3685 base::string16 aria_role = GetString16Attribute( |
| 3686 AccessibilityNodeData::ATTR_ROLE); | 3686 ui::AX_ATTR_ROLE); |
| 3687 if (aria_role == L"treegrid") { | 3687 if (aria_role == L"treegrid") { |
| 3688 ia_role_ = ROLE_SYSTEM_OUTLINE; | 3688 ia_role_ = ROLE_SYSTEM_OUTLINE; |
| 3689 } else { | 3689 } else { |
| 3690 ia_role_ = ROLE_SYSTEM_TABLE; | 3690 ia_role_ = ROLE_SYSTEM_TABLE; |
| 3691 ia_state_ |= STATE_SYSTEM_READONLY; | 3691 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3692 } | 3692 } |
| 3693 break; | 3693 break; |
| 3694 } | 3694 } |
| 3695 case blink::WebAXRoleTableHeaderContainer: | 3695 case ui::AX_ROLE_TABLE_HEADER_CONTAINER: |
| 3696 ia_role_ = ROLE_SYSTEM_GROUPING; | 3696 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3697 ia2_role_ = IA2_ROLE_SECTION; | 3697 ia2_role_ = IA2_ROLE_SECTION; |
| 3698 ia_state_ |= STATE_SYSTEM_READONLY; | 3698 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3699 break; | 3699 break; |
| 3700 case blink::WebAXRoleTabList: | 3700 case ui::AX_ROLE_TAB_LIST: |
| 3701 ia_role_ = ROLE_SYSTEM_PAGETABLIST; | 3701 ia_role_ = ROLE_SYSTEM_PAGETABLIST; |
| 3702 break; | 3702 break; |
| 3703 case blink::WebAXRoleTabPanel: | 3703 case ui::AX_ROLE_TAB_PANEL: |
| 3704 ia_role_ = ROLE_SYSTEM_PROPERTYPAGE; | 3704 ia_role_ = ROLE_SYSTEM_PROPERTYPAGE; |
| 3705 break; | 3705 break; |
| 3706 case blink::WebAXRoleToggleButton: | 3706 case ui::AX_ROLE_TOGGLE_BUTTON: |
| 3707 ia_role_ = ROLE_SYSTEM_PUSHBUTTON; | 3707 ia_role_ = ROLE_SYSTEM_PUSHBUTTON; |
| 3708 ia2_role_ = IA2_ROLE_TOGGLE_BUTTON; | 3708 ia2_role_ = IA2_ROLE_TOGGLE_BUTTON; |
| 3709 break; | 3709 break; |
| 3710 case blink::WebAXRoleTextArea: | 3710 case ui::AX_ROLE_TEXT_AREA: |
| 3711 ia_role_ = ROLE_SYSTEM_TEXT; | 3711 ia_role_ = ROLE_SYSTEM_TEXT; |
| 3712 ia2_state_ |= IA2_STATE_MULTI_LINE; | 3712 ia2_state_ |= IA2_STATE_MULTI_LINE; |
| 3713 ia2_state_ |= IA2_STATE_EDITABLE; | 3713 ia2_state_ |= IA2_STATE_EDITABLE; |
| 3714 ia2_state_ |= IA2_STATE_SELECTABLE_TEXT; | 3714 ia2_state_ |= IA2_STATE_SELECTABLE_TEXT; |
| 3715 break; | 3715 break; |
| 3716 case blink::WebAXRoleTextField: | 3716 case ui::AX_ROLE_TEXT_FIELD: |
| 3717 ia_role_ = ROLE_SYSTEM_TEXT; | 3717 ia_role_ = ROLE_SYSTEM_TEXT; |
| 3718 ia2_state_ |= IA2_STATE_SINGLE_LINE; | 3718 ia2_state_ |= IA2_STATE_SINGLE_LINE; |
| 3719 ia2_state_ |= IA2_STATE_EDITABLE; | 3719 ia2_state_ |= IA2_STATE_EDITABLE; |
| 3720 ia2_state_ |= IA2_STATE_SELECTABLE_TEXT; | 3720 ia2_state_ |= IA2_STATE_SELECTABLE_TEXT; |
| 3721 break; | 3721 break; |
| 3722 case blink::WebAXRoleTimer: | 3722 case ui::AX_ROLE_TIMER: |
| 3723 ia_role_ = ROLE_SYSTEM_CLOCK; | 3723 ia_role_ = ROLE_SYSTEM_CLOCK; |
| 3724 ia_state_ |= STATE_SYSTEM_READONLY; | 3724 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3725 break; | 3725 break; |
| 3726 case blink::WebAXRoleToolbar: | 3726 case ui::AX_ROLE_TOOLBAR: |
| 3727 ia_role_ = ROLE_SYSTEM_TOOLBAR; | 3727 ia_role_ = ROLE_SYSTEM_TOOLBAR; |
| 3728 ia_state_ |= STATE_SYSTEM_READONLY; | 3728 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3729 break; | 3729 break; |
| 3730 case blink::WebAXRoleUserInterfaceTooltip: | 3730 case ui::AX_ROLE_TOOLTIP: |
| 3731 ia_role_ = ROLE_SYSTEM_TOOLTIP; | 3731 ia_role_ = ROLE_SYSTEM_TOOLTIP; |
| 3732 ia_state_ |= STATE_SYSTEM_READONLY; | 3732 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3733 break; | 3733 break; |
| 3734 case blink::WebAXRoleTree: | 3734 case ui::AX_ROLE_TREE: |
| 3735 ia_role_ = ROLE_SYSTEM_OUTLINE; | 3735 ia_role_ = ROLE_SYSTEM_OUTLINE; |
| 3736 ia_state_ |= STATE_SYSTEM_READONLY; | 3736 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3737 break; | 3737 break; |
| 3738 case blink::WebAXRoleTreeGrid: | 3738 case ui::AX_ROLE_TREE_GRID: |
| 3739 ia_role_ = ROLE_SYSTEM_OUTLINE; | 3739 ia_role_ = ROLE_SYSTEM_OUTLINE; |
| 3740 ia_state_ |= STATE_SYSTEM_READONLY; | 3740 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3741 break; | 3741 break; |
| 3742 case blink::WebAXRoleTreeItem: | 3742 case ui::AX_ROLE_TREE_ITEM: |
| 3743 ia_role_ = ROLE_SYSTEM_OUTLINEITEM; | 3743 ia_role_ = ROLE_SYSTEM_OUTLINEITEM; |
| 3744 ia_state_ |= STATE_SYSTEM_READONLY; | 3744 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3745 break; | 3745 break; |
| 3746 case blink::WebAXRoleWindow: | 3746 case ui::AX_ROLE_WINDOW: |
| 3747 ia_role_ = ROLE_SYSTEM_WINDOW; | 3747 ia_role_ = ROLE_SYSTEM_WINDOW; |
| 3748 break; | 3748 break; |
| 3749 | 3749 |
| 3750 // TODO(dmazzoni): figure out the proper MSAA role for all of these. | 3750 // TODO(dmazzoni): figure out the proper MSAA role for all of these. |
| 3751 case blink::WebAXRoleBrowser: | 3751 case ui::AX_ROLE_BROWSER: |
| 3752 case blink::WebAXRoleDirectory: | 3752 case ui::AX_ROLE_DIRECTORY: |
| 3753 case blink::WebAXRoleDrawer: | 3753 case ui::AX_ROLE_DRAWER: |
| 3754 case blink::WebAXRoleHelpTag: | 3754 case ui::AX_ROLE_HELP_TAG: |
| 3755 case blink::WebAXRoleIgnored: | 3755 case ui::AX_ROLE_IGNORED: |
| 3756 case blink::WebAXRoleIncrementor: | 3756 case ui::AX_ROLE_INCREMENTOR: |
| 3757 case blink::WebAXRoleLog: | 3757 case ui::AX_ROLE_LOG: |
| 3758 case blink::WebAXRoleMarquee: | 3758 case ui::AX_ROLE_MARQUEE: |
| 3759 case blink::WebAXRoleMatte: | 3759 case ui::AX_ROLE_MATTE: |
| 3760 case blink::WebAXRolePresentational: | 3760 case ui::AX_ROLE_PRESENTATIONAL: |
| 3761 case blink::WebAXRoleRulerMarker: | 3761 case ui::AX_ROLE_RULER_MARKER: |
| 3762 case blink::WebAXRoleSheet: | 3762 case ui::AX_ROLE_SHEET: |
| 3763 case blink::WebAXRoleSliderThumb: | 3763 case ui::AX_ROLE_SLIDER_THUMB: |
| 3764 case blink::WebAXRoleSystemWide: | 3764 case ui::AX_ROLE_SYSTEM_WIDE: |
| 3765 case blink::WebAXRoleValueIndicator: | 3765 case ui::AX_ROLE_VALUE_INDICATOR: |
| 3766 default: | 3766 default: |
| 3767 ia_role_ = ROLE_SYSTEM_CLIENT; | 3767 ia_role_ = ROLE_SYSTEM_CLIENT; |
| 3768 break; | 3768 break; |
| 3769 } | 3769 } |
| 3770 | 3770 |
| 3771 // Compute the final value of READONLY for MSAA. | 3771 // Compute the final value of READONLY for MSAA. |
| 3772 // | 3772 // |
| 3773 // We always set the READONLY state for elements that have the | 3773 // We always set the READONLY state for elements that have the |
| 3774 // aria-readonly attribute and for a few roles (in the switch above). | 3774 // aria-readonly attribute and for a few roles (in the switch above). |
| 3775 // We clear the READONLY state on focusable controls and on a document. | 3775 // We clear the READONLY state on focusable controls and on a document. |
| 3776 // Everything else, the majority of objects, do not have this state set. | 3776 // Everything else, the majority of objects, do not have this state set. |
| 3777 if (HasState(blink::WebAXStateFocusable) && | 3777 if (HasState(ui::AX_STATE_FOCUSABLE) && |
| 3778 ia_role_ != ROLE_SYSTEM_DOCUMENT) { | 3778 ia_role_ != ROLE_SYSTEM_DOCUMENT) { |
| 3779 ia_state_ &= ~(STATE_SYSTEM_READONLY); | 3779 ia_state_ &= ~(STATE_SYSTEM_READONLY); |
| 3780 } | 3780 } |
| 3781 if (!HasState(blink::WebAXStateReadonly)) | 3781 if (!HasState(ui::AX_STATE_READONLY)) |
| 3782 ia_state_ &= ~(STATE_SYSTEM_READONLY); | 3782 ia_state_ &= ~(STATE_SYSTEM_READONLY); |
| 3783 if (GetBoolAttribute(AccessibilityNodeData::ATTR_ARIA_READONLY)) | 3783 if (GetBoolAttribute(ui::AX_ATTR_ARIA_READONLY)) |
| 3784 ia_state_ |= STATE_SYSTEM_READONLY; | 3784 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3785 | 3785 |
| 3786 // The role should always be set. | 3786 // The role should always be set. |
| 3787 DCHECK(!role_name_.empty() || ia_role_); | 3787 DCHECK(!role_name_.empty() || ia_role_); |
| 3788 | 3788 |
| 3789 // If we didn't explicitly set the IAccessible2 role, make it the same | 3789 // If we didn't explicitly set the IAccessible2 role, make it the same |
| 3790 // as the MSAA role. | 3790 // as the MSAA role. |
| 3791 if (!ia2_role_) | 3791 if (!ia2_role_) |
| 3792 ia2_role_ = ia_role_; | 3792 ia2_role_ = ia_role_; |
| 3793 } | 3793 } |
| 3794 | 3794 |
| 3795 } // namespace content | 3795 } // namespace content |
| OLD | NEW |