Summary: | AX: Re-enable accessibility/ios-simulator/inline-prediction-attributed-string test | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Joshua Hoffman <jhoffman23> | ||||||||||||
Component: | Accessibility | Assignee: | Joshua Hoffman <jhoffman23> | ||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||
Severity: | Normal | CC: | andresg_22, ews-watchlist, mifenton, tyler_w, webkit-bug-importer | ||||||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||||||
Version: | WebKit Nightly Build | ||||||||||||||
Hardware: | All | ||||||||||||||
OS: | All | ||||||||||||||
Attachments: |
|
Description
Joshua Hoffman
2024-04-25 15:47:17 PDT
Created attachment 471144 [details]
Patch
Created attachment 471151 [details]
Patch
(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) 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)) { ... } Created attachment 471164 [details]
Patch
Missing the glib revert—adding that now. Created attachment 471166 [details]
Patch
Created attachment 471201 [details]
Patch
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]. |