https://bugs.webkit.org/show_bug.cgi?id=69150
Source/WebCore:
We need to map these HTML5 elements to appropriate ARIA roles. That mapping is:
article -> Document article
nav -> Landmark navigation
aside -> Landmark complementary
section -> Document region
address -> Landmark content info
header -> Landmark banner (unless it's in an article or section)
footer -> Landmark content info (unless it's in an article or section)
Reviewed by Darin Adler.
Test: platform/mac/accessibility/html-section-elements.html
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::isDescendantOfElementType):
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
* accessibility/AccessibilityRenderObject.h:
LayoutTests:
Reviewed by Darin Adler.
* platform/mac/accessibility/html-section-elements-expected.txt: Added.
* platform/mac/accessibility/html-section-elements.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96524
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2011-10-03 Chris Fleizach <cfleizach@apple.com>
+ AX: support role mapping for HTML5 section elements
+ https://bugs.webkit.org/show_bug.cgi?id=69150
+
+ Reviewed by Darin Adler.
+
+ * platform/mac/accessibility/html-section-elements-expected.txt: Added.
+ * platform/mac/accessibility/html-section-elements.html: Added.
+
+2011-10-03 Chris Fleizach <cfleizach@apple.com>
+
AX: click point for AXHeadings often returns point on empty space (results in wrong context menu)
https://bugs.webkit.org/show_bug.cgi?id=69262
--- /dev/null
+header
+footer
+section
+article
+nav
+aside
+Should be IGNORED because it's inside an article, so it should not be a landmark
+Should be IGNORED because it's inside an article, so it should not be a landmark
+Should be IGNORED because it's inside a section, so it should not be a landmark
+Should be IGNORED because it's inside a section, so it should not be a landmark
+This tests that the HTML5 section elements map to the correct AX roles.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS body.childAtIndex(0).subrole is 'AXSubrole: AXLandmarkBanner'
+PASS body.childAtIndex(1).subrole is 'AXSubrole: AXLandmarkContentInfo'
+PASS body.childAtIndex(2).subrole is 'AXSubrole: AXDocumentRegion'
+PASS body.childAtIndex(3).subrole is 'AXSubrole: AXDocumentArticle'
+PASS body.childAtIndex(4).subrole is 'AXSubrole: AXLandmarkNavigation'
+PASS body.childAtIndex(5).subrole is 'AXSubrole: AXLandmarkComplementary'
+PASS body.childAtIndex(6).childAtIndex(0).subrole is 'AXSubrole: '
+PASS body.childAtIndex(6).childAtIndex(1).subrole is 'AXSubrole: '
+PASS body.childAtIndex(7).childAtIndex(0).subrole is 'AXSubrole: '
+PASS body.childAtIndex(7).childAtIndex(1).subrole is 'AXSubrole: '
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<header>header</header>
+<footer>footer</footer>
+<section>section</section>
+<article>article</article>
+<nav>nav</nav>
+<aside>aside</aside>
+
+<article>
+<header>Should be IGNORED because it's inside an article, so it should not be a landmark</header>
+<footer>Should be IGNORED because it's inside an article, so it should not be a landmark</footer>
+</article>
+
+<section>
+<header>Should be IGNORED because it's inside a section, so it should not be a landmark</header>
+<footer>Should be IGNORED because it's inside a section, so it should not be a landmark</footer>
+</section>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests that the HTML5 section elements map to the correct AX roles.");
+
+ if (window.accessibilityController) {
+
+ document.getElementById("body").focus();
+ var body = accessibilityController.focusedElement;
+ shouldBe("body.childAtIndex(0).subrole", "'AXSubrole: AXLandmarkBanner'");
+ shouldBe("body.childAtIndex(1).subrole", "'AXSubrole: AXLandmarkContentInfo'");
+ shouldBe("body.childAtIndex(2).subrole", "'AXSubrole: AXDocumentRegion'");
+ shouldBe("body.childAtIndex(3).subrole", "'AXSubrole: AXDocumentArticle'");
+ shouldBe("body.childAtIndex(4).subrole", "'AXSubrole: AXLandmarkNavigation'");
+ shouldBe("body.childAtIndex(5).subrole", "'AXSubrole: AXLandmarkComplementary'");
+
+ // When a header and footer are inside an article, they should not be landmarks.
+ shouldBe("body.childAtIndex(6).childAtIndex(0).subrole", "'AXSubrole: '");
+ shouldBe("body.childAtIndex(6).childAtIndex(1).subrole", "'AXSubrole: '");
+
+ // When a header and footer are inside a section, they should not be landmarks.
+ shouldBe("body.childAtIndex(7).childAtIndex(0).subrole", "'AXSubrole: '");
+ shouldBe("body.childAtIndex(7).childAtIndex(1).subrole", "'AXSubrole: '");
+ }
+
+ successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
2011-10-03 Chris Fleizach <cfleizach@apple.com>
+ AX: support role mapping for HTML5 section elements
+ https://bugs.webkit.org/show_bug.cgi?id=69150
+
+ We need to map these HTML5 elements to appropriate ARIA roles. That mapping is:
+ article -> Document article
+ nav -> Landmark navigation
+ aside -> Landmark complementary
+ section -> Document region
+ address -> Landmark content info
+ header -> Landmark banner (unless it's in an article or section)
+ footer -> Landmark content info (unless it's in an article or section)
+
+ Reviewed by Darin Adler.
+
+ Test: platform/mac/accessibility/html-section-elements.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::isDescendantOfElementType):
+ (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
+ * accessibility/AccessibilityRenderObject.h:
+
+2011-10-03 Chris Fleizach <cfleizach@apple.com>
+
AX: click point for AXHeadings often returns point on empty space (results in wrong context menu)
https://bugs.webkit.org/show_bug.cgi?id=69262
childrenChanged();
}
+bool AccessibilityRenderObject::isDescendantOfElementType(const QualifiedName& tagName) const
+{
+ for (RenderObject* parent = m_renderer->parent(); parent; parent = parent->parent()) {
+ if (parent->node() && parent->node()->hasTagName(tagName))
+ return true;
+ }
+ return false;
+}
+
AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
{
if (!m_renderer)
return GroupRole;
#endif
+ if (node && node->hasTagName(articleTag))
+ return DocumentArticleRole;
+
+ if (node && node->hasTagName(navTag))
+ return LandmarkNavigationRole;
+
+ if (node && node->hasTagName(asideTag))
+ return LandmarkComplementaryRole;
+
+ if (node && node->hasTagName(sectionTag))
+ return DocumentRegionRole;
+
+ if (node && node->hasTagName(addressTag))
+ return LandmarkContentInfoRole;
+
+ // There should only be one banner/contentInfo per page. If header/footer are being used within an article or section
+ // then it should not be exposed as whole page's banner/contentInfo
+ if (node && node->hasTagName(headerTag) && !isDescendantOfElementType(articleTag) && !isDescendantOfElementType(sectionTag))
+ return LandmarkBannerRole;
+ if (node && node->hasTagName(footerTag) && !isDescendantOfElementType(articleTag) && !isDescendantOfElementType(sectionTag))
+ return LandmarkContentInfoRole;
+
if (m_renderer->isBlockFlow())
return GroupRole;
AccessibilityObject* accessibilityParentForImageMap(HTMLMapElement*) const;
bool renderObjectIsObservable(RenderObject*) const;
RenderObject* renderParentObject() const;
+ bool isDescendantOfElementType(const QualifiedName& tagName) const;
void ariaSelectedRows(AccessibilityChildrenVector&);