feat(libSceNKWebKit): implement WKPage zoom factor controls #18117

Merged
heditrigui merged 1 commit from upstream-pr/18117 into main 2026-11-15 18:52:17 +00:00
heditrigui commented 2026-11-10 13:49:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by heditrigui on 2026-11-10T13:49:46Z.


What

Implement 6 WKPage page and text zoom factor accessors in libSceNKWebKit:

  • WKPageGetPageZoomFactor
  • WKPageGetTextZoomFactor
  • WKPageSetPageAndTextZoomFactors
  • WKPageSetPageZoomFactor
  • WKPageSetTextZoomFactor
  • WKPageSupportsTextZoom

Zoom factor state is modeled on NKWebKit::Page following WebKit C API semantics (defaults of 1.0 for zoom multipliers, true for text zoom support, and clamping to ignore non-positive factor updates), supporting state query, dynamic factor updates, and null-pointer validation.

Tested

Linux x86_64, unit tests in core/libs/prx/libSceNKWebKit/tests/PageZoom.cpp, validating default values (1.0), dynamic zoom modification, non-positive value clamping, and std::invalid_argument exceptions on null page references. Verified clean with python3 tools/check_conventions.py and compilation via C++20.

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:5242417331 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18117). Originally posted by [heditrigui](https://github.com/heditrigui) on 2026-11-10T13:49:46Z. --- ### What Implement 6 `WKPage` page and text zoom factor accessors in `libSceNKWebKit`: - `WKPageGetPageZoomFactor` - `WKPageGetTextZoomFactor` - `WKPageSetPageAndTextZoomFactors` - `WKPageSetPageZoomFactor` - `WKPageSetTextZoomFactor` - `WKPageSupportsTextZoom` Zoom factor state is modeled on `NKWebKit::Page` following WebKit C API semantics (defaults of `1.0` for zoom multipliers, `true` for text zoom support, and clamping to ignore non-positive factor updates), supporting state query, dynamic factor updates, and null-pointer validation. ### Tested Linux x86_64, unit tests in `core/libs/prx/libSceNKWebKit/tests/PageZoom.cpp`, validating default values (1.0), dynamic zoom modification, non-positive value clamping, and `std::invalid_argument` exceptions on null page references. Verified clean with `python3 tools/check_conventions.py` and compilation via C++20. ### 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) - [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-10 20:53:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-10T20:53:25Z.

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: libSceNKWebKit, nkwebkit_pagezoom_tests built cleanly.
  • CTest (nkwebkit_pagezoom):
    1/1 Test #3618: nkwebkit_pagezoom ................   Passed    0.02 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/Configuration.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified signatures and calling conventions: WKPageGetPageZoomFactor, WKPageGetTextZoomFactor, WKPageSetPageAndTextZoomFactors, WKPageSetPageZoomFactor, WKPageSetTextZoomFactor, and WKPageSupportsTextZoom use APS5_VABI, extern "C", and match WebKit C API types in WebKitValueExports.hpp and PageZoom.cpp.
    • Verified null pointer and type safety: All six exports route through NKWebKit::CastNKWebKit::Page(pageRef, func), throwing std::invalid_argument on nullptr or invalid handles as verified in tests/PageZoom.cpp.
    • Verified zoom factor clamping and state semantics: Default zoom factors (1.0), text zoom support (true), and non-positive factor rejection (<= 0.0 ignored in individual and combined setters) correctly mirror WebKit WebPageProxy behavior.
    • Verified AGENTS.md compliance: Zero comments in source and test code, technical debt accurately recorded in docs/dev/debt/libSceNKWebKit.md with the table count decremented from 6046 to 6040, and conventional commit format used.
    • Verified cross-platform portability and test coverage: Types (double, bool, const void*) are LP64/LLP64 invariant, and unit tests in tests/PageZoom.cpp exercise default initialization, dynamic mutation, edge-case rejection (0.0, negative), and null pointer exceptions.
  • Note: the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5849179527 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18117#pullrequestreview-5849179527). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-10T20:53:25Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `35aa59ef56`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `libSceNKWebKit`, `nkwebkit_pagezoom_tests` built cleanly. - **CTest** (`nkwebkit_pagezoom`): ``` 1/1 Test #3618: nkwebkit_pagezoom ................ Passed 0.02 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/Configuration.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified signatures and calling conventions: WKPageGetPageZoomFactor, WKPageGetTextZoomFactor, WKPageSetPageAndTextZoomFactors, WKPageSetPageZoomFactor, WKPageSetTextZoomFactor, and WKPageSupportsTextZoom use APS5_VABI, extern "C", and match WebKit C API types in WebKitValueExports.hpp and PageZoom.cpp. - Verified null pointer and type safety: All six exports route through NKWebKit::Cast<NKWebKit::Page>(pageRef, __func__), throwing std::invalid_argument on nullptr or invalid handles as verified in tests/PageZoom.cpp. - Verified zoom factor clamping and state semantics: Default zoom factors (1.0), text zoom support (true), and non-positive factor rejection (<= 0.0 ignored in individual and combined setters) correctly mirror WebKit WebPageProxy behavior. - Verified AGENTS.md compliance: Zero comments in source and test code, technical debt accurately recorded in docs/dev/debt/libSceNKWebKit.md with the table count decremented from 6046 to 6040, and conventional commit format used. - Verified cross-platform portability and test coverage: Types (double, bool, const void*) are LP64/LLP64 invariant, and unit tests in tests/PageZoom.cpp exercise default initialization, dynamic mutation, edge-case rejection (0.0, negative), and null pointer exceptions. - Note: the AI-assisted checkbox can stay. Looks Good To Me
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!18117
No description provided.