RESOLVED FIXED273284
AX: Re-enable accessibility/ios-simulator/inline-prediction-attributed-string test
https://bugs.webkit.org/show_bug.cgi?id=273284
Summary AX: Re-enable accessibility/ios-simulator/inline-prediction-attributed-string...
Joshua Hoffman
Reported 2024-04-25 15:47:17 PDT
This test and corresponding infrastructure for iOS was removed, but the implementation stayed the same. We need to add this back in. This is related to https://bugs.webkit.org/show_bug.cgi?id=271969, which will track the work needed for the Mac side.
Attachments
Patch (26.40 KB, patch)
2024-04-25 16:08 PDT, Joshua Hoffman
no flags
Patch (26.61 KB, patch)
2024-04-25 19:39 PDT, Joshua Hoffman
no flags
Patch (26.70 KB, patch)
2024-04-26 09:58 PDT, Joshua Hoffman
no flags
Patch (27.87 KB, patch)
2024-04-26 12:12 PDT, Joshua Hoffman
no flags
Patch (28.54 KB, patch)
2024-04-29 11:25 PDT, Joshua Hoffman
no flags
Radar WebKit Bug Importer
Comment 1 2024-04-25 15:47:27 PDT
Joshua Hoffman
Comment 2 2024-04-25 16:08:56 PDT
Joshua Hoffman
Comment 3 2024-04-25 19:39:40 PDT
Andres Gonzalez
Comment 4 2024-04-26 07:21:34 PDT
(In reply to Joshua Hoffman from comment #3) > Created attachment 471151 [details] > Patch diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp index 32dc838ceaaf..e6495aacf498 100644 --- a/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp +++ b/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp @@ -621,7 +621,7 @@ WKArrayRef WKBundlePageCopyTrackedRepaintRects(WKBundlePageRef pageRef) return WebKit::toAPI(&WebKit::toImpl(pageRef)->trackedRepaintRects().leakRef()); } -void WKBundlePageSetComposition(WKBundlePageRef pageRef, WKStringRef text, int from, int length, bool suppressUnderline, WKArrayRef highlightData) +void WKBundlePageSetComposition(WKBundlePageRef pageRef, WKStringRef text, int from, int length, bool suppressUnderline, WKArrayRef highlightData, WKArrayRef annotationData) { Vector<WebCore::CompositionHighlight> highlights; if (highlightData) { @@ -648,7 +648,22 @@ void WKBundlePageSetComposition(WKBundlePageRef pageRef, WKStringRef text, int f } } - WebKit::toImpl(pageRef)->setCompositionForTesting(WebKit::toWTFString(text), from, length, suppressUnderline, highlights); + HashMap<String, Vector<WebCore::CharacterRange>> annotations; + if (annotationData) { + auto* annotationDataArray = WebKit::toImpl(annotationData); + for (auto dictionary : annotationDataArray->elementsOfType<API::Dictionary>()) { + auto location = static_cast<API::UInt64*>(dictionary->get("from"_s))->value(); + auto length = static_cast<API::UInt64*>(dictionary->get("length"_s))->value(); + auto name = static_cast<API::String*>(dictionary->get("annotation"_s))->string(); + + auto it = annotations.find(name); + if (it == annotations.end()) + it = annotations.add(name, Vector<WebCore::CharacterRange> { }).iterator; + it->value.append({ location, length }); AG: should not use it when it is == annotations.end(). + } + } + + WebKit::toImpl(pageRef)->setCompositionForTesting(WebKit::toWTFString(text), from, length, suppressUnderline, highlights, annotations); } bool WKBundlePageHasComposition(WKBundlePageRef pageRef)
Tyler Wilcock
Comment 5 2024-04-26 08:28:05 PDT
Comment on attachment 471151 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=471151&action=review Looks good minus maybe one missing null check. > Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:654 > + auto* annotationDataArray = WebKit::toImpl(annotationData); > + for (auto dictionary : annotationDataArray->elementsOfType<API::Dictionary>()) { Does annotationDataArray need a null-check? Would it be possible to do this? if (auto* annotationDataArray = WebKit::toImpl(annotationData)) { ... }
Joshua Hoffman
Comment 6 2024-04-26 09:58:54 PDT
Joshua Hoffman
Comment 7 2024-04-26 12:12:15 PDT
Missing the glib revert—adding that now.
Joshua Hoffman
Comment 8 2024-04-26 12:12:47 PDT
Joshua Hoffman
Comment 9 2024-04-29 11:25:22 PDT
EWS
Comment 10 2024-04-30 09:53:15 PDT
Committed 278171@main (26acf2ecbc14): <https://commits.webkit.org/278171@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 471201 [details].
Note You need to log in before you can comment on or make changes to this bug.