Chromium Code Reviews| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2410 BSTR* text) { | 2409 BSTR* text) { |
| 2411 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT); | 2410 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT); |
| 2412 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2411 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
| 2413 if (!instance_active()) | 2412 if (!instance_active()) |
| 2414 return E_FAIL; | 2413 return E_FAIL; |
| 2415 | 2414 |
| 2416 if (!text) | 2415 if (!text) |
| 2417 return E_INVALIDARG; | 2416 return E_INVALIDARG; |
| 2418 | 2417 |
| 2419 const base::string16& text_str = GetText(); | 2418 const base::string16& text_str = GetText(); |
| 2420 HandleSpecialTextOffset(text_str, &start_offset); | 2419 HandleSpecialTextOffset(&start_offset); |
| 2421 HandleSpecialTextOffset(text_str, &end_offset); | 2420 HandleSpecialTextOffset(&end_offset); |
| 2422 | 2421 |
| 2423 // The spec allows the arguments to be reversed. | 2422 // The spec allows the arguments to be reversed. |
| 2424 if (start_offset > end_offset) { | 2423 if (start_offset > end_offset) { |
| 2425 LONG tmp = start_offset; | 2424 LONG tmp = start_offset; |
| 2426 start_offset = end_offset; | 2425 start_offset = end_offset; |
| 2427 end_offset = tmp; | 2426 end_offset = tmp; |
| 2428 } | 2427 } |
| 2429 | 2428 |
| 2430 // The spec does not allow the start or end offsets to be out or range; | 2429 // The spec does not allow the start or end offsets to be out or range; |
| 2431 // we must return an error if so. | 2430 // 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); | 2454 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT_AT_OFFSET); |
| 2456 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER | | 2455 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER | |
| 2457 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES); | 2456 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES); |
| 2458 if (!instance_active()) | 2457 if (!instance_active()) |
| 2459 return E_FAIL; | 2458 return E_FAIL; |
| 2460 | 2459 |
| 2461 if (!start_offset || !end_offset || !text) | 2460 if (!start_offset || !end_offset || !text) |
| 2462 return E_INVALIDARG; | 2461 return E_INVALIDARG; |
| 2463 | 2462 |
| 2464 const base::string16& text_str = GetText(); | 2463 const base::string16& text_str = GetText(); |
| 2465 HandleSpecialTextOffset(text_str, &offset); | 2464 HandleSpecialTextOffset(&offset); |
| 2466 if (offset < 0) | 2465 if (offset < 0) |
| 2467 return E_INVALIDARG; | 2466 return E_INVALIDARG; |
| 2468 | 2467 |
| 2469 LONG text_len = text_str.length(); | 2468 LONG text_len = text_str.length(); |
| 2470 if (offset > text_len) | 2469 if (offset > text_len) |
| 2471 return E_INVALIDARG; | 2470 return E_INVALIDARG; |
| 2472 | 2471 |
| 2473 // The IAccessible2 spec says we don't have to implement the "sentence" | 2472 // The IAccessible2 spec says we don't have to implement the "sentence" |
| 2474 // boundary type, we can just let the screenreader handle it. | 2473 // boundary type, we can just let the screenreader handle it. |
| 2475 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { | 2474 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); | 2665 return scrollToPoint(coordinate_type, x, y); |
| 2667 } | 2666 } |
| 2668 | 2667 |
| 2669 STDMETHODIMP BrowserAccessibilityWin::addSelection(LONG start_offset, | 2668 STDMETHODIMP BrowserAccessibilityWin::addSelection(LONG start_offset, |
| 2670 LONG end_offset) { | 2669 LONG end_offset) { |
| 2671 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ADD_SELECTION); | 2670 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ADD_SELECTION); |
| 2672 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2671 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
| 2673 if (!instance_active()) | 2672 if (!instance_active()) |
| 2674 return E_FAIL; | 2673 return E_FAIL; |
| 2675 | 2674 |
| 2676 const base::string16& text_str = GetText(); | 2675 // We only support one selection. |
| 2677 HandleSpecialTextOffset(text_str, &start_offset); | 2676 SetIA2HypertextSelection(start_offset, end_offset); |
| 2678 HandleSpecialTextOffset(text_str, &end_offset); | |
| 2679 | |
| 2680 manager()->SetTextSelection(*this, start_offset, end_offset); | |
| 2681 return S_OK; | 2677 return S_OK; |
| 2682 } | 2678 } |
| 2683 | 2679 |
| 2684 STDMETHODIMP BrowserAccessibilityWin::removeSelection(LONG selection_index) { | 2680 STDMETHODIMP BrowserAccessibilityWin::removeSelection(LONG selection_index) { |
| 2685 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_REMOVE_SELECTION); | 2681 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_REMOVE_SELECTION); |
| 2686 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2682 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
| 2687 if (!instance_active()) | 2683 if (!instance_active()) |
| 2688 return E_FAIL; | 2684 return E_FAIL; |
| 2689 | 2685 |
| 2690 if (selection_index != 0) | 2686 if (selection_index != 0) |
| 2691 return E_INVALIDARG; | 2687 return E_INVALIDARG; |
| 2692 | 2688 |
| 2693 manager()->SetTextSelection(*this, 0, 0); | 2689 // Simply collapse the selection to the position of the caret if a caret is |
| 2690 // visible, otherwise set the selection to 0. | |
| 2691 LONG caret_offset = 0; | |
| 2692 int selection_start, selection_end; | |
| 2693 GetSelectionOffsets(&selection_start, &selection_end); | |
| 2694 if (HasCaret() && selection_end >= 0) | |
| 2695 caret_offset = selection_end; | |
| 2696 SetIA2HypertextSelection(caret_offset, caret_offset); | |
| 2694 return S_OK; | 2697 return S_OK; |
| 2695 } | 2698 } |
| 2696 | 2699 |
| 2697 STDMETHODIMP BrowserAccessibilityWin::setCaretOffset(LONG offset) { | 2700 STDMETHODIMP BrowserAccessibilityWin::setCaretOffset(LONG offset) { |
| 2698 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_CARET_OFFSET); | 2701 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_CARET_OFFSET); |
| 2699 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2702 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
| 2700 if (!instance_active()) | 2703 if (!instance_active()) |
| 2701 return E_FAIL; | 2704 return E_FAIL; |
| 2702 | 2705 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; | 2706 return S_OK; |
| 2707 } | 2707 } |
| 2708 | 2708 |
| 2709 STDMETHODIMP BrowserAccessibilityWin::setSelection(LONG selection_index, | 2709 STDMETHODIMP BrowserAccessibilityWin::setSelection(LONG selection_index, |
| 2710 LONG start_offset, | 2710 LONG start_offset, |
| 2711 LONG end_offset) { | 2711 LONG end_offset) { |
| 2712 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_SELECTION); | 2712 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_SELECTION); |
| 2713 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2713 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
| 2714 if (!instance_active()) | 2714 if (!instance_active()) |
| 2715 return E_FAIL; | 2715 return E_FAIL; |
| 2716 | |
| 2717 if (selection_index != 0) | 2716 if (selection_index != 0) |
| 2718 return E_INVALIDARG; | 2717 return E_INVALIDARG; |
| 2719 | 2718 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; | 2719 return S_OK; |
| 2726 } | 2720 } |
| 2727 | 2721 |
| 2728 STDMETHODIMP BrowserAccessibilityWin::get_attributes(LONG offset, | 2722 STDMETHODIMP BrowserAccessibilityWin::get_attributes(LONG offset, |
| 2729 LONG* start_offset, | 2723 LONG* start_offset, |
| 2730 LONG* end_offset, | 2724 LONG* end_offset, |
| 2731 BSTR* text_attributes) { | 2725 BSTR* text_attributes) { |
| 2732 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IATEXT_GET_ATTRIBUTES); | 2726 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IATEXT_GET_ATTRIBUTES); |
| 2733 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2727 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
| 2734 if (!start_offset || !end_offset || !text_attributes) | 2728 if (!start_offset || !end_offset || !text_attributes) |
| 2735 return E_INVALIDARG; | 2729 return E_INVALIDARG; |
| 2736 | 2730 |
| 2737 *start_offset = *end_offset = 0; | 2731 *start_offset = *end_offset = 0; |
| 2738 *text_attributes = nullptr; | 2732 *text_attributes = nullptr; |
| 2739 if (!instance_active()) | 2733 if (!instance_active()) |
| 2740 return E_FAIL; | 2734 return E_FAIL; |
| 2741 | 2735 |
| 2742 const base::string16& text = GetText(); | 2736 const base::string16 text = GetText(); |
| 2743 HandleSpecialTextOffset(text, &offset); | 2737 HandleSpecialTextOffset(&offset); |
| 2744 if (offset < 0 || offset > static_cast<LONG>(text.size())) | 2738 if (offset < 0 || offset > static_cast<LONG>(text.size())) |
| 2745 return E_INVALIDARG; | 2739 return E_INVALIDARG; |
| 2746 | 2740 |
| 2747 ComputeStylesIfNeeded(); | 2741 ComputeStylesIfNeeded(); |
| 2748 *start_offset = FindStartOfStyle(offset, ui::BACKWARDS_DIRECTION); | 2742 *start_offset = FindStartOfStyle(offset, ui::BACKWARDS_DIRECTION); |
| 2749 *end_offset = FindStartOfStyle(offset, ui::FORWARDS_DIRECTION); | 2743 *end_offset = FindStartOfStyle(offset, ui::FORWARDS_DIRECTION); |
| 2750 | 2744 |
| 2751 base::string16 attributes_str; | 2745 base::string16 attributes_str; |
| 2752 const std::vector<base::string16>& attributes = | 2746 const std::vector<base::string16>& attributes = |
| 2753 offset_to_text_attributes().find(*start_offset)->second; | 2747 offset_to_text_attributes().find(*start_offset)->second; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2951 | 2945 |
| 2952 STDMETHODIMP BrowserAccessibilityWin::doAction(long action_index) { | 2946 STDMETHODIMP BrowserAccessibilityWin::doAction(long action_index) { |
| 2953 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_DO_ACTION); | 2947 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_DO_ACTION); |
| 2954 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2948 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
| 2955 if (!instance_active()) | 2949 if (!instance_active()) |
| 2956 return E_FAIL; | 2950 return E_FAIL; |
| 2957 | 2951 |
| 2958 if (!HasIntAttribute(ui::AX_ATTR_ACTION) || action_index != 0) | 2952 if (!HasIntAttribute(ui::AX_ATTR_ACTION) || action_index != 0) |
| 2959 return E_INVALIDARG; | 2953 return E_INVALIDARG; |
| 2960 | 2954 |
| 2961 manager()->DoDefaultAction(*this); | 2955 manager_->DoDefaultAction(*this); |
| 2962 return S_OK; | 2956 return S_OK; |
| 2963 } | 2957 } |
| 2964 | 2958 |
| 2965 STDMETHODIMP | 2959 STDMETHODIMP |
| 2966 BrowserAccessibilityWin::get_description(long action_index, BSTR* description) { | 2960 BrowserAccessibilityWin::get_description(long action_index, BSTR* description) { |
| 2967 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IAACTION_GET_DESCRIPTION); | 2961 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IAACTION_GET_DESCRIPTION); |
| 2968 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 2962 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
| 2969 return E_NOTIMPL; | 2963 return E_NOTIMPL; |
| 2970 } | 2964 } |
| 2971 | 2965 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3113 // | 3107 // |
| 3114 | 3108 |
| 3115 STDMETHODIMP BrowserAccessibilityWin::get_URL(BSTR* url) { | 3109 STDMETHODIMP BrowserAccessibilityWin::get_URL(BSTR* url) { |
| 3116 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_URL); | 3110 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_URL); |
| 3117 if (!instance_active()) | 3111 if (!instance_active()) |
| 3118 return E_FAIL; | 3112 return E_FAIL; |
| 3119 | 3113 |
| 3120 if (!url) | 3114 if (!url) |
| 3121 return E_INVALIDARG; | 3115 return E_INVALIDARG; |
| 3122 | 3116 |
| 3123 if (this != manager()->GetRoot()) | 3117 if (this != manager_->GetRoot()) |
| 3124 return E_FAIL; | 3118 return E_FAIL; |
| 3125 | 3119 |
| 3126 std::string str = manager()->GetTreeData().url; | 3120 std::string str = manager_->GetTreeData().url; |
| 3127 if (str.empty()) | 3121 if (str.empty()) |
| 3128 return S_FALSE; | 3122 return S_FALSE; |
| 3129 | 3123 |
| 3130 *url = SysAllocString(base::UTF8ToUTF16(str).c_str()); | 3124 *url = SysAllocString(base::UTF8ToUTF16(str).c_str()); |
| 3131 DCHECK(*url); | 3125 DCHECK(*url); |
| 3132 | 3126 |
| 3133 return S_OK; | 3127 return S_OK; |
| 3134 } | 3128 } |
| 3135 | 3129 |
| 3136 STDMETHODIMP BrowserAccessibilityWin::get_title(BSTR* title) { | 3130 STDMETHODIMP BrowserAccessibilityWin::get_title(BSTR* title) { |
| 3137 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TITLE); | 3131 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TITLE); |
| 3138 if (!instance_active()) | 3132 if (!instance_active()) |
| 3139 return E_FAIL; | 3133 return E_FAIL; |
| 3140 | 3134 |
| 3141 if (!title) | 3135 if (!title) |
| 3142 return E_INVALIDARG; | 3136 return E_INVALIDARG; |
| 3143 | 3137 |
| 3144 std::string str = manager()->GetTreeData().title; | 3138 std::string str = manager_->GetTreeData().title; |
| 3145 if (str.empty()) | 3139 if (str.empty()) |
| 3146 return S_FALSE; | 3140 return S_FALSE; |
| 3147 | 3141 |
| 3148 *title = SysAllocString(base::UTF8ToUTF16(str).c_str()); | 3142 *title = SysAllocString(base::UTF8ToUTF16(str).c_str()); |
| 3149 DCHECK(*title); | 3143 DCHECK(*title); |
| 3150 | 3144 |
| 3151 return S_OK; | 3145 return S_OK; |
| 3152 } | 3146 } |
| 3153 | 3147 |
| 3154 STDMETHODIMP BrowserAccessibilityWin::get_mimeType(BSTR* mime_type) { | 3148 STDMETHODIMP BrowserAccessibilityWin::get_mimeType(BSTR* mime_type) { |
| 3155 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_MIME_TYPE); | 3149 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_MIME_TYPE); |
| 3156 if (!instance_active()) | 3150 if (!instance_active()) |
| 3157 return E_FAIL; | 3151 return E_FAIL; |
| 3158 | 3152 |
| 3159 if (!mime_type) | 3153 if (!mime_type) |
| 3160 return E_INVALIDARG; | 3154 return E_INVALIDARG; |
| 3161 | 3155 |
| 3162 std::string str = manager()->GetTreeData().mimetype; | 3156 std::string str = manager_->GetTreeData().mimetype; |
| 3163 if (str.empty()) | 3157 if (str.empty()) |
| 3164 return S_FALSE; | 3158 return S_FALSE; |
| 3165 | 3159 |
| 3166 *mime_type = SysAllocString(base::UTF8ToUTF16(str).c_str()); | 3160 *mime_type = SysAllocString(base::UTF8ToUTF16(str).c_str()); |
| 3167 DCHECK(*mime_type); | 3161 DCHECK(*mime_type); |
| 3168 | 3162 |
| 3169 return S_OK; | 3163 return S_OK; |
| 3170 } | 3164 } |
| 3171 | 3165 |
| 3172 STDMETHODIMP BrowserAccessibilityWin::get_docType(BSTR* doc_type) { | 3166 STDMETHODIMP BrowserAccessibilityWin::get_docType(BSTR* doc_type) { |
| 3173 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_DOC_TYPE); | 3167 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_DOC_TYPE); |
| 3174 if (!instance_active()) | 3168 if (!instance_active()) |
| 3175 return E_FAIL; | 3169 return E_FAIL; |
| 3176 | 3170 |
| 3177 if (!doc_type) | 3171 if (!doc_type) |
| 3178 return E_INVALIDARG; | 3172 return E_INVALIDARG; |
| 3179 | 3173 |
| 3180 std::string str = manager()->GetTreeData().doctype; | 3174 std::string str = manager_->GetTreeData().doctype; |
| 3181 if (str.empty()) | 3175 if (str.empty()) |
| 3182 return S_FALSE; | 3176 return S_FALSE; |
| 3183 | 3177 |
| 3184 *doc_type = SysAllocString(base::UTF8ToUTF16(str).c_str()); | 3178 *doc_type = SysAllocString(base::UTF8ToUTF16(str).c_str()); |
| 3185 DCHECK(*doc_type); | 3179 DCHECK(*doc_type); |
| 3186 | 3180 |
| 3187 return S_OK; | 3181 return S_OK; |
| 3188 } | 3182 } |
| 3189 | 3183 |
| 3190 STDMETHODIMP | 3184 STDMETHODIMP |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3585 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES); | 3579 ACCESSIBILITY_MODE_FLAG_INLINE_TEXT_BOXES); |
| 3586 if (!instance_active()) | 3580 if (!instance_active()) |
| 3587 return E_FAIL; | 3581 return E_FAIL; |
| 3588 | 3582 |
| 3589 unsigned int text_length = static_cast<unsigned int>(GetText().size()); | 3583 unsigned int text_length = static_cast<unsigned int>(GetText().size()); |
| 3590 if (start_index > text_length || end_index > text_length || | 3584 if (start_index > text_length || end_index > text_length || |
| 3591 start_index > end_index) { | 3585 start_index > end_index) { |
| 3592 return E_INVALIDARG; | 3586 return E_INVALIDARG; |
| 3593 } | 3587 } |
| 3594 | 3588 |
| 3595 manager()->ScrollToMakeVisible(*this, GetPageBoundsForRange( | 3589 manager_->ScrollToMakeVisible( |
| 3596 start_index, end_index - start_index)); | 3590 *this, GetPageBoundsForRange(start_index, end_index - start_index)); |
| 3597 | 3591 |
| 3598 return S_OK; | 3592 return S_OK; |
| 3599 } | 3593 } |
| 3600 | 3594 |
| 3601 STDMETHODIMP BrowserAccessibilityWin::get_fontFamily(BSTR* font_family) { | 3595 STDMETHODIMP BrowserAccessibilityWin::get_fontFamily(BSTR* font_family) { |
| 3602 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_FONT_FAMILY); | 3596 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_FONT_FAMILY); |
| 3603 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); | 3597 AddAccessibilityModeFlags(ACCESSIBILITY_MODE_FLAG_SCREEN_READER); |
| 3604 if (!font_family) | 3598 if (!font_family) |
| 3605 return E_INVALIDARG; | 3599 return E_INVALIDARG; |
| 3606 *font_family = nullptr; | 3600 *font_family = nullptr; |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4005 } | 3999 } |
| 4006 | 4000 |
| 4007 win_attributes_->name = GetString16Attribute(ui::AX_ATTR_NAME); | 4001 win_attributes_->name = GetString16Attribute(ui::AX_ATTR_NAME); |
| 4008 win_attributes_->description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION); | 4002 win_attributes_->description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION); |
| 4009 StringAttributeToIA2(ui::AX_ATTR_PLACEHOLDER, "placeholder"); | 4003 StringAttributeToIA2(ui::AX_ATTR_PLACEHOLDER, "placeholder"); |
| 4010 | 4004 |
| 4011 base::string16 value = GetValue(); | 4005 base::string16 value = GetValue(); |
| 4012 // On Windows, the value of a document should be its url. | 4006 // On Windows, the value of a document should be its url. |
| 4013 if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA || | 4007 if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA || |
| 4014 GetRole() == ui::AX_ROLE_WEB_AREA) { | 4008 GetRole() == ui::AX_ROLE_WEB_AREA) { |
| 4015 value = base::UTF8ToUTF16(manager()->GetTreeData().url); | 4009 value = base::UTF8ToUTF16(manager_->GetTreeData().url); |
| 4016 } | 4010 } |
| 4017 // If this doesn't have a value and is linked then set its value to the url | 4011 // 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. | 4012 // attribute. This allows screen readers to read an empty link's destination. |
| 4019 if (value.empty() && (ia_state() & STATE_SYSTEM_LINKED)) | 4013 if (value.empty() && (ia_state() & STATE_SYSTEM_LINKED)) |
| 4020 value = GetString16Attribute(ui::AX_ATTR_URL); | 4014 value = GetString16Attribute(ui::AX_ATTR_URL); |
| 4021 win_attributes_->value = value; | 4015 win_attributes_->value = value; |
| 4022 | 4016 |
| 4023 ClearOwnRelations(); | 4017 ClearOwnRelations(); |
| 4024 AddBidirectionalRelations(IA2_RELATION_CONTROLLER_FOR, | 4018 AddBidirectionalRelations(IA2_RELATION_CONTROLLER_FOR, |
| 4025 IA2_RELATION_CONTROLLED_BY, | 4019 IA2_RELATION_CONTROLLED_BY, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4188 } | 4182 } |
| 4189 | 4183 |
| 4190 bool BrowserAccessibilityWin::IsNative() const { | 4184 bool BrowserAccessibilityWin::IsNative() const { |
| 4191 return true; | 4185 return true; |
| 4192 } | 4186 } |
| 4193 | 4187 |
| 4194 void BrowserAccessibilityWin::OnLocationChanged() { | 4188 void BrowserAccessibilityWin::OnLocationChanged() { |
| 4195 FireNativeEvent(EVENT_OBJECT_LOCATIONCHANGE); | 4189 FireNativeEvent(EVENT_OBJECT_LOCATIONCHANGE); |
| 4196 } | 4190 } |
| 4197 | 4191 |
| 4192 // |offset| could either be a text character or a child index in case of | |
| 4193 // non-text objects. | |
| 4194 BrowserAccessibilityWin::AXPlatformPositionInstance | |
|
dmazzoni
2017/02/14 20:17:58
can you make this shorter with the "using" keyword
| |
| 4195 BrowserAccessibilityWin::CreatePositionAt(int offset) const { | |
| 4196 if (!IsTextOnlyObject()) { | |
| 4197 DCHECK(manager_); | |
| 4198 return AXPlatformPosition::CreateTreePosition(manager_->ax_tree_id(), | |
| 4199 GetId(), offset); | |
| 4200 } | |
| 4201 return BrowserAccessibility::CreatePositionAt(offset); | |
| 4202 } | |
| 4203 | |
| 4198 std::vector<base::string16> BrowserAccessibilityWin::ComputeTextAttributes() | 4204 std::vector<base::string16> BrowserAccessibilityWin::ComputeTextAttributes() |
| 4199 const { | 4205 const { |
| 4200 std::vector<base::string16> attributes; | 4206 std::vector<base::string16> attributes; |
| 4201 | 4207 |
| 4202 // We include list markers for now, but there might be other objects that are | 4208 // We include list markers for now, but there might be other objects that are |
| 4203 // auto generated. | 4209 // auto generated. |
| 4204 // TODO(nektar): Compute what objects are auto-generated in Blink. | 4210 // TODO(nektar): Compute what objects are auto-generated in Blink. |
| 4205 if (GetRole() == ui::AX_ROLE_LIST_MARKER) | 4211 if (GetRole() == ui::AX_ROLE_LIST_MARKER) |
| 4206 attributes.push_back(L"auto-generated:true"); | 4212 attributes.push_back(L"auto-generated:true"); |
| 4207 else | 4213 else |
| (...skipping 257 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 | 4471 // According to the IA2 Spec, these characters need to be escaped with a |
| 4466 // backslash: backslash, colon, comma, equals and semicolon. | 4472 // backslash: backslash, colon, comma, equals and semicolon. |
| 4467 // Note that backslash must be replaced first. | 4473 // Note that backslash must be replaced first. |
| 4468 base::ReplaceChars(input, L"\\", L"\\\\", output); | 4474 base::ReplaceChars(input, L"\\", L"\\\\", output); |
| 4469 base::ReplaceChars(*output, L":", L"\\:", output); | 4475 base::ReplaceChars(*output, L":", L"\\:", output); |
| 4470 base::ReplaceChars(*output, L",", L"\\,", output); | 4476 base::ReplaceChars(*output, L",", L"\\,", output); |
| 4471 base::ReplaceChars(*output, L"=", L"\\=", output); | 4477 base::ReplaceChars(*output, L"=", L"\\=", output); |
| 4472 base::ReplaceChars(*output, L";", L"\\;", output); | 4478 base::ReplaceChars(*output, L";", L"\\;", output); |
| 4473 } | 4479 } |
| 4474 | 4480 |
| 4481 void BrowserAccessibilityWin::SetIA2HypertextSelection(LONG start_offset, | |
| 4482 LONG end_offset) { | |
| 4483 HandleSpecialTextOffset(&start_offset); | |
| 4484 HandleSpecialTextOffset(&end_offset); | |
| 4485 AXPlatformPositionInstance start_position = | |
| 4486 CreatePositionAt(static_cast<int>(start_offset)); | |
| 4487 AXPlatformPositionInstance end_position = | |
| 4488 CreatePositionAt(static_cast<int>(end_offset)); | |
| 4489 manager_->SetSelection(AXPlatformRange(start_position->AsLeafTextPosition(), | |
| 4490 end_position->AsLeafTextPosition())); | |
| 4491 } | |
| 4492 | |
| 4475 void BrowserAccessibilityWin::StringAttributeToIA2( | 4493 void BrowserAccessibilityWin::StringAttributeToIA2( |
| 4476 ui::AXStringAttribute attribute, | 4494 ui::AXStringAttribute attribute, |
| 4477 const char* ia2_attr) { | 4495 const char* ia2_attr) { |
| 4478 base::string16 value; | 4496 base::string16 value; |
| 4479 if (GetString16Attribute(attribute, &value)) { | 4497 if (GetString16Attribute(attribute, &value)) { |
| 4480 SanitizeStringAttributeForIA2(value, &value); | 4498 SanitizeStringAttributeForIA2(value, &value); |
| 4481 win_attributes_->ia2_attributes.push_back( | 4499 win_attributes_->ia2_attributes.push_back( |
| 4482 base::ASCIIToUTF16(ia2_attr) + L":" + value); | 4500 base::ASCIIToUTF16(ia2_attr) + L":" + value); |
| 4483 } | 4501 } |
| 4484 } | 4502 } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4671 if (endpoint_index_in_common_parent < index_in_common_parent) | 4689 if (endpoint_index_in_common_parent < index_in_common_parent) |
| 4672 return 0; | 4690 return 0; |
| 4673 if (endpoint_index_in_common_parent > index_in_common_parent) | 4691 if (endpoint_index_in_common_parent > index_in_common_parent) |
| 4674 return GetText().size(); | 4692 return GetText().size(); |
| 4675 | 4693 |
| 4676 NOTREACHED(); | 4694 NOTREACHED(); |
| 4677 return -1; | 4695 return -1; |
| 4678 } | 4696 } |
| 4679 | 4697 |
| 4680 int BrowserAccessibilityWin::GetSelectionAnchor() const { | 4698 int BrowserAccessibilityWin::GetSelectionAnchor() const { |
| 4681 int32_t anchor_id = manager()->GetTreeData().sel_anchor_object_id; | 4699 int32_t anchor_id = manager_->GetTreeData().sel_anchor_object_id; |
| 4682 const BrowserAccessibilityWin* anchor_object = GetFromID(anchor_id); | 4700 const BrowserAccessibilityWin* anchor_object = GetFromID(anchor_id); |
| 4683 if (!anchor_object) | 4701 if (!anchor_object) |
| 4684 return -1; | 4702 return -1; |
| 4685 | 4703 |
| 4686 int anchor_offset = manager()->GetTreeData().sel_anchor_offset; | 4704 int anchor_offset = manager_->GetTreeData().sel_anchor_offset; |
| 4687 return GetHypertextOffsetFromEndpoint(*anchor_object, anchor_offset); | 4705 return GetHypertextOffsetFromEndpoint(*anchor_object, anchor_offset); |
| 4688 } | 4706 } |
| 4689 | 4707 |
| 4690 int BrowserAccessibilityWin::GetSelectionFocus() const { | 4708 int BrowserAccessibilityWin::GetSelectionFocus() const { |
| 4691 int32_t focus_id = manager()->GetTreeData().sel_focus_object_id; | 4709 int32_t focus_id = manager_->GetTreeData().sel_focus_object_id; |
| 4692 const BrowserAccessibilityWin* focus_object = GetFromID(focus_id); | 4710 const BrowserAccessibilityWin* focus_object = GetFromID(focus_id); |
| 4693 if (!focus_object) | 4711 if (!focus_object) |
| 4694 return -1; | 4712 return -1; |
| 4695 | 4713 |
| 4696 int focus_offset = manager()->GetTreeData().sel_focus_offset; | 4714 int focus_offset = manager_->GetTreeData().sel_focus_offset; |
| 4697 return GetHypertextOffsetFromEndpoint(*focus_object, focus_offset); | 4715 return GetHypertextOffsetFromEndpoint(*focus_object, focus_offset); |
| 4698 } | 4716 } |
| 4699 | 4717 |
| 4700 void BrowserAccessibilityWin::GetSelectionOffsets( | 4718 void BrowserAccessibilityWin::GetSelectionOffsets( |
| 4701 int* selection_start, int* selection_end) const { | 4719 int* selection_start, int* selection_end) const { |
| 4702 DCHECK(selection_start && selection_end); | 4720 DCHECK(selection_start && selection_end); |
| 4703 | 4721 |
| 4704 if (IsSimpleTextControl() && | 4722 if (IsSimpleTextControl() && |
| 4705 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, selection_start) && | 4723 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, selection_start) && |
| 4706 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, selection_end)) { | 4724 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, | 4841 old_text.size() - common_suffix - 1, |
| 4824 new_text.size() - common_suffix - 1)) { | 4842 new_text.size() - common_suffix - 1)) { |
| 4825 ++common_suffix; | 4843 ++common_suffix; |
| 4826 } | 4844 } |
| 4827 | 4845 |
| 4828 *start = common_prefix; | 4846 *start = common_prefix; |
| 4829 *old_len = old_text.size() - common_prefix - common_suffix; | 4847 *old_len = old_text.size() - common_prefix - common_suffix; |
| 4830 *new_len = new_text.size() - common_prefix - common_suffix; | 4848 *new_len = new_text.size() - common_prefix - common_suffix; |
| 4831 } | 4849 } |
| 4832 | 4850 |
| 4833 void BrowserAccessibilityWin::HandleSpecialTextOffset( | 4851 void BrowserAccessibilityWin::HandleSpecialTextOffset(LONG* offset) { |
| 4834 const base::string16& text, | 4852 if (*offset == IA2_TEXT_OFFSET_LENGTH) { |
| 4835 LONG* offset) { | 4853 *offset = static_cast<LONG>(GetText().length()); |
| 4836 if (*offset == IA2_TEXT_OFFSET_LENGTH) | 4854 } else if (*offset == IA2_TEXT_OFFSET_CARET) { |
| 4837 *offset = static_cast<LONG>(text.size()); | 4855 // We shouldn't call |get_caretOffset| here as it affects UMA counts. |
| 4838 else if (*offset == IA2_TEXT_OFFSET_CARET) | 4856 int selection_start, selection_end; |
| 4839 get_caretOffset(offset); | 4857 GetSelectionOffsets(&selection_start, &selection_end); |
| 4858 *offset = selection_end; | |
| 4859 } | |
| 4840 } | 4860 } |
| 4841 | 4861 |
| 4842 ui::TextBoundaryType BrowserAccessibilityWin::IA2TextBoundaryToTextBoundary( | 4862 ui::TextBoundaryType BrowserAccessibilityWin::IA2TextBoundaryToTextBoundary( |
| 4843 IA2TextBoundaryType ia2_boundary) { | 4863 IA2TextBoundaryType ia2_boundary) { |
| 4844 switch(ia2_boundary) { | 4864 switch(ia2_boundary) { |
| 4845 case IA2_TEXT_BOUNDARY_CHAR: | 4865 case IA2_TEXT_BOUNDARY_CHAR: |
| 4846 return ui::CHAR_BOUNDARY; | 4866 return ui::CHAR_BOUNDARY; |
| 4847 case IA2_TEXT_BOUNDARY_WORD: | 4867 case IA2_TEXT_BOUNDARY_WORD: |
| 4848 return ui::WORD_BOUNDARY; | 4868 return ui::WORD_BOUNDARY; |
| 4849 case IA2_TEXT_BOUNDARY_LINE: | 4869 case IA2_TEXT_BOUNDARY_LINE: |
| 4850 return ui::LINE_BOUNDARY; | 4870 return ui::LINE_BOUNDARY; |
| 4851 case IA2_TEXT_BOUNDARY_SENTENCE: | 4871 case IA2_TEXT_BOUNDARY_SENTENCE: |
| 4852 return ui::SENTENCE_BOUNDARY; | 4872 return ui::SENTENCE_BOUNDARY; |
| 4853 case IA2_TEXT_BOUNDARY_PARAGRAPH: | 4873 case IA2_TEXT_BOUNDARY_PARAGRAPH: |
| 4854 return ui::PARAGRAPH_BOUNDARY; | 4874 return ui::PARAGRAPH_BOUNDARY; |
| 4855 case IA2_TEXT_BOUNDARY_ALL: | 4875 case IA2_TEXT_BOUNDARY_ALL: |
| 4856 return ui::ALL_BOUNDARY; | 4876 return ui::ALL_BOUNDARY; |
| 4857 } | 4877 } |
| 4858 NOTREACHED(); | 4878 NOTREACHED(); |
| 4859 return ui::CHAR_BOUNDARY; | 4879 return ui::CHAR_BOUNDARY; |
| 4860 } | 4880 } |
| 4861 | 4881 |
| 4862 LONG BrowserAccessibilityWin::FindBoundary( | 4882 LONG BrowserAccessibilityWin::FindBoundary( |
| 4863 const base::string16& text, | 4883 const base::string16& text, |
| 4864 IA2TextBoundaryType ia2_boundary, | 4884 IA2TextBoundaryType ia2_boundary, |
| 4865 LONG start_offset, | 4885 LONG start_offset, |
| 4866 ui::TextBoundaryDirection direction) { | 4886 ui::TextBoundaryDirection direction) { |
| 4867 // If the boundary is relative to the caret, use the selection | 4887 // If the boundary is relative to the caret, use the selection |
| 4868 // affinity, otherwise default to downstream affinity. | 4888 // affinity, otherwise default to downstream affinity. |
| 4869 ui::AXTextAffinity affinity = | 4889 ui::AXTextAffinity affinity = start_offset == IA2_TEXT_OFFSET_CARET |
| 4870 start_offset == IA2_TEXT_OFFSET_CARET ? | 4890 ? manager_->GetTreeData().sel_focus_affinity |
| 4871 manager()->GetTreeData().sel_focus_affinity : | 4891 : ui::AX_TEXT_AFFINITY_DOWNSTREAM; |
| 4872 ui::AX_TEXT_AFFINITY_DOWNSTREAM; | |
| 4873 | 4892 |
| 4874 HandleSpecialTextOffset(text, &start_offset); | 4893 HandleSpecialTextOffset(&start_offset); |
| 4875 if (ia2_boundary == IA2_TEXT_BOUNDARY_WORD) | 4894 if (ia2_boundary == IA2_TEXT_BOUNDARY_WORD) |
| 4876 return GetWordStartBoundary(static_cast<int>(start_offset), direction); | 4895 return GetWordStartBoundary(static_cast<int>(start_offset), direction); |
| 4877 if (ia2_boundary == IA2_TEXT_BOUNDARY_LINE) { | 4896 if (ia2_boundary == IA2_TEXT_BOUNDARY_LINE) { |
| 4878 return GetLineStartBoundary( | 4897 return GetLineStartBoundary( |
| 4879 static_cast<int>(start_offset), direction, affinity); | 4898 static_cast<int>(start_offset), direction, affinity); |
| 4880 } | 4899 } |
| 4881 | 4900 |
| 4882 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); | 4901 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); |
| 4883 return ui::FindAccessibleTextBoundary(text, GetLineStartOffsets(), boundary, | 4902 return ui::FindAccessibleTextBoundary(text, GetLineStartOffsets(), boundary, |
| 4884 start_offset, direction, affinity); | 4903 start_offset, direction, affinity); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 4909 } | 4928 } |
| 4910 } | 4929 } |
| 4911 | 4930 |
| 4912 NOTREACHED(); | 4931 NOTREACHED(); |
| 4913 return start_offset; | 4932 return start_offset; |
| 4914 } | 4933 } |
| 4915 | 4934 |
| 4916 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromID(int32_t id) const { | 4935 BrowserAccessibilityWin* BrowserAccessibilityWin::GetFromID(int32_t id) const { |
| 4917 if (!instance_active()) | 4936 if (!instance_active()) |
| 4918 return nullptr; | 4937 return nullptr; |
| 4919 return ToBrowserAccessibilityWin(manager()->GetFromID(id)); | 4938 return ToBrowserAccessibilityWin(manager_->GetFromID(id)); |
| 4920 } | 4939 } |
| 4921 | 4940 |
| 4922 bool BrowserAccessibilityWin::IsListBoxOptionOrMenuListOption() { | 4941 bool BrowserAccessibilityWin::IsListBoxOptionOrMenuListOption() { |
| 4923 if (!GetParent()) | 4942 if (!GetParent()) |
| 4924 return false; | 4943 return false; |
| 4925 | 4944 |
| 4926 int32_t role = GetRole(); | 4945 int32_t role = GetRole(); |
| 4927 int32_t parent_role = GetParent()->GetRole(); | 4946 int32_t parent_role = GetParent()->GetRole(); |
| 4928 | 4947 |
| 4929 if (role == ui::AX_ROLE_LIST_BOX_OPTION && | 4948 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); | 5732 return static_cast<BrowserAccessibilityWin*>(obj); |
| 5714 } | 5733 } |
| 5715 | 5734 |
| 5716 const BrowserAccessibilityWin* | 5735 const BrowserAccessibilityWin* |
| 5717 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5736 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
| 5718 DCHECK(!obj || obj->IsNative()); | 5737 DCHECK(!obj || obj->IsNative()); |
| 5719 return static_cast<const BrowserAccessibilityWin*>(obj); | 5738 return static_cast<const BrowserAccessibilityWin*>(obj); |
| 5720 } | 5739 } |
| 5721 | 5740 |
| 5722 } // namespace content | 5741 } // namespace content |
| OLD | NEW |