Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2dfc04d252010d994f92b92ca2feb3d9f1d2b980
      
https://github.com/WebKit/WebKit/commit/2dfc04d252010d994f92b92ca2feb3d9f1d2b980
  Author: Wenson Hsieh <[email protected]>
  Date:   2023-05-03 (Wed, 03 May 2023)

  Changed paths:
    M Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h
    M Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/mac/EditableLegacyWebView.mm

  Log Message:
  -----------
  REGRESSION (262691@main): [macOS] [WK1] Selection fails to repaint in Mail 
signature editor
https://bugs.webkit.org/show_bug.cgi?id=256255
rdar://108277205

Reviewed by Ryosuke Niwa.

After the changes in 262691@main, certain selection changes in editable web 
views (e.g. by clicking
or selecting all) no longer trigger repaints, causing the DOM selection to be 
correctly updated but
the selection highlight or caret UI (painted as a part of page rendering on 
macOS) to become stale.

This is because we now defer selection appearance updates until the next 
rendering update, but
nothing actually ends up triggering a rendering update in the WebKit1 codepath 
when modifying the
selection. In contrast, in WebKit2, the process of scheduling `EditorState` 
updates to the UI
process (among other call sites, depending on the cause of the selection 
change) ensures that
rendering updates are scheduled (since `EditorState` updates are rolled into 
remote layer tree
transactions).

To fix this, we adjust client code in WebKit1 to match that of WebKit2, and 
schedule rendering
updates in response to selection changes in the case where either the new or 
previous selection is
visible (i.e. collapsed caret selection in editable content, or a ranged 
selection).

Test: WebKitLegacy.SelectionAppearanceUpdatesInEditableWebView

* Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::respondToChangedSelection):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/mac/EditableLegacyWebView.mm: Added.
(-[EditableLegacyWebViewLoadDelegate webView:didFinishLoadForFrame:]):
(-[EditableLegacyWebViewLoadDelegate waitForLoadToFinish]):

Add an API test to exercise the change by verifying that we trigger repaint 
after invoking "Select
All" in a legacy macOS `WebView`.

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to