Title: [293362] branches/safari-613.2.7.1-branch/Source/WebCore
Revision
293362
Author
alanc...@apple.com
Date
2022-04-25 15:03:28 -0700 (Mon, 25 Apr 2022)

Log Message

Cherry-pick r291968. rdar://problem/91681393

    AccessibilityObject::listMarkerTextForNodeAndPosition should check for presence of list item before anything else
    https://bugs.webkit.org/show_bug.cgi?id=238341

    Reviewed by Andres Gonzalez.

    The first thing AccessibilityObject::listMarkerTextForNodeAndPosition
    does is check to see that the given range `isStartOfLine`. We
    should instead check if there's an actual list item to work with
    before doing this, since `isStartOfLine` can cause crashes.

    Covered by test
    accessibility/mac/attributed-string-with-listitem-multiple-lines.html.

    * accessibility/AccessibilityObject.cpp:
    (WebCore::AccessibilityObject::listMarkerTextForNodeAndPosition):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291968 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613.2.7.1-branch/Source/WebCore/ChangeLog (293361 => 293362)


--- branches/safari-613.2.7.1-branch/Source/WebCore/ChangeLog	2022-04-25 22:03:13 UTC (rev 293361)
+++ branches/safari-613.2.7.1-branch/Source/WebCore/ChangeLog	2022-04-25 22:03:28 UTC (rev 293362)
@@ -1,5 +1,46 @@
 2022-04-25  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r291968. rdar://problem/91681393
+
+    AccessibilityObject::listMarkerTextForNodeAndPosition should check for presence of list item before anything else
+    https://bugs.webkit.org/show_bug.cgi?id=238341
+    
+    Reviewed by Andres Gonzalez.
+    
+    The first thing AccessibilityObject::listMarkerTextForNodeAndPosition
+    does is check to see that the given range `isStartOfLine`. We
+    should instead check if there's an actual list item to work with
+    before doing this, since `isStartOfLine` can cause crashes.
+    
+    Covered by test
+    accessibility/mac/attributed-string-with-listitem-multiple-lines.html.
+    
+    * accessibility/AccessibilityObject.cpp:
+    (WebCore::AccessibilityObject::listMarkerTextForNodeAndPosition):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-28  Tyler Wilcock  <tyle...@apple.com>
+
+            AccessibilityObject::listMarkerTextForNodeAndPosition should check for presence of list item before anything else
+            https://bugs.webkit.org/show_bug.cgi?id=238341
+
+            Reviewed by Andres Gonzalez.
+
+            The first thing AccessibilityObject::listMarkerTextForNodeAndPosition
+            does is check to see that the given range `isStartOfLine`. We
+            should instead check if there's an actual list item to work with
+            before doing this, since `isStartOfLine` can cause crashes.
+
+            Covered by test
+            accessibility/mac/attributed-string-with-listitem-multiple-lines.html.
+
+            * accessibility/AccessibilityObject.cpp:
+            (WebCore::AccessibilityObject::listMarkerTextForNodeAndPosition):
+
+2022-04-25  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r290860. rdar://problem/89291570
 
     AX: Protect incoming object with Ref in AXObjectCache::textChanged

Modified: branches/safari-613.2.7.1-branch/Source/WebCore/accessibility/AccessibilityObject.cpp (293361 => 293362)


--- branches/safari-613.2.7.1-branch/Source/WebCore/accessibility/AccessibilityObject.cpp	2022-04-25 22:03:13 UTC (rev 293361)
+++ branches/safari-613.2.7.1-branch/Source/WebCore/accessibility/AccessibilityObject.cpp	2022-04-25 22:03:28 UTC (rev 293362)
@@ -1354,17 +1354,13 @@
 // Returns the text associated with a list marker if this node is contained within a list item.
 String AccessibilityObject::listMarkerTextForNodeAndPosition(Node* node, const VisiblePosition& visiblePositionStart)
 {
-    // If the range does not contain the start of the line, the list marker text should not be included.
-    if (!isStartOfLine(visiblePositionStart))
-        return String();
+    auto* listItem = renderListItemContainerForNode(node);
+    if (!listItem)
+        return { };
+    // Only include the list marker if the range includes the line start (where the marker would be), and is in the same line as the marker.
+    if (!isStartOfLine(visiblePositionStart) || !inSameLine(visiblePositionStart, firstPositionInNode(&listItem->element())))
+        return { };
 
-    // We should speak the list marker only for the first line.
-    RenderListItem* listItem = renderListItemContainerForNode(node);
-    if (!listItem)
-        return String();
-    if (!inSameLine(visiblePositionStart, firstPositionInNode(&listItem->element())))
-        return String();
-    
     return listMarkerTextForNode(node);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to