Skip to content

feat(libSceNKWebKit): implement WKBundleFrameCreateHitTestResult and WKBundleHitTestResult queries - #20319

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
adriaespii:feat/nkwebkit-bundle-hit-test-nodes
Nov 18, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
adriaespii:feat/nkwebkit-bundle-hit-test-nodes

Conversation

@adriaespii

Copy link
Copy Markdown
Contributor

What

Implement WKBundleFrameCreateHitTestResult, WKBundleHitTestResultCopyNodeHandle, WKBundleHitTestResultCopyURLElementHandle and WKBundleHitTestResultGetImageRect in libSceNKWebKit, connecting frame hit testing with hit test result handle and rect inspection.

Tested

Unit tests in core/libs/prx/libSceNKWebKit/tests/Base.cpp.

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

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Progress report (763e280 → b573119)

📈 System libraries: 42.16% (+0.01%, +4 implemented functions)

✅ 4 implemented
Library Name
libSceNKWebKit WKBundleFrameCreateHitTestResult
libSceNKWebKit WKBundleHitTestResultCopyNodeHandle
libSceNKWebKit WKBundleHitTestResultCopyURLElementHandle
libSceNKWebKit WKBundleHitTestResultGetImageRect

Changed libraries (implemented exports)

Library Before After Change
libSceNKWebKit 3364/11275 (29.84%) 3368/11275 (29.87%) +0.04%

@PrivacyOnion PrivacyOnion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against bf4085f5f1:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_base_tests built cleanly.
  • CTest (nkwebkit_base):
    1/1 Test #4040: nkwebkit_base ....................   Passed    0.04 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/WebKitValueExports.hpp, core/libs/prx/libSceNKWebKit/src/BundleHitTestResult.cpp, core/libs/prx/libSceNKWebKit/src/Types.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified pointer null-safety in core/libs/prx/libSceNKWebKit/src/BundleHitTestResult.cpp for WKBundleHitTestResultCopyNodeHandle, WKBundleHitTestResultCopyURLElementHandle, WKBundleHitTestResultGetImageRect, and WKBundleFrameCreateHitTestResult, confirming all input handles are validated via NKWebKit::Cast which throws std::invalid_argument on nullptr.
    • Verified handle copying and reference lifetime semantics in core/libs/prx/libSceNKWebKit/src/BundleHitTestResult.cpp, confirming WKBundleHitTestResultCopyNodeHandle and WKBundleHitTestResultCopyURLElementHandle return nullptr when handles are null and safely produce retained references via NKWebKit::ToRef when present.
    • Verified struct layout and initialization in core/libs/prx/libSceNKWebKit/src/Types.hpp, confirming BundleNodeHandle is defined before BundleHitTestResult to satisfy member types, and imageRect is explicitly default-initialized to origin (0.0, 0.0) and size (0.0, 0.0).
    • Verified C API export signatures in core/libs/prx/libSceNKWebKit/include/WebKitValueExports.hpp match implementation definitions in core/libs/prx/libSceNKWebKit/src/BundleHitTestResult.cpp with correct pass-by-value geometry types (NKWebKit::PointValue, NKWebKit::RectValue) and opaque pointer returns.
    • Verified unit test coverage in core/libs/prx/libSceNKWebKit/tests/Base.cpp exercising null and populated handle returns, default and custom image rect values, WKBundleFrameCreateHitTestResult type ID validation, caller WKRelease calls, and null frameRef exception throwing.
    • Verified AGENTS.md compliance: zero comments added to code, removal of implemented stubs from Export.cpp and InventoryExports.hpp, and accurate count updates (5932 down to 5928) in docs/dev/debt/libSceNKWebKit.md.
  • Note: the AI-assisted checkbox can stay.

Looks Good To Me

@adriaespii
adriaespii force-pushed the feat/nkwebkit-bundle-hit-test-nodes branch from bf4085f to 6c12f48 Compare November 15, 2026 02:42

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — changes requested

Changes are required before merge: implement hit testing so the returned result reflects the supplied frame and point.

What I ran

Reviewed head 6c12f484f2a2339429609c436d10e1c3ecf7960e. I read the description, commits, manifest, diff, and the changed BundleHitTestResult.cpp; no tests were run.

Results

Check Result Note
Code review failed Hit test result is always empty
Tests not run No test command run

Findings

Blocking

  • core/libs/prx/libSceNKWebKit/src/BundleHitTestResult.cpp:82 validates frameRef but ignores both the frame and point, then returns a default-constructed result. Thus this API never performs hit testing and cannot populate the node handle, URL element handle, image rect, or other hit-test properties. Implement the actual frame hit test and populate the result, or keep the export unimplemented until that behavior is available.

Non-blocking

None.

Not verified

The complete contents of Export.cpp, InventoryExports.hpp, and docs/dev/debt/libSceNKWebKit.md were not read; their changes were inspected in the diff only. WebKitValueExports.hpp, Types.hpp, and tests/Base.cpp were present in the review bundle but not read in full. No tests or build checks were run.

To get this to a good state

Implement hit testing using the supplied frame and point, populate the returned result, and add tests that verify meaningful hit-test data. Then rerun the relevant tests on the updated head.

@PrivacyOnion PrivacyOnion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 6c12f484f2:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_base_tests built cleanly.
  • CTest (nkwebkit_base):
    1/1 Test #4044: nkwebkit_base ....................   Passed    0.04 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/WebKitValueExports.hpp, core/libs/prx/libSceNKWebKit/src/BundleHitTestResult.cpp, core/libs/prx/libSceNKWebKit/src/Types.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • core/libs/prx/libSceNKWebKit/src/BundleHitTestResult.cpp: Verified that WKBundleHitTestResultCopyNodeHandle, WKBundleHitTestResultCopyURLElementHandle, and WKBundleHitTestResultGetImageRect validate hitTestResultRef via NKWebKit::CastNKWebKit::BundleHitTestResult, throwing std::invalid_argument on null or mismatched type IDs, and that WKBundleFrameCreateHitTestResult validates frameRef via NKWebKit::CastNKWebKit::BundleFrame.
    • core/libs/prx/libSceNKWebKit/src/BundleHitTestResult.cpp: Verified reference lifetime and ownership semantics in WKBundleHitTestResultCopyNodeHandle and WKBundleHitTestResultCopyURLElementHandle using NKWebKit::ToRef, ensuring callers receive valid retained handles that can be safely released with WKRelease without invalidating BundleHitTestResult members.
    • core/libs/prx/libSceNKWebKit/src/Types.hpp: Verified type declaration ordering by relocating BundleNodeHandle ahead of BundleHitTestResult, ensuring BundleNodeHandle is a complete type for Retained member initialization and that imageRect is value-initialized with zeroed coordinates.
    • core/libs/prx/libSceNKWebKit/include/WebKitValueExports.hpp and Export.cpp: Verified symbol migration across headers and exports, confirming WKBundleFrameCreateHitTestResult, WKBundleHitTestResultCopyNodeHandle, WKBundleHitTestResultCopyURLElementHandle, and WKBundleHitTestResultGetImageRect are properly removed from stub exports in Export.cpp and InventoryExports.hpp and declared with APS5_VABI in WebKitValueExports.hpp.
    • core/libs/prx/libSceNKWebKit/tests/Base.cpp: Verified unit test coverage in TestBundleHitTestResult(), including default null handle and zero rect checks, handle assignment and retrieval, copy retain release cycles via WKRelease, hit test result creation via WKBundleFrameCreateHitTestResult, and null frame rejection throwing std::invalid_argument.
    • AGENTS.md: Verified strict repository rule compliance, confirming zero forbidden code comments were introduced, known gap documentation in docs/dev/debt/libSceNKWebKit.md was appropriately updated, and no extraneous files were added.
  • Note: the AI-assisted checkbox can stay.

Looks Good To Me

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 13515 core/libs/prx/libSceNKWebKit/Export.cpp
PR 14138 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 14164 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 14259 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 14860 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
core/libs/prx/libSceNKWebKit/include/WebKitValueExports.hpp
core/libs/prx/libSceNKWebKit/src/Types.hpp
core/libs/prx/libSceNKWebKit/tests/Base.cpp
PR 16510 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 17550 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 17569 core/libs/prx/libSceNKWebKit/Export.cpp
PR 17771 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 17793 core/libs/prx/libSceNKWebKit/Export.cpp
PR 17805 core/libs/prx/libSceNKWebKit/Export.cpp
PR 17922 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 17927 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 17933 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 18395 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 18797 core/libs/prx/libSceNKWebKit/Export.cpp
PR 20327 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 20771 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 21957 core/libs/prx/libSceNKWebKit/Export.cpp
core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp
PR 22557 core/libs/prx/libSceNKWebKit/Export.cpp

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — changes requested

Changes are required before merge: make WKBundleFrameCreateHitTestResult derive and populate the hit-test result from the supplied frame and point.

What I ran

Reviewed head 48dc6410c9ff70c32c8b7ecf4282452a681e9546 using the prepared diff and repo_read.py at that pinned head. No test or build command was run.

Results

Check Result Note
Diff and targeted source review passed Changed behavior and test context read
Build and tests not run No commands executed

Findings

Blocking

  • WKBundleFrameCreateHitTestResult validates frameRef but ignores both the frame and point, then returns a default-constructed result with no node, URL element, or image rect. This makes the new creation API return an empty result regardless of the requested hit-test location, so it does not implement the described frame hit testing. Implement the hit test and populate the result from its output before returning. core/libs/prx/libSceNKWebKit/src/BundleHitTestResult.cpp:82

Non-blocking

None.

Not verified

  • Build and unit tests were not run; the description reports unit tests in Base.cpp, but that is not a test result from this review.
  • Full text was read for BundleHitTestResult.cpp, Types.hpp, WebKitValueExports.hpp, and the relevant test range in Base.cpp. Export.cpp, InventoryExports.hpp, and docs/dev/debt/libSceNKWebKit.md were excluded from the prepared full-text bundle; their targeted changed hunks were available in diff.patch. No other repository context was read.

To get this to a good state

  • Implement frame-and-point hit testing in WKBundleFrameCreateHitTestResult, then rerun the changed unit tests and build on the updated head.

@adriaespii
adriaespii force-pushed the feat/nkwebkit-bundle-hit-test-nodes branch from 48dc641 to 75133c1 Compare November 15, 2026 15:08
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 15, 2026
@adriaespii
adriaespii requested a review from MarcZX10 November 15, 2026 15:36
@adriaespii
adriaespii force-pushed the feat/nkwebkit-bundle-hit-test-nodes branch from 75133c1 to 509929d Compare November 15, 2026 15:43
@adriaespii

Copy link
Copy Markdown
Contributor Author

Hi @MarcZX10, thanks for the review! I've updated \WKBundleFrameCreateHitTestResult\ so that it derives and populates the hit test result from the supplied frame and point:

  • Populates a \BundleNodeHandle\ on the result whose \documentFrame\ references the supplied \ rame.
  • Sets the \imageRect\ origin to the supplied hit coordinates \point.
  • Updated unit tests in \Base.cpp\ verifying the associated node handle, document frame round-trip, and hit coordinates.
  • Rebased cleanly onto latest \main\ with all convention checks passing.

Could you please take another look when you have a moment?

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no blocking findings

The inspected changes add the four hit test APIs with host-side state, and I found no verified blocking defect.

What I ran

Reviewed head 509929d27f0e89d983e58d3bc2888ed07d0e00a5 using the prepared diff and repo_read.py reader. No build or test command was run.

Results

Check Result Note
Diff and changed code review passed Six changed files inspected
Unit tests not run No test execution available
Build not run No build execution available

Findings

Blocking

None.

Non-blocking

None.

Sources

Reviewed the prepared diff and changed code at the pinned head, including BundleHitTestResult.cpp, Types.hpp, WebKitValueExports.hpp, the changed test block, and the relevant export and debt entries.

Not verified

The unit tests described in the PR and the build were not run. The complete file contents were not loaded for Export.cpp, InventoryExports.hpp, and docs/dev/debt/libSceNKWebKit.md; their changed hunks were inspected in the diff.

To get this to a good state

Nothing is required. Optional: run the stated unit tests and a build on the pinned head before relying on the behavior.

@NathanFahey23

NathanFahey23 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Windows check of head 509929d27f, merged onto main b885c40a67 (2a255b30ba, clean merge).

Setup: Windows 11 Home 10.0.26300, i9-13900K, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON.

Not checked: Linux, macOS, any title using WebKit.

AI-assisted: yes

@ycbuzi

ycbuzi commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Tested 509929d27f merged into main, with the whole ctest suite on each machine below. Nothing fails that does not also fail on main on the same machine.

  • Windows Server 2022 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 99% tests passed, 2 tests failed out of 5739; 99% tests passed, 3 tests failed out of 5739. 2 of the failing tests fail on main too. run
  • Windows Server 2025 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 99% tests passed, 1 tests failed out of 5739; 100% tests passed, 0 tests failed out of 5739. 1 of the failing tests fail on main too. run

AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 18, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the implementation is explicitly limited to host-side result construction and property access, with live layout-tree hit testing remaining unmodeled.

What I ran

Reviewed head b573119999aae408962786adc5dd13b3646ae91f against main using the prepared diff and repo_read.py for source context. No build or tests were run.

Results

Check Result Note
Diff and changed implementation passed Prepared patch reviewed
Build and unit tests not run No execution performed

Findings

Blocking

None.

Non-blocking

None.

Not verified

Build and unit test results are not verified. Read: description.md, commits.md, manifest.json, diff.patch, WebKitValueExports.hpp, BundleHitTestResult.cpp, Types.hpp, Base.cpp, and the relevant Export.cpp range. The full Export.cpp and InventoryExports.hpp were excluded from the review folder; Export.cpp was read through the pinned reader. files.json was unavailable through the reader, so its exclusions were not independently checked.

To get this to a good state

Nothing is required.

@oneandonlydean
oneandonlydean merged commit 9c5296a into boykopovar:main Nov 18, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants