Skip to content

[macOS] Expose a KVO property for the top scroll pocket on WKWebView #47256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2025

Conversation

whsieh
Copy link
Member

@whsieh whsieh commented Jun 26, 2025

9ae715d

[macOS] Expose a KVO property for the top scroll pocket on WKWebView
https://bugs.webkit.org/show_bug.cgi?id=295051
rdar://154419636

Reviewed by Abrar Rahman Protyasha.

Add support for a new property, `-[WKWebView _topScrollPocket]`; additionally, add KVO support, so
clients can observe when the top scroll pocket is torn down or recreated.

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView _topScrollPocket]):
* Source/WebKit/UIProcess/API/mac/WKWebViewPrivateForTestingMac.h:
* Source/WebKit/UIProcess/API/mac/WKWebViewTestingMac.mm:
(-[WKWebView _scrollPocketForTesting]): Deleted.
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::updateScrollPocket):

Call `-{will|did}ChangeValueForKey:` when setting `m_topScrollPocket`.

* Tools/TestWebKitAPI/Tests/TestWebKitAPI/mac/AppKitSPI.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm:
(-[TopScrollPocketObserver initWithWebView:]):
(-[TopScrollPocketObserver dealloc]):
(-[TopScrollPocketObserver observeValueForKeyPath:ofObject:change:context:]):
(-[TopScrollPocketObserver changeCount]):
(TestWebKitAPI::TEST(ObscuredContentInsets, ResizeScrollPocket)):
(TestWebKitAPI::TEST(ObscuredContentInsets, ScrollPocketCaptureColor)):

Replace the now-unnecessary `-_scrollPocketForTesting` testing helper with `-_topScrollPocket`.

(TestWebKitAPI::TEST(ObscuredContentInsets, TopScrollPocketKVO)):

Add a test for KVO on the new property.

Canonical link: https://commits.webkit.org/296686@main

fdd1026

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
❌ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug 🧪 wpe-wk2 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision 🧪 mac-AS-debug-wk2 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ❌ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 🛠 playstation
✅ 🛠 tv 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@whsieh whsieh requested a review from cdumez as a code owner June 26, 2025 19:26
@whsieh whsieh self-assigned this Jun 26, 2025
@whsieh whsieh added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Jun 26, 2025
@whsieh whsieh added the merge-queue Applied to send a pull request to merge-queue label Jun 26, 2025
https://bugs.webkit.org/show_bug.cgi?id=295051
rdar://154419636

Reviewed by Abrar Rahman Protyasha.

Add support for a new property, `-[WKWebView _topScrollPocket]`; additionally, add KVO support, so
clients can observe when the top scroll pocket is torn down or recreated.

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView _topScrollPocket]):
* Source/WebKit/UIProcess/API/mac/WKWebViewPrivateForTestingMac.h:
* Source/WebKit/UIProcess/API/mac/WKWebViewTestingMac.mm:
(-[WKWebView _scrollPocketForTesting]): Deleted.
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::updateScrollPocket):

Call `-{will|did}ChangeValueForKey:` when setting `m_topScrollPocket`.

* Tools/TestWebKitAPI/Tests/TestWebKitAPI/mac/AppKitSPI.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm:
(-[TopScrollPocketObserver initWithWebView:]):
(-[TopScrollPocketObserver dealloc]):
(-[TopScrollPocketObserver observeValueForKeyPath:ofObject:change:context:]):
(-[TopScrollPocketObserver changeCount]):
(TestWebKitAPI::TEST(ObscuredContentInsets, ResizeScrollPocket)):
(TestWebKitAPI::TEST(ObscuredContentInsets, ScrollPocketCaptureColor)):

Replace the now-unnecessary `-_scrollPocketForTesting` testing helper with `-_topScrollPocket`.

(TestWebKitAPI::TEST(ObscuredContentInsets, TopScrollPocketKVO)):

Add a test for KVO on the new property.

Canonical link: https://commits.webkit.org/296686@main
@webkit-commit-queue
Copy link
Collaborator

Committed 296686@main (9ae715d): https://commits.webkit.org/296686@main

Reviewed commits have been landed. Closing PR #47256 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 9ae715d into WebKit:main Jun 26, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 26, 2025
@whsieh whsieh deleted the eng/295051 branch June 26, 2025 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Bugs Unclassified bugs are placed in this component until the correct component can be determined.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants