Title: [262500] trunk
Revision
262500
Author
andresg...@apple.com
Date
2020-06-03 12:07:39 -0700 (Wed, 03 Jun 2020)

Log Message

AX: SVG text node with content is described as "empty group" even if it's not empty
https://bugs.webkit.org/show_bug.cgi?id=210315

Reviewed by Darin Adler.

Source/WebCore:

Test: accessibility/svg-text.html

SVGText elements are conveyed as AXGroups and cannot have a description
or help property, but instead the content of the element is exposed as
static text.

* accessibility/AccessibilitySVGElement.cpp:
(WebCore::AccessibilitySVGElement::accessibilityDescription const):
(WebCore::AccessibilitySVGElement::helpText const):
* accessibility/AccessibilitySVGElement.h:

LayoutTests:

* accessibility/svg-text-expected.txt: Added.
* accessibility/svg-text.html: Added.
* accessibility/w3c-svg-name-calculation.html: Expected name for an SVG
text element should be "". Its text content is exposed as a child static text accessibility object.
* platform/mac/accessibility/w3c-svg-name-calculation-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (262499 => 262500)


--- trunk/LayoutTests/ChangeLog	2020-06-03 19:04:28 UTC (rev 262499)
+++ trunk/LayoutTests/ChangeLog	2020-06-03 19:07:39 UTC (rev 262500)
@@ -1,3 +1,16 @@
+2020-06-03  Andres Gonzalez  <andresg...@apple.com>
+
+        AX: SVG text node with content is described as "empty group" even if it's not empty
+        https://bugs.webkit.org/show_bug.cgi?id=210315
+
+        Reviewed by Darin Adler.
+
+        * accessibility/svg-text-expected.txt: Added.
+        * accessibility/svg-text.html: Added.
+        * accessibility/w3c-svg-name-calculation.html: Expected name for an SVG
+        text element should be "". Its text content is exposed as a child static text accessibility object.
+        * platform/mac/accessibility/w3c-svg-name-calculation-expected.txt:
+
 2020-06-03  John Wilander  <wilan...@apple.com>
 
         Storage Access API: Add setting for per-page storage access scope

Added: trunk/LayoutTests/accessibility/svg-text-expected.txt (0 => 262500)


--- trunk/LayoutTests/accessibility/svg-text-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/svg-text-expected.txt	2020-06-03 19:07:39 UTC (rev 262500)
@@ -0,0 +1,14 @@
+Hello World!
+This tests SVGText elements and their content are properly handled as static text.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS text1.role is 'AXRole: AXGroup'
+PASS text1.childrenCount is 1
+PASS staticText.role is 'AXRole: AXStaticText'
+PASS staticText.stringValue is 'AXValue: Hello World!'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/svg-text.html (0 => 262500)


--- trunk/LayoutTests/accessibility/svg-text.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/svg-text.html	2020-06-03 19:07:39 UTC (rev 262500)
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<svg xmlns="http://www.w3.org/2000/svg">
+    <text id="text1">Hello World!</text>
+</svg>
+
+<div id="console"></div>
+
+<script>
+    description("This tests SVGText elements and their content are properly handled as static text.");
+
+    if (window.accessibilityController) {
+        text1 = accessibilityController.accessibleElementById("text1");
+        shouldBe("text1.role", "'AXRole: AXGroup'");
+        shouldBe("text1.childrenCount", "1");
+        staticText = text1.childAtIndex(0);
+        shouldBe("staticText.role", "'AXRole: AXStaticText'");
+        shouldBe("staticText.stringValue", "'AXValue: Hello World!'");
+    }
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/accessibility/w3c-svg-name-calculation.html (262499 => 262500)


--- trunk/LayoutTests/accessibility/w3c-svg-name-calculation.html	2020-06-03 19:04:28 UTC (rev 262499)
+++ trunk/LayoutTests/accessibility/w3c-svg-name-calculation.html	2020-06-03 19:07:39 UTC (rev 262500)
@@ -142,7 +142,7 @@
   <text id="23b" x="40" y="90">end</text>
 </svg>
 <svg>
-  <text id="test24" x="40" y="90" data-expected="name: end">end</text>
+  <text id="test24" x="40" y="90" data-expected="">end</text>
 </svg>
 <svg>
   <a id="test25" aria-label="booth" href="" xlink:title="table" data-expected="name: booth"></a>

Modified: trunk/LayoutTests/platform/mac/accessibility/w3c-svg-name-calculation-expected.txt (262499 => 262500)


--- trunk/LayoutTests/platform/mac/accessibility/w3c-svg-name-calculation-expected.txt	2020-06-03 19:04:28 UTC (rev 262499)
+++ trunk/LayoutTests/platform/mac/accessibility/w3c-svg-name-calculation-expected.txt	2020-06-03 19:07:39 UTC (rev 262500)
@@ -142,9 +142,9 @@
 	AXHelp: 
 	AXTitleUIElement: null
 test24:
-	Expected name: end
+	Expected 
 	AXTitle: 
-	AXDescription: end
+	AXDescription: 
 	AXHelp: 
 	AXTitleUIElement: null
 test25:

Modified: trunk/Source/WebCore/ChangeLog (262499 => 262500)


--- trunk/Source/WebCore/ChangeLog	2020-06-03 19:04:28 UTC (rev 262499)
+++ trunk/Source/WebCore/ChangeLog	2020-06-03 19:07:39 UTC (rev 262500)
@@ -1,3 +1,21 @@
+2020-06-03  Andres Gonzalez  <andresg...@apple.com>
+
+        AX: SVG text node with content is described as "empty group" even if it's not empty
+        https://bugs.webkit.org/show_bug.cgi?id=210315
+
+        Reviewed by Darin Adler.
+
+        Test: accessibility/svg-text.html
+
+        SVGText elements are conveyed as AXGroups and cannot have a description
+        or help property, but instead the content of the element is exposed as
+        static text.
+
+        * accessibility/AccessibilitySVGElement.cpp:
+        (WebCore::AccessibilitySVGElement::accessibilityDescription const):
+        (WebCore::AccessibilitySVGElement::helpText const):
+        * accessibility/AccessibilitySVGElement.h:
+
 2020-06-03  Sihui Liu  <sihui_...@apple.com>
 
         Text manipulation sometimes fails to replace text in attributes

Modified: trunk/Source/WebCore/accessibility/AccessibilitySVGElement.cpp (262499 => 262500)


--- trunk/Source/WebCore/accessibility/AccessibilitySVGElement.cpp	2020-06-03 19:04:28 UTC (rev 262499)
+++ trunk/Source/WebCore/accessibility/AccessibilitySVGElement.cpp	2020-06-03 19:07:39 UTC (rev 262500)
@@ -141,13 +141,6 @@
             return xlinkTitle;
     }
 
-    if (m_renderer->isSVGText()) {
-        AccessibilityTextUnderElementMode mode;
-        String text = textUnderElement(mode);
-        if (!text.isEmpty())
-            return text;
-    }
-
     if (is<SVGUseElement>(element())) {
         if (AccessibilityObject* target = targetForUseElement())
             return target->accessibilityDescription();
@@ -188,18 +181,9 @@
             return target->helpText();
     }
 
-    String description = accessibilityDescription();
-
-    if (m_renderer->isSVGText()) {
-        AccessibilityTextUnderElementMode mode;
-        String text = textUnderElement(mode);
-        if (!text.isEmpty() && text != description)
-            return text;
-    }
-
     auto titleElements = childrenOfType<SVGTitleElement>(*element());
     if (auto titleChild = childElementWithMatchingLanguage(titleElements)) {
-        if (titleChild->textContent() != description)
+        if (titleChild->textContent() != accessibilityDescription())
             return titleChild->textContent();
     }
 

Modified: trunk/Source/WebCore/accessibility/AccessibilitySVGElement.h (262499 => 262500)


--- trunk/Source/WebCore/accessibility/AccessibilitySVGElement.h	2020-06-03 19:04:28 UTC (rev 262499)
+++ trunk/Source/WebCore/accessibility/AccessibilitySVGElement.h	2020-06-03 19:07:39 UTC (rev 262500)
@@ -37,13 +37,12 @@
     static Ref<AccessibilitySVGElement> create(RenderObject*);
     virtual ~AccessibilitySVGElement();
 
-    String accessibilityDescription() const final;
-    String helpText() const final;
-
 protected:
     explicit AccessibilitySVGElement(RenderObject*);
 
 private:
+    String accessibilityDescription() const final;
+    String helpText() const final;
     void accessibilityText(Vector<AccessibilityText>&) const final;
     AccessibilityRole determineAccessibilityRole() final;
     AccessibilityRole determineAriaRoleAttribute() const final;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to