OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/accessibility/browser_accessibility_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_win.h" |
6 | 6 |
7 #include <UIAutomationClient.h> | 7 #include <UIAutomationClient.h> |
8 #include <UIAutomationCoreApi.h> | 8 #include <UIAutomationCoreApi.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 return E_FAIL; | 422 return E_FAIL; |
423 | 423 |
424 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 424 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
425 if (!target) | 425 if (!target) |
426 return E_INVALIDARG; | 426 return E_INVALIDARG; |
427 | 427 |
428 // Return an error if it's not clickable. | 428 // Return an error if it's not clickable. |
429 if (!target->HasIntAttribute(ui::AX_ATTR_ACTION)) | 429 if (!target->HasIntAttribute(ui::AX_ATTR_ACTION)) |
430 return DISP_E_MEMBERNOTFOUND; | 430 return DISP_E_MEMBERNOTFOUND; |
431 | 431 |
432 manager()->DoDefaultAction(*target); | 432 manager_->DoDefaultAction(*target); |
433 return S_OK; | 433 return S_OK; |
434 } | 434 } |
435 | 435 |
436 STDMETHODIMP BrowserAccessibilityWin::accHitTest(LONG x_left, | 436 STDMETHODIMP BrowserAccessibilityWin::accHitTest(LONG x_left, |
437 LONG y_top, | 437 LONG y_top, |
438 VARIANT* child) { | 438 VARIANT* child) { |
439 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_HIT_TEST); | 439 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_HIT_TEST); |
440 if (!instance_active()) | 440 if (!instance_active()) |
441 return E_FAIL; | 441 return E_FAIL; |
442 | 442 |
443 if (!child) | 443 if (!child) |
444 return E_INVALIDARG; | 444 return E_INVALIDARG; |
445 | 445 |
446 gfx::Point point(x_left, y_top); | 446 gfx::Point point(x_left, y_top); |
447 if (!GetScreenBoundsRect().Contains(point)) { | 447 if (!GetScreenBoundsRect().Contains(point)) { |
448 // Return S_FALSE and VT_EMPTY when outside the object's boundaries. | 448 // Return S_FALSE and VT_EMPTY when outside the object's boundaries. |
449 child->vt = VT_EMPTY; | 449 child->vt = VT_EMPTY; |
450 return S_FALSE; | 450 return S_FALSE; |
451 } | 451 } |
452 | 452 |
453 BrowserAccessibility* result = manager()->CachingAsyncHitTest(point); | 453 BrowserAccessibility* result = manager_->CachingAsyncHitTest(point); |
454 if (result == this) { | 454 if (result == this) { |
455 // Point is within this object. | 455 // Point is within this object. |
456 child->vt = VT_I4; | 456 child->vt = VT_I4; |
457 child->lVal = CHILDID_SELF; | 457 child->lVal = CHILDID_SELF; |
458 } else { | 458 } else { |
459 child->vt = VT_DISPATCH; | 459 child->vt = VT_DISPATCH; |
460 child->pdispVal = ToBrowserAccessibilityWin(result)->NewReference(); | 460 child->pdispVal = ToBrowserAccessibilityWin(result)->NewReference(); |
461 } | 461 } |
462 return S_OK; | 462 return S_OK; |
463 } | 463 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 } | 609 } |
610 | 610 |
611 STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) { | 611 STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) { |
612 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_FOCUS); | 612 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_FOCUS); |
613 if (!instance_active()) | 613 if (!instance_active()) |
614 return E_FAIL; | 614 return E_FAIL; |
615 | 615 |
616 if (!focus_child) | 616 if (!focus_child) |
617 return E_INVALIDARG; | 617 return E_INVALIDARG; |
618 | 618 |
619 BrowserAccessibilityWin* focus = static_cast<BrowserAccessibilityWin*>( | 619 BrowserAccessibilityWin* focus = |
620 manager()->GetFocus()); | 620 static_cast<BrowserAccessibilityWin*>(manager_->GetFocus()); |
621 if (focus == this) { | 621 if (focus == this) { |
622 focus_child->vt = VT_I4; | 622 focus_child->vt = VT_I4; |
623 focus_child->lVal = CHILDID_SELF; | 623 focus_child->lVal = CHILDID_SELF; |
624 } else if (focus == NULL) { | 624 } else if (focus == NULL) { |
625 focus_child->vt = VT_EMPTY; | 625 focus_child->vt = VT_EMPTY; |
626 } else { | 626 } else { |
627 focus_child->vt = VT_DISPATCH; | 627 focus_child->vt = VT_DISPATCH; |
628 focus_child->pdispVal = focus->NewReference(); | 628 focus_child->pdispVal = focus->NewReference(); |
629 } | 629 } |
630 | 630 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 return E_FAIL; | 695 return E_FAIL; |
696 | 696 |
697 if (!disp_parent) | 697 if (!disp_parent) |
698 return E_INVALIDARG; | 698 return E_INVALIDARG; |
699 | 699 |
700 IAccessible* parent_obj = ToBrowserAccessibilityWin(GetParent()); | 700 IAccessible* parent_obj = ToBrowserAccessibilityWin(GetParent()); |
701 if (parent_obj == NULL) { | 701 if (parent_obj == NULL) { |
702 // This happens if we're the root of the tree; | 702 // This happens if we're the root of the tree; |
703 // return the IAccessible for the window. | 703 // return the IAccessible for the window. |
704 parent_obj = | 704 parent_obj = |
705 manager()->ToBrowserAccessibilityManagerWin()->GetParentIAccessible(); | 705 manager_->ToBrowserAccessibilityManagerWin()->GetParentIAccessible(); |
706 // |parent| can only be NULL if the manager was created before the parent | 706 // |parent| can only be NULL if the manager was created before the parent |
707 // IAccessible was known and it wasn't subsequently set before a client | 707 // IAccessible was known and it wasn't subsequently set before a client |
708 // requested it. This has been fixed. |parent| may also be NULL during | 708 // requested it. This has been fixed. |parent| may also be NULL during |
709 // destruction. Possible cases where this could occur include tabs being | 709 // destruction. Possible cases where this could occur include tabs being |
710 // dragged to a new window, etc. | 710 // dragged to a new window, etc. |
711 if (!parent_obj) { | 711 if (!parent_obj) { |
712 DVLOG(1) << "In Function: " << __func__ | 712 DVLOG(1) << "In Function: " << __func__ |
713 << ". Parent IAccessible interface is NULL. Returning failure"; | 713 << ". Parent IAccessible interface is NULL. Returning failure"; |
714 return E_FAIL; | 714 return E_FAIL; |
715 } | 715 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 | 750 |
751 if (!state) | 751 if (!state) |
752 return E_INVALIDARG; | 752 return E_INVALIDARG; |
753 | 753 |
754 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 754 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
755 if (!target) | 755 if (!target) |
756 return E_INVALIDARG; | 756 return E_INVALIDARG; |
757 | 757 |
758 state->vt = VT_I4; | 758 state->vt = VT_I4; |
759 state->lVal = target->ia_state(); | 759 state->lVal = target->ia_state(); |
760 if (manager()->GetFocus() == this) | 760 if (manager_->GetFocus() == this) |
761 state->lVal |= STATE_SYSTEM_FOCUSED; | 761 state->lVal |= STATE_SYSTEM_FOCUSED; |
762 | 762 |
763 return S_OK; | 763 return S_OK; |
764 } | 764 } |
765 | 765 |
766 STDMETHODIMP BrowserAccessibilityWin::get_accValue(VARIANT var_id, | 766 STDMETHODIMP BrowserAccessibilityWin::get_accValue(VARIANT var_id, |
767 BSTR* value) { | 767 BSTR* value) { |
768 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_VALUE); | 768 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_VALUE); |
769 if (!instance_active()) | 769 if (!instance_active()) |
770 return E_FAIL; | 770 return E_FAIL; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 return S_OK; | 862 return S_OK; |
863 } | 863 } |
864 | 864 |
865 STDMETHODIMP BrowserAccessibilityWin::accSelect( | 865 STDMETHODIMP BrowserAccessibilityWin::accSelect( |
866 LONG flags_sel, VARIANT var_id) { | 866 LONG flags_sel, VARIANT var_id) { |
867 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_SELECT); | 867 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_SELECT); |
868 if (!instance_active()) | 868 if (!instance_active()) |
869 return E_FAIL; | 869 return E_FAIL; |
870 | 870 |
871 if (flags_sel & SELFLAG_TAKEFOCUS) { | 871 if (flags_sel & SELFLAG_TAKEFOCUS) { |
872 manager()->SetFocus(*this); | 872 manager_->SetFocus(*this); |
873 return S_OK; | 873 return S_OK; |
874 } | 874 } |
875 | 875 |
876 return S_FALSE; | 876 return S_FALSE; |
877 } | 877 } |
878 | 878 |
879 STDMETHODIMP | 879 STDMETHODIMP |
880 BrowserAccessibilityWin::put_accName(VARIANT var_id, BSTR put_name) { | 880 BrowserAccessibilityWin::put_accName(VARIANT var_id, BSTR put_name) { |
881 return E_NOTIMPL; | 881 return E_NOTIMPL; |
882 } | 882 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 | 951 |
952 STDMETHODIMP BrowserAccessibilityWin::get_windowHandle(HWND* window_handle) { | 952 STDMETHODIMP BrowserAccessibilityWin::get_windowHandle(HWND* window_handle) { |
953 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_WINDOW_HANDLE); | 953 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_WINDOW_HANDLE); |
954 if (!instance_active()) | 954 if (!instance_active()) |
955 return E_FAIL; | 955 return E_FAIL; |
956 | 956 |
957 if (!window_handle) | 957 if (!window_handle) |
958 return E_INVALIDARG; | 958 return E_INVALIDARG; |
959 | 959 |
960 *window_handle = | 960 *window_handle = |
961 manager()->ToBrowserAccessibilityManagerWin()->GetParentHWND(); | 961 manager_->ToBrowserAccessibilityManagerWin()->GetParentHWND(); |
962 if (!*window_handle) | 962 if (!*window_handle) |
963 return E_FAIL; | 963 return E_FAIL; |
964 | 964 |
965 return S_OK; | 965 return S_OK; |
966 } | 966 } |
967 | 967 |
968 STDMETHODIMP BrowserAccessibilityWin::get_indexInParent(LONG* index_in_parent) { | 968 STDMETHODIMP BrowserAccessibilityWin::get_indexInParent(LONG* index_in_parent) { |
969 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_INDEX_IN_PARENT); | 969 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_INDEX_IN_PARENT); |
970 if (!instance_active()) | 970 if (!instance_active()) |
971 return E_FAIL; | 971 return E_FAIL; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 } | 1037 } |
1038 | 1038 |
1039 STDMETHODIMP BrowserAccessibilityWin::scrollTo(IA2ScrollType scroll_type) { | 1039 STDMETHODIMP BrowserAccessibilityWin::scrollTo(IA2ScrollType scroll_type) { |
1040 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IA2_SCROLL_TO); | 1040 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IA2_SCROLL_TO); |
1041 if (!instance_active()) | 1041 if (!instance_active()) |
1042 return E_FAIL; | 1042 return E_FAIL; |
1043 | 1043 |
1044 gfx::Rect r = GetFrameBoundsRect(); | 1044 gfx::Rect r = GetFrameBoundsRect(); |
1045 switch(scroll_type) { | 1045 switch(scroll_type) { |
1046 case IA2_SCROLL_TYPE_TOP_LEFT: | 1046 case IA2_SCROLL_TYPE_TOP_LEFT: |
1047 manager()->ScrollToMakeVisible(*this, gfx::Rect(r.x(), r.y(), 0, 0)); | 1047 manager_->ScrollToMakeVisible(*this, gfx::Rect(r.x(), r.y(), 0, 0)); |
1048 break; | 1048 break; |
1049 case IA2_SCROLL_TYPE_BOTTOM_RIGHT: | 1049 case IA2_SCROLL_TYPE_BOTTOM_RIGHT: |
1050 manager()->ScrollToMakeVisible( | 1050 manager_->ScrollToMakeVisible(*this, |
1051 *this, gfx::Rect(r.right(), r.bottom(), 0, 0)); | 1051 gfx::Rect(r.right(), r.bottom(), 0, 0)); |
1052 break; | 1052 break; |
1053 case IA2_SCROLL_TYPE_TOP_EDGE: | 1053 case IA2_SCROLL_TYPE_TOP_EDGE: |
1054 manager()->ScrollToMakeVisible( | 1054 manager_->ScrollToMakeVisible(*this, |
1055 *this, gfx::Rect(r.x(), r.y(), r.width(), 0)); | 1055 gfx::Rect(r.x(), r.y(), r.width(), 0)); |
1056 break; | 1056 break; |
1057 case IA2_SCROLL_TYPE_BOTTOM_EDGE: | 1057 case IA2_SCROLL_TYPE_BOTTOM_EDGE: |
1058 manager()->ScrollToMakeVisible( | 1058 manager_->ScrollToMakeVisible(*this, |
1059 *this, gfx::Rect(r.x(), r.bottom(), r.width(), 0)); | 1059 gfx::Rect(r.x(), r.bottom(), r.width(), 0)); |
1060 break; | 1060 break; |
1061 case IA2_SCROLL_TYPE_LEFT_EDGE: | 1061 case IA2_SCROLL_TYPE_LEFT_EDGE: |
1062 manager()->ScrollToMakeVisible( | 1062 manager_->ScrollToMakeVisible(*this, |
1063 *this, gfx::Rect(r.x(), r.y(), 0, r.height())); | 1063 gfx::Rect(r.x(), r.y(), 0, r.height())); |
1064 break; | 1064 break; |
1065 case IA2_SCROLL_TYPE_RIGHT_EDGE: | 1065 case IA2_SCROLL_TYPE_RIGHT_EDGE: |
1066 manager()->ScrollToMakeVisible( | 1066 manager_->ScrollToMakeVisible(*this, |
1067 *this, gfx::Rect(r.right(), r.y(), 0, r.height())); | 1067 gfx::Rect(r.right(), r.y(), 0, r.height())); |
1068 break; | 1068 break; |
1069 case IA2_SCROLL_TYPE_ANYWHERE: | 1069 case IA2_SCROLL_TYPE_ANYWHERE: |
1070 default: | 1070 default: |
1071 manager()->ScrollToMakeVisible(*this, r); | 1071 manager_->ScrollToMakeVisible(*this, r); |
1072 break; | 1072 break; |
1073 } | 1073 } |
1074 | 1074 |
1075 return S_OK; | 1075 return S_OK; |
1076 } | 1076 } |
1077 | 1077 |
1078 STDMETHODIMP BrowserAccessibilityWin::scrollToPoint( | 1078 STDMETHODIMP BrowserAccessibilityWin::scrollToPoint( |
1079 IA2CoordinateType coordinate_type, | 1079 IA2CoordinateType coordinate_type, |
1080 LONG x, | 1080 LONG x, |
1081 LONG y) { | 1081 LONG y) { |
1082 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SCROLL_TO_POINT); | 1082 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SCROLL_TO_POINT); |
1083 if (!instance_active()) | 1083 if (!instance_active()) |
1084 return E_FAIL; | 1084 return E_FAIL; |
1085 | 1085 |
1086 gfx::Point scroll_to(x, y); | 1086 gfx::Point scroll_to(x, y); |
1087 | 1087 |
1088 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { | 1088 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { |
1089 scroll_to -= manager()->GetViewBounds().OffsetFromOrigin(); | 1089 scroll_to -= manager_->GetViewBounds().OffsetFromOrigin(); |
1090 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { | 1090 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { |
1091 if (GetParent()) | 1091 if (GetParent()) |
1092 scroll_to += GetParent()->GetFrameBoundsRect().OffsetFromOrigin(); | 1092 scroll_to += GetParent()->GetFrameBoundsRect().OffsetFromOrigin(); |
1093 } else { | 1093 } else { |
1094 return E_INVALIDARG; | 1094 return E_INVALIDARG; |
1095 } | 1095 } |
1096 | 1096 |
1097 manager()->ScrollToPoint(*this, scroll_to); | 1097 manager_->ScrollToPoint(*this, scroll_to); |
1098 | 1098 |
1099 return S_OK; | 1099 return S_OK; |
1100 } | 1100 } |
1101 | 1101 |
1102 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( | 1102 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( |
1103 LONG* group_level, | 1103 LONG* group_level, |
1104 LONG* similar_items_in_group, | 1104 LONG* similar_items_in_group, |
1105 LONG* position_in_group) { | 1105 LONG* position_in_group) { |
1106 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_GROUP_POSITION); | 1106 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_GROUP_POSITION); |
1107 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 1107 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2049 BrowserAccessibilityWin* cell = GetFromID(cell_id); | 2049 BrowserAccessibilityWin* cell = GetFromID(cell_id); |
2050 if (cell && cell->GetRole() == ui::AX_ROLE_COLUMN_HEADER) | 2050 if (cell && cell->GetRole() == ui::AX_ROLE_COLUMN_HEADER) |
2051 (*n_column_header_cells)++; | 2051 (*n_column_header_cells)++; |
2052 } | 2052 } |
2053 | 2053 |
2054 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( | 2054 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( |
2055 (*n_column_header_cells) * sizeof(cell_accessibles[0]))); | 2055 (*n_column_header_cells) * sizeof(cell_accessibles[0]))); |
2056 int index = 0; | 2056 int index = 0; |
2057 for (int i = 0; i < rows; ++i) { | 2057 for (int i = 0; i < rows; ++i) { |
2058 int cell_id = cell_ids[i * columns + column]; | 2058 int cell_id = cell_ids[i * columns + column]; |
2059 BrowserAccessibility* cell = manager()->GetFromID(cell_id); | 2059 BrowserAccessibility* cell = manager_->GetFromID(cell_id); |
2060 if (cell && cell->GetRole() == ui::AX_ROLE_COLUMN_HEADER) { | 2060 if (cell && cell->GetRole() == ui::AX_ROLE_COLUMN_HEADER) { |
2061 (*cell_accessibles)[index] = static_cast<IAccessible*>( | 2061 (*cell_accessibles)[index] = static_cast<IAccessible*>( |
2062 ToBrowserAccessibilityWin(cell)->NewReference()); | 2062 ToBrowserAccessibilityWin(cell)->NewReference()); |
2063 ++index; | 2063 ++index; |
2064 } | 2064 } |
2065 } | 2065 } |
2066 | 2066 |
2067 return S_OK; | 2067 return S_OK; |
2068 } | 2068 } |
2069 | 2069 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 return S_FALSE; | 2142 return S_FALSE; |
2143 } | 2143 } |
2144 if (columns <= 0 || rows <= 0 || row < 0 || row >= rows) | 2144 if (columns <= 0 || rows <= 0 || row < 0 || row >= rows) |
2145 return S_FALSE; | 2145 return S_FALSE; |
2146 | 2146 |
2147 const std::vector<int32_t>& cell_ids = | 2147 const std::vector<int32_t>& cell_ids = |
2148 table->GetIntListAttribute(ui::AX_ATTR_CELL_IDS); | 2148 table->GetIntListAttribute(ui::AX_ATTR_CELL_IDS); |
2149 | 2149 |
2150 for (int i = 0; i < columns; ++i) { | 2150 for (int i = 0; i < columns; ++i) { |
2151 int cell_id = cell_ids[row * columns + i]; | 2151 int cell_id = cell_ids[row * columns + i]; |
2152 BrowserAccessibility* cell = manager()->GetFromID(cell_id); | 2152 BrowserAccessibility* cell = manager_->GetFromID(cell_id); |
2153 if (cell && cell->GetRole() == ui::AX_ROLE_ROW_HEADER) | 2153 if (cell && cell->GetRole() == ui::AX_ROLE_ROW_HEADER) |
2154 (*n_row_header_cells)++; | 2154 (*n_row_header_cells)++; |
2155 } | 2155 } |
2156 | 2156 |
2157 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( | 2157 *cell_accessibles = static_cast<IUnknown**>(CoTaskMemAlloc( |
2158 (*n_row_header_cells) * sizeof(cell_accessibles[0]))); | 2158 (*n_row_header_cells) * sizeof(cell_accessibles[0]))); |
2159 int index = 0; | 2159 int index = 0; |
2160 for (int i = 0; i < columns; ++i) { | 2160 for (int i = 0; i < columns; ++i) { |
2161 int cell_id = cell_ids[row * columns + i]; | 2161 int cell_id = cell_ids[row * columns + i]; |
2162 BrowserAccessibility* cell = manager()->GetFromID(cell_id); | 2162 BrowserAccessibility* cell = manager_->GetFromID(cell_id); |
2163 if (cell && cell->GetRole() == ui::AX_ROLE_ROW_HEADER) { | 2163 if (cell && cell->GetRole() == ui::AX_ROLE_ROW_HEADER) { |
2164 (*cell_accessibles)[index] = static_cast<IAccessible*>( | 2164 (*cell_accessibles)[index] = static_cast<IAccessible*>( |
2165 ToBrowserAccessibilityWin(cell)->NewReference()); | 2165 ToBrowserAccessibilityWin(cell)->NewReference()); |
2166 ++index; | 2166 ++index; |
2167 } | 2167 } |
2168 } | 2168 } |
2169 | 2169 |
2170 return S_OK; | 2170 return S_OK; |
2171 } | 2171 } |
2172 | 2172 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2320 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CHARACTER_EXTENTS); | 2320 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CHARACTER_EXTENTS); |
2321 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER | | 2321 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER | |
2322 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES); | 2322 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES); |
2323 if (!instance_active()) | 2323 if (!instance_active()) |
2324 return E_FAIL; | 2324 return E_FAIL; |
2325 | 2325 |
2326 if (!out_x || !out_y || !out_width || !out_height) | 2326 if (!out_x || !out_y || !out_width || !out_height) |
2327 return E_INVALIDARG; | 2327 return E_INVALIDARG; |
2328 | 2328 |
2329 const base::string16& text_str = GetText(); | 2329 const base::string16& text_str = GetText(); |
2330 HandleSpecialTextOffset(text_str, &offset); | 2330 HandleSpecialTextOffset(&offset); |
2331 | |
2332 if (offset < 0 || offset > static_cast<LONG>(text_str.size())) | 2331 if (offset < 0 || offset > static_cast<LONG>(text_str.size())) |
2333 return E_INVALIDARG; | 2332 return E_INVALIDARG; |
2334 | 2333 |
2335 gfx::Rect character_bounds; | 2334 gfx::Rect character_bounds; |
2336 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { | 2335 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { |
2337 character_bounds = GetScreenBoundsForRange(offset, 1); | 2336 character_bounds = GetScreenBoundsForRange(offset, 1); |
2338 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { | 2337 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { |
2339 character_bounds = GetPageBoundsForRange(offset, 1); | 2338 character_bounds = GetPageBoundsForRange(offset, 1); |
2340 if (GetParent()) | 2339 if (GetParent()) |
2341 character_bounds -= GetParent()->GetPageBoundsRect().OffsetFromOrigin(); | 2340 character_bounds -= GetParent()->GetPageBoundsRect().OffsetFromOrigin(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 LONG* start_offset, | 2374 LONG* start_offset, |
2376 LONG* end_offset) { | 2375 LONG* end_offset) { |
2377 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTION); | 2376 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTION); |
2378 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2377 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
2379 if (!instance_active()) | 2378 if (!instance_active()) |
2380 return E_FAIL; | 2379 return E_FAIL; |
2381 | 2380 |
2382 if (!start_offset || !end_offset || selection_index != 0) | 2381 if (!start_offset || !end_offset || selection_index != 0) |
2383 return E_INVALIDARG; | 2382 return E_INVALIDARG; |
2384 | 2383 |
2385 LONG n_selections = 0; | |
2386 if (FAILED(get_nSelections(&n_selections)) || n_selections < 1) | |
2387 return E_INVALIDARG; | |
2388 | |
2389 *start_offset = 0; | 2384 *start_offset = 0; |
2390 *end_offset = 0; | 2385 *end_offset = 0; |
2391 int selection_start, selection_end; | 2386 int selection_start, selection_end; |
2392 GetSelectionOffsets(&selection_start, &selection_end); | 2387 GetSelectionOffsets(&selection_start, &selection_end); |
2393 if (selection_start >= 0 && selection_end >= 0) { | 2388 if (selection_start >= 0 && selection_end >= 0 && |
| 2389 selection_start != selection_end) { |
2394 // We should ignore the direction of the selection when exposing start and | 2390 // We should ignore the direction of the selection when exposing start and |
2395 // end offsets. According to the IA2 Spec the end offset is always increased | 2391 // end offsets. According to the IA2 Spec the end offset is always increased |
2396 // by one past the end of the selection. This wouldn't make sense if | 2392 // by one past the end of the selection. This wouldn't make sense if |
2397 // end < start. | 2393 // end < start. |
2398 if (selection_end < selection_start) | 2394 if (selection_end < selection_start) |
2399 std::swap(selection_start, selection_end); | 2395 std::swap(selection_start, selection_end); |
2400 | 2396 |
2401 *start_offset = selection_start; | 2397 *start_offset = selection_start; |
2402 *end_offset = selection_end; | 2398 *end_offset = selection_end; |
| 2399 return S_OK; |
2403 } | 2400 } |
2404 | 2401 |
2405 return S_OK; | 2402 return E_INVALIDARG; |
2406 } | 2403 } |
2407 | 2404 |
2408 STDMETHODIMP BrowserAccessibilityWin::get_text(LONG start_offset, | 2405 STDMETHODIMP BrowserAccessibilityWin::get_text(LONG start_offset, |
2409 LONG end_offset, | 2406 LONG end_offset, |
2410 BSTR* text) { | 2407 BSTR* text) { |
2411 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT); | 2408 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT); |
2412 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2409 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
2413 if (!instance_active()) | 2410 if (!instance_active()) |
2414 return E_FAIL; | 2411 return E_FAIL; |
2415 | 2412 |
2416 if (!text) | 2413 if (!text) |
2417 return E_INVALIDARG; | 2414 return E_INVALIDARG; |
2418 | 2415 |
2419 const base::string16& text_str = GetText(); | 2416 const base::string16& text_str = GetText(); |
2420 HandleSpecialTextOffset(text_str, &start_offset); | 2417 HandleSpecialTextOffset(&start_offset); |
2421 HandleSpecialTextOffset(text_str, &end_offset); | 2418 HandleSpecialTextOffset(&end_offset); |
2422 | 2419 |
2423 // The spec allows the arguments to be reversed. | 2420 // The spec allows the arguments to be reversed. |
2424 if (start_offset > end_offset) { | 2421 if (start_offset > end_offset) { |
2425 LONG tmp = start_offset; | 2422 LONG tmp = start_offset; |
2426 start_offset = end_offset; | 2423 start_offset = end_offset; |
2427 end_offset = tmp; | 2424 end_offset = tmp; |
2428 } | 2425 } |
2429 | 2426 |
2430 // The spec does not allow the start or end offsets to be out or range; | 2427 // The spec does not allow the start or end offsets to be out or range; |
2431 // we must return an error if so. | 2428 // we must return an error if so. |
(...skipping 23 matching lines...) Expand all Loading... |
2455 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT_AT_OFFSET); | 2452 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT_AT_OFFSET); |
2456 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER | | 2453 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER | |
2457 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES); | 2454 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES); |
2458 if (!instance_active()) | 2455 if (!instance_active()) |
2459 return E_FAIL; | 2456 return E_FAIL; |
2460 | 2457 |
2461 if (!start_offset || !end_offset || !text) | 2458 if (!start_offset || !end_offset || !text) |
2462 return E_INVALIDARG; | 2459 return E_INVALIDARG; |
2463 | 2460 |
2464 const base::string16& text_str = GetText(); | 2461 const base::string16& text_str = GetText(); |
2465 HandleSpecialTextOffset(text_str, &offset); | 2462 HandleSpecialTextOffset(&offset); |
2466 if (offset < 0) | 2463 if (offset < 0) |
2467 return E_INVALIDARG; | 2464 return E_INVALIDARG; |
2468 | 2465 |
2469 LONG text_len = text_str.length(); | 2466 LONG text_len = text_str.length(); |
2470 if (offset > text_len) | 2467 if (offset > text_len) |
2471 return E_INVALIDARG; | 2468 return E_INVALIDARG; |
2472 | 2469 |
2473 // The IAccessible2 spec says we don't have to implement the "sentence" | 2470 // The IAccessible2 spec says we don't have to implement the "sentence" |
2474 // boundary type, we can just let the screenreader handle it. | 2471 // boundary type, we can just let the screenreader handle it. |
2475 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { | 2472 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2666 return scrollToPoint(coordinate_type, x, y); | 2663 return scrollToPoint(coordinate_type, x, y); |
2667 } | 2664 } |
2668 | 2665 |
2669 STDMETHODIMP BrowserAccessibilityWin::addSelection(LONG start_offset, | 2666 STDMETHODIMP BrowserAccessibilityWin::addSelection(LONG start_offset, |
2670 LONG end_offset) { | 2667 LONG end_offset) { |
2671 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ADD_SELECTION); | 2668 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ADD_SELECTION); |
2672 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2669 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
2673 if (!instance_active()) | 2670 if (!instance_active()) |
2674 return E_FAIL; | 2671 return E_FAIL; |
2675 | 2672 |
2676 const base::string16& text_str = GetText(); | 2673 // We only support one selection. |
2677 HandleSpecialTextOffset(text_str, &start_offset); | 2674 SetIA2HypertextSelection(start_offset, end_offset); |
2678 HandleSpecialTextOffset(text_str, &end_offset); | |
2679 | |
2680 manager()->SetTextSelection(*this, start_offset, end_offset); | |
2681 return S_OK; | 2675 return S_OK; |
2682 } | 2676 } |
2683 | 2677 |
2684 STDMETHODIMP BrowserAccessibilityWin::removeSelection(LONG selection_index) { | 2678 STDMETHODIMP BrowserAccessibilityWin::removeSelection(LONG selection_index) { |
2685 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_REMOVE_SELECTION); | 2679 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_REMOVE_SELECTION); |
2686 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2680 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
2687 if (!instance_active()) | 2681 if (!instance_active()) |
2688 return E_FAIL; | 2682 return E_FAIL; |
2689 | 2683 |
2690 if (selection_index != 0) | 2684 if (selection_index != 0) |
2691 return E_INVALIDARG; | 2685 return E_INVALIDARG; |
2692 | 2686 |
2693 manager()->SetTextSelection(*this, 0, 0); | 2687 // Simply collapse the selection to the position of the caret if a caret is |
| 2688 // visible, otherwise set the selection to 0. |
| 2689 LONG caret_offset = 0; |
| 2690 int selection_start, selection_end; |
| 2691 GetSelectionOffsets(&selection_start, &selection_end); |
| 2692 if (HasCaret() && selection_end >= 0) |
| 2693 caret_offset = selection_end; |
| 2694 SetIA2HypertextSelection(caret_offset, caret_offset); |
2694 return S_OK; | 2695 return S_OK; |
2695 } | 2696 } |
2696 | 2697 |
2697 STDMETHODIMP BrowserAccessibilityWin::setCaretOffset(LONG offset) { | 2698 STDMETHODIMP BrowserAccessibilityWin::setCaretOffset(LONG offset) { |
2698 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_CARET_OFFSET); | 2699 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_CARET_OFFSET); |
2699 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2700 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
2700 if (!instance_active()) | 2701 if (!instance_active()) |
2701 return E_FAIL; | 2702 return E_FAIL; |
2702 | 2703 SetIA2HypertextSelection(offset, offset); |
2703 const base::string16& text_str = GetText(); | |
2704 HandleSpecialTextOffset(text_str, &offset); | |
2705 manager()->SetTextSelection(*this, offset, offset); | |
2706 return S_OK; | 2704 return S_OK; |
2707 } | 2705 } |
2708 | 2706 |
2709 STDMETHODIMP BrowserAccessibilityWin::setSelection(LONG selection_index, | 2707 STDMETHODIMP BrowserAccessibilityWin::setSelection(LONG selection_index, |
2710 LONG start_offset, | 2708 LONG start_offset, |
2711 LONG end_offset) { | 2709 LONG end_offset) { |
2712 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_SELECTION); | 2710 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_SELECTION); |
2713 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2711 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
2714 if (!instance_active()) | 2712 if (!instance_active()) |
2715 return E_FAIL; | 2713 return E_FAIL; |
2716 | |
2717 if (selection_index != 0) | 2714 if (selection_index != 0) |
2718 return E_INVALIDARG; | 2715 return E_INVALIDARG; |
2719 | 2716 SetIA2HypertextSelection(start_offset, end_offset); |
2720 const base::string16& text_str = GetText(); | |
2721 HandleSpecialTextOffset(text_str, &start_offset); | |
2722 HandleSpecialTextOffset(text_str, &end_offset); | |
2723 | |
2724 manager()->SetTextSelection(*this, start_offset, end_offset); | |
2725 return S_OK; | 2717 return S_OK; |
2726 } | 2718 } |
2727 | 2719 |
2728 STDMETHODIMP BrowserAccessibilityWin::get_attributes(LONG offset, | 2720 STDMETHODIMP BrowserAccessibilityWin::get_attributes(LONG offset, |
2729 LONG* start_offset, | 2721 LONG* start_offset, |
2730 LONG* end_offset, | 2722 LONG* end_offset, |
2731 BSTR* text_attributes) { | 2723 BSTR* text_attributes) { |
2732 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IATEXT_GET_ATTRIBUTES); | 2724 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IATEXT_GET_ATTRIBUTES); |
2733 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2725 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
2734 if (!start_offset || !end_offset || !text_attributes) | 2726 if (!start_offset || !end_offset || !text_attributes) |
2735 return E_INVALIDARG; | 2727 return E_INVALIDARG; |
2736 | 2728 |
2737 *start_offset = *end_offset = 0; | 2729 *start_offset = *end_offset = 0; |
2738 *text_attributes = nullptr; | 2730 *text_attributes = nullptr; |
2739 if (!instance_active()) | 2731 if (!instance_active()) |
2740 return E_FAIL; | 2732 return E_FAIL; |
2741 | 2733 |
2742 const base::string16& text = GetText(); | 2734 const base::string16 text = GetText(); |
2743 HandleSpecialTextOffset(text, &offset); | 2735 HandleSpecialTextOffset(&offset); |
2744 if (offset < 0 || offset > static_cast<LONG>(text.size())) | 2736 if (offset < 0 || offset > static_cast<LONG>(text.size())) |
2745 return E_INVALIDARG; | 2737 return E_INVALIDARG; |
2746 | 2738 |
2747 ComputeStylesIfNeeded(); | 2739 ComputeStylesIfNeeded(); |
2748 *start_offset = FindStartOfStyle(offset, ui::BACKWARDS_DIRECTION); | 2740 *start_offset = FindStartOfStyle(offset, ui::BACKWARDS_DIRECTION); |
2749 *end_offset = FindStartOfStyle(offset, ui::FORWARDS_DIRECTION); | 2741 *end_offset = FindStartOfStyle(offset, ui::FORWARDS_DIRECTION); |
2750 | 2742 |
2751 base::string16 attributes_str; | 2743 base::string16 attributes_str; |
2752 const std::vector<base::string16>& attributes = | 2744 const std::vector<base::string16>& attributes = |
2753 offset_to_text_attributes().find(*start_offset)->second; | 2745 offset_to_text_attributes().find(*start_offset)->second; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2951 | 2943 |
2952 STDMETHODIMP BrowserAccessibilityWin::doAction(long action_index) { | 2944 STDMETHODIMP BrowserAccessibilityWin::doAction(long action_index) { |
2953 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_DO_ACTION); | 2945 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_DO_ACTION); |
2954 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2946 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
2955 if (!instance_active()) | 2947 if (!instance_active()) |
2956 return E_FAIL; | 2948 return E_FAIL; |
2957 | 2949 |
2958 if (!HasIntAttribute(ui::AX_ATTR_ACTION) || action_index != 0) | 2950 if (!HasIntAttribute(ui::AX_ATTR_ACTION) || action_index != 0) |
2959 return E_INVALIDARG; | 2951 return E_INVALIDARG; |
2960 | 2952 |
2961 manager()->DoDefaultAction(*this); | 2953 manager_->DoDefaultAction(*this); |
2962 return S_OK; | 2954 return S_OK; |
2963 } | 2955 } |
2964 | 2956 |
2965 STDMETHODIMP | 2957 STDMETHODIMP |
2966 BrowserAccessibilityWin::get_description(long action_index, BSTR* description) { | 2958 BrowserAccessibilityWin::get_description(long action_index, BSTR* description) { |
2967 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IAACTION_GET_DESCRIPTION); | 2959 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IAACTION_GET_DESCRIPTION); |
2968 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2960 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
2969 return E_NOTIMPL; | 2961 return E_NOTIMPL; |
2970 } | 2962 } |
2971 | 2963 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3113 // | 3105 // |
3114 | 3106 |
3115 STDMETHODIMP BrowserAccessibilityWin::get_URL(BSTR* url) { | 3107 STDMETHODIMP BrowserAccessibilityWin::get_URL(BSTR* url) { |
3116 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_URL); | 3108 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_URL); |
3117 if (!instance_active()) | 3109 if (!instance_active()) |
3118 return E_FAIL; | 3110 return E_FAIL; |
3119 | 3111 |
3120 if (!url) | 3112 if (!url) |
3121 return E_INVALIDARG; | 3113 return E_INVALIDARG; |
3122 | 3114 |
3123 if (this != manager()->GetRoot()) | 3115 if (this != manager_->GetRoot()) |
3124 return E_FAIL; | 3116 return E_FAIL; |
3125 | 3117 |
3126 std::string str = manager()->GetTreeData().url; | 3118 std::string str = manager_->GetTreeData().url; |
3127 if (str.empty()) | 3119 if (str.empty()) |
3128 return S_FALSE; | 3120 return S_FALSE; |
3129 | 3121 |
3130 *url = SysAllocString(base::UTF8ToUTF16(str).c_str()); | 3122 *url = SysAllocString(base::UTF8ToUTF16(str).c_str()); |
3131 DCHECK(*url); | 3123 DCHECK(*url); |
3132 | 3124 |
3133 return S_OK; | 3125 return S_OK; |
3134 } | 3126 } |
3135 | 3127 |
3136 STDMETHODIMP BrowserAccessibilityWin::get_title(BSTR* title) { | 3128 STDMETHODIMP BrowserAccessibilityWin::get_title(BSTR* title) { |
3137 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TITLE); | 3129 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TITLE); |
3138 if (!instance_active()) | 3130 if (!instance_active()) |
3139 return E_FAIL; | 3131 return E_FAIL; |
3140 | 3132 |
3141 if (!title) | 3133 if (!title) |
3142 return E_INVALIDARG; | 3134 return E_INVALIDARG; |
3143 | 3135 |
3144 std::string str = manager()->GetTreeData().title; | 3136 std::string str = manager_->GetTreeData().title; |
3145 if (str.empty()) | 3137 if (str.empty()) |
3146 return S_FALSE; | 3138 return S_FALSE; |
3147 | 3139 |
3148 *title = SysAllocString(base::UTF8ToUTF16(str).c_str()); | 3140 *title = SysAllocString(base::UTF8ToUTF16(str).c_str()); |
3149 DCHECK(*title); | 3141 DCHECK(*title); |
3150 | 3142 |
3151 return S_OK; | 3143 return S_OK; |
3152 } | 3144 } |
3153 | 3145 |
3154 STDMETHODIMP BrowserAccessibilityWin::get_mimeType(BSTR* mime_type) { | 3146 STDMETHODIMP BrowserAccessibilityWin::get_mimeType(BSTR* mime_type) { |
3155 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_MIME_TYPE); | 3147 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_MIME_TYPE); |
3156 if (!instance_active()) | 3148 if (!instance_active()) |
3157 return E_FAIL; | 3149 return E_FAIL; |
3158 | 3150 |
3159 if (!mime_type) | 3151 if (!mime_type) |
3160 return E_INVALIDARG; | 3152 return E_INVALIDARG; |
3161 | 3153 |
3162 std::string str = manager()->GetTreeData().mimetype; | 3154 std::string str = manager_->GetTreeData().mimetype; |
3163 if (str.empty()) | 3155 if (str.empty()) |
3164 return S_FALSE; | 3156 return S_FALSE; |
3165 | 3157 |
3166 *mime_type = SysAllocString(base::UTF8ToUTF16(str).c_str()); | 3158 *mime_type = SysAllocString(base::UTF8ToUTF16(str).c_str()); |
3167 DCHECK(*mime_type); | 3159 DCHECK(*mime_type); |
3168 | 3160 |
3169 return S_OK; | 3161 return S_OK; |
3170 } | 3162 } |
3171 | 3163 |
3172 STDMETHODIMP BrowserAccessibilityWin::get_docType(BSTR* doc_type) { | 3164 STDMETHODIMP BrowserAccessibilityWin::get_docType(BSTR* doc_type) { |
3173 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_DOC_TYPE); | 3165 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_DOC_TYPE); |
3174 if (!instance_active()) | 3166 if (!instance_active()) |
3175 return E_FAIL; | 3167 return E_FAIL; |
3176 | 3168 |
3177 if (!doc_type) | 3169 if (!doc_type) |
3178 return E_INVALIDARG; | 3170 return E_INVALIDARG; |
3179 | 3171 |
3180 std::string str = manager()->GetTreeData().doctype; | 3172 std::string str = manager_->GetTreeData().doctype; |
3181 if (str.empty()) | 3173 if (str.empty()) |
3182 return S_FALSE; | 3174 return S_FALSE; |
3183 | 3175 |
3184 *doc_type = SysAllocString(base::UTF8ToUTF16(str).c_str()); | 3176 *doc_type = SysAllocString(base::UTF8ToUTF16(str).c_str()); |
3185 DCHECK(*doc_type); | 3177 DCHECK(*doc_type); |
3186 | 3178 |
3187 return S_OK; | 3179 return S_OK; |
3188 } | 3180 } |
3189 | 3181 |
3190 STDMETHODIMP | 3182 STDMETHODIMP |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3585 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES); | 3577 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES); |
3586 if (!instance_active()) | 3578 if (!instance_active()) |
3587 return E_FAIL; | 3579 return E_FAIL; |
3588 | 3580 |
3589 unsigned int text_length = static_cast<unsigned int>(GetText().size()); | 3581 unsigned int text_length = static_cast<unsigned int>(GetText().size()); |
3590 if (start_index > text_length || end_index > text_length || | 3582 if (start_index > text_length || end_index > text_length || |
3591 start_index > end_index) { | 3583 start_index > end_index) { |
3592 return E_INVALIDARG; | 3584 return E_INVALIDARG; |
3593 } | 3585 } |
3594 | 3586 |
3595 manager()->ScrollToMakeVisible(*this, GetPageBoundsForRange( | 3587 manager_->ScrollToMakeVisible( |
3596 start_index, end_index - start_index)); | 3588 *this, GetPageBoundsForRange(start_index, end_index - start_index)); |
3597 | 3589 |
3598 return S_OK; | 3590 return S_OK; |
3599 } | 3591 } |
3600 | 3592 |
3601 STDMETHODIMP BrowserAccessibilityWin::get_fontFamily(BSTR* font_family) { | 3593 STDMETHODIMP BrowserAccessibilityWin::get_fontFamily(BSTR* font_family) { |
3602 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_FONT_FAMILY); | 3594 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_FONT_FAMILY); |
3603 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 3595 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
3604 if (!font_family) | 3596 if (!font_family) |
3605 return E_INVALIDARG; | 3597 return E_INVALIDARG; |
3606 *font_family = nullptr; | 3598 *font_family = nullptr; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3850 | 3842 |
3851 if (child->IsTextOnlyObject()) | 3843 if (child->IsTextOnlyObject()) |
3852 start_offset += child->GetText().length(); | 3844 start_offset += child->GetText().length(); |
3853 else | 3845 else |
3854 start_offset += 1; | 3846 start_offset += 1; |
3855 } | 3847 } |
3856 | 3848 |
3857 win_attributes_->offset_to_text_attributes.swap(attributes_map); | 3849 win_attributes_->offset_to_text_attributes.swap(attributes_map); |
3858 } | 3850 } |
3859 | 3851 |
| 3852 // |offset| could either be a text character or a child index in case of |
| 3853 // non-text objects. |
| 3854 BrowserAccessibilityWin::AXPlatformPositionInstance |
| 3855 BrowserAccessibilityWin::CreatePositionAt(int offset) const { |
| 3856 if (!IsNativeTextControl() && !IsTextOnlyObject()) { |
| 3857 DCHECK(manager_); |
| 3858 const BrowserAccessibilityWin* child = this; |
| 3859 // TODO(nektar): Make parents of text-only objects not include the text of |
| 3860 // children in their hypertext. |
| 3861 for (size_t i = 0; i < InternalChildCount(); ++i) { |
| 3862 int new_offset = offset; |
| 3863 child = ToBrowserAccessibilityWin(InternalGetChild(i)); |
| 3864 DCHECK(child); |
| 3865 if (child->IsTextOnlyObject()) { |
| 3866 new_offset -= child->GetText().length(); |
| 3867 } else { |
| 3868 new_offset -= 1; |
| 3869 } |
| 3870 if (new_offset <= 0) |
| 3871 break; |
| 3872 offset = new_offset; |
| 3873 } |
| 3874 AXPlatformPositionInstance position = |
| 3875 AXPlatformPosition::CreateTextPosition(manager_->ax_tree_id(), |
| 3876 child->GetId(), offset, |
| 3877 ui::AX_TEXT_AFFINITY_DOWNSTREAM) |
| 3878 ->AsLeafTextPosition(); |
| 3879 if (position->GetAnchor() && |
| 3880 position->GetAnchor()->GetRole() == ui::AX_ROLE_INLINE_TEXT_BOX) { |
| 3881 return position->CreateParentPosition(); |
| 3882 } |
| 3883 return position; |
| 3884 } |
| 3885 return BrowserAccessibility::CreatePositionAt(offset); |
| 3886 } |
| 3887 |
3860 base::string16 BrowserAccessibilityWin::GetText() const { | 3888 base::string16 BrowserAccessibilityWin::GetText() const { |
3861 if (PlatformIsChildOfLeaf()) | 3889 if (PlatformIsChildOfLeaf()) |
3862 return BrowserAccessibility::GetText(); | 3890 return BrowserAccessibility::GetText(); |
3863 return win_attributes_->hypertext; | 3891 return win_attributes_->hypertext; |
3864 } | 3892 } |
3865 | 3893 |
3866 // | 3894 // |
3867 // Private methods. | 3895 // Private methods. |
3868 // | 3896 // |
3869 | 3897 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4005 } | 4033 } |
4006 | 4034 |
4007 win_attributes_->name = GetString16Attribute(ui::AX_ATTR_NAME); | 4035 win_attributes_->name = GetString16Attribute(ui::AX_ATTR_NAME); |
4008 win_attributes_->description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION); | 4036 win_attributes_->description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION); |
4009 StringAttributeToIA2(ui::AX_ATTR_PLACEHOLDER, "placeholder"); | 4037 StringAttributeToIA2(ui::AX_ATTR_PLACEHOLDER, "placeholder"); |
4010 | 4038 |
4011 base::string16 value = GetValue(); | 4039 base::string16 value = GetValue(); |
4012 // On Windows, the value of a document should be its url. | 4040 // On Windows, the value of a document should be its url. |
4013 if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA || | 4041 if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA || |
4014 GetRole() == ui::AX_ROLE_WEB_AREA) { | 4042 GetRole() == ui::AX_ROLE_WEB_AREA) { |
4015 value = base::UTF8ToUTF16(manager()->GetTreeData().url); | 4043 value = base::UTF8ToUTF16(manager_->GetTreeData().url); |
4016 } | 4044 } |
4017 // If this doesn't have a value and is linked then set its value to the url | 4045 // If this doesn't have a value and is linked then set its value to the url |
4018 // attribute. This allows screen readers to read an empty link's destination. | 4046 // attribute. This allows screen readers to read an empty link's destination. |
4019 if (value.empty() && (ia_state() & STATE_SYSTEM_LINKED)) | 4047 if (value.empty() && (ia_state() & STATE_SYSTEM_LINKED)) |
4020 value = GetString16Attribute(ui::AX_ATTR_URL); | 4048 value = GetString16Attribute(ui::AX_ATTR_URL); |
4021 win_attributes_->value = value; | 4049 win_attributes_->value = value; |
4022 | 4050 |
4023 ClearOwnRelations(); | 4051 ClearOwnRelations(); |
4024 AddBidirectionalRelations(IA2_RELATION_CONTROLLER_FOR, | 4052 AddBidirectionalRelations(IA2_RELATION_CONTROLLER_FOR, |
4025 IA2_RELATION_CONTROLLED_BY, | 4053 IA2_RELATION_CONTROLLED_BY, |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4465 // According to the IA2 Spec, these characters need to be escaped with a | 4493 // According to the IA2 Spec, these characters need to be escaped with a |
4466 // backslash: backslash, colon, comma, equals and semicolon. | 4494 // backslash: backslash, colon, comma, equals and semicolon. |
4467 // Note that backslash must be replaced first. | 4495 // Note that backslash must be replaced first. |
4468 base::ReplaceChars(input, L"\\", L"\\\\", output); | 4496 base::ReplaceChars(input, L"\\", L"\\\\", output); |
4469 base::ReplaceChars(*output, L":", L"\\:", output); | 4497 base::ReplaceChars(*output, L":", L"\\:", output); |
4470 base::ReplaceChars(*output, L",", L"\\,", output); | 4498 base::ReplaceChars(*output, L",", L"\\,", output); |
4471 base::ReplaceChars(*output, L"=", L"\\=", output); | 4499 base::ReplaceChars(*output, L"=", L"\\=", output); |
4472 base::ReplaceChars(*output, L";", L"\\;", output); | 4500 base::ReplaceChars(*output, L";", L"\\;", output); |
4473 } | 4501 } |
4474 | 4502 |
| 4503 void BrowserAccessibilityWin::SetIA2HypertextSelection(LONG start_offset, |
| 4504 LONG end_offset) { |
| 4505 HandleSpecialTextOffset(&start_offset); |
| 4506 HandleSpecialTextOffset(&end_offset); |
| 4507 AXPlatformPositionInstance start_position = |
| 4508 CreatePositionAt(static_cast<int>(start_offset)); |
| 4509 AXPlatformPositionInstance end_position = |
| 4510 CreatePositionAt(static_cast<int>(end_offset)); |
| 4511 manager_->SetSelection(AXPlatformRange(start_position->AsTextPosition(), |
| 4512 end_position->AsTextPosition())); |
| 4513 } |
| 4514 |
4475 void BrowserAccessibilityWin::StringAttributeToIA2( | 4515 void BrowserAccessibilityWin::StringAttributeToIA2( |
4476 ui::AXStringAttribute attribute, | 4516 ui::AXStringAttribute attribute, |
4477 const char* ia2_attr) { | 4517 const char* ia2_attr) { |
4478 base::string16 value; | 4518 base::string16 value; |
4479 if (GetString16Attribute(attribute, &value)) { | 4519 if (GetString16Attribute(attribute, &value)) { |
4480 SanitizeStringAttributeForIA2(value, &value); | 4520 SanitizeStringAttributeForIA2(value, &value); |
4481 win_attributes_->ia2_attributes.push_back( | 4521 win_attributes_->ia2_attributes.push_back( |
4482 base::ASCIIToUTF16(ia2_attr) + L":" + value); | 4522 base::ASCIIToUTF16(ia2_attr) + L":" + value); |
4483 } | 4523 } |
4484 } | 4524 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4671 if (endpoint_index_in_common_parent < index_in_common_parent) | 4711 if (endpoint_index_in_common_parent < index_in_common_parent) |
4672 return 0; | 4712 return 0; |
4673 if (endpoint_index_in_common_parent > index_in_common_parent) | 4713 if (endpoint_index_in_common_parent > index_in_common_parent) |
4674 return GetText().size(); | 4714 return GetText().size(); |
4675 | 4715 |
4676 NOTREACHED(); | 4716 NOTREACHED(); |
4677 return -1; | 4717 return -1; |
4678 } | 4718 } |
4679 | 4719 |
4680 int BrowserAccessibilityWin::GetSelectionAnchor() const { | 4720 int BrowserAccessibilityWin::GetSelectionAnchor() const { |
4681 int32_t anchor_id = manager()->GetTreeData().sel_anchor_object_id; | 4721 int32_t anchor_id = manager_->GetTreeData().sel_anchor_object_id; |
4682 const BrowserAccessibilityWin* anchor_object = GetFromID(anchor_id); | 4722 const BrowserAccessibilityWin* anchor_object = GetFromID(anchor_id); |
4683 if (!anchor_object) | 4723 if (!anchor_object) |
4684 return -1; | 4724 return -1; |
4685 | 4725 |
4686 int anchor_offset = manager()->GetTreeData().sel_anchor_offset; | 4726 int anchor_offset = manager_->GetTreeData().sel_anchor_offset; |
4687 return GetHypertextOffsetFromEndpoint(*anchor_object, anchor_offset); | 4727 return GetHypertextOffsetFromEndpoint(*anchor_object, anchor_offset); |
4688 } | 4728 } |
4689 | 4729 |
4690 int BrowserAccessibilityWin::GetSelectionFocus() const { | 4730 int BrowserAccessibilityWin::GetSelectionFocus() const { |
4691 int32_t focus_id = manager()->GetTreeData().sel_focus_object_id; | 4731 int32_t focus_id = manager_->GetTreeData().sel_focus_object_id; |
4692 const BrowserAccessibilityWin* focus_object = GetFromID(focus_id); | 4732 const BrowserAccessibilityWin* focus_object = GetFromID(focus_id); |
4693 if (!focus_object) | 4733 if (!focus_object) |
4694 return -1; | 4734 return -1; |
4695 | 4735 |
4696 int focus_offset = manager()->GetTreeData().sel_focus_offset; | 4736 int focus_offset = manager_->GetTreeData().sel_focus_offset; |
4697 return GetHypertextOffsetFromEndpoint(*focus_object, focus_offset); | 4737 return GetHypertextOffsetFromEndpoint(*focus_object, focus_offset); |
4698 } | 4738 } |
4699 | 4739 |
4700 void BrowserAccessibilityWin::GetSelectionOffsets( | 4740 void BrowserAccessibilityWin::GetSelectionOffsets( |
4701 int* selection_start, int* selection_end) const { | 4741 int* selection_start, int* selection_end) const { |
4702 DCHECK(selection_start && selection_end); | 4742 DCHECK(selection_start && selection_end); |
4703 | 4743 |
4704 if (IsSimpleTextControl() && | 4744 if (IsSimpleTextControl() && |
4705 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, selection_start) && | 4745 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, selection_start) && |
4706 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, selection_end)) { | 4746 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, selection_end)) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4823 old_text.size() - common_suffix - 1, | 4863 old_text.size() - common_suffix - 1, |
4824 new_text.size() - common_suffix - 1)) { | 4864 new_text.size() - common_suffix - 1)) { |
4825 ++common_suffix; | 4865 ++common_suffix; |
4826 } | 4866 } |
4827 | 4867 |
4828 *start = common_prefix; | 4868 *start = common_prefix; |
4829 *old_len = old_text.size() - common_prefix - common_suffix; | 4869 *old_len = old_text.size() - common_prefix - common_suffix; |
4830 *new_len = new_text.size() - common_prefix - common_suffix; | 4870 *new_len = new_text.size() - common_prefix - common_suffix; |
4831 } | 4871 } |
4832 | 4872 |
4833 void BrowserAccessibilityWin::HandleSpecialTextOffset( | 4873 void BrowserAccessibilityWin::HandleSpecialTextOffset(LONG* offset) { |
4834 const base::string16& text, | 4874 if (*offset == IA2_TEXT_OFFSET_LENGTH) { |
4835 LONG* offset) { | 4875 *offset = static_cast<LONG>(GetText().length()); |
4836 if (*offset == IA2_TEXT_OFFSET_LENGTH) | 4876 } else if (*offset == IA2_TEXT_OFFSET_CARET) { |
4837 *offset = static_cast<LONG>(text.size()); | 4877 // We shouldn't call |get_caretOffset| here as it affects UMA counts. |
4838 else if (*offset == IA2_TEXT_OFFSET_CARET) | 4878 int selection_start, selection_end; |
4839 get_caretOffset(offset); | 4879 GetSelectionOffsets(&selection_start, &selection_end); |
| 4880 *offset = selection_end; |
| 4881 } |
4840 } | 4882 } |
4841 | 4883 |
4842 ui::TextBoundaryType BrowserAccessibilityWin::IA2TextBoundaryToTextBoundary( | 4884 ui::TextBoundaryType BrowserAccessibilityWin::IA2TextBoundaryToTextBoundary( |
4843 IA2TextBoundaryType ia2_boundary) { | 4885 IA2TextBoundaryType ia2_boundary) { |
4844 switch(ia2_boundary) { | 4886 switch(ia2_boundary) { |
4845 case IA2_TEXT_BOUNDARY_CHAR: | 4887 case IA2_TEXT_BOUNDARY_CHAR: |
4846 return ui::CHAR_BOUNDARY; | 4888 return ui::CHAR_BOUNDARY; |
4847 case IA2_TEXT_BOUNDARY_WORD: | 4889 case IA2_TEXT_BOUNDARY_WORD: |
4848 return ui::WORD_BOUNDARY; | 4890 return ui::WORD_BOUNDARY; |
4849 case IA2_TEXT_BOUNDARY_LINE: | 4891 case IA2_TEXT_BOUNDARY_LINE: |
4850 return ui::LINE_BOUNDARY; | 4892 return ui::LINE_BOUNDARY; |
4851 case IA2_TEXT_BOUNDARY_SENTENCE: | 4893 case IA2_TEXT_BOUNDARY_SENTENCE: |
4852 return ui::SENTENCE_BOUNDARY; | 4894 return ui::SENTENCE_BOUNDARY; |
4853 case IA2_TEXT_BOUNDARY_PARAGRAPH: | 4895 case IA2_TEXT_BOUNDARY_PARAGRAPH: |
4854 return ui::PARAGRAPH_BOUNDARY; | 4896 return ui::PARAGRAPH_BOUNDARY; |
4855 case IA2_TEXT_BOUNDARY_ALL: | 4897 case IA2_TEXT_BOUNDARY_ALL: |
4856 return ui::ALL_BOUNDARY; | 4898 return ui::ALL_BOUNDARY; |
4857 } | 4899 } |
4858 NOTREACHED(); | 4900 NOTREACHED(); |
4859 return ui::CHAR_BOUNDARY; | 4901 return ui::CHAR_BOUNDARY; |
4860 } | 4902 } |
4861 | 4903 |
4862 LONG BrowserAccessibilityWin::FindBoundary( | 4904 LONG BrowserAccessibilityWin::FindBoundary( |
4863 const base::string16& text, | 4905 const base::string16& text, |
4864 IA2TextBoundaryType ia2_boundary, | 4906 IA2TextBoundaryType ia2_boundary, |
4865 LONG start_offset, | 4907 LONG start_offset, |
4866 ui::TextBoundaryDirection direction) { | 4908 ui::TextBoundaryDirection direction) { |
4867 // If the boundary is relative to the caret, use the selection | 4909 // If the boundary is relative to the caret, use the selection |
4868 // affinity, otherwise default to downstream affinity. | 4910 // affinity, otherwise default to downstream affinity. |
4869 ui::AXTextAffinity affinity = | 4911 ui::AXTextAffinity affinity = start_offset == IA2_TEXT_OFFSET_CARET |
4870 start_offset == IA2_TEXT_OFFSET_CARET ? | 4912 ? manager_->GetTreeData().sel_focus_affinity |
4871 manager()->GetTreeData().sel_focus_affinity : | 4913 : ui::AX_TEXT_AFFINITY_DOWNSTREAM; |
4872 ui::AX_TEXT_AFFINITY_DOWNSTREAM; | |
4873 | 4914 |
4874 HandleSpecialTextOffset(text, &start_offset); | 4915 HandleSpecialTextOffset(&start_offset); |
4875 if (ia2_boundary == IA2_TEXT_BOUNDARY_WORD) | 4916 if (ia2_boundary == IA2_TEXT_BOUNDARY_WORD) |
4876 return GetWordStartBoundary(static_cast<int>(start_offset), direction); | 4917 return GetWordStartBoundary(static_cast<int>(start_offset), direction); |
4877 if (ia2_boundary == IA2_TEXT_BOUNDARY_LINE) { | 4918 if (ia2_boundary == IA2_TEXT_BOUNDARY_LINE) { |
4878 return GetLineStartBoundary( | 4919 return GetLineStartBoundary( |
4879 static_cast<int>(start_offset), direction, affinity); | 4920 static_cast<int>(start_offset), direction, affinity); |
4880 } | 4921 } |
4881 | 4922 |
4882 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); | 4923 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); |
4883 return ui::FindAccessibleTextBoundary(text, GetLineStartOffsets(), boundary, | 4924 return ui::FindAccessibleTextBoundary(text, GetLineStartOffsets(), boundary, |
4884 start_offset, direction, affinity); | 4925 start_offset, direction, affinity); |
(...skipping 24 matching lines...) Expand all Loading... |
4909 } | 4950 } |
4910 } | 4951 } |
4911 | 4952 |
4912 NOTREACHED(); | 4953 NOTREACHED(); |
4913 return start_offset; | 4954 return start_offset; |
4914 } | 4955 } |
4915 | 4956 |
4916 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromID(int32_t id) const { | 4957 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromID(int32_t id) const { |
4917 if (!instance_active()) | 4958 if (!instance_active()) |
4918 return nullptr; | 4959 return nullptr; |
4919 return ToBrowserAccessibilityWin(manager()->GetFromID(id)); | 4960 return ToBrowserAccessibilityWin(manager_->GetFromID(id)); |
4920 } | 4961 } |
4921 | 4962 |
4922 bool BrowserAccessibilityWin::IsListBoxOptionOrMenuListOption() { | 4963 bool BrowserAccessibilityWin::IsListBoxOptionOrMenuListOption() { |
4923 if (!GetParent()) | 4964 if (!GetParent()) |
4924 return false; | 4965 return false; |
4925 | 4966 |
4926 int32_t role = GetRole(); | 4967 int32_t role = GetRole(); |
4927 int32_t parent_role = GetParent()->GetRole(); | 4968 int32_t parent_role = GetParent()->GetRole(); |
4928 | 4969 |
4929 if (role == ui::AX_ROLE_LIST_BOX_OPTION && | 4970 if (role == ui::AX_ROLE_LIST_BOX_OPTION && |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5713 return static_cast<BrowserAccessibilityWin*>(obj); | 5754 return static_cast<BrowserAccessibilityWin*>(obj); |
5714 } | 5755 } |
5715 | 5756 |
5716 const BrowserAccessibilityWin* | 5757 const BrowserAccessibilityWin* |
5717 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5758 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
5718 DCHECK(!obj || obj->IsNative()); | 5759 DCHECK(!obj || obj->IsNative()); |
5719 return static_cast<const BrowserAccessibilityWin*>(obj); | 5760 return static_cast<const BrowserAccessibilityWin*>(obj); |
5720 } | 5761 } |
5721 | 5762 |
5722 } // namespace content | 5763 } // namespace content |
OLD | NEW |