Skip to content
Permalink
Browse files
AX: [ATK] We need to be smarter about flattening and the accessible t…
…ext 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.


Canonical link: https://commits.webkit.org/175235@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
joanmarie committed Apr 28, 2016
1 parent 4ad0fa4 commit 6da79d87bb35c8d738a91f3fa2d611e64eb2bf65
@@ -1,3 +1,23 @@
2016-04-28 Joanmarie Diggs <jdiggs@igalia.com>

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-28 Manuel Rego Casasnovas <rego@igalia.com>

[css-grid] Fix alignment with content distribution
@@ -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

@@ -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="../../resources/js-test-pre.js"></script>
<script src="../../resources/accessibility-helper.js"></script>
</head>
<body id="body">
<div id="content">
<div>
<span>Test 1</span>
<h1><a href="foo">Test 1</a></h1>
<h2>Test 1</h2>
<p>Test 1</p>
</div>
<div>
<span style="display:block;">Test 2</span>
<h1><a href="foo">Test 2</a></h1>
<h2>Test 2</h2>
<p>Test 2</p>
</div>
<div>
Test 3
<h1><a href="foo">Test 3</a></h1>
<h1>Test 3</h1>
<h2>Test 3</h2>
<p>Test 3</p>
</div>
<div>
<h1><a href="foo">Test 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="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -34,10 +34,8 @@ PASS link.role is 'AXRole: AXLink'
PASS link.childrenCount is 0
PASS element.role is 'AXRole: AXParagraph'
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: AXLink'
PASS element.childrenCount is 0
PASS element.role is 'AXRole: AXSection'
PASS element.childrenCount is 0
PASS element.role is 'AXRole: AXSection'
@@ -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

@@ -0,0 +1,66 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="../../resources/accessibility-helper.js"></script>
</head>
<body id="body">
<div id="content">
<p>
<a href='foo'>
<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='foo'>
<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='foo'>
<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='foo'>
<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="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -83,12 +83,8 @@
shouldBe("element.childrenCount", "0");

element = webArea.childAtIndex(4);
shouldBe("element.role", "'AXRole: AXSection'");
shouldBe("element.childrenCount", "1");

link = element.childAtIndex(0);
shouldBe("link.role", "'AXRole: AXLink'");
shouldBe("link.childrenCount", "0");
shouldBe("element.role", "'AXRole: AXLink'");
shouldBe("element.childrenCount", "0");

element = webArea.childAtIndex(5);
shouldBe("element.role", "'AXRole: AXSection'");
@@ -4,7 +4,8 @@ baz
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.
@@ -20,7 +20,8 @@ AXRole: AXWebArea
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
@@ -1,3 +1,24 @@
2016-04-28 Joanmarie Diggs <jdiggs@igalia.com>

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 Frederic Wang <fred.wang@free.fr>

RenderMathMLOperator refactoring: introduce getBaseGlyph and remove parameter from getDisplayStyleLargeOperator
@@ -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"
@@ -2648,7 +2649,7 @@ AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
// 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

0 comments on commit 6da79d8

Please sign in to comment.