Re: [PFR] <rdar://problem/5471973> Some AXLinks are not getting AXTitles though there...
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 May 2008 19:35:09 +0000 (19:35 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 May 2008 19:35:09 +0000 (19:35 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@33381 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/page/AccessibilityRenderObject.cpp

index a387072..b8821dc 100644 (file)
@@ -1,3 +1,12 @@
+2008-05-13  chris fleizach  <cfleizach@apple.com>
+
+        Reviewed by Beth Dakin
+
+        <rdar://problem/5471973> Some AXLinks are not getting AXTitles though there is title text
+
+        * page/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::title):
+
 2008-05-13  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Eric Seidel.
index e1cbf2e..c78d77f 100644 (file)
@@ -611,9 +611,13 @@ static HTMLLabelElement* labelForElement(Element* element)
 
 String AccessibilityRenderObject::title() const
 {
-    if (!m_renderer || m_areaElement || !m_renderer->element())
+    if (!m_renderer || m_areaElement)
         return String();
 
+    Node* node = m_renderer->element();
+    if (!node)
+        return String();
+    
     String ariaLabel = ariaLabeledByAttribute();
     if (!ariaLabel.isEmpty())
         return ariaLabel;
@@ -621,20 +625,29 @@ String AccessibilityRenderObject::title() const
     if (roleValue() == ButtonRole)
         return textUnderElement();
     
-    bool isInputTag = m_renderer->element()->hasTagName(inputTag);
+    bool isInputTag = node->hasTagName(inputTag);
     if (isInputTag) {
-        HTMLInputElement* input = static_cast<HTMLInputElement*>(m_renderer->element());
+        HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
         if (input->isTextButton())
             return input->value();
     }
     
     if (isInputTag || AccessibilityObject::isARIAInput(ariaRoleAttribute())) {
-        HTMLLabelElement* label = labelForElement(static_cast<Element*>(m_renderer->element()));
+        HTMLLabelElement* label = labelForElement(static_cast<Element*>(node));
         if (label)
             return label->innerText();
     }
     
-    if (isLink() || isHeading())
+    if (isLink()) {
+        Element* element = static_cast<Element*>(node);    
+        const AtomicString& title = element->getAttribute(titleAttr);
+        if (!title.isEmpty())
+            return title;    
+        
+        return textUnderElement();
+    }
+    
+    if (isHeading())
         return textUnderElement();
     
     return String();