Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3d10598b567ea12426cb75f2a27af7296aaa1b84
      
https://github.com/WebKit/WebKit/commit/3d10598b567ea12426cb75f2a27af7296aaa1b84
  Author: Wenson Hsieh <[email protected]>
  Date:   2026-02-11 (Wed, 11 Feb 2026)

  Changed paths:
    M Source/WebKit/UIProcess/mac/WebViewImpl.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/EditorStateTests.mm

  Log Message:
  -----------
  [macOS] Call -[NSTextInputContext textInputClientDidUpdateSelection] when the 
non-editable ranged selection changes
https://bugs.webkit.org/show_bug.cgi?id=307603
rdar://169743663

Reviewed by Abrar Rahman Protyasha.

When the selection changes, notify AppKit by way of 
`-textInputClientDidUpdateSelection`, even if
the selection is non-editable (as long as it's ranged). See below for more 
details.

Test:   
EditorStateTests.UnionRectInVisibleSelectedRangeForNonEditableRangeSelection
        
EditorStateTests.UnionRectInVisibleSelectedRangeForEditableCaretSelection

* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::selectionDidChange):
(WebKit::WebViewImpl::unionRectInVisibleSelectedRangeInScreen const):

Drive-by fix: also include caret rects in the selection union rect (with a zero 
width).

(WebKit::WebViewImpl::inputContext):
(WebKit::WebViewImpl::inputContextIncludingNonEditable):

Split `inputContext` out into `inputContextIncludingNonEditable`, which (when 
the feature flag is
enabled) returns a non-null context as long as the selection is visible. This 
means either:
- Caret selection in an editable context, or
- Ranged selection, in either non-editable or editable contexts.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/EditorStateTests.mm:
(TestWebKitAPI::configurationWithTextInputClientSelectionUpdatesEnabled):
(TestWebKitAPI::TEST(EditorStateTests, 
UnionRectInVisibleSelectedRangeAndDocumentVisibleRect)):
(TestWebKitAPI::TEST(EditorStateTests, 
UnionRectInVisibleSelectedRangeForEditableCaretSelection)):
(TestWebKitAPI::TEST(EditorStateTests, 
UnionRectInVisibleSelectedRangeForNonEditableRangeSelection)):

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



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

Reply via email to