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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 110 } |
111 | 111 |
112 bool BrowserAccessibilityAndroid::IsClickable() const { | 112 bool BrowserAccessibilityAndroid::IsClickable() const { |
113 return (PlatformIsLeaf() && !GetText().empty()); | 113 return (PlatformIsLeaf() && !GetText().empty()); |
114 } | 114 } |
115 | 115 |
116 bool BrowserAccessibilityAndroid::IsCollection() const { | 116 bool BrowserAccessibilityAndroid::IsCollection() const { |
117 return (GetRole() == ui::AX_ROLE_GRID || | 117 return (GetRole() == ui::AX_ROLE_GRID || |
118 GetRole() == ui::AX_ROLE_LIST || | 118 GetRole() == ui::AX_ROLE_LIST || |
119 GetRole() == ui::AX_ROLE_LIST_BOX || | 119 GetRole() == ui::AX_ROLE_LIST_BOX || |
| 120 GetRole() == ui::AX_ROLE_DESCRIPTION_LIST || |
120 GetRole() == ui::AX_ROLE_TABLE || | 121 GetRole() == ui::AX_ROLE_TABLE || |
121 GetRole() == ui::AX_ROLE_TREE); | 122 GetRole() == ui::AX_ROLE_TREE); |
122 } | 123 } |
123 | 124 |
124 bool BrowserAccessibilityAndroid::IsCollectionItem() const { | 125 bool BrowserAccessibilityAndroid::IsCollectionItem() const { |
125 return (GetRole() == ui::AX_ROLE_CELL || | 126 return (GetRole() == ui::AX_ROLE_CELL || |
126 GetRole() == ui::AX_ROLE_COLUMN_HEADER || | 127 GetRole() == ui::AX_ROLE_COLUMN_HEADER || |
127 GetRole() == ui::AX_ROLE_DESCRIPTION_LIST_TERM || | 128 GetRole() == ui::AX_ROLE_DESCRIPTION_LIST_TERM || |
128 GetRole() == ui::AX_ROLE_LIST_BOX_OPTION || | 129 GetRole() == ui::AX_ROLE_LIST_BOX_OPTION || |
129 GetRole() == ui::AX_ROLE_LIST_ITEM || | 130 GetRole() == ui::AX_ROLE_LIST_ITEM || |
(...skipping 28 matching lines...) Expand all Loading... |
158 } | 159 } |
159 | 160 |
160 bool BrowserAccessibilityAndroid::IsHeading() const { | 161 bool BrowserAccessibilityAndroid::IsHeading() const { |
161 return (GetRole() == ui::AX_ROLE_COLUMN_HEADER || | 162 return (GetRole() == ui::AX_ROLE_COLUMN_HEADER || |
162 GetRole() == ui::AX_ROLE_HEADING || | 163 GetRole() == ui::AX_ROLE_HEADING || |
163 GetRole() == ui::AX_ROLE_ROW_HEADER); | 164 GetRole() == ui::AX_ROLE_ROW_HEADER); |
164 } | 165 } |
165 | 166 |
166 bool BrowserAccessibilityAndroid::IsHierarchical() const { | 167 bool BrowserAccessibilityAndroid::IsHierarchical() const { |
167 return (GetRole() == ui::AX_ROLE_LIST || | 168 return (GetRole() == ui::AX_ROLE_LIST || |
| 169 GetRole() == ui::AX_ROLE_DESCRIPTION_LIST || |
168 GetRole() == ui::AX_ROLE_TREE); | 170 GetRole() == ui::AX_ROLE_TREE); |
169 } | 171 } |
170 | 172 |
171 bool BrowserAccessibilityAndroid::IsLink() const { | 173 bool BrowserAccessibilityAndroid::IsLink() const { |
172 return GetRole() == ui::AX_ROLE_LINK || | 174 return GetRole() == ui::AX_ROLE_LINK || |
173 GetRole() == ui::AX_ROLE_IMAGE_MAP_LINK; | 175 GetRole() == ui::AX_ROLE_IMAGE_MAP_LINK; |
174 } | 176 } |
175 | 177 |
176 bool BrowserAccessibilityAndroid::IsMultiLine() const { | 178 bool BrowserAccessibilityAndroid::IsMultiLine() const { |
177 return GetRole() == ui::AX_ROLE_TEXT_AREA; | 179 return GetRole() == ui::AX_ROLE_TEXT_AREA; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 break; | 245 break; |
244 case ui::AX_ROLE_TAB_LIST: | 246 case ui::AX_ROLE_TAB_LIST: |
245 class_name = "android.widget.TabWidget"; | 247 class_name = "android.widget.TabWidget"; |
246 break; | 248 break; |
247 case ui::AX_ROLE_GRID: | 249 case ui::AX_ROLE_GRID: |
248 case ui::AX_ROLE_TABLE: | 250 case ui::AX_ROLE_TABLE: |
249 class_name = "android.widget.GridView"; | 251 class_name = "android.widget.GridView"; |
250 break; | 252 break; |
251 case ui::AX_ROLE_LIST: | 253 case ui::AX_ROLE_LIST: |
252 case ui::AX_ROLE_LIST_BOX: | 254 case ui::AX_ROLE_LIST_BOX: |
| 255 case ui::AX_ROLE_DESCRIPTION_LIST: |
253 class_name = "android.widget.ListView"; | 256 class_name = "android.widget.ListView"; |
254 break; | 257 break; |
255 case ui::AX_ROLE_DIALOG: | 258 case ui::AX_ROLE_DIALOG: |
256 class_name = "android.app.Dialog"; | 259 class_name = "android.app.Dialog"; |
257 break; | 260 break; |
258 case ui::AX_ROLE_ROOT_WEB_AREA: | 261 case ui::AX_ROLE_ROOT_WEB_AREA: |
259 class_name = "android.webkit.WebView"; | 262 class_name = "android.webkit.WebView"; |
260 break; | 263 break; |
261 default: | 264 default: |
262 class_name = "android.view.View"; | 265 class_name = "android.view.View"; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 } | 352 } |
350 } | 353 } |
351 return index; | 354 return index; |
352 } | 355 } |
353 | 356 |
354 int BrowserAccessibilityAndroid::GetItemCount() const { | 357 int BrowserAccessibilityAndroid::GetItemCount() const { |
355 int count = 0; | 358 int count = 0; |
356 switch(GetRole()) { | 359 switch(GetRole()) { |
357 case ui::AX_ROLE_LIST: | 360 case ui::AX_ROLE_LIST: |
358 case ui::AX_ROLE_LIST_BOX: | 361 case ui::AX_ROLE_LIST_BOX: |
| 362 case ui::AX_ROLE_DESCRIPTION_LIST: |
359 count = PlatformChildCount(); | 363 count = PlatformChildCount(); |
360 break; | 364 break; |
361 case ui::AX_ROLE_SLIDER: | 365 case ui::AX_ROLE_SLIDER: |
362 case ui::AX_ROLE_PROGRESS_INDICATOR: { | 366 case ui::AX_ROLE_PROGRESS_INDICATOR: { |
363 float max_value_for_range; | 367 float max_value_for_range; |
364 if (GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, | 368 if (GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, |
365 &max_value_for_range)) { | 369 &max_value_for_range)) { |
366 count = static_cast<int>(max_value_for_range); | 370 count = static_cast<int>(max_value_for_range); |
367 } | 371 } |
368 break; | 372 break; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 } | 516 } |
513 | 517 |
514 int BrowserAccessibilityAndroid::RowCount() const { | 518 int BrowserAccessibilityAndroid::RowCount() const { |
515 if (GetRole() == ui::AX_ROLE_GRID || | 519 if (GetRole() == ui::AX_ROLE_GRID || |
516 GetRole() == ui::AX_ROLE_TABLE) { | 520 GetRole() == ui::AX_ROLE_TABLE) { |
517 return CountChildrenWithRole(ui::AX_ROLE_ROW); | 521 return CountChildrenWithRole(ui::AX_ROLE_ROW); |
518 } | 522 } |
519 | 523 |
520 if (GetRole() == ui::AX_ROLE_LIST || | 524 if (GetRole() == ui::AX_ROLE_LIST || |
521 GetRole() == ui::AX_ROLE_LIST_BOX || | 525 GetRole() == ui::AX_ROLE_LIST_BOX || |
| 526 GetRole() == ui::AX_ROLE_DESCRIPTION_LIST || |
522 GetRole() == ui::AX_ROLE_TREE) { | 527 GetRole() == ui::AX_ROLE_TREE) { |
523 return PlatformChildCount(); | 528 return PlatformChildCount(); |
524 } | 529 } |
525 | 530 |
526 return 0; | 531 return 0; |
527 } | 532 } |
528 | 533 |
529 int BrowserAccessibilityAndroid::ColumnCount() const { | 534 int BrowserAccessibilityAndroid::ColumnCount() const { |
530 if (GetRole() == ui::AX_ROLE_GRID || | 535 if (GetRole() == ui::AX_ROLE_GRID || |
531 GetRole() == ui::AX_ROLE_TABLE) { | 536 GetRole() == ui::AX_ROLE_TABLE) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { | 644 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { |
640 int count = 0; | 645 int count = 0; |
641 for (uint32 i = 0; i < PlatformChildCount(); i++) { | 646 for (uint32 i = 0; i < PlatformChildCount(); i++) { |
642 if (PlatformGetChild(i)->GetRole() == role) | 647 if (PlatformGetChild(i)->GetRole() == role) |
643 count++; | 648 count++; |
644 } | 649 } |
645 return count; | 650 return count; |
646 } | 651 } |
647 | 652 |
648 } // namespace content | 653 } // namespace content |
OLD | NEW |