+2004-12-09 John Sullivan <sullivan@apple.com>
+
+ Reviewed by Dave.
+
+ - fixed <rdar://problem/3731099> Move AXTitle string for image elements to AXDescription
+
+ * kwq/KWQAccObject.mm:
+ (-[KWQAccObject title]): moved image alt tag code out of here
+ (-[KWQAccObject accessibilityDescription]): moved image alt tag code into this new method
+ (-[KWQAccObject accessibilityAttributeNames]): include AXDescription in the set of attributes
+ that ordinary elements return; this means that ordinary elements that aren't images will return
+ a nil description, which isn't ideal, but is in keeping with the way the rest of these attributes
+ work here.
+ (-[KWQAccObject accessibilityAttributeValue:]):
+ call accessibilityDescription when asked for AXDescription
+
2004-12-09 Ken Kocienda <kocienda@apple.com>
Reviewed by Harrison
using khtml::RenderListMarker;
using khtml::RenderImage;
+/* NSAccessibilityDescriptionAttribute is only defined on 10.4 and newer */
+#if BUILDING_ON_PANTHER
+#define ACCESSIBILITY_DESCRIPTION_ATTRIBUTE @"AXDescription"
+#else
+#define ACCESSIBILITY_DESCRIPTION_ATTRIBUTE NSAccessibilityDescriptionAttribute
+#endif
+
// FIXME: This will eventually need to really localize.
#define UI_STRING(string, comment) ((NSString *)[NSString stringWithUTF8String:(string)])
{
if (!m_renderer || m_areaElement)
return nil;
+
+ if (m_renderer->element() && m_renderer->element()->isHTMLElement() &&
+ Node(m_renderer->element()).elementId() == ID_BUTTON)
+ return [self textUnderElement];
+ else if (m_renderer->element() && m_renderer->element()->hasAnchor())
+ return [self textUnderElement];
+
+ return nil;
+}
+-(NSString*)accessibilityDescription
+{
+ if (!m_renderer || m_areaElement)
+ return nil;
+
if (m_renderer->isImage()) {
if (m_renderer->element() && m_renderer->element()->isHTMLElement()) {
QString alt = static_cast<ElementImpl*>(m_renderer->element())->getAttribute(ATTR_ALT).string();
return !alt.isEmpty() ? alt.getNSString() : nil;
}
}
- else if (m_renderer->element() && m_renderer->element()->isHTMLElement() &&
- Node(m_renderer->element()).elementId() == ID_BUTTON)
- return [self textUnderElement];
- else if (m_renderer->element() && m_renderer->element()->hasAnchor())
- return [self textUnderElement];
-
+
return nil;
}
NSAccessibilityPositionAttribute,
NSAccessibilitySizeAttribute,
NSAccessibilityTitleAttribute,
+ ACCESSIBILITY_DESCRIPTION_ATTRIBUTE,
NSAccessibilityValueAttribute,
NSAccessibilityFocusedAttribute,
NSAccessibilityEnabledAttribute,
if ([attributeName isEqualToString: NSAccessibilityTitleAttribute])
return [self title];
+ if ([attributeName isEqualToString: ACCESSIBILITY_DESCRIPTION_ATTRIBUTE])
+ return [self accessibilityDescription];
+
if ([attributeName isEqualToString: NSAccessibilityValueAttribute])
return [self value];