summaryrefslogtreecommitdiff
path: root/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/accessibility/AccessibilityRenderObject.cpp')
-rw-r--r--Source/WebCore/accessibility/AccessibilityRenderObject.cpp50
1 files changed, 40 insertions, 10 deletions
diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
index e06f9e8ac..3fff2fa42 100644
--- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -1194,9 +1194,12 @@ float AccessibilityRenderObject::minValueForRange() const
String AccessibilityRenderObject::stringValue() const
{
- if (!m_renderer || isPasswordField())
+ if (!m_renderer)
return String();
+ if (isPasswordField())
+ return passwordFieldValue();
+
RenderBoxModelObject* cssBox = renderBoxModelObject();
if (ariaRoleAttribute() == StaticTextRole) {
@@ -1996,9 +1999,11 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const
if (isWebArea() || m_renderer->isListMarker())
return false;
- // Using the help text to decide an element's visibility is not as definitive
- // as previous checks, so this should remain as one of the last.
- if (!helpText().isEmpty())
+ // Using the help text, title or accessibility description (so we
+ // check if there's some kind of accessible name for the element)
+ // to decide an element's visibility is not as definitive as
+ // previous checks, so this should remain as one of the last.
+ if (!helpText().isEmpty() || !title().isEmpty() || !accessibilityDescription().isEmpty())
return false;
// By default, objects should be ignored so that the AX hierarchy is not
@@ -2039,9 +2044,12 @@ String AccessibilityRenderObject::text() const
if (ariaRoleAttribute() == StaticTextRole)
return ariaAccessibilityDescription();
- if (!isTextControl() || isPasswordField())
+ if (!isTextControl())
return String();
+ if (isPasswordField())
+ return passwordFieldValue();
+
Node* node = m_renderer->node();
if (!node)
return String();
@@ -2060,8 +2068,12 @@ int AccessibilityRenderObject::textLength() const
ASSERT(isTextControl());
if (isPasswordField())
+#if PLATFORM(GTK)
+ return passwordFieldValue().length();
+#else
return -1; // need to return something distinct from 0
-
+#endif
+
return text().length();
}
@@ -2854,16 +2866,13 @@ PlainTextRange AccessibilityRenderObject::doAXRangeForIndex(unsigned index) cons
// specified by the given character range.
String AccessibilityRenderObject::doAXStringForRange(const PlainTextRange& range) const
{
- if (isPasswordField())
- return String();
-
if (!range.length)
return String();
if (!isTextControl())
return String();
- String elementText = text();
+ String elementText = isPasswordField() ? passwordFieldValue() : text();
if (range.start + range.length > elementText.length())
return String();
@@ -3921,6 +3930,27 @@ AccessibilityRole AccessibilityRenderObject::roleValueForMSAA() const
return m_roleForMSAA;
}
+String AccessibilityRenderObject::passwordFieldValue() const
+{
+#if PLATFORM(GTK)
+ ASSERT(isPasswordField());
+
+ // Look for the RenderText object in the RenderObject tree for this input field.
+ RenderObject* renderer = node()->renderer();
+ while (renderer && !renderer->isText())
+ renderer = renderer->firstChild();
+
+ if (!renderer || !renderer->isText())
+ return String();
+
+ // Return the text that is actually being rendered in the input field.
+ return static_cast<RenderText*>(renderer)->textWithoutTranscoding();
+#else
+ // It seems only GTK is interested in this at the moment.
+ return String();
+#endif
+}
+
ScrollableArea* AccessibilityRenderObject::getScrollableAreaIfScrollable() const
{
// If the parent is a scroll view, then this object isn't really scrollable, the parent ScrollView should handle the scrolling.