feat(libSceNKWebKit): implement geometry enclosure helpers #14138

Closed
CobaltMoth482 wants to merge 8 commits from upstream-pr/14138 into main
CobaltMoth482 commented 2026-10-31 20:33:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CobaltMoth482 on 2026-10-31T20:33:39Z.


What

Implements six existing libSceNKWebKit geometry stubs in one topic: findIntersection, both enclosingIntRect overloads, enclosingLayoutRect, makeMapBetweenRects, and encloseRectToDevicePixels.

Also routes the two existing integer AffineTransform::mapRect / TransformationMatrix::mapRect callers through the same enclosure implementation, removing a duplicate that overflows signed endpoint subtraction. The exact baseline triggers UBSan for both callers; the candidate returns the source-compatible saturated extent. These two fixes are not counted as new exports.

Behavior follows revision-pinned official WebKit GeometryUtilities.cpp, FloatRect.cpp, LayoutRect.cpp and AffineTransform.cpp, including subordinate clamping/fixed-point rules. All 28 checked source sections, including the six bodies and both caller compositions, match the project's existing public-source reference port after whitespace/comments normalization; official upstream files were used for the final reference-execution rerun. This is source-equivalence evidence, not console binary provenance. Both integer-map caller compositions are confirmed in the pinned TransformationMatrix.cpp and AffineTransform source. Uses existing asserted value layouts; no new dependency or opaque object model. Console ABI/behavior remains unverified and is documented as debt.

All six names/NIDs were independently recomputed and matched to exact name/NID pairs in the pinned public 3.20 inventory; that inventory alone does not establish prototypes.

Repository classifier: 1,150 / 11,248 → 1,156 / 11,248 (+6, unchanged denominator; 10.2240% → 10.2774%, +0.05334 percentage points). No game-unblock or performance claim.

Tested

Linux x86-64 / GCC 14.2.0. Candidate 2873edb871327c8be57ef25420afa8178c0b38b0 on main 0836dfdf4fecb1e0326100c490476e15d3a74da5 (2026-10-31).

  • Strict optimized behavioral fixture passes; exercises all six helpers plus both existing integer map callers, inputs unchanged, output aliases, rounding/saturation, signed zero, NaN/infinity and non-finite values.
  • Independent review: 3,487,708 total differential assertions pass against a separately written model and exact pinned WebKit function bodies with scoped type shims. Includes all-bit cases, 3,204 structured finite boundaries, 12 scales, near-parallel determinants, all four output aliases, and 5,400 transform cases per integer-map caller. The caller oracle checks pinned enclosure composition using the existing float mapping, not the entire transform algorithm. NaNs are compared by classification, not payload; this is not a full WebKit build.
  • The same differential coverage passes ASan/UBSan/float-cast-overflow; eleven independent-oracle mutants are detected. The actual CMake-built module also passes all 3,487,708 checks using lazy loading for unrelated unresolved dependencies.
  • ASan/UBSan/float-cast-overflow fixtures pass (leak detection disabled). Baseline caller regressions fail; fixed callers pass. Changed translation units pass strict warnings; the combined standalone test suppresses one preexisting unused-function warning in unchanged WebCoreGeometry.cpp.
  • Actual NKWebKit, Jsc and pinned QuickJS sources build through their module CMake files in an external focused harness; original geometry and new geometry-access CTests pass (2/2). The harness substitutes an interface for unrelated guest libc and permits unresolved unrelated symbols, so this is not a full-product or guest-loader link validation.
  • Linux GCC Microsoft-ABI caller to APS5 SysV-export bridge exercises all six return/argument shapes. This is not Windows execution.
  • Public-header audit: 394 libraries / 24,929 exports; standalone headers and unique declaration coverage pass. Conventions and whitespace checks pass.
  • Full-product configuration blocked at CMakeLists.txt:534 by unavailable XRandR development support with the pinned SDL submodule initialized. Guard not disabled. No full product build/CTest, Windows, title/homebrew or console execution; maintainer full CI remains needed.

Overlap and merge ordering

Required tools/pr_overlap.py scanned 1,684 open PRs and found nine shared-file peers; it exited 2, not a clean pass. Manual review and 44 base-vs-candidate controls across 22 shared files found no duplicate functions/NIDs or new-file collisions, including both modified integer-map callers. No peer touches WebCoreTransform.cpp.

Five peers (#13515, #13744, #13766, #13770, #13772) already conflict with main; this candidate adds no code/header conflict. Four peers (#13930, #13936, #13947, #13992) have genuine debt-counter-only conflicts: each changes the aggregate remaining-stub count independently. Whichever lands later must rebase and recompute the count while preserving both independent entries. No functional dependency and no combined-peer build; this branch is based directly on main.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5101297881 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14138). Originally posted by [CobaltMoth482](https://github.com/CobaltMoth482) on 2026-10-31T20:33:39Z. --- ### What Implements six existing `libSceNKWebKit` geometry stubs in one topic: `findIntersection`, both `enclosingIntRect` overloads, `enclosingLayoutRect`, `makeMapBetweenRects`, and `encloseRectToDevicePixels`. Also routes the two existing integer `AffineTransform::mapRect` / `TransformationMatrix::mapRect` callers through the same enclosure implementation, removing a duplicate that overflows signed endpoint subtraction. The exact baseline triggers UBSan for both callers; the candidate returns the source-compatible saturated extent. These two fixes are **not** counted as new exports. Behavior follows revision-pinned official WebKit [GeometryUtilities.cpp](https://github.com/WebKit/WebKit/blob/0756854fafd4312b8f0126de111792e39db106ef/Source/WebCore/platform/graphics/GeometryUtilities.cpp), [FloatRect.cpp](https://github.com/WebKit/WebKit/blob/0756854fafd4312b8f0126de111792e39db106ef/Source/WebCore/platform/graphics/FloatRect.cpp), [LayoutRect.cpp](https://github.com/WebKit/WebKit/blob/0756854fafd4312b8f0126de111792e39db106ef/Source/WebCore/platform/graphics/LayoutRect.cpp) and [AffineTransform.cpp](https://github.com/WebKit/WebKit/blob/0756854fafd4312b8f0126de111792e39db106ef/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp), including subordinate clamping/fixed-point rules. All 28 checked source sections, including the six bodies and both caller compositions, match the project's existing public-source reference port after whitespace/comments normalization; official upstream files were used for the final reference-execution rerun. This is source-equivalence evidence, not console binary provenance. Both integer-map caller compositions are confirmed in the pinned [TransformationMatrix.cpp](https://github.com/WebKit/WebKit/blob/0756854fafd4312b8f0126de111792e39db106ef/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp) and AffineTransform source. Uses existing asserted value layouts; no new dependency or opaque object model. Console ABI/behavior remains unverified and is documented as debt. All six names/NIDs were independently recomputed and matched to exact name/NID pairs in the [pinned public 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceNKWebKit.c); that inventory alone does not establish prototypes. Repository classifier: **1,150 / 11,248 → 1,156 / 11,248** (+6, unchanged denominator; 10.2240% → 10.2774%, +0.05334 percentage points). No game-unblock or performance claim. ### Tested Linux x86-64 / GCC 14.2.0. Candidate `2873edb871327c8be57ef25420afa8178c0b38b0` on main `0836dfdf4fecb1e0326100c490476e15d3a74da5` (2026-10-31). - Strict optimized behavioral fixture passes; exercises all six helpers plus both existing integer map callers, inputs unchanged, output aliases, rounding/saturation, signed zero, NaN/infinity and non-finite values. - Independent review: **3,487,708 total differential assertions pass** against a separately written model and exact pinned WebKit function bodies with scoped type shims. Includes all-bit cases, 3,204 structured finite boundaries, 12 scales, near-parallel determinants, all four output aliases, and 5,400 transform cases per integer-map caller. The caller oracle checks pinned enclosure composition using the existing float mapping, not the entire transform algorithm. NaNs are compared by classification, not payload; this is not a full WebKit build. - The same differential coverage passes ASan/UBSan/float-cast-overflow; eleven independent-oracle mutants are detected. The actual CMake-built module also passes all 3,487,708 checks using lazy loading for unrelated unresolved dependencies. - ASan/UBSan/float-cast-overflow fixtures pass (leak detection disabled). Baseline caller regressions fail; fixed callers pass. Changed translation units pass strict warnings; the combined standalone test suppresses one preexisting unused-function warning in unchanged `WebCoreGeometry.cpp`. - Actual NKWebKit, Jsc and pinned QuickJS sources build through their module CMake files in an external focused harness; original geometry and new geometry-access CTests pass (2/2). The harness substitutes an interface for unrelated guest libc and permits unresolved unrelated symbols, so this is not a full-product or guest-loader link validation. - Linux GCC Microsoft-ABI caller to APS5 SysV-export bridge exercises all six return/argument shapes. This is **not Windows execution**. - Public-header audit: 394 libraries / 24,929 exports; standalone headers and unique declaration coverage pass. Conventions and whitespace checks pass. - Full-product configuration blocked at CMakeLists.txt:534 by unavailable XRandR development support with the pinned SDL submodule initialized. Guard not disabled. No full product build/CTest, Windows, title/homebrew or console execution; maintainer full CI remains needed. ### Overlap and merge ordering Required `tools/pr_overlap.py` scanned 1,684 open PRs and found nine shared-file peers; it exited **2**, not a clean pass. Manual review and 44 base-vs-candidate controls across 22 shared files found no duplicate functions/NIDs or new-file collisions, including both modified integer-map callers. No peer touches `WebCoreTransform.cpp`. Five peers (#13515, #13744, #13766, #13770, #13772) already conflict with main; this candidate adds no code/header conflict. Four peers (#13930, #13936, #13947, #13992) have genuine **debt-counter-only** conflicts: each changes the aggregate remaining-stub count independently. Whichever lands later must rebase and recompute the count while preserving both independent entries. No functional dependency and no combined-peer build; this branch is based directly on main. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### 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: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
MarcZX10 commented 2026-10-31 20:46:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T20:46:09Z.

Review: APPROVED


Reviewed — looks good

Reviewed exact head c4b9ee6ea07d15974779703baf58666d09185b53 against PR base 0836dfdf4fecb1e0326100c490476e15d3a74da5; the Windows build and changed geometry test passed, and I found no blocking source issue.

What I ran

Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. I did not build locally. The PR base is 0836dfdf4fecb1e0326100c490476e15d3a74da5; the stack checker previewed cleanly against current main at 9fe758d7520eb0c33f3df8bef539064b40bd523f.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14138
git diff --check 0836dfdf4fecb1e0326100c490476e15d3a74da5...c4b9ee6ea07d15974779703baf58666d09185b53
python3 tools/pr_abi_audit.py --base 0836dfdf4fecb1e0326100c490476e15d3a74da5 --head c4b9ee6ea07d15974779703baf58666d09185b53 --json
python3 tools/pr_stack_check.py 14138 --repo boykopovar/AnyPS5

Results

Check Result
Diff and conventions Passed
Export/declaration/NID lexical audit The temporary precheck checkout lacked the helper; rerunning it from the workspace passed with no findings (the audit does not certify runtime ABI)
Current-main merge preview Clean
Hosted Windows build Built libSceNKWebKit.prx and the changed geometry test executable (job)
Hosted Windows tests nkwebkit_webcoregeometryaccess passed; selected suite: 2,534 passed, 0 failed (job)
Test-quality heuristic Could not run in the temporary checkout because the helper script was absent; the new C++ test is registered and ran in hosted CI
Unedited check output

Conventions:

All conventions checks passed.

ABI audit summary from its JSON output:

{
  "status": "passed",
  "findings": []
}

Hosted Windows CTest log:

1851/2534 Test #2304: nkwebkit_webcoregeometryaccess ...........................................   Passed    0.01 sec
100% tests passed, 0 tests failed out of 2534

Sources

The implementations follow the pinned WebKit GeometryUtilities.cpp, FloatRect.cpp, LayoutRect.cpp, and AffineTransform.cpp. The changed implementations and tests are available at the reviewed head.

Not verified

Linux CI was skipped, and I did not run a local or full-product build, console execution, or console ABI verification. The PR records the console ABI and behavior as unverified; this review's build/test evidence is the hosted Windows job above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724845350 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14138#pullrequestreview-5724845350). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T20:46:09Z. **Review:** APPROVED --- # Reviewed — looks good Reviewed exact head `c4b9ee6ea07d15974779703baf58666d09185b53` against PR base `0836dfdf4fecb1e0326100c490476e15d3a74da5`; the Windows build and changed geometry test passed, and I found no blocking source issue. ## What I ran Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. I did not build locally. The PR base is `0836dfdf4fecb1e0326100c490476e15d3a74da5`; the stack checker previewed cleanly against current `main` at `9fe758d7520eb0c33f3df8bef539064b40bd523f`. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14138 git diff --check 0836dfdf4fecb1e0326100c490476e15d3a74da5...c4b9ee6ea07d15974779703baf58666d09185b53 python3 tools/pr_abi_audit.py --base 0836dfdf4fecb1e0326100c490476e15d3a74da5 --head c4b9ee6ea07d15974779703baf58666d09185b53 --json python3 tools/pr_stack_check.py 14138 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | |---|---| | Diff and conventions | Passed | | Export/declaration/NID lexical audit | The temporary precheck checkout lacked the helper; rerunning it from the workspace passed with no findings (the audit does not certify runtime ABI) | | Current-main merge preview | Clean | | Hosted Windows build | Built `libSceNKWebKit.prx` and the changed geometry test executable ([job](https://github.com/boykopovar/AnyPS5/actions/runs/41239478261/job/124650190435)) | | Hosted Windows tests | `nkwebkit_webcoregeometryaccess` passed; selected suite: 2,534 passed, 0 failed ([job](https://github.com/boykopovar/AnyPS5/actions/runs/41239478261/job/124650190435)) | | Test-quality heuristic | Could not run in the temporary checkout because the helper script was absent; the new C++ test is registered and ran in hosted CI | <details><summary>Unedited check output</summary> Conventions: ```text All conventions checks passed. ``` ABI audit summary from its JSON output: ```json { "status": "passed", "findings": [] } ``` Hosted Windows CTest log: ```text 1851/2534 Test #2304: nkwebkit_webcoregeometryaccess ........................................... Passed 0.01 sec 100% tests passed, 0 tests failed out of 2534 ``` </details> ## Sources The implementations follow the pinned [WebKit GeometryUtilities.cpp](https://github.com/WebKit/WebKit/blob/0756854fafd4312b8f0126de111792e39db106ef/Source/WebCore/platform/graphics/GeometryUtilities.cpp), [FloatRect.cpp](https://github.com/WebKit/WebKit/blob/0756854fafd4312b8f0126de111792e39db106ef/Source/WebCore/platform/graphics/FloatRect.cpp), [LayoutRect.cpp](https://github.com/WebKit/WebKit/blob/0756854fafd4312b8f0126de111792e39db106ef/Source/WebCore/platform/graphics/LayoutRect.cpp), and [AffineTransform.cpp](https://github.com/WebKit/WebKit/blob/0756854fafd4312b8f0126de111792e39db106ef/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp). The changed implementations and tests are available at the [reviewed head](https://github.com/boykopovar/AnyPS5/tree/c4b9ee6ea07d15974779703baf58666d09185b53/core/libs/prx/libSceNKWebKit). ## Not verified Linux CI was skipped, and I did not run a local or full-product build, console execution, or console ABI verification. The PR records the console ABI and behavior as unverified; this review's build/test evidence is the hosted Windows job above.
CnRJay commented 2026-11-01 19:49:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:49:33Z.

Review: COMMENTED


Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (Unblocks: none is allowed), and it contained no code review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729922625 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14138#pullrequestreview-5729922625). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:49:33Z. **Review:** COMMENTED --- Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (`Unblocks: none` is allowed), and it contained no code review.
MarcZX10 commented 2026-11-20 08:46:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T08:46:06Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the points below are optional.

What I ran

Reviewed head 7efb741f713a8e3eebca3ca6c1515eef87746ccf using the prepared diff and pinned repository reader. No commands or tests were run in this review; test results below are reported by the author.

Results

Check Result Note
Source and diff review passed Changed implementation and callers inspected
Author-reported test suite not run Reported passing; not independently verified
Full product build and console behavior not run Author reports these remain unverified

Findings

Blocking

None.

Non-blocking

  • Console ABI and behavior for the new geometry exports remain unverified, as documented in the PR. Host-side tests and pinned source comparisons provide useful evidence, but cannot establish console execution behavior.
  • The report notes four peer PRs with debt-counter-only conflicts; the landing PR should rebase and recompute the aggregate count as described.

Not verified

No tests were run. Full product build, Windows execution, guest-loader linking, and console behavior were not verified. Read: description.md, commits.md, manifest.json, diff.patch, WebCoreExports.hpp, WebCoreGeometryAccess.cpp, WebCoreTransform.cpp, and tests/WebCoreGeometryAccess.cpp. Excluded from the review folder and not read: Export.cpp, InventoryExports.hpp, docs/dev/debt/libSceNKWebKit.md, and files identified in files.json as excluded by rule.

To get this to a good state

Nothing is required. Optional: validate the new exports' ABI and behavior on console hardware, and recompute the debt counter after rebasing if one of the noted peer PRs lands first.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5989799182 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14138#pullrequestreview-5989799182). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T08:46:06Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the points below are optional. ## What I ran Reviewed head `7efb741f713a8e3eebca3ca6c1515eef87746ccf` using the prepared diff and pinned repository reader. No commands or tests were run in this review; test results below are reported by the author. ## Results | Check | Result | Note | |---|---|---| | Source and diff review | passed | Changed implementation and callers inspected | | Author-reported test suite | not run | Reported passing; not independently verified | | Full product build and console behavior | not run | Author reports these remain unverified | ## Findings ### Blocking None. ### Non-blocking - Console ABI and behavior for the new geometry exports remain unverified, as documented in the PR. Host-side tests and pinned source comparisons provide useful evidence, but cannot establish console execution behavior. - The report notes four peer PRs with debt-counter-only conflicts; the landing PR should rebase and recompute the aggregate count as described. ## Not verified No tests were run. Full product build, Windows execution, guest-loader linking, and console behavior were not verified. Read: `description.md`, `commits.md`, `manifest.json`, `diff.patch`, `WebCoreExports.hpp`, `WebCoreGeometryAccess.cpp`, `WebCoreTransform.cpp`, and `tests/WebCoreGeometryAccess.cpp`. Excluded from the review folder and not read: `Export.cpp`, `InventoryExports.hpp`, `docs/dev/debt/libSceNKWebKit.md`, and files identified in `files.json` as excluded by rule. ## To get this to a good state Nothing is required. Optional: validate the new exports' ABI and behavior on console hardware, and recompute the debt counter after rebasing if one of the noted peer PRs lands first.
ligmaSec commented 2026-12-03 13:16:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:16:46Z.

Review: COMMENTED


Checked the branch sources and built the focused tests against the existing Linux runtime. WebCoreGeometryAccess passed.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6170531053 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14138#pullrequestreview-6170531053). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T13:16:46Z. **Review:** COMMENTED --- Checked the branch sources and built the focused tests against the existing Linux runtime. `WebCoreGeometryAccess` passed. AI-assisted: yes.

Pull request closed

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!14138
No description provided.