feat(libSceNKWebKit): implement WebCore::Path and the path DisplayList items #24965
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24965"
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 momgaroganuchi-crypto on 2026-11-21T13:29:08Z.
What
Implements 47
libSceNKWebKitexports that throw onmaintoday: theWebCore::Pathlifecycle and geometry entry points (17) and the lifecycle of six path-based DisplayList items (30).Pathuses the console 32-byte layout read from the 11.00libSceNKWebKit.sprx(Path::PathandPath::isNullbodies): the cairo context at +0, a 16-byteVector<PathElement>at +8 and the engaged flag at +0x18. It keeps both the cairo path and the element list, as the cairoPathCairo.cppdoes when inline path data is disabled. Implemented: default/copy/move construction, assignment and destruction,moveTo,addLineTo,addQuadCurveTo,addBezierCurveTo,closeSubpath,clear, bothaddRoundedRectoverloads,elementCount,applyandfastBoundingRect. Copying or clearing an empty path keeps the element list engaged, so a latermoveTooraddLineTois counted and replayed.applycalls the guestWTF::Functionwrapper and falls back to the cairo path when the element list is not engaged.The item work covers
FillPath,StrokePath,DrawPath,ClipPath,ClipOutToPathandDrawFocusRingPath: constructors and destructors copy and release the embeddedPath;FillPathandDrawPathalso answerlocalBoundsfromfastBoundingRect. Theirapplystill throws throughApplyWithoutGraphicsContext, so replaying these items remains future work;StrokePath::localBoundsreports no bounds.The 33 exports are declared once in
include/PathExports.hpp; the duplicate placeholders are removed frominclude/LegacyExports.hpp,include/InventoryExports.hpp,include/Api.hpp,src/PathAbi.hppand the forward declarations insrc/DisplayListPathItems.cpp. Cairo calls go through the internal_nid_no_patchhelpers inlibcairo/include/Bridge.hppandlibcairo/Bridge.cpp, the same mechanism as the existingCairoSurfaceDestroy_nid_no_patch, because the NID patcher rewrites libcairo exports but leaves non-SCE imports of a system library unchanged. The debt fragment adds the Functional entry and removes the eight inventory rows.New files:
include/PathExports.hpp,src/PathAbi.hpp,src/Path.cpp,src/DisplayListPathItems.cpp,tests/Path.cpp,tests/DisplayListPathItems.cpp,libcairo/include/Bridge.hpp,libcairo/Bridge.cpp.Overlap:
pr_overlap.py --namesfinds no open implementation of any of the 47 functions.--branchreports only file-level overlaps with the Export.cpp/CMakeLists edits of other PRs and the split refactors (#24322, #24910, #24917), which list these exports because they move the stubs, not because they implement them. The libcairo_nid_no_patchbridge files are also added by the independent #24980; both copies are identical, so whichever merges first, the other rebases without a semantic conflict.Tested
Windows 11, MinGW-w64 GCC 16.2, Release:
nkwebkit_pathandnkwebkit_displaylistpathitemspass, including layout asserts, copy/move/clear, segment application, rounded rects and null-object faults.nkwebkit_wtfandnkwebkit_dragimagestill pass.The full NKWebKit suite passes (291/291) after rebasing onto
maindc956738fd.tools/check_conventions.py --base origin/mainpasses.tools/debt_fold.py --checkpasses for this fragment; the repository's unrelatedfeat-libwebrtc-rnn-vad.mdfragment fails on its own, so it was moved aside for the check.Not compared with a console module.
Checklist
Based on current
main; no other open PR implements the same functionsOne topic per PR; follow-ups go in a new PR
No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
Unimplemented paths throw (
NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt fileNo notes, investigation
.mdfiles 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
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T13:43:35Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: fix path copy/clear handling so empty paths enter the element-list mode before subsequent edits.
What I ran
Reviewed head
eaefbb1da3d957c2859385b7f30698fb98a61958against basemain. No commands or tests were run in this review; the test results in the PR description are author-reported. Read all changed source and test files listed as included in the review manifest, plus the changedExport.cpplocations relevant to the removed stubs.Export.cppwas excluded from the review folder because it is too large; only targeted lines were read. The review folder’sfiles.jsonwas not available through the reader.Results
Negative control
Not run.
Findings
Blocking
CopyPathleavesm_elementsEngagedfalse when copying a null/empty path, andClearreturns without engaging the element list whenm_pathis null. Thus a copied empty path remains disengaged afterclear(), and later path edits update cairo whileelementCount()reports zero because the disengaged element list is empty. This also affectsFillPathand other items constructed from an empty path. Initialize the empty path as engaged or makeclear()engage the element list even when no cairo context exists. Evidence:core/libs/prx/libSceNKWebKit/src/Path.cpp:145andcore/libs/prx/libSceNKWebKit/src/Path.cpp:183.Non-blocking
None.
Sources
Not verified
The full
Export.cppwas not read; only the unchangedPath::isNullstub location was checked. No build, tests, conventions checks, or PS5 console comparison were run by this reviewer.To get this to a good state
Fix empty-path copy and clear state, add coverage for copying an empty path, clearing it, then adding a segment and checking
elementCount()andapply(). Rerun the path and DisplayList path item tests and the project checks reported in the PR description on the new head.Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T13:46:44Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
eaefbb1da3:tools/check_conventions.pypassed.nkwebkit_displaylistpathitems_tests,nkwebkit_path_testsbuilt cleanly.nkwebkit_displaylistpathitems,nkwebkit_path):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/src/DisplayListPathItems.cpp,core/libs/prx/libSceNKWebKit/src/Path.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T04:14:53Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change based on the reviewed code; its main path and DisplayList lifecycle behavior is implemented as described.
What I ran
Reviewed head
6131e72574fed59e29958bac783ccc9b82c6c229. No commands or tests were run; the Windows test results in the PR description are author-reported.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
None.
Not verified
The full text of
Export.cppandInventoryExports.hppwas excluded by the review bundle size limit. I reviewed their changes in the prepared diff, but did not inspect their complete head contents. I did not run tests, verify the build, or compare behavior against a console module. The PR description reports Windows 11 / MinGW-w64 GCC 16.2 Release test results; these were not run by me.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T14:09:09Z.
Review: COMMENTED
Reviewed — comments
The path implementation and its tests were inspected at head
1ca600ce52f6ca917b260f4b4571d22d93730f81; I did not run the author-reported checks, and one Cairo path-copy cleanup edge case remains.What I ran
Read the prepared description, commits, manifest, diff, and selected changed files using
repo_read.pyat the pinned head. No build or test commands were run. The author reports Windows 11 and MinGW-w64 GCC 16.2 tests in the PR description; these were not independently verified.Results
Negative control
Not run; no checks were run in this review.
Findings
Blocking
None.
Non-blocking
Path::applyleaks the copied Cairo path if a guest callback throws during replay. InApplyCairoPath, the callback runs inside the loop beforeCairoPathDestroy_nid_no_patch(copy); use scoped cleanup so the copy is released on both normal and exceptional exits. (core/libs/prx/libSceNKWebKit/src/Path.cpp:309)Sources
Not verified
No build, test, or console comparison was performed. Read:
core/libs/prx/libSceNKWebKit/CMakeLists.txt,include/Api.hpp,include/LegacyExports.hpp,include/PathExports.hpp,libSceNKWebKit.hpp,src/DisplayListPathItems.cpp,src/Path.cpp,src/PathAbi.hpp, both added test files, andcore/libs/prx/libcairo/CMakeLists.txt,Bridge.cpp, andinclude/Bridge.hpp, plus the review description, commits, manifest, and diff.Export.cppandinclude/InventoryExports.hppwere excluded from the review bundle as too large; the debt fragment was not read.To get this to a good state
Nothing is required. Consider ensuring the copied Cairo path is released if a callback throws.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T15:07:25Z.
Review: COMMENTED
Reviewed — no blocking findings
The requested review folder and reader are not accessible through the available tools, so no changed files or checks could be inspected.
What I ran
Not run. The pinned head, diff, manifest, and repository sources were not available to read.
Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
All changed files, diff hunks, tests, and repository behavior. Files read: none. Files listed for review: not verified.
To get this to a good state
Provide the prepared review folder and pinned reader through an accessible tool so the review can be completed.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T16:23:52Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: remove the duplicate C-linkage export definitions that conflict with the existing implementations.
What I ran
c435055c270d79a0e62c9e44a6ec0bd4f67e11b7usingrepo_read.pyto inspect the prepared diff and selected files.Results
Findings
Blocking
core/libs/prx/libSceNKWebKit/Export.cpp:2749adds a C-linkage stub for_ZN7WebCore12SettingsBase21setStandardFontFamilyERKN3WTF10AtomStringE11UScriptCode, whilesrc/SettingsBase.cppalready defines that symbol. The same conflict occurs atcore/libs/prx/libSceNKWebKit/Export.cpp:6568for_ZN7WebCore16SQLiteFileSystem28appendDatabaseFileNameToPathERKN3WTF6StringES4_, already defined insrc/LegacySQLiteFileSystem.cpp. These duplicate definitions prevent linking. Remove the accidental stubs fromExport.cpp.Non-blocking
None.
Sources
Export.cppat the reviewed head, lines 2749 and 6568; existing definitions insrc/SettingsBase.cppandsrc/LegacySQLiteFileSystem.cpp.Not verified
description.md,commits.md,manifest.json,diff.patch; selected ranges ofPath.cpp,DisplayListPathItems.cpp,PathAbi.hpp,Bridge.cpp,Bridge.hpp,PathExports.hpp, andExport.cpp.Export.cppwas excluded from the prepared review folder due to size and was inspected through the reader. No other files were excluded from the review folder according to the file listing.To get this to a good state
Remove the two duplicate stub definitions and rerun the build and relevant tests on the new head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T16:50:18Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: implement the default and move constructors, which remain placeholders despite the description claiming the Path lifecycle is implemented.
What I ran
6f5c5fec6d4dc8312e2ebbe3007f7a005877f521; no build or tests were run.repo_read.pyto inspect relevant callers and export declarations.Results
Findings
Blocking
core/libs/prx/libSceNKWebKit/include/PathExports.hpp:8exposes only the copy constructor, whilecore/libs/prx/libSceNKWebKit/src/Path.cpp:318implements only copy construction. The default constructors (PathC1Ev/PathC2Ev) and move constructors (PathC1EOS0_/PathC2EOS0_) remain placeholder exports inExport.cppand declarations inLegacyExports.hpp. This leaves required lifecycle entry points unimplemented and contradicts the stated lifecycle scope. Add the constructor implementations and route their declarations/exports consistently.Non-blocking
None.
Not verified
Export.cppwas excluded from the prepared folder because it is too large; targeted searches confirmed the remaining constructor placeholders, but its full text was not read.CMakeLists.txt,Api.hpp,InventoryExports.hpp,LegacyExports.hpp,PathExports.hpp,libSceNKWebKit.hpp,DisplayListPathItems.cpp,Path.cpp,PathAbi.hpp, both path test files,Bridge.cpp,Bridge.hpp, libcairoCMakeLists.txt, and the debt fragment. Excluded: fullExport.cpptext.To get this to a good state
Implement and declare the default and move constructors, remove their placeholder exports, and add constructor coverage. Then rerun the reported NKWebKit tests and export/convention checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T17:33:44Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected path and DisplayList implementations show no verified blocking defect; I could not complete review of every changed file or run checks.
What I ran
Reviewed head
c1e2e97e91bf7ea3d73805b25bd03a0f68daeea3using the prepared review bundle andrepo_read.py. No commands or tests were run.Results
Findings
Blocking
None verified in the inspected code.
Non-blocking
None.
Not verified
Read the description, commits, manifest, and the first 699 lines of the diff. Read
CMakeLists.txt,PathExports.hpp,Path.cpp,PathAbi.hpp,DisplayListPathItems.cpp,Bridge.cpp,Bridge.hpp, andlibSceNKWebKit.hpp. The review bundle excludesExport.cppdue to size; I did not read the other changed files, including the tests, or the remainder of the diff. Export-table correctness, those files, and all reported test results remain unverified.To get this to a good state
Nothing is required. Optional: complete inspection of the remaining changed files and run the reported checks on this head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T18:17:45Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: fix copy assignment so it handles a source path with no Cairo context without dereferencing null.
What I ran
db67bf4a830635549ded4966d7b2d111c123892e.Results
Findings
Blocking
core/libs/prx/libSceNKWebKit/src/Path.cpp:164callsCopyCairowhenever the source has a Cairo context. When the source is empty (from.m_path == nullptr) and the destination already has a context, the empty-source branch at lines 153–158 is skipped, andCopyCairopasses the null source context toCairoGetMatrix_nid_no_patchandCairoCopyPath_nid_no_patch. Copy-assigning a default-constructed empty path into a previously used path can therefore crash instead of clearing the destination. Handle an empty source before callingCopyCairo, resetting the destination context and elements while preserving the intended engaged state.Non-blocking
Sources
Not verified
Export.cppwas excluded from the review folder because it was too large; its full text and changed hunks were not inspected.To get this to a good state
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T20:39:34Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: make copy assignment preserve its destination when copying a non-empty source fails.
What I ran
a14dd8e5d28595ae9de4eac0f7573a4030438eecusing the pinnedrepo_read.pyreader.Results
Findings
Blocking
core/libs/prx/libSceNKWebKit/src/Path.cpp:1383:AssignPathclears an existing destination Cairo path beforeCopyCairosucceeds. If copying the source path fails (for example, Cairo cannot allocate its copied path), the assignment throws with the destination already emptied, violating the usual strong guarantee for copy assignment and leaving the old element list inconsistent with its Cairo path. Copy into temporary state and replace the destination only after the copy succeeds.Non-blocking
None.
Not verified
core/libs/prx/libSceNKWebKit/Export.cppwas excluded from the review bundle because it was too large. Its changed hunks were visible inreview/diff.patch, and its file header was read via the reader; the full file was not read.core/libs/prx/libSceNKWebKit/CMakeLists.txt,core/libs/prx/libSceNKWebKit/Export.cpp(header only),core/libs/prx/libSceNKWebKit/include/Api.hpp,core/libs/prx/libSceNKWebKit/include/PathExports.hpp,core/libs/prx/libSceNKWebKit/src/Path.cpp,core/libs/prx/libSceNKWebKit/src/PathAbi.hpp,core/libs/prx/libSceNKWebKit/src/DisplayListPathItems.cpp,core/libs/prx/libSceNKWebKit/tests/Path.cpp(diff only),core/libs/prx/libSceNKWebKit/tests/DisplayListPathItems.cpp(diff only),core/libs/prx/libcairo/CMakeLists.txt,core/libs/prx/libcairo/Bridge.cpp,core/libs/prx/libcairo/include/Bridge.hpp, anddocs/dev/debt/changes/feat-libnkwebkit-webcore-path.md(diff only).To get this to a good state
AssignPathto copy into temporary Cairo and element state, then commit it to the destination after all copying succeeds. Add a regression test for a failed copy that verifies the destination retains its original path.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T20:56:34Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: ensure every
Pathoperation preserves the element-list and cairo-path state when allocation or cairo calls fail.What I ran
Reviewed head
e362fb046dfeb204bad4dac83212e02e5da2c7ee; no commands or tests were run in this review.Results
Findings
Blocking
Path::operator=(const Path&)loses the destination if copying the element list fails.AssignPathcreates a temporary copy, then callsCopyPath;CopyElementsfirst frees the temporary's empty list, but allocates withfastMallocand immediately writes metadata and copies without checking for allocation failure. If allocation fails, the failure may become a null write rather than an exception, and the surrounding cleanup cannot reliably preserve the destination. More directly, mutation routines update cairo before appending to the element list:moveToandaddLineTocall cairo beforeAppendElement, whose allocation can fail, leaving cairo and the engaged element list inconsistent. Make mutations transactional or disengage/fallback to cairo on element-allocation failure, and check allocations before use. Changed lines:core/libs/prx/libSceNKWebKit/src/Path.cpp:95,core/libs/prx/libSceNKWebKit/src/Path.cpp:367.Non-blocking
Not verified
Export.cppis excluded from the review folder because it is too large; its changes were not read. Other changed files are not individually audited here. No test commands were run, and console behavior was not verified. The review folder lists these included changed files:CMakeLists.txt,Api.hpp,InventoryExports.hpp,LegacyExports.hpp,PathExports.hpp,libSceNKWebKit.hpp,DisplayListPathItems.cpp,Path.cpp,PathAbi.hpp,tests/DisplayListPathItems.cpp,tests/Path.cpp,libcairo/Bridge.cpp,libcairo/CMakeLists.txt,libcairo/include/Bridge.hpp, and the debt fragment.To get this to a good state
Make path mutations safe when element allocation fails, and check allocator results before copying or updating ownership metadata. Rerun the NKWebKit tests and conventions/debt checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T13:17:52Z.
Review: COMMENTED
Actionable comments posted: 3
817c34d8-3e62-4508-b6bf-6434734afa21Reviewing files that changed from the base of the PR and between
d12a22df51and77cbf4136d.core/libs/prx/libSceNKWebKit/CMakeLists.txtcore/libs/prx/libSceNKWebKit/Export.cppcore/libs/prx/libSceNKWebKit/include/Api.hppcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppcore/libs/prx/libSceNKWebKit/include/LegacyExports.hppcore/libs/prx/libSceNKWebKit/include/PathExports.hppcore/libs/prx/libSceNKWebKit/libSceNKWebKit.hppcore/libs/prx/libSceNKWebKit/src/DisplayListPathItems.cppcore/libs/prx/libSceNKWebKit/src/Path.cppcore/libs/prx/libSceNKWebKit/src/PathAbi.hppcore/libs/prx/libSceNKWebKit/tests/DisplayListPathItems.cppcore/libs/prx/libSceNKWebKit/tests/Path.cppcore/libs/prx/libcairo/Bridge.cppcore/libs/prx/libcairo/CMakeLists.txtcore/libs/prx/libcairo/include/Bridge.hppdocs/dev/debt/changes/feat-libnkwebkit-webcore-path.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T13:25:49Z.
Review: COMMENTED
Reviewed — comments
The review is incomplete, so a formal approval is not justified; I found no verified blocking defect in the code I inspected.
What I ran
Reviewed the prepared bundle for head
77cbf4136d999f6d3de45ead118873593fd9c414and read selected repository files throughrepo_read.py. No tests or other checks were run. The author reports Windows 11/MinGW tests and convention checks in the PR description; these were not independently run.Results
Negative control
Not run; no tests were run during this review.
Findings
Blocking
None verified in the inspected code.
Non-blocking
None.
Sources
Read
core/libs/prx/libSceNKWebKit/CMakeLists.txt,include/Api.hpp,include/PathExports.hpp,libSceNKWebKit.hpp,src/Path.cpp,src/DisplayListPathItems.cpp, andcore/libs/prx/libcairo/Bridge.cppplusinclude/Bridge.hpp. Also inspected the prepared description, commits, manifest, and portions of the diff. The bundle lists 16 changed files;Export.cppwas excluded from the bundle for size, and the other changed files were not all read at the repository head.Not verified
The review did not cover every changed file or the complete diff. In particular,
Export.cppwas excluded, andPathAbi.hpp, both test files, both inventory headers, libcairo's CMake file, and the debt fragment were not read at the repository head. The reported test results, console ABI behavior, and changes in those files remain unverified.To get this to a good state
Nothing is required. Optional: complete the review of the unread changed files before making a formal approval decision.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T15:16:35Z.
Review: COMMENTED
I ran
nkwebkit_pathandnkwebkit_displaylistpathitemswith the patch applied on Linux. Both passed, covering path storage and element iteration, bounds, and the draw, fill, and stroke item paths.AI-assisted: yes.
Pull request closed