- Revision
- 127370
- Author
- [email protected]
- Date
- 2012-09-01 03:51:25 -0700 (Sat, 01 Sep 2012)
Log Message
[Gtk] No accessible caret-moved events found in certain content
https://bugs.webkit.org/show_bug.cgi?id=72811
Part of the bug was due to expected accessible objects of DivRole
and ParagraphRole being ignored, in favor of including child blocks.
Patch by Joanmarie Diggs <[email protected]> on 2012-09-01
Reviewed by Chris Fleizach.
Source/WebCore:
Test: platform/gtk/accessibility/spans-paragraphs-and-divs.html
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::firstAnonymousBlockChild):
(WebCore):
* accessibility/AccessibilityObject.h:
(AccessibilityObject):
New method to return the first child which is an anonymous block.
* accessibility/gtk/AccessibilityObjectAtk.cpp:
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
Include paragraphs and divs which contain a non-nested anonymous block.
LayoutTests:
Added new test to verify that paragraphs and divs which contain anonymous
blocks are included in the accessible object hierarchy and have the correct
number of children with the expected role.
* platform/gtk/accessibility/spans-paragraphs-and-divs-expected.txt: Added.
* platform/gtk/accessibility/spans-paragraphs-and-divs.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (127369 => 127370)
--- trunk/LayoutTests/ChangeLog 2012-09-01 10:47:16 UTC (rev 127369)
+++ trunk/LayoutTests/ChangeLog 2012-09-01 10:51:25 UTC (rev 127370)
@@ -1,3 +1,20 @@
+2012-09-01 Joanmarie Diggs <[email protected]>
+
+ [Gtk] No accessible caret-moved events found in certain content
+ https://bugs.webkit.org/show_bug.cgi?id=72811
+
+ Part of the bug was due to expected accessible objects of DivRole
+ and ParagraphRole being ignored, in favor of including child blocks.
+
+ Reviewed by Chris Fleizach.
+
+ Added new test to verify that paragraphs and divs which contain anonymous
+ blocks are included in the accessible object hierarchy and have the correct
+ number of children with the expected role.
+
+ * platform/gtk/accessibility/spans-paragraphs-and-divs-expected.txt: Added.
+ * platform/gtk/accessibility/spans-paragraphs-and-divs.html: Added.
+
2012-09-01 Zan Dobersek <[email protected]>
Unreviewed GTK gardening, rebaselining an accessibility test.
Added: trunk/LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs-expected.txt (0 => 127370)
--- trunk/LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs-expected.txt 2012-09-01 10:51:25 UTC (rev 127370)
@@ -0,0 +1,52 @@
+Block span in a link in a paragraph
+Inline span in a link in a paragraph
+
+Block span in a paragraph
+Inline span in a paragraph
+
+Inline span in a link in a paragraph
+Block span in a link in a paragraph
+
+Inline span in a paragraph
+Block span in a paragraph
+Block span in a link in a div
+Inline span in a link in a div
+Block span in a div
+Inline span in a div
+Inline span in a link in a div
+Block span in a link in a div
+Inline span in a div
+Block span in a div
+This tests that paragraphs and divs with anonymous block children are not ignored and have the expected children
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS element.role is 'AXRole: paragraph'
+PASS element.childrenCount is 1
+PASS link.role is 'AXRole: link'
+PASS link.childrenCount is 0
+PASS element.role is 'AXRole: paragraph'
+PASS element.childrenCount is 0
+PASS element.role is 'AXRole: paragraph'
+PASS element.childrenCount is 1
+PASS link.role is 'AXRole: link'
+PASS link.childrenCount is 0
+PASS element.role is 'AXRole: paragraph'
+PASS element.childrenCount is 0
+PASS element.role is 'AXRole: section'
+PASS element.childrenCount is 1
+PASS link.role is 'AXRole: link'
+PASS link.childrenCount is 0
+PASS element.role is 'AXRole: section'
+PASS element.childrenCount is 0
+PASS element.role is 'AXRole: section'
+PASS element.childrenCount is 1
+PASS link.role is 'AXRole: link'
+PASS link.childrenCount is 0
+PASS element.role is 'AXRole: section'
+PASS element.childrenCount is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs.html (0 => 127370)
--- trunk/LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs.html (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs.html 2012-09-01 10:51:25 UTC (rev 127370)
@@ -0,0 +1,113 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+ <p>
+ <a href=''>
+ <span style='display:block;'>Block span in a link in a paragraph</span>
+ <span>Inline span in a link in a paragraph</span>
+ </a>
+ </p>
+ <p>
+ <span style='display:block;'>Block span in a paragraph</span>
+ <span>Inline span in a paragraph</span>
+ </p>
+ <p>
+ <a href=''>
+ <span>Inline span in a link in a paragraph</span>
+ <span style='display:block;'>Block span in a link in a paragraph</span>
+ </a>
+ </p>
+ <p>
+ <span>Inline span in a paragraph</span>
+ <span style='display:block;'>Block span in a paragraph</span>
+ </p>
+ <div>
+ <a href=''>
+ <span style='display:block;'>Block span in a link in a div</span>
+ <span>Inline span in a link in a div</span>
+ </a>
+ </div>
+ <div>
+ <span style='display:block;'>Block span in a div</span>
+ <span>Inline span in a div</span>
+ </div>
+ <div>
+ <a href=''>
+ <span>Inline span in a link in a div</span>
+ <span style='display:block;'>Block span in a link in a div</span>
+ </a>
+ </div>
+ <div>
+ <span>Inline span in a div</span>
+ <span style='display:block;'>Block span in a div</span>
+ </div>
+
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("This tests that paragraphs and divs with anonymous block children are not ignored and have the expected children");
+
+if (window.layoutController) {
+ testRunner.dumpAsText();
+}
+
+if (window.accessibilityController) {
+ document.getElementById("body").focus();
+ var webArea = accessibilityController.focusedElement;
+
+ var element = webArea.childAtIndex(0);
+ shouldBe("element.role", "'AXRole: paragraph'");
+ shouldBe("element.childrenCount", "1");
+
+ var link = element.childAtIndex(0);
+ shouldBe("link.role", "'AXRole: link'");
+ shouldBe("link.childrenCount", "0");
+
+ element = webArea.childAtIndex(1);
+ shouldBe("element.role", "'AXRole: paragraph'");
+ shouldBe("element.childrenCount", "0");
+
+ element = webArea.childAtIndex(2);
+ shouldBe("element.role", "'AXRole: paragraph'");
+ shouldBe("element.childrenCount", "1");
+
+ link = element.childAtIndex(0);
+ shouldBe("link.role", "'AXRole: link'");
+ shouldBe("link.childrenCount", "0");
+
+ element = webArea.childAtIndex(3);
+ shouldBe("element.role", "'AXRole: paragraph'");
+ shouldBe("element.childrenCount", "0");
+
+ element = webArea.childAtIndex(4);
+ shouldBe("element.role", "'AXRole: section'");
+ shouldBe("element.childrenCount", "1");
+
+ link = element.childAtIndex(0);
+ shouldBe("link.role", "'AXRole: link'");
+ shouldBe("link.childrenCount", "0");
+
+ element = webArea.childAtIndex(5);
+ shouldBe("element.role", "'AXRole: section'");
+ shouldBe("element.childrenCount", "0");
+
+ element = webArea.childAtIndex(6);
+ shouldBe("element.role", "'AXRole: section'");
+ shouldBe("element.childrenCount", "1");
+
+ link = element.childAtIndex(0);
+ shouldBe("link.role", "'AXRole: link'");
+ shouldBe("link.childrenCount", "0");
+
+ element = webArea.childAtIndex(7);
+ shouldBe("element.role", "'AXRole: section'");
+ shouldBe("element.childrenCount", "0");
+}
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (127369 => 127370)
--- trunk/Source/WebCore/ChangeLog 2012-09-01 10:47:16 UTC (rev 127369)
+++ trunk/Source/WebCore/ChangeLog 2012-09-01 10:51:25 UTC (rev 127370)
@@ -3,6 +3,28 @@
[Gtk] No accessible caret-moved events found in certain content
https://bugs.webkit.org/show_bug.cgi?id=72811
+ Part of the bug was due to expected accessible objects of DivRole
+ and ParagraphRole being ignored, in favor of including child blocks.
+
+ Reviewed by Chris Fleizach.
+
+ Test: platform/gtk/accessibility/spans-paragraphs-and-divs.html
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::firstAnonymousBlockChild):
+ (WebCore):
+ * accessibility/AccessibilityObject.h:
+ (AccessibilityObject):
+ New method to return the first child which is an anonymous block.
+ * accessibility/gtk/AccessibilityObjectAtk.cpp:
+ (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
+ Include paragraphs and divs which contain a non-nested anonymous block.
+
+2012-09-01 Joanmarie Diggs <[email protected]>
+
+ [Gtk] No accessible caret-moved events found in certain content
+ https://bugs.webkit.org/show_bug.cgi?id=72811
+
Part of the bug was due to extraneous accessible objects resulting
from unignored inline and block spans.
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (127369 => 127370)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2012-09-01 10:47:16 UTC (rev 127369)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2012-09-01 10:51:25 UTC (rev 127370)
@@ -1353,6 +1353,15 @@
return this == axObject || axObject->isDescendantOfObject(this);
}
+AccessibilityObject* AccessibilityObject::firstAnonymousBlockChild() const
+{
+ for (AccessibilityObject* child = firstChild(); child; child = child->nextSibling()) {
+ if (child->renderer() && child->renderer()->isAnonymousBlock())
+ return child;
+ }
+ return 0;
+}
+
typedef HashMap<String, AccessibilityRole, CaseFoldingHash> ARIARoleMap;
struct RoleEntry {
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (127369 => 127370)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2012-09-01 10:47:16 UTC (rev 127369)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2012-09-01 10:51:25 UTC (rev 127370)
@@ -586,6 +586,7 @@
virtual void handleAriaExpandedChanged() { }
bool isDescendantOfObject(const AccessibilityObject*) const;
bool isAncestorOfObject(const AccessibilityObject*) const;
+ AccessibilityObject* firstAnonymousBlockChild() const;
static AccessibilityRole ariaRoleToWebCoreRole(const String&);
bool hasAttribute(const QualifiedName&) const;
Modified: trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp (127369 => 127370)
--- trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp 2012-09-01 10:47:16 UTC (rev 127369)
+++ trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp 2012-09-01 10:51:25 UTC (rev 127370)
@@ -78,6 +78,21 @@
if (role == UnknownRole)
return IgnoreObject;
+ // Given a paragraph or div containing a non-nested anonymous block, WebCore
+ // ignores the paragraph or div and includes the block. We want the opposite:
+ // ATs are expecting accessible objects associated with textual elements. They
+ // usually have no need for the anonymous block. And when the wrong objects
+ // get included or ignored, needed accessibility signals do not get emitted.
+ if (role == ParagraphRole || role == DivRole) {
+ AccessibilityObject* child = firstAnonymousBlockChild();
+ if (!child)
+ return DefaultBehavior;
+
+ child = child->firstChild();
+ if (child->isLink() || !child->firstAnonymousBlockChild())
+ return IncludeObject;
+ }
+
// Block spans result in objects of ATK_ROLE_PANEL which are almost always unwanted.
// However, if we ignore block spans whose parent is the body, the child controls
// will become immediate children of the ATK_ROLE_DOCUMENT_FRAME and any text will