summaryrefslogtreecommitdiffstats
path: root/WebCore/accessibility/AccessibilityObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/accessibility/AccessibilityObject.cpp')
-rw-r--r--WebCore/accessibility/AccessibilityObject.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/WebCore/accessibility/AccessibilityObject.cpp b/WebCore/accessibility/AccessibilityObject.cpp
index a0959e6..b0ae86b 100644
--- a/WebCore/accessibility/AccessibilityObject.cpp
+++ b/WebCore/accessibility/AccessibilityObject.cpp
@@ -373,7 +373,24 @@ VisiblePositionRange AccessibilityObject::styleRangeForPosition(const VisiblePos
// NOTE: Consider providing this utility method as AX API
VisiblePositionRange AccessibilityObject::visiblePositionRangeForRange(const PlainTextRange& range) const
{
- if (range.start + range.length > text().length())
+ unsigned textLength = text().length();
+#if PLATFORM(GTK)
+ // Gtk ATs need this for all text objects; not just text controls.
+ if (!textLength) {
+ Node* node = this->node();
+ if (node) {
+ RenderText* renderText = toRenderText(node->renderer());
+ if (renderText)
+ textLength = renderText->textLength();
+
+ // Get the text length from the elements under the
+ // accessibility object if not a RenderText object.
+ if (!textLength && allowsTextRanges())
+ textLength = textUnderElement().length();
+ }
+ }
+#endif
+ if (range.start + range.length > textLength)
return VisiblePositionRange();
VisiblePosition startPosition = visiblePositionForIndex(range.start);