Title: [200844] releases/WebKitGTK/webkit-2.12
Revision
200844
Author
[email protected]
Date
2016-05-13 04:51:43 -0700 (Fri, 13 May 2016)

Log Message

Merge r200188 - AX: [ATK] We need to be smarter about flattening and the accessible text implementation
https://bugs.webkit.org/show_bug.cgi?id=144639

Reviewed by Chris Fleizach.

Source/WebCore:

Defer to WebCore Accessibility more regarding when to include anonymous blocks in the
accessibility tree. Explicitly flatten menu items, headings, list items, and paragraphs
in order to preserve the expected platform behavior for backwards compatibility. Also
map anonymous table parts to DivRole rather than GroupRole for GTK and EFL because ATK
has separate roles for generic text block elements and other generic containers.

Tests: accessibility/gtk/nested-block-element-children.html
       accessibility/gtk/spans-paragraphs-and-divs-tree.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
* accessibility/atk/AccessibilityObjectAtk.cpp:
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):

LayoutTests:

Added two new tests and updated three existing tests to reflect the new behavior
regarding inclusion of elements in the accessibility tree and the text value of
included elements.

* accessibility/gtk/nested-block-element-children-expected.txt: Added.
* accessibility/gtk/nested-block-element-children.html: Added.
* accessibility/gtk/spans-paragraphs-and-divs-expected.txt: Updated for new behavior.
* accessibility/gtk/spans-paragraphs-and-divs-tree-expected.txt: Added.
* accessibility/gtk/spans-paragraphs-and-divs-tree.html: Added.
* accessibility/gtk/spans-paragraphs-and-divs.html: Updated for new behavior.
* platform/gtk/accessibility/generated-content-with-display-table-crash-expected.txt: Updated for new behavior.
* platform/gtk/accessibility/gtk/replaced-objects-in-anonymous-blocks-expected.txt: Updated for new behavior.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog (200843 => 200844)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog	2016-05-13 11:49:56 UTC (rev 200843)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog	2016-05-13 11:51:43 UTC (rev 200844)
@@ -1,3 +1,23 @@
+2016-04-28  Joanmarie Diggs  <[email protected]>
+
+        AX: [ATK] We need to be smarter about flattening and the accessible text implementation
+        https://bugs.webkit.org/show_bug.cgi?id=144639
+
+        Reviewed by Chris Fleizach.
+
+        Added two new tests and updated three existing tests to reflect the new behavior
+        regarding inclusion of elements in the accessibility tree and the text value of
+        included elements.
+
+        * accessibility/gtk/nested-block-element-children-expected.txt: Added.
+        * accessibility/gtk/nested-block-element-children.html: Added.
+        * accessibility/gtk/spans-paragraphs-and-divs-expected.txt: Updated for new behavior.
+        * accessibility/gtk/spans-paragraphs-and-divs-tree-expected.txt: Added.
+        * accessibility/gtk/spans-paragraphs-and-divs-tree.html: Added.
+        * accessibility/gtk/spans-paragraphs-and-divs.html: Updated for new behavior.
+        * platform/gtk/accessibility/generated-content-with-display-table-crash-expected.txt: Updated for new behavior.
+        * platform/gtk/accessibility/gtk/replaced-objects-in-anonymous-blocks-expected.txt: Updated for new behavior.
+
 2016-04-27  Hunseop Jeong  <[email protected]>
 
         [EFL][GTK] Volume slider only changes volume when thumb is released, not while dragging

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/nested-block-element-children-expected.txt (0 => 200844)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/nested-block-element-children-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/nested-block-element-children-expected.txt	2016-05-13 11:51:43 UTC (rev 200844)
@@ -0,0 +1,47 @@
+AXRole: AXWebArea 
+    AXRole: AXSection AXValue: Test 1
+    AXRole: AXHeading AXValue: Test 1
+        AXRole: AXLink AXValue: Test 1
+    AXRole: AXHeading AXValue: Test 1
+    AXRole: AXParagraph AXValue: Test 1
+    AXRole: AXHeading AXValue: Test 2
+        AXRole: AXLink AXValue: Test 2
+    AXRole: AXHeading AXValue: Test 2
+    AXRole: AXParagraph AXValue: Test 2
+    AXRole: AXSection AXValue: Test 3
+    AXRole: AXHeading AXValue: Test 3
+        AXRole: AXLink AXValue: Test 3
+    AXRole: AXHeading AXValue: Test 3
+    AXRole: AXHeading AXValue: Test 3
+    AXRole: AXParagraph AXValue: Test 3
+    AXRole: AXHeading AXValue: Test 4
+        AXRole: AXLink AXValue: Test 4
+    AXRole: AXHeading AXValue: Test 4
+    AXRole: AXParagraph AXValue: Test 4
+    AXRole: AXSection AXValue: Test 5
+    AXRole: AXSection AXValue: Test 5
+    AXRole: AXSection AXValue: Test 5<\n>
+    AXRole: AXParagraph AXValue: Test 6
+    AXRole: AXParagraph AXValue: Test 7
+    AXRole: AXParagraph AXValue: Test 8<\n>
+    AXRole: AXParagraph AXValue: Test 9 Test 9
+    AXRole: AXParagraph AXValue: Test 10<\n>Test 10<\n>
+    AXRole: AXParagraph AXValue: Test 11 Test 11<\n>Test 11<\n>
+    AXRole: AXParagraph AXValue: <obj>
+        AXRole: AXButton 
+    AXRole: AXParagraph AXValue: Test 13  <obj>
+        AXRole: AXButton 
+    AXRole: AXParagraph AXValue: Test 14  <obj>
+        AXRole: AXButton 
+    AXRole: AXParagraph AXValue: <obj><\n>Test 15<\n>
+        AXRole: AXButton 
+    AXRole: AXSection AXValue: End of test
+This verifies the accessibility tree when there are nested block element children.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/nested-block-element-children.html (0 => 200844)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/nested-block-element-children.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/nested-block-element-children.html	2016-05-13 11:51:43 UTC (rev 200844)
@@ -0,0 +1,94 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<style>
+.cell { display:table-cell; width:100px; border:solid red; }
+</style>
+<script src=""
+<script src=""
+</head>
+<body id="body">
+<div id="content">
+  <div>
+    <span>Test 1</span>
+    <h1><a href="" 1</a></h1>
+    <h2>Test 1</h2>
+    <p>Test 1</p>
+  </div>
+  <div>
+    <span style="display:block;">Test 2</span>
+    <h1><a href="" 2</a></h1>
+    <h2>Test 2</h2>
+    <p>Test 2</p>
+  </div>
+  <div>
+    Test 3
+    <h1><a href="" 3</a></h1>
+    <h1>Test 3</h1>
+    <h2>Test 3</h2>
+    <p>Test 3</p>
+  </div>
+  <div>
+    <h1><a href="" 4</a></h1>
+    <h2>Test 4</h2>
+    <p>Test 4</p>
+  </div>
+  <div style="display:table;">
+    <div style="display:table-row;">
+      <div class="cell">Test 5</div>
+      <div class="cell"><span>Test 5</span></div>
+      <div class="cell"><span style="display:block">Test 5</span></div>
+    </div>
+  </div>
+  <p>Test 6</p>
+  <p>
+    <span>Test 7</span>
+  </p>
+  <p>
+    <span style="display:block;">Test 8</span>
+  </p>
+  <p>
+    Test 9
+    <span>Test 9</span>
+  </p>
+  <p>
+    Test 10
+    <span style="display:block;">Test 10</span>
+  </p>
+  <p>
+    Test 11
+    <span>Test 11</span>
+    <span style="display:block;">Test 11</span>
+  </p>
+  <p>
+    <button>Test 12</button>
+  </p>
+  <p>
+    Test 13
+    <button>Test 13</button>
+  </p>
+  <p>
+    <span>Test 14</span>
+    <button>Test 14</button>
+  </p>
+  <p>
+    <button>Test 15</button>
+    <span style="display:block;">Test 15</span>
+  </p>
+  <div id="stopElement">End of test</div>
+</div>
+<pre id="tree"></pre>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+    description("This verifies the accessibility tree when there are nested block element children.");
+    if (window.accessibilityController) {
+        document.body.focus();
+        var stopElement = accessibilityController.accessibleElementById("stopElement");
+        dumpAccessibilityTree(accessibilityController.focusedElement, stopElement, 0);
+    }
+    document.getElementById("content").style.visibility = "hidden";
+</script>
+<script src=""
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/spans-paragraphs-and-divs-expected.txt (200843 => 200844)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/spans-paragraphs-and-divs-expected.txt	2016-05-13 11:49:56 UTC (rev 200843)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/spans-paragraphs-and-divs-expected.txt	2016-05-13 11:51:43 UTC (rev 200844)
@@ -34,11 +34,9 @@
 PASS link.childrenCount is 0
 PASS element.role is 'AXRole: AXParagraph'
 PASS element.childrenCount is 0
+PASS element.role is 'AXRole: AXLink'
+PASS element.childrenCount is 0
 PASS element.role is 'AXRole: AXSection'
-PASS element.childrenCount is 1
-PASS link.role is 'AXRole: AXLink'
-PASS link.childrenCount is 0
-PASS element.role is 'AXRole: AXSection'
 PASS element.childrenCount is 0
 PASS element.role is 'AXRole: AXSection'
 PASS element.childrenCount is 1

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/spans-paragraphs-and-divs-tree-expected.txt (0 => 200844)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/spans-paragraphs-and-divs-tree-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/spans-paragraphs-and-divs-tree-expected.txt	2016-05-13 11:51:43 UTC (rev 200844)
@@ -0,0 +1,22 @@
+AXRole: AXWebArea 
+    AXRole: AXParagraph AXValue: Block span in a link in a paragraph<\n>Inline span in a link in a paragraph
+        AXRole: AXLink AXValue: Block span in a link in a paragraph<\n>Inline span in a link in a paragraph
+    AXRole: AXParagraph AXValue: Block span in a paragraph<\n>Inline span in a paragraph
+    AXRole: AXParagraph AXValue: Inline span in a link in a paragraph<\n>Block span in a link in a paragraph<\n>
+        AXRole: AXLink AXValue: Inline span in a link in a paragraph<\n>Block span in a link in a paragraph<\n>
+    AXRole: AXParagraph AXValue: Inline span in a paragraph<\n>Block span in a paragraph<\n>
+    AXRole: AXLink AXValue: Block span in a link in a div<\n>Inline span in a link in a div
+    AXRole: AXSection AXValue: Inline span in a div
+    AXRole: AXSection AXValue: Inline span in a link in a div<\n>Block span in a link in a div<\n>
+        AXRole: AXLink AXValue: Inline span in a link in a div<\n>Block span in a link in a div<\n>
+    AXRole: AXSection AXValue: Inline span in a div
+    AXRole: AXSection AXValue: End of test
+This verifies the accessibility tree of spans, paragraphs, and divs.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/spans-paragraphs-and-divs-tree.html (0 => 200844)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/spans-paragraphs-and-divs-tree.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/spans-paragraphs-and-divs-tree.html	2016-05-13 11:51:43 UTC (rev 200844)
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body id="body">
+<div id="content">
+  <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>
+
+<div id="stopElement">End of test</div>
+</div>
+<pre id="tree"></pre>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+    description("This verifies the accessibility tree of spans, paragraphs, and divs.");
+    if (window.accessibilityController) {
+        document.body.focus();
+        var stopElement = accessibilityController.accessibleElementById("stopElement");
+        dumpAccessibilityTree(accessibilityController.focusedElement, stopElement, 0);
+    }
+    document.getElementById("content").style.visibility = "hidden";
+</script>
+<script src=""
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/spans-paragraphs-and-divs.html (200843 => 200844)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/spans-paragraphs-and-divs.html	2016-05-13 11:49:56 UTC (rev 200843)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/accessibility/gtk/spans-paragraphs-and-divs.html	2016-05-13 11:51:43 UTC (rev 200844)
@@ -83,13 +83,9 @@
     shouldBe("element.childrenCount", "0");
 
     element = webArea.childAtIndex(4);
-    shouldBe("element.role", "'AXRole: AXSection'");
-    shouldBe("element.childrenCount", "1");
+    shouldBe("element.role", "'AXRole: AXLink'");
+    shouldBe("element.childrenCount", "0");
 
-    link = element.childAtIndex(0);
-    shouldBe("link.role", "'AXRole: AXLink'");
-    shouldBe("link.childrenCount", "0");
-
     element = webArea.childAtIndex(5);
     shouldBe("element.role", "'AXRole: AXSection'");
     shouldBe("element.childrenCount", "0");

Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/platform/gtk/accessibility/generated-content-with-display-table-crash-expected.txt (200843 => 200844)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/platform/gtk/accessibility/generated-content-with-display-table-crash-expected.txt	2016-05-13 11:49:56 UTC (rev 200843)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/platform/gtk/accessibility/generated-content-with-display-table-crash-expected.txt	2016-05-13 11:51:43 UTC (rev 200844)
@@ -4,7 +4,8 @@
 End of test
 AXRole: AXWebArea 
     AXRole: AXSection AXValue: foo !
-    AXRole: AXSection AXValue: bar !
+    AXRole: AXSection AXValue: bar
+    AXRole: AXSection AXValue: !
     AXRole: AXSection AXValue: baz
     AXRole: AXSection AXValue: End of test
 This verifies that getting content of an element with generated content in CSS table doesn't cause a crash.

Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/platform/gtk/accessibility/gtk/replaced-objects-in-anonymous-blocks-expected.txt (200843 => 200844)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/platform/gtk/accessibility/gtk/replaced-objects-in-anonymous-blocks-expected.txt	2016-05-13 11:49:56 UTC (rev 200843)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/platform/gtk/accessibility/gtk/replaced-objects-in-anonymous-blocks-expected.txt	2016-05-13 11:51:43 UTC (rev 200844)
@@ -20,7 +20,8 @@
                 AXRole: AXWebArea 
     AXRole: AXSection AXValue: <obj>
         AXRole: AXTextField AXValue: text area
-    AXRole: AXSection AXValue: Div<\n><obj>
+    AXRole: AXSection AXValue: Div
+    AXRole: AXSection AXValue: <obj>
         AXRole: AXButton 
     AXRole: AXHeading AXValue: Heading<\n><obj><\n><obj>
         AXRole: AXButton 

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog (200843 => 200844)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-05-13 11:49:56 UTC (rev 200843)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-05-13 11:51:43 UTC (rev 200844)
@@ -1,3 +1,24 @@
+2016-04-28  Joanmarie Diggs  <[email protected]>
+
+        AX: [ATK] We need to be smarter about flattening and the accessible text implementation
+        https://bugs.webkit.org/show_bug.cgi?id=144639
+
+        Reviewed by Chris Fleizach.
+
+        Defer to WebCore Accessibility more regarding when to include anonymous blocks in the
+        accessibility tree. Explicitly flatten menu items, headings, list items, and paragraphs
+        in order to preserve the expected platform behavior for backwards compatibility. Also
+        map anonymous table parts to DivRole rather than GroupRole for GTK and EFL because ATK
+        has separate roles for generic text block elements and other generic containers.
+
+        Tests: accessibility/gtk/nested-block-element-children.html
+               accessibility/gtk/spans-paragraphs-and-divs-tree.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
+        * accessibility/atk/AccessibilityObjectAtk.cpp:
+        (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
+
 2016-04-28  Carlos Garcia Campos  <[email protected]>
 
         REGRESSION(r199659): Web Process crash when RenderTheme::adjustMenuListStyle is called with a null element

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (200843 => 200844)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2016-05-13 11:49:56 UTC (rev 200843)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2016-05-13 11:51:43 UTC (rev 200844)
@@ -86,6 +86,7 @@
 #include "RenderMenuList.h"
 #include "RenderSVGRoot.h"
 #include "RenderSVGShape.h"
+#include "RenderTableCell.h"
 #include "RenderText.h"
 #include "RenderTextControl.h"
 #include "RenderTextControlSingleLine.h"
@@ -2640,7 +2641,7 @@
     // the cell should not be treated as a cell (e.g. because it is a layout table.
     // In ATK, there is a distinction between generic text block elements and other
     // generic containers; AX API does not make this distinction.
-    if (node && (node->hasTagName(tdTag) || node->hasTagName(thTag)))
+    if (is<RenderTableCell>(m_renderer))
 #if PLATFORM(GTK) || PLATFORM(EFL)
         return DivRole;
 #else

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp (200843 => 200844)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp	2016-05-13 11:49:56 UTC (rev 200843)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/accessibility/atk/AccessibilityObjectAtk.cpp	2016-05-13 11:51:43 UTC (rev 200844)
@@ -21,8 +21,11 @@
 #include "config.h"
 #include "AccessibilityObject.h"
 
-#include "HTMLElement.h"
-#include "HTMLNames.h"
+#include "HTMLSpanElement.h"
+#include "RenderBlock.h"
+#include "RenderInline.h"
+#include "RenderIterator.h"
+#include "RenderTableCell.h"
 #include "RenderText.h"
 #include "TextControlInnerElements.h"
 #include <glib-object.h>
@@ -85,16 +88,57 @@
     if (!renderObject)
         return DefaultBehavior;
 
-    // The text displayed by an ARIA menu item is exposed through the accessible name.
-    if (renderObject->isAnonymousBlock() && parent->isMenuItem())
-        return IgnoreObject;
+    // We always want to include paragraphs that have rendered content.
+    // WebCore Accessibility does so unless there is a RenderBlock child.
+    if (role == ParagraphRole) {
+        auto child = childrenOfType<RenderBlock>(downcast<RenderElement>(*renderObject)).first();
+        return child ? IncludeObject : DefaultBehavior;
+    }
 
+    // We always want to include table cells (layout and CSS) that have rendered text content.
+    if (is<RenderTableCell>(renderObject)) {
+        for (const auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(*renderObject))) {
+            if (is<RenderInline>(child) || is<RenderText>(child) || is<HTMLSpanElement>(child.node()))
+                return IncludeObject;
+        }
+        return DefaultBehavior;
+    }
+
+    if (renderObject->isAnonymousBlock()) {
+        // The text displayed by an ARIA menu item is exposed through the accessible name.
+        if (parent->isMenuItem())
+            return IgnoreObject;
+
+        // The text displayed in headings is typically exposed in the heading itself.
+        if (parent->isHeading())
+            return IgnoreObject;
+
+        // The text displayed in list items is typically exposed in the list item itself.
+        if (parent->isListItem())
+            return IgnoreObject;
+
+        // The text displayed in links is typically exposed in the link itself.
+        if (parent->isLink())
+            return IgnoreObject;
+
+        // FIXME: This next one needs some further consideration. But paragraphs are not
+        // typically huge (like divs). And ignoring anonymous block children of paragraphs
+        // will preserve existing behavior.
+        if (parent->roleValue() == ParagraphRole)
+            return IgnoreObject;
+
+        return DefaultBehavior;
+    }
+
+    Node* node = renderObject->node();
+    if (!node)
+        return DefaultBehavior;
+
     // We don't want <span> elements to show up in the accessibility hierarchy unless
     // we have good reasons for that (e.g. focusable or visible because of containing
     // a meaningful accessible name, maybe set through ARIA), so we can use
     // atk_component_grab_focus() to set the focus to it.
-    Node* node = renderObject->node();
-    if (node && node->hasTagName(HTMLNames::spanTag) && !canSetFocusAttribute() && !hasAttributesRequiredForInclusion())
+    if (is<HTMLSpanElement>(node) && !canSetFocusAttribute() && !hasAttributesRequiredForInclusion())
         return IgnoreObject;
 
     // If we include TextControlInnerTextElement children, changes to those children
@@ -104,41 +148,6 @@
     if (is<TextControlInnerTextElement>(node))
         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) {
-        // Don't call textUnderElement() here, because it's slow and it can
-        // crash when called while we're in the middle of a subtree being deleted.
-        if (!renderObject->firstChildSlow())
-            return DefaultBehavior;
-
-        if (!parent->renderer() || parent->renderer()->isAnonymousBlock())
-            return DefaultBehavior;
-
-        for (RenderObject* r = renderObject->firstChildSlow(); r; r = r->nextSibling()) {
-            if (r->isAnonymousBlock())
-                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
-    // become text within the document frame itself. This ultimately may be what we want
-    // and would largely be consistent with what we see from Gecko. However, ignoring
-    // spans whose parent is the body changes the current behavior we see from WebCore.
-    // Until we have sufficient time to properly analyze these cases, we will defer to
-    // WebCore. We only check that the parent is not aria because we do not expect
-    // anonymous blocks which are aria-related to themselves have an aria role, nor
-    // have we encountered instances where the parent of an anonymous block also lacked
-    // an aria role but the grandparent had one.
-    if (renderObject && renderObject->isAnonymousBlock() && !parent->renderer()->isBody()
-        && parent->ariaRoleAttribute() == UnknownRole)
-        return IgnoreObject;
-
     return DefaultBehavior;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to