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

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

Issue 1086253002: Revert of 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
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.h ('k') | Source/modules/accessibility/AXObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, Google 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 idList.replace('\n', ' '); 513 idList.replace('\n', ' ');
514 Vector<String> idVector; 514 Vector<String> idVector;
515 idList.split(' ', idVector); 515 idList.split(' ', idVector);
516 516
517 for (const auto& idName : idVector) { 517 for (const auto& idName : idVector) {
518 if (Element* idElement = scope.getElementById(AtomicString(idName))) 518 if (Element* idElement = scope.getElementById(AtomicString(idName)))
519 elements.append(idElement); 519 elements.append(idElement);
520 } 520 }
521 } 521 }
522 522
523 // This only returns true if this is the element that actually has the 523 // If you call node->hasEditableStyle() since that will return true if an ancest or is editable.
524 // contentEditable attribute set, unlike node->hasEditableStyle() which will 524 // This only returns true if this is the element that actually has the contentEd itable attribute set.
525 // also return true if an ancestor is editable.
526 bool AXNodeObject::hasContentEditableAttributeSet() const 525 bool AXNodeObject::hasContentEditableAttributeSet() const
527 { 526 {
528 if (!hasAttribute(contenteditableAttr)) 527 if (!hasAttribute(contenteditableAttr))
529 return false; 528 return false;
530 const AtomicString& contentEditableValue = getAttribute(contenteditableAttr) ; 529 const AtomicString& contentEditableValue = getAttribute(contenteditableAttr) ;
531 // Both "true" (case-insensitive) and the empty string count as true. 530 // Both "true" (case-insensitive) and the empty string count as true.
532 return contentEditableValue.isEmpty() || equalIgnoringCase(contentEditableVa lue, "true"); 531 return contentEditableValue.isEmpty() || equalIgnoringCase(contentEditableVa lue, "true");
533 } 532 }
534 533
535 bool AXNodeObject::isTextControl() const
536 {
537 if (hasContentEditableAttributeSet())
538 return true;
539
540 switch (roleValue()) {
541 case TextFieldRole:
542 case ComboBoxRole:
543 case SearchBoxRole:
544 return true;
545 default:
546 return false;
547 }
548 }
549
550 bool AXNodeObject::isGenericFocusableElement() const 534 bool AXNodeObject::isGenericFocusableElement() const
551 { 535 {
552 if (!canSetFocusAttribute()) 536 if (!canSetFocusAttribute())
553 return false; 537 return false;
554 538
555 // If it's a control, it's not generic. 539 // If it's a control, it's not generic.
556 if (isControl()) 540 if (isControl())
557 return false; 541 return false;
558 542
559 // If it has an aria role, it's not generic. 543 // If it has an aria role, it's not generic.
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after
2188 float range = maxValueForRange() - minValueForRange(); 2172 float range = maxValueForRange() - minValueForRange();
2189 float value = valueForRange(); 2173 float value = valueForRange();
2190 2174
2191 value += range * (percentChange / 100); 2175 value += range * (percentChange / 100);
2192 setValue(String::number(value)); 2176 setValue(String::number(value));
2193 2177
2194 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged) ; 2178 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged) ;
2195 } 2179 }
2196 2180
2197 } // namespace blink 2181 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.h ('k') | Source/modules/accessibility/AXObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698