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

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

Issue 1056763002: Reland: Made content editables report the caret and text selection by treating them as text controls (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Merged with master. Created 5 years, 8 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
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.h ('k') | Source/modules/accessibility/AXObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/accessibility/AXNodeObject.cpp
diff --git a/Source/modules/accessibility/AXNodeObject.cpp b/Source/modules/accessibility/AXNodeObject.cpp
index a5438ac4ada964ee02f7734e009ef76f7e326b59..247386d0d7ac508efbec4fd4a61534a67d7d32a2 100644
--- a/Source/modules/accessibility/AXNodeObject.cpp
+++ b/Source/modules/accessibility/AXNodeObject.cpp
@@ -511,8 +511,9 @@ void AXNodeObject::elementsFromAttribute(WillBeHeapVector<RawPtrWillBeMember<Ele
}
}
-// If you call node->hasEditableStyle() since that will return true if an ancestor is editable.
-// This only returns true if this is the element that actually has the contentEditable attribute set.
+// 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.
bool AXNodeObject::hasContentEditableAttributeSet() const
{
if (!hasAttribute(contenteditableAttr))
@@ -522,6 +523,21 @@ bool AXNodeObject::hasContentEditableAttributeSet() const
return contentEditableValue.isEmpty() || equalIgnoringCase(contentEditableValue, "true");
}
+bool AXNodeObject::isTextControl() const
+{
+ if (hasContentEditableAttributeSet())
+ return true;
+
+ switch (roleValue()) {
+ case TextFieldRole:
+ case ComboBoxRole:
+ case SearchBoxRole:
+ return true;
+ default:
+ return false;
+ }
+}
+
bool AXNodeObject::isGenericFocusableElement() const
{
if (!canSetFocusAttribute())
« no previous file with comments | « Source/modules/accessibility/AXNodeObject.h ('k') | Source/modules/accessibility/AXObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698