Title: [123157] trunk
Revision
123157
Author
[email protected]
Date
2012-07-19 15:55:33 -0700 (Thu, 19 Jul 2012)

Log Message

Source/WebCore: WebKit should pass <title> element value as the default description for web views
https://bugs.webkit.org/show_bug.cgi?id=91763

Reviewed by Anders Carlsson.

Update the logic for determining the description for the AXWebArea to include the document's title.

Test: platform/mac/accessibility/document-title-used-for-description.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::webAreaAccessibilityDescription):
   Move web area description handling into a separate method.
(WebCore::AccessibilityRenderObject::accessibilityDescription):
* accessibility/AccessibilityRenderObject.h:
(AccessibilityRenderObject):

LayoutTests: WebKit should pass <title> element value as the default AXTitle for web views
https://bugs.webkit.org/show_bug.cgi?id=91763

Reviewed by Anders Carlsson.

* platform/mac/accessibility/document-title-used-for-description-expected.txt: Added.
* platform/mac/accessibility/document-title-used-for-description.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123156 => 123157)


--- trunk/LayoutTests/ChangeLog	2012-07-19 22:40:46 UTC (rev 123156)
+++ trunk/LayoutTests/ChangeLog	2012-07-19 22:55:33 UTC (rev 123157)
@@ -1,3 +1,13 @@
+2012-07-19  Chris Fleizach  <[email protected]>
+
+        WebKit should pass <title> element value as the default AXTitle for web views
+        https://bugs.webkit.org/show_bug.cgi?id=91763
+
+        Reviewed by Anders Carlsson.
+
+        * platform/mac/accessibility/document-title-used-for-description-expected.txt: Added.
+        * platform/mac/accessibility/document-title-used-for-description.html: Added.
+
 2012-07-19  Bruno de Oliveira Abinader  <[email protected]>
 
         [Qt] Added/updated missing fast/forms results after rebaseline

Added: trunk/LayoutTests/platform/mac/accessibility/document-title-used-for-description-expected.txt (0 => 123157)


--- trunk/LayoutTests/platform/mac/accessibility/document-title-used-for-description-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/document-title-used-for-description-expected.txt	2012-07-19 22:55:33 UTC (rev 123157)
@@ -0,0 +1,8 @@
+This tests that
+
+PASS webArea.description is 'AXDescription: FirstTitle'
+PASS webArea.description is 'AXDescription: SecondTitle'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/document-title-used-for-description.html (0 => 123157)


--- trunk/LayoutTests/platform/mac/accessibility/document-title-used-for-description.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/document-title-used-for-description.html	2012-07-19 22:55:33 UTC (rev 123157)
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<title>FirstTitle</title>
+<link rel="stylesheet" href=""
+<script>
+var successfullyParsed = false;
+</script>
+<script src=""
+</head>
+<body id="body">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that <title> will be used as the description for a web area.");
+
+    if (window.accessibilityController) {
+
+        document.getElementById("body").focus();
+        var webArea = window.accessibilityController.focusedElement;
+        shouldBe("webArea.description", "'AXDescription: FirstTitle'");
+
+        document.title = "SecondTitle";
+        shouldBe("webArea.description", "'AXDescription: SecondTitle'");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (123156 => 123157)


--- trunk/Source/WebCore/ChangeLog	2012-07-19 22:40:46 UTC (rev 123156)
+++ trunk/Source/WebCore/ChangeLog	2012-07-19 22:55:33 UTC (rev 123157)
@@ -1,3 +1,21 @@
+2012-07-19  Chris Fleizach  <[email protected]>
+
+        WebKit should pass <title> element value as the default description for web views
+        https://bugs.webkit.org/show_bug.cgi?id=91763
+
+        Reviewed by Anders Carlsson.
+
+        Update the logic for determining the description for the AXWebArea to include the document's title.
+
+        Test: platform/mac/accessibility/document-title-used-for-description.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::webAreaAccessibilityDescription):
+           Move web area description handling into a separate method.
+        (WebCore::AccessibilityRenderObject::accessibilityDescription):
+        * accessibility/AccessibilityRenderObject.h:
+        (AccessibilityRenderObject):
+
 2012-07-19  Zeev Lieber  <[email protected]>
 
         [Chromium] Textures drawn during occlusion are incorrectly re-used when unoccluded.

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (123156 => 123157)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2012-07-19 22:40:46 UTC (rev 123156)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2012-07-19 22:55:33 UTC (rev 123157)
@@ -1413,6 +1413,53 @@
     return String();
 }
 
+String AccessibilityRenderObject::webAreaAccessibilityDescription() const
+{
+    // The WebArea description should follow this order:
+    //     aria-label on the <html>
+    //     title on the <html>
+    //     <title> inside the <head> (of it was set through JS)
+    //     name on the <html>
+    // For iframes:
+    //     aria-label on the <iframe>
+    //     title on the <iframe>
+    //     name on the <iframe>
+    
+    if (!m_renderer)
+        return String();
+    
+    Document* document = m_renderer->document();
+    
+    // Check if the HTML element has an aria-label for the webpage.
+    if (Element* documentElement = document->documentElement()) {
+        const AtomicString& ariaLabel = documentElement->getAttribute(aria_labelAttr);
+        if (!ariaLabel.isEmpty())
+            return ariaLabel;
+    }
+    
+    Node* owner = document->ownerElement();
+    if (owner) {
+        if (owner->hasTagName(frameTag) || owner->hasTagName(iframeTag)) {
+            const AtomicString& title = static_cast<HTMLFrameElementBase*>(owner)->getAttribute(titleAttr);
+            if (!title.isEmpty())
+                return title;
+            return static_cast<HTMLFrameElementBase*>(owner)->getNameAttribute();
+        }
+        if (owner->isHTMLElement())
+            return toHTMLElement(owner)->getNameAttribute();
+    }
+
+    String documentTitle = document->title();
+    if (!documentTitle.isEmpty())
+        return documentTitle;
+    
+    owner = document->body();
+    if (owner && owner->isHTMLElement())
+        return toHTMLElement(owner)->getNameAttribute();
+    
+    return String();
+}
+    
 String AccessibilityRenderObject::accessibilityDescription() const
 {
     if (!m_renderer)
@@ -1441,33 +1488,9 @@
         return getAttribute(MathMLNames::alttextAttr);
 #endif
     
-    if (isWebArea()) {
-        Document* document = m_renderer->document();
-        
-        // Check if the HTML element has an aria-label for the webpage.
-        Element* documentElement = document->documentElement();
-        if (documentElement) {
-            const AtomicString& ariaLabel = documentElement->getAttribute(aria_labelAttr);
-            if (!ariaLabel.isEmpty())
-                return ariaLabel;
-        }
-        
-        Node* owner = document->ownerElement();
-        if (owner) {
-            if (owner->hasTagName(frameTag) || owner->hasTagName(iframeTag)) {
-                const AtomicString& title = static_cast<HTMLFrameElementBase*>(owner)->getAttribute(titleAttr);
-                if (!title.isEmpty())
-                    return title;
-                return static_cast<HTMLFrameElementBase*>(owner)->getNameAttribute();
-            }
-            if (owner->isHTMLElement())
-                return toHTMLElement(owner)->getNameAttribute();
-        }
-        owner = document->body();
-        if (owner && owner->isHTMLElement())
-            return toHTMLElement(owner)->getNameAttribute();
-    }
-
+    if (isWebArea())
+        return webAreaAccessibilityDescription();
+    
     return String();
 }
 

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (123156 => 123157)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2012-07-19 22:40:46 UTC (rev 123156)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h	2012-07-19 22:55:33 UTC (rev 123157)
@@ -318,7 +318,8 @@
     String accessibilityDescriptionForElements(Vector<Element*> &elements) const;
     void elementsFromAttribute(Vector<Element*>& elements, const QualifiedName&) const;
     String ariaAccessibilityDescription() const;
-    
+    String webAreaAccessibilityDescription() const;
+
     virtual ESpeak speakProperty() const;
     
     virtual const AtomicString& ariaLiveRegionStatus() const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to