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 5976ccf44b0ac11c8c54fd7ffe37b60d541e3fde..be9f8c126cbe37afec65f8914333ed3c01e8724d 100644 |
--- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
+++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp |
@@ -792,6 +792,36 @@ 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 is false, including for ARIA, says CORE-AAM. |
+ if (is_edit_box) |
+ return false; |
+ |
+ // If root of contenteditable area and no ARIA role of textbox/searchbox used, |
+ // default to multiline=true which is what the default behavior is. |
+ 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 +835,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. |
bool AXNodeObject::IsTextControl() const { |
if (HasContentEditableAttributeSet()) |
return true; |