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

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

Issue 1086253002: Revert of 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: 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/AXLayoutObject.h ('k') | Source/modules/accessibility/AXNodeObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/accessibility/AXLayoutObject.cpp
diff --git a/Source/modules/accessibility/AXLayoutObject.cpp b/Source/modules/accessibility/AXLayoutObject.cpp
index b350c5288235b895aaef715531f87c68fb76e62c..46ead68c75698a1e6654024b5115b0f297c38d9e 100644
--- a/Source/modules/accessibility/AXLayoutObject.cpp
+++ b/Source/modules/accessibility/AXLayoutObject.cpp
@@ -1590,12 +1590,16 @@
if (!isTextControl())
return PlainTextRange();
- if (m_layoutObject->isTextControl()) {
+ AccessibilityRole ariaRole = ariaRoleAttribute();
+ if (isNativeTextControl() && ariaRole == UnknownRole && m_layoutObject->isTextControl()) {
HTMLTextFormControlElement* textControl = toLayoutTextControl(m_layoutObject)->textFormControlElement();
return PlainTextRange(textControl->selectionStart(), textControl->selectionEnd() - textControl->selectionStart());
}
- return visibleSelectionUnderObject();
+ if (ariaRole == UnknownRole)
+ return PlainTextRange();
+
+ return ariaSelectedTextRange();
}
VisibleSelection AXLayoutObject::selection() const
@@ -1609,7 +1613,7 @@
void AXLayoutObject::setSelectedTextRange(const PlainTextRange& range)
{
- if (m_layoutObject->isTextControl()) {
+ if (isNativeTextControl() && m_layoutObject->isTextControl()) {
HTMLTextFormControlElement* textControl = toLayoutTextControl(m_layoutObject)->textFormControlElement();
textControl->setSelectionRange(range.start, range.start + range.length, SelectionHasNoDirection, NotDispatchSelectEvent);
return;
@@ -1746,7 +1750,7 @@
if (!m_layoutObject)
return VisiblePosition();
- if (m_layoutObject->isTextControl())
+ if (isNativeTextControl() && m_layoutObject->isTextControl())
return toLayoutTextControl(m_layoutObject)->textFormControlElement()->visiblePositionForIndex(index);
if (!allowsTextRanges() && !m_layoutObject->isText())
@@ -1771,7 +1775,7 @@
int AXLayoutObject::indexForVisiblePosition(const VisiblePosition& pos) const
{
- if (m_layoutObject->isTextControl()) {
+ if (isNativeTextControl() && m_layoutObject->isTextControl()) {
HTMLTextFormControlElement* textControl = toLayoutTextControl(m_layoutObject)->textFormControlElement();
return textControl->indexForVisiblePosition(pos);
}
@@ -1784,9 +1788,7 @@
return 0;
Position indexPosition = pos.deepEquivalent();
- if (indexPosition.isNull()
- || (highestEditableRoot(indexPosition) != node
- && highestEditableRoot(indexPosition, HasEditableAXRole) != node))
+ if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditableAXRole) != node)
return 0;
RefPtrWillBeRawPtr<Range> range = Range::create(m_layoutObject->document());
@@ -1875,7 +1877,7 @@
}
}
-AXObject::PlainTextRange AXLayoutObject::visibleSelectionUnderObject() const
+AXObject::PlainTextRange AXLayoutObject::ariaSelectedTextRange() const
{
Node* node = m_layoutObject->node();
if (!node)
« no previous file with comments | « Source/modules/accessibility/AXLayoutObject.h ('k') | Source/modules/accessibility/AXNodeObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698