Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 978866cd7f3eb16702e07454d6c74005f9062f2a
      
https://github.com/WebKit/WebKit/commit/978866cd7f3eb16702e07454d6c74005f9062f2a
  Author: Simon Pena <[email protected]>
  Date:   2026-09-28 (Mon, 28 Sep 2026)

  Changed paths:
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/glib/TestInputMethodContext.cpp

  Log Message:
  -----------
  [GTK][WPE] TestInputMethodContext cannot observe the cursor area, 
notification counts or the preedit caret offset
https://bugs.webkit.org/show_bug.cgi?id=324703

Reviewed by Adrian Perez de Castro.

The mock WebKitInputMethodContext that the input method API tests share cannot 
observe several
things an input method depends on, so:

- Implement notify_cursor_area in the mock and record the rectangle and a call 
count.
- Add a settable preedit caret offset, defaulting to the end of the preedit so 
the existing
  tests are unaffected.
- Count focus-in, focus-out, cursor area and surrounding notifications, and 
content type
  notifications.
- Add waitForCursorAreaCount(), which waits for a given number of cursor area 
notifications,
  in the same shape as the existing waitForSurroundingText().
- Add editableSelectionStart(), which reads the selection start of the editable 
element.
- Split waitUntilInputMethodEnabled() and waitUntilInputMethodDisabled() out of
  focusEditableAndWaitUntilInputMethodEnabled() and
  unfocusEditableAndWaitUntilInputMethodDisabled(), so a test can focus an 
element by clicking
  it, or blur an element other than the one those two hardcode. No behaviour 
change.

Four tests come with it:

- cursor-area covers the cursor area notifications,
- preedit-cursor covers a caret reported inside the preedit, asserting that the 
composition
  starts where the input method said its caret was,
- focus-change covers moving focus between two fields with equal state,
- and focus-interaction covers the difference between focusing by click and by
  element.focus().

The last of these documents why the content-type test expects 
WEBKIT_INPUT_HINT_INHIBIT_OSK on
every field, including a plain input element.

* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/glib/TestInputMethodContext.cpp:
(webkitInputMethodContextMockGetPreedit):
(webkitInputMethodContextMockNotifyFocusIn):
(webkitInputMethodContextMockNotifyFocusOut):
(webkitInputMethodContextMockNotifyCursorArea):
(webkitInputMethodContextMockNotifySurrounding):
(webkit_input_method_context_mock_class_init):
(webkit_input_method_context_mock_init):
(testWebKitInputMethodContextCursorArea):
(testWebKitInputMethodContextPreeditCursor):
(testWebKitInputMethodContextFocusChange):
(testWebKitInputMethodContextFocusInteraction):
(beforeAll):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to