Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 92c99b29d3a64dd7c5243c5b104c66a7141c103e
https://github.com/WebKit/WebKit/commit/92c99b29d3a64dd7c5243c5b104c66a7141c103e
Author: Wenson Hsieh <[email protected]>
Date: 2026-10-14 (Wed, 14 Oct 2026)
Changed paths:
M Source/WebCore/PAL/pal/spi/cocoa/WritingToolsUISPI.h
M Source/WebKit/UIProcess/mac/WebViewImpl.h
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/EditorStateTests.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WritingTools.mm
Log Message:
-----------
[Writing Tools] macOS 27: Setting writingToolsBehavior to .none no longer
suppresses the Siri affordance
https://bugs.webkit.org/show_bug.cgi?id=327446
rdar://189876711
Reviewed by Abrar Rahman Protyasha and Aditya Keerthi.
These API tests (`WritingTools.{APIWithBehaviorDefault|APIWithBehaviorNone}`)
that are now failing
since macOS 27 exposed a bug, wherein setting the configuration's
`writingToolsBehavior` to `.none`
is no longer sufficient to suppress the new Siri Writing Tools affordance. This
is because the code
to update the selection context is (currently) only gated by a preference whose
default value is set
by a system feature flag (`textInputClientSelectionUpdatesEnabled`), instead of
accounting for the
`writingToolsBehavior` flag set by the WebKit client.
To fix this:
- Replace the `textInputClientSelectionUpdatesEnabled` check with a check for a
new helper method,
`shouldSendSelectionUpdatesForWritingToolsAffordance`.
- This new helper method additionally consults `writingToolsBehavior` and
`isEnhancedSiriAvailable`.
- Rebaseline `APIWithBehaviorDefault`, such that it expects the behavior of
WebKit to follow the
system behavior (based on the result of `isEnhancedSiriAvailable`).
Tests: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/EditorStateTests.mm
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WritingTools.mm
* Source/WebCore/PAL/pal/spi/cocoa/WritingToolsUISPI.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::selectionDidChange):
(WebKit::WebViewImpl::shouldAllowWritingToolsAffordance const):
(WebKit::WebViewImpl::shouldSendSelectionUpdatesToInputContext const):
(WebKit::WebViewImpl::inputContextForSelectionUpdates):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/EditorStateTests.mm:
(TestWebKitAPI::TEST(EditorStateTests,
UnionRectInVisibleSelectedRangeAndDocumentVisibleRect)):
(TestWebKitAPI::TEST(EditorStateTests,
UnionRectInVisibleSelectedRangeForEditableCaretSelection)):
(TestWebKitAPI::TEST(EditorStateTests,
UnionRectInVisibleSelectedRangeForNonEditableRangeSelection)):
(TestWebKitAPI::TEST(EditorStateTests,
NotifyTextInputClientAfterMagnificationChange)):
(TestWebKitAPI::TEST(EditorStateTests,
DismissSiriAffordanceWhenSelectionScrollsAwayFromCursor)):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WritingTools.mm:
(-[WritingToolsWKWebView
initWithHTMLString:writingToolsBehavior:attachmentElementEnabled:]):
(-[WritingToolsWKWebView initWithHTMLString:configuration:]):
(configurationForWritingToolsBehaviorTest):
(TEST(WritingTools, APIWithBehaviorNone)):
(TEST(WritingTools, APIWithBehaviorDefault)):
(TEST(WritingTools, APIWithBehaviorComplete)):
(testWritingToolsBehaviorWithEnhancedSiri):
(TEST(WritingTools, APIWithBehaviorNoneAndEnhancedSiri)):
(TEST(WritingTools, APIWithBehaviorDefaultAndEnhancedSiri)):
(TEST(WritingTools, APIWithBehaviorCompleteAndEnhancedSiri)):
(TEST(WritingTools, ShouldAllowAffordance)):
Canonical link: https://commits.webkit.org/323726@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications