OLD | NEW |
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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 idList.replace('\n', ' '); | 504 idList.replace('\n', ' '); |
505 Vector<String> idVector; | 505 Vector<String> idVector; |
506 idList.split(' ', idVector); | 506 idList.split(' ', idVector); |
507 | 507 |
508 for (const auto& idName : idVector) { | 508 for (const auto& idName : idVector) { |
509 if (Element* idElement = scope.getElementById(AtomicString(idName))) | 509 if (Element* idElement = scope.getElementById(AtomicString(idName))) |
510 elements.append(idElement); | 510 elements.append(idElement); |
511 } | 511 } |
512 } | 512 } |
513 | 513 |
514 // If you call node->hasEditableStyle() since that will return true if an ancest
or is editable. | 514 // This only returns true if this is the element that actually has the |
515 // This only returns true if this is the element that actually has the contentEd
itable attribute set. | 515 // contentEditable attribute set, unlike node->hasEditableStyle() which will |
| 516 // also return true if an ancestor is editable. |
516 bool AXNodeObject::hasContentEditableAttributeSet() const | 517 bool AXNodeObject::hasContentEditableAttributeSet() const |
517 { | 518 { |
518 if (!hasAttribute(contenteditableAttr)) | 519 if (!hasAttribute(contenteditableAttr)) |
519 return false; | 520 return false; |
520 const AtomicString& contentEditableValue = getAttribute(contenteditableAttr)
; | 521 const AtomicString& contentEditableValue = getAttribute(contenteditableAttr)
; |
521 // Both "true" (case-insensitive) and the empty string count as true. | 522 // Both "true" (case-insensitive) and the empty string count as true. |
522 return contentEditableValue.isEmpty() || equalIgnoringCase(contentEditableVa
lue, "true"); | 523 return contentEditableValue.isEmpty() || equalIgnoringCase(contentEditableVa
lue, "true"); |
523 } | 524 } |
524 | 525 |
| 526 bool AXNodeObject::isTextControl() const |
| 527 { |
| 528 if (hasContentEditableAttributeSet()) |
| 529 return true; |
| 530 |
| 531 switch (roleValue()) { |
| 532 case TextFieldRole: |
| 533 case ComboBoxRole: |
| 534 case SearchBoxRole: |
| 535 return true; |
| 536 default: |
| 537 return false; |
| 538 } |
| 539 } |
| 540 |
525 bool AXNodeObject::isGenericFocusableElement() const | 541 bool AXNodeObject::isGenericFocusableElement() const |
526 { | 542 { |
527 if (!canSetFocusAttribute()) | 543 if (!canSetFocusAttribute()) |
528 return false; | 544 return false; |
529 | 545 |
530 // If it's a control, it's not generic. | 546 // If it's a control, it's not generic. |
531 if (isControl()) | 547 if (isControl()) |
532 return false; | 548 return false; |
533 | 549 |
534 // If it has an aria role, it's not generic. | 550 // If it has an aria role, it's not generic. |
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2162 ariaLabeledByElements(elements); | 2178 ariaLabeledByElements(elements); |
2163 | 2179 |
2164 for (const auto& element : elements) { | 2180 for (const auto& element : elements) { |
2165 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(element); | 2181 RefPtr<AXObject> axElement = axObjectCache()->getOrCreate(element); |
2166 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a
xElement)); | 2182 textOrder.append(AccessibilityText(ariaLabeledBy, AlternativeText, a
xElement)); |
2167 } | 2183 } |
2168 } | 2184 } |
2169 } | 2185 } |
2170 | 2186 |
2171 } // namespace blink | 2187 } // namespace blink |
OLD | NEW |