[webkit-changes] [WebKit/WebKit] b50554: [Unified Text Replacement] Distinguish plain text ...

Aditya Keerthi noreply at github.com
Thu Mar 21 13:49:07 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b50554e8a29dcccba3b8ebd232d3bbf8ace3599a
      https://github.com/WebKit/WebKit/commit/b50554e8a29dcccba3b8ebd232d3bbf8ace3599a
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2024-03-21 (Thu, 21 Mar 2024)

  Changed paths:
    M Source/WebCore/dom/SimpleRange.h
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Shared/UnifiedTextReplacement.serialization.in
    M Source/WebKit/Shared/WebUnifiedTextReplacementContextData.h
    M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/UnifiedTextReplacementController.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
    M Source/WebKit/WebProcess/WebPage/UnifiedTextReplacementController.h
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in

  Log Message:
  -----------
  [Unified Text Replacement] Distinguish plain text and rich text replacements
https://bugs.webkit.org/show_bug.cgi?id=271351
rdar://123530706

Reviewed by Wenson Hsieh.

Edit actions should have a different effect depending on whether a plain or rich
text replacement is occuring.

* Source/WebCore/dom/SimpleRange.h:
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
* Source/WebKit/Shared/UnifiedTextReplacement.serialization.in:
* Source/WebKit/Shared/WebUnifiedTextReplacementContextData.h:
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::willBeginTextReplacementSession):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::willBeginTextReplacementSession):
* Source/WebKit/WebProcess/WebPage/Cocoa/UnifiedTextReplacementController.mm:
(WebKit::replaceTextInRange):

Refactor to use `Document` rather than `Frame` so that common code can be shared,
and indirection is reduced.

(WebKit::replaceContentsInRange):

Ditto (WebKit::replaceTextInRange).

(WebKit::UnifiedTextReplacementController::willBeginTextReplacementSession):

Store the replacement type for retrieval when an edit action is performed.

(WebKit::UnifiedTextReplacementController::textReplacementSessionDidReceiveReplacements):
(WebKit::UnifiedTextReplacementController::textReplacementSessionDidUpdateStateForReplacement):

Committed and reverted state changes are now permanent. Do not restore the marker
after it is removed.

(WebKit::UnifiedTextReplacementController::didEndTextReplacementSession):
(WebKit::UnifiedTextReplacementController::textReplacementSessionDidReceiveTextWithReplacementRange):
(WebKit::UnifiedTextReplacementController::textReplacementSessionDidReceiveEditAction):
(WebKit::UnifiedTextReplacementController::textReplacementSessionPerformEditActionForPlainText):

Add a new path for plain text edit actions. Replacements are performed in reverse
order to avoid recomputing ranges.

(WebKit::UnifiedTextReplacementController::textReplacementSessionPerformEditActionForRichText):

Preserve existing rich text behavior.

* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::willBeginTextReplacementSession):
* Source/WebKit/WebProcess/WebPage/UnifiedTextReplacementController.h:

Add a map of UUIDs to replacement types, to ensure the right method is used when
an edit action is received.

* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:

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



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


More information about the webkit-changes mailing list