| 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/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "base/win/enum_variant.h" | 13 #include "base/win/enum_variant.h" |
| 14 #include "base/win/scoped_comptr.h" | 14 #include "base/win/scoped_comptr.h" |
| 15 #include "base/win/windows_version.h" | 15 #include "base/win/windows_version.h" |
| 16 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 16 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
| 17 #include "content/common/accessibility_messages.h" | 17 #include "content/common/accessibility_messages.h" |
| 18 #include "ui/base/accessibility/accessible_text_utils.h" | 18 #include "ui/base/accessibility/accessible_text_utils.h" |
| 19 #include "ui/base/win/accessibility_misc_utils.h" | 19 #include "ui/base/win/accessibility_misc_utils.h" |
| 20 | 20 |
| 21 using webkit_glue::WebAccessibility; | 21 using content::AccessibilityNodeData; |
| 22 | 22 |
| 23 // The GUID for the ISimpleDOM service is not defined in the IDL files. | 23 // The GUID for the ISimpleDOM service is not defined in the IDL files. |
| 24 // This is taken directly from the Mozilla sources | 24 // This is taken directly from the Mozilla sources |
| 25 // (accessible/src/msaa/nsAccessNodeWrap.cpp) and it's also documented at: | 25 // (accessible/src/msaa/nsAccessNodeWrap.cpp) and it's also documented at: |
| 26 // http://developer.mozilla.org/en/Accessibility/AT-APIs/ImplementationFeatures/
MSAA | 26 // http://developer.mozilla.org/en/Accessibility/AT-APIs/ImplementationFeatures/
MSAA |
| 27 | 27 |
| 28 const GUID GUID_ISimpleDOM = { | 28 const GUID GUID_ISimpleDOM = { |
| 29 0x0c539790, 0x12e4, 0x11cf, | 29 0x0c539790, 0x12e4, 0x11cf, |
| 30 0xb6, 0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8}; | 30 0xb6, 0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8}; |
| 31 | 31 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 return E_FAIL; | 345 return E_FAIL; |
| 346 | 346 |
| 347 if (!def_action) | 347 if (!def_action) |
| 348 return E_INVALIDARG; | 348 return E_INVALIDARG; |
| 349 | 349 |
| 350 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 350 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 351 if (!target) | 351 if (!target) |
| 352 return E_INVALIDARG; | 352 return E_INVALIDARG; |
| 353 | 353 |
| 354 return target->GetStringAttributeAsBstr( | 354 return target->GetStringAttributeAsBstr( |
| 355 WebAccessibility::ATTR_SHORTCUT, def_action); | 355 AccessibilityNodeData::ATTR_SHORTCUT, def_action); |
| 356 } | 356 } |
| 357 | 357 |
| 358 STDMETHODIMP BrowserAccessibilityWin::get_accDescription(VARIANT var_id, | 358 STDMETHODIMP BrowserAccessibilityWin::get_accDescription(VARIANT var_id, |
| 359 BSTR* desc) { | 359 BSTR* desc) { |
| 360 if (!instance_active_) | 360 if (!instance_active_) |
| 361 return E_FAIL; | 361 return E_FAIL; |
| 362 | 362 |
| 363 if (!desc) | 363 if (!desc) |
| 364 return E_INVALIDARG; | 364 return E_INVALIDARG; |
| 365 | 365 |
| 366 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 366 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 367 if (!target) | 367 if (!target) |
| 368 return E_INVALIDARG; | 368 return E_INVALIDARG; |
| 369 | 369 |
| 370 return target->GetStringAttributeAsBstr( | 370 return target->GetStringAttributeAsBstr( |
| 371 WebAccessibility::ATTR_DESCRIPTION, desc); | 371 AccessibilityNodeData::ATTR_DESCRIPTION, desc); |
| 372 } | 372 } |
| 373 | 373 |
| 374 STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) { | 374 STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) { |
| 375 if (!instance_active_) | 375 if (!instance_active_) |
| 376 return E_FAIL; | 376 return E_FAIL; |
| 377 | 377 |
| 378 if (!focus_child) | 378 if (!focus_child) |
| 379 return E_INVALIDARG; | 379 return E_INVALIDARG; |
| 380 | 380 |
| 381 BrowserAccessibilityWin* focus = static_cast<BrowserAccessibilityWin*>( | 381 BrowserAccessibilityWin* focus = static_cast<BrowserAccessibilityWin*>( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 397 if (!instance_active_) | 397 if (!instance_active_) |
| 398 return E_FAIL; | 398 return E_FAIL; |
| 399 | 399 |
| 400 if (!help) | 400 if (!help) |
| 401 return E_INVALIDARG; | 401 return E_INVALIDARG; |
| 402 | 402 |
| 403 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 403 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 404 if (!target) | 404 if (!target) |
| 405 return E_INVALIDARG; | 405 return E_INVALIDARG; |
| 406 | 406 |
| 407 return target->GetStringAttributeAsBstr(WebAccessibility::ATTR_HELP, help); | 407 return target->GetStringAttributeAsBstr( |
| 408 AccessibilityNodeData::ATTR_HELP, help); |
| 408 } | 409 } |
| 409 | 410 |
| 410 STDMETHODIMP BrowserAccessibilityWin::get_accKeyboardShortcut(VARIANT var_id, | 411 STDMETHODIMP BrowserAccessibilityWin::get_accKeyboardShortcut(VARIANT var_id, |
| 411 BSTR* acc_key) { | 412 BSTR* acc_key) { |
| 412 if (!instance_active_) | 413 if (!instance_active_) |
| 413 return E_FAIL; | 414 return E_FAIL; |
| 414 | 415 |
| 415 if (!acc_key) | 416 if (!acc_key) |
| 416 return E_INVALIDARG; | 417 return E_INVALIDARG; |
| 417 | 418 |
| 418 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 419 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 419 if (!target) | 420 if (!target) |
| 420 return E_INVALIDARG; | 421 return E_INVALIDARG; |
| 421 | 422 |
| 422 return target->GetStringAttributeAsBstr( | 423 return target->GetStringAttributeAsBstr( |
| 423 WebAccessibility::ATTR_SHORTCUT, acc_key); | 424 AccessibilityNodeData::ATTR_SHORTCUT, acc_key); |
| 424 } | 425 } |
| 425 | 426 |
| 426 STDMETHODIMP BrowserAccessibilityWin::get_accName(VARIANT var_id, BSTR* name) { | 427 STDMETHODIMP BrowserAccessibilityWin::get_accName(VARIANT var_id, BSTR* name) { |
| 427 if (!instance_active_) | 428 if (!instance_active_) |
| 428 return E_FAIL; | 429 return E_FAIL; |
| 429 | 430 |
| 430 if (!name) | 431 if (!name) |
| 431 return E_INVALIDARG; | 432 return E_INVALIDARG; |
| 432 | 433 |
| 433 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 434 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 434 if (!target) | 435 if (!target) |
| 435 return E_INVALIDARG; | 436 return E_INVALIDARG; |
| 436 | 437 |
| 437 string16 name_str = target->name_; | 438 string16 name_str = target->name_; |
| 438 | 439 |
| 439 // If the name is empty, see if it's labeled by another element. | 440 // If the name is empty, see if it's labeled by another element. |
| 440 if (name_str.empty()) { | 441 if (name_str.empty()) { |
| 441 int title_elem_id; | 442 int title_elem_id; |
| 442 if (target->GetIntAttribute(WebAccessibility::ATTR_TITLE_UI_ELEMENT, | 443 if (target->GetIntAttribute(AccessibilityNodeData::ATTR_TITLE_UI_ELEMENT, |
| 443 &title_elem_id)) { | 444 &title_elem_id)) { |
| 444 BrowserAccessibility* title_elem = | 445 BrowserAccessibility* title_elem = |
| 445 manager_->GetFromRendererID(title_elem_id); | 446 manager_->GetFromRendererID(title_elem_id); |
| 446 if (title_elem) | 447 if (title_elem) |
| 447 name_str = title_elem->GetTextRecursive(); | 448 name_str = title_elem->GetTextRecursive(); |
| 448 } | 449 } |
| 449 } | 450 } |
| 450 | 451 |
| 451 if (name_str.empty()) | 452 if (name_str.empty()) |
| 452 return S_FALSE; | 453 return S_FALSE; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 | 540 |
| 540 STDMETHODIMP BrowserAccessibilityWin::get_accHelpTopic( | 541 STDMETHODIMP BrowserAccessibilityWin::get_accHelpTopic( |
| 541 BSTR* help_file, VARIANT var_id, LONG* topic_id) { | 542 BSTR* help_file, VARIANT var_id, LONG* topic_id) { |
| 542 return E_NOTIMPL; | 543 return E_NOTIMPL; |
| 543 } | 544 } |
| 544 | 545 |
| 545 STDMETHODIMP BrowserAccessibilityWin::get_accSelection(VARIANT* selected) { | 546 STDMETHODIMP BrowserAccessibilityWin::get_accSelection(VARIANT* selected) { |
| 546 if (!instance_active_) | 547 if (!instance_active_) |
| 547 return E_FAIL; | 548 return E_FAIL; |
| 548 | 549 |
| 549 if (role_ != WebAccessibility::ROLE_LISTBOX) | 550 if (role_ != AccessibilityNodeData::ROLE_LISTBOX) |
| 550 return E_NOTIMPL; | 551 return E_NOTIMPL; |
| 551 | 552 |
| 552 unsigned long selected_count = 0; | 553 unsigned long selected_count = 0; |
| 553 for (size_t i = 0; i < children_.size(); ++i) { | 554 for (size_t i = 0; i < children_.size(); ++i) { |
| 554 if (children_[i]->HasState(WebAccessibility::STATE_SELECTED)) | 555 if (children_[i]->HasState(AccessibilityNodeData::STATE_SELECTED)) |
| 555 ++selected_count; | 556 ++selected_count; |
| 556 } | 557 } |
| 557 | 558 |
| 558 if (selected_count == 0) { | 559 if (selected_count == 0) { |
| 559 selected->vt = VT_EMPTY; | 560 selected->vt = VT_EMPTY; |
| 560 return S_OK; | 561 return S_OK; |
| 561 } | 562 } |
| 562 | 563 |
| 563 if (selected_count == 1) { | 564 if (selected_count == 1) { |
| 564 for (size_t i = 0; i < children_.size(); ++i) { | 565 for (size_t i = 0; i < children_.size(); ++i) { |
| 565 if (children_[i]->HasState(WebAccessibility::STATE_SELECTED)) { | 566 if (children_[i]->HasState(AccessibilityNodeData::STATE_SELECTED)) { |
| 566 selected->vt = VT_DISPATCH; | 567 selected->vt = VT_DISPATCH; |
| 567 selected->pdispVal = | 568 selected->pdispVal = |
| 568 children_[i]->ToBrowserAccessibilityWin()->NewReference(); | 569 children_[i]->ToBrowserAccessibilityWin()->NewReference(); |
| 569 return S_OK; | 570 return S_OK; |
| 570 } | 571 } |
| 571 } | 572 } |
| 572 } | 573 } |
| 573 | 574 |
| 574 // Multiple items are selected. | 575 // Multiple items are selected. |
| 575 base::win::EnumVariant* enum_variant = | 576 base::win::EnumVariant* enum_variant = |
| 576 new base::win::EnumVariant(selected_count); | 577 new base::win::EnumVariant(selected_count); |
| 577 enum_variant->AddRef(); | 578 enum_variant->AddRef(); |
| 578 unsigned long index = 0; | 579 unsigned long index = 0; |
| 579 for (size_t i = 0; i < children_.size(); ++i) { | 580 for (size_t i = 0; i < children_.size(); ++i) { |
| 580 if (children_[i]->HasState(WebAccessibility::STATE_SELECTED)) { | 581 if (children_[i]->HasState(AccessibilityNodeData::STATE_SELECTED)) { |
| 581 enum_variant->ItemAt(index)->vt = VT_DISPATCH; | 582 enum_variant->ItemAt(index)->vt = VT_DISPATCH; |
| 582 enum_variant->ItemAt(index)->pdispVal = | 583 enum_variant->ItemAt(index)->pdispVal = |
| 583 children_[i]->ToBrowserAccessibilityWin()->NewReference(); | 584 children_[i]->ToBrowserAccessibilityWin()->NewReference(); |
| 584 ++index; | 585 ++index; |
| 585 } | 586 } |
| 586 } | 587 } |
| 587 selected->vt = VT_UNKNOWN; | 588 selected->vt = VT_UNKNOWN; |
| 588 selected->punkVal = static_cast<IUnknown*>( | 589 selected->punkVal = static_cast<IUnknown*>( |
| 589 static_cast<base::win::IUnknownImpl*>(enum_variant)); | 590 static_cast<base::win::IUnknownImpl*>(enum_variant)); |
| 590 return S_OK; | 591 return S_OK; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( | 816 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( |
| 816 LONG* group_level, | 817 LONG* group_level, |
| 817 LONG* similar_items_in_group, | 818 LONG* similar_items_in_group, |
| 818 LONG* position_in_group) { | 819 LONG* position_in_group) { |
| 819 if (!instance_active_) | 820 if (!instance_active_) |
| 820 return E_FAIL; | 821 return E_FAIL; |
| 821 | 822 |
| 822 if (!group_level || !similar_items_in_group || !position_in_group) | 823 if (!group_level || !similar_items_in_group || !position_in_group) |
| 823 return E_INVALIDARG; | 824 return E_INVALIDARG; |
| 824 | 825 |
| 825 if (role_ == WebAccessibility::ROLE_LISTBOX_OPTION && | 826 if (role_ == AccessibilityNodeData::ROLE_LISTBOX_OPTION && |
| 826 parent_ && | 827 parent_ && |
| 827 parent_->role() == WebAccessibility::ROLE_LISTBOX) { | 828 parent_->role() == AccessibilityNodeData::ROLE_LISTBOX) { |
| 828 *group_level = 0; | 829 *group_level = 0; |
| 829 *similar_items_in_group = parent_->child_count(); | 830 *similar_items_in_group = parent_->child_count(); |
| 830 *position_in_group = index_in_parent_ + 1; | 831 *position_in_group = index_in_parent_ + 1; |
| 831 return S_OK; | 832 return S_OK; |
| 832 } | 833 } |
| 833 | 834 |
| 834 return E_NOTIMPL; | 835 return E_NOTIMPL; |
| 835 } | 836 } |
| 836 | 837 |
| 837 // | 838 // |
| 838 // IAccessibleImage methods. | 839 // IAccessibleImage methods. |
| 839 // | 840 // |
| 840 | 841 |
| 841 STDMETHODIMP BrowserAccessibilityWin::get_description(BSTR* desc) { | 842 STDMETHODIMP BrowserAccessibilityWin::get_description(BSTR* desc) { |
| 842 if (!instance_active_) | 843 if (!instance_active_) |
| 843 return E_FAIL; | 844 return E_FAIL; |
| 844 | 845 |
| 845 if (!desc) | 846 if (!desc) |
| 846 return E_INVALIDARG; | 847 return E_INVALIDARG; |
| 847 | 848 |
| 848 return GetStringAttributeAsBstr(WebAccessibility::ATTR_DESCRIPTION, desc); | 849 return GetStringAttributeAsBstr( |
| 850 AccessibilityNodeData::ATTR_DESCRIPTION, desc); |
| 849 } | 851 } |
| 850 | 852 |
| 851 STDMETHODIMP BrowserAccessibilityWin::get_imagePosition( | 853 STDMETHODIMP BrowserAccessibilityWin::get_imagePosition( |
| 852 enum IA2CoordinateType coordinate_type, LONG* x, LONG* y) { | 854 enum IA2CoordinateType coordinate_type, LONG* x, LONG* y) { |
| 853 if (!instance_active_) | 855 if (!instance_active_) |
| 854 return E_FAIL; | 856 return E_FAIL; |
| 855 | 857 |
| 856 if (!x || !y) | 858 if (!x || !y) |
| 857 return E_INVALIDARG; | 859 return E_INVALIDARG; |
| 858 | 860 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 long column, | 899 long column, |
| 898 IUnknown** accessible) { | 900 IUnknown** accessible) { |
| 899 if (!instance_active_) | 901 if (!instance_active_) |
| 900 return E_FAIL; | 902 return E_FAIL; |
| 901 | 903 |
| 902 if (!accessible) | 904 if (!accessible) |
| 903 return E_INVALIDARG; | 905 return E_INVALIDARG; |
| 904 | 906 |
| 905 int columns; | 907 int columns; |
| 906 int rows; | 908 int rows; |
| 907 if (!GetIntAttribute(WebAccessibility::ATTR_TABLE_COLUMN_COUNT, &columns) || | 909 if (!GetIntAttribute( |
| 908 !GetIntAttribute(WebAccessibility::ATTR_TABLE_ROW_COUNT, &rows) || | 910 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 911 !GetIntAttribute( |
| 912 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows) || |
| 909 columns <= 0 || | 913 columns <= 0 || |
| 910 rows <= 0) { | 914 rows <= 0) { |
| 911 return S_FALSE; | 915 return S_FALSE; |
| 912 } | 916 } |
| 913 | 917 |
| 914 if (row < 0 || row >= rows || column < 0 || column >= columns) | 918 if (row < 0 || row >= rows || column < 0 || column >= columns) |
| 915 return E_INVALIDARG; | 919 return E_INVALIDARG; |
| 916 | 920 |
| 917 DCHECK_EQ(columns * rows, static_cast<int>(cell_ids_.size())); | 921 DCHECK_EQ(columns * rows, static_cast<int>(cell_ids_.size())); |
| 918 | 922 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 943 long column, | 947 long column, |
| 944 long* cell_index) { | 948 long* cell_index) { |
| 945 if (!instance_active_) | 949 if (!instance_active_) |
| 946 return E_FAIL; | 950 return E_FAIL; |
| 947 | 951 |
| 948 if (!cell_index) | 952 if (!cell_index) |
| 949 return E_INVALIDARG; | 953 return E_INVALIDARG; |
| 950 | 954 |
| 951 int columns; | 955 int columns; |
| 952 int rows; | 956 int rows; |
| 953 if (!GetIntAttribute(WebAccessibility::ATTR_TABLE_COLUMN_COUNT, &columns) || | 957 if (!GetIntAttribute( |
| 954 !GetIntAttribute(WebAccessibility::ATTR_TABLE_ROW_COUNT, &rows) || | 958 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 959 !GetIntAttribute( |
| 960 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows) || |
| 955 columns <= 0 || | 961 columns <= 0 || |
| 956 rows <= 0) { | 962 rows <= 0) { |
| 957 return S_FALSE; | 963 return S_FALSE; |
| 958 } | 964 } |
| 959 | 965 |
| 960 if (row < 0 || row >= rows || column < 0 || column >= columns) | 966 if (row < 0 || row >= rows || column < 0 || column >= columns) |
| 961 return E_INVALIDARG; | 967 return E_INVALIDARG; |
| 962 | 968 |
| 963 DCHECK_EQ(columns * rows, static_cast<int>(cell_ids_.size())); | 969 DCHECK_EQ(columns * rows, static_cast<int>(cell_ids_.size())); |
| 964 int cell_id = cell_ids_[row * columns + column]; | 970 int cell_id = cell_ids_[row * columns + column]; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 976 long column, | 982 long column, |
| 977 BSTR* description) { | 983 BSTR* description) { |
| 978 if (!instance_active_) | 984 if (!instance_active_) |
| 979 return E_FAIL; | 985 return E_FAIL; |
| 980 | 986 |
| 981 if (!description) | 987 if (!description) |
| 982 return E_INVALIDARG; | 988 return E_INVALIDARG; |
| 983 | 989 |
| 984 int columns; | 990 int columns; |
| 985 int rows; | 991 int rows; |
| 986 if (!GetIntAttribute(WebAccessibility::ATTR_TABLE_COLUMN_COUNT, &columns) || | 992 if (!GetIntAttribute( |
| 987 !GetIntAttribute(WebAccessibility::ATTR_TABLE_ROW_COUNT, &rows) || | 993 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 994 !GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows) || |
| 988 columns <= 0 || | 995 columns <= 0 || |
| 989 rows <= 0) { | 996 rows <= 0) { |
| 990 return S_FALSE; | 997 return S_FALSE; |
| 991 } | 998 } |
| 992 | 999 |
| 993 if (column < 0 || column >= columns) | 1000 if (column < 0 || column >= columns) |
| 994 return E_INVALIDARG; | 1001 return E_INVALIDARG; |
| 995 | 1002 |
| 996 for (int i = 0; i < rows; ++i) { | 1003 for (int i = 0; i < rows; ++i) { |
| 997 int cell_id = cell_ids_[i * columns + column]; | 1004 int cell_id = cell_ids_[i * columns + column]; |
| 998 BrowserAccessibilityWin* cell = static_cast<BrowserAccessibilityWin*>( | 1005 BrowserAccessibilityWin* cell = static_cast<BrowserAccessibilityWin*>( |
| 999 manager_->GetFromRendererID(cell_id)); | 1006 manager_->GetFromRendererID(cell_id)); |
| 1000 if (cell && cell->role_ == WebAccessibility::ROLE_COLUMN_HEADER) { | 1007 if (cell && cell->role_ == AccessibilityNodeData::ROLE_COLUMN_HEADER) { |
| 1001 if (cell->name_.size() > 0) { | 1008 if (cell->name_.size() > 0) { |
| 1002 *description = SysAllocString(cell->name_.c_str()); | 1009 *description = SysAllocString(cell->name_.c_str()); |
| 1003 return S_OK; | 1010 return S_OK; |
| 1004 } | 1011 } |
| 1005 | 1012 |
| 1006 return cell->GetStringAttributeAsBstr( | 1013 return cell->GetStringAttributeAsBstr( |
| 1007 WebAccessibility::ATTR_DESCRIPTION, description); | 1014 AccessibilityNodeData::ATTR_DESCRIPTION, description); |
| 1008 } | 1015 } |
| 1009 } | 1016 } |
| 1010 | 1017 |
| 1011 return S_FALSE; | 1018 return S_FALSE; |
| 1012 } | 1019 } |
| 1013 | 1020 |
| 1014 STDMETHODIMP BrowserAccessibilityWin::get_columnExtentAt( | 1021 STDMETHODIMP BrowserAccessibilityWin::get_columnExtentAt( |
| 1015 long row, | 1022 long row, |
| 1016 long column, | 1023 long column, |
| 1017 long* n_columns_spanned) { | 1024 long* n_columns_spanned) { |
| 1018 if (!instance_active_) | 1025 if (!instance_active_) |
| 1019 return E_FAIL; | 1026 return E_FAIL; |
| 1020 | 1027 |
| 1021 if (!n_columns_spanned) | 1028 if (!n_columns_spanned) |
| 1022 return E_INVALIDARG; | 1029 return E_INVALIDARG; |
| 1023 | 1030 |
| 1024 int columns; | 1031 int columns; |
| 1025 int rows; | 1032 int rows; |
| 1026 if (!GetIntAttribute(WebAccessibility::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1033 if (!GetIntAttribute( |
| 1027 !GetIntAttribute(WebAccessibility::ATTR_TABLE_ROW_COUNT, &rows) || | 1034 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1035 !GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows) || |
| 1028 columns <= 0 || | 1036 columns <= 0 || |
| 1029 rows <= 0) { | 1037 rows <= 0) { |
| 1030 return S_FALSE; | 1038 return S_FALSE; |
| 1031 } | 1039 } |
| 1032 | 1040 |
| 1033 if (row < 0 || row >= rows || column < 0 || column >= columns) | 1041 if (row < 0 || row >= rows || column < 0 || column >= columns) |
| 1034 return E_INVALIDARG; | 1042 return E_INVALIDARG; |
| 1035 | 1043 |
| 1036 int cell_id = cell_ids_[row * columns + column]; | 1044 int cell_id = cell_ids_[row * columns + column]; |
| 1037 BrowserAccessibilityWin* cell = static_cast<BrowserAccessibilityWin*>( | 1045 BrowserAccessibilityWin* cell = static_cast<BrowserAccessibilityWin*>( |
| 1038 manager_->GetFromRendererID(cell_id)); | 1046 manager_->GetFromRendererID(cell_id)); |
| 1039 int colspan; | 1047 int colspan; |
| 1040 if (cell && | 1048 if (cell && |
| 1041 cell->GetIntAttribute( | 1049 cell->GetIntAttribute( |
| 1042 WebAccessibility::ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && | 1050 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && |
| 1043 colspan >= 1) { | 1051 colspan >= 1) { |
| 1044 *n_columns_spanned = colspan; | 1052 *n_columns_spanned = colspan; |
| 1045 return S_OK; | 1053 return S_OK; |
| 1046 } | 1054 } |
| 1047 | 1055 |
| 1048 return S_FALSE; | 1056 return S_FALSE; |
| 1049 } | 1057 } |
| 1050 | 1058 |
| 1051 STDMETHODIMP BrowserAccessibilityWin::get_columnHeader( | 1059 STDMETHODIMP BrowserAccessibilityWin::get_columnHeader( |
| 1052 IAccessibleTable** accessible_table, | 1060 IAccessibleTable** accessible_table, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1069 return E_INVALIDARG; | 1077 return E_INVALIDARG; |
| 1070 if (cell_index >= cell_id_count) | 1078 if (cell_index >= cell_id_count) |
| 1071 return S_FALSE; | 1079 return S_FALSE; |
| 1072 | 1080 |
| 1073 int cell_id = unique_cell_ids_[cell_index]; | 1081 int cell_id = unique_cell_ids_[cell_index]; |
| 1074 BrowserAccessibilityWin* cell = | 1082 BrowserAccessibilityWin* cell = |
| 1075 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1083 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1076 int col_index; | 1084 int col_index; |
| 1077 if (cell && | 1085 if (cell && |
| 1078 cell->GetIntAttribute( | 1086 cell->GetIntAttribute( |
| 1079 WebAccessibility::ATTR_TABLE_CELL_COLUMN_INDEX, &col_index)) { | 1087 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &col_index)) { |
| 1080 *column_index = col_index; | 1088 *column_index = col_index; |
| 1081 return S_OK; | 1089 return S_OK; |
| 1082 } | 1090 } |
| 1083 | 1091 |
| 1084 return S_FALSE; | 1092 return S_FALSE; |
| 1085 } | 1093 } |
| 1086 | 1094 |
| 1087 STDMETHODIMP BrowserAccessibilityWin::get_nColumns( | 1095 STDMETHODIMP BrowserAccessibilityWin::get_nColumns( |
| 1088 long* column_count) { | 1096 long* column_count) { |
| 1089 if (!instance_active_) | 1097 if (!instance_active_) |
| 1090 return E_FAIL; | 1098 return E_FAIL; |
| 1091 | 1099 |
| 1092 if (!column_count) | 1100 if (!column_count) |
| 1093 return E_INVALIDARG; | 1101 return E_INVALIDARG; |
| 1094 | 1102 |
| 1095 int columns; | 1103 int columns; |
| 1096 if (GetIntAttribute(WebAccessibility::ATTR_TABLE_COLUMN_COUNT, &columns)) { | 1104 if (GetIntAttribute( |
| 1105 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns)) { |
| 1097 *column_count = columns; | 1106 *column_count = columns; |
| 1098 return S_OK; | 1107 return S_OK; |
| 1099 } | 1108 } |
| 1100 | 1109 |
| 1101 return S_FALSE; | 1110 return S_FALSE; |
| 1102 } | 1111 } |
| 1103 | 1112 |
| 1104 STDMETHODIMP BrowserAccessibilityWin::get_nRows( | 1113 STDMETHODIMP BrowserAccessibilityWin::get_nRows( |
| 1105 long* row_count) { | 1114 long* row_count) { |
| 1106 if (!instance_active_) | 1115 if (!instance_active_) |
| 1107 return E_FAIL; | 1116 return E_FAIL; |
| 1108 | 1117 |
| 1109 if (!row_count) | 1118 if (!row_count) |
| 1110 return E_INVALIDARG; | 1119 return E_INVALIDARG; |
| 1111 | 1120 |
| 1112 int rows; | 1121 int rows; |
| 1113 if (GetIntAttribute(WebAccessibility::ATTR_TABLE_ROW_COUNT, &rows)) { | 1122 if (GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows)) { |
| 1114 *row_count = rows; | 1123 *row_count = rows; |
| 1115 return S_OK; | 1124 return S_OK; |
| 1116 } | 1125 } |
| 1117 | 1126 |
| 1118 return S_FALSE; | 1127 return S_FALSE; |
| 1119 } | 1128 } |
| 1120 | 1129 |
| 1121 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedChildren( | 1130 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedChildren( |
| 1122 long* cell_count) { | 1131 long* cell_count) { |
| 1123 if (!instance_active_) | 1132 if (!instance_active_) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 long row, | 1168 long row, |
| 1160 BSTR* description) { | 1169 BSTR* description) { |
| 1161 if (!instance_active_) | 1170 if (!instance_active_) |
| 1162 return E_FAIL; | 1171 return E_FAIL; |
| 1163 | 1172 |
| 1164 if (!description) | 1173 if (!description) |
| 1165 return E_INVALIDARG; | 1174 return E_INVALIDARG; |
| 1166 | 1175 |
| 1167 int columns; | 1176 int columns; |
| 1168 int rows; | 1177 int rows; |
| 1169 if (!GetIntAttribute(WebAccessibility::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1178 if (!GetIntAttribute( |
| 1170 !GetIntAttribute(WebAccessibility::ATTR_TABLE_ROW_COUNT, &rows) || | 1179 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1180 !GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows) || |
| 1171 columns <= 0 || | 1181 columns <= 0 || |
| 1172 rows <= 0) { | 1182 rows <= 0) { |
| 1173 return S_FALSE; | 1183 return S_FALSE; |
| 1174 } | 1184 } |
| 1175 | 1185 |
| 1176 if (row < 0 || row >= rows) | 1186 if (row < 0 || row >= rows) |
| 1177 return E_INVALIDARG; | 1187 return E_INVALIDARG; |
| 1178 | 1188 |
| 1179 for (int i = 0; i < columns; ++i) { | 1189 for (int i = 0; i < columns; ++i) { |
| 1180 int cell_id = cell_ids_[row * columns + i]; | 1190 int cell_id = cell_ids_[row * columns + i]; |
| 1181 BrowserAccessibilityWin* cell = | 1191 BrowserAccessibilityWin* cell = |
| 1182 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1192 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1183 if (cell && cell->role_ == WebAccessibility::ROLE_ROW_HEADER) { | 1193 if (cell && cell->role_ == AccessibilityNodeData::ROLE_ROW_HEADER) { |
| 1184 if (cell->name_.size() > 0) { | 1194 if (cell->name_.size() > 0) { |
| 1185 *description = SysAllocString(cell->name_.c_str()); | 1195 *description = SysAllocString(cell->name_.c_str()); |
| 1186 return S_OK; | 1196 return S_OK; |
| 1187 } | 1197 } |
| 1188 | 1198 |
| 1189 return cell->GetStringAttributeAsBstr( | 1199 return cell->GetStringAttributeAsBstr( |
| 1190 WebAccessibility::ATTR_DESCRIPTION, description); | 1200 AccessibilityNodeData::ATTR_DESCRIPTION, description); |
| 1191 } | 1201 } |
| 1192 } | 1202 } |
| 1193 | 1203 |
| 1194 return S_FALSE; | 1204 return S_FALSE; |
| 1195 } | 1205 } |
| 1196 | 1206 |
| 1197 STDMETHODIMP BrowserAccessibilityWin::get_rowExtentAt( | 1207 STDMETHODIMP BrowserAccessibilityWin::get_rowExtentAt( |
| 1198 long row, | 1208 long row, |
| 1199 long column, | 1209 long column, |
| 1200 long* n_rows_spanned) { | 1210 long* n_rows_spanned) { |
| 1201 if (!instance_active_) | 1211 if (!instance_active_) |
| 1202 return E_FAIL; | 1212 return E_FAIL; |
| 1203 | 1213 |
| 1204 if (!n_rows_spanned) | 1214 if (!n_rows_spanned) |
| 1205 return E_INVALIDARG; | 1215 return E_INVALIDARG; |
| 1206 | 1216 |
| 1207 int columns; | 1217 int columns; |
| 1208 int rows; | 1218 int rows; |
| 1209 if (!GetIntAttribute(WebAccessibility::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1219 if (!GetIntAttribute( |
| 1210 !GetIntAttribute(WebAccessibility::ATTR_TABLE_ROW_COUNT, &rows) || | 1220 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1221 !GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows) || |
| 1211 columns <= 0 || | 1222 columns <= 0 || |
| 1212 rows <= 0) { | 1223 rows <= 0) { |
| 1213 return S_FALSE; | 1224 return S_FALSE; |
| 1214 } | 1225 } |
| 1215 | 1226 |
| 1216 if (row < 0 || row >= rows || column < 0 || column >= columns) | 1227 if (row < 0 || row >= rows || column < 0 || column >= columns) |
| 1217 return E_INVALIDARG; | 1228 return E_INVALIDARG; |
| 1218 | 1229 |
| 1219 int cell_id = cell_ids_[row * columns + column]; | 1230 int cell_id = cell_ids_[row * columns + column]; |
| 1220 BrowserAccessibilityWin* cell = | 1231 BrowserAccessibilityWin* cell = |
| 1221 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1232 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1222 int rowspan; | 1233 int rowspan; |
| 1223 if (cell && | 1234 if (cell && |
| 1224 cell->GetIntAttribute( | 1235 cell->GetIntAttribute( |
| 1225 WebAccessibility::ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && | 1236 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && |
| 1226 rowspan >= 1) { | 1237 rowspan >= 1) { |
| 1227 *n_rows_spanned = rowspan; | 1238 *n_rows_spanned = rowspan; |
| 1228 return S_OK; | 1239 return S_OK; |
| 1229 } | 1240 } |
| 1230 | 1241 |
| 1231 return S_FALSE; | 1242 return S_FALSE; |
| 1232 } | 1243 } |
| 1233 | 1244 |
| 1234 STDMETHODIMP BrowserAccessibilityWin::get_rowHeader( | 1245 STDMETHODIMP BrowserAccessibilityWin::get_rowHeader( |
| 1235 IAccessibleTable **accessible_table, | 1246 IAccessibleTable **accessible_table, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1252 return E_INVALIDARG; | 1263 return E_INVALIDARG; |
| 1253 if (cell_index >= cell_id_count) | 1264 if (cell_index >= cell_id_count) |
| 1254 return S_FALSE; | 1265 return S_FALSE; |
| 1255 | 1266 |
| 1256 int cell_id = unique_cell_ids_[cell_index]; | 1267 int cell_id = unique_cell_ids_[cell_index]; |
| 1257 BrowserAccessibilityWin* cell = | 1268 BrowserAccessibilityWin* cell = |
| 1258 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1269 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1259 int cell_row_index; | 1270 int cell_row_index; |
| 1260 if (cell && | 1271 if (cell && |
| 1261 cell->GetIntAttribute( | 1272 cell->GetIntAttribute( |
| 1262 WebAccessibility::ATTR_TABLE_CELL_ROW_INDEX, &cell_row_index)) { | 1273 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &cell_row_index)) { |
| 1263 *row_index = cell_row_index; | 1274 *row_index = cell_row_index; |
| 1264 return S_OK; | 1275 return S_OK; |
| 1265 } | 1276 } |
| 1266 | 1277 |
| 1267 return S_FALSE; | 1278 return S_FALSE; |
| 1268 } | 1279 } |
| 1269 | 1280 |
| 1270 STDMETHODIMP BrowserAccessibilityWin::get_selectedChildren( | 1281 STDMETHODIMP BrowserAccessibilityWin::get_selectedChildren( |
| 1271 long max_children, | 1282 long max_children, |
| 1272 long** children, | 1283 long** children, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 if (index >= cell_id_count) | 1397 if (index >= cell_id_count) |
| 1387 return S_FALSE; | 1398 return S_FALSE; |
| 1388 | 1399 |
| 1389 int cell_id = unique_cell_ids_[index]; | 1400 int cell_id = unique_cell_ids_[index]; |
| 1390 BrowserAccessibilityWin* cell = | 1401 BrowserAccessibilityWin* cell = |
| 1391 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1402 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1392 int rowspan; | 1403 int rowspan; |
| 1393 int colspan; | 1404 int colspan; |
| 1394 if (cell && | 1405 if (cell && |
| 1395 cell->GetIntAttribute( | 1406 cell->GetIntAttribute( |
| 1396 WebAccessibility::ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && | 1407 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && |
| 1397 cell->GetIntAttribute( | 1408 cell->GetIntAttribute( |
| 1398 WebAccessibility::ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && | 1409 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && |
| 1399 rowspan >= 1 && | 1410 rowspan >= 1 && |
| 1400 colspan >= 1) { | 1411 colspan >= 1) { |
| 1401 *row_extents = rowspan; | 1412 *row_extents = rowspan; |
| 1402 *column_extents = colspan; | 1413 *column_extents = colspan; |
| 1403 return S_OK; | 1414 return S_OK; |
| 1404 } | 1415 } |
| 1405 | 1416 |
| 1406 return S_FALSE; | 1417 return S_FALSE; |
| 1407 } | 1418 } |
| 1408 | 1419 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 STDMETHODIMP BrowserAccessibilityWin::get_columnExtent( | 1482 STDMETHODIMP BrowserAccessibilityWin::get_columnExtent( |
| 1472 long* n_columns_spanned) { | 1483 long* n_columns_spanned) { |
| 1473 if (!instance_active_) | 1484 if (!instance_active_) |
| 1474 return E_FAIL; | 1485 return E_FAIL; |
| 1475 | 1486 |
| 1476 if (!n_columns_spanned) | 1487 if (!n_columns_spanned) |
| 1477 return E_INVALIDARG; | 1488 return E_INVALIDARG; |
| 1478 | 1489 |
| 1479 int colspan; | 1490 int colspan; |
| 1480 if (GetIntAttribute( | 1491 if (GetIntAttribute( |
| 1481 WebAccessibility::ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && | 1492 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && |
| 1482 colspan >= 1) { | 1493 colspan >= 1) { |
| 1483 *n_columns_spanned = colspan; | 1494 *n_columns_spanned = colspan; |
| 1484 return S_OK; | 1495 return S_OK; |
| 1485 } | 1496 } |
| 1486 | 1497 |
| 1487 return S_FALSE; | 1498 return S_FALSE; |
| 1488 } | 1499 } |
| 1489 | 1500 |
| 1490 STDMETHODIMP BrowserAccessibilityWin::get_columnHeaderCells( | 1501 STDMETHODIMP BrowserAccessibilityWin::get_columnHeaderCells( |
| 1491 IUnknown*** cell_accessibles, | 1502 IUnknown*** cell_accessibles, |
| 1492 long* n_column_header_cells) { | 1503 long* n_column_header_cells) { |
| 1493 if (!instance_active_) | 1504 if (!instance_active_) |
| 1494 return E_FAIL; | 1505 return E_FAIL; |
| 1495 | 1506 |
| 1496 if (!cell_accessibles || !n_column_header_cells) | 1507 if (!cell_accessibles || !n_column_header_cells) |
| 1497 return E_INVALIDARG; | 1508 return E_INVALIDARG; |
| 1498 | 1509 |
| 1499 *n_column_header_cells = 0; | 1510 *n_column_header_cells = 0; |
| 1500 | 1511 |
| 1501 int column; | 1512 int column; |
| 1502 if (!GetIntAttribute( | 1513 if (!GetIntAttribute( |
| 1503 WebAccessibility::ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { | 1514 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { |
| 1504 return S_FALSE; | 1515 return S_FALSE; |
| 1505 } | 1516 } |
| 1506 | 1517 |
| 1507 BrowserAccessibility* table = parent(); | 1518 BrowserAccessibility* table = parent(); |
| 1508 while (table && table->role() != WebAccessibility::ROLE_TABLE) | 1519 while (table && table->role() != AccessibilityNodeData::ROLE_TABLE) |
| 1509 table = table->parent(); | 1520 table = table->parent(); |
| 1510 if (!table) { | 1521 if (!table) { |
| 1511 NOTREACHED(); | 1522 NOTREACHED(); |
| 1512 return S_FALSE; | 1523 return S_FALSE; |
| 1513 } | 1524 } |
| 1514 | 1525 |
| 1515 int columns; | 1526 int columns; |
| 1516 int rows; | 1527 int rows; |
| 1517 if (!table->GetIntAttribute( | 1528 if (!table->GetIntAttribute( |
| 1518 WebAccessibility::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1529 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1519 !table->GetIntAttribute( | 1530 !table->GetIntAttribute( |
| 1520 WebAccessibility::ATTR_TABLE_ROW_COUNT, &rows)) { | 1531 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows)) { |
| 1521 return S_FALSE; | 1532 return S_FALSE; |
| 1522 } | 1533 } |
| 1523 if (columns <= 0 || rows <= 0 || column < 0 || column >= columns) | 1534 if (columns <= 0 || rows <= 0 || column < 0 || column >= columns) |
| 1524 return S_FALSE; | 1535 return S_FALSE; |
| 1525 | 1536 |
| 1526 for (int i = 0; i < rows; ++i) { | 1537 for (int i = 0; i < rows; ++i) { |
| 1527 int cell_id = table->cell_ids()[i * columns + column]; | 1538 int cell_id = table->cell_ids()[i * columns + column]; |
| 1528 BrowserAccessibilityWin* cell = | 1539 BrowserAccessibilityWin* cell = |
| 1529 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1540 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1530 if (cell && cell->role_ == WebAccessibility::ROLE_COLUMN_HEADER) | 1541 if (cell && cell->role_ == AccessibilityNodeData::ROLE_COLUMN_HEADER) |
| 1531 (*n_column_header_cells)++; | 1542 (*n_column_header_cells)++; |
| 1532 } | 1543 } |
| 1533 | 1544 |
| 1534 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( | 1545 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( |
| 1535 (*n_column_header_cells) * sizeof(cell_accessibles[0]))); | 1546 (*n_column_header_cells) * sizeof(cell_accessibles[0]))); |
| 1536 int index = 0; | 1547 int index = 0; |
| 1537 for (int i = 0; i < rows; ++i) { | 1548 for (int i = 0; i < rows; ++i) { |
| 1538 int cell_id = table->cell_ids()[i * columns + column]; | 1549 int cell_id = table->cell_ids()[i * columns + column]; |
| 1539 BrowserAccessibilityWin* cell = | 1550 BrowserAccessibilityWin* cell = |
| 1540 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1551 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1541 if (cell && cell->role_ == WebAccessibility::ROLE_COLUMN_HEADER) { | 1552 if (cell && cell->role_ == AccessibilityNodeData::ROLE_COLUMN_HEADER) { |
| 1542 (*cell_accessibles)[index] = | 1553 (*cell_accessibles)[index] = |
| 1543 static_cast<IAccessible*>(cell->NewReference()); | 1554 static_cast<IAccessible*>(cell->NewReference()); |
| 1544 ++index; | 1555 ++index; |
| 1545 } | 1556 } |
| 1546 } | 1557 } |
| 1547 | 1558 |
| 1548 return S_OK; | 1559 return S_OK; |
| 1549 } | 1560 } |
| 1550 | 1561 |
| 1551 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex( | 1562 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex( |
| 1552 long* column_index) { | 1563 long* column_index) { |
| 1553 if (!instance_active_) | 1564 if (!instance_active_) |
| 1554 return E_FAIL; | 1565 return E_FAIL; |
| 1555 | 1566 |
| 1556 if (!column_index) | 1567 if (!column_index) |
| 1557 return E_INVALIDARG; | 1568 return E_INVALIDARG; |
| 1558 | 1569 |
| 1559 int column; | 1570 int column; |
| 1560 if (GetIntAttribute( | 1571 if (GetIntAttribute( |
| 1561 WebAccessibility::ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { | 1572 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { |
| 1562 *column_index = column; | 1573 *column_index = column; |
| 1563 return S_OK; | 1574 return S_OK; |
| 1564 } | 1575 } |
| 1565 | 1576 |
| 1566 return S_FALSE; | 1577 return S_FALSE; |
| 1567 } | 1578 } |
| 1568 | 1579 |
| 1569 STDMETHODIMP BrowserAccessibilityWin::get_rowExtent( | 1580 STDMETHODIMP BrowserAccessibilityWin::get_rowExtent( |
| 1570 long* n_rows_spanned) { | 1581 long* n_rows_spanned) { |
| 1571 if (!instance_active_) | 1582 if (!instance_active_) |
| 1572 return E_FAIL; | 1583 return E_FAIL; |
| 1573 | 1584 |
| 1574 if (!n_rows_spanned) | 1585 if (!n_rows_spanned) |
| 1575 return E_INVALIDARG; | 1586 return E_INVALIDARG; |
| 1576 | 1587 |
| 1577 int rowspan; | 1588 int rowspan; |
| 1578 if (GetIntAttribute( | 1589 if (GetIntAttribute( |
| 1579 WebAccessibility::ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && | 1590 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && |
| 1580 rowspan >= 1) { | 1591 rowspan >= 1) { |
| 1581 *n_rows_spanned = rowspan; | 1592 *n_rows_spanned = rowspan; |
| 1582 return S_OK; | 1593 return S_OK; |
| 1583 } | 1594 } |
| 1584 | 1595 |
| 1585 return S_FALSE; | 1596 return S_FALSE; |
| 1586 } | 1597 } |
| 1587 | 1598 |
| 1588 STDMETHODIMP BrowserAccessibilityWin::get_rowHeaderCells( | 1599 STDMETHODIMP BrowserAccessibilityWin::get_rowHeaderCells( |
| 1589 IUnknown*** cell_accessibles, | 1600 IUnknown*** cell_accessibles, |
| 1590 long* n_row_header_cells) { | 1601 long* n_row_header_cells) { |
| 1591 if (!instance_active_) | 1602 if (!instance_active_) |
| 1592 return E_FAIL; | 1603 return E_FAIL; |
| 1593 | 1604 |
| 1594 if (!cell_accessibles || !n_row_header_cells) | 1605 if (!cell_accessibles || !n_row_header_cells) |
| 1595 return E_INVALIDARG; | 1606 return E_INVALIDARG; |
| 1596 | 1607 |
| 1597 *n_row_header_cells = 0; | 1608 *n_row_header_cells = 0; |
| 1598 | 1609 |
| 1599 int row; | 1610 int row; |
| 1600 if (!GetIntAttribute( | 1611 if (!GetIntAttribute( |
| 1601 WebAccessibility::ATTR_TABLE_CELL_ROW_INDEX, &row)) { | 1612 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &row)) { |
| 1602 return S_FALSE; | 1613 return S_FALSE; |
| 1603 } | 1614 } |
| 1604 | 1615 |
| 1605 BrowserAccessibility* table = parent(); | 1616 BrowserAccessibility* table = parent(); |
| 1606 while (table && table->role() != WebAccessibility::ROLE_TABLE) | 1617 while (table && table->role() != AccessibilityNodeData::ROLE_TABLE) |
| 1607 table = table->parent(); | 1618 table = table->parent(); |
| 1608 if (!table) { | 1619 if (!table) { |
| 1609 NOTREACHED(); | 1620 NOTREACHED(); |
| 1610 return S_FALSE; | 1621 return S_FALSE; |
| 1611 } | 1622 } |
| 1612 | 1623 |
| 1613 int columns; | 1624 int columns; |
| 1614 int rows; | 1625 int rows; |
| 1615 if (!table->GetIntAttribute( | 1626 if (!table->GetIntAttribute( |
| 1616 WebAccessibility::ATTR_TABLE_COLUMN_COUNT, &columns) || | 1627 AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT, &columns) || |
| 1617 !table->GetIntAttribute( | 1628 !table->GetIntAttribute( |
| 1618 WebAccessibility::ATTR_TABLE_ROW_COUNT, &rows)) { | 1629 AccessibilityNodeData::ATTR_TABLE_ROW_COUNT, &rows)) { |
| 1619 return S_FALSE; | 1630 return S_FALSE; |
| 1620 } | 1631 } |
| 1621 if (columns <= 0 || rows <= 0 || row < 0 || row >= rows) | 1632 if (columns <= 0 || rows <= 0 || row < 0 || row >= rows) |
| 1622 return S_FALSE; | 1633 return S_FALSE; |
| 1623 | 1634 |
| 1624 for (int i = 0; i < columns; ++i) { | 1635 for (int i = 0; i < columns; ++i) { |
| 1625 int cell_id = table->cell_ids()[row * columns + i]; | 1636 int cell_id = table->cell_ids()[row * columns + i]; |
| 1626 BrowserAccessibilityWin* cell = | 1637 BrowserAccessibilityWin* cell = |
| 1627 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1638 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1628 if (cell && cell->role_ == WebAccessibility::ROLE_ROW_HEADER) | 1639 if (cell && cell->role_ == AccessibilityNodeData::ROLE_ROW_HEADER) |
| 1629 (*n_row_header_cells)++; | 1640 (*n_row_header_cells)++; |
| 1630 } | 1641 } |
| 1631 | 1642 |
| 1632 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( | 1643 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( |
| 1633 (*n_row_header_cells) * sizeof(cell_accessibles[0]))); | 1644 (*n_row_header_cells) * sizeof(cell_accessibles[0]))); |
| 1634 int index = 0; | 1645 int index = 0; |
| 1635 for (int i = 0; i < columns; ++i) { | 1646 for (int i = 0; i < columns; ++i) { |
| 1636 int cell_id = table->cell_ids()[row * columns + i]; | 1647 int cell_id = table->cell_ids()[row * columns + i]; |
| 1637 BrowserAccessibilityWin* cell = | 1648 BrowserAccessibilityWin* cell = |
| 1638 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); | 1649 manager_->GetFromRendererID(cell_id)->ToBrowserAccessibilityWin(); |
| 1639 if (cell && cell->role_ == WebAccessibility::ROLE_ROW_HEADER) { | 1650 if (cell && cell->role_ == AccessibilityNodeData::ROLE_ROW_HEADER) { |
| 1640 (*cell_accessibles)[index] = | 1651 (*cell_accessibles)[index] = |
| 1641 static_cast<IAccessible*>(cell->NewReference()); | 1652 static_cast<IAccessible*>(cell->NewReference()); |
| 1642 ++index; | 1653 ++index; |
| 1643 } | 1654 } |
| 1644 } | 1655 } |
| 1645 | 1656 |
| 1646 return S_OK; | 1657 return S_OK; |
| 1647 } | 1658 } |
| 1648 | 1659 |
| 1649 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex( | 1660 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex( |
| 1650 long* row_index) { | 1661 long* row_index) { |
| 1651 if (!instance_active_) | 1662 if (!instance_active_) |
| 1652 return E_FAIL; | 1663 return E_FAIL; |
| 1653 | 1664 |
| 1654 if (!row_index) | 1665 if (!row_index) |
| 1655 return E_INVALIDARG; | 1666 return E_INVALIDARG; |
| 1656 | 1667 |
| 1657 int row; | 1668 int row; |
| 1658 if (GetIntAttribute(WebAccessibility::ATTR_TABLE_CELL_ROW_INDEX, &row)) { | 1669 if (GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &row)) { |
| 1659 *row_index = row; | 1670 *row_index = row; |
| 1660 return S_OK; | 1671 return S_OK; |
| 1661 } | 1672 } |
| 1662 return S_FALSE; | 1673 return S_FALSE; |
| 1663 } | 1674 } |
| 1664 | 1675 |
| 1665 STDMETHODIMP BrowserAccessibilityWin::get_isSelected( | 1676 STDMETHODIMP BrowserAccessibilityWin::get_isSelected( |
| 1666 boolean* is_selected) { | 1677 boolean* is_selected) { |
| 1667 if (!instance_active_) | 1678 if (!instance_active_) |
| 1668 return E_FAIL; | 1679 return E_FAIL; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1688 !row_extents || | 1699 !row_extents || |
| 1689 !column_extents || | 1700 !column_extents || |
| 1690 !is_selected) { | 1701 !is_selected) { |
| 1691 return E_INVALIDARG; | 1702 return E_INVALIDARG; |
| 1692 } | 1703 } |
| 1693 | 1704 |
| 1694 int row; | 1705 int row; |
| 1695 int column; | 1706 int column; |
| 1696 int rowspan; | 1707 int rowspan; |
| 1697 int colspan; | 1708 int colspan; |
| 1698 if (GetIntAttribute(WebAccessibility::ATTR_TABLE_CELL_ROW_INDEX, &row) && | 1709 if (GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &row) && |
| 1699 GetIntAttribute( | 1710 GetIntAttribute( |
| 1700 WebAccessibility::ATTR_TABLE_CELL_COLUMN_INDEX, &column) && | 1711 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &column) && |
| 1701 GetIntAttribute( | 1712 GetIntAttribute( |
| 1702 WebAccessibility::ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && | 1713 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && |
| 1703 GetIntAttribute( | 1714 GetIntAttribute( |
| 1704 WebAccessibility::ATTR_TABLE_CELL_COLUMN_SPAN, &colspan)) { | 1715 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_SPAN, &colspan)) { |
| 1705 *row_index = row; | 1716 *row_index = row; |
| 1706 *column_index = column; | 1717 *column_index = column; |
| 1707 *row_extents = rowspan; | 1718 *row_extents = rowspan; |
| 1708 *column_extents = colspan; | 1719 *column_extents = colspan; |
| 1709 *is_selected = false; | 1720 *is_selected = false; |
| 1710 return S_OK; | 1721 return S_OK; |
| 1711 } | 1722 } |
| 1712 | 1723 |
| 1713 return S_FALSE; | 1724 return S_FALSE; |
| 1714 } | 1725 } |
| 1715 | 1726 |
| 1716 STDMETHODIMP BrowserAccessibilityWin::get_table( | 1727 STDMETHODIMP BrowserAccessibilityWin::get_table( |
| 1717 IUnknown** table) { | 1728 IUnknown** table) { |
| 1718 if (!instance_active_) | 1729 if (!instance_active_) |
| 1719 return E_FAIL; | 1730 return E_FAIL; |
| 1720 | 1731 |
| 1721 if (!table) | 1732 if (!table) |
| 1722 return E_INVALIDARG; | 1733 return E_INVALIDARG; |
| 1723 | 1734 |
| 1724 | 1735 |
| 1725 int row; | 1736 int row; |
| 1726 int column; | 1737 int column; |
| 1727 GetIntAttribute(WebAccessibility::ATTR_TABLE_CELL_ROW_INDEX, &row); | 1738 GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX, &row); |
| 1728 GetIntAttribute(WebAccessibility::ATTR_TABLE_CELL_COLUMN_INDEX, &column); | 1739 GetIntAttribute(AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX, &column); |
| 1729 | 1740 |
| 1730 BrowserAccessibility* find_table = parent(); | 1741 BrowserAccessibility* find_table = parent(); |
| 1731 while (find_table && find_table->role() != WebAccessibility::ROLE_TABLE) | 1742 while (find_table && find_table->role() != AccessibilityNodeData::ROLE_TABLE) |
| 1732 find_table = find_table->parent(); | 1743 find_table = find_table->parent(); |
| 1733 if (!find_table) { | 1744 if (!find_table) { |
| 1734 NOTREACHED(); | 1745 NOTREACHED(); |
| 1735 return S_FALSE; | 1746 return S_FALSE; |
| 1736 } | 1747 } |
| 1737 | 1748 |
| 1738 *table = static_cast<IAccessibleTable*>( | 1749 *table = static_cast<IAccessibleTable*>( |
| 1739 find_table->ToBrowserAccessibilityWin()->NewReference()); | 1750 find_table->ToBrowserAccessibilityWin()->NewReference()); |
| 1740 | 1751 |
| 1741 return S_OK; | 1752 return S_OK; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1756 return S_OK; | 1767 return S_OK; |
| 1757 } | 1768 } |
| 1758 | 1769 |
| 1759 STDMETHODIMP BrowserAccessibilityWin::get_caretOffset(LONG* offset) { | 1770 STDMETHODIMP BrowserAccessibilityWin::get_caretOffset(LONG* offset) { |
| 1760 if (!instance_active_) | 1771 if (!instance_active_) |
| 1761 return E_FAIL; | 1772 return E_FAIL; |
| 1762 | 1773 |
| 1763 if (!offset) | 1774 if (!offset) |
| 1764 return E_INVALIDARG; | 1775 return E_INVALIDARG; |
| 1765 | 1776 |
| 1766 if (role_ == WebAccessibility::ROLE_TEXT_FIELD || | 1777 if (role_ == AccessibilityNodeData::ROLE_TEXT_FIELD || |
| 1767 role_ == WebAccessibility::ROLE_TEXTAREA) { | 1778 role_ == AccessibilityNodeData::ROLE_TEXTAREA) { |
| 1768 int sel_start = 0; | 1779 int sel_start = 0; |
| 1769 if (GetIntAttribute(WebAccessibility::ATTR_TEXT_SEL_START, &sel_start)) { | 1780 if (GetIntAttribute( |
| 1781 AccessibilityNodeData::ATTR_TEXT_SEL_START, &sel_start)) { |
| 1770 *offset = sel_start; | 1782 *offset = sel_start; |
| 1771 } else { | 1783 } else { |
| 1772 *offset = 0; | 1784 *offset = 0; |
| 1773 } | 1785 } |
| 1774 } else { | 1786 } else { |
| 1775 *offset = 0; | 1787 *offset = 0; |
| 1776 } | 1788 } |
| 1777 | 1789 |
| 1778 return S_OK; | 1790 return S_OK; |
| 1779 } | 1791 } |
| 1780 | 1792 |
| 1781 STDMETHODIMP BrowserAccessibilityWin::get_nSelections(LONG* n_selections) { | 1793 STDMETHODIMP BrowserAccessibilityWin::get_nSelections(LONG* n_selections) { |
| 1782 if (!instance_active_) | 1794 if (!instance_active_) |
| 1783 return E_FAIL; | 1795 return E_FAIL; |
| 1784 | 1796 |
| 1785 if (!n_selections) | 1797 if (!n_selections) |
| 1786 return E_INVALIDARG; | 1798 return E_INVALIDARG; |
| 1787 | 1799 |
| 1788 if (role_ == WebAccessibility::ROLE_TEXT_FIELD || | 1800 if (role_ == AccessibilityNodeData::ROLE_TEXT_FIELD || |
| 1789 role_ == WebAccessibility::ROLE_TEXTAREA) { | 1801 role_ == AccessibilityNodeData::ROLE_TEXTAREA) { |
| 1790 int sel_start = 0; | 1802 int sel_start = 0; |
| 1791 int sel_end = 0; | 1803 int sel_end = 0; |
| 1792 if (GetIntAttribute(WebAccessibility::ATTR_TEXT_SEL_START, &sel_start) && | 1804 if (GetIntAttribute( |
| 1793 GetIntAttribute(WebAccessibility::ATTR_TEXT_SEL_END, &sel_end) && | 1805 AccessibilityNodeData::ATTR_TEXT_SEL_START, &sel_start) && |
| 1806 GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_END, &sel_end) && |
| 1794 sel_start != sel_end) { | 1807 sel_start != sel_end) { |
| 1795 *n_selections = 1; | 1808 *n_selections = 1; |
| 1796 } else { | 1809 } else { |
| 1797 *n_selections = 0; | 1810 *n_selections = 0; |
| 1798 } | 1811 } |
| 1799 } else { | 1812 } else { |
| 1800 *n_selections = 0; | 1813 *n_selections = 0; |
| 1801 } | 1814 } |
| 1802 | 1815 |
| 1803 return S_OK; | 1816 return S_OK; |
| 1804 } | 1817 } |
| 1805 | 1818 |
| 1806 STDMETHODIMP BrowserAccessibilityWin::get_selection(LONG selection_index, | 1819 STDMETHODIMP BrowserAccessibilityWin::get_selection(LONG selection_index, |
| 1807 LONG* start_offset, | 1820 LONG* start_offset, |
| 1808 LONG* end_offset) { | 1821 LONG* end_offset) { |
| 1809 if (!instance_active_) | 1822 if (!instance_active_) |
| 1810 return E_FAIL; | 1823 return E_FAIL; |
| 1811 | 1824 |
| 1812 if (!start_offset || !end_offset || selection_index != 0) | 1825 if (!start_offset || !end_offset || selection_index != 0) |
| 1813 return E_INVALIDARG; | 1826 return E_INVALIDARG; |
| 1814 | 1827 |
| 1815 if (role_ == WebAccessibility::ROLE_TEXT_FIELD || | 1828 if (role_ == AccessibilityNodeData::ROLE_TEXT_FIELD || |
| 1816 role_ == WebAccessibility::ROLE_TEXTAREA) { | 1829 role_ == AccessibilityNodeData::ROLE_TEXTAREA) { |
| 1817 int sel_start = 0; | 1830 int sel_start = 0; |
| 1818 int sel_end = 0; | 1831 int sel_end = 0; |
| 1819 if (GetIntAttribute(WebAccessibility::ATTR_TEXT_SEL_START, &sel_start) && | 1832 if (GetIntAttribute( |
| 1820 GetIntAttribute(WebAccessibility::ATTR_TEXT_SEL_END, &sel_end)) { | 1833 AccessibilityNodeData::ATTR_TEXT_SEL_START, &sel_start) && |
| 1834 GetIntAttribute(AccessibilityNodeData::ATTR_TEXT_SEL_END, &sel_end)) { |
| 1821 *start_offset = sel_start; | 1835 *start_offset = sel_start; |
| 1822 *end_offset = sel_end; | 1836 *end_offset = sel_end; |
| 1823 } else { | 1837 } else { |
| 1824 *start_offset = 0; | 1838 *start_offset = 0; |
| 1825 *end_offset = 0; | 1839 *end_offset = 0; |
| 1826 } | 1840 } |
| 1827 } else { | 1841 } else { |
| 1828 *start_offset = 0; | 1842 *start_offset = 0; |
| 1829 *end_offset = 0; | 1843 *end_offset = 0; |
| 1830 } | 1844 } |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2127 // | 2141 // |
| 2128 | 2142 |
| 2129 STDMETHODIMP BrowserAccessibilityWin::get_currentValue(VARIANT* value) { | 2143 STDMETHODIMP BrowserAccessibilityWin::get_currentValue(VARIANT* value) { |
| 2130 if (!instance_active_) | 2144 if (!instance_active_) |
| 2131 return E_FAIL; | 2145 return E_FAIL; |
| 2132 | 2146 |
| 2133 if (!value) | 2147 if (!value) |
| 2134 return E_INVALIDARG; | 2148 return E_INVALIDARG; |
| 2135 | 2149 |
| 2136 float float_val; | 2150 float float_val; |
| 2137 if (GetFloatAttribute(WebAccessibility::ATTR_VALUE_FOR_RANGE, &float_val)) { | 2151 if (GetFloatAttribute( |
| 2152 AccessibilityNodeData::ATTR_VALUE_FOR_RANGE, &float_val)) { |
| 2138 value->vt = VT_R8; | 2153 value->vt = VT_R8; |
| 2139 value->dblVal = float_val; | 2154 value->dblVal = float_val; |
| 2140 return S_OK; | 2155 return S_OK; |
| 2141 } | 2156 } |
| 2142 | 2157 |
| 2143 value->vt = VT_EMPTY; | 2158 value->vt = VT_EMPTY; |
| 2144 return S_FALSE; | 2159 return S_FALSE; |
| 2145 } | 2160 } |
| 2146 | 2161 |
| 2147 STDMETHODIMP BrowserAccessibilityWin::get_minimumValue(VARIANT* value) { | 2162 STDMETHODIMP BrowserAccessibilityWin::get_minimumValue(VARIANT* value) { |
| 2148 if (!instance_active_) | 2163 if (!instance_active_) |
| 2149 return E_FAIL; | 2164 return E_FAIL; |
| 2150 | 2165 |
| 2151 if (!value) | 2166 if (!value) |
| 2152 return E_INVALIDARG; | 2167 return E_INVALIDARG; |
| 2153 | 2168 |
| 2154 float float_val; | 2169 float float_val; |
| 2155 if (GetFloatAttribute(WebAccessibility::ATTR_MIN_VALUE_FOR_RANGE, | 2170 if (GetFloatAttribute(AccessibilityNodeData::ATTR_MIN_VALUE_FOR_RANGE, |
| 2156 &float_val)) { | 2171 &float_val)) { |
| 2157 value->vt = VT_R8; | 2172 value->vt = VT_R8; |
| 2158 value->dblVal = float_val; | 2173 value->dblVal = float_val; |
| 2159 return S_OK; | 2174 return S_OK; |
| 2160 } | 2175 } |
| 2161 | 2176 |
| 2162 value->vt = VT_EMPTY; | 2177 value->vt = VT_EMPTY; |
| 2163 return S_FALSE; | 2178 return S_FALSE; |
| 2164 } | 2179 } |
| 2165 | 2180 |
| 2166 STDMETHODIMP BrowserAccessibilityWin::get_maximumValue(VARIANT* value) { | 2181 STDMETHODIMP BrowserAccessibilityWin::get_maximumValue(VARIANT* value) { |
| 2167 if (!instance_active_) | 2182 if (!instance_active_) |
| 2168 return E_FAIL; | 2183 return E_FAIL; |
| 2169 | 2184 |
| 2170 if (!value) | 2185 if (!value) |
| 2171 return E_INVALIDARG; | 2186 return E_INVALIDARG; |
| 2172 | 2187 |
| 2173 float float_val; | 2188 float float_val; |
| 2174 if (GetFloatAttribute(WebAccessibility::ATTR_MAX_VALUE_FOR_RANGE, | 2189 if (GetFloatAttribute(AccessibilityNodeData::ATTR_MAX_VALUE_FOR_RANGE, |
| 2175 &float_val)) { | 2190 &float_val)) { |
| 2176 value->vt = VT_R8; | 2191 value->vt = VT_R8; |
| 2177 value->dblVal = float_val; | 2192 value->dblVal = float_val; |
| 2178 return S_OK; | 2193 return S_OK; |
| 2179 } | 2194 } |
| 2180 | 2195 |
| 2181 value->vt = VT_EMPTY; | 2196 value->vt = VT_EMPTY; |
| 2182 return S_FALSE; | 2197 return S_FALSE; |
| 2183 } | 2198 } |
| 2184 | 2199 |
| 2185 STDMETHODIMP BrowserAccessibilityWin::setCurrentValue(VARIANT new_value) { | 2200 STDMETHODIMP BrowserAccessibilityWin::setCurrentValue(VARIANT new_value) { |
| 2186 // TODO(dmazzoni): Implement this. | 2201 // TODO(dmazzoni): Implement this. |
| 2187 return E_NOTIMPL; | 2202 return E_NOTIMPL; |
| 2188 } | 2203 } |
| 2189 | 2204 |
| 2190 // | 2205 // |
| 2191 // ISimpleDOMDocument methods. | 2206 // ISimpleDOMDocument methods. |
| 2192 // | 2207 // |
| 2193 | 2208 |
| 2194 STDMETHODIMP BrowserAccessibilityWin::get_URL(BSTR* url) { | 2209 STDMETHODIMP BrowserAccessibilityWin::get_URL(BSTR* url) { |
| 2195 if (!instance_active_) | 2210 if (!instance_active_) |
| 2196 return E_FAIL; | 2211 return E_FAIL; |
| 2197 | 2212 |
| 2198 if (!url) | 2213 if (!url) |
| 2199 return E_INVALIDARG; | 2214 return E_INVALIDARG; |
| 2200 | 2215 |
| 2201 return GetStringAttributeAsBstr(WebAccessibility::ATTR_DOC_URL, url); | 2216 return GetStringAttributeAsBstr(AccessibilityNodeData::ATTR_DOC_URL, url); |
| 2202 } | 2217 } |
| 2203 | 2218 |
| 2204 STDMETHODIMP BrowserAccessibilityWin::get_title(BSTR* title) { | 2219 STDMETHODIMP BrowserAccessibilityWin::get_title(BSTR* title) { |
| 2205 if (!instance_active_) | 2220 if (!instance_active_) |
| 2206 return E_FAIL; | 2221 return E_FAIL; |
| 2207 | 2222 |
| 2208 if (!title) | 2223 if (!title) |
| 2209 return E_INVALIDARG; | 2224 return E_INVALIDARG; |
| 2210 | 2225 |
| 2211 return GetStringAttributeAsBstr(WebAccessibility::ATTR_DOC_TITLE, title); | 2226 return GetStringAttributeAsBstr(AccessibilityNodeData::ATTR_DOC_TITLE, title); |
| 2212 } | 2227 } |
| 2213 | 2228 |
| 2214 STDMETHODIMP BrowserAccessibilityWin::get_mimeType(BSTR* mime_type) { | 2229 STDMETHODIMP BrowserAccessibilityWin::get_mimeType(BSTR* mime_type) { |
| 2215 if (!instance_active_) | 2230 if (!instance_active_) |
| 2216 return E_FAIL; | 2231 return E_FAIL; |
| 2217 | 2232 |
| 2218 if (!mime_type) | 2233 if (!mime_type) |
| 2219 return E_INVALIDARG; | 2234 return E_INVALIDARG; |
| 2220 | 2235 |
| 2221 return GetStringAttributeAsBstr( | 2236 return GetStringAttributeAsBstr( |
| 2222 WebAccessibility::ATTR_DOC_MIMETYPE, mime_type); | 2237 AccessibilityNodeData::ATTR_DOC_MIMETYPE, mime_type); |
| 2223 } | 2238 } |
| 2224 | 2239 |
| 2225 STDMETHODIMP BrowserAccessibilityWin::get_docType(BSTR* doc_type) { | 2240 STDMETHODIMP BrowserAccessibilityWin::get_docType(BSTR* doc_type) { |
| 2226 if (!instance_active_) | 2241 if (!instance_active_) |
| 2227 return E_FAIL; | 2242 return E_FAIL; |
| 2228 | 2243 |
| 2229 if (!doc_type) | 2244 if (!doc_type) |
| 2230 return E_INVALIDARG; | 2245 return E_INVALIDARG; |
| 2231 | 2246 |
| 2232 return GetStringAttributeAsBstr(WebAccessibility::ATTR_DOC_DOCTYPE, doc_type); | 2247 return GetStringAttributeAsBstr( |
| 2248 AccessibilityNodeData::ATTR_DOC_DOCTYPE, doc_type); |
| 2233 } | 2249 } |
| 2234 | 2250 |
| 2235 // | 2251 // |
| 2236 // ISimpleDOMNode methods. | 2252 // ISimpleDOMNode methods. |
| 2237 // | 2253 // |
| 2238 | 2254 |
| 2239 STDMETHODIMP BrowserAccessibilityWin::get_nodeInfo( | 2255 STDMETHODIMP BrowserAccessibilityWin::get_nodeInfo( |
| 2240 BSTR* node_name, | 2256 BSTR* node_name, |
| 2241 short* name_space_id, | 2257 short* name_space_id, |
| 2242 BSTR* node_value, | 2258 BSTR* node_value, |
| 2243 unsigned int* num_children, | 2259 unsigned int* num_children, |
| 2244 unsigned int* unique_id, | 2260 unsigned int* unique_id, |
| 2245 unsigned short* node_type) { | 2261 unsigned short* node_type) { |
| 2246 if (!instance_active_) | 2262 if (!instance_active_) |
| 2247 return E_FAIL; | 2263 return E_FAIL; |
| 2248 | 2264 |
| 2249 if (!node_name || !name_space_id || !node_value || !num_children || | 2265 if (!node_name || !name_space_id || !node_value || !num_children || |
| 2250 !unique_id || !node_type) { | 2266 !unique_id || !node_type) { |
| 2251 return E_INVALIDARG; | 2267 return E_INVALIDARG; |
| 2252 } | 2268 } |
| 2253 | 2269 |
| 2254 string16 tag; | 2270 string16 tag; |
| 2255 if (GetStringAttribute(WebAccessibility::ATTR_HTML_TAG, &tag)) | 2271 if (GetStringAttribute(AccessibilityNodeData::ATTR_HTML_TAG, &tag)) |
| 2256 *node_name = SysAllocString(tag.c_str()); | 2272 *node_name = SysAllocString(tag.c_str()); |
| 2257 else | 2273 else |
| 2258 *node_name = NULL; | 2274 *node_name = NULL; |
| 2259 | 2275 |
| 2260 *name_space_id = 0; | 2276 *name_space_id = 0; |
| 2261 *node_value = SysAllocString(value_.c_str()); | 2277 *node_value = SysAllocString(value_.c_str()); |
| 2262 *num_children = children_.size(); | 2278 *num_children = children_.size(); |
| 2263 *unique_id = child_id_; | 2279 *unique_id = child_id_; |
| 2264 | 2280 |
| 2265 if (ia_role_ == ROLE_SYSTEM_DOCUMENT) { | 2281 if (ia_role_ == ROLE_SYSTEM_DOCUMENT) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2336 if (!instance_active_) | 2352 if (!instance_active_) |
| 2337 return E_FAIL; | 2353 return E_FAIL; |
| 2338 | 2354 |
| 2339 if (!style_properties || !style_values) | 2355 if (!style_properties || !style_values) |
| 2340 return E_INVALIDARG; | 2356 return E_INVALIDARG; |
| 2341 | 2357 |
| 2342 // We only cache a single style property for now: DISPLAY | 2358 // We only cache a single style property for now: DISPLAY |
| 2343 | 2359 |
| 2344 string16 display; | 2360 string16 display; |
| 2345 if (max_style_properties == 0 || | 2361 if (max_style_properties == 0 || |
| 2346 !GetStringAttribute(WebAccessibility::ATTR_DISPLAY, &display)) { | 2362 !GetStringAttribute(AccessibilityNodeData::ATTR_DISPLAY, &display)) { |
| 2347 *num_style_properties = 0; | 2363 *num_style_properties = 0; |
| 2348 return S_OK; | 2364 return S_OK; |
| 2349 } | 2365 } |
| 2350 | 2366 |
| 2351 *num_style_properties = 1; | 2367 *num_style_properties = 1; |
| 2352 style_properties[0] = SysAllocString(L"display"); | 2368 style_properties[0] = SysAllocString(L"display"); |
| 2353 style_values[0] = SysAllocString(display.c_str()); | 2369 style_values[0] = SysAllocString(display.c_str()); |
| 2354 | 2370 |
| 2355 return S_OK; | 2371 return S_OK; |
| 2356 } | 2372 } |
| 2357 | 2373 |
| 2358 STDMETHODIMP BrowserAccessibilityWin::get_computedStyleForProperties( | 2374 STDMETHODIMP BrowserAccessibilityWin::get_computedStyleForProperties( |
| 2359 unsigned short num_style_properties, | 2375 unsigned short num_style_properties, |
| 2360 boolean use_alternate_view, | 2376 boolean use_alternate_view, |
| 2361 BSTR* style_properties, | 2377 BSTR* style_properties, |
| 2362 BSTR* style_values) { | 2378 BSTR* style_values) { |
| 2363 if (!instance_active_) | 2379 if (!instance_active_) |
| 2364 return E_FAIL; | 2380 return E_FAIL; |
| 2365 | 2381 |
| 2366 if (!style_properties || !style_values) | 2382 if (!style_properties || !style_values) |
| 2367 return E_INVALIDARG; | 2383 return E_INVALIDARG; |
| 2368 | 2384 |
| 2369 // We only cache a single style property for now: DISPLAY | 2385 // We only cache a single style property for now: DISPLAY |
| 2370 | 2386 |
| 2371 for (unsigned short i = 0; i < num_style_properties; ++i) { | 2387 for (unsigned short i = 0; i < num_style_properties; ++i) { |
| 2372 string16 name = (LPCWSTR)style_properties[i]; | 2388 string16 name = (LPCWSTR)style_properties[i]; |
| 2373 StringToLowerASCII(&name); | 2389 StringToLowerASCII(&name); |
| 2374 if (name == L"display") { | 2390 if (name == L"display") { |
| 2375 string16 display; | 2391 string16 display; |
| 2376 GetStringAttribute(WebAccessibility::ATTR_DISPLAY, &display); | 2392 GetStringAttribute(AccessibilityNodeData::ATTR_DISPLAY, &display); |
| 2377 style_values[i] = SysAllocString(display.c_str()); | 2393 style_values[i] = SysAllocString(display.c_str()); |
| 2378 } else { | 2394 } else { |
| 2379 style_values[i] = NULL; | 2395 style_values[i] = NULL; |
| 2380 } | 2396 } |
| 2381 } | 2397 } |
| 2382 | 2398 |
| 2383 return S_OK; | 2399 return S_OK; |
| 2384 } | 2400 } |
| 2385 | 2401 |
| 2386 STDMETHODIMP BrowserAccessibilityWin::scrollTo(boolean placeTopLeft) { | 2402 STDMETHODIMP BrowserAccessibilityWin::scrollTo(boolean placeTopLeft) { |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2628 // Private methods. | 2644 // Private methods. |
| 2629 // | 2645 // |
| 2630 | 2646 |
| 2631 // Initialize this object and mark it as active. | 2647 // Initialize this object and mark it as active. |
| 2632 void BrowserAccessibilityWin::PreInitialize() { | 2648 void BrowserAccessibilityWin::PreInitialize() { |
| 2633 BrowserAccessibility::PreInitialize(); | 2649 BrowserAccessibility::PreInitialize(); |
| 2634 | 2650 |
| 2635 InitRoleAndState(); | 2651 InitRoleAndState(); |
| 2636 | 2652 |
| 2637 // Expose headings levels with the "level" attribute. | 2653 // Expose headings levels with the "level" attribute. |
| 2638 if (role_ == WebAccessibility::ROLE_HEADING && role_name_.size() == 2 && | 2654 if (role_ == AccessibilityNodeData::ROLE_HEADING && role_name_.size() == 2 && |
| 2639 IsAsciiDigit(role_name_[1])) { | 2655 IsAsciiDigit(role_name_[1])) { |
| 2640 ia2_attributes_.push_back(string16(L"level:") + role_name_.substr(1)); | 2656 ia2_attributes_.push_back(string16(L"level:") + role_name_.substr(1)); |
| 2641 } | 2657 } |
| 2642 | 2658 |
| 2643 // Expose the "display" and "tag" attributes. | 2659 // Expose the "display" and "tag" attributes. |
| 2644 StringAttributeToIA2(WebAccessibility::ATTR_DISPLAY, "display"); | 2660 StringAttributeToIA2(AccessibilityNodeData::ATTR_DISPLAY, "display"); |
| 2645 StringAttributeToIA2(WebAccessibility::ATTR_HTML_TAG, "tag"); | 2661 StringAttributeToIA2(AccessibilityNodeData::ATTR_HTML_TAG, "tag"); |
| 2646 StringAttributeToIA2(WebAccessibility::ATTR_ROLE, "xml-roles"); | 2662 StringAttributeToIA2(AccessibilityNodeData::ATTR_ROLE, "xml-roles"); |
| 2647 | 2663 |
| 2648 // Expose "level" attribute for tree nodes. | 2664 // Expose "level" attribute for tree nodes. |
| 2649 IntAttributeToIA2(WebAccessibility::ATTR_HIERARCHICAL_LEVEL, "level"); | 2665 IntAttributeToIA2(AccessibilityNodeData::ATTR_HIERARCHICAL_LEVEL, "level"); |
| 2650 | 2666 |
| 2651 // Expose the set size and position in set for listbox options. | 2667 // Expose the set size and position in set for listbox options. |
| 2652 if (role_ == WebAccessibility::ROLE_LISTBOX_OPTION && | 2668 if (role_ == AccessibilityNodeData::ROLE_LISTBOX_OPTION && |
| 2653 parent_ && | 2669 parent_ && |
| 2654 parent_->role() == WebAccessibility::ROLE_LISTBOX) { | 2670 parent_->role() == AccessibilityNodeData::ROLE_LISTBOX) { |
| 2655 ia2_attributes_.push_back( | 2671 ia2_attributes_.push_back( |
| 2656 L"setsize:" + base::IntToString16(parent_->child_count())); | 2672 L"setsize:" + base::IntToString16(parent_->child_count())); |
| 2657 ia2_attributes_.push_back( | 2673 ia2_attributes_.push_back( |
| 2658 L"setsize:" + base::IntToString16(index_in_parent_ + 1)); | 2674 L"setsize:" + base::IntToString16(index_in_parent_ + 1)); |
| 2659 } | 2675 } |
| 2660 | 2676 |
| 2661 // Expose live region attributes. | 2677 // Expose live region attributes. |
| 2662 StringAttributeToIA2(WebAccessibility::ATTR_LIVE_STATUS, "live"); | 2678 StringAttributeToIA2(AccessibilityNodeData::ATTR_LIVE_STATUS, "live"); |
| 2663 StringAttributeToIA2(WebAccessibility::ATTR_LIVE_RELEVANT, "relevant"); | 2679 StringAttributeToIA2(AccessibilityNodeData::ATTR_LIVE_RELEVANT, "relevant"); |
| 2664 BoolAttributeToIA2(WebAccessibility::ATTR_LIVE_ATOMIC, "atomic"); | 2680 BoolAttributeToIA2(AccessibilityNodeData::ATTR_LIVE_ATOMIC, "atomic"); |
| 2665 BoolAttributeToIA2(WebAccessibility::ATTR_LIVE_BUSY, "busy"); | 2681 BoolAttributeToIA2(AccessibilityNodeData::ATTR_LIVE_BUSY, "busy"); |
| 2666 | 2682 |
| 2667 // Expose container live region attributes. | 2683 // Expose container live region attributes. |
| 2668 StringAttributeToIA2(WebAccessibility::ATTR_CONTAINER_LIVE_STATUS, | 2684 StringAttributeToIA2(AccessibilityNodeData::ATTR_CONTAINER_LIVE_STATUS, |
| 2669 "container-live"); | 2685 "container-live"); |
| 2670 StringAttributeToIA2(WebAccessibility::ATTR_CONTAINER_LIVE_RELEVANT, | 2686 StringAttributeToIA2(AccessibilityNodeData::ATTR_CONTAINER_LIVE_RELEVANT, |
| 2671 "container-relevant"); | 2687 "container-relevant"); |
| 2672 BoolAttributeToIA2(WebAccessibility::ATTR_CONTAINER_LIVE_ATOMIC, | 2688 BoolAttributeToIA2(AccessibilityNodeData::ATTR_CONTAINER_LIVE_ATOMIC, |
| 2673 "container-atomic"); | 2689 "container-atomic"); |
| 2674 BoolAttributeToIA2(WebAccessibility::ATTR_CONTAINER_LIVE_BUSY, | 2690 BoolAttributeToIA2(AccessibilityNodeData::ATTR_CONTAINER_LIVE_BUSY, |
| 2675 "container-busy"); | 2691 "container-busy"); |
| 2676 | 2692 |
| 2677 // Expose slider value. | 2693 // Expose slider value. |
| 2678 if (ia_role_ == ROLE_SYSTEM_PROGRESSBAR || | 2694 if (ia_role_ == ROLE_SYSTEM_PROGRESSBAR || |
| 2679 ia_role_ == ROLE_SYSTEM_SCROLLBAR || | 2695 ia_role_ == ROLE_SYSTEM_SCROLLBAR || |
| 2680 ia_role_ == ROLE_SYSTEM_SLIDER) { | 2696 ia_role_ == ROLE_SYSTEM_SLIDER) { |
| 2681 float fval; | 2697 float fval; |
| 2682 if (value_.empty() && | 2698 if (value_.empty() && |
| 2683 GetFloatAttribute(WebAccessibility::ATTR_VALUE_FOR_RANGE, &fval)) { | 2699 GetFloatAttribute(AccessibilityNodeData::ATTR_VALUE_FOR_RANGE, &fval)) { |
| 2684 // TODO(dmazzoni): Use ICU to localize this? | 2700 // TODO(dmazzoni): Use ICU to localize this? |
| 2685 value_ = UTF8ToUTF16(base::DoubleToString(fval)); | 2701 value_ = UTF8ToUTF16(base::DoubleToString(fval)); |
| 2686 } | 2702 } |
| 2687 ia2_attributes_.push_back(L"valuetext:" + value_); | 2703 ia2_attributes_.push_back(L"valuetext:" + value_); |
| 2688 } | 2704 } |
| 2689 | 2705 |
| 2690 // Expose table cell index. | 2706 // Expose table cell index. |
| 2691 if (ia_role_ == ROLE_SYSTEM_CELL) { | 2707 if (ia_role_ == ROLE_SYSTEM_CELL) { |
| 2692 BrowserAccessibility* table = parent(); | 2708 BrowserAccessibility* table = parent(); |
| 2693 while (table && table->role() != WebAccessibility::ROLE_TABLE) | 2709 while (table && table->role() != AccessibilityNodeData::ROLE_TABLE) |
| 2694 table = table->parent(); | 2710 table = table->parent(); |
| 2695 if (table) { | 2711 if (table) { |
| 2696 const std::vector<int32>& unique_cell_ids = table->unique_cell_ids(); | 2712 const std::vector<int32>& unique_cell_ids = table->unique_cell_ids(); |
| 2697 int index = -1; | 2713 int index = -1; |
| 2698 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { | 2714 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { |
| 2699 if (unique_cell_ids[i] == renderer_id_) { | 2715 if (unique_cell_ids[i] == renderer_id_) { |
| 2700 index = static_cast<int>(i); | 2716 index = static_cast<int>(i); |
| 2701 break; | 2717 break; |
| 2702 } | 2718 } |
| 2703 } | 2719 } |
| 2704 if (index >= 0) { | 2720 if (index >= 0) { |
| 2705 ia2_attributes_.push_back(string16(L"table-cell-index:") + | 2721 ia2_attributes_.push_back(string16(L"table-cell-index:") + |
| 2706 base::IntToString16(index)); | 2722 base::IntToString16(index)); |
| 2707 } | 2723 } |
| 2708 } else { | 2724 } else { |
| 2709 NOTREACHED(); | 2725 NOTREACHED(); |
| 2710 } | 2726 } |
| 2711 } | 2727 } |
| 2712 | 2728 |
| 2713 if (name_.empty() && | 2729 if (name_.empty() && |
| 2714 (role_ == WebAccessibility::ROLE_LISTBOX_OPTION || | 2730 (role_ == AccessibilityNodeData::ROLE_LISTBOX_OPTION || |
| 2715 role_ == WebAccessibility::ROLE_STATIC_TEXT || | 2731 role_ == AccessibilityNodeData::ROLE_STATIC_TEXT || |
| 2716 role_ == WebAccessibility::ROLE_LIST_MARKER)) { | 2732 role_ == AccessibilityNodeData::ROLE_LIST_MARKER)) { |
| 2717 name_.swap(value_); | 2733 name_.swap(value_); |
| 2718 } | 2734 } |
| 2719 | 2735 |
| 2720 // If this object doesn't have a name but it does have a description, | 2736 // If this object doesn't have a name but it does have a description, |
| 2721 // use the description as its name - because some screen readers only | 2737 // use the description as its name - because some screen readers only |
| 2722 // announce the name. | 2738 // announce the name. |
| 2723 if (name_.empty()) | 2739 if (name_.empty()) |
| 2724 GetStringAttribute(WebAccessibility::ATTR_DESCRIPTION, &name_); | 2740 GetStringAttribute(AccessibilityNodeData::ATTR_DESCRIPTION, &name_); |
| 2725 | 2741 |
| 2726 // If this doesn't have a value and is linked then set its value to the url | 2742 // If this doesn't have a value and is linked then set its value to the url |
| 2727 // attribute. This allows screen readers to read an empty link's destination. | 2743 // attribute. This allows screen readers to read an empty link's destination. |
| 2728 string16 url; | 2744 string16 url; |
| 2729 if (value_.empty() && (ia_state_ & STATE_SYSTEM_LINKED)) | 2745 if (value_.empty() && (ia_state_ & STATE_SYSTEM_LINKED)) |
| 2730 GetStringAttribute(WebAccessibility::ATTR_URL, &value_); | 2746 GetStringAttribute(AccessibilityNodeData::ATTR_URL, &value_); |
| 2731 | 2747 |
| 2732 // Clear any old relationships between this node and other nodes. | 2748 // Clear any old relationships between this node and other nodes. |
| 2733 for (size_t i = 0; i < relations_.size(); ++i) | 2749 for (size_t i = 0; i < relations_.size(); ++i) |
| 2734 relations_[i]->Release(); | 2750 relations_[i]->Release(); |
| 2735 relations_.clear(); | 2751 relations_.clear(); |
| 2736 | 2752 |
| 2737 // Handle title UI element. | 2753 // Handle title UI element. |
| 2738 int title_elem_id; | 2754 int title_elem_id; |
| 2739 if (GetIntAttribute(WebAccessibility::ATTR_TITLE_UI_ELEMENT, | 2755 if (GetIntAttribute(AccessibilityNodeData::ATTR_TITLE_UI_ELEMENT, |
| 2740 &title_elem_id)) { | 2756 &title_elem_id)) { |
| 2741 // Add a labelled by relationship. | 2757 // Add a labelled by relationship. |
| 2742 CComObject<BrowserAccessibilityRelation>* relation; | 2758 CComObject<BrowserAccessibilityRelation>* relation; |
| 2743 HRESULT hr = CComObject<BrowserAccessibilityRelation>::CreateInstance( | 2759 HRESULT hr = CComObject<BrowserAccessibilityRelation>::CreateInstance( |
| 2744 &relation); | 2760 &relation); |
| 2745 DCHECK(SUCCEEDED(hr)); | 2761 DCHECK(SUCCEEDED(hr)); |
| 2746 relation->AddRef(); | 2762 relation->AddRef(); |
| 2747 relation->Initialize(this, IA2_RELATION_LABELLED_BY); | 2763 relation->Initialize(this, IA2_RELATION_LABELLED_BY); |
| 2748 relation->AddTarget(title_elem_id); | 2764 relation->AddTarget(title_elem_id); |
| 2749 relations_.push_back(relation); | 2765 relations_.push_back(relation); |
| 2750 } | 2766 } |
| 2751 } | 2767 } |
| 2752 | 2768 |
| 2753 void BrowserAccessibilityWin::PostInitialize() { | 2769 void BrowserAccessibilityWin::PostInitialize() { |
| 2754 BrowserAccessibility::PostInitialize(); | 2770 BrowserAccessibility::PostInitialize(); |
| 2755 | 2771 |
| 2756 // Construct the hypertext for this node. | 2772 // Construct the hypertext for this node. |
| 2757 hyperlink_offset_to_index_.clear(); | 2773 hyperlink_offset_to_index_.clear(); |
| 2758 hyperlinks_.clear(); | 2774 hyperlinks_.clear(); |
| 2759 hypertext_.clear(); | 2775 hypertext_.clear(); |
| 2760 for (unsigned int i = 0; i < children().size(); ++i) { | 2776 for (unsigned int i = 0; i < children().size(); ++i) { |
| 2761 BrowserAccessibility* child = children()[i]; | 2777 BrowserAccessibility* child = children()[i]; |
| 2762 if (child->role() == WebAccessibility::ROLE_STATIC_TEXT) { | 2778 if (child->role() == AccessibilityNodeData::ROLE_STATIC_TEXT) { |
| 2763 hypertext_ += child->name(); | 2779 hypertext_ += child->name(); |
| 2764 } else { | 2780 } else { |
| 2765 hyperlink_offset_to_index_[hypertext_.size()] = hyperlinks_.size(); | 2781 hyperlink_offset_to_index_[hypertext_.size()] = hyperlinks_.size(); |
| 2766 hypertext_ += kEmbeddedCharacter; | 2782 hypertext_ += kEmbeddedCharacter; |
| 2767 hyperlinks_.push_back(i); | 2783 hyperlinks_.push_back(i); |
| 2768 } | 2784 } |
| 2769 } | 2785 } |
| 2770 DCHECK_EQ(hyperlink_offset_to_index_.size(), hyperlinks_.size()); | 2786 DCHECK_EQ(hyperlink_offset_to_index_.size(), hyperlinks_.size()); |
| 2771 | 2787 |
| 2772 // Fire an event when an alert first appears. | 2788 // Fire an event when an alert first appears. |
| 2773 if (role_ == WebAccessibility::ROLE_ALERT && first_time_) | 2789 if (role_ == AccessibilityNodeData::ROLE_ALERT && first_time_) |
| 2774 manager_->NotifyAccessibilityEvent(AccessibilityNotificationAlert, this); | 2790 manager_->NotifyAccessibilityEvent(AccessibilityNotificationAlert, this); |
| 2775 | 2791 |
| 2776 // Fire events if text has changed. | 2792 // Fire events if text has changed. |
| 2777 string16 text = TextForIAccessibleText(); | 2793 string16 text = TextForIAccessibleText(); |
| 2778 if (previous_text_ != text) { | 2794 if (previous_text_ != text) { |
| 2779 if (!previous_text_.empty() && !text.empty()) { | 2795 if (!previous_text_.empty() && !text.empty()) { |
| 2780 manager_->NotifyAccessibilityEvent( | 2796 manager_->NotifyAccessibilityEvent( |
| 2781 AccessibilityNotificationObjectShow, this); | 2797 AccessibilityNotificationObjectShow, this); |
| 2782 } | 2798 } |
| 2783 | 2799 |
| 2784 // TODO(dmazzoni): Look into HIDE events, too. | 2800 // TODO(dmazzoni): Look into HIDE events, too. |
| 2785 | 2801 |
| 2786 old_text_ = previous_text_; | 2802 old_text_ = previous_text_; |
| 2787 previous_text_ = text; | 2803 previous_text_ = text; |
| 2788 } | 2804 } |
| 2789 | 2805 |
| 2790 // Fire events if the state has changed. | 2806 // Fire events if the state has changed. |
| 2791 if (!first_time_ && ia_state_ != old_ia_state_) { | 2807 if (!first_time_ && ia_state_ != old_ia_state_) { |
| 2792 // Normally focus events are handled elsewhere, however | 2808 // Normally focus events are handled elsewhere, however |
| 2793 // focus for managed descendants is platform-specific. | 2809 // focus for managed descendants is platform-specific. |
| 2794 // Fire a focus event if the focused descendant in a multi-select | 2810 // Fire a focus event if the focused descendant in a multi-select |
| 2795 // list box changes. | 2811 // list box changes. |
| 2796 if (role_ == WebAccessibility::ROLE_LISTBOX_OPTION && | 2812 if (role_ == AccessibilityNodeData::ROLE_LISTBOX_OPTION && |
| 2797 (ia_state_ & STATE_SYSTEM_FOCUSABLE) && | 2813 (ia_state_ & STATE_SYSTEM_FOCUSABLE) && |
| 2798 (ia_state_ & STATE_SYSTEM_SELECTABLE) && | 2814 (ia_state_ & STATE_SYSTEM_SELECTABLE) && |
| 2799 (ia_state_ & STATE_SYSTEM_FOCUSED) && | 2815 (ia_state_ & STATE_SYSTEM_FOCUSED) && |
| 2800 !(old_ia_state_ & STATE_SYSTEM_FOCUSED)) { | 2816 !(old_ia_state_ & STATE_SYSTEM_FOCUSED)) { |
| 2801 ::NotifyWinEvent(EVENT_OBJECT_FOCUS, | 2817 ::NotifyWinEvent(EVENT_OBJECT_FOCUS, |
| 2802 manager_->GetParentView(), | 2818 manager_->GetParentView(), |
| 2803 OBJID_CLIENT, | 2819 OBJID_CLIENT, |
| 2804 child_id()); | 2820 child_id()); |
| 2805 } | 2821 } |
| 2806 | 2822 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2850 if (child_id == CHILDID_SELF) | 2866 if (child_id == CHILDID_SELF) |
| 2851 return this; | 2867 return this; |
| 2852 | 2868 |
| 2853 if (child_id >= 1 && child_id <= static_cast<LONG>(children_.size())) | 2869 if (child_id >= 1 && child_id <= static_cast<LONG>(children_.size())) |
| 2854 return children_[child_id - 1]->ToBrowserAccessibilityWin(); | 2870 return children_[child_id - 1]->ToBrowserAccessibilityWin(); |
| 2855 | 2871 |
| 2856 return manager_->GetFromChildID(child_id)->ToBrowserAccessibilityWin(); | 2872 return manager_->GetFromChildID(child_id)->ToBrowserAccessibilityWin(); |
| 2857 } | 2873 } |
| 2858 | 2874 |
| 2859 HRESULT BrowserAccessibilityWin::GetStringAttributeAsBstr( | 2875 HRESULT BrowserAccessibilityWin::GetStringAttributeAsBstr( |
| 2860 WebAccessibility::StringAttribute attribute, BSTR* value_bstr) { | 2876 AccessibilityNodeData::StringAttribute attribute, BSTR* value_bstr) { |
| 2861 string16 str; | 2877 string16 str; |
| 2862 | 2878 |
| 2863 if (!GetStringAttribute(attribute, &str)) | 2879 if (!GetStringAttribute(attribute, &str)) |
| 2864 return S_FALSE; | 2880 return S_FALSE; |
| 2865 | 2881 |
| 2866 if (str.empty()) | 2882 if (str.empty()) |
| 2867 return S_FALSE; | 2883 return S_FALSE; |
| 2868 | 2884 |
| 2869 *value_bstr = SysAllocString(str.c_str()); | 2885 *value_bstr = SysAllocString(str.c_str()); |
| 2870 DCHECK(*value_bstr); | 2886 DCHECK(*value_bstr); |
| 2871 | 2887 |
| 2872 return S_OK; | 2888 return S_OK; |
| 2873 } | 2889 } |
| 2874 | 2890 |
| 2875 void BrowserAccessibilityWin::StringAttributeToIA2( | 2891 void BrowserAccessibilityWin::StringAttributeToIA2( |
| 2876 WebAccessibility::StringAttribute attribute, const char* ia2_attr) { | 2892 AccessibilityNodeData::StringAttribute attribute, const char* ia2_attr) { |
| 2877 string16 value; | 2893 string16 value; |
| 2878 if (GetStringAttribute(attribute, &value)) | 2894 if (GetStringAttribute(attribute, &value)) |
| 2879 ia2_attributes_.push_back(ASCIIToUTF16(ia2_attr) + L":" + value); | 2895 ia2_attributes_.push_back(ASCIIToUTF16(ia2_attr) + L":" + value); |
| 2880 } | 2896 } |
| 2881 | 2897 |
| 2882 void BrowserAccessibilityWin::BoolAttributeToIA2( | 2898 void BrowserAccessibilityWin::BoolAttributeToIA2( |
| 2883 WebAccessibility::BoolAttribute attribute, const char* ia2_attr) { | 2899 AccessibilityNodeData::BoolAttribute attribute, const char* ia2_attr) { |
| 2884 bool value; | 2900 bool value; |
| 2885 if (GetBoolAttribute(attribute, &value)) { | 2901 if (GetBoolAttribute(attribute, &value)) { |
| 2886 ia2_attributes_.push_back((ASCIIToUTF16(ia2_attr) + L":") + | 2902 ia2_attributes_.push_back((ASCIIToUTF16(ia2_attr) + L":") + |
| 2887 (value ? L"true" : L"false")); | 2903 (value ? L"true" : L"false")); |
| 2888 } | 2904 } |
| 2889 } | 2905 } |
| 2890 | 2906 |
| 2891 void BrowserAccessibilityWin::IntAttributeToIA2( | 2907 void BrowserAccessibilityWin::IntAttributeToIA2( |
| 2892 WebAccessibility::IntAttribute attribute, const char* ia2_attr) { | 2908 AccessibilityNodeData::IntAttribute attribute, const char* ia2_attr) { |
| 2893 int value; | 2909 int value; |
| 2894 if (GetIntAttribute(attribute, &value)) | 2910 if (GetIntAttribute(attribute, &value)) |
| 2895 ia2_attributes_.push_back(ASCIIToUTF16(ia2_attr) + L":" + | 2911 ia2_attributes_.push_back(ASCIIToUTF16(ia2_attr) + L":" + |
| 2896 base::IntToString16(value)); | 2912 base::IntToString16(value)); |
| 2897 } | 2913 } |
| 2898 | 2914 |
| 2899 const string16& BrowserAccessibilityWin::TextForIAccessibleText() { | 2915 const string16& BrowserAccessibilityWin::TextForIAccessibleText() { |
| 2900 if (IsEditableText()) { | 2916 if (IsEditableText()) { |
| 2901 return value_; | 2917 return value_; |
| 2902 } else if (role_ == WebAccessibility::ROLE_STATIC_TEXT) { | 2918 } else if (role_ == AccessibilityNodeData::ROLE_STATIC_TEXT) { |
| 2903 return name_; | 2919 return name_; |
| 2904 } else { | 2920 } else { |
| 2905 return hypertext_; | 2921 return hypertext_; |
| 2906 } | 2922 } |
| 2907 } | 2923 } |
| 2908 | 2924 |
| 2909 void BrowserAccessibilityWin::HandleSpecialTextOffset( | 2925 void BrowserAccessibilityWin::HandleSpecialTextOffset( |
| 2910 const string16& text, LONG* offset) { | 2926 const string16& text, LONG* offset) { |
| 2911 if (*offset == IA2_TEXT_OFFSET_LENGTH) { | 2927 if (*offset == IA2_TEXT_OFFSET_LENGTH) { |
| 2912 *offset = static_cast<LONG>(text.size()); | 2928 *offset = static_cast<LONG>(text.size()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2944 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromRendererID( | 2960 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromRendererID( |
| 2945 int32 renderer_id) { | 2961 int32 renderer_id) { |
| 2946 return manager_->GetFromRendererID(renderer_id)->ToBrowserAccessibilityWin(); | 2962 return manager_->GetFromRendererID(renderer_id)->ToBrowserAccessibilityWin(); |
| 2947 } | 2963 } |
| 2948 | 2964 |
| 2949 void BrowserAccessibilityWin::InitRoleAndState() { | 2965 void BrowserAccessibilityWin::InitRoleAndState() { |
| 2950 ia_state_ = 0; | 2966 ia_state_ = 0; |
| 2951 ia2_state_ = IA2_STATE_OPAQUE; | 2967 ia2_state_ = IA2_STATE_OPAQUE; |
| 2952 ia2_attributes_.clear(); | 2968 ia2_attributes_.clear(); |
| 2953 | 2969 |
| 2954 if (HasState(WebAccessibility::STATE_BUSY)) | 2970 if (HasState(AccessibilityNodeData::STATE_BUSY)) |
| 2955 ia_state_ |= STATE_SYSTEM_BUSY; | 2971 ia_state_ |= STATE_SYSTEM_BUSY; |
| 2956 if (HasState(WebAccessibility::STATE_CHECKED)) | 2972 if (HasState(AccessibilityNodeData::STATE_CHECKED)) |
| 2957 ia_state_ |= STATE_SYSTEM_CHECKED; | 2973 ia_state_ |= STATE_SYSTEM_CHECKED; |
| 2958 if (HasState(WebAccessibility::STATE_COLLAPSED)) | 2974 if (HasState(AccessibilityNodeData::STATE_COLLAPSED)) |
| 2959 ia_state_ |= STATE_SYSTEM_COLLAPSED; | 2975 ia_state_ |= STATE_SYSTEM_COLLAPSED; |
| 2960 if (HasState(WebAccessibility::STATE_EXPANDED)) | 2976 if (HasState(AccessibilityNodeData::STATE_EXPANDED)) |
| 2961 ia_state_ |= STATE_SYSTEM_EXPANDED; | 2977 ia_state_ |= STATE_SYSTEM_EXPANDED; |
| 2962 if (HasState(WebAccessibility::STATE_FOCUSABLE)) | 2978 if (HasState(AccessibilityNodeData::STATE_FOCUSABLE)) |
| 2963 ia_state_ |= STATE_SYSTEM_FOCUSABLE; | 2979 ia_state_ |= STATE_SYSTEM_FOCUSABLE; |
| 2964 if (HasState(WebAccessibility::STATE_HASPOPUP)) | 2980 if (HasState(AccessibilityNodeData::STATE_HASPOPUP)) |
| 2965 ia_state_ |= STATE_SYSTEM_HASPOPUP; | 2981 ia_state_ |= STATE_SYSTEM_HASPOPUP; |
| 2966 if (HasState(WebAccessibility::STATE_HOTTRACKED)) | 2982 if (HasState(AccessibilityNodeData::STATE_HOTTRACKED)) |
| 2967 ia_state_ |= STATE_SYSTEM_HOTTRACKED; | 2983 ia_state_ |= STATE_SYSTEM_HOTTRACKED; |
| 2968 if (HasState(WebAccessibility::STATE_INDETERMINATE)) | 2984 if (HasState(AccessibilityNodeData::STATE_INDETERMINATE)) |
| 2969 ia_state_ |= STATE_SYSTEM_INDETERMINATE; | 2985 ia_state_ |= STATE_SYSTEM_INDETERMINATE; |
| 2970 if (HasState(WebAccessibility::STATE_INVISIBLE)) | 2986 if (HasState(AccessibilityNodeData::STATE_INVISIBLE)) |
| 2971 ia_state_ |= STATE_SYSTEM_INVISIBLE; | 2987 ia_state_ |= STATE_SYSTEM_INVISIBLE; |
| 2972 if (HasState(WebAccessibility::STATE_LINKED)) | 2988 if (HasState(AccessibilityNodeData::STATE_LINKED)) |
| 2973 ia_state_ |= STATE_SYSTEM_LINKED; | 2989 ia_state_ |= STATE_SYSTEM_LINKED; |
| 2974 if (HasState(WebAccessibility::STATE_MULTISELECTABLE)) { | 2990 if (HasState(AccessibilityNodeData::STATE_MULTISELECTABLE)) { |
| 2975 ia_state_ |= STATE_SYSTEM_EXTSELECTABLE; | 2991 ia_state_ |= STATE_SYSTEM_EXTSELECTABLE; |
| 2976 ia_state_ |= STATE_SYSTEM_MULTISELECTABLE; | 2992 ia_state_ |= STATE_SYSTEM_MULTISELECTABLE; |
| 2977 } | 2993 } |
| 2978 // TODO(ctguil): Support STATE_SYSTEM_EXTSELECTABLE/accSelect. | 2994 // TODO(ctguil): Support STATE_SYSTEM_EXTSELECTABLE/accSelect. |
| 2979 if (HasState(WebAccessibility::STATE_OFFSCREEN)) | 2995 if (HasState(AccessibilityNodeData::STATE_OFFSCREEN)) |
| 2980 ia_state_ |= STATE_SYSTEM_OFFSCREEN; | 2996 ia_state_ |= STATE_SYSTEM_OFFSCREEN; |
| 2981 if (HasState(WebAccessibility::STATE_PRESSED)) | 2997 if (HasState(AccessibilityNodeData::STATE_PRESSED)) |
| 2982 ia_state_ |= STATE_SYSTEM_PRESSED; | 2998 ia_state_ |= STATE_SYSTEM_PRESSED; |
| 2983 if (HasState(WebAccessibility::STATE_PROTECTED)) | 2999 if (HasState(AccessibilityNodeData::STATE_PROTECTED)) |
| 2984 ia_state_ |= STATE_SYSTEM_PROTECTED; | 3000 ia_state_ |= STATE_SYSTEM_PROTECTED; |
| 2985 if (HasState(WebAccessibility::STATE_REQUIRED)) | 3001 if (HasState(AccessibilityNodeData::STATE_REQUIRED)) |
| 2986 ia2_state_ |= IA2_STATE_REQUIRED; | 3002 ia2_state_ |= IA2_STATE_REQUIRED; |
| 2987 if (HasState(WebAccessibility::STATE_SELECTABLE)) | 3003 if (HasState(AccessibilityNodeData::STATE_SELECTABLE)) |
| 2988 ia_state_ |= STATE_SYSTEM_SELECTABLE; | 3004 ia_state_ |= STATE_SYSTEM_SELECTABLE; |
| 2989 if (HasState(WebAccessibility::STATE_SELECTED)) | 3005 if (HasState(AccessibilityNodeData::STATE_SELECTED)) |
| 2990 ia_state_ |= STATE_SYSTEM_SELECTED; | 3006 ia_state_ |= STATE_SYSTEM_SELECTED; |
| 2991 if (HasState(WebAccessibility::STATE_TRAVERSED)) | 3007 if (HasState(AccessibilityNodeData::STATE_TRAVERSED)) |
| 2992 ia_state_ |= STATE_SYSTEM_TRAVERSED; | 3008 ia_state_ |= STATE_SYSTEM_TRAVERSED; |
| 2993 if (HasState(WebAccessibility::STATE_UNAVAILABLE)) | 3009 if (HasState(AccessibilityNodeData::STATE_UNAVAILABLE)) |
| 2994 ia_state_ |= STATE_SYSTEM_UNAVAILABLE; | 3010 ia_state_ |= STATE_SYSTEM_UNAVAILABLE; |
| 2995 if (HasState(WebAccessibility::STATE_VERTICAL)) { | 3011 if (HasState(AccessibilityNodeData::STATE_VERTICAL)) { |
| 2996 ia2_state_ |= IA2_STATE_VERTICAL; | 3012 ia2_state_ |= IA2_STATE_VERTICAL; |
| 2997 } else { | 3013 } else { |
| 2998 ia2_state_ |= IA2_STATE_HORIZONTAL; | 3014 ia2_state_ |= IA2_STATE_HORIZONTAL; |
| 2999 } | 3015 } |
| 3000 if (HasState(WebAccessibility::STATE_VISITED)) | 3016 if (HasState(AccessibilityNodeData::STATE_VISITED)) |
| 3001 ia_state_ |= STATE_SYSTEM_TRAVERSED; | 3017 ia_state_ |= STATE_SYSTEM_TRAVERSED; |
| 3002 | 3018 |
| 3003 // WebKit marks everything as readonly unless it's editable text, so if it's | 3019 // WebKit marks everything as readonly unless it's editable text, so if it's |
| 3004 // not readonly, mark it as editable now. The final computation of the | 3020 // not readonly, mark it as editable now. The final computation of the |
| 3005 // READONLY state for MSAA is below, after the switch. | 3021 // READONLY state for MSAA is below, after the switch. |
| 3006 if (!HasState(WebAccessibility::STATE_READONLY)) | 3022 if (!HasState(AccessibilityNodeData::STATE_READONLY)) |
| 3007 ia2_state_ |= IA2_STATE_EDITABLE; | 3023 ia2_state_ |= IA2_STATE_EDITABLE; |
| 3008 | 3024 |
| 3009 string16 invalid; | 3025 string16 invalid; |
| 3010 if (GetHtmlAttribute("aria-invalid", &invalid)) | 3026 if (GetHtmlAttribute("aria-invalid", &invalid)) |
| 3011 ia2_state_ |= IA2_STATE_INVALID_ENTRY; | 3027 ia2_state_ |= IA2_STATE_INVALID_ENTRY; |
| 3012 | 3028 |
| 3013 bool mixed = false; | 3029 bool mixed = false; |
| 3014 GetBoolAttribute(WebAccessibility::ATTR_BUTTON_MIXED, &mixed); | 3030 GetBoolAttribute(AccessibilityNodeData::ATTR_BUTTON_MIXED, &mixed); |
| 3015 if (mixed) | 3031 if (mixed) |
| 3016 ia_state_ |= STATE_SYSTEM_MIXED; | 3032 ia_state_ |= STATE_SYSTEM_MIXED; |
| 3017 | 3033 |
| 3018 bool editable = false; | 3034 bool editable = false; |
| 3019 GetBoolAttribute(WebAccessibility::ATTR_CAN_SET_VALUE, &editable); | 3035 GetBoolAttribute(AccessibilityNodeData::ATTR_CAN_SET_VALUE, &editable); |
| 3020 if (editable) | 3036 if (editable) |
| 3021 ia2_state_ |= IA2_STATE_EDITABLE; | 3037 ia2_state_ |= IA2_STATE_EDITABLE; |
| 3022 | 3038 |
| 3023 string16 html_tag; | 3039 string16 html_tag; |
| 3024 GetStringAttribute(WebAccessibility::ATTR_HTML_TAG, &html_tag); | 3040 GetStringAttribute(AccessibilityNodeData::ATTR_HTML_TAG, &html_tag); |
| 3025 ia_role_ = 0; | 3041 ia_role_ = 0; |
| 3026 ia2_role_ = 0; | 3042 ia2_role_ = 0; |
| 3027 switch (role_) { | 3043 switch (role_) { |
| 3028 case WebAccessibility::ROLE_ALERT: | 3044 case AccessibilityNodeData::ROLE_ALERT: |
| 3029 ia_role_ = ROLE_SYSTEM_ALERT; | 3045 ia_role_ = ROLE_SYSTEM_ALERT; |
| 3030 break; | 3046 break; |
| 3031 case WebAccessibility::ROLE_ALERT_DIALOG: | 3047 case AccessibilityNodeData::ROLE_ALERT_DIALOG: |
| 3032 ia_role_ = ROLE_SYSTEM_DIALOG; | 3048 ia_role_ = ROLE_SYSTEM_DIALOG; |
| 3033 break; | 3049 break; |
| 3034 case WebAccessibility::ROLE_APPLICATION: | 3050 case AccessibilityNodeData::ROLE_APPLICATION: |
| 3035 ia_role_ = ROLE_SYSTEM_APPLICATION; | 3051 ia_role_ = ROLE_SYSTEM_APPLICATION; |
| 3036 break; | 3052 break; |
| 3037 case WebAccessibility::ROLE_ARTICLE: | 3053 case AccessibilityNodeData::ROLE_ARTICLE: |
| 3038 ia_role_ = ROLE_SYSTEM_GROUPING; | 3054 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3039 ia2_role_ = IA2_ROLE_SECTION; | 3055 ia2_role_ = IA2_ROLE_SECTION; |
| 3040 ia_state_ |= STATE_SYSTEM_READONLY; | 3056 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3041 break; | 3057 break; |
| 3042 case WebAccessibility::ROLE_BUSY_INDICATOR: | 3058 case AccessibilityNodeData::ROLE_BUSY_INDICATOR: |
| 3043 ia_role_ = ROLE_SYSTEM_ANIMATION; | 3059 ia_role_ = ROLE_SYSTEM_ANIMATION; |
| 3044 ia_state_ |= STATE_SYSTEM_READONLY; | 3060 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3045 break; | 3061 break; |
| 3046 case WebAccessibility::ROLE_BUTTON: | 3062 case AccessibilityNodeData::ROLE_BUTTON: |
| 3047 ia_role_ = ROLE_SYSTEM_PUSHBUTTON; | 3063 ia_role_ = ROLE_SYSTEM_PUSHBUTTON; |
| 3048 bool is_aria_pressed_defined; | 3064 bool is_aria_pressed_defined; |
| 3049 bool is_mixed; | 3065 bool is_mixed; |
| 3050 if (GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed)) | 3066 if (GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed)) |
| 3051 ia_state_ |= STATE_SYSTEM_PRESSED; | 3067 ia_state_ |= STATE_SYSTEM_PRESSED; |
| 3052 if (is_aria_pressed_defined) | 3068 if (is_aria_pressed_defined) |
| 3053 ia2_role_ = IA2_ROLE_TOGGLE_BUTTON; | 3069 ia2_role_ = IA2_ROLE_TOGGLE_BUTTON; |
| 3054 if (is_mixed) | 3070 if (is_mixed) |
| 3055 ia_state_ |= STATE_SYSTEM_MIXED; | 3071 ia_state_ |= STATE_SYSTEM_MIXED; |
| 3056 break; | 3072 break; |
| 3057 case WebAccessibility::ROLE_CELL: | 3073 case AccessibilityNodeData::ROLE_CELL: |
| 3058 ia_role_ = ROLE_SYSTEM_CELL; | 3074 ia_role_ = ROLE_SYSTEM_CELL; |
| 3059 break; | 3075 break; |
| 3060 case WebAccessibility::ROLE_CHECKBOX: | 3076 case AccessibilityNodeData::ROLE_CHECKBOX: |
| 3061 ia_role_ = ROLE_SYSTEM_CHECKBUTTON; | 3077 ia_role_ = ROLE_SYSTEM_CHECKBUTTON; |
| 3062 break; | 3078 break; |
| 3063 case WebAccessibility::ROLE_COLOR_WELL: | 3079 case AccessibilityNodeData::ROLE_COLOR_WELL: |
| 3064 ia_role_ = ROLE_SYSTEM_CLIENT; | 3080 ia_role_ = ROLE_SYSTEM_CLIENT; |
| 3065 ia2_role_ = IA2_ROLE_COLOR_CHOOSER; | 3081 ia2_role_ = IA2_ROLE_COLOR_CHOOSER; |
| 3066 break; | 3082 break; |
| 3067 case WebAccessibility::ROLE_COLUMN: | 3083 case AccessibilityNodeData::ROLE_COLUMN: |
| 3068 ia_role_ = ROLE_SYSTEM_COLUMN; | 3084 ia_role_ = ROLE_SYSTEM_COLUMN; |
| 3069 ia_state_ |= STATE_SYSTEM_READONLY; | 3085 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3070 break; | 3086 break; |
| 3071 case WebAccessibility::ROLE_COLUMN_HEADER: | 3087 case AccessibilityNodeData::ROLE_COLUMN_HEADER: |
| 3072 ia_role_ = ROLE_SYSTEM_COLUMNHEADER; | 3088 ia_role_ = ROLE_SYSTEM_COLUMNHEADER; |
| 3073 ia_state_ |= STATE_SYSTEM_READONLY; | 3089 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3074 break; | 3090 break; |
| 3075 case WebAccessibility::ROLE_COMBO_BOX: | 3091 case AccessibilityNodeData::ROLE_COMBO_BOX: |
| 3076 ia_role_ = ROLE_SYSTEM_COMBOBOX; | 3092 ia_role_ = ROLE_SYSTEM_COMBOBOX; |
| 3077 break; | 3093 break; |
| 3078 case WebAccessibility::ROLE_DEFINITION_LIST_DEFINITION: | 3094 case AccessibilityNodeData::ROLE_DEFINITION_LIST_DEFINITION: |
| 3079 role_name_ = html_tag; | 3095 role_name_ = html_tag; |
| 3080 ia2_role_ = IA2_ROLE_PARAGRAPH; | 3096 ia2_role_ = IA2_ROLE_PARAGRAPH; |
| 3081 ia_state_ |= STATE_SYSTEM_READONLY; | 3097 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3082 break; | 3098 break; |
| 3083 case WebAccessibility::ROLE_DEFINITION_LIST_TERM: | 3099 case AccessibilityNodeData::ROLE_DEFINITION_LIST_TERM: |
| 3084 ia_role_ = ROLE_SYSTEM_LISTITEM; | 3100 ia_role_ = ROLE_SYSTEM_LISTITEM; |
| 3085 ia_state_ |= STATE_SYSTEM_READONLY; | 3101 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3086 break; | 3102 break; |
| 3087 case WebAccessibility::ROLE_DIALOG: | 3103 case AccessibilityNodeData::ROLE_DIALOG: |
| 3088 ia_role_ = ROLE_SYSTEM_DIALOG; | 3104 ia_role_ = ROLE_SYSTEM_DIALOG; |
| 3089 ia_state_ |= STATE_SYSTEM_READONLY; | 3105 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3090 break; | 3106 break; |
| 3091 case WebAccessibility::ROLE_DISCLOSURE_TRIANGLE: | 3107 case AccessibilityNodeData::ROLE_DISCLOSURE_TRIANGLE: |
| 3092 ia_role_ = ROLE_SYSTEM_OUTLINEBUTTON; | 3108 ia_role_ = ROLE_SYSTEM_OUTLINEBUTTON; |
| 3093 ia_state_ |= STATE_SYSTEM_READONLY; | 3109 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3094 break; | 3110 break; |
| 3095 case WebAccessibility::ROLE_DOCUMENT: | 3111 case AccessibilityNodeData::ROLE_DOCUMENT: |
| 3096 case WebAccessibility::ROLE_ROOT_WEB_AREA: | 3112 case AccessibilityNodeData::ROLE_ROOT_WEB_AREA: |
| 3097 case WebAccessibility::ROLE_WEB_AREA: | 3113 case AccessibilityNodeData::ROLE_WEB_AREA: |
| 3098 ia_role_ = ROLE_SYSTEM_DOCUMENT; | 3114 ia_role_ = ROLE_SYSTEM_DOCUMENT; |
| 3099 ia_state_ |= STATE_SYSTEM_READONLY; | 3115 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3100 ia_state_ |= STATE_SYSTEM_FOCUSABLE; | 3116 ia_state_ |= STATE_SYSTEM_FOCUSABLE; |
| 3101 break; | 3117 break; |
| 3102 case WebAccessibility::ROLE_EDITABLE_TEXT: | 3118 case AccessibilityNodeData::ROLE_EDITABLE_TEXT: |
| 3103 ia_role_ = ROLE_SYSTEM_TEXT; | 3119 ia_role_ = ROLE_SYSTEM_TEXT; |
| 3104 ia2_state_ |= IA2_STATE_SINGLE_LINE; | 3120 ia2_state_ |= IA2_STATE_SINGLE_LINE; |
| 3105 ia2_state_ |= IA2_STATE_EDITABLE; | 3121 ia2_state_ |= IA2_STATE_EDITABLE; |
| 3106 break; | 3122 break; |
| 3107 case WebAccessibility::ROLE_FOOTER: | 3123 case AccessibilityNodeData::ROLE_FOOTER: |
| 3108 ia_role_ = IA2_ROLE_FOOTER; | 3124 ia_role_ = IA2_ROLE_FOOTER; |
| 3109 ia_state_ |= STATE_SYSTEM_READONLY; | 3125 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3110 break; | 3126 break; |
| 3111 case WebAccessibility::ROLE_GRID: | 3127 case AccessibilityNodeData::ROLE_GRID: |
| 3112 ia_role_ = ROLE_SYSTEM_TABLE; | 3128 ia_role_ = ROLE_SYSTEM_TABLE; |
| 3113 ia_state_ |= STATE_SYSTEM_READONLY; | 3129 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3114 break; | 3130 break; |
| 3115 case WebAccessibility::ROLE_GROUP: { | 3131 case AccessibilityNodeData::ROLE_GROUP: { |
| 3116 string16 aria_role; | 3132 string16 aria_role; |
| 3117 GetStringAttribute(WebAccessibility::ATTR_ROLE, &aria_role); | 3133 GetStringAttribute(AccessibilityNodeData::ATTR_ROLE, &aria_role); |
| 3118 if (aria_role == L"group" || html_tag == L"fieldset") { | 3134 if (aria_role == L"group" || html_tag == L"fieldset") { |
| 3119 ia_role_ = ROLE_SYSTEM_GROUPING; | 3135 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3120 } else if (html_tag == L"li") { | 3136 } else if (html_tag == L"li") { |
| 3121 ia_role_ = ROLE_SYSTEM_LISTITEM; | 3137 ia_role_ = ROLE_SYSTEM_LISTITEM; |
| 3122 } else if (html_tag == L"form") { | 3138 } else if (html_tag == L"form") { |
| 3123 role_name_ = html_tag; | 3139 role_name_ = html_tag; |
| 3124 ia2_role_ = IA2_ROLE_FORM; | 3140 ia2_role_ = IA2_ROLE_FORM; |
| 3125 } else if (html_tag == L"p") { | 3141 } else if (html_tag == L"p") { |
| 3126 role_name_ = html_tag; | 3142 role_name_ = html_tag; |
| 3127 ia2_role_ = IA2_ROLE_PARAGRAPH; | 3143 ia2_role_ = IA2_ROLE_PARAGRAPH; |
| 3128 } else { | 3144 } else { |
| 3129 if (html_tag.empty()) | 3145 if (html_tag.empty()) |
| 3130 role_name_ = L"div"; | 3146 role_name_ = L"div"; |
| 3131 else | 3147 else |
| 3132 role_name_ = html_tag; | 3148 role_name_ = html_tag; |
| 3133 ia2_role_ = IA2_ROLE_SECTION; | 3149 ia2_role_ = IA2_ROLE_SECTION; |
| 3134 } | 3150 } |
| 3135 ia_state_ |= STATE_SYSTEM_READONLY; | 3151 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3136 break; | 3152 break; |
| 3137 } | 3153 } |
| 3138 case WebAccessibility::ROLE_GROW_AREA: | 3154 case AccessibilityNodeData::ROLE_GROW_AREA: |
| 3139 ia_role_ = ROLE_SYSTEM_GRIP; | 3155 ia_role_ = ROLE_SYSTEM_GRIP; |
| 3140 ia_state_ |= STATE_SYSTEM_READONLY; | 3156 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3141 break; | 3157 break; |
| 3142 case WebAccessibility::ROLE_HEADING: | 3158 case AccessibilityNodeData::ROLE_HEADING: |
| 3143 role_name_ = html_tag; | 3159 role_name_ = html_tag; |
| 3144 ia2_role_ = IA2_ROLE_HEADING; | 3160 ia2_role_ = IA2_ROLE_HEADING; |
| 3145 ia_state_ |= STATE_SYSTEM_READONLY; | 3161 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3146 break; | 3162 break; |
| 3147 case WebAccessibility::ROLE_IMAGE: | 3163 case AccessibilityNodeData::ROLE_IMAGE: |
| 3148 ia_role_ = ROLE_SYSTEM_GRAPHIC; | 3164 ia_role_ = ROLE_SYSTEM_GRAPHIC; |
| 3149 ia_state_ |= STATE_SYSTEM_READONLY; | 3165 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3150 break; | 3166 break; |
| 3151 case WebAccessibility::ROLE_IMAGE_MAP: | 3167 case AccessibilityNodeData::ROLE_IMAGE_MAP: |
| 3152 role_name_ = html_tag; | 3168 role_name_ = html_tag; |
| 3153 ia2_role_ = IA2_ROLE_IMAGE_MAP; | 3169 ia2_role_ = IA2_ROLE_IMAGE_MAP; |
| 3154 ia_state_ |= STATE_SYSTEM_READONLY; | 3170 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3155 break; | 3171 break; |
| 3156 case WebAccessibility::ROLE_IMAGE_MAP_LINK: | 3172 case AccessibilityNodeData::ROLE_IMAGE_MAP_LINK: |
| 3157 ia_role_ = ROLE_SYSTEM_LINK; | 3173 ia_role_ = ROLE_SYSTEM_LINK; |
| 3158 ia_state_ |= STATE_SYSTEM_LINKED; | 3174 ia_state_ |= STATE_SYSTEM_LINKED; |
| 3159 ia_state_ |= STATE_SYSTEM_READONLY; | 3175 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3160 break; | 3176 break; |
| 3161 case WebAccessibility::ROLE_LANDMARK_APPLICATION: | 3177 case AccessibilityNodeData::ROLE_LANDMARK_APPLICATION: |
| 3162 case WebAccessibility::ROLE_LANDMARK_BANNER: | 3178 case AccessibilityNodeData::ROLE_LANDMARK_BANNER: |
| 3163 case WebAccessibility::ROLE_LANDMARK_COMPLEMENTARY: | 3179 case AccessibilityNodeData::ROLE_LANDMARK_COMPLEMENTARY: |
| 3164 case WebAccessibility::ROLE_LANDMARK_CONTENTINFO: | 3180 case AccessibilityNodeData::ROLE_LANDMARK_CONTENTINFO: |
| 3165 case WebAccessibility::ROLE_LANDMARK_MAIN: | 3181 case AccessibilityNodeData::ROLE_LANDMARK_MAIN: |
| 3166 case WebAccessibility::ROLE_LANDMARK_NAVIGATION: | 3182 case AccessibilityNodeData::ROLE_LANDMARK_NAVIGATION: |
| 3167 case WebAccessibility::ROLE_LANDMARK_SEARCH: | 3183 case AccessibilityNodeData::ROLE_LANDMARK_SEARCH: |
| 3168 ia_role_ = ROLE_SYSTEM_GROUPING; | 3184 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3169 ia2_role_ = IA2_ROLE_SECTION; | 3185 ia2_role_ = IA2_ROLE_SECTION; |
| 3170 ia_state_ |= STATE_SYSTEM_READONLY; | 3186 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3171 break; | 3187 break; |
| 3172 case WebAccessibility::ROLE_LINK: | 3188 case AccessibilityNodeData::ROLE_LINK: |
| 3173 case WebAccessibility::ROLE_WEBCORE_LINK: | 3189 case AccessibilityNodeData::ROLE_WEBCORE_LINK: |
| 3174 ia_role_ = ROLE_SYSTEM_LINK; | 3190 ia_role_ = ROLE_SYSTEM_LINK; |
| 3175 ia_state_ |= STATE_SYSTEM_LINKED; | 3191 ia_state_ |= STATE_SYSTEM_LINKED; |
| 3176 break; | 3192 break; |
| 3177 case WebAccessibility::ROLE_LIST: | 3193 case AccessibilityNodeData::ROLE_LIST: |
| 3178 ia_role_ = ROLE_SYSTEM_LIST; | 3194 ia_role_ = ROLE_SYSTEM_LIST; |
| 3179 ia_state_ |= STATE_SYSTEM_READONLY; | 3195 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3180 break; | 3196 break; |
| 3181 case WebAccessibility::ROLE_LISTBOX: | 3197 case AccessibilityNodeData::ROLE_LISTBOX: |
| 3182 ia_role_ = ROLE_SYSTEM_LIST; | 3198 ia_role_ = ROLE_SYSTEM_LIST; |
| 3183 break; | 3199 break; |
| 3184 case WebAccessibility::ROLE_LISTBOX_OPTION: | 3200 case AccessibilityNodeData::ROLE_LISTBOX_OPTION: |
| 3185 ia_role_ = ROLE_SYSTEM_LISTITEM; | 3201 ia_role_ = ROLE_SYSTEM_LISTITEM; |
| 3186 if (ia_state_ & STATE_SYSTEM_SELECTABLE) { | 3202 if (ia_state_ & STATE_SYSTEM_SELECTABLE) { |
| 3187 ia_state_ |= STATE_SYSTEM_FOCUSABLE; | 3203 ia_state_ |= STATE_SYSTEM_FOCUSABLE; |
| 3188 if (HasState(WebAccessibility::STATE_FOCUSED)) | 3204 if (HasState(AccessibilityNodeData::STATE_FOCUSED)) |
| 3189 ia_state_ |= STATE_SYSTEM_FOCUSED; | 3205 ia_state_ |= STATE_SYSTEM_FOCUSED; |
| 3190 } | 3206 } |
| 3191 break; | 3207 break; |
| 3192 case WebAccessibility::ROLE_LIST_ITEM: | 3208 case AccessibilityNodeData::ROLE_LIST_ITEM: |
| 3193 ia_role_ = ROLE_SYSTEM_LISTITEM; | 3209 ia_role_ = ROLE_SYSTEM_LISTITEM; |
| 3194 ia_state_ |= STATE_SYSTEM_READONLY; | 3210 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3195 break; | 3211 break; |
| 3196 case WebAccessibility::ROLE_LIST_MARKER: | 3212 case AccessibilityNodeData::ROLE_LIST_MARKER: |
| 3197 ia_role_ = ROLE_SYSTEM_TEXT; | 3213 ia_role_ = ROLE_SYSTEM_TEXT; |
| 3198 ia_state_ |= STATE_SYSTEM_READONLY; | 3214 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3199 break; | 3215 break; |
| 3200 case WebAccessibility::ROLE_MATH: | 3216 case AccessibilityNodeData::ROLE_MATH: |
| 3201 ia_role_ = ROLE_SYSTEM_EQUATION; | 3217 ia_role_ = ROLE_SYSTEM_EQUATION; |
| 3202 ia_state_ |= STATE_SYSTEM_READONLY; | 3218 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3203 break; | 3219 break; |
| 3204 case WebAccessibility::ROLE_MENU: | 3220 case AccessibilityNodeData::ROLE_MENU: |
| 3205 case WebAccessibility::ROLE_MENU_BUTTON: | 3221 case AccessibilityNodeData::ROLE_MENU_BUTTON: |
| 3206 ia_role_ = ROLE_SYSTEM_MENUPOPUP; | 3222 ia_role_ = ROLE_SYSTEM_MENUPOPUP; |
| 3207 break; | 3223 break; |
| 3208 case WebAccessibility::ROLE_MENU_BAR: | 3224 case AccessibilityNodeData::ROLE_MENU_BAR: |
| 3209 ia_role_ = ROLE_SYSTEM_MENUBAR; | 3225 ia_role_ = ROLE_SYSTEM_MENUBAR; |
| 3210 break; | 3226 break; |
| 3211 case WebAccessibility::ROLE_MENU_ITEM: | 3227 case AccessibilityNodeData::ROLE_MENU_ITEM: |
| 3212 ia_role_ = ROLE_SYSTEM_MENUITEM; | 3228 ia_role_ = ROLE_SYSTEM_MENUITEM; |
| 3213 break; | 3229 break; |
| 3214 case WebAccessibility::ROLE_MENU_LIST_POPUP: | 3230 case AccessibilityNodeData::ROLE_MENU_LIST_POPUP: |
| 3215 ia_role_ = ROLE_SYSTEM_CLIENT; | 3231 ia_role_ = ROLE_SYSTEM_CLIENT; |
| 3216 break; | 3232 break; |
| 3217 case WebAccessibility::ROLE_MENU_LIST_OPTION: | 3233 case AccessibilityNodeData::ROLE_MENU_LIST_OPTION: |
| 3218 ia_role_ = ROLE_SYSTEM_LISTITEM; | 3234 ia_role_ = ROLE_SYSTEM_LISTITEM; |
| 3219 if (ia_state_ & STATE_SYSTEM_SELECTABLE) { | 3235 if (ia_state_ & STATE_SYSTEM_SELECTABLE) { |
| 3220 ia_state_ |= STATE_SYSTEM_FOCUSABLE; | 3236 ia_state_ |= STATE_SYSTEM_FOCUSABLE; |
| 3221 if (HasState(WebAccessibility::STATE_FOCUSED)) | 3237 if (HasState(AccessibilityNodeData::STATE_FOCUSED)) |
| 3222 ia_state_ |= STATE_SYSTEM_FOCUSED; | 3238 ia_state_ |= STATE_SYSTEM_FOCUSED; |
| 3223 } | 3239 } |
| 3224 break; | 3240 break; |
| 3225 case WebAccessibility::ROLE_NOTE: | 3241 case AccessibilityNodeData::ROLE_NOTE: |
| 3226 ia_role_ = ROLE_SYSTEM_GROUPING; | 3242 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3227 ia2_role_ = IA2_ROLE_NOTE; | 3243 ia2_role_ = IA2_ROLE_NOTE; |
| 3228 ia_state_ |= STATE_SYSTEM_READONLY; | 3244 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3229 break; | 3245 break; |
| 3230 case WebAccessibility::ROLE_OUTLINE: | 3246 case AccessibilityNodeData::ROLE_OUTLINE: |
| 3231 ia_role_ = ROLE_SYSTEM_OUTLINE; | 3247 ia_role_ = ROLE_SYSTEM_OUTLINE; |
| 3232 ia_state_ |= STATE_SYSTEM_READONLY; | 3248 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3233 break; | 3249 break; |
| 3234 case WebAccessibility::ROLE_POPUP_BUTTON: | 3250 case AccessibilityNodeData::ROLE_POPUP_BUTTON: |
| 3235 if (html_tag == L"select") { | 3251 if (html_tag == L"select") { |
| 3236 ia_role_ = ROLE_SYSTEM_COMBOBOX; | 3252 ia_role_ = ROLE_SYSTEM_COMBOBOX; |
| 3237 } else { | 3253 } else { |
| 3238 ia_role_ = ROLE_SYSTEM_BUTTONMENU; | 3254 ia_role_ = ROLE_SYSTEM_BUTTONMENU; |
| 3239 } | 3255 } |
| 3240 break; | 3256 break; |
| 3241 case WebAccessibility::ROLE_PROGRESS_INDICATOR: | 3257 case AccessibilityNodeData::ROLE_PROGRESS_INDICATOR: |
| 3242 ia_role_ = ROLE_SYSTEM_PROGRESSBAR; | 3258 ia_role_ = ROLE_SYSTEM_PROGRESSBAR; |
| 3243 ia_state_ |= STATE_SYSTEM_READONLY; | 3259 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3244 break; | 3260 break; |
| 3245 case WebAccessibility::ROLE_RADIO_BUTTON: | 3261 case AccessibilityNodeData::ROLE_RADIO_BUTTON: |
| 3246 ia_role_ = ROLE_SYSTEM_RADIOBUTTON; | 3262 ia_role_ = ROLE_SYSTEM_RADIOBUTTON; |
| 3247 break; | 3263 break; |
| 3248 case WebAccessibility::ROLE_RADIO_GROUP: | 3264 case AccessibilityNodeData::ROLE_RADIO_GROUP: |
| 3249 ia_role_ = ROLE_SYSTEM_GROUPING; | 3265 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3250 ia2_role_ = IA2_ROLE_SECTION; | 3266 ia2_role_ = IA2_ROLE_SECTION; |
| 3251 break; | 3267 break; |
| 3252 case WebAccessibility::ROLE_REGION: | 3268 case AccessibilityNodeData::ROLE_REGION: |
| 3253 ia_role_ = ROLE_SYSTEM_GROUPING; | 3269 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3254 ia2_role_ = IA2_ROLE_SECTION; | 3270 ia2_role_ = IA2_ROLE_SECTION; |
| 3255 ia_state_ |= STATE_SYSTEM_READONLY; | 3271 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3256 break; | 3272 break; |
| 3257 case WebAccessibility::ROLE_ROW: | 3273 case AccessibilityNodeData::ROLE_ROW: |
| 3258 ia_role_ = ROLE_SYSTEM_ROW; | 3274 ia_role_ = ROLE_SYSTEM_ROW; |
| 3259 ia_state_ |= STATE_SYSTEM_READONLY; | 3275 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3260 break; | 3276 break; |
| 3261 case WebAccessibility::ROLE_ROW_HEADER: | 3277 case AccessibilityNodeData::ROLE_ROW_HEADER: |
| 3262 ia_role_ = ROLE_SYSTEM_ROWHEADER; | 3278 ia_role_ = ROLE_SYSTEM_ROWHEADER; |
| 3263 ia_state_ |= STATE_SYSTEM_READONLY; | 3279 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3264 break; | 3280 break; |
| 3265 case WebAccessibility::ROLE_RULER: | 3281 case AccessibilityNodeData::ROLE_RULER: |
| 3266 ia_role_ = ROLE_SYSTEM_CLIENT; | 3282 ia_role_ = ROLE_SYSTEM_CLIENT; |
| 3267 ia2_role_ = IA2_ROLE_RULER; | 3283 ia2_role_ = IA2_ROLE_RULER; |
| 3268 ia_state_ |= STATE_SYSTEM_READONLY; | 3284 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3269 break; | 3285 break; |
| 3270 case WebAccessibility::ROLE_SCROLLAREA: | 3286 case AccessibilityNodeData::ROLE_SCROLLAREA: |
| 3271 ia_role_ = ROLE_SYSTEM_CLIENT; | 3287 ia_role_ = ROLE_SYSTEM_CLIENT; |
| 3272 ia2_role_ = IA2_ROLE_SCROLL_PANE; | 3288 ia2_role_ = IA2_ROLE_SCROLL_PANE; |
| 3273 ia_state_ |= STATE_SYSTEM_READONLY; | 3289 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3274 break; | 3290 break; |
| 3275 case WebAccessibility::ROLE_SCROLLBAR: | 3291 case AccessibilityNodeData::ROLE_SCROLLBAR: |
| 3276 ia_role_ = ROLE_SYSTEM_SCROLLBAR; | 3292 ia_role_ = ROLE_SYSTEM_SCROLLBAR; |
| 3277 break; | 3293 break; |
| 3278 case WebAccessibility::ROLE_SLIDER: | 3294 case AccessibilityNodeData::ROLE_SLIDER: |
| 3279 ia_role_ = ROLE_SYSTEM_SLIDER; | 3295 ia_role_ = ROLE_SYSTEM_SLIDER; |
| 3280 break; | 3296 break; |
| 3281 case WebAccessibility::ROLE_SPLIT_GROUP: | 3297 case AccessibilityNodeData::ROLE_SPLIT_GROUP: |
| 3282 ia_role_ = ROLE_SYSTEM_CLIENT; | 3298 ia_role_ = ROLE_SYSTEM_CLIENT; |
| 3283 ia2_role_ = IA2_ROLE_SPLIT_PANE; | 3299 ia2_role_ = IA2_ROLE_SPLIT_PANE; |
| 3284 ia_state_ |= STATE_SYSTEM_READONLY; | 3300 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3285 break; | 3301 break; |
| 3286 case WebAccessibility::ROLE_ANNOTATION: | 3302 case AccessibilityNodeData::ROLE_ANNOTATION: |
| 3287 case WebAccessibility::ROLE_STATIC_TEXT: | 3303 case AccessibilityNodeData::ROLE_STATIC_TEXT: |
| 3288 ia_role_ = ROLE_SYSTEM_TEXT; | 3304 ia_role_ = ROLE_SYSTEM_TEXT; |
| 3289 ia_state_ |= STATE_SYSTEM_READONLY; | 3305 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3290 break; | 3306 break; |
| 3291 case WebAccessibility::ROLE_STATUS: | 3307 case AccessibilityNodeData::ROLE_STATUS: |
| 3292 ia_role_ = ROLE_SYSTEM_STATUSBAR; | 3308 ia_role_ = ROLE_SYSTEM_STATUSBAR; |
| 3293 ia_state_ |= STATE_SYSTEM_READONLY; | 3309 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3294 break; | 3310 break; |
| 3295 case WebAccessibility::ROLE_SPLITTER: | 3311 case AccessibilityNodeData::ROLE_SPLITTER: |
| 3296 ia_role_ = ROLE_SYSTEM_SEPARATOR; | 3312 ia_role_ = ROLE_SYSTEM_SEPARATOR; |
| 3297 break; | 3313 break; |
| 3298 case WebAccessibility::ROLE_TAB: | 3314 case AccessibilityNodeData::ROLE_TAB: |
| 3299 ia_role_ = ROLE_SYSTEM_PAGETAB; | 3315 ia_role_ = ROLE_SYSTEM_PAGETAB; |
| 3300 break; | 3316 break; |
| 3301 case WebAccessibility::ROLE_TABLE: | 3317 case AccessibilityNodeData::ROLE_TABLE: |
| 3302 ia_role_ = ROLE_SYSTEM_TABLE; | 3318 ia_role_ = ROLE_SYSTEM_TABLE; |
| 3303 ia_state_ |= STATE_SYSTEM_READONLY; | 3319 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3304 break; | 3320 break; |
| 3305 case WebAccessibility::ROLE_TABLE_HEADER_CONTAINER: | 3321 case AccessibilityNodeData::ROLE_TABLE_HEADER_CONTAINER: |
| 3306 ia_role_ = ROLE_SYSTEM_GROUPING; | 3322 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3307 ia2_role_ = IA2_ROLE_SECTION; | 3323 ia2_role_ = IA2_ROLE_SECTION; |
| 3308 ia_state_ |= STATE_SYSTEM_READONLY; | 3324 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3309 break; | 3325 break; |
| 3310 case WebAccessibility::ROLE_TAB_GROUP_UNUSED: | 3326 case AccessibilityNodeData::ROLE_TAB_GROUP_UNUSED: |
| 3311 NOTREACHED(); | 3327 NOTREACHED(); |
| 3312 ia_role_ = ROLE_SYSTEM_PAGETABLIST; | 3328 ia_role_ = ROLE_SYSTEM_PAGETABLIST; |
| 3313 break; | 3329 break; |
| 3314 case WebAccessibility::ROLE_TAB_LIST: | 3330 case AccessibilityNodeData::ROLE_TAB_LIST: |
| 3315 ia_role_ = ROLE_SYSTEM_PAGETABLIST; | 3331 ia_role_ = ROLE_SYSTEM_PAGETABLIST; |
| 3316 break; | 3332 break; |
| 3317 case WebAccessibility::ROLE_TAB_PANEL: | 3333 case AccessibilityNodeData::ROLE_TAB_PANEL: |
| 3318 ia_role_ = ROLE_SYSTEM_PROPERTYPAGE; | 3334 ia_role_ = ROLE_SYSTEM_PROPERTYPAGE; |
| 3319 break; | 3335 break; |
| 3320 case WebAccessibility::ROLE_TEXTAREA: | 3336 case AccessibilityNodeData::ROLE_TEXTAREA: |
| 3321 ia_role_ = ROLE_SYSTEM_TEXT; | 3337 ia_role_ = ROLE_SYSTEM_TEXT; |
| 3322 ia2_state_ |= IA2_STATE_MULTI_LINE; | 3338 ia2_state_ |= IA2_STATE_MULTI_LINE; |
| 3323 ia2_state_ |= IA2_STATE_EDITABLE; | 3339 ia2_state_ |= IA2_STATE_EDITABLE; |
| 3324 ia2_state_ |= IA2_STATE_SELECTABLE_TEXT; | 3340 ia2_state_ |= IA2_STATE_SELECTABLE_TEXT; |
| 3325 break; | 3341 break; |
| 3326 case WebAccessibility::ROLE_TEXT_FIELD: | 3342 case AccessibilityNodeData::ROLE_TEXT_FIELD: |
| 3327 ia_role_ = ROLE_SYSTEM_TEXT; | 3343 ia_role_ = ROLE_SYSTEM_TEXT; |
| 3328 ia2_state_ |= IA2_STATE_SINGLE_LINE; | 3344 ia2_state_ |= IA2_STATE_SINGLE_LINE; |
| 3329 ia2_state_ |= IA2_STATE_EDITABLE; | 3345 ia2_state_ |= IA2_STATE_EDITABLE; |
| 3330 ia2_state_ |= IA2_STATE_SELECTABLE_TEXT; | 3346 ia2_state_ |= IA2_STATE_SELECTABLE_TEXT; |
| 3331 break; | 3347 break; |
| 3332 case WebAccessibility::ROLE_TIMER: | 3348 case AccessibilityNodeData::ROLE_TIMER: |
| 3333 ia_role_ = ROLE_SYSTEM_CLOCK; | 3349 ia_role_ = ROLE_SYSTEM_CLOCK; |
| 3334 ia_state_ |= STATE_SYSTEM_READONLY; | 3350 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3335 break; | 3351 break; |
| 3336 case WebAccessibility::ROLE_TOOLBAR: | 3352 case AccessibilityNodeData::ROLE_TOOLBAR: |
| 3337 ia_role_ = ROLE_SYSTEM_TOOLBAR; | 3353 ia_role_ = ROLE_SYSTEM_TOOLBAR; |
| 3338 ia_state_ |= STATE_SYSTEM_READONLY; | 3354 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3339 break; | 3355 break; |
| 3340 case WebAccessibility::ROLE_TOOLTIP: | 3356 case AccessibilityNodeData::ROLE_TOOLTIP: |
| 3341 ia_role_ = ROLE_SYSTEM_TOOLTIP; | 3357 ia_role_ = ROLE_SYSTEM_TOOLTIP; |
| 3342 ia_state_ |= STATE_SYSTEM_READONLY; | 3358 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3343 break; | 3359 break; |
| 3344 case WebAccessibility::ROLE_TREE: | 3360 case AccessibilityNodeData::ROLE_TREE: |
| 3345 ia_role_ = ROLE_SYSTEM_OUTLINE; | 3361 ia_role_ = ROLE_SYSTEM_OUTLINE; |
| 3346 ia_state_ |= STATE_SYSTEM_READONLY; | 3362 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3347 break; | 3363 break; |
| 3348 case WebAccessibility::ROLE_TREE_GRID: | 3364 case AccessibilityNodeData::ROLE_TREE_GRID: |
| 3349 ia_role_ = ROLE_SYSTEM_OUTLINE; | 3365 ia_role_ = ROLE_SYSTEM_OUTLINE; |
| 3350 ia_state_ |= STATE_SYSTEM_READONLY; | 3366 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3351 break; | 3367 break; |
| 3352 case WebAccessibility::ROLE_TREE_ITEM: | 3368 case AccessibilityNodeData::ROLE_TREE_ITEM: |
| 3353 ia_role_ = ROLE_SYSTEM_OUTLINEITEM; | 3369 ia_role_ = ROLE_SYSTEM_OUTLINEITEM; |
| 3354 ia_state_ |= STATE_SYSTEM_READONLY; | 3370 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3355 break; | 3371 break; |
| 3356 case WebAccessibility::ROLE_WINDOW: | 3372 case AccessibilityNodeData::ROLE_WINDOW: |
| 3357 ia_role_ = ROLE_SYSTEM_WINDOW; | 3373 ia_role_ = ROLE_SYSTEM_WINDOW; |
| 3358 break; | 3374 break; |
| 3359 | 3375 |
| 3360 // TODO(dmazzoni): figure out the proper MSAA role for all of these. | 3376 // TODO(dmazzoni): figure out the proper MSAA role for all of these. |
| 3361 case WebAccessibility::ROLE_BROWSER: | 3377 case AccessibilityNodeData::ROLE_BROWSER: |
| 3362 case WebAccessibility::ROLE_DIRECTORY: | 3378 case AccessibilityNodeData::ROLE_DIRECTORY: |
| 3363 case WebAccessibility::ROLE_DRAWER: | 3379 case AccessibilityNodeData::ROLE_DRAWER: |
| 3364 case WebAccessibility::ROLE_HELP_TAG: | 3380 case AccessibilityNodeData::ROLE_HELP_TAG: |
| 3365 case WebAccessibility::ROLE_IGNORED: | 3381 case AccessibilityNodeData::ROLE_IGNORED: |
| 3366 case WebAccessibility::ROLE_INCREMENTOR: | 3382 case AccessibilityNodeData::ROLE_INCREMENTOR: |
| 3367 case WebAccessibility::ROLE_LOG: | 3383 case AccessibilityNodeData::ROLE_LOG: |
| 3368 case WebAccessibility::ROLE_MARQUEE: | 3384 case AccessibilityNodeData::ROLE_MARQUEE: |
| 3369 case WebAccessibility::ROLE_MATTE: | 3385 case AccessibilityNodeData::ROLE_MATTE: |
| 3370 case WebAccessibility::ROLE_RULER_MARKER: | 3386 case AccessibilityNodeData::ROLE_RULER_MARKER: |
| 3371 case WebAccessibility::ROLE_SHEET: | 3387 case AccessibilityNodeData::ROLE_SHEET: |
| 3372 case WebAccessibility::ROLE_SLIDER_THUMB: | 3388 case AccessibilityNodeData::ROLE_SLIDER_THUMB: |
| 3373 case WebAccessibility::ROLE_SYSTEM_WIDE: | 3389 case AccessibilityNodeData::ROLE_SYSTEM_WIDE: |
| 3374 case WebAccessibility::ROLE_VALUE_INDICATOR: | 3390 case AccessibilityNodeData::ROLE_VALUE_INDICATOR: |
| 3375 default: | 3391 default: |
| 3376 ia_role_ = ROLE_SYSTEM_CLIENT; | 3392 ia_role_ = ROLE_SYSTEM_CLIENT; |
| 3377 break; | 3393 break; |
| 3378 } | 3394 } |
| 3379 | 3395 |
| 3380 // Compute the final value of READONLY for MSAA. | 3396 // Compute the final value of READONLY for MSAA. |
| 3381 // | 3397 // |
| 3382 // We always set the READONLY state for elements that have the | 3398 // We always set the READONLY state for elements that have the |
| 3383 // aria-readonly attribute and for a few roles (in the switch above). | 3399 // aria-readonly attribute and for a few roles (in the switch above). |
| 3384 // We clear the READONLY state on focusable controls and on a document. | 3400 // We clear the READONLY state on focusable controls and on a document. |
| 3385 // Everything else, the majority of objects, do not have this state set. | 3401 // Everything else, the majority of objects, do not have this state set. |
| 3386 if (HasState(WebAccessibility::STATE_FOCUSABLE) && | 3402 if (HasState(AccessibilityNodeData::STATE_FOCUSABLE) && |
| 3387 ia_role_ != ROLE_SYSTEM_DOCUMENT) { | 3403 ia_role_ != ROLE_SYSTEM_DOCUMENT) { |
| 3388 ia_state_ &= ~(STATE_SYSTEM_READONLY); | 3404 ia_state_ &= ~(STATE_SYSTEM_READONLY); |
| 3389 } | 3405 } |
| 3390 if (!HasState(WebAccessibility::STATE_READONLY)) | 3406 if (!HasState(AccessibilityNodeData::STATE_READONLY)) |
| 3391 ia_state_ &= ~(STATE_SYSTEM_READONLY); | 3407 ia_state_ &= ~(STATE_SYSTEM_READONLY); |
| 3392 bool aria_readonly = false; | 3408 bool aria_readonly = false; |
| 3393 GetBoolAttribute(WebAccessibility::ATTR_ARIA_READONLY, &aria_readonly); | 3409 GetBoolAttribute(AccessibilityNodeData::ATTR_ARIA_READONLY, &aria_readonly); |
| 3394 if (aria_readonly) | 3410 if (aria_readonly) |
| 3395 ia_state_ |= STATE_SYSTEM_READONLY; | 3411 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3396 | 3412 |
| 3397 // The role should always be set. | 3413 // The role should always be set. |
| 3398 DCHECK(!role_name_.empty() || ia_role_); | 3414 DCHECK(!role_name_.empty() || ia_role_); |
| 3399 | 3415 |
| 3400 // If we didn't explicitly set the IAccessible2 role, make it the same | 3416 // If we didn't explicitly set the IAccessible2 role, make it the same |
| 3401 // as the MSAA role. | 3417 // as the MSAA role. |
| 3402 if (!ia2_role_) | 3418 if (!ia2_role_) |
| 3403 ia2_role_ = ia_role_; | 3419 ia2_role_ = ia_role_; |
| 3404 } | 3420 } |
| OLD | NEW |