Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7547947782451bc6f8978b4d865fb3b447abb629
https://github.com/WebKit/WebKit/commit/7547947782451bc6f8978b4d865fb3b447abb629
Author: Wenson Hsieh <[email protected]>
Date: 2026-01-26 (Mon, 26 Jan 2026)
Changed paths:
M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
M Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm
M Source/WebKit/Shared/WebPreferencesDefaultValues.h
M Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
M Source/WebKit/UIProcess/mac/WebViewImpl.h
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/EditorStateTests.mm
Log Message:
-----------
[macOS] Adopt several `NSTextInputClient` and `NSTextInputContext` APIs
https://bugs.webkit.org/show_bug.cgi?id=306230
rdar://165725855
Reviewed by Abrar Rahman Protyasha.
Add support for several `NSTextInputClient` methods, as well as calls to the
text input context
when the selection changes (or when scrolling starts or stops). See below for
more details.
Test: EditorStateTests.UnionRectInVisibleSelectedRangeAndDocumentVisibleRect
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
(WebKit::defaultTextInputClientSelectionUpdatesEnabled):
* Source/WebKit/Shared/WebPreferencesDefaultValues.h:
Add a new flag to guard the call to `-textInputClientDidUpdateSelection` below.
* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView unionRectInVisibleSelectedRange]):
(-[WKWebView documentVisibleRect]):
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
Replace `m_pageIsScrolledToTop` with an `IntPoint m_lastPageScrollPosition`,
and add a new getter
for `pageIsScrolledToTop()` based on the `m_lastPageScrollPosition`.
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::WebViewImpl):
(WebKit::m_flagsChangedEventMonitorTrackingArea):
(WebKit::WebViewImpl::pageDidScroll):
(WebKit::WebViewImpl::updateScrollPocketVisibilityWhenScrolledToTop):
(WebKit::WebViewImpl::hasScrolledContentsUnderTitlebar):
(WebKit::WebViewImpl::selectionDidChange):
Add a call to `-[NSTextInputContext textInputClientDidUpdateSelection]` when
the selection changes.
Put this behind a runtime setting, to keep existing caret decoration UI updates
working (see
rdar://165160994 for more details).
(WebKit::WebViewImpl::unionRectInVisibleSelectedRange const):
Implement `-[NSTextInputClient unionRectInVisibleSelectedRange]` in terms of
`WebPageProxy::selectionBoundingRectInRootViewCoordinates()`.
(WebKit::WebViewImpl::documentVisibleRect const):
Implement `-[NSTextInputClient documentVisibleRect]`.
(WebKit::WebViewImpl::pageScrollingHysteresisFired):
Add calls to `-[NSTextInputContext textInputClientWillStartScrollingOrZooming]`
and
`-[NSTextInputContext textInputClientDidEndScrollingOrZooming]` by adding a 500
ms hysteresis
activity, triggered when the page scrolls.
(WebKit::WebViewImpl::updatePrefersSolidColorHardPocket):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/EditorStateTests.mm:
(TestWebKitAPI::TEST(EditorStateTests,
UnionRectInVisibleSelectedRangeAndDocumentVisibleRect)):
Canonical link: https://commits.webkit.org/306235@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications