Title: [291271] releases/WebKitGTK/webkit-2.36
Revision
291271
Author
carlo...@webkit.org
Date
2022-03-15 02:04:41 -0700 (Tue, 15 Mar 2022)

Log Message

Merge r290502 - AX: List item marker not exposed when not a direct child of a list item
https://bugs.webkit.org/show_bug.cgi?id=236777
<rdar://problem/89082485>

Reviewed by Adrian Perez de Castro.

Source/WebCore:

It can happen that the marker is not a direct child of a list item, in which case the marker is ignored and not
exposed to ATs.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::parentObjectUnignored const): In case of list marker find the marker list item.
(WebCore::AccessibilityRenderObject::markerRenderer const): Helper to return the list item marker renderer.
(WebCore::AccessibilityRenderObject::addListItemMarker): Add always the list item marker as the first child of
list items.
(WebCore::AccessibilityRenderObject::addChildren): Do not add list item marker children, they will be added to
the right parent in addListItemMarker().
* accessibility/AccessibilityRenderObject.h:

Tools:

* WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp:
(WTR::roleValueToString): Return AXStatic for Text role too.

LayoutTests:

Update test results.

* accessibility/gtk/list-items-always-exposed-expected.txt:
* accessibility/gtk/list-items-always-exposed.html:
* accessibility/gtk/spans-expected.txt:
* accessibility/gtk/spans.html:
* platform/gtk/TestExpectations:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.36/LayoutTests/ChangeLog (291270 => 291271)


--- releases/WebKitGTK/webkit-2.36/LayoutTests/ChangeLog	2022-03-15 08:55:30 UTC (rev 291270)
+++ releases/WebKitGTK/webkit-2.36/LayoutTests/ChangeLog	2022-03-15 09:04:41 UTC (rev 291271)
@@ -1,3 +1,19 @@
+2022-02-25  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        AX: List item marker not exposed when not a direct child of a list item
+        https://bugs.webkit.org/show_bug.cgi?id=236777
+        <rdar://problem/89082485>
+
+        Reviewed by Adrian Perez de Castro.
+
+        Update test results.
+
+        * accessibility/gtk/list-items-always-exposed-expected.txt:
+        * accessibility/gtk/list-items-always-exposed.html:
+        * accessibility/gtk/spans-expected.txt:
+        * accessibility/gtk/spans.html:
+        * platform/gtk/TestExpectations:
+
 2022-02-28  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [ATSPI] Always expose table cells (layout and CSS) that have rendered text content

Modified: releases/WebKitGTK/webkit-2.36/LayoutTests/accessibility/gtk/list-items-always-exposed-expected.txt (291270 => 291271)


--- releases/WebKitGTK/webkit-2.36/LayoutTests/accessibility/gtk/list-items-always-exposed-expected.txt	2022-03-15 08:55:30 UTC (rev 291270)
+++ releases/WebKitGTK/webkit-2.36/LayoutTests/accessibility/gtk/list-items-always-exposed-expected.txt	2022-03-15 09:04:41 UTC (rev 291271)
@@ -8,7 +8,9 @@
 
 PASS list.role is 'AXRole: AXList'
 PASS item1.role is 'AXRole: AXListItem'
+PASS marker1.role is 'AXRole: AXStatic'
 PASS item2.role is 'AXRole: AXListItem'
+PASS marker2.role is 'AXRole: AXStatic'
 PASS paragraph.role is 'AXRole: AXParagraph'
 PASS successfullyParsed is true
 

Modified: releases/WebKitGTK/webkit-2.36/LayoutTests/accessibility/gtk/list-items-always-exposed.html (291270 => 291271)


--- releases/WebKitGTK/webkit-2.36/LayoutTests/accessibility/gtk/list-items-always-exposed.html	2022-03-15 08:55:30 UTC (rev 291270)
+++ releases/WebKitGTK/webkit-2.36/LayoutTests/accessibility/gtk/list-items-always-exposed.html	2022-03-15 09:04:41 UTC (rev 291271)
@@ -23,12 +23,16 @@
 
     var list = webArea.childAtIndex(0);
     var item1 = list.childAtIndex(0);
+    var marker1 = item1.childAtIndex(0);
     var item2 = list.childAtIndex(1);
-    var paragraph = item2.childAtIndex(0);
+    var marker2 = item2.childAtIndex(0);
+    var paragraph = item2.childAtIndex(1);
 
     shouldBe("list.role", "'AXRole: AXList'");
     shouldBe("item1.role", "'AXRole: AXListItem'");
+    shouldBe("marker1.role", "'AXRole: AXStatic'");
     shouldBe("item2.role", "'AXRole: AXListItem'");
+    shouldBe("marker2.role", "'AXRole: AXStatic'");
     shouldBe("paragraph.role", "'AXRole: AXParagraph'");
   }
 }

Modified: releases/WebKitGTK/webkit-2.36/LayoutTests/accessibility/gtk/spans-expected.txt (291270 => 291271)


--- releases/WebKitGTK/webkit-2.36/LayoutTests/accessibility/gtk/spans-expected.txt	2022-03-15 08:55:30 UTC (rev 291270)
+++ releases/WebKitGTK/webkit-2.36/LayoutTests/accessibility/gtk/spans-expected.txt	2022-03-15 09:04:41 UTC (rev 291271)
@@ -26,9 +26,13 @@
 PASS element.role is 'AXRole: AXList'
 PASS element.childrenCount is 2
 PASS item.role is 'AXRole: AXListItem'
-PASS item.childrenCount is 0
+PASS item.childrenCount is 1
+PASS marker.role is 'AXRole: AXStatic'
+PASS marker.childrenCount is 0
 PASS item.role is 'AXRole: AXListItem'
-PASS item.childrenCount is 1
+PASS item.childrenCount is 2
+PASS marker.role is 'AXRole: AXStatic'
+PASS marker.childrenCount is 0
 PASS link.role is 'AXRole: AXLink'
 PASS link.childrenCount is 0
 PASS successfullyParsed is true

Modified: releases/WebKitGTK/webkit-2.36/LayoutTests/accessibility/gtk/spans.html (291270 => 291271)


--- releases/WebKitGTK/webkit-2.36/LayoutTests/accessibility/gtk/spans.html	2022-03-15 08:55:30 UTC (rev 291270)
+++ releases/WebKitGTK/webkit-2.36/LayoutTests/accessibility/gtk/spans.html	2022-03-15 09:04:41 UTC (rev 291271)
@@ -61,13 +61,21 @@
 
     var item = element.childAtIndex(0);
     shouldBe("item.role", "'AXRole: AXListItem'");
-    shouldBe("item.childrenCount", "0");
+    shouldBe("item.childrenCount", "1");
 
+    var marker = item.childAtIndex(0);
+    shouldBe("marker.role", "'AXRole: AXStatic'");
+    shouldBe("marker.childrenCount", "0");
+
     item = element.childAtIndex(1);
     shouldBe("item.role", "'AXRole: AXListItem'");
-    shouldBe("item.childrenCount", "1");
+    shouldBe("item.childrenCount", "2");
 
-    link = item.childAtIndex(0);
+    marker = item.childAtIndex(0);
+    shouldBe("marker.role", "'AXRole: AXStatic'");
+    shouldBe("marker.childrenCount", "0");
+
+    link = item.childAtIndex(1);
     shouldBe("link.role", "'AXRole: AXLink'");
     shouldBe("link.childrenCount", "0");
 }

Modified: releases/WebKitGTK/webkit-2.36/LayoutTests/platform/gtk/TestExpectations (291270 => 291271)


--- releases/WebKitGTK/webkit-2.36/LayoutTests/platform/gtk/TestExpectations	2022-03-15 08:55:30 UTC (rev 291270)
+++ releases/WebKitGTK/webkit-2.36/LayoutTests/platform/gtk/TestExpectations	2022-03-15 09:04:41 UTC (rev 291271)
@@ -136,7 +136,6 @@
 
 # Tests failing with ATSPI implementation.
 webkit.org/b/235941 accessibility/gtk/no-notification-for-unrendered-iframe-children.html [ Failure ]
-webkit.org/b/235941 accessibility/gtk/spans.html [ Failure ]
 webkit.org/b/235941 accessibility/gtk/text-at-offset-embedded-objects.html [ Failure ]
 webkit.org/b/235941 accessibility/gtk/text-at-offset-special-chars.html [ Failure ]
 webkit.org/b/235941 accessibility/gtk/caret-offsets.html [ Timeout ]

Modified: releases/WebKitGTK/webkit-2.36/Source/WebCore/ChangeLog (291270 => 291271)


--- releases/WebKitGTK/webkit-2.36/Source/WebCore/ChangeLog	2022-03-15 08:55:30 UTC (rev 291270)
+++ releases/WebKitGTK/webkit-2.36/Source/WebCore/ChangeLog	2022-03-15 09:04:41 UTC (rev 291271)
@@ -1,3 +1,23 @@
+2022-02-25  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        AX: List item marker not exposed when not a direct child of a list item
+        https://bugs.webkit.org/show_bug.cgi?id=236777
+        <rdar://problem/89082485>
+
+        Reviewed by Adrian Perez de Castro.
+
+        It can happen that the marker is not a direct child of a list item, in which case the marker is ignored and not
+        exposed to ATs.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::parentObjectUnignored const): In case of list marker find the marker list item.
+        (WebCore::AccessibilityRenderObject::markerRenderer const): Helper to return the list item marker renderer.
+        (WebCore::AccessibilityRenderObject::addListItemMarker): Add always the list item marker as the first child of
+        list items.
+        (WebCore::AccessibilityRenderObject::addChildren): Do not add list item marker children, they will be added to
+        the right parent in addListItemMarker().
+        * accessibility/AccessibilityRenderObject.h:
+
 2022-02-28  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [ATSPI] Always expose table cells (layout and CSS) that have rendered text content

Modified: releases/WebKitGTK/webkit-2.36/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (291270 => 291271)


--- releases/WebKitGTK/webkit-2.36/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2022-03-15 08:55:30 UTC (rev 291270)
+++ releases/WebKitGTK/webkit-2.36/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2022-03-15 09:04:41 UTC (rev 291271)
@@ -527,7 +527,23 @@
     
     return nullptr;
 }
-    
+
+AXCoreObject* AccessibilityRenderObject::parentObjectUnignored() const
+{
+#if USE(ATSPI)
+    // Expose markers that are not direct children of a list item too.
+    if (m_renderer && m_renderer->isListMarker()) {
+        if (auto* listItem = ancestorsOfType<RenderListItem>(*m_renderer).first()) {
+            AccessibilityObject* parent = axObjectCache()->getOrCreate(listItem);
+            if (downcast<AccessibilityRenderObject>(*parent).markerRenderer() == m_renderer)
+                return parent;
+        }
+    }
+#endif
+
+    return AccessibilityNodeObject::parentObjectUnignored();
+}
+
 bool AccessibilityRenderObject::isAttachment() const
 {
     RenderBoxModelObject* renderer = renderBoxModelObject();
@@ -3236,7 +3252,23 @@
         insertionIndex += (m_children.size() - previousSize);
     }
 }
-    
+
+#if USE(ATSPI)
+RenderObject* AccessibilityRenderObject::markerRenderer() const
+{
+    if (accessibilityIsIgnored() || !isListItem() || !m_renderer || !m_renderer->isListItem())
+        return nullptr;
+
+    return downcast<RenderListItem>(*m_renderer).markerRenderer();
+}
+
+void AccessibilityRenderObject::addListItemMarker()
+{
+    if (auto* marker = markerRenderer())
+        insertChild(axObjectCache()->getOrCreate(marker), 0);
+}
+#endif
+
 void AccessibilityRenderObject::updateRoleAfterChildrenCreation()
 {
     AXTRACE("AccessibilityRenderObject::updateRoleAfterChildrenCreation");
@@ -3269,10 +3301,18 @@
     
     if (!canHaveChildren())
         return;
-    
-    for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSibling())
-        addChild(obj.get());
-    
+
+    auto addChildIfNeeded = [this](AccessibilityObject& object) {
+#if USE(ATSPI)
+        if (object.renderer()->isListMarker())
+            return;
+#endif
+        addChild(&object);
+    };
+
+    for (RefPtr<AccessibilityObject> object = firstChild(); object; object = object->nextSibling())
+        addChildIfNeeded(*object);
+
     m_subtreeDirty = false;
     
     addHiddenChildren();
@@ -3281,6 +3321,9 @@
     addTextFieldChildren();
     addCanvasChildren();
     addRemoteSVGChildren();
+#if USE(ATSPI)
+    addListItemMarker();
+#endif
 
 #if PLATFORM(COCOA)
     updateAttachmentViewParents();

Modified: releases/WebKitGTK/webkit-2.36/Source/WebCore/accessibility/AccessibilityRenderObject.h (291270 => 291271)


--- releases/WebKitGTK/webkit-2.36/Source/WebCore/accessibility/AccessibilityRenderObject.h	2022-03-15 08:55:30 UTC (rev 291270)
+++ releases/WebKitGTK/webkit-2.36/Source/WebCore/accessibility/AccessibilityRenderObject.h	2022-03-15 09:04:41 UTC (rev 291271)
@@ -91,6 +91,7 @@
     AccessibilityObject* nextSibling() const override;
     AccessibilityObject* parentObject() const override;
     AccessibilityObject* parentObjectIfExists() const override;
+    AXCoreObject* parentObjectUnignored() const override;
     AccessibilityObject* observableObject() const override;
     void linkedUIElements(AccessibilityChildrenVector&) const override;
     AccessibilityObject* titleUIElement() const override;
@@ -237,6 +238,9 @@
 
     bool renderObjectIsObservable(RenderObject&) const;
     RenderObject* renderParentObject() const;
+#if USE(ATSPI)
+    RenderObject* markerRenderer() const;
+#endif
 
     bool isSVGImage() const;
     void detachRemoteSVGRoot();
@@ -252,6 +256,9 @@
     void addCanvasChildren();
     void addAttachmentChildren();
     void addRemoteSVGChildren();
+#if USE(ATSPI)
+    void addListItemMarker();
+#endif
 #if PLATFORM(COCOA)
     void updateAttachmentViewParents();
 #endif

Modified: releases/WebKitGTK/webkit-2.36/Tools/ChangeLog (291270 => 291271)


--- releases/WebKitGTK/webkit-2.36/Tools/ChangeLog	2022-03-15 08:55:30 UTC (rev 291270)
+++ releases/WebKitGTK/webkit-2.36/Tools/ChangeLog	2022-03-15 09:04:41 UTC (rev 291271)
@@ -1,3 +1,14 @@
+2022-02-25  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        AX: List item marker not exposed when not a direct child of a list item
+        https://bugs.webkit.org/show_bug.cgi?id=236777
+        <rdar://problem/89082485>
+
+        Reviewed by Adrian Perez de Castro.
+
+        * WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp:
+        (WTR::roleValueToString): Return AXStatic for Text role too.
+
 2022-02-23  Philippe Normand  <pnorm...@igalia.com>
 
         [GStreamer] De-initialize GStreamer before terminating WebProcess

Modified: releases/WebKitGTK/webkit-2.36/Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp (291270 => 291271)


--- releases/WebKitGTK/webkit-2.36/Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp	2022-03-15 08:55:30 UTC (rev 291270)
+++ releases/WebKitGTK/webkit-2.36/Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp	2022-03-15 09:04:41 UTC (rev 291271)
@@ -772,6 +772,7 @@
     case WebCore::Atspi::Role::SpinButton:
         return "AXSpinButton"_s;
     case WebCore::Atspi::Role::Static:
+    case WebCore::Atspi::Role::Text:
         return "AXStatic"_s;
     case WebCore::Atspi::Role::StatusBar:
         return "AXStatusBar"_s;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to