Commit 4ccc554f authored by Joel Riley's avatar Joel Riley Committed by Commit Bot

Include SVG <g> elements in accessibility tree, marked as ignored.

This is needed as a first step to preserve grouping information for text
nodes within an SVG. Grouping information will help Select-to-Speak
properly re-order text nodes within an SVG to match a natural reading
order.

AX-Relnotes: n/a

R=dmazzoni@chromium.org

Bug: 892822
Change-Id: I29ad9db045df95fef0acb1a5bab5aa9337911211
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352614Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Joel Riley <joelriley@google.com>
Cr-Commit-Position: refs/heads/master@{#798357}
parent 274d2c72
......@@ -2227,6 +2227,10 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilitySvg) {
RunHtmlTest(FILE_PATH_LITERAL("svg.html"));
}
IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilitySvgG) {
RunHtmlTest(FILE_PATH_LITERAL("svg-g.html"));
}
IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityTableSimple) {
RunHtmlTest(FILE_PATH_LITERAL("table-simple.html"));
}
......
rootWebArea
++genericContainer ignored
++++genericContainer
++++++svgRoot name='svg'
++++++++genericContainer ignored htmlTag='g'
++++++++++genericContainer
++++++++++++staticText name='Group 1 Text 1'
++++++++++++++inlineTextBox name='Group 1 Text 1'
++++++++++genericContainer
++++++++++++staticText name='Group 1 Text 2'
++++++++++++++inlineTextBox name='Group 1 Text 2'
++++++++genericContainer ignored htmlTag='g'
++++++++++genericContainer
++++++++++++staticText name='Group 2 Text 1'
++++++++++++++inlineTextBox name='Group 2 Text 1'
<!--
@BLINK-ALLOW:htmlTag='g'
-->
<!DOCTYPE html>
<html>
<body>
<svg aria-label="svg">
<g>
<text x="10" y="10" fill="red">Group 1 Text 1</text>
<text x="10" y="100" fill="red">Group 1 Text 2</text>
</g>
<g>
<text x="200" y="10" fill="red">Group 2 Text 1</text>
</g>
</svg>
</body>
</html>
......@@ -60,6 +60,7 @@
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.h"
#include "third_party/blink/renderer/core/svg/svg_element.h"
#include "third_party/blink/renderer/core/svg/svg_g_element.h"
#include "third_party/blink/renderer/core/svg/svg_style_element.h"
#include "third_party/blink/renderer/modules/accessibility/ax_menu_list.h"
#include "third_party/blink/renderer/modules/accessibility/ax_menu_list_option.h"
......@@ -1542,6 +1543,10 @@ bool AXObject::ComputeAccessibilityIsIgnoredButIncludedInTree() const {
if (GetLayoutObject() && AriaHiddenRoot())
return true;
// Preserve SVG grouping elements.
if (GetNode() && IsA<SVGGElement>(GetNode()))
return true;
return false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment