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

Unified Diff: Source/modules/accessibility/AXObject.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: Moved layout tests to other CLs. 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
Index: Source/modules/accessibility/AXObject.cpp
diff --git a/Source/modules/accessibility/AXObject.cpp b/Source/modules/accessibility/AXObject.cpp
index e05a796356d47388e2b9ba1dfd4e4a83316fcee2..7f717e438df06569d229a52e4b99ffcb1ce9f93e 100644
--- a/Source/modules/accessibility/AXObject.cpp
+++ b/Source/modules/accessibility/AXObject.cpp
@@ -453,8 +453,22 @@ bool AXObject::isPasswordFieldAndShouldHideValue() const
return isPasswordField();
}
+// If you call node->hasEditableStyle() since that will return true if an ancestor is editable.
dmazzoni 2015/04/10 21:23:24 Please fix this sentence while you're at it, it do
+// This only returns true if this is the element that actually has the contentEditable attribute set.
+bool AXObject::hasContentEditableAttributeSet() const
+{
+ if (!hasAttribute(contenteditableAttr))
+ return false;
+ const AtomicString& contentEditableValue = getAttribute(contenteditableAttr);
+ // Both "true" (case-insensitive) and the empty string count as true.
+ return contentEditableValue.isEmpty() || equalIgnoringCase(contentEditableValue, "true");
+}
+
bool AXObject::isTextControl() const
{
+ if (hasContentEditableAttributeSet())
+ return true;
+
switch (roleValue()) {
case TextFieldRole:
case ComboBoxRole:
« Source/modules/accessibility/AXObject.h ('K') | « Source/modules/accessibility/AXObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698