Chromium Code Reviews| Index: third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
| diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
| index 924e391ebe25113e85d14b37112b80eb7878781d..e2202abe8c34e62ab229ef6b2c441285e9832e49 100644 |
| --- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
| +++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
| @@ -792,6 +792,35 @@ void AXNodeObject::AccessibilityChildrenFromAttribute( |
| } |
| } |
| +bool AXNodeObject::IsMultiline() const { |
| + Node* node = this->GetNode(); |
| + if (!node) |
| + return false; |
| + |
| + const AccessibilityRole role = RoleValue(); |
| + const bool is_edit_box = role == kSearchBoxRole || role == kTextFieldRole; |
| + if (!IsEditable() && !is_edit_box) |
| + return false; // Doesn't support multiline. |
| + |
| + // Supports aria-multiline, so check for attribute. |
| + bool is_multiline = false; |
| + if (HasAOMPropertyOrARIAAttribute(AOMBooleanProperty::kMultiline, |
| + is_multiline)) { |
| + return is_multiline; |
| + } |
| + |
| + // Default for <textarea> is true. |
| + if (isHTMLTextAreaElement(*node)) |
| + return true; |
| + |
| + // Default for other edit boxes i false, including for ARIA, says CORE-AAM. |
|
David Tseng
2017/06/27 18:41:14
nit: is
|
| + if (is_edit_box) |
| + return false; |
| + |
| + // Root of contenteditable area. |
| + return HasContentEditableAttributeSet(); |
| +} |
| + |
| // This only returns true if this is the element that actually has the |
| // contentEditable attribute set, unlike node->hasEditableStyle() which will |
| // also return true if an ancestor is editable. |
| @@ -805,6 +834,9 @@ bool AXNodeObject::HasContentEditableAttributeSet() const { |
| EqualIgnoringASCIICase(content_editable_value, "true"); |
| } |
| +// TODO(aleventhal) Find a more appropriate name or consider returning false |
| +// for everything but a searchbox or textfield, as a combobox and spinbox |
| +// can contain a field but should not be considered edit controls themselves. |
|
David Tseng
2017/06/27 18:41:14
Why not? <input type="text" role="combobox">
has n
|
| bool AXNodeObject::IsTextControl() const { |
| if (HasContentEditableAttributeSet()) |
| return true; |