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

Side by Side Diff: Source/modules/accessibility/AXObject.cpp

Issue 1056763002: Reland: Made content editables report the caret and text selection by treating them as text controls (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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 /* 1 /*
2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 310
311 bool AXObject::isPasswordFieldAndShouldHideValue() const 311 bool AXObject::isPasswordFieldAndShouldHideValue() const
312 { 312 {
313 Settings* settings = document()->settings(); 313 Settings* settings = document()->settings();
314 if (!settings || settings->accessibilityPasswordValuesEnabled()) 314 if (!settings || settings->accessibilityPasswordValuesEnabled())
315 return false; 315 return false;
316 316
317 return isPasswordField(); 317 return isPasswordField();
318 } 318 }
319 319
320 // If you call node->hasEditableStyle() since that will return true if an ancest or is editable.
321 // This only returns true if this is the element that actually has the contentEd itable attribute set.
322 bool AXObject::hasContentEditableAttributeSet() const
323 {
324 if (!hasAttribute(contenteditableAttr))
325 return false;
326 const AtomicString& contentEditableValue = getAttribute(contenteditableAttr) ;
327 // Both "true" (case-insensitive) and the empty string count as true.
328 return contentEditableValue.isEmpty() || equalIgnoringCase(contentEditableVa lue, "true");
329 }
330
320 bool AXObject::isTextControl() const 331 bool AXObject::isTextControl() const
321 { 332 {
333 if (hasContentEditableAttributeSet())
334 return true;
335
322 switch (roleValue()) { 336 switch (roleValue()) {
323 case TextAreaRole: 337 case TextAreaRole:
324 case TextFieldRole: 338 case TextFieldRole:
325 case ComboBoxRole: 339 case ComboBoxRole:
326 case SearchBoxRole: 340 case SearchBoxRole:
327 return true; 341 return true;
328 default: 342 default:
329 return false; 343 return false;
330 } 344 }
331 } 345 }
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 } 1157 }
1144 1158
1145 const AtomicString& AXObject::roleName(AccessibilityRole role) 1159 const AtomicString& AXObject::roleName(AccessibilityRole role)
1146 { 1160 {
1147 static const Vector<AtomicString>* roleNameVector = createRoleNameVector(); 1161 static const Vector<AtomicString>* roleNameVector = createRoleNameVector();
1148 1162
1149 return roleNameVector->at(role); 1163 return roleNameVector->at(role);
1150 } 1164 }
1151 1165
1152 } // namespace blink 1166 } // namespace blink
OLDNEW
« Source/modules/accessibility/AXLayoutObject.cpp ('K') | « Source/modules/accessibility/AXObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698