Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 26c2acfbf6717bd9fb7d62a572cccdb8b012a092
https://github.com/WebKit/WebKit/commit/26c2acfbf6717bd9fb7d62a572cccdb8b012a092
Author: Fujii Hironori <[email protected]>
Date: 2026-10-15 (Thu, 15 Oct 2026)
Changed paths:
M Source/WebCore/html/HTMLInputElement.cpp
M Source/WebCore/page/ChromeClient.h
M Source/WebKit/Shared/glib/InputMethodState.h
M Source/WebKit/Shared/glib/InputMethodState.serialization.in
M Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp
M Source/WebKit/UIProcess/API/glib/WebKitInputMethodContext.h.in
M Source/WebKit/UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp
M Source/WebKit/UIProcess/API/wpe/WebKitInputMethodContextImplWPE.cpp
M Source/WebKit/WPEPlatform/wpe/wayland/WPEInputMethodContextWaylandV1.cpp
M Source/WebKit/WPEPlatform/wpe/wayland/WPEInputMethodContextWaylandV3.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp
M Tools/MiniBrowser/glib/BrowserLoggingInputMethodContext.c
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/glib/TestInputMethodContext.cpp
Log Message:
-----------
[GTK][WPE] Update the input method state when the type of the focused input
changes, and add WEBKIT_INPUT_HINT_PRIVATE
https://bugs.webkit.org/show_bug.cgi?id=327490
Reviewed by Carlos Garcia Campos.
A common "show password" button toggles the type of the focused field between
password and text without moving the focus. The input method state was only
computed again when the focus, inputmode or readonly changed, so after the type
changed the input method kept the state of the old type. A field changed to
password kept a free-form purpose, so the input method could predict and learn
the password while the user typed it.
Notifying the type change alone would make a revealed password a free-form field
that the input method is free to learn, because the only signal GTK and WPE sent
for sensitive input was the password purpose. Add
InputMethodState::Hint::Private,
exposed as the new WEBKIT_INPUT_HINT_PRIVATE API and mapped to
GTK_INPUT_HINT_PRIVATE (GTK4 only, GTK3 has no such hint) and
WPE_INPUT_HINT_PRIVATE. Set it for an input that hasEverBeenPasswordField(),
like iOS which turns off learning for such a field.
The Wayland input method contexts of WPEPlatform only sent SENSITIVE_DATA for
the
password and PIN purposes, so map WPE_INPUT_HINT_PRIVATE to SENSITIVE_DATA of
text-input-v1 and text-input-v3 too. The Wayland input method of GTK 4 does not
send GTK_INPUT_HINT_PRIVATE to the compositor yet, so it only helps input method
modules that take the GTK hints into account, like the IBus one.
Add ChromeClient::focusedElementDidChangeType(), called by
HTMLInputElement::runPostTypeUpdateTasks() for the focused element in the same
way as focusedElementDidChangeReadOnly(), and set the input method state again
from it on GTK and WPE.
Also document when WEBKIT_INPUT_HINT_INHIBIT_OSK is set, since a type change
by a script outside of an input event handler sets it too.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/glib/TestInputMethodContext.cpp
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::runPostTypeUpdateTasks):
* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::focusedElementDidChangeType):
* Source/WebKit/Shared/glib/InputMethodState.h:
* Source/WebKit/Shared/glib/InputMethodState.serialization.in:
* Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp:
(WebKit::toWebKitHints):
* Source/WebKit/UIProcess/API/glib/WebKitInputMethodContext.h.in:
* Source/WebKit/UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp:
(toGtkInputHints):
* Source/WebKit/UIProcess/API/wpe/WebKitInputMethodContextImplWPE.cpp:
(toWPEInputHints):
* Source/WebKit/WPEPlatform/wpe/wayland/WPEInputMethodContextWaylandV1.cpp:
(toTextInputV1Hints):
* Source/WebKit/WPEPlatform/wpe/wayland/WPEInputMethodContextWaylandV3.cpp:
(toTextInputV3Hints):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::focusedElementDidChangeType):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp:
(WebKit::inputMethodStateForElement):
(WebKit::WebPage::focusedElementDidChangeType):
* Tools/MiniBrowser/glib/BrowserLoggingInputMethodContext.c:
(hintsDescription):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/glib/TestInputMethodContext.cpp:
(testWebKitInputMethodContextContentType):
(testWebKitInputMethodContextInputMode):
(testWebKitInputMethodContextTypeChange):
(beforeAll):
Canonical link: https://commits.webkit.org/323805@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications