[Webkit-unassigned] [Bug 261056] AX: Expose accessibility attributes for inline text predictions

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 12 06:35:52 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=261056

--- Comment #22 from Andres Gonzalez <andresg_22 at apple.com> ---
(In reply to Joshua Hoffman from comment #21)
> Created attachment 467646 [details]
> Patch

--- a/Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm
+++ b/Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm

+        // Find the location of the the complete word being predicted by iterating backwards through the text to find whitespace.

Typo: the the 

+        previousCompositionNodeText = previousCompositionNodeText.substring(wordStart);

If wordStart is 0, we are unnecessarily copying previousCompositionNodeText. Can we avoid this copy?

+static void attributedStringSetCompositionAttributes(NSMutableAttributedString *attributedString, RenderObject* renderer)
+{
+#if HAVE(INLINE_PREDICTIONS)
+    if (!renderer)
+        return;
+
+    RefPtr object = renderer->document().axObjectCache()->getOrCreate(renderer);
+
+    auto lastPresentedCompleteWord = object->lastPresentedTextPredictionComplete();

Check object for null before using it?
Also, we are copying the strings unnecessarily. You may want to make the inline method lastPresentedTextPredictionComplete() to return a reference.

+    auto lastPresentedTextPrediction = object->lastPresentedTextPrediction();

Same comment applies here to lastPresentedTextPrediction().

--- /dev/null
+++ b/LayoutTests/accessibility/ios-simulator/inline-prediction-attributed-string.html

+    editable.focus();

editable.xxx --> document.getElementById("editable").xxx instead.

+    input.insertText("Good mo")

Missing ;

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230912/399aeffb/attachment-0001.htm>


More information about the webkit-unassigned mailing list