Title: [127601] releases/WebKitGTK/webkit-1.10
Revision
127601
Author
carlo...@webkit.org
Date
2012-09-05 09:33:01 -0700 (Wed, 05 Sep 2012)

Log Message

Merge r127370 - [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 <jdi...@igalia.com> 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: releases/WebKitGTK/webkit-1.10/LayoutTests/ChangeLog (127600 => 127601)


--- releases/WebKitGTK/webkit-1.10/LayoutTests/ChangeLog	2012-09-05 16:32:43 UTC (rev 127600)
+++ releases/WebKitGTK/webkit-1.10/LayoutTests/ChangeLog	2012-09-05 16:33:01 UTC (rev 127601)
@@ -1,5 +1,22 @@
 2012-09-01  Joanmarie Diggs  <jdi...@igalia.com>
 
+        [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  Joanmarie Diggs  <jdi...@igalia.com>
+
         [Gtk] accessibility/replaced-objects-in-anonymous-blocks layout test failure
         https://bugs.webkit.org/show_bug.cgi?id=95643
 

Added: releases/WebKitGTK/webkit-1.10/LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs-expected.txt (0 => 127601)


--- releases/WebKitGTK/webkit-1.10/LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.10/LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs-expected.txt	2012-09-05 16:33:01 UTC (rev 127601)
@@ -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: releases/WebKitGTK/webkit-1.10/LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs.html (0 => 127601)


--- releases/WebKitGTK/webkit-1.10/LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.10/LayoutTests/platform/gtk/accessibility/spans-paragraphs-and-divs.html	2012-09-05 16:33:01 UTC (rev 127601)
@@ -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: releases/WebKitGTK/webkit-1.10/Source/WebCore/ChangeLog (127600 => 127601)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/ChangeLog	2012-09-05 16:32:43 UTC (rev 127600)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/ChangeLog	2012-09-05 16:33:01 UTC (rev 127601)
@@ -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  <jdi...@igalia.com>
+
+        [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: releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/AccessibilityObject.cpp (127600 => 127601)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/AccessibilityObject.cpp	2012-09-05 16:32:43 UTC (rev 127600)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/AccessibilityObject.cpp	2012-09-05 16:33:01 UTC (rev 127601)
@@ -1340,6 +1340,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: releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/AccessibilityObject.h (127600 => 127601)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/AccessibilityObject.h	2012-09-05 16:32:43 UTC (rev 127600)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/AccessibilityObject.h	2012-09-05 16:33:01 UTC (rev 127601)
@@ -582,6 +582,7 @@
     virtual void handleAriaExpandedChanged() { }
     bool isDescendantOfObject(const AccessibilityObject*) const;
     bool isAncestorOfObject(const AccessibilityObject*) const;
+    AccessibilityObject* firstAnonymousBlockChild() const;
     
     static AccessibilityRole ariaRoleToWebCoreRole(const String&);
     const AtomicString& getAttribute(const QualifiedName&) const;

Modified: releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp (127600 => 127601)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp	2012-09-05 16:32:43 UTC (rev 127600)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp	2012-09-05 16:33:01 UTC (rev 127601)
@@ -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
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to