OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/accessibility/native_view_accessibility_win.h" | 5 #include "views/accessibility/native_view_accessibility_win.h" |
6 | 6 |
7 #include "ui/base/accessibility/accessible_view_state.h" | 7 #include "ui/base/accessibility/accessible_view_state.h" |
8 #include "ui/base/view_prop.h" | 8 #include "ui/base/view_prop.h" |
9 #include "views/controls/button/native_button.h" | 9 #include "views/controls/button/native_button.h" |
10 #include "views/widget/native_widget_win.h" | 10 #include "views/widget/native_widget_win.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } else if (!view_->has_children()) { | 120 } else if (!view_->has_children()) { |
121 // No children found. | 121 // No children found. |
122 return S_FALSE; | 122 return S_FALSE; |
123 } | 123 } |
124 | 124 |
125 // Set child_id based on first or last child. | 125 // Set child_id based on first or last child. |
126 int child_id = 0; | 126 int child_id = 0; |
127 if (nav_dir == NAVDIR_LASTCHILD) | 127 if (nav_dir == NAVDIR_LASTCHILD) |
128 child_id = view_->child_count() - 1; | 128 child_id = view_->child_count() - 1; |
129 | 129 |
130 views::View* child = view_->GetChildViewAt(child_id); | 130 views::View* child = view_->child_at(child_id); |
131 end->vt = VT_DISPATCH; | 131 end->vt = VT_DISPATCH; |
132 end->pdispVal = child->GetNativeViewAccessible(); | 132 end->pdispVal = child->GetNativeViewAccessible(); |
133 end->pdispVal->AddRef(); | 133 end->pdispVal->AddRef(); |
134 return S_OK; | 134 return S_OK; |
135 } | 135 } |
136 case NAVDIR_LEFT: | 136 case NAVDIR_LEFT: |
137 case NAVDIR_UP: | 137 case NAVDIR_UP: |
138 case NAVDIR_PREVIOUS: | 138 case NAVDIR_PREVIOUS: |
139 case NAVDIR_RIGHT: | 139 case NAVDIR_RIGHT: |
140 case NAVDIR_DOWN: | 140 case NAVDIR_DOWN: |
(...skipping 14 matching lines...) Expand all Loading... |
155 end->vt = VT_EMPTY; | 155 end->vt = VT_EMPTY; |
156 return S_FALSE; | 156 return S_FALSE; |
157 } else { | 157 } else { |
158 if (IsNavDirNext(nav_dir)) { | 158 if (IsNavDirNext(nav_dir)) { |
159 view_index += 1; | 159 view_index += 1; |
160 } else { | 160 } else { |
161 view_index -=1; | 161 view_index -=1; |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 views::View* child = parent->GetChildViewAt(view_index); | 165 views::View* child = parent->child_at(view_index); |
166 end->pdispVal = child->GetNativeViewAccessible(); | 166 end->pdispVal = child->GetNativeViewAccessible(); |
167 end->vt = VT_DISPATCH; | 167 end->vt = VT_DISPATCH; |
168 end->pdispVal->AddRef(); | 168 end->pdispVal->AddRef(); |
169 return S_OK; | 169 return S_OK; |
170 } else { | 170 } else { |
171 // Check navigation bounds, adjusting for MSAA child indexing (MSAA | 171 // Check navigation bounds, adjusting for MSAA child indexing (MSAA |
172 // child indexing starts with 1, whereas View indexing starts with 0). | 172 // child indexing starts with 1, whereas View indexing starts with 0). |
173 if (!IsValidNav(nav_dir, start.lVal, 0, parent->child_count() + 1)) { | 173 if (!IsValidNav(nav_dir, start.lVal, 0, parent->child_count() + 1)) { |
174 // Navigation attempted to go out-of-bounds. | 174 // Navigation attempted to go out-of-bounds. |
175 end->vt = VT_EMPTY; | 175 end->vt = VT_EMPTY; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 if (child_id == CHILDID_SELF) { | 217 if (child_id == CHILDID_SELF) { |
218 // Remain with the same dispatch. | 218 // Remain with the same dispatch. |
219 return S_OK; | 219 return S_OK; |
220 } | 220 } |
221 | 221 |
222 views::View* child_view = NULL; | 222 views::View* child_view = NULL; |
223 if (child_id > 0) { | 223 if (child_id > 0) { |
224 int child_id_as_index = child_id - 1; | 224 int child_id_as_index = child_id - 1; |
225 if (child_id_as_index < view_->child_count()) { | 225 if (child_id_as_index < view_->child_count()) { |
226 // Note: child_id is a one based index when indexing children. | 226 // Note: child_id is a one based index when indexing children. |
227 child_view = view_->GetChildViewAt(child_id_as_index); | 227 child_view = view_->child_at(child_id_as_index); |
228 } else { | 228 } else { |
229 // Attempt to retrieve a child view with the specified id. | 229 // Attempt to retrieve a child view with the specified id. |
230 child_view = view_->GetViewByID(child_id); | 230 child_view = view_->GetViewByID(child_id); |
231 } | 231 } |
232 } else { | 232 } else { |
233 // Negative values are used for events fired using the view's | 233 // Negative values are used for events fired using the view's |
234 // NativeWidgetWin. | 234 // NativeWidgetWin. |
235 views::NativeWidgetWin* widget = static_cast<views::NativeWidgetWin*>( | 235 views::NativeWidgetWin* widget = static_cast<views::NativeWidgetWin*>( |
236 view_->GetWidget()->native_widget()); | 236 view_->GetWidget()->native_widget()); |
237 child_view = widget->GetAccessibilityViewEventAt(child_id); | 237 child_view = widget->GetAccessibilityViewEventAt(child_id); |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 if (state & AccessibilityTypes::STATE_READONLY) | 692 if (state & AccessibilityTypes::STATE_READONLY) |
693 msaa_state |= STATE_SYSTEM_READONLY; | 693 msaa_state |= STATE_SYSTEM_READONLY; |
694 if (state & AccessibilityTypes::STATE_SELECTED) | 694 if (state & AccessibilityTypes::STATE_SELECTED) |
695 msaa_state |= STATE_SYSTEM_SELECTED; | 695 msaa_state |= STATE_SYSTEM_SELECTED; |
696 if (state & AccessibilityTypes::STATE_FOCUSED) | 696 if (state & AccessibilityTypes::STATE_FOCUSED) |
697 msaa_state |= STATE_SYSTEM_FOCUSED; | 697 msaa_state |= STATE_SYSTEM_FOCUSED; |
698 if (state & AccessibilityTypes::STATE_UNAVAILABLE) | 698 if (state & AccessibilityTypes::STATE_UNAVAILABLE) |
699 msaa_state |= STATE_SYSTEM_UNAVAILABLE; | 699 msaa_state |= STATE_SYSTEM_UNAVAILABLE; |
700 return msaa_state; | 700 return msaa_state; |
701 } | 701 } |
OLD | NEW |