feat(libSceNKWebKit): implement the TextStream operators for activity flags, touch actions and regions #24161

Merged
ToRaNek merged 1 commit from upstream-pr/24161 into main 2026-11-21 11:20:31 +00:00
ToRaNek commented 2026-11-20 08:31:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ToRaNek on 2026-11-20T08:31:30Z.


What

Three WebCore::operator<<(TextStream&, ...) exports were stubs that threw. They now print what WebKit prints.

Export Source Output
operator<<(TextStream&, OptionSet<ActivityState::Flag>) ActivityState.cpp L33-L57 the names of the set flags, in bit order, joined by , : active window, focused, visible, visible or occluded, in-window, visually idle, audible, loading, capturing media
operator<<(TextStream&, TouchAction) EventRegion.cpp L346-L364 auto, none, manipulation, pan-x, pan-y or pinch-zoom
operator<<(TextStream&, const Region&) Region.cpp L656-L666 a newline, then one indented (rect ...) line per rectangle of Region::rects()

Which revision. The first symbol names a nested enum, ActivityState::Flag. That enum exists at c55364d53f97, e12a212a531a and 73a35b43be7a, where the function is the same nine-name list. The pinned 11.x tree has made ActivityState an enum class, so its operator takes OptionSet<ActivityState>, mangles differently and has a tenth name; the inventory symbol cannot be that one. The TouchAction and Region operators are the same text in all four trees.

Values outside the enums. WebKit tests each flag with contains, so bits above the ninth print nothing. For a TouchAction that is not one of the six values the switch falls through to ASSERT_NOT_REACHED(); return ts;, which in a release build returns the stream unchanged. The port does the same in both cases.

Region. The operator writes the newline, raises the indent by one for the rectangle lines and restores it, as TextStream::IndentScope does, and prints each rectangle with the existing IntRect operator, so the SVGStyleRect flag applies to it. The rectangles come from the existing Region::rects() export.

FloatRoundedRect is left a stub on purpose: its operator differs between the three older revisions and 11.x, and nothing in the symbol tells them apart.

Tested

Windows 11 IoT Enterprise LTSC 2024 (10.0.26100), WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON.

  • core/libs/prx/libSceNKWebKit/tests/WebCoreDump.cpp (nkwebkit_webcoredump): each of the nine flags alone, all nine, all 32 bits set, two pairs, an unknown bit alone and with a known one; the six touch actions and six values outside the enum; an empty region, a one-rectangle region (default, SVGStyleRect, and single-line mode, where no indent is written), an L-shaped union of two rectangles, and the same union on a stream already indented by two, with the indent checked afterwards.
  • Before: on main e825fa1492 the three exports are the stubs removed here, which throw NotImplemented.
  • With the change on main e825fa1492: ctest -R "^nkwebkit_" passes 162 of 162.
  • python tools/check_conventions.py --base origin/main passes.
  • python tools/pr_overlap.py --branch feat/nkwebkit-text-stream-activity-touch-region: it fails closed on 32 open PRs that edit Export.cpp or the export headers. I fetched each head and searched the added and removed lines of its diff for the three symbols and the two new file names. None implements them. #23758 and the three PRs stacked on it (#23999, #24000, #24009) call the Region operator from a translated wrapper and define a test double for it; they leave the operator itself a stub. #24011 implements other TextStream operators (Vector, ScrollableAreaParameters, VisiblePosition, VisibleSelection) and removes the stub next to the TouchAction one, so the two branches touch neighbouring lines of Export.cpp, InventoryExports.hpp, WebCoreDumpExports.hpp and tests/WebCoreDump.cpp: whichever merges second needs a rebase, which I will do if it is this one.

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 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 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:5410266097 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24161). Originally posted by [ToRaNek](https://github.com/ToRaNek) on 2026-11-20T08:31:30Z. --- ### What Three `WebCore::operator<<(TextStream&, ...)` exports were stubs that threw. They now print what WebKit prints. | Export | Source | Output | |---|---|---| | `operator<<(TextStream&, OptionSet<ActivityState::Flag>)` | [`ActivityState.cpp` L33-L57](https://github.com/WebKit/WebKit/blob/c55364d53f971f63a709976f168d932d558b8909/Source/WebCore/page/ActivityState.cpp#L33-L57) | the names of the set flags, in bit order, joined by `, `: `active window`, `focused`, `visible`, `visible or occluded`, `in-window`, `visually idle`, `audible`, `loading`, `capturing media` | | `operator<<(TextStream&, TouchAction)` | [`EventRegion.cpp` L346-L364](https://github.com/WebKit/WebKit/blob/c55364d53f971f63a709976f168d932d558b8909/Source/WebCore/rendering/EventRegion.cpp#L346-L364) | `auto`, `none`, `manipulation`, `pan-x`, `pan-y` or `pinch-zoom` | | `operator<<(TextStream&, const Region&)` | [`Region.cpp` L656-L666](https://github.com/WebKit/WebKit/blob/c55364d53f971f63a709976f168d932d558b8909/Source/WebCore/platform/graphics/Region.cpp#L656-L666) | a newline, then one indented `(rect ...)` line per rectangle of `Region::rects()` | **Which revision.** The first symbol names a nested enum, `ActivityState::Flag`. That enum exists at `c55364d53f97`, `e12a212a531a` and `73a35b43be7a`, where the function is the same nine-name list. The pinned 11.x tree has made `ActivityState` an `enum class`, so its operator takes `OptionSet<ActivityState>`, mangles differently and has a tenth name; the inventory symbol cannot be that one. The `TouchAction` and `Region` operators are the same text in all four trees. **Values outside the enums.** WebKit tests each flag with `contains`, so bits above the ninth print nothing. For a `TouchAction` that is not one of the six values the `switch` falls through to `ASSERT_NOT_REACHED(); return ts;`, which in a release build returns the stream unchanged. The port does the same in both cases. **Region.** The operator writes the newline, raises the indent by one for the rectangle lines and restores it, as `TextStream::IndentScope` does, and prints each rectangle with the existing `IntRect` operator, so the `SVGStyleRect` flag applies to it. The rectangles come from the existing `Region::rects()` export. `FloatRoundedRect` is left a stub on purpose: its operator differs between the three older revisions and 11.x, and nothing in the symbol tells them apart. ### Tested Windows 11 IoT Enterprise LTSC 2024 (10.0.26100), WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`. - `core/libs/prx/libSceNKWebKit/tests/WebCoreDump.cpp` (`nkwebkit_webcoredump`): each of the nine flags alone, all nine, all 32 bits set, two pairs, an unknown bit alone and with a known one; the six touch actions and six values outside the enum; an empty region, a one-rectangle region (default, `SVGStyleRect`, and single-line mode, where no indent is written), an L-shaped union of two rectangles, and the same union on a stream already indented by two, with the indent checked afterwards. - Before: on `main` `e825fa1492` the three exports are the stubs removed here, which throw `NotImplemented`. - With the change on `main` `e825fa1492`: `ctest -R "^nkwebkit_"` passes 162 of 162. - `python tools/check_conventions.py --base origin/main` passes. - `python tools/pr_overlap.py --branch feat/nkwebkit-text-stream-activity-touch-region`: it fails closed on 32 open PRs that edit `Export.cpp` or the export headers. I fetched each head and searched the added and removed lines of its diff for the three symbols and the two new file names. None implements them. #23758 and the three PRs stacked on it (#23999, #24000, #24009) call the `Region` operator from a translated wrapper and define a test double for it; they leave the operator itself a stub. #24011 implements other `TextStream` operators (`Vector`, `ScrollableAreaParameters`, `VisiblePosition`, `VisibleSelection`) and removes the stub next to the `TouchAction` one, so the two branches touch neighbouring lines of `Export.cpp`, `InventoryExports.hpp`, `WebCoreDumpExports.hpp` and `tests/WebCoreDump.cpp`: whichever merges second needs a rebase, which I will do if it is this one. ### Checklist - [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) and the licence notice of code adapted from upstream (see AGENTS.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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-20 08:33:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T08:33:54Z.

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_webcoredump_tests built cleanly.
  • CTest (nkwebkit_webcoredump):
    1/1 Test #4782: nkwebkit_webcoredump .............   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/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/include/WebCoreDumpExports.hpp, core/libs/prx/libSceNKWebKit/src/Region.cpp, core/libs/prx/libSceNKWebKit/src/ActivityState.cpp, core/libs/prx/libSceNKWebKit/src/TouchAction.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified ActivityState stream operator against WebKit c55364d53f97 (ActivityState.cpp L33-L57): bit loop bounds, flag string formatting with comma separators, and std::uint32_t bitmask handling.
    • Verified TouchAction stream operator against WebKit c55364d53f97 (EventRegion.cpp L346-L364): matches all enum values (Auto, None, Manipulation, PanX, PanY, PinchZoom) and returns stream unaltered for invalid enum values as expected in release WebKit.
    • Verified Region stream operator against WebKit c55364d53f97 (Region.cpp L656-L666): RAII stream indentation management, newline placement, and delegating IntRect printing.
    • Verified AGENTS.md conventions: no comments in source code beyond upstream copyright notices, proper removal of stubs from LegacyExports.hpp/InventoryExports.hpp, and proper technical debt tracking in docs/dev/debt/changes/.
    • Verified 64-bit portability (std::size_t indexing, LP64/LLP64 safety) and C++20 type compatibility across all modified headers and translation units.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5989657673 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24161#pullrequestreview-5989657673). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-20T08:33:54Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `73ebad20fc`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `nkwebkit_webcoredump_tests` built cleanly. - **CTest** (`nkwebkit_webcoredump`): ``` 1/1 Test #4782: nkwebkit_webcoredump ............. 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/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/include/WebCoreDumpExports.hpp`, `core/libs/prx/libSceNKWebKit/src/Region.cpp`, `core/libs/prx/libSceNKWebKit/src/ActivityState.cpp`, `core/libs/prx/libSceNKWebKit/src/TouchAction.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified ActivityState stream operator against WebKit c55364d53f97 (ActivityState.cpp L33-L57): bit loop bounds, flag string formatting with comma separators, and std::uint32_t bitmask handling. - Verified TouchAction stream operator against WebKit c55364d53f97 (EventRegion.cpp L346-L364): matches all enum values (Auto, None, Manipulation, PanX, PanY, PinchZoom) and returns stream unaltered for invalid enum values as expected in release WebKit. - Verified Region stream operator against WebKit c55364d53f97 (Region.cpp L656-L666): RAII stream indentation management, newline placement, and delegating IntRect printing. - Verified AGENTS.md conventions: no comments in source code beyond upstream copyright notices, proper removal of stubs from LegacyExports.hpp/InventoryExports.hpp, and proper technical debt tracking in docs/dev/debt/changes/. - Verified 64-bit portability (std::size_t indexing, LP64/LLP64 safety) and C++20 type compatibility across all modified headers and translation units. Looks Good To Me
MarcZX10 commented 2026-11-20 08:39:28 +00:00 (Migrated from github.com)

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

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the inspected implementation and tests support merging.

What I ran

  • Reviewed head 73ebad20fce87c572aae95246d21cd6829e5d9f2; base is main. No merged-preview check or commands were run.
  • Read the prepared description, commit summary, manifest, complete diff, and every changed source/test file marked included. For the two excluded files, read only the relevant ranges of Export.cpp and LegacyExports.hpp; also inspected targeted declarations, the reader's file listing, and build configuration.
  • The author reports Windows 11 / GCC tests and convention checks in the description; these were not run during this review.

Results

Check Result Note
Diff and implementation review passed Three operators and their declarations inspected
Added test coverage passed Flags, enum values, region formatting and indentation covered
Build and tests in this review not run Author-reported results are not independently verified

Negative control

Not run; no local test execution was available in this review.

Findings

Blocking

None.

Non-blocking

None.

Sources

Behavior and edge cases are supported by the reviewed implementation and tests at the pinned head: ActivityState.cpp, TouchAction.cpp, Region.cpp, and WebCoreDump.cpp.

Not verified

  • Build, tests, and conventions were not run here; the reported Windows 11 / GCC results are author-supplied.
  • Full contents of Export.cpp and InventoryExports.hpp were excluded by size; only relevant regions were read. The other changed files listed as included in the manifest were read.
  • Console behavior and comparison against a console module were not verified; the change record explicitly says it was not compared.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5989723789 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24161#pullrequestreview-5989723789). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T08:39:28Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the inspected implementation and tests support merging. ## What I ran - Reviewed head `73ebad20fce87c572aae95246d21cd6829e5d9f2`; base is `main`. No merged-preview check or commands were run. - Read the prepared description, commit summary, manifest, complete diff, and every changed source/test file marked included. For the two excluded files, read only the relevant ranges of `Export.cpp` and `LegacyExports.hpp`; also inspected targeted declarations, the reader's file listing, and build configuration. - The author reports Windows 11 / GCC tests and convention checks in the description; these were not run during this review. ## Results | Check | Result | Note | |---|---|---| | Diff and implementation review | passed | Three operators and their declarations inspected | | Added test coverage | passed | Flags, enum values, region formatting and indentation covered | | Build and tests in this review | not run | Author-reported results are not independently verified | ## Negative control Not run; no local test execution was available in this review. ## Findings ### Blocking None. ### Non-blocking None. ## Sources Behavior and edge cases are supported by the reviewed implementation and tests at the pinned head: [ActivityState.cpp](https://github.com/boykopovar/AnyPS5/blob/73ebad20fce87c572aae95246d21cd6829e5d9f2/core/libs/prx/libSceNKWebKit/src/ActivityState.cpp), [TouchAction.cpp](https://github.com/boykopovar/AnyPS5/blob/73ebad20fce87c572aae95246d21cd6829e5d9f2/core/libs/prx/libSceNKWebKit/src/TouchAction.cpp), [Region.cpp](https://github.com/boykopovar/AnyPS5/blob/73ebad20fce87c572aae95246d21cd6829e5d9f2/core/libs/prx/libSceNKWebKit/src/Region.cpp), and [WebCoreDump.cpp](https://github.com/boykopovar/AnyPS5/blob/73ebad20fce87c572aae95246d21cd6829e5d9f2/core/libs/prx/libSceNKWebKit/tests/WebCoreDump.cpp). ## Not verified - Build, tests, and conventions were not run here; the reported Windows 11 / GCC results are author-supplied. - Full contents of `Export.cpp` and `InventoryExports.hpp` were excluded by size; only relevant regions were read. The other changed files listed as included in the manifest were read. - Console behavior and comparison against a console module were not verified; the change record explicitly says it was not compared. ## To get this to a good state Nothing is required.
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!24161
No description provided.