OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_android.h" | 5 #include "content/browser/accessibility/browser_accessibility_android.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/browser/accessibility/browser_accessibility_manager_android.h" | 8 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
9 #include "content/common/accessibility_messages.h" | 9 #include "content/common/accessibility_messages.h" |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 BrowserAccessibilityAndroid::BrowserAccessibilityAndroid() { | 50 BrowserAccessibilityAndroid::BrowserAccessibilityAndroid() { |
51 first_time_ = true; | 51 first_time_ = true; |
52 } | 52 } |
53 | 53 |
54 bool BrowserAccessibilityAndroid::IsNative() const { | 54 bool BrowserAccessibilityAndroid::IsNative() const { |
55 return true; | 55 return true; |
56 } | 56 } |
57 | 57 |
58 bool BrowserAccessibilityAndroid::PlatformIsLeaf() const { | 58 bool BrowserAccessibilityAndroid::PlatformIsLeaf() const { |
59 if (child_count() == 0) | 59 if (InternalChildCount() == 0) |
60 return true; | 60 return true; |
61 | 61 |
62 // Iframes are always allowed to contain children. | 62 // Iframes are always allowed to contain children. |
63 if (IsIframe() || | 63 if (IsIframe() || |
64 role() == ui::AX_ROLE_ROOT_WEB_AREA || | 64 GetRole() == ui::AX_ROLE_ROOT_WEB_AREA || |
65 role() == ui::AX_ROLE_WEB_AREA) { | 65 GetRole() == ui::AX_ROLE_WEB_AREA) { |
66 return false; | 66 return false; |
67 } | 67 } |
68 | 68 |
69 // If it has a focusable child, we definitely can't leave out children. | 69 // If it has a focusable child, we definitely can't leave out children. |
70 if (HasFocusableChild()) | 70 if (HasFocusableChild()) |
71 return false; | 71 return false; |
72 | 72 |
73 // Headings with text can drop their children. | 73 // Headings with text can drop their children. |
74 base::string16 name = GetText(); | 74 base::string16 name = GetText(); |
75 if (role() == ui::AX_ROLE_HEADING && !name.empty()) | 75 if (GetRole() == ui::AX_ROLE_HEADING && !name.empty()) |
76 return true; | 76 return true; |
77 | 77 |
78 // Focusable nodes with text can drop their children. | 78 // Focusable nodes with text can drop their children. |
79 if (HasState(ui::AX_STATE_FOCUSABLE) && !name.empty()) | 79 if (HasState(ui::AX_STATE_FOCUSABLE) && !name.empty()) |
80 return true; | 80 return true; |
81 | 81 |
82 // Nodes with only static text as children can drop their children. | 82 // Nodes with only static text as children can drop their children. |
83 if (HasOnlyStaticTextChildren()) | 83 if (HasOnlyStaticTextChildren()) |
84 return true; | 84 return true; |
85 | 85 |
86 return BrowserAccessibility::PlatformIsLeaf(); | 86 return BrowserAccessibility::PlatformIsLeaf(); |
87 } | 87 } |
88 | 88 |
89 bool BrowserAccessibilityAndroid::IsCheckable() const { | 89 bool BrowserAccessibilityAndroid::IsCheckable() const { |
90 bool checkable = false; | 90 bool checkable = false; |
91 bool is_aria_pressed_defined; | 91 bool is_aria_pressed_defined; |
92 bool is_mixed; | 92 bool is_mixed; |
93 GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed); | 93 GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed); |
94 if (role() == ui::AX_ROLE_CHECK_BOX || | 94 if (GetRole() == ui::AX_ROLE_CHECK_BOX || |
95 role() == ui::AX_ROLE_RADIO_BUTTON || | 95 GetRole() == ui::AX_ROLE_RADIO_BUTTON || |
96 is_aria_pressed_defined) { | 96 is_aria_pressed_defined) { |
97 checkable = true; | 97 checkable = true; |
98 } | 98 } |
99 if (HasState(ui::AX_STATE_CHECKED)) | 99 if (HasState(ui::AX_STATE_CHECKED)) |
100 checkable = true; | 100 checkable = true; |
101 return checkable; | 101 return checkable; |
102 } | 102 } |
103 | 103 |
104 bool BrowserAccessibilityAndroid::IsChecked() const { | 104 bool BrowserAccessibilityAndroid::IsChecked() const { |
105 return HasState(ui::AX_STATE_CHECKED); | 105 return HasState(ui::AX_STATE_CHECKED); |
106 } | 106 } |
107 | 107 |
108 bool BrowserAccessibilityAndroid::IsClickable() const { | 108 bool BrowserAccessibilityAndroid::IsClickable() const { |
109 return (PlatformIsLeaf() && !GetText().empty()); | 109 return (PlatformIsLeaf() && !GetText().empty()); |
110 } | 110 } |
111 | 111 |
112 bool BrowserAccessibilityAndroid::IsCollection() const { | 112 bool BrowserAccessibilityAndroid::IsCollection() const { |
113 return (role() == ui::AX_ROLE_GRID || | 113 return (GetRole() == ui::AX_ROLE_GRID || |
114 role() == ui::AX_ROLE_LIST || | 114 GetRole() == ui::AX_ROLE_LIST || |
115 role() == ui::AX_ROLE_LIST_BOX || | 115 GetRole() == ui::AX_ROLE_LIST_BOX || |
116 role() == ui::AX_ROLE_TABLE || | 116 GetRole() == ui::AX_ROLE_TABLE || |
117 role() == ui::AX_ROLE_TREE); | 117 GetRole() == ui::AX_ROLE_TREE); |
118 } | 118 } |
119 | 119 |
120 bool BrowserAccessibilityAndroid::IsCollectionItem() const { | 120 bool BrowserAccessibilityAndroid::IsCollectionItem() const { |
121 return (role() == ui::AX_ROLE_CELL || | 121 return (GetRole() == ui::AX_ROLE_CELL || |
122 role() == ui::AX_ROLE_COLUMN_HEADER || | 122 GetRole() == ui::AX_ROLE_COLUMN_HEADER || |
123 role() == ui::AX_ROLE_DESCRIPTION_LIST_TERM || | 123 GetRole() == ui::AX_ROLE_DESCRIPTION_LIST_TERM || |
124 role() == ui::AX_ROLE_LIST_BOX_OPTION || | 124 GetRole() == ui::AX_ROLE_LIST_BOX_OPTION || |
125 role() == ui::AX_ROLE_LIST_ITEM || | 125 GetRole() == ui::AX_ROLE_LIST_ITEM || |
126 role() == ui::AX_ROLE_ROW_HEADER || | 126 GetRole() == ui::AX_ROLE_ROW_HEADER || |
127 role() == ui::AX_ROLE_TREE_ITEM); | 127 GetRole() == ui::AX_ROLE_TREE_ITEM); |
128 } | 128 } |
129 | 129 |
130 bool BrowserAccessibilityAndroid::IsContentInvalid() const { | 130 bool BrowserAccessibilityAndroid::IsContentInvalid() const { |
131 std::string invalid; | 131 std::string invalid; |
132 return GetHtmlAttribute("aria-invalid", &invalid); | 132 return GetHtmlAttribute("aria-invalid", &invalid); |
133 } | 133 } |
134 | 134 |
135 bool BrowserAccessibilityAndroid::IsDismissable() const { | 135 bool BrowserAccessibilityAndroid::IsDismissable() const { |
136 return false; // No concept of "dismissable" on the web currently. | 136 return false; // No concept of "dismissable" on the web currently. |
137 } | 137 } |
138 | 138 |
139 bool BrowserAccessibilityAndroid::IsEnabled() const { | 139 bool BrowserAccessibilityAndroid::IsEnabled() const { |
140 return HasState(ui::AX_STATE_ENABLED); | 140 return HasState(ui::AX_STATE_ENABLED); |
141 } | 141 } |
142 | 142 |
143 bool BrowserAccessibilityAndroid::IsFocusable() const { | 143 bool BrowserAccessibilityAndroid::IsFocusable() const { |
144 bool focusable = HasState(ui::AX_STATE_FOCUSABLE); | 144 bool focusable = HasState(ui::AX_STATE_FOCUSABLE); |
145 if (IsIframe() || | 145 if (IsIframe() || |
146 role() == ui::AX_ROLE_WEB_AREA) { | 146 GetRole() == ui::AX_ROLE_WEB_AREA) { |
147 focusable = false; | 147 focusable = false; |
148 } | 148 } |
149 return focusable; | 149 return focusable; |
150 } | 150 } |
151 | 151 |
152 bool BrowserAccessibilityAndroid::IsFocused() const { | 152 bool BrowserAccessibilityAndroid::IsFocused() const { |
153 return manager()->GetFocus(manager()->GetRoot()) == this; | 153 return manager()->GetFocus(manager()->GetRoot()) == this; |
154 } | 154 } |
155 | 155 |
156 bool BrowserAccessibilityAndroid::IsHeading() const { | 156 bool BrowserAccessibilityAndroid::IsHeading() const { |
157 return (role() == ui::AX_ROLE_COLUMN_HEADER || | 157 return (GetRole() == ui::AX_ROLE_COLUMN_HEADER || |
158 role() == ui::AX_ROLE_HEADING || | 158 GetRole() == ui::AX_ROLE_HEADING || |
159 role() == ui::AX_ROLE_ROW_HEADER); | 159 GetRole() == ui::AX_ROLE_ROW_HEADER); |
160 } | 160 } |
161 | 161 |
162 bool BrowserAccessibilityAndroid::IsHierarchical() const { | 162 bool BrowserAccessibilityAndroid::IsHierarchical() const { |
163 return (role() == ui::AX_ROLE_LIST || | 163 return (GetRole() == ui::AX_ROLE_LIST || |
164 role() == ui::AX_ROLE_TREE); | 164 GetRole() == ui::AX_ROLE_TREE); |
165 } | 165 } |
166 | 166 |
167 bool BrowserAccessibilityAndroid::IsLink() const { | 167 bool BrowserAccessibilityAndroid::IsLink() const { |
168 return role() == ui::AX_ROLE_LINK || role() == ui::AX_ROLE_IMAGE_MAP_LINK; | 168 return GetRole() == ui::AX_ROLE_LINK || GetRole() == ui::AX_ROLE_IMAGE_MAP_LIN
K; |
169 } | 169 } |
170 | 170 |
171 bool BrowserAccessibilityAndroid::IsMultiLine() const { | 171 bool BrowserAccessibilityAndroid::IsMultiLine() const { |
172 return role() == ui::AX_ROLE_TEXT_AREA; | 172 return GetRole() == ui::AX_ROLE_TEXT_AREA; |
173 } | 173 } |
174 | 174 |
175 bool BrowserAccessibilityAndroid::IsPassword() const { | 175 bool BrowserAccessibilityAndroid::IsPassword() const { |
176 return HasState(ui::AX_STATE_PROTECTED); | 176 return HasState(ui::AX_STATE_PROTECTED); |
177 } | 177 } |
178 | 178 |
179 bool BrowserAccessibilityAndroid::IsRangeType() const { | 179 bool BrowserAccessibilityAndroid::IsRangeType() const { |
180 return (role() == ui::AX_ROLE_PROGRESS_INDICATOR || | 180 return (GetRole() == ui::AX_ROLE_PROGRESS_INDICATOR || |
181 role() == ui::AX_ROLE_SCROLL_BAR || | 181 GetRole() == ui::AX_ROLE_SCROLL_BAR || |
182 role() == ui::AX_ROLE_SLIDER); | 182 GetRole() == ui::AX_ROLE_SLIDER); |
183 } | 183 } |
184 | 184 |
185 bool BrowserAccessibilityAndroid::IsScrollable() const { | 185 bool BrowserAccessibilityAndroid::IsScrollable() const { |
186 int dummy; | 186 int dummy; |
187 return GetIntAttribute(ui::AX_ATTR_SCROLL_X_MAX, &dummy); | 187 return GetIntAttribute(ui::AX_ATTR_SCROLL_X_MAX, &dummy); |
188 } | 188 } |
189 | 189 |
190 bool BrowserAccessibilityAndroid::IsSelected() const { | 190 bool BrowserAccessibilityAndroid::IsSelected() const { |
191 return HasState(ui::AX_STATE_SELECTED); | 191 return HasState(ui::AX_STATE_SELECTED); |
192 } | 192 } |
193 | 193 |
194 bool BrowserAccessibilityAndroid::IsVisibleToUser() const { | 194 bool BrowserAccessibilityAndroid::IsVisibleToUser() const { |
195 return !HasState(ui::AX_STATE_INVISIBLE); | 195 return !HasState(ui::AX_STATE_INVISIBLE); |
196 } | 196 } |
197 | 197 |
198 bool BrowserAccessibilityAndroid::CanOpenPopup() const { | 198 bool BrowserAccessibilityAndroid::CanOpenPopup() const { |
199 return HasState(ui::AX_STATE_HASPOPUP); | 199 return HasState(ui::AX_STATE_HASPOPUP); |
200 } | 200 } |
201 | 201 |
202 const char* BrowserAccessibilityAndroid::GetClassName() const { | 202 const char* BrowserAccessibilityAndroid::GetClassName() const { |
203 const char* class_name = NULL; | 203 const char* class_name = NULL; |
204 | 204 |
205 switch(role()) { | 205 switch(GetRole()) { |
206 case ui::AX_ROLE_EDITABLE_TEXT: | 206 case ui::AX_ROLE_EDITABLE_TEXT: |
207 case ui::AX_ROLE_SPIN_BUTTON: | 207 case ui::AX_ROLE_SPIN_BUTTON: |
208 case ui::AX_ROLE_TEXT_AREA: | 208 case ui::AX_ROLE_TEXT_AREA: |
209 case ui::AX_ROLE_TEXT_FIELD: | 209 case ui::AX_ROLE_TEXT_FIELD: |
210 class_name = "android.widget.EditText"; | 210 class_name = "android.widget.EditText"; |
211 break; | 211 break; |
212 case ui::AX_ROLE_SLIDER: | 212 case ui::AX_ROLE_SLIDER: |
213 class_name = "android.widget.SeekBar"; | 213 class_name = "android.widget.SeekBar"; |
214 break; | 214 break; |
215 case ui::AX_ROLE_COMBO_BOX: | 215 case ui::AX_ROLE_COMBO_BOX: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 default: | 256 default: |
257 class_name = "android.view.View"; | 257 class_name = "android.view.View"; |
258 break; | 258 break; |
259 } | 259 } |
260 | 260 |
261 return class_name; | 261 return class_name; |
262 } | 262 } |
263 | 263 |
264 base::string16 BrowserAccessibilityAndroid::GetText() const { | 264 base::string16 BrowserAccessibilityAndroid::GetText() const { |
265 if (IsIframe() || | 265 if (IsIframe() || |
266 role() == ui::AX_ROLE_WEB_AREA) { | 266 GetRole() == ui::AX_ROLE_WEB_AREA) { |
267 return base::string16(); | 267 return base::string16(); |
268 } | 268 } |
269 | 269 |
270 base::string16 description = GetString16Attribute( | 270 base::string16 description = GetString16Attribute( |
271 ui::AX_ATTR_DESCRIPTION); | 271 ui::AX_ATTR_DESCRIPTION); |
272 base::string16 text; | 272 base::string16 text; |
273 if (!name().empty()) | 273 if (!name().empty()) |
274 text = base::UTF8ToUTF16(name()); | 274 text = base::UTF8ToUTF16(name()); |
275 else if (!description.empty()) | 275 else if (!description.empty()) |
276 text = description; | 276 text = description; |
277 else if (!value().empty()) | 277 else if (!value().empty()) |
278 text = base::UTF8ToUTF16(value()); | 278 text = base::UTF8ToUTF16(value()); |
279 | 279 |
280 // This is called from PlatformIsLeaf, so don't call PlatformChildCount | 280 // This is called from PlatformIsLeaf, so don't call PlatformChildCount |
281 // from within this! | 281 // from within this! |
282 if (text.empty() && HasOnlyStaticTextChildren()) { | 282 if (text.empty() && HasOnlyStaticTextChildren()) { |
283 for (uint32 i = 0; i < child_count(); i++) { | 283 for (uint32 i = 0; i < InternalChildCount(); i++) { |
284 BrowserAccessibility* child = children()[i]; | 284 BrowserAccessibility* child = InternalGetChild(i); |
285 text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText(); | 285 text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText(); |
286 } | 286 } |
287 } | 287 } |
288 | 288 |
289 switch(role()) { | 289 switch(GetRole()) { |
290 case ui::AX_ROLE_HEADING: | 290 case ui::AX_ROLE_HEADING: |
291 // Only append "heading" if this node already has text. | 291 // Only append "heading" if this node already has text. |
292 if (!text.empty()) | 292 if (!text.empty()) |
293 text += base::ASCIIToUTF16(" Heading"); | 293 text += base::ASCIIToUTF16(" Heading"); |
294 break; | 294 break; |
295 } | 295 } |
296 | 296 |
297 return text; | 297 return text; |
298 } | 298 } |
299 | 299 |
300 int BrowserAccessibilityAndroid::GetItemIndex() const { | 300 int BrowserAccessibilityAndroid::GetItemIndex() const { |
301 int index = 0; | 301 int index = 0; |
302 switch(role()) { | 302 switch(GetRole()) { |
303 case ui::AX_ROLE_LIST_ITEM: | 303 case ui::AX_ROLE_LIST_ITEM: |
304 case ui::AX_ROLE_LIST_BOX_OPTION: | 304 case ui::AX_ROLE_LIST_BOX_OPTION: |
305 case ui::AX_ROLE_TREE_ITEM: | 305 case ui::AX_ROLE_TREE_ITEM: |
306 index = index_in_parent(); | 306 index = GetIndexInParent(); |
307 break; | 307 break; |
308 case ui::AX_ROLE_SLIDER: | 308 case ui::AX_ROLE_SLIDER: |
309 case ui::AX_ROLE_PROGRESS_INDICATOR: { | 309 case ui::AX_ROLE_PROGRESS_INDICATOR: { |
310 float value_for_range; | 310 float value_for_range; |
311 if (GetFloatAttribute( | 311 if (GetFloatAttribute( |
312 ui::AX_ATTR_VALUE_FOR_RANGE, &value_for_range)) { | 312 ui::AX_ATTR_VALUE_FOR_RANGE, &value_for_range)) { |
313 index = static_cast<int>(value_for_range); | 313 index = static_cast<int>(value_for_range); |
314 } | 314 } |
315 break; | 315 break; |
316 } | 316 } |
317 } | 317 } |
318 return index; | 318 return index; |
319 } | 319 } |
320 | 320 |
321 int BrowserAccessibilityAndroid::GetItemCount() const { | 321 int BrowserAccessibilityAndroid::GetItemCount() const { |
322 int count = 0; | 322 int count = 0; |
323 switch(role()) { | 323 switch(GetRole()) { |
324 case ui::AX_ROLE_LIST: | 324 case ui::AX_ROLE_LIST: |
325 case ui::AX_ROLE_LIST_BOX: | 325 case ui::AX_ROLE_LIST_BOX: |
326 count = PlatformChildCount(); | 326 count = PlatformChildCount(); |
327 break; | 327 break; |
328 case ui::AX_ROLE_SLIDER: | 328 case ui::AX_ROLE_SLIDER: |
329 case ui::AX_ROLE_PROGRESS_INDICATOR: { | 329 case ui::AX_ROLE_PROGRESS_INDICATOR: { |
330 float max_value_for_range; | 330 float max_value_for_range; |
331 if (GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, | 331 if (GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, |
332 &max_value_for_range)) { | 332 &max_value_for_range)) { |
333 count = static_cast<int>(max_value_for_range); | 333 count = static_cast<int>(max_value_for_range); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 else if (live == "assertive") | 472 else if (live == "assertive") |
473 return ANDROID_VIEW_VIEW_ACCESSIBILITY_LIVE_REGION_ASSERTIVE; | 473 return ANDROID_VIEW_VIEW_ACCESSIBILITY_LIVE_REGION_ASSERTIVE; |
474 return ANDROID_VIEW_VIEW_ACCESSIBILITY_LIVE_REGION_NONE; | 474 return ANDROID_VIEW_VIEW_ACCESSIBILITY_LIVE_REGION_NONE; |
475 } | 475 } |
476 | 476 |
477 int BrowserAccessibilityAndroid::AndroidRangeType() const { | 477 int BrowserAccessibilityAndroid::AndroidRangeType() const { |
478 return ANDROID_VIEW_ACCESSIBILITY_RANGE_TYPE_FLOAT; | 478 return ANDROID_VIEW_ACCESSIBILITY_RANGE_TYPE_FLOAT; |
479 } | 479 } |
480 | 480 |
481 int BrowserAccessibilityAndroid::RowCount() const { | 481 int BrowserAccessibilityAndroid::RowCount() const { |
482 if (role() == ui::AX_ROLE_GRID || | 482 if (GetRole() == ui::AX_ROLE_GRID || |
483 role() == ui::AX_ROLE_TABLE) { | 483 GetRole() == ui::AX_ROLE_TABLE) { |
484 return CountChildrenWithRole(ui::AX_ROLE_ROW); | 484 return CountChildrenWithRole(ui::AX_ROLE_ROW); |
485 } | 485 } |
486 | 486 |
487 if (role() == ui::AX_ROLE_LIST || | 487 if (GetRole() == ui::AX_ROLE_LIST || |
488 role() == ui::AX_ROLE_LIST_BOX || | 488 GetRole() == ui::AX_ROLE_LIST_BOX || |
489 role() == ui::AX_ROLE_TREE) { | 489 GetRole() == ui::AX_ROLE_TREE) { |
490 return PlatformChildCount(); | 490 return PlatformChildCount(); |
491 } | 491 } |
492 | 492 |
493 return 0; | 493 return 0; |
494 } | 494 } |
495 | 495 |
496 int BrowserAccessibilityAndroid::ColumnCount() const { | 496 int BrowserAccessibilityAndroid::ColumnCount() const { |
497 if (role() == ui::AX_ROLE_GRID || | 497 if (GetRole() == ui::AX_ROLE_GRID || |
498 role() == ui::AX_ROLE_TABLE) { | 498 GetRole() == ui::AX_ROLE_TABLE) { |
499 return CountChildrenWithRole(ui::AX_ROLE_COLUMN); | 499 return CountChildrenWithRole(ui::AX_ROLE_COLUMN); |
500 } | 500 } |
501 return 0; | 501 return 0; |
502 } | 502 } |
503 | 503 |
504 int BrowserAccessibilityAndroid::RowIndex() const { | 504 int BrowserAccessibilityAndroid::RowIndex() const { |
505 if (role() == ui::AX_ROLE_LIST_ITEM || | 505 if (GetRole() == ui::AX_ROLE_LIST_ITEM || |
506 role() == ui::AX_ROLE_LIST_BOX_OPTION || | 506 GetRole() == ui::AX_ROLE_LIST_BOX_OPTION || |
507 role() == ui::AX_ROLE_TREE_ITEM) { | 507 GetRole() == ui::AX_ROLE_TREE_ITEM) { |
508 return index_in_parent(); | 508 return GetIndexInParent(); |
509 } | 509 } |
510 | 510 |
511 return GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX); | 511 return GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX); |
512 } | 512 } |
513 | 513 |
514 int BrowserAccessibilityAndroid::RowSpan() const { | 514 int BrowserAccessibilityAndroid::RowSpan() const { |
515 return GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_SPAN); | 515 return GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_SPAN); |
516 } | 516 } |
517 | 517 |
518 int BrowserAccessibilityAndroid::ColumnIndex() const { | 518 int BrowserAccessibilityAndroid::ColumnIndex() const { |
(...skipping 12 matching lines...) Expand all Loading... |
531 return GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE); | 531 return GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE); |
532 } | 532 } |
533 | 533 |
534 float BrowserAccessibilityAndroid::RangeCurrentValue() const { | 534 float BrowserAccessibilityAndroid::RangeCurrentValue() const { |
535 return GetFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE); | 535 return GetFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE); |
536 } | 536 } |
537 | 537 |
538 bool BrowserAccessibilityAndroid::HasFocusableChild() const { | 538 bool BrowserAccessibilityAndroid::HasFocusableChild() const { |
539 // This is called from PlatformIsLeaf, so don't call PlatformChildCount | 539 // This is called from PlatformIsLeaf, so don't call PlatformChildCount |
540 // from within this! | 540 // from within this! |
541 for (uint32 i = 0; i < child_count(); i++) { | 541 for (uint32 i = 0; i < InternalChildCount(); i++) { |
542 BrowserAccessibility* child = children()[i]; | 542 BrowserAccessibility* child = InternalGetChild(i); |
543 if (child->HasState(ui::AX_STATE_FOCUSABLE)) | 543 if (child->HasState(ui::AX_STATE_FOCUSABLE)) |
544 return true; | 544 return true; |
545 if (static_cast<BrowserAccessibilityAndroid*>(child)->HasFocusableChild()) | 545 if (static_cast<BrowserAccessibilityAndroid*>(child)->HasFocusableChild()) |
546 return true; | 546 return true; |
547 } | 547 } |
548 return false; | 548 return false; |
549 } | 549 } |
550 | 550 |
551 bool BrowserAccessibilityAndroid::HasOnlyStaticTextChildren() const { | 551 bool BrowserAccessibilityAndroid::HasOnlyStaticTextChildren() const { |
552 // This is called from PlatformIsLeaf, so don't call PlatformChildCount | 552 // This is called from PlatformIsLeaf, so don't call PlatformChildCount |
553 // from within this! | 553 // from within this! |
554 for (uint32 i = 0; i < child_count(); i++) { | 554 for (uint32 i = 0; i < InternalChildCount(); i++) { |
555 BrowserAccessibility* child = children()[i]; | 555 BrowserAccessibility* child = InternalGetChild(i); |
556 if (child->role() != ui::AX_ROLE_STATIC_TEXT) | 556 if (child->GetRole() != ui::AX_ROLE_STATIC_TEXT) |
557 return false; | 557 return false; |
558 } | 558 } |
559 return true; | 559 return true; |
560 } | 560 } |
561 | 561 |
562 bool BrowserAccessibilityAndroid::IsIframe() const { | 562 bool BrowserAccessibilityAndroid::IsIframe() const { |
563 base::string16 html_tag = GetString16Attribute( | 563 base::string16 html_tag = GetString16Attribute( |
564 ui::AX_ATTR_HTML_TAG); | 564 ui::AX_ATTR_HTML_TAG); |
565 return html_tag == base::ASCIIToUTF16("iframe"); | 565 return html_tag == base::ASCIIToUTF16("iframe"); |
566 } | 566 } |
567 | 567 |
568 void BrowserAccessibilityAndroid::PostInitialize() { | 568 void BrowserAccessibilityAndroid::PostInitialize() { |
569 BrowserAccessibility::PostInitialize(); | 569 BrowserAccessibility::PostInitialize(); |
570 | 570 |
571 if (IsEditableText()) { | 571 if (IsEditableText()) { |
572 if (base::UTF8ToUTF16(value()) != new_value_) { | 572 if (base::UTF8ToUTF16(value()) != new_value_) { |
573 old_value_ = new_value_; | 573 old_value_ = new_value_; |
574 new_value_ = base::UTF8ToUTF16(value()); | 574 new_value_ = base::UTF8ToUTF16(value()); |
575 } | 575 } |
576 } | 576 } |
577 | 577 |
578 if (role() == ui::AX_ROLE_ALERT && first_time_) | 578 if (GetRole() == ui::AX_ROLE_ALERT && first_time_) |
579 manager()->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, this); | 579 manager()->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, this); |
580 | 580 |
581 base::string16 live; | 581 base::string16 live; |
582 if (GetString16Attribute( | 582 if (GetString16Attribute( |
583 ui::AX_ATTR_CONTAINER_LIVE_STATUS, &live)) { | 583 ui::AX_ATTR_CONTAINER_LIVE_STATUS, &live)) { |
584 NotifyLiveRegionUpdate(live); | 584 NotifyLiveRegionUpdate(live); |
585 } | 585 } |
586 | 586 |
587 first_time_ = false; | 587 first_time_ = false; |
588 } | 588 } |
(...skipping 10 matching lines...) Expand all Loading... |
599 manager()->NotifyAccessibilityEvent(ui::AX_EVENT_SHOW, | 599 manager()->NotifyAccessibilityEvent(ui::AX_EVENT_SHOW, |
600 this); | 600 this); |
601 } | 601 } |
602 cached_text_ = text; | 602 cached_text_ = text; |
603 } | 603 } |
604 } | 604 } |
605 | 605 |
606 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { | 606 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { |
607 int count = 0; | 607 int count = 0; |
608 for (uint32 i = 0; i < PlatformChildCount(); i++) { | 608 for (uint32 i = 0; i < PlatformChildCount(); i++) { |
609 if (PlatformGetChild(i)->role() == role) | 609 if (PlatformGetChild(i)->GetRole() == role) |
610 count++; | 610 count++; |
611 } | 611 } |
612 return count; | 612 return count; |
613 } | 613 } |
614 | 614 |
615 } // namespace content | 615 } // namespace content |
OLD | NEW |