| 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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 if (child->AccessibilityIsIgnored() && | 816 if (child->AccessibilityIsIgnored() && |
| 817 property != AOMRelationListProperty::kLabeledBy && | 817 property != AOMRelationListProperty::kLabeledBy && |
| 818 property != AOMRelationListProperty::kDescribedBy) { | 818 property != AOMRelationListProperty::kDescribedBy) { |
| 819 continue; | 819 continue; |
| 820 } | 820 } |
| 821 children.push_back(child); | 821 children.push_back(child); |
| 822 } | 822 } |
| 823 } | 823 } |
| 824 } | 824 } |
| 825 | 825 |
| 826 bool AXNodeObject::IsMultiline() const { |
| 827 Node* node = this->GetNode(); |
| 828 if (!node) |
| 829 return false; |
| 830 |
| 831 const AccessibilityRole role = RoleValue(); |
| 832 const bool is_edit_box = role == kSearchBoxRole || role == kTextFieldRole; |
| 833 if (!IsEditable() && !is_edit_box) |
| 834 return false; // Doesn't support multiline. |
| 835 |
| 836 // Supports aria-multiline, so check for attribute. |
| 837 bool is_multiline = false; |
| 838 if (HasAOMPropertyOrARIAAttribute(AOMBooleanProperty::kMultiline, |
| 839 is_multiline)) { |
| 840 return is_multiline; |
| 841 } |
| 842 |
| 843 // Default for <textarea> is true. |
| 844 if (isHTMLTextAreaElement(*node)) |
| 845 return true; |
| 846 |
| 847 // Default for other edit boxes is false, including for ARIA, says CORE-AAM. |
| 848 if (is_edit_box) |
| 849 return false; |
| 850 |
| 851 // If root of contenteditable area and no ARIA role of textbox/searchbox used, |
| 852 // default to multiline=true which is what the default behavior is. |
| 853 return HasContentEditableAttributeSet(); |
| 854 } |
| 855 |
| 826 // This only returns true if this is the element that actually has the | 856 // This only returns true if this is the element that actually has the |
| 827 // contentEditable attribute set, unlike node->hasEditableStyle() which will | 857 // contentEditable attribute set, unlike node->hasEditableStyle() which will |
| 828 // also return true if an ancestor is editable. | 858 // also return true if an ancestor is editable. |
| 829 bool AXNodeObject::HasContentEditableAttributeSet() const { | 859 bool AXNodeObject::HasContentEditableAttributeSet() const { |
| 830 const AtomicString& content_editable_value = | 860 const AtomicString& content_editable_value = |
| 831 GetAttribute(contenteditableAttr); | 861 GetAttribute(contenteditableAttr); |
| 832 if (content_editable_value.IsNull()) | 862 if (content_editable_value.IsNull()) |
| 833 return false; | 863 return false; |
| 834 // Both "true" (case-insensitive) and the empty string count as true. | 864 // Both "true" (case-insensitive) and the empty string count as true. |
| 835 return content_editable_value.IsEmpty() || | 865 return content_editable_value.IsEmpty() || |
| 836 EqualIgnoringASCIICase(content_editable_value, "true"); | 866 EqualIgnoringASCIICase(content_editable_value, "true"); |
| 837 } | 867 } |
| 838 | 868 |
| 869 // TODO(aleventhal) Find a more appropriate name or consider returning false |
| 870 // for everything but a searchbox or textfield, as a combobox and spinbox |
| 871 // can contain a field but should not be considered edit controls themselves. |
| 839 bool AXNodeObject::IsTextControl() const { | 872 bool AXNodeObject::IsTextControl() const { |
| 840 if (HasContentEditableAttributeSet()) | 873 if (HasContentEditableAttributeSet()) |
| 841 return true; | 874 return true; |
| 842 | 875 |
| 843 switch (RoleValue()) { | 876 switch (RoleValue()) { |
| 844 case kTextFieldRole: | 877 case kTextFieldRole: |
| 845 case kComboBoxRole: | 878 case kComboBoxRole: |
| 846 case kSearchBoxRole: | 879 case kSearchBoxRole: |
| 847 case kSpinButtonRole: | 880 case kSpinButtonRole: |
| 848 return true; | 881 return true; |
| (...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3327 return String(); | 3360 return String(); |
| 3328 return ToTextControlElement(node)->StrippedPlaceholder(); | 3361 return ToTextControlElement(node)->StrippedPlaceholder(); |
| 3329 } | 3362 } |
| 3330 | 3363 |
| 3331 DEFINE_TRACE(AXNodeObject) { | 3364 DEFINE_TRACE(AXNodeObject) { |
| 3332 visitor->Trace(node_); | 3365 visitor->Trace(node_); |
| 3333 AXObject::Trace(visitor); | 3366 AXObject::Trace(visitor); |
| 3334 } | 3367 } |
| 3335 | 3368 |
| 3336 } // namespace blink | 3369 } // namespace blink |
| OLD | NEW |