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

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp

Issue 2931893002: More precise use of multiline state (Closed)
Patch Set: Fix typo Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698