feat(libSceNKWebKit): implement WebCore color space conversions and serialization #18415
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18415"
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:45:12Z.
What
Implements 20 WebCore color exports in libSceNKWebKit.
Conversions (8):
toLinearSRGBA(SRGBA<float>),toSRGBA(LinearSRGBA<float>)toLinearDisplayP3(DisplayP3<float>),toDisplayP3(LinearDisplayP3<float>)toSRGBA(DisplayP3<float>),toDisplayP3(SRGBA<float>)toHSLA(SRGBA<float>),toSRGBA(HSLA<float>)Serialization (12):
serializationForCSS,serializationForHTMLandserializationForRenderTreeAsText, each for:SRGBA<uint8_t>, passed by valueSRGBA<float>LinearSRGBA<float>DisplayP3<float>Source. Ported from WebKit
c55364d53f97:ColorConversion.cpp,ColorSerialization.cpp,ColorTypes.handColorMatrix.hareEssentiallyEqualandclampTofrom WTFMathExtras.hIts declarations match the exported names. The 11.x source has none of these declarations.
Types.
src/WebCoreTypes.hppgains theSRGBA,LinearSRGBA,DisplayP3,LinearDisplayP3andHSLAcomponent types, with size, offset and trivially-copyable static asserts.Formatting. Float output reuses the existing
NumberToString(float), and strings come fromStringImpl::create.Files.
src/WebCoreColorSpaces.cpp,include/ColorSpaceExports.hpp,tests/WebCoreColorSpaces.cpp.LegacyExports.hppplaceholders.Left throwing:
serializationForCSS(Color),serializationForRenderTreeAsText(Color)andColor::colorSpaceAndComponents: c55364d packs an inlineColordifferently from the 11.x packing this library decodes, so the console layout is unknown.serializationForHTML(Color): open PR #17917 implements it.FilterOperation::transformColorandinverseTransformColor: they need FilterOperation object layouts.Debt. A new entry records the unverified layouts and that matrix products are not fused into FMA, so a console build that fuses them may differ in the last bit.
Tested
macOS 27 on Apple M1. The new
nkwebkit_webcorecolorspacestest is registered by the existing glob. It is a full-build test and was not run: the full build does not run on macOS. A Linux or Windows run is needed.Harness. A temporary host harness, not committed, compiled the unchanged
WebCoreColorSpaces.cpp,WtfString.cpp,WtfNumberFormat.cppandBmalloc.cppwith the test file. It passed on x86-64 under Rosetta (ad-hoc signed) and on arm64.Expected values were derived by hand (HSL hues, alpha digits, hex). Gamut values come from an independent float64 evaluation of the formulas, with tolerance 1e-4.
Mutation check.
CalcHuethreshold 3→2ABI. An x86-64 caller compiled against declarations shaped like upstream's matches one compiled against this header. HSLA results come back in xmm0/xmm1. String results return through the hidden pointer in rdi, with the 4-byte color in esi.
Syntax.
clang++ -arch x86_64 -fsyntax-onlypasses onExport.cpp, the new source and the new test.Overlap. No open PR implements these exports.
pr_overlap.pycould not compare contain none of the 20 names or the new files.Export.cppandLegacyExports.hpp.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-11T15:30:32Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
35464babda:tools/check_conventions.pypassed;git diff --checkclean.libSceNKWebKit,nkwebkit_webcorecolorspaces_testsfailed to build.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-12T06:12:54Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
cc1d3d2c26:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_webcorecolorspaces_testsbuilt cleanly.nkwebkit_webcorecolorspaces):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/WebCoreTypes.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
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T08:28:35Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
06a82800d3:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_webcorecolorspaces_testsbuilt cleanly.nkwebkit_webcorecolorspaces):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/WebCoreTypes.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
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T15:24:24Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
25c60a827f:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_webcorecolorspaces_testsbuilt cleanly.nkwebkit_webcorecolorspaces):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/WebCoreTypes.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