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

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

Issue 755883006: Remove unused roles(EditableText, SplitGroup, GrowArea) from Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 bool BrowserAccessibilityAndroid::IsContentInvalid() const { 162 bool BrowserAccessibilityAndroid::IsContentInvalid() const {
163 std::string invalid; 163 std::string invalid;
164 return GetHtmlAttribute("aria-invalid", &invalid); 164 return GetHtmlAttribute("aria-invalid", &invalid);
165 } 165 }
166 166
167 bool BrowserAccessibilityAndroid::IsDismissable() const { 167 bool BrowserAccessibilityAndroid::IsDismissable() const {
168 return false; // No concept of "dismissable" on the web currently. 168 return false; // No concept of "dismissable" on the web currently.
169 } 169 }
170 170
171 bool BrowserAccessibilityAndroid::IsEditableText() const { 171 bool BrowserAccessibilityAndroid::IsEditableText() const {
172 return (GetRole() == ui::AX_ROLE_EDITABLE_TEXT || 172 return (GetRole() == ui::AX_ROLE_TEXT_AREA ||
173 GetRole() == ui::AX_ROLE_TEXT_AREA ||
174 GetRole() == ui::AX_ROLE_TEXT_FIELD); 173 GetRole() == ui::AX_ROLE_TEXT_FIELD);
175 } 174 }
176 175
177 bool BrowserAccessibilityAndroid::IsEnabled() const { 176 bool BrowserAccessibilityAndroid::IsEnabled() const {
178 return HasState(ui::AX_STATE_ENABLED); 177 return HasState(ui::AX_STATE_ENABLED);
179 } 178 }
180 179
181 bool BrowserAccessibilityAndroid::IsFocusable() const { 180 bool BrowserAccessibilityAndroid::IsFocusable() const {
182 bool focusable = HasState(ui::AX_STATE_FOCUSABLE); 181 bool focusable = HasState(ui::AX_STATE_FOCUSABLE);
183 if (IsIframe() || 182 if (IsIframe() ||
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 239 }
241 240
242 bool BrowserAccessibilityAndroid::CanOpenPopup() const { 241 bool BrowserAccessibilityAndroid::CanOpenPopup() const {
243 return HasState(ui::AX_STATE_HASPOPUP); 242 return HasState(ui::AX_STATE_HASPOPUP);
244 } 243 }
245 244
246 const char* BrowserAccessibilityAndroid::GetClassName() const { 245 const char* BrowserAccessibilityAndroid::GetClassName() const {
247 const char* class_name = NULL; 246 const char* class_name = NULL;
248 247
249 switch(GetRole()) { 248 switch(GetRole()) {
250 case ui::AX_ROLE_EDITABLE_TEXT:
251 case ui::AX_ROLE_SPIN_BUTTON: 249 case ui::AX_ROLE_SPIN_BUTTON:
252 case ui::AX_ROLE_TEXT_AREA: 250 case ui::AX_ROLE_TEXT_AREA:
253 case ui::AX_ROLE_TEXT_FIELD: 251 case ui::AX_ROLE_TEXT_FIELD:
254 class_name = "android.widget.EditText"; 252 class_name = "android.widget.EditText";
255 break; 253 break;
256 case ui::AX_ROLE_SLIDER: 254 case ui::AX_ROLE_SLIDER:
257 class_name = "android.widget.SeekBar"; 255 class_name = "android.widget.SeekBar";
258 break; 256 break;
259 case ui::AX_ROLE_COLOR_WELL: 257 case ui::AX_ROLE_COLOR_WELL:
260 case ui::AX_ROLE_COMBO_BOX: 258 case ui::AX_ROLE_COMBO_BOX:
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // name on Android, not 2 or 3 like on Windows or Mac. 325 // name on Android, not 2 or 3 like on Windows or Mac.
328 326
329 // First, always return the |value| attribute if this is an 327 // First, always return the |value| attribute if this is an
330 // input field. 328 // input field.
331 if (!value().empty()) { 329 if (!value().empty()) {
332 if (HasState(ui::AX_STATE_EDITABLE)) 330 if (HasState(ui::AX_STATE_EDITABLE))
333 return base::UTF8ToUTF16(value()); 331 return base::UTF8ToUTF16(value());
334 332
335 switch (GetRole()) { 333 switch (GetRole()) {
336 case ui::AX_ROLE_COMBO_BOX: 334 case ui::AX_ROLE_COMBO_BOX:
337 case ui::AX_ROLE_EDITABLE_TEXT:
338 case ui::AX_ROLE_POP_UP_BUTTON: 335 case ui::AX_ROLE_POP_UP_BUTTON:
339 case ui::AX_ROLE_TEXT_AREA: 336 case ui::AX_ROLE_TEXT_AREA:
340 case ui::AX_ROLE_TEXT_FIELD: 337 case ui::AX_ROLE_TEXT_FIELD:
341 return base::UTF8ToUTF16(value()); 338 return base::UTF8ToUTF16(value());
342 } 339 }
343 } 340 }
344 341
345 // For color wells, the color is stored in separate attributes. 342 // For color wells, the color is stored in separate attributes.
346 // Perhaps we could return color names in the future? 343 // Perhaps we could return color names in the future?
347 if (GetRole() == ui::AX_ROLE_COLOR_WELL) { 344 if (GetRole() == ui::AX_ROLE_COLOR_WELL) {
(...skipping 16 matching lines...) Expand all
364 // title_elem_id is set, that means there's a label element 361 // title_elem_id is set, that means there's a label element
365 // supplying the name and then name takes precedence over help. 362 // supplying the name and then name takes precedence over help.
366 // TODO(dmazzoni): clean this up by providing more granular labels in 363 // TODO(dmazzoni): clean this up by providing more granular labels in
367 // Blink, making the platform-specific mapping to accessible text simpler. 364 // Blink, making the platform-specific mapping to accessible text simpler.
368 base::string16 description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION); 365 base::string16 description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION);
369 base::string16 help = GetString16Attribute(ui::AX_ATTR_HELP); 366 base::string16 help = GetString16Attribute(ui::AX_ATTR_HELP);
370 367
371 base::string16 placeholder; 368 base::string16 placeholder;
372 switch (GetRole()) { 369 switch (GetRole()) {
373 case ui::AX_ROLE_DATE: 370 case ui::AX_ROLE_DATE:
374 case ui::AX_ROLE_EDITABLE_TEXT:
375 case ui::AX_ROLE_TEXT_AREA: 371 case ui::AX_ROLE_TEXT_AREA:
376 case ui::AX_ROLE_TEXT_FIELD: 372 case ui::AX_ROLE_TEXT_FIELD:
377 case ui::AX_ROLE_TIME: 373 case ui::AX_ROLE_TIME:
378 GetHtmlAttribute("placeholder", &placeholder); 374 GetHtmlAttribute("placeholder", &placeholder);
379 } 375 }
380 376
381 int title_elem_id = GetIntAttribute( 377 int title_elem_id = GetIntAttribute(
382 ui::AX_ATTR_TITLE_UI_ELEMENT); 378 ui::AX_ATTR_TITLE_UI_ELEMENT);
383 base::string16 text; 379 base::string16 text;
384 if (!description.empty()) 380 if (!description.empty())
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { 858 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const {
863 int count = 0; 859 int count = 0;
864 for (uint32 i = 0; i < PlatformChildCount(); i++) { 860 for (uint32 i = 0; i < PlatformChildCount(); i++) {
865 if (PlatformGetChild(i)->GetRole() == role) 861 if (PlatformGetChild(i)->GetRole() == role)
866 count++; 862 count++;
867 } 863 }
868 return count; 864 return count;
869 } 865 }
870 866
871 } // namespace content 867 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility.cc ('k') | content/browser/accessibility/browser_accessibility_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698