Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: content/browser/accessibility/browser_accessibility_android.cc

Issue 1132963002: Handles conversion rule for TimeRole and updates InputTimeRole. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Maps InputTime role to ROLE_SYSTEM_GROUPING Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/i18n/break_iterator.h" 7 #include "base/i18n/break_iterator.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 GetRole() == ui::AX_ROLE_ROOT_WEB_AREA || 71 GetRole() == ui::AX_ROLE_ROOT_WEB_AREA ||
72 GetRole() == ui::AX_ROLE_WEB_AREA) { 72 GetRole() == ui::AX_ROLE_WEB_AREA) {
73 return false; 73 return false;
74 } 74 }
75 75
76 // If it has a focusable child, we definitely can't leave out children. 76 // If it has a focusable child, we definitely can't leave out children.
77 if (HasFocusableChild()) 77 if (HasFocusableChild())
78 return false; 78 return false;
79 79
80 // Date and time controls should drop their children. 80 // Date and time controls should drop their children.
81 if (GetRole() == ui::AX_ROLE_DATE || GetRole() == ui::AX_ROLE_TIME) 81 if (GetRole() == ui::AX_ROLE_DATE || GetRole() == ui::AX_ROLE_INPUT_TIME)
82 return true; 82 return true;
83 83
84 // Headings with text can drop their children. 84 // Headings with text can drop their children.
85 base::string16 name = GetText(); 85 base::string16 name = GetText();
86 if (GetRole() == ui::AX_ROLE_HEADING && !name.empty()) 86 if (GetRole() == ui::AX_ROLE_HEADING && !name.empty())
87 return true; 87 return true;
88 88
89 // Focusable nodes with text can drop their children. 89 // Focusable nodes with text can drop their children.
90 if (HasState(ui::AX_STATE_FOCUSABLE) && !name.empty()) 90 if (HasState(ui::AX_STATE_FOCUSABLE) && !name.empty())
91 return true; 91 return true;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 case ui::AX_ROLE_TEXT_FIELD: 259 case ui::AX_ROLE_TEXT_FIELD:
260 class_name = "android.widget.EditText"; 260 class_name = "android.widget.EditText";
261 break; 261 break;
262 case ui::AX_ROLE_SLIDER: 262 case ui::AX_ROLE_SLIDER:
263 class_name = "android.widget.SeekBar"; 263 class_name = "android.widget.SeekBar";
264 break; 264 break;
265 case ui::AX_ROLE_COLOR_WELL: 265 case ui::AX_ROLE_COLOR_WELL:
266 case ui::AX_ROLE_COMBO_BOX: 266 case ui::AX_ROLE_COMBO_BOX:
267 case ui::AX_ROLE_DATE: 267 case ui::AX_ROLE_DATE:
268 case ui::AX_ROLE_POP_UP_BUTTON: 268 case ui::AX_ROLE_POP_UP_BUTTON:
269 case ui::AX_ROLE_TIME: 269 case ui::AX_ROLE_INPUT_TIME:
270 class_name = "android.widget.Spinner"; 270 class_name = "android.widget.Spinner";
271 break; 271 break;
272 case ui::AX_ROLE_BUTTON: 272 case ui::AX_ROLE_BUTTON:
273 case ui::AX_ROLE_MENU_BUTTON: 273 case ui::AX_ROLE_MENU_BUTTON:
274 class_name = "android.widget.Button"; 274 class_name = "android.widget.Button";
275 break; 275 break;
276 case ui::AX_ROLE_CHECK_BOX: 276 case ui::AX_ROLE_CHECK_BOX:
277 case ui::AX_ROLE_SWITCH: 277 case ui::AX_ROLE_SWITCH:
278 class_name = "android.widget.CheckBox"; 278 class_name = "android.widget.CheckBox";
279 break; 279 break;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // title_elem_id is set, that means there's a label element 372 // title_elem_id is set, that means there's a label element
373 // supplying the name and then name takes precedence over help. 373 // supplying the name and then name takes precedence over help.
374 // TODO(dmazzoni): clean this up by providing more granular labels in 374 // TODO(dmazzoni): clean this up by providing more granular labels in
375 // Blink, making the platform-specific mapping to accessible text simpler. 375 // Blink, making the platform-specific mapping to accessible text simpler.
376 base::string16 description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION); 376 base::string16 description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION);
377 base::string16 help = GetString16Attribute(ui::AX_ATTR_HELP); 377 base::string16 help = GetString16Attribute(ui::AX_ATTR_HELP);
378 378
379 base::string16 placeholder; 379 base::string16 placeholder;
380 switch (GetRole()) { 380 switch (GetRole()) {
381 case ui::AX_ROLE_DATE: 381 case ui::AX_ROLE_DATE:
382 case ui::AX_ROLE_INPUT_TIME:
382 case ui::AX_ROLE_TEXT_FIELD: 383 case ui::AX_ROLE_TEXT_FIELD:
383 case ui::AX_ROLE_TIME:
384 GetHtmlAttribute("placeholder", &placeholder); 384 GetHtmlAttribute("placeholder", &placeholder);
385 } 385 }
386 386
387 int title_elem_id = GetIntAttribute( 387 int title_elem_id = GetIntAttribute(
388 ui::AX_ATTR_TITLE_UI_ELEMENT); 388 ui::AX_ATTR_TITLE_UI_ELEMENT);
389 base::string16 text; 389 base::string16 text;
390 if (!description.empty()) 390 if (!description.empty())
391 text = description; 391 text = description;
392 else if (title_elem_id && !name.empty()) 392 else if (title_elem_id && !name.empty())
393 text = name; 393 text = name;
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { 876 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const {
877 int count = 0; 877 int count = 0;
878 for (uint32 i = 0; i < PlatformChildCount(); i++) { 878 for (uint32 i = 0; i < PlatformChildCount(); i++) {
879 if (PlatformGetChild(i)->GetRole() == role) 879 if (PlatformGetChild(i)->GetRole() == role)
880 count++; 880 count++;
881 } 881 }
882 return count; 882 return count;
883 } 883 }
884 884
885 } // namespace content 885 } // namespace content
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/automation.idl ('k') | content/browser/accessibility/browser_accessibility_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698