feat(libSceNKWebKit): implement the TextStream operators for absolute and fixed position constraints #24165

Merged
ToRaNek merged 2 commits from upstream-pr/24165 into main 2026-11-21 11:56:49 +00:00
ToRaNek commented 2026-11-20 08:44:59 +00:00 (Migrated from github.com)

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


What

Two more WebCore::operator<<(TextStream&, ...) exports were stubs that threw: the ones for AbsolutePositionConstraints and FixedPositionViewportConstraints. They now print what WebKit prints (ScrollingConstraints.cpp L113-L126):

TextStream& operator<<(TextStream& ts, const AbsolutePositionConstraints& constraints)
{
    ts.dumpProperty("layer-position-at-last-layout", constraints.layerPositionAtLastLayout());

    return ts;
}

TextStream& operator<<(TextStream& ts, const FixedPositionViewportConstraints& constraints)
{
    ts.dumpProperty("viewport-rect-at-last-layout", constraints.viewportRectAtLastLayout());
    ts.dumpProperty("layer-position-at-last-layout", constraints.layerPositionAtLastLayout());

    return ts;
}

dumpProperty is startGroup(), the name, a space, the value, endGroup(); the port calls the existing startGroup, endGroup, FloatPoint and FloatRect exports, so the multi-line mode, the indent and the SVGStyleRect flag behave as they already do.

Which revision. The two functions, the two classes, dumpProperty and the FloatPoint and FloatRect operators are the same text at c55364d53f97, e12a212a531a, 73a35b43be7a and in the pinned 11.x tree, so the output does not depend on which one the console follows.

Layout. AbsolutePositionConstraints is a FloatSize then a FloatPoint, 16 bytes. FixedPositionViewportConstraints derives from the polymorphic ViewportConstraints (FloatSize, unsigned), whose data ends at byte 20; under the Itanium ABI the derived members start there, so the viewport rectangle is at offset 20, the layer position at 36 and the object is 48 bytes. I checked those numbers with offsetof on a copy of the class declarations compiled with GCC, and the header asserts them.

Object Output (multi-line mode)
absolute, layer position (1, 2.5) \n(layer-position-at-last-layout (1,2.50))
fixed, viewport (1, 2.5, 3, 4), layer position (-1.5, 2) \n(viewport-rect-at-last-layout (1,2.50) width=3 height=4)\n(layer-position-at-last-layout (-1.50,2))

The StickyPositionViewportConstraints operator is left a stub on purpose: its text differs between the three older revisions and 11.x.

This is stacked on #24161, which adds the neighbouring operators to the same header and test file; the first commit of this branch is that PR.

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): both objects in multi-line mode, in single-line mode and, for the fixed one, with SVGStyleRect and on a stream already indented by two, with the indent checked afterwards. The alignment offset and anchor edges are set to values that must not appear.
  • Before: on main e825fa1492 the two exports are the stubs removed here, which throw NotImplemented.
  • With #24161 and this 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-position-constraints: it fails closed on 32 open PRs that edit Export.cpp or the export headers. I fetched the head of each reported PR and searched the added and removed lines of its diff for the two symbols: none implements them. #22454 implements two other members of these classes (layerPositionForViewportRect, layerPositionForConstrainingRect) in a new src/ScrollingConstraints.cpp and declares the same 48-byte layout, with the same four offsets, in its own header and namespace. To stay clear of it this PR names its file src/ScrollingConstraintsDump.cpp and keeps its record types in WebCoreDumpExports.hpp, so the two merge in either order. #24011 touches neighbouring lines of the same header and test file, as noted on #24161.

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: #24161
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5410428058 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24165). Originally posted by [ToRaNek](https://github.com/ToRaNek) on 2026-11-20T08:44:59Z. --- ### What Two more `WebCore::operator<<(TextStream&, ...)` exports were stubs that threw: the ones for `AbsolutePositionConstraints` and `FixedPositionViewportConstraints`. They now print what WebKit prints ([`ScrollingConstraints.cpp` L113-L126](https://github.com/WebKit/WebKit/blob/c55364d53f971f63a709976f168d932d558b8909/Source/WebCore/page/scrolling/ScrollingConstraints.cpp#L113-L126)): ```cpp TextStream& operator<<(TextStream& ts, const AbsolutePositionConstraints& constraints) { ts.dumpProperty("layer-position-at-last-layout", constraints.layerPositionAtLastLayout()); return ts; } TextStream& operator<<(TextStream& ts, const FixedPositionViewportConstraints& constraints) { ts.dumpProperty("viewport-rect-at-last-layout", constraints.viewportRectAtLastLayout()); ts.dumpProperty("layer-position-at-last-layout", constraints.layerPositionAtLastLayout()); return ts; } ``` `dumpProperty` is `startGroup()`, the name, a space, the value, `endGroup()`; the port calls the existing `startGroup`, `endGroup`, `FloatPoint` and `FloatRect` exports, so the multi-line mode, the indent and the `SVGStyleRect` flag behave as they already do. **Which revision.** The two functions, the two classes, `dumpProperty` and the `FloatPoint` and `FloatRect` operators are the same text at `c55364d53f97`, `e12a212a531a`, `73a35b43be7a` and in the pinned 11.x tree, so the output does not depend on which one the console follows. **Layout.** `AbsolutePositionConstraints` is a `FloatSize` then a `FloatPoint`, 16 bytes. `FixedPositionViewportConstraints` derives from the polymorphic `ViewportConstraints` (`FloatSize`, `unsigned`), whose data ends at byte 20; under the Itanium ABI the derived members start there, so the viewport rectangle is at offset 20, the layer position at 36 and the object is 48 bytes. I checked those numbers with `offsetof` on a copy of the class declarations compiled with GCC, and the header asserts them. | Object | Output (multi-line mode) | |---|---| | absolute, layer position (1, 2.5) | `\n(layer-position-at-last-layout (1,2.50))` | | fixed, viewport (1, 2.5, 3, 4), layer position (-1.5, 2) | `\n(viewport-rect-at-last-layout (1,2.50) width=3 height=4)\n(layer-position-at-last-layout (-1.50,2))` | The `StickyPositionViewportConstraints` operator is left a stub on purpose: its text differs between the three older revisions and 11.x. This is stacked on #24161, which adds the neighbouring operators to the same header and test file; the first commit of this branch is that PR. ### 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`): both objects in multi-line mode, in single-line mode and, for the fixed one, with `SVGStyleRect` and on a stream already indented by two, with the indent checked afterwards. The alignment offset and anchor edges are set to values that must not appear. - Before: on `main` `e825fa1492` the two exports are the stubs removed here, which throw `NotImplemented`. - With #24161 and this 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-position-constraints`: it fails closed on 32 open PRs that edit `Export.cpp` or the export headers. I fetched the head of each reported PR and searched the added and removed lines of its diff for the two symbols: none implements them. #22454 implements two other members of these classes (`layerPositionForViewportRect`, `layerPositionForConstrainingRect`) in a new `src/ScrollingConstraints.cpp` and declares the same 48-byte layout, with the same four offsets, in its own header and namespace. To stay clear of it this PR names its file `src/ScrollingConstraintsDump.cpp` and keeps its record types in `WebCoreDumpExports.hpp`, so the two merge in either order. #24011 touches neighbouring lines of the same header and test file, as noted on #24161. ### 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: #24161 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-20 08:46:38 +00:00 (Migrated from github.com)

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

Review: APPROVED


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

  • 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/ScrollingConstraintsDump.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 libSceNKWebKit/src/ScrollingConstraintsDump.cpp against upstream WebKit Source/WebCore/page/scrolling/ScrollingConstraints.cpp (L113-L126): layerPositionAtLastLayout and viewportRectAtLastLayout are emitted accurately with proper group start/end semantics and spacing.
    • Verified struct layout and alignment static assertions for AbsolutePositionConstraints (16 bytes, offset 8) and FixedPositionViewportConstraints (48 bytes, offset 20 for viewport rect, offset 36 for layer position) in WebCoreDumpExports.hpp under the 64-bit Itanium ABI.
    • Checked ActivityState and TouchAction implementations in ActivityState.cpp and TouchAction.cpp for bitwise handling, string matching, and stream return values.
    • Verified Region.cpp text stream dumping implementation for correct IndentScope RAII usage, proper indentation handling, and vector traversal.
    • Inspected technical debt fragment files docs/dev/debt/changes/feat-nkwebkit-text-stream-activity-touch-region.md and docs/dev/debt/changes/feat-nkwebkit-text-stream-position-constraints.md against AGENTS.md conventions.
    • Confirmed WebCoreDump.cpp unit tests thoroughly cover default, SVGStyleRect, single-line, nested indentation, and chaining behaviors without state leaks or crashes.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5989806791 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24165#pullrequestreview-5989806791). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-20T08:46:38Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `463cbd574d`: - **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/ScrollingConstraintsDump.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 libSceNKWebKit/src/ScrollingConstraintsDump.cpp against upstream WebKit Source/WebCore/page/scrolling/ScrollingConstraints.cpp (L113-L126): layerPositionAtLastLayout and viewportRectAtLastLayout are emitted accurately with proper group start/end semantics and spacing. - Verified struct layout and alignment static assertions for AbsolutePositionConstraints (16 bytes, offset 8) and FixedPositionViewportConstraints (48 bytes, offset 20 for viewport rect, offset 36 for layer position) in WebCoreDumpExports.hpp under the 64-bit Itanium ABI. - Checked ActivityState and TouchAction implementations in ActivityState.cpp and TouchAction.cpp for bitwise handling, string matching, and stream return values. - Verified Region.cpp text stream dumping implementation for correct IndentScope RAII usage, proper indentation handling, and vector traversal. - Inspected technical debt fragment files docs/dev/debt/changes/feat-nkwebkit-text-stream-activity-touch-region.md and docs/dev/debt/changes/feat-nkwebkit-text-stream-position-constraints.md against AGENTS.md conventions. - Confirmed WebCoreDump.cpp unit tests thoroughly cover default, SVGStyleRect, single-line, nested indentation, and chaining behaviors without state leaks or crashes. Looks Good To Me
MarcZX10 commented 2026-11-20 09:07:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T09:07:23Z.

Review: COMMENTED


Reviewed — no blocking findings

The inspected implementation follows the described WebKit output behavior; the review is incomplete because two changed files were not read in full and no checks were run.

What I ran

Reviewed head 463cbd574d501dd1fef7c8e94d6a718bb9472d36 using the prepared diff and repository reader. No build or tests were run.

Results

Check Result Note
Diff and targeted source review passed Implementations and tests inspected
Build and tests not run Author reports test results

Findings

Blocking

None identified in the code inspected.

Non-blocking

None.

Sources

The implementation and test cases were reviewed at the pinned head using the prepared diff and reader.

Not verified

Export.cpp and InventoryExports.hpp were not read in full; LegacyExports.hpp and Region.cpp were read only around the changed areas. Other changed files were read in full: WebCoreDumpExports.hpp, ActivityState.cpp, ScrollingConstraintsDump.cpp, TouchAction.cpp, WebCoreDump.cpp, and both debt change notes. The full review bundle lists 11 changed files; only 6 were read in full. No build or tests were run, and console behavior was not confirmed. The description reports 162 passing tests and a successful conventions check; these were not run as part of this review.

To get this to a good state

Nothing is required. Optional: run the reported build, tests, and conventions check at this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5990092443 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24165#pullrequestreview-5990092443). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T09:07:23Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The inspected implementation follows the described WebKit output behavior; the review is incomplete because two changed files were not read in full and no checks were run. ## What I ran Reviewed head `463cbd574d501dd1fef7c8e94d6a718bb9472d36` using the prepared diff and repository reader. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Implementations and tests inspected | | Build and tests | not run | Author reports test results | ## Findings ### Blocking None identified in the code inspected. ### Non-blocking None. ## Sources The implementation and test cases were reviewed at the pinned head using the prepared diff and reader. ## Not verified `Export.cpp` and `InventoryExports.hpp` were not read in full; `LegacyExports.hpp` and `Region.cpp` were read only around the changed areas. Other changed files were read in full: `WebCoreDumpExports.hpp`, `ActivityState.cpp`, `ScrollingConstraintsDump.cpp`, `TouchAction.cpp`, `WebCoreDump.cpp`, and both debt change notes. The full review bundle lists 11 changed files; only 6 were read in full. No build or tests were run, and console behavior was not confirmed. The description reports 162 passing tests and a successful conventions check; these were not run as part of this review. ## To get this to a good state Nothing is required. Optional: run the reported build, tests, and conventions check at this head.
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!24165
No description provided.