Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 72212a28c6b2c3b605bebb33a5c9e14196952586
      
https://github.com/WebKit/WebKit/commit/72212a28c6b2c3b605bebb33a5c9e14196952586
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2024-07-28 (Sun, 28 Jul 2024)

  Changed paths:
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Tools/TestWebKitAPI/Tests/mac/WKWebViewMacEditingTests.mm

  Log Message:
  -----------
  [macOS] Dictation UI no longer shows up when beginning dictation after 
focusing an empty text field
https://bugs.webkit.org/show_bug.cgi?id=277236
rdar://131534054

Reviewed by Richard Robinson.

After the changes in 279576@main, 
`-firstRectForCharacterRange:completionHandler:` returns an empty
rect in the case where the selection is a caret in a focused, empty `textarea` 
or text field. This
happens because the selected range is the first position inside of an empty 
block-level container
underneath the text form control's shadow root, which causes `endOfLine` to 
return the null position
and subsequently means `lineEndBoundary` is null, so we bail early.

Avoid this by falling back to the selection start in the case where `endOfLine` 
returns a null
position.

Test: WKWebViewMacEditingTests.FirstRectForCharacterRangeInTextArea

* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::firstRectForCharacterRangeAsync):

See above for more details.

* Tools/TestWebKitAPI/Tests/mac/WKWebViewMacEditingTests.mm:
(-[WKWebView _firstRectForCharacterRange:]):
(TEST(WKWebViewMacEditingTests, FirstRectForCharacterRange)):
(TEST(WKWebViewMacEditingTests, FirstRectForCharacterRangeInTextArea)):

Add a new API test to exercise the change; clean up some of these existing 
tests as well, by
factoring out some of the common logic to asynchronously request the first rect 
for a
character range into a new category helper method that returns a `std::pair`.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to