feat(libSceNKWebKit): implement WebCore color space conversions and serialization #18415

Merged
SHOnnay merged 6 commits from upstream-pr/18415 into main 2026-11-13 01:12:15 +00:00
SHOnnay commented 2026-11-11 13:45:12 +00:00 (Migrated from github.com)

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, serializationForHTML and serializationForRenderTreeAsText, each for:

  • SRGBA<uint8_t>, passed by value
  • SRGBA<float>
  • LinearSRGBA<float>
  • DisplayP3<float>

Source. Ported from WebKit c55364d53f97:

  • ColorConversion.cpp, ColorSerialization.cpp, ColorTypes.h and ColorMatrix.h
  • areEssentiallyEqual and clampTo from WTF MathExtras.h

Its declarations match the exported names. The 11.x source has none of these declarations.

Types. src/WebCoreTypes.hpp gains the SRGBA, LinearSRGBA, DisplayP3, LinearDisplayP3 and HSLA component types, with size, offset and trivially-copyable static asserts.

Formatting. Float output reuses the existing NumberToString(float), and strings come from StringImpl::create.

Files.

  • New: src/WebCoreColorSpaces.cpp, include/ColorSpaceExports.hpp, tests/WebCoreColorSpaces.cpp.
  • Removed: the 20 stubs and their LegacyExports.hpp placeholders.

Left throwing:

  • serializationForCSS(Color), serializationForRenderTreeAsText(Color) and Color::colorSpaceAndComponents: c55364d packs an inline Color differently from the 11.x packing this library decodes, so the console layout is unknown.
  • serializationForHTML(Color): open PR #17917 implements it.
  • FilterOperation::transformColor and inverseTransformColor: 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_webcorecolorspaces test 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.cpp and Bmalloc.cpp with 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.

  • x86-64: all 5 hand mutations failed the harness:
    • transfer divisor 12.92→12.0
    • swapped green-max hue operands
    • CalcHue threshold 3→2
    • lowercase hex digits
    • the alpha check
  • arm64: 9 of 11 failed. The 2 survivors led to added test cases.

ABI. 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-only passes on Export.cpp, the new source and the new test.

$ python3 tools/check_conventions.py --base upstream/main
All conventions checks passed.
$ python3 core/libs/tests/test_public_headers.py --audit-only
407 libraries, 34229 exports: unique declarations and umbrella coverage verified

Overlap. No open PR implements these exports.

  • The added lines of all 59 PRs pr_overlap.py could not compare contain none of the 20 names or the new files.
  • #17912, #14138 and #15515 show them only as unchanged context.
  • Textual conflicts are possible in Export.cpp and LegacyExports.hpp.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5260577155 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18415). Originally posted by [SHOnnay](https://github.com/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`, `serializationForHTML` and `serializationForRenderTreeAsText`, each for: - `SRGBA<uint8_t>`, passed by value - `SRGBA<float>` - `LinearSRGBA<float>` - `DisplayP3<float>` **Source.** Ported from WebKit [`c55364d53f97`](https://github.com/WebKit/WebKit/tree/c55364d53f971f63a709976f168d932d558b8909): - `ColorConversion.cpp`, `ColorSerialization.cpp`, `ColorTypes.h` and `ColorMatrix.h` - `areEssentiallyEqual` and `clampTo` from WTF `MathExtras.h` Its declarations match the exported names. The 11.x source has none of these declarations. **Types.** `src/WebCoreTypes.hpp` gains the `SRGBA`, `LinearSRGBA`, `DisplayP3`, `LinearDisplayP3` and `HSLA` component types, with size, offset and trivially-copyable static asserts. **Formatting.** Float output reuses the existing `NumberToString(float)`, and strings come from `StringImpl::create`. **Files.** - New: `src/WebCoreColorSpaces.cpp`, `include/ColorSpaceExports.hpp`, `tests/WebCoreColorSpaces.cpp`. - Removed: the 20 stubs and their `LegacyExports.hpp` placeholders. **Left throwing:** - `serializationForCSS(Color)`, `serializationForRenderTreeAsText(Color)` and `Color::colorSpaceAndComponents`: c55364d packs an inline `Color` differently from the 11.x packing this library decodes, so the console layout is unknown. - `serializationForHTML(Color)`: open PR #17917 implements it. - `FilterOperation::transformColor` and `inverseTransformColor`: 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_webcorecolorspaces` test 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.cpp` and `Bmalloc.cpp` with 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.** - **x86-64:** all 5 hand mutations failed the harness: - transfer divisor 12.92→12.0 - swapped green-max hue operands - `CalcHue` threshold 3→2 - lowercase hex digits - the alpha check - **arm64:** 9 of 11 failed. The 2 survivors led to added test cases. **ABI.** 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-only` passes on `Export.cpp`, the new source and the new test. ```text $ python3 tools/check_conventions.py --base upstream/main All conventions checks passed. $ python3 core/libs/tests/test_public_headers.py --audit-only 407 libraries, 34229 exports: unique declarations and umbrella coverage verified ``` **Overlap.** No open PR implements these exports. - The added lines of all 59 PRs `pr_overlap.py` could not compare contain none of the 20 names or the new files. - #17912, #14138 and #15515 show them only as unchanged context. - Textual conflicts are possible in `Export.cpp` and `LegacyExports.hpp`. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
PrivacyOnion commented 2026-11-11 15:30:32 +00:00 (Migrated from github.com)

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:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: libSceNKWebKit, nkwebkit_webcorecolorspaces_tests failed to build.
    /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `NoteGuestStackProtection(unsigned long, unsigned long, bool)'
    /usr/bin/ld: core/libs/libs/unpatched/libSceNKWebKit.prx: undefined reference to `JSC::JSRunLoopTimer::~JSRunLoopTimer()'
    /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `ThreadLifecycle::SetThreadDtors(void (*)())'
    /usr/bin/ld: core/libs/libs/unpatched/libSceNKWebKit.prx: undefined reference to `WTF::fastFree(void*)'
    /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `GuestThreadCpuClockId(PthreadPrivate const*)'
    /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `LockMainGuestThread_nid_no_patch(PthreadPrivate*&)'
    /usr/bin/ld: core/libs/libs/unpatched/libSceNKWebKit.prx: undefined reference to `JSC::DeferredWorkTimer::~DeferredWorkTimer()'
    /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `scePthreadOnce'
    /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `ThreadCancel::EndWait()'
    /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `ThreadCancel::BeginWait(TimedWait::Condition*)'
    /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `scePthreadGetname'
    /usr/bin/ld: core/libs/libs/unpatched/libSceNKWebKit.prx: undefined reference to `Inspector::ScriptCallFrame::isEqual(Inspector::ScriptCallFrame const&) const'
    
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5861193174 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18415#pullrequestreview-5861193174). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-11T15:30:32Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `35464babda`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `libSceNKWebKit`, `nkwebkit_webcorecolorspaces_tests` failed to build. ``` /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `NoteGuestStackProtection(unsigned long, unsigned long, bool)' /usr/bin/ld: core/libs/libs/unpatched/libSceNKWebKit.prx: undefined reference to `JSC::JSRunLoopTimer::~JSRunLoopTimer()' /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `ThreadLifecycle::SetThreadDtors(void (*)())' /usr/bin/ld: core/libs/libs/unpatched/libSceNKWebKit.prx: undefined reference to `WTF::fastFree(void*)' /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `GuestThreadCpuClockId(PthreadPrivate const*)' /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `LockMainGuestThread_nid_no_patch(PthreadPrivate*&)' /usr/bin/ld: core/libs/libs/unpatched/libSceNKWebKit.prx: undefined reference to `JSC::DeferredWorkTimer::~DeferredWorkTimer()' /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `scePthreadOnce' /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `ThreadCancel::EndWait()' /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `ThreadCancel::BeginWait(TimedWait::Condition*)' /usr/bin/ld: /home/loki/workers/w4/build/core/libs/libs/unpatched/libkernel.prx: undefined reference to `scePthreadGetname' /usr/bin/ld: core/libs/libs/unpatched/libSceNKWebKit.prx: undefined reference to `Inspector::ScriptCallFrame::isEqual(Inspector::ScriptCallFrame const&) const' ``` - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Requesting changes for the points above.
PrivacyOnion commented 2026-11-12 06:12:54 +00:00 (Migrated from github.com)

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:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_webcorecolorspaces_tests built cleanly.
  • CTest (nkwebkit_webcorecolorspaces):
    1/1 Test #3751: nkwebkit_webcorecolorspaces ......   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with 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.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified all 20 WebCore color space conversion and serialization exports in core/libs/prx/libSceNKWebKit/include/ColorSpaceExports.hpp and src/WebCoreColorSpaces.cpp match the mangled symbol signatures removed from Export.cpp and LegacyExports.hpp, ensuring exact parameter passing modes (pass-by-value for 4-byte SRGBA<uint8_t> vs const reference for 16-byte float color types) and APS5_VABI linkage.
    • Verified color space transfer functions (LinearToRgbComponent, RgbToLinearComponent) and gamut transformations (LinearSrgbToXyz, XyzToLinearSrgb, LinearDisplayP3ToXyz, XyzToLinearDisplayP3) in src/WebCoreColorSpaces.cpp, confirming correct matrix operations in Transform() and alpha channel preservation at index 3.
    • Verified HSL color conversion logic in _ZN7WebCore6toHSLAERKNS_5SRGBAIfEE and _ZN7WebCore7toSRGBAERKNS_4HSLAIfEE, confirming proper handling of zero chroma/saturation edge cases, hue wrapping, lightness boundaries, and the period-6 trapezoidal piecewise mapping in CalcHue.
    • Verified CSS, HTML, and RenderTree serialization routines (SerializeCss, SerializeColorFunction, FractionDigitsForFractionalAlphaValue, Hex2), ensuring proper handling of alpha values (0, 0xFF, and fractional 1..254), hex casing (lowercase for HTML, uppercase for RenderTree), and floating-point alpha omission when equal to 1.0f via AreEssentiallyEqual.
    • Verified struct layouts, field offsets, sizes, and trivially-copyable traits for SRGBA<uint8_t> (4 bytes), SRGBA, LinearSRGBA, DisplayP3, LinearDisplayP3, and HSLA (16 bytes each) via static_assert checks in core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hpp.
    • Verified AGENTS.md compliance: zero prohibited comments in code (the Apple BSD license and commit attribution header in WebCoreColorSpaces.cpp was explicitly requested by maintainer oneandonlydean), known gaps correctly recorded in docs/dev/debt/libSceNKWebKit.md, and thorough regression tests covering all 20 exports in tests/WebCoreColorSpaces.cpp.
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5869930919 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18415#pullrequestreview-5869930919). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-12T06:12:54Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `cc1d3d2c26`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_webcorecolorspaces_tests` built cleanly. - **CTest** (`nkwebkit_webcorecolorspaces`): ``` 1/1 Test #3751: nkwebkit_webcorecolorspaces ...... Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `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.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified all 20 WebCore color space conversion and serialization exports in core/libs/prx/libSceNKWebKit/include/ColorSpaceExports.hpp and src/WebCoreColorSpaces.cpp match the mangled symbol signatures removed from Export.cpp and LegacyExports.hpp, ensuring exact parameter passing modes (pass-by-value for 4-byte SRGBA<uint8_t> vs const reference for 16-byte float color types) and APS5_VABI linkage. - Verified color space transfer functions (LinearToRgbComponent, RgbToLinearComponent) and gamut transformations (LinearSrgbToXyz, XyzToLinearSrgb, LinearDisplayP3ToXyz, XyzToLinearDisplayP3) in src/WebCoreColorSpaces.cpp, confirming correct matrix operations in Transform() and alpha channel preservation at index 3. - Verified HSL color conversion logic in _ZN7WebCore6toHSLAERKNS_5SRGBAIfEE and _ZN7WebCore7toSRGBAERKNS_4HSLAIfEE, confirming proper handling of zero chroma/saturation edge cases, hue wrapping, lightness boundaries, and the period-6 trapezoidal piecewise mapping in CalcHue. - Verified CSS, HTML, and RenderTree serialization routines (SerializeCss, SerializeColorFunction, FractionDigitsForFractionalAlphaValue, Hex2), ensuring proper handling of alpha values (0, 0xFF, and fractional 1..254), hex casing (lowercase for HTML, uppercase for RenderTree), and floating-point alpha omission when equal to 1.0f via AreEssentiallyEqual. - Verified struct layouts, field offsets, sizes, and trivially-copyable traits for SRGBA<uint8_t> (4 bytes), SRGBA<float>, LinearSRGBA<float>, DisplayP3<float>, LinearDisplayP3<float>, and HSLA<float> (16 bytes each) via static_assert checks in core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hpp. - Verified AGENTS.md compliance: zero prohibited comments in code (the Apple BSD license and commit attribution header in WebCoreColorSpaces.cpp was explicitly requested by maintainer oneandonlydean), known gaps correctly recorded in docs/dev/debt/libSceNKWebKit.md, and thorough regression tests covering all 20 exports in tests/WebCoreColorSpaces.cpp. - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Looks Good To Me
PrivacyOnion commented 2026-11-12 08:28:35 +00:00 (Migrated from github.com)

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:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_webcorecolorspaces_tests built cleanly.
  • CTest (nkwebkit_webcorecolorspaces):
    1/1 Test #3760: nkwebkit_webcorecolorspaces ......   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with 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.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified matrix transformations and transfer functions in core/libs/prx/libSceNKWebKit/src/WebCoreColorSpaces.cpp for toLinearSRGBA, toSRGBA, toLinearDisplayP3, toDisplayP3, toHSLA, and gamut conversions between Display P3 and sRGB, confirming matrix constants match WebKit revision c55364d53f97 as approved by maintainer oneandonlydean.
    • Verified serialization formatting in SerializeCss, Hex2, FractionDigitsForFractionalAlphaValue, and SerializeColorFunction in WebCoreColorSpaces.cpp across all 12 serialization exports, validating boundary alpha handling (0, 255, and fractional values in [1, 254]) and lowercase/uppercase hex casing across CSS, HTML, and RenderTreeAsText.
    • Verified struct layouts, alignments, member offsets, and trivial copyability static assertions in core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hpp for SRGBA<uint8_t>, SRGBA, LinearSRGBA, DisplayP3, LinearDisplayP3, and HSLA.
    • Verified that all 20 exported symbol manglings in core/libs/prx/libSceNKWebKit/include/ColorSpaceExports.hpp match the removed stub declarations from Export.cpp and LegacyExports.hpp, using extern "C" and APS5_VABI.
    • Verified test coverage in core/libs/prx/libSceNKWebKit/tests/WebCoreColorSpaces.cpp, ensuring all 20 exports are exercised with edge cases including negative linear components, gamut conversions, boundary hues (0, 30, 60, 150, 210, 300, 330 degrees), zero chroma, and alpha equality thresholding.
    • Verified compliance with AGENTS.md rules and maintainer instructions, confirming technical debt is documented in docs/dev/debt/libSceNKWebKit.md, license headers verbatim match upstream as requested by the maintainer, and no forbidden comments or extra files are introduced.
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5871363722 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18415#pullrequestreview-5871363722). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-12T08:28:35Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `06a82800d3`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_webcorecolorspaces_tests` built cleanly. - **CTest** (`nkwebkit_webcorecolorspaces`): ``` 1/1 Test #3760: nkwebkit_webcorecolorspaces ...... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `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.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified matrix transformations and transfer functions in core/libs/prx/libSceNKWebKit/src/WebCoreColorSpaces.cpp for toLinearSRGBA, toSRGBA, toLinearDisplayP3, toDisplayP3, toHSLA, and gamut conversions between Display P3 and sRGB, confirming matrix constants match WebKit revision c55364d53f97 as approved by maintainer oneandonlydean. - Verified serialization formatting in SerializeCss, Hex2, FractionDigitsForFractionalAlphaValue, and SerializeColorFunction in WebCoreColorSpaces.cpp across all 12 serialization exports, validating boundary alpha handling (0, 255, and fractional values in [1, 254]) and lowercase/uppercase hex casing across CSS, HTML, and RenderTreeAsText. - Verified struct layouts, alignments, member offsets, and trivial copyability static assertions in core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hpp for SRGBA<uint8_t>, SRGBA<float>, LinearSRGBA<float>, DisplayP3<float>, LinearDisplayP3<float>, and HSLA<float>. - Verified that all 20 exported symbol manglings in core/libs/prx/libSceNKWebKit/include/ColorSpaceExports.hpp match the removed stub declarations from Export.cpp and LegacyExports.hpp, using extern "C" and APS5_VABI. - Verified test coverage in core/libs/prx/libSceNKWebKit/tests/WebCoreColorSpaces.cpp, ensuring all 20 exports are exercised with edge cases including negative linear components, gamut conversions, boundary hues (0, 30, 60, 150, 210, 300, 330 degrees), zero chroma, and alpha equality thresholding. - Verified compliance with AGENTS.md rules and maintainer instructions, confirming technical debt is documented in docs/dev/debt/libSceNKWebKit.md, license headers verbatim match upstream as requested by the maintainer, and no forbidden comments or extra files are introduced. - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Looks Good To Me
PrivacyOnion commented 2026-11-12 15:24:24 +00:00 (Migrated from github.com)

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:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_webcorecolorspaces_tests built cleanly.
  • CTest (nkwebkit_webcorecolorspaces):
    1/1 Test #3797: nkwebkit_webcorecolorspaces ......   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with 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.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified that all 20 exported conversion and serialization functions in core/libs/prx/libSceNKWebKit/src/WebCoreColorSpaces.cpp match their declarations in include/ColorSpaceExports.hpp, use correct extern "C" APS5_VABI ABI linkage, and correspond 1:1 with removed stubs in Export.cpp and include/LegacyExports.hpp.
    • Verified matrix transformation arithmetic in Transform() across XyzToLinearSrgb, LinearSrgbToXyz, XyzToLinearDisplayP3, and LinearDisplayP3ToXyz, confirming 3x3 row-major indexing within std::array<float, 9> bounds and exact preservation of the alpha channel in component arrays.
    • Verified bidirectional transfer functions LinearToRgbComponent() and RgbToLinearComponent() for SRGBA and DisplayP3 float inputs, confirming proper branching across linear thresholds (0.0031308f and 0.04045f) and correct preservation of negative component values.
    • Verified toHSLA() and toSRGBA(HSLA) conversions in WebCoreColorSpaces.cpp, checking min/max/chroma edge cases, hue sector wrapping across [0, 360) / [0, 1), saturation calculations at lightness boundaries, and CalcHue() periodic folding.
    • Verified CSS, HTML, and RenderTreeAsText color serialization routines across 8-bit SRGBA and float SRGBA/LinearSRGBA/DisplayP3 types, confirming FractionDigitsForFractionalAlphaValue arithmetic, Hex2 uppercase/lowercase formatting, and AreEssentiallyEqual float alpha omission.
    • Verified memory safety and ABI layout in core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hpp, validating static asserts for sizeof, offsetof, and trivial copyability across SRGBA<uint8_t>, SRGBA, LinearSRGBA, DisplayP3, LinearDisplayP3, and HSLA.
    • Verified test coverage in core/libs/prx/libSceNKWebKit/tests/WebCoreColorSpaces.cpp, ensuring all 20 exports are actively exercised across gamut boundary values, HSL hues, fractional alpha variations, and CSS/HTML/RenderTree serialization outputs.
    • docs/dev/debt/libSceNKWebKit.md: Verified the debt entry under '### Functional' correctly links to 'core/libs/prx/libSceNKWebKit/src/WebCoreColorSpaces.cpp' via a valid relative path, cites WebKit commit c55364d53f97, documents the non-fused FMA precision tolerance, and records that the Color overloads remain throwing due to 11.x packing layout differences.
  • Minor: please drop the Generated with footer from the description; the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5877063716 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18415#pullrequestreview-5877063716). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-12T15:24:24Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `25c60a827f`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_webcorecolorspaces_tests` built cleanly. - **CTest** (`nkwebkit_webcorecolorspaces`): ``` 1/1 Test #3797: nkwebkit_webcorecolorspaces ...... Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `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.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified that all 20 exported conversion and serialization functions in core/libs/prx/libSceNKWebKit/src/WebCoreColorSpaces.cpp match their declarations in include/ColorSpaceExports.hpp, use correct extern "C" APS5_VABI ABI linkage, and correspond 1:1 with removed stubs in Export.cpp and include/LegacyExports.hpp. - Verified matrix transformation arithmetic in Transform() across XyzToLinearSrgb, LinearSrgbToXyz, XyzToLinearDisplayP3, and LinearDisplayP3ToXyz, confirming 3x3 row-major indexing within std::array<float, 9> bounds and exact preservation of the alpha channel in component arrays. - Verified bidirectional transfer functions LinearToRgbComponent() and RgbToLinearComponent() for SRGBA and DisplayP3 float inputs, confirming proper branching across linear thresholds (0.0031308f and 0.04045f) and correct preservation of negative component values. - Verified toHSLA() and toSRGBA(HSLA) conversions in WebCoreColorSpaces.cpp, checking min/max/chroma edge cases, hue sector wrapping across [0, 360) / [0, 1), saturation calculations at lightness boundaries, and CalcHue() periodic folding. - Verified CSS, HTML, and RenderTreeAsText color serialization routines across 8-bit SRGBA and float SRGBA/LinearSRGBA/DisplayP3 types, confirming FractionDigitsForFractionalAlphaValue arithmetic, Hex2 uppercase/lowercase formatting, and AreEssentiallyEqual float alpha omission. - Verified memory safety and ABI layout in core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hpp, validating static asserts for sizeof, offsetof, and trivial copyability across SRGBA<uint8_t>, SRGBA<float>, LinearSRGBA<float>, DisplayP3<float>, LinearDisplayP3<float>, and HSLA<float>. - Verified test coverage in core/libs/prx/libSceNKWebKit/tests/WebCoreColorSpaces.cpp, ensuring all 20 exports are actively exercised across gamut boundary values, HSL hues, fractional alpha variations, and CSS/HTML/RenderTree serialization outputs. - docs/dev/debt/libSceNKWebKit.md: Verified the debt entry under '### Functional' correctly links to 'core/libs/prx/libSceNKWebKit/src/WebCoreColorSpaces.cpp' via a valid relative path, cites WebKit commit c55364d53f97, documents the non-fused FMA precision tolerance, and records that the Color overloads remain throwing due to 11.x packing layout differences. - Minor: please drop the `Generated with` footer from the description; the AI-assisted checkbox can stay. Looks Good To Me
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!18415
No description provided.