feat(libSceNKWebKit): implement WTF string case mapping, foldCase and normalizedNFC #18391
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18391"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by SHOnnay on 2026-11-11T13:20:18Z.
What
Implements 13 libSceNKWebKit exports that threw:
WTF::StringImpl:convertToLowercaseWithoutLocaleconvertToUppercaseWithoutLocaleconvertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit(unsigned)convertToLowercaseWithLocale(const AtomString&)convertToUppercaseWithLocale(const AtomString&)WTF::String: the same five, plusfoldCase.WTF::normalizedNFC: theStringViewandconst String&overloads.Source. Ported from pinned WebKit
c55364d53f97:These declarations match the mangled parameter lists. The case-mapping code is identical in the PS5-WebKit-11.x revision this library also cites.
Behaviour.
u_strToLower,u_strToUpper,u_strFoldCaseu_tolower,u_toupper,u_foldCaseunorm2_getNFCInstance,unorm2_isNormalized,unorm2_normalizePlacement. The code is in a new
src/WtfStringIcu.cpp, becausenkwebkit_wtftext_allocationlinksWtfString.cppwith libc only.Allocation. New strings come from the module's existing
NewImpl, exposed asWtfAbi::CreateUninitialized. Paths that returnthisadd a reference the way the existing code does.ABI.
StringViewWithUnderlyingString, 24 bytes, is added toWtfStringAbi.hppwith static asserts.Debt file. The 13 stubs and placeholder declarations are removed. The debt count drops from 6000 to 5987 and the 13 table rows are removed. One debt entry records three things:
AtomString/StringViewWithUnderlyingStringABI follows the pinned headers.Left throwing:
String::simplifyWhiteSpace(CodeUnitMatchFunction): open in #16890.String::number(double/float)andnumberToStringFixed*: open in #14259.MediaTime::toString: depends on #14259's formatting.StringImpl::adopt(StringBuffer):StringBufferis not modelled.Tested
macOS 27 on Apple M1. The registered
nkwebkit_*tests are full-build tests and were not run: the full build does not run on macOS. A Linux or Windows run is needed.Harness. Five new test functions in
tests/WtfText.cppuse expectations worked out by hand from Unicode case and normalization rules. A temporary host harness, not committed, compiled the whole oftests/WtfText.cppwith the unchanged production files:WtfString.cppWtfStringIcu.cppStringBuilder.cpp,StringBuilderJSON.cppWtfNumberFormat.cppTextStream.cppResults:
libicucore). libSceIcu wraps the ICU sources, which the harness could not include without the submodule, so the Unicode tables used may differ from libSceIcu's ICU version.static_assertinlibc/include/GuestLongDouble.hppfails there; this change does not cause it.realLength == lengthfrom the first-pass check. Its behaviour is equivalent, because ICU always reports overflow when the result is longer.Syntax.
clang++ -arch x86_64 -fsyntax-onlypasses on these files:WtfStringIcu.cpp,WtfString.cpp,Export.cpptests/WtfText.cpp,tests/Wtf.cpp,tests/WtfTextAllocation.cppOverlap.
pr_overlap.pyfound no shared exports among the pull requests it could merge. It could not compare 59 that conflict withmain. None of their diffs names any of these exports, the new file or the new helper; #15853 only matches the existingTryCreateUninitialized.gh pr listsearches for the case-mapping names andnormalizedNFCfound nothing.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T17:25:33Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
26036c540d:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_wtftext_testsbuilt cleanly.nkwebkit_wtftext,nkwebkit_wtftext_allocation):Generated withfooter from the description; the AI-assisted checkbox can stay.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T18:35:54Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
26036c540d:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_wtftext_testsbuilt cleanly.nkwebkit_wtftext,nkwebkit_wtftext_allocation):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hpp,core/libs/prx/libSceNKWebKit/src/WtfString.cpp,core/libs/prx/libSceNKWebKit/src/WtfStringAbi.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Generated withfooter from the description; the AI-assisted checkbox can stay.Looks Good To Me