[webkit-changes] [WebKit/WebKit] ccdf27: Add a feature flag to allow or disallow writing RT...

Wenson Hsieh noreply at github.com
Fri Nov 24 15:18:25 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ccdf27571963f7cc3fd1e2559e94c4f74b0494bc
      https://github.com/WebKit/WebKit/commit/ccdf27571963f7cc3fd1e2559e94c4f74b0494bc
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-11-24 (Fri, 24 Nov 2023)

  Changed paths:
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/editing/Editor.h
    M Source/WebCore/editing/cocoa/EditorCocoa.mm

  Log Message:
  -----------
  Add a feature flag to allow or disallow writing RTF to the pasteboard when copying/dragging
https://bugs.webkit.org/show_bug.cgi?id=265323
rdar://118419812

Reviewed by Richard Robinson.

On some Cocoa OS versions, the pasteboard will (if necessary) automatically convert HTML and web
archive data written to the pasteboard to RTF, RTFD, or archived `NSAttributedString` data when
pasting in an app that only consumes these native rich text formats.

When this behavior is available (guarded by `HAVE(PASTEBOARD_CONVERSION_FROM_HTML_TO_RTF)`), WebKit
no longer needs to eagerly write RTF, RTFD or attributed string representations of the selected text
to the pasteboard when copying or dragging text, since we can defer to system support for performing
this conversion on paste/drop.

Make some minor adjustments to pasteboard writing logic, to make the attributed string writing part
conditional on this new setting.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/editing/Editor.h:
* Source/WebCore/editing/cocoa/EditorCocoa.mm:
(WebCore::populateRichTextDataIfNeeded):
(WebCore::Editor::writeSelectionToPasteboard):
(WebCore::Editor::writeSelection):

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




More information about the webkit-changes mailing list