Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7b7675037164a3fd778ec0c2e2b9900527e5109e
https://github.com/WebKit/WebKit/commit/7b7675037164a3fd778ec0c2e2b9900527e5109e
Author: Wenson Hsieh <[email protected]>
Date: 2026-06-20 (Sat, 20 Jun 2026)
Changed paths:
M Source/WebKit/Scripts/webkit/messages.py
M Source/WebKit/Shared/FocusedElementInformation.h
M Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
M Source/WebKit/UIProcess/PageClient.h
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebPageProxy.messages.in
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Source/WebKit/UIProcess/mac/PageClientImplMac.h
M Source/WebKit/UIProcess/mac/PageClientImplMac.mm
M Source/WebKit/UIProcess/mac/WebViewImpl.h
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WritingTools.mm
Log Message:
-----------
[macOS] Suppress the writing tools affordance for single-line text inputs
https://bugs.webkit.org/show_bug.cgi?id=317503
rdar://180072518
Reviewed by Richard Robinson and Megan Gardner.
Implement `-[NSTextInputClient allowsWritingToolsAffordance]`, and return `NO`
in the case where
a single-line text input (e.g. a text field) is focused, as opposed to a
multi-line text input (such
as a `textarea` or `contenteditable` container).
See below for more details.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WritingTools.mm
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
* Source/WebKit/Shared/FocusedElementInformation.h:
(WebKit::isSingleLineInputType):
Pull this out into a shared helper function.
* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView allowsWritingToolsAffordance]):
Implement the new delegate method.
* Source/WebKit/UIProcess/PageClient.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setFocusedElementInputType):
(WebKit::WebPageProxy::setEditableElementIsFocused): Deleted.
Refactor how `setEditableElementIsFocused` works — instead of caching a single
flag that determines
whether or not an editable form is focused, we instead plumb an `InputType`
enum flag that
represents what kind of form is focused.
This allows us to check whether or not the focused element is a single-line
input in the UI process,
and return `YES` or `NO` from `-allowsWritingToolsAffordance` based on that
result.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _updateTextInputTraits:]):
* Source/WebKit/UIProcess/mac/PageClientImplMac.h:
* Source/WebKit/UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::setFocusedElementInputType):
(WebKit::PageClientImpl::setEditableElementIsFocused): Deleted.
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::shouldAllowWritingToolsAffordance const):
(WebKit::WebViewImpl::updateTouchBar):
(WebKit::WebViewImpl::setFocusedElementInputType):
(WebKit::WebViewImpl::editableElementIsFocused const):
(WebKit::WebViewImpl::setEditableElementIsFocused): Deleted.
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::resetFocusedElementForFrame):
(WebKit::WebPage::inputTypeForElement):
Pull this common helper method out of iOS-specific code and into `WebPage`, so
that we can use it on
macOS as well.
(WebKit::WebPage::elementDidFocus):
(WebKit::WebPage::elementDidBlur):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::focusedElementInformation):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WritingTools.mm:
(TEST(WritingTools, ShouldAllowAffordance)):
Canonical link: https://commits.webkit.org/315560@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications