Source/WebCore/ChangeLog

33 [Gtk] No accessible caret-moved events found in certain content
44 https://bugs.webkit.org/show_bug.cgi?id=72811
55
 6 Part of the bug was due to expected accessible objects of DivRole
 7 and ParagraphRole being ignored, in favor of including child blocks.
 8
 9 Reviewed by Chris Fleizach.
 10
 11 Test: platform/gtk/accessibility/spans-paragraphs-and-divs.html
 12
 13 * accessibility/AccessibilityObject.cpp:
 14 (WebCore::AccessibilityObject::firstAnonymousBlockChild):
 15 (WebCore):
 16 * accessibility/AccessibilityObject.h:
 17 (AccessibilityObject):
 18 New method to return the first child which is an anonymous block.
 19 * accessibility/gtk/AccessibilityObjectAtk.cpp:
 20 (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
 21 Include paragraphs and divs which contain a non-nested anonymous block.
 22
 232012-09-01 Joanmarie Diggs <jdiggs@igalia.com>
 24
 25 [Gtk] No accessible caret-moved events found in certain content
 26 https://bugs.webkit.org/show_bug.cgi?id=72811
 27
628 Part of the bug was due to extraneous accessible objects resulting
729 from unignored inline and block spans.
830

Source/WebCore/accessibility/AccessibilityObject.cpp

@@bool AccessibilityObject::isAncestorOfObject(const AccessibilityObject* axObject
13531353 return this == axObject || axObject->isDescendantOfObject(this);
13541354}
13551355
 1356AccessibilityObject* AccessibilityObject::firstAnonymousBlockChild() const
 1357{
 1358 for (AccessibilityObject* child = firstChild(); child; child = child->nextSibling()) {
 1359 if (child->renderer() && child->renderer()->isAnonymousBlock())
 1360 return child;
 1361 }
 1362 return 0;
 1363}
 1364
13561365typedef HashMap<String, AccessibilityRole, CaseFoldingHash> ARIARoleMap;
13571366
13581367struct RoleEntry {

Source/WebCore/accessibility/AccessibilityObject.h

@@public:
586586 virtual void handleAriaExpandedChanged() { }
587587 bool isDescendantOfObject(const AccessibilityObject*) const;
588588 bool isAncestorOfObject(const AccessibilityObject*) const;
 589 AccessibilityObject* firstAnonymousBlockChild() const;
589590
590591 static AccessibilityRole ariaRoleToWebCoreRole(const String&);
591592 bool hasAttribute(const QualifiedName&) const;

Source/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp

@@AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesO
7878 if (role == UnknownRole)
7979 return IgnoreObject;
8080
 81 // Given a paragraph or div containing a non-nested anonymous block, WebCore
 82 // ignores the paragraph or div and includes the block. We want the opposite:
 83 // ATs are expecting accessible objects associated with textual elements. They
 84 // usually have no need for the anonymous block. And when the wrong objects
 85 // get included or ignored, needed accessibility signals do not get emitted.
 86 if (role == ParagraphRole || role == DivRole) {
 87 AccessibilityObject* child = firstAnonymousBlockChild();
 88 if (!child)
 89 return DefaultBehavior;
 90
 91 child = child->firstChild();
 92 if (child->isLink() || !child->firstAnonymousBlockChild())
 93 return IncludeObject;
 94 }
 95
8196 // Block spans result in objects of ATK_ROLE_PANEL which are almost always unwanted.
8297 // However, if we ignore block spans whose parent is the body, the child controls
8398 // will become immediate children of the ATK_ROLE_DOCUMENT_FRAME and any text will

LayoutTests/ChangeLog

33 [Gtk] No accessible caret-moved events found in certain content
44 https://bugs.webkit.org/show_bug.cgi?id=72811
55
 6 Part of the bug was due to expected accessible objects of DivRole
 7 and ParagraphRole being ignored, in favor of including child blocks.
 8
 9 Reviewed by Chris Fleizach.
 10
 11 Added new test to verify that paragraphs and divs which contain anonymous
 12 blocks are included in the accessible object hierarchy and have the correct
 13 number of children with the expected role.
 14
 15 * platform/gtk/accessibility/spans-paragraphs-and-divs-expected.txt: Added.
 16 * platform/gtk/accessibility/spans-paragraphs-and-divs.html: Added.
 17
 182012-09-01 Joanmarie Diggs <jdiggs@igalia.com>
 19
 20 [Gtk] No accessible caret-moved events found in certain content
 21 https://bugs.webkit.org/show_bug.cgi?id=72811
 22
623 Part of the bug was due to extraneous accessible objects resulting
724 from unignored inline and block spans.
825

LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs-expected.txt

 1Block span in a link in a paragraph
 2Inline span in a link in a paragraph
 3
 4Block span in a paragraph
 5Inline span in a paragraph
 6
 7Inline span in a link in a paragraph
 8Block span in a link in a paragraph
 9
 10Inline span in a paragraph
 11Block span in a paragraph
 12Block span in a link in a div
 13Inline span in a link in a div
 14Block span in a div
 15Inline span in a div
 16Inline span in a link in a div
 17Block span in a link in a div
 18Inline span in a div
 19Block span in a div
 20This tests that paragraphs and divs with anonymous block children are not ignored and have the expected children
 21
 22On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 23
 24
 25PASS element.role is 'AXRole: paragraph'
 26PASS element.childrenCount is 1
 27PASS link.role is 'AXRole: link'
 28PASS link.childrenCount is 0
 29PASS element.role is 'AXRole: paragraph'
 30PASS element.childrenCount is 0
 31PASS element.role is 'AXRole: paragraph'
 32PASS element.childrenCount is 1
 33PASS link.role is 'AXRole: link'
 34PASS link.childrenCount is 0
 35PASS element.role is 'AXRole: paragraph'
 36PASS element.childrenCount is 0
 37PASS element.role is 'AXRole: section'
 38PASS element.childrenCount is 1
 39PASS link.role is 'AXRole: link'
 40PASS link.childrenCount is 0
 41PASS element.role is 'AXRole: section'
 42PASS element.childrenCount is 0
 43PASS element.role is 'AXRole: section'
 44PASS element.childrenCount is 1
 45PASS link.role is 'AXRole: link'
 46PASS link.childrenCount is 0
 47PASS element.role is 'AXRole: section'
 48PASS element.childrenCount is 0
 49PASS successfullyParsed is true
 50
 51TEST COMPLETE
 52

LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<script src="../../../fast/js/resources/js-test-pre.js"></script>
 5</head>
 6<body id="body">
 7 <p>
 8 <a href='foo'>
 9 <span style='display:block;'>Block span in a link in a paragraph</span>
 10 <span>Inline span in a link in a paragraph</span>
 11 </a>
 12 </p>
 13 <p>
 14 <span style='display:block;'>Block span in a paragraph</span>
 15 <span>Inline span in a paragraph</span>
 16 </p>
 17 <p>
 18 <a href='foo'>
 19 <span>Inline span in a link in a paragraph</span>
 20 <span style='display:block;'>Block span in a link in a paragraph</span>
 21 </a>
 22 </p>
 23 <p>
 24 <span>Inline span in a paragraph</span>
 25 <span style='display:block;'>Block span in a paragraph</span>
 26 </p>
 27 <div>
 28 <a href='foo'>
 29 <span style='display:block;'>Block span in a link in a div</span>
 30 <span>Inline span in a link in a div</span>
 31 </a>
 32 </div>
 33 <div>
 34 <span style='display:block;'>Block span in a div</span>
 35 <span>Inline span in a div</span>
 36 </div>
 37 <div>
 38 <a href='foo'>
 39 <span>Inline span in a link in a div</span>
 40 <span style='display:block;'>Block span in a link in a div</span>
 41 </a>
 42 </div>
 43 <div>
 44 <span>Inline span in a div</span>
 45 <span style='display:block;'>Block span in a div</span>
 46 </div>
 47
 48<p id="description"></p>
 49<div id="console"></div>
 50<script>
 51description("This tests that paragraphs and divs with anonymous block children are not ignored and have the expected children");
 52
 53if (window.layoutController) {
 54 testRunner.dumpAsText();
 55}
 56
 57if (window.accessibilityController) {
 58 document.getElementById("body").focus();
 59 var webArea = accessibilityController.focusedElement;
 60
 61 var element = webArea.childAtIndex(0);
 62 shouldBe("element.role", "'AXRole: paragraph'");
 63 shouldBe("element.childrenCount", "1");
 64
 65 var link = element.childAtIndex(0);
 66 shouldBe("link.role", "'AXRole: link'");
 67 shouldBe("link.childrenCount", "0");
 68
 69 element = webArea.childAtIndex(1);
 70 shouldBe("element.role", "'AXRole: paragraph'");
 71 shouldBe("element.childrenCount", "0");
 72
 73 element = webArea.childAtIndex(2);
 74 shouldBe("element.role", "'AXRole: paragraph'");
 75 shouldBe("element.childrenCount", "1");
 76
 77 link = element.childAtIndex(0);
 78 shouldBe("link.role", "'AXRole: link'");
 79 shouldBe("link.childrenCount", "0");
 80
 81 element = webArea.childAtIndex(3);
 82 shouldBe("element.role", "'AXRole: paragraph'");
 83 shouldBe("element.childrenCount", "0");
 84
 85 element = webArea.childAtIndex(4);
 86 shouldBe("element.role", "'AXRole: section'");
 87 shouldBe("element.childrenCount", "1");
 88
 89 link = element.childAtIndex(0);
 90 shouldBe("link.role", "'AXRole: link'");
 91 shouldBe("link.childrenCount", "0");
 92
 93 element = webArea.childAtIndex(5);
 94 shouldBe("element.role", "'AXRole: section'");
 95 shouldBe("element.childrenCount", "0");
 96
 97 element = webArea.childAtIndex(6);
 98 shouldBe("element.role", "'AXRole: section'");
 99 shouldBe("element.childrenCount", "1");
 100
 101 link = element.childAtIndex(0);
 102 shouldBe("link.role", "'AXRole: link'");
 103 shouldBe("link.childrenCount", "0");
 104
 105 element = webArea.childAtIndex(7);
 106 shouldBe("element.role", "'AXRole: section'");
 107 shouldBe("element.childrenCount", "0");
 108}
 109
 110</script>
 111<script src="../../../fast/js/resources/js-test-post.js"></script>
 112</body>
 113</html>