Title: [291968] trunk/Source/WebCore
- Revision
- 291968
- Author
- tyle...@apple.com
- Date
- 2022-03-28 09:28:57 -0700 (Mon, 28 Mar 2022)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (291967 => 291968)
--- trunk/Source/WebCore/ChangeLog 2022-03-28 16:24:10 UTC (rev 291967)
+++ trunk/Source/WebCore/ChangeLog 2022-03-28 16:28:57 UTC (rev 291968)
@@ -1,3 +1,21 @@
+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-03-28 Youenn Fablet <you...@apple.com>
Share more code between RemoteRealtimeAudioSource and RemoteRealtimeVideoSource
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (291967 => 291968)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2022-03-28 16:24:10 UTC (rev 291967)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2022-03-28 16:28:57 UTC (rev 291968)
@@ -1455,17 +1455,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