<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[286894] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/286894">286894</a></dd>
<dt>Author</dt> <dd>drousso@apple.com</dd>
<dt>Date</dt> <dd>2021-12-10 18:06:54 -0800 (Fri, 10 Dec 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>WKWebView doesn’t respond to -copyFont: and -pasteFont:
https://bugs.webkit.org/show_bug.cgi?id=191379
<rdar://problem/45878659>

Reviewed by Wenson Hsieh.

Source/WebCore:

Test: editing/execCommand/mac/copyFont-pasteFont.html

* dom/DOMPasteAccess.h:
Add `DOMPasteAccessCategory::Fonts` (which corresponds to `NSPasteboardNameFont` on macOS).

* editing/Editor.h:
* editing/Editor.cpp:
(WebCore::eventNameForClipboardEvent):
(WebCore::createDataTransferForClipboardEvent):
(WebCore::Editor::copyFont): Added.
(WebCore::Editor::pasteFont): Added.
Add platform-agnostic handling for `"CopyFont"` and `"PasteFont"` editor commands.

* editing/mac/EditorMac.mm:
(WebCore::Editor::platformCopyFont): Added.
(WebCore::Editor::platformPasteFont): Added.
Mimic the logic in `-[WebHTMLView copyFont:]`/`-[WebHTMLView pasteFont:]` to be compatible
with WK1 (i.e. to make it easier for clients to switch to WK2).

* editing/gtk/EditorGtk.cpp:
(WebCore::Editor::platformCopyFont): Added.
(WebCore::Editor::platformPasteFont): Added.
* editing/ios/EditorIOS.mm:
(WebCore::Editor::platformCopyFont): Added.
(WebCore::Editor::platformPasteFont): Added.
* editing/libwpe/EditorLibWPE.cpp:
(WebCore::Editor::platformCopyFont): Added.
(WebCore::Editor::platformPasteFont): Added.
* editing/win/EditorWin.cpp:
(WebCore::Editor::platformCopyFont): Added.
(WebCore::Editor::platformPasteFont): Added.
Add stubs for other platforms.

* editing/EditorCommand.cpp:
(WebCore::executeCopyFont): Added.
(WebCore::executePasteFont): Added.
(WebCore::createCommandMap):
Hook `"CopyFont"` and `"PasteFont"` editor commands up to `document.execCommand`.

Source/WebKit:

* UIProcess/API/mac/WKView.mm:
* UIProcess/API/mac/WKWebViewMac.mm:
Add `-copyFont:` and `-pasteFont:` methods via `WEBCORE_COMMAND`.

* UIProcess/WebPageProxy.cpp:
(WebKit::pasteAccessCategoryForCommand):
The `PasteFont` command should be categorized as `DOMPasteAccessCategory::Fonts`.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::pasteboardNameForAccessCategory):
(WebKit::pasteboardForAccessCategory):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::willPerformPasteCommand):
Correlate `DOMPasteAccessCategory::Fonts` with `NSPasteboardNameFont`.

* UIProcess/ios/WKContentViewInteraction.mm:
(pasteboardNameForAccessCategory):
(pasteboardForAccessCategory):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::willPerformPasteCommand):
Correlate `DOMPasteAccessCategory::Fonts` with `UIPasteboardNameGeneral`.

LayoutTests:

* editing/editing.js:
(execCopyFontCommand): Added.
(copyFontCommand): Added.
(execPasteFontCommand): Added.
(pasteFontCommand): Added.
* editing/execCommand/mac/copyFont-pasteFont.html: Added.
* editing/execCommand/mac/copyFont-pasteFont-expected.html: Added.

* TestExpectations:
* platform/mac/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestseditingeditingjs">trunk/LayoutTests/editing/editing.js</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDOMPasteAccessh">trunk/Source/WebCore/dom/DOMPasteAccess.h</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorh">trunk/Source/WebCore/editing/Editor.h</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorCommandcpp">trunk/Source/WebCore/editing/EditorCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditinggtkEditorGtkcpp">trunk/Source/WebCore/editing/gtk/EditorGtk.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingiosEditorIOSmm">trunk/Source/WebCore/editing/ios/EditorIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreeditinglibwpeEditorLibWPEcpp">trunk/Source/WebCore/editing/libwpe/EditorLibWPE.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingmacEditorMacmm">trunk/Source/WebCore/editing/mac/EditorMac.mm</a></li>
<li><a href="#trunkSourceWebCoreeditingwinEditorWincpp">trunk/Source/WebCore/editing/win/EditorWin.cpp</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPImacWKViewmm">trunk/Source/WebKit/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPImacWKWebViewMacmm">trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessCocoaWebViewImplmm">trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxycpp">trunk/Source/WebKit/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessmacWebPageProxyMacmm">trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/editing/execCommand/mac/</li>
<li><a href="#trunkLayoutTestseditingexecCommandmaccopyFontpasteFontexpectedhtml">trunk/LayoutTests/editing/execCommand/mac/copyFont-pasteFont-expected.html</a></li>
<li><a href="#trunkLayoutTestseditingexecCommandmaccopyFontpasteFonthtml">trunk/LayoutTests/editing/execCommand/mac/copyFont-pasteFont.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/LayoutTests/ChangeLog 2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2021-12-10  Devin Rousso  <drousso@apple.com>
+
+        WKWebView doesn’t respond to -copyFont: and -pasteFont:
+        https://bugs.webkit.org/show_bug.cgi?id=191379
+        <rdar://problem/45878659>
+
+        Reviewed by Wenson Hsieh.
+
+        * editing/editing.js:
+        (execCopyFontCommand): Added.
+        (copyFontCommand): Added.
+        (execPasteFontCommand): Added.
+        (pasteFontCommand): Added.
+        * editing/execCommand/mac/copyFont-pasteFont.html: Added.
+        * editing/execCommand/mac/copyFont-pasteFont-expected.html: Added.
+
+        * TestExpectations:
+        * platform/mac/TestExpectations:
+
</ins><span class="cx"> 2021-12-10  Myles C. Maxfield  <mmaxfield@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [Cocoa] OT-SVG glyphs don't draw into canvases (because of the GPU process)
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations       2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/LayoutTests/TestExpectations  2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -20,6 +20,7 @@
</span><span class="cx"> editing/caret/ios [ Skip ]
</span><span class="cx"> editing/editable-region [ Skip ]
</span><span class="cx"> editing/execCommand/ios [ Skip ]
</span><ins>+editing/execCommand/mac [ Skip ]
</ins><span class="cx"> editing/input/cocoa [ Skip ]
</span><span class="cx"> editing/input/ios [ Skip ]
</span><span class="cx"> editing/find [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestseditingeditingjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/editing.js (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/editing.js     2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/LayoutTests/editing/editing.js        2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -811,6 +811,34 @@
</span><span class="cx"> 
</span><span class="cx"> //-------------------------------------------------------------------------------------------------------
</span><span class="cx"> 
</span><ins>+function execCopyFontCommand() {
+    document.execCommand("CopyFont");
+    debugForDumpAsText("execCopyFontCommand");
+}
+function copyFontCommand() {
+    if (commandDelay > 0) {
+        queueCommand(execCopyFontCommand, commandCount * commandDelay);
+        commandCount++;
+    } else
+        execCopyFontCommand();
+}
+
+//-------------------------------------------------------------------------------------------------------
+
+function execPasteFontCommand() {
+    document.execCommand("PasteFont");
+    debugForDumpAsText("execPasteFontCommand");
+}
+function pasteFontCommand() {
+    if (commandDelay > 0) {
+        queueCommand(execPasteFontCommand, commandCount * commandDelay);
+        commandCount++;
+    } else
+        execPasteFontCommand();
+}
+
+//-------------------------------------------------------------------------------------------------------
+
</ins><span class="cx"> function execCreateLinkCommand(url) {
</span><span class="cx">     document.execCommand("CreateLink", false, url);
</span><span class="cx">     debugForDumpAsText("execCreateLinkCommand");
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommandmaccopyFontpasteFontexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/execCommand/mac/copyFont-pasteFont-expected.html (0 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/mac/copyFont-pasteFont-expected.html                               (rev 0)
+++ trunk/LayoutTests/editing/execCommand/mac/copyFont-pasteFont-expected.html  2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+<html>
+<head>
+    <style>
+#copy {
+    background-color: green;
+    font-family: Arial;
+    font-size: 20px;
+    font-weight: bold;
+    font-style: italic;
+    color: yellow;
+    text-shadow: black 1px 1px;
+    vertical-align: sub;
+}
+    </style>
+</head>
+<body>
+    <div id="copy">copy this</div>
+    <div id="paste" contenteditable=""><font color="#ffff00" face="Arial"><span style="background-color: rgb(0, 128, 0); font-size: 20px; text-shadow: rgb(0, 0, 0) 1px 1px;"><b><i><sub>paste here</sub></i></b></span></font></div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestseditingexecCommandmaccopyFontpasteFonthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/execCommand/mac/copyFont-pasteFont.html (0 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/mac/copyFont-pasteFont.html                                (rev 0)
+++ trunk/LayoutTests/editing/execCommand/mac/copyFont-pasteFont.html   2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+<html>
+<head>
+    <script src=../../editing.js></script>
+    <script>
+function editingTest() {
+    let selection = window.getSelection();
+
+    let copyRange = document.createRange();
+    copyRange.selectNodeContents(document.getElementById("copy"));
+    selection.removeAllRanges();
+    selection.addRange(copyRange);
+    copyFontCommand();
+
+    let pasteRange = document.createRange();
+    pasteRange.selectNodeContents(document.getElementById("paste"));
+    selection.removeAllRanges();
+    selection.addRange(pasteRange);
+    pasteFontCommand();
+
+    selection.removeAllRanges();
+}
+    </script>
+    <style>
+#copy {
+    background-color: green;
+    font-family: Arial;
+    font-size: 20px;
+    font-weight: bold;
+    font-style: italic;
+    color: yellow;
+    text-shadow: black 1px 1px;
+    vertical-align: sub;
+}
+#paste {
+    outline: none;
+}
+    </style>
+</head>
+<body>
+    <div id="copy">copy this</div>
+    <div id="paste" contenteditable>paste here</div>
+    <script>
+runEditingTest();
+    </script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations  2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/LayoutTests/platform/mac/TestExpectations     2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -9,6 +9,7 @@
</span><span class="cx"> accessibility/mac [ Pass ]
</span><span class="cx"> compositing/scrolling/async-overflow-scrolling/mac [ Pass ]
</span><span class="cx"> displaylists [ Pass ]
</span><ins>+editing/execCommand/mac [ Pass ]
</ins><span class="cx"> editing/input/cocoa [ Pass ]
</span><span class="cx"> editing/mac [ Pass ]
</span><span class="cx"> editing/pasteboard/mac [ Pass ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebCore/ChangeLog      2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2021-12-10  Devin Rousso  <drousso@apple.com>
+
+        WKWebView doesn’t respond to -copyFont: and -pasteFont:
+        https://bugs.webkit.org/show_bug.cgi?id=191379
+        <rdar://problem/45878659>
+
+        Reviewed by Wenson Hsieh.
+
+        Test: editing/execCommand/mac/copyFont-pasteFont.html
+
+        * dom/DOMPasteAccess.h:
+        Add `DOMPasteAccessCategory::Fonts` (which corresponds to `NSPasteboardNameFont` on macOS).
+
+        * editing/Editor.h:
+        * editing/Editor.cpp:
+        (WebCore::eventNameForClipboardEvent):
+        (WebCore::createDataTransferForClipboardEvent):
+        (WebCore::Editor::copyFont): Added.
+        (WebCore::Editor::pasteFont): Added.
+        Add platform-agnostic handling for `"CopyFont"` and `"PasteFont"` editor commands.
+
+        * editing/mac/EditorMac.mm:
+        (WebCore::Editor::platformCopyFont): Added.
+        (WebCore::Editor::platformPasteFont): Added.
+        Mimic the logic in `-[WebHTMLView copyFont:]`/`-[WebHTMLView pasteFont:]` to be compatible
+        with WK1 (i.e. to make it easier for clients to switch to WK2).
+
+        * editing/gtk/EditorGtk.cpp:
+        (WebCore::Editor::platformCopyFont): Added.
+        (WebCore::Editor::platformPasteFont): Added.
+        * editing/ios/EditorIOS.mm:
+        (WebCore::Editor::platformCopyFont): Added.
+        (WebCore::Editor::platformPasteFont): Added.
+        * editing/libwpe/EditorLibWPE.cpp:
+        (WebCore::Editor::platformCopyFont): Added.
+        (WebCore::Editor::platformPasteFont): Added.
+        * editing/win/EditorWin.cpp:
+        (WebCore::Editor::platformCopyFont): Added.
+        (WebCore::Editor::platformPasteFont): Added.
+        Add stubs for other platforms.
+
+        * editing/EditorCommand.cpp:
+        (WebCore::executeCopyFont): Added.
+        (WebCore::executePasteFont): Added.
+        (WebCore::createCommandMap):
+        Hook `"CopyFont"` and `"PasteFont"` editor commands up to `document.execCommand`.
+
</ins><span class="cx"> 2021-12-10  Eric Carlson  <eric.carlson@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [macOS] Add new screen and window capture backend
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMPasteAccessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMPasteAccess.h (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DOMPasteAccess.h        2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebCore/dom/DOMPasteAccess.h   2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> enum class DOMPasteAccessCategory : uint8_t {
</span><span class="cx">     General,
</span><ins>+    Fonts,
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> enum class DOMPasteAccessPolicy : uint8_t {
</span><span class="lines">@@ -52,7 +53,8 @@
</span><span class="cx"> template<> struct EnumTraits<WebCore::DOMPasteAccessCategory> {
</span><span class="cx">     using values = EnumValues<
</span><span class="cx">         WebCore::DOMPasteAccessCategory,
</span><del>-        WebCore::DOMPasteAccessCategory::General
</del><ins>+        WebCore::DOMPasteAccessCategory::General,
+        WebCore::DOMPasteAccessCategory::Fonts
</ins><span class="cx">     >;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp  2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebCore/editing/Editor.cpp     2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -372,8 +372,10 @@
</span><span class="cx"> 
</span><span class="cx"> enum class ClipboardEventKind {
</span><span class="cx">     Copy,
</span><ins>+    CopyFont,
</ins><span class="cx">     Cut,
</span><span class="cx">     Paste,
</span><ins>+    PasteFont,
</ins><span class="cx">     PasteAsPlainText,
</span><span class="cx">     PasteAsQuotation,
</span><span class="cx">     BeforeCopy,
</span><span class="lines">@@ -385,6 +387,7 @@
</span><span class="cx"> {
</span><span class="cx">     switch (kind) {
</span><span class="cx">     case ClipboardEventKind::Copy:
</span><ins>+    case ClipboardEventKind::CopyFont:
</ins><span class="cx">         return eventNames().copyEvent;
</span><span class="cx">     case ClipboardEventKind::Cut:
</span><span class="cx">         return eventNames().cutEvent;
</span><span class="lines">@@ -391,6 +394,7 @@
</span><span class="cx">     case ClipboardEventKind::Paste:
</span><span class="cx">     case ClipboardEventKind::PasteAsPlainText:
</span><span class="cx">     case ClipboardEventKind::PasteAsQuotation:
</span><ins>+    case ClipboardEventKind::PasteFont:
</ins><span class="cx">         return eventNames().pasteEvent;
</span><span class="cx">     case ClipboardEventKind::BeforeCopy:
</span><span class="cx">         return eventNames().beforecopyEvent;
</span><span class="lines">@@ -407,6 +411,7 @@
</span><span class="cx"> {
</span><span class="cx">     switch (kind) {
</span><span class="cx">     case ClipboardEventKind::Copy:
</span><ins>+    case ClipboardEventKind::CopyFont:
</ins><span class="cx">     case ClipboardEventKind::Cut:
</span><span class="cx">         return DataTransfer::createForCopyAndPaste(document, DataTransfer::StoreMode::ReadWrite, makeUnique<StaticPasteboard>());
</span><span class="cx">     case ClipboardEventKind::PasteAsPlainText:
</span><span class="lines">@@ -420,6 +425,7 @@
</span><span class="cx">         FALLTHROUGH;
</span><span class="cx">     case ClipboardEventKind::Paste:
</span><span class="cx">     case ClipboardEventKind::PasteAsQuotation:
</span><ins>+    case ClipboardEventKind::PasteFont:
</ins><span class="cx">         return DataTransfer::createForCopyAndPaste(document, DataTransfer::StoreMode::Readonly, Pasteboard::createForCopyAndPaste(PagePasteboardContext::create(document.pageID())));
</span><span class="cx">     case ClipboardEventKind::BeforeCopy:
</span><span class="cx">     case ClipboardEventKind::BeforeCut:
</span><span class="lines">@@ -1404,6 +1410,21 @@
</span><span class="cx">     performCutOrCopy(CopyAction);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Editor::copyFont(FromMenuOrKeyBinding fromMenuOrKeyBinding)
+{
+    SetForScope<bool> copyScope { m_copyingFromMenuOrKeyBinding, fromMenuOrKeyBinding == FromMenuOrKeyBinding::Yes };
+    if (tryDHTMLCopy())
+        return; // DHTML did the whole operation
+    if (!canCopy()) {
+        SystemSoundManager::singleton().systemBeep();
+        return;
+    }
+
+    willWriteSelectionToPasteboard(selectedRange());
+    platformCopyFont();
+    didWriteSelectionToPasteboard();
+}
+
</ins><span class="cx"> void Editor::postTextStateChangeNotificationForCut(const String& text, const VisibleSelection& selection)
</span><span class="cx"> {
</span><span class="cx">     if (!AXObjectCache::accessibilityEnabled())
</span><span class="lines">@@ -1512,6 +1533,19 @@
</span><span class="cx">         pasteAsPlainTextWithPasteboard(*pasteboard);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Editor::pasteFont(FromMenuOrKeyBinding fromMenuOrKeyBinding)
+{
+    SetForScope<bool> pasteScope { m_pastingFromMenuOrKeyBinding, fromMenuOrKeyBinding == FromMenuOrKeyBinding::Yes };
+
+    if (!dispatchClipboardEvent(findEventTargetFromSelection(), ClipboardEventKind::PasteFont))
+        return;
+    if (!canPaste())
+        return;
+    updateMarkersForWordsAffectedByEditing(false);
+    ResourceCacheValidationSuppressor validationSuppressor(document().cachedResourceLoader());
+    platformPasteFont();
+}
+
</ins><span class="cx"> void Editor::quoteFragmentForPasting(DocumentFragment& fragment)
</span><span class="cx"> {
</span><span class="cx">     auto blockQuote = HTMLQuoteElement::create(blockquoteTag, document());
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.h (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.h    2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebCore/editing/Editor.h       2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -197,11 +197,13 @@
</span><span class="cx">     enum class FromMenuOrKeyBinding : bool { No, Yes };
</span><span class="cx">     WEBCORE_EXPORT void cut(FromMenuOrKeyBinding = FromMenuOrKeyBinding::No);
</span><span class="cx">     WEBCORE_EXPORT void copy(FromMenuOrKeyBinding = FromMenuOrKeyBinding::No);
</span><ins>+    void copyFont(FromMenuOrKeyBinding = FromMenuOrKeyBinding::No);
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void paste(FromMenuOrKeyBinding = FromMenuOrKeyBinding::No);
</span><span class="cx">     void paste(Pasteboard&, FromMenuOrKeyBinding = FromMenuOrKeyBinding::No);
</span><span class="cx">     WEBCORE_EXPORT void pasteAsPlainText(FromMenuOrKeyBinding = FromMenuOrKeyBinding::No);
</span><span class="cx">     void pasteAsQuotation(FromMenuOrKeyBinding = FromMenuOrKeyBinding::No);
</span><ins>+    void pasteFont(FromMenuOrKeyBinding = FromMenuOrKeyBinding::No);
</ins><span class="cx">     WEBCORE_EXPORT void performDelete();
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void copyURL(const URL&, const String& title);
</span><span class="lines">@@ -592,6 +594,9 @@
</span><span class="cx">     void pasteWithPasteboard(Pasteboard*, OptionSet<PasteOption>);
</span><span class="cx">     String plainTextFromPasteboard(const PasteboardPlainText&);
</span><span class="cx"> 
</span><ins>+    void platformCopyFont();
+    void platformPasteFont();
+
</ins><span class="cx">     void quoteFragmentForPasting(DocumentFragment&);
</span><span class="cx"> 
</span><span class="cx">     void revealSelectionAfterEditingOperation(const ScrollAlignment& = ScrollAlignment::alignCenterIfNeeded, RevealExtentOption = DoNotRevealExtent);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/EditorCommand.cpp (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/EditorCommand.cpp   2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebCore/editing/EditorCommand.cpp      2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -242,6 +242,12 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool executeCopyFont(Frame& frame, Event*, EditorCommandSource source, const String&)
+{
+    frame.editor().copyFont(source == CommandFromMenuOrKeyBinding ? Editor::FromMenuOrKeyBinding::Yes : Editor::FromMenuOrKeyBinding::No);
+    return true;
+}
+
</ins><span class="cx"> static bool executeCreateLink(Frame& frame, Event*, EditorCommandSource, const String& value)
</span><span class="cx"> {
</span><span class="cx">     // FIXME: If userInterface is true, we should display a dialog box to let the user enter a URL.
</span><span class="lines">@@ -906,6 +912,21 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool executePasteFont(Frame& frame, Event*, EditorCommandSource source, const String&)
+{
+    if (source == CommandFromMenuOrKeyBinding) {
+        UserTypingGestureIndicator typingGestureIndicator(frame);
+        frame.editor().pasteFont(Editor::FromMenuOrKeyBinding::Yes);
+        return true;
+    }
+
+    if (!frame.requestDOMPasteAccess(DOMPasteAccessCategory::Fonts))
+        return false;
+
+    frame.editor().pasteFont();
+    return true;
+}
+
</ins><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx"> 
</span><span class="cx"> static bool executePasteGlobalSelection(Frame& frame, Event*, EditorCommandSource source, const String&)
</span><span class="lines">@@ -1614,6 +1635,7 @@
</span><span class="cx">         { "Bold"_s, { executeToggleBold, supported, enabledInRichlyEditableText, stateBold, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
</span><span class="cx">         { "ClearText"_s, { executeClearText, supported, enabledClearText, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
</span><span class="cx">         { "Copy"_s, { executeCopy, supportedCopyCut, enabledCopy, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledCopyCut } },
</span><ins>+        { "CopyFont"_s, { executeCopyFont, supportedCopyCut, enabledCopy, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledCopyCut } },
</ins><span class="cx">         { "CreateLink"_s, { executeCreateLink, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
</span><span class="cx">         { "Cut"_s, { executeCut, supportedCopyCut, enabledCut, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledCopyCut } },
</span><span class="cx">         { "DefaultParagraphSeparator"_s, { executeDefaultParagraphSeparator, supported, enabled, stateNone, valueDefaultParagraphSeparator, notTextInsertion, doNotAllowExecutionWhenDisabled} },
</span><span class="lines">@@ -1713,6 +1735,7 @@
</span><span class="cx">         { "PasteAndMatchStyle"_s, { executePasteAndMatchStyle, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledPaste } },
</span><span class="cx">         { "PasteAsPlainText"_s, { executePasteAsPlainText, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledPaste } },
</span><span class="cx">         { "PasteAsQuotation"_s, { executePasteAsQuotation, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledPaste } },
</span><ins>+        { "PasteFont"_s, { executePasteFont, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledPaste } },
</ins><span class="cx">         { "Print"_s, { executePrint, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
</span><span class="cx">         { "Redo"_s, { executeRedo, supported, enabledRedo, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
</span><span class="cx">         { "RemoveFormat"_s, { executeRemoveFormat, supported, enabledRangeInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
</span></span></pre></div>
<a id="trunkSourceWebCoreeditinggtkEditorGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/gtk/EditorGtk.cpp (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/gtk/EditorGtk.cpp   2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebCore/editing/gtk/EditorGtk.cpp      2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -65,6 +65,14 @@
</span><span class="cx">         pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, options.contains(PasteOption::IgnoreMailBlockquote) ? MailBlockquoteHandling::IgnoreBlockquote : MailBlockquoteHandling::RespectBlockquote);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Editor::platformCopyFont()
+{
+}
+
+void Editor::platformPasteFont()
+{
+}
+
</ins><span class="cx"> static const AtomString& elementURL(Element& element)
</span><span class="cx"> {
</span><span class="cx">     if (is<HTMLImageElement>(element) || is<HTMLInputElement>(element))
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingiosEditorIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ios/EditorIOS.mm (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ios/EditorIOS.mm    2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebCore/editing/ios/EditorIOS.mm       2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -238,6 +238,14 @@
</span><span class="cx">         pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(*pasteboard), false, options.contains(PasteOption::IgnoreMailBlockquote) ? MailBlockquoteHandling::IgnoreBlockquote : MailBlockquoteHandling::RespectBlockquote);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Editor::platformCopyFont()
+{
+}
+
+void Editor::platformPasteFont()
+{
+}
+
</ins><span class="cx"> void Editor::insertDictationPhrases(Vector<Vector<String>>&& dictationPhrases, id metadata)
</span><span class="cx"> {
</span><span class="cx">     if (m_document.selection().isNone())
</span></span></pre></div>
<a id="trunkSourceWebCoreeditinglibwpeEditorLibWPEcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/libwpe/EditorLibWPE.cpp (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/libwpe/EditorLibWPE.cpp     2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebCore/editing/libwpe/EditorLibWPE.cpp        2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -91,6 +91,14 @@
</span><span class="cx">         pasteAsFragment(*fragment, canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, options.contains(PasteOption::IgnoreMailBlockquote) ? MailBlockquoteHandling::IgnoreBlockquote : MailBlockquoteHandling::RespectBlockquote);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Editor::platformCopyFont()
+{
+}
+
+void Editor::platformPasteFont()
+{
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // USE(LIBWPE)
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmacEditorMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/mac/EditorMac.mm    2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm       2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -31,10 +31,15 @@
</span><span class="cx"> #import "Blob.h"
</span><span class="cx"> #import "CSSPrimitiveValueMappings.h"
</span><span class="cx"> #import "CSSValuePool.h"
</span><ins>+#import "Color.h"
+#import "ColorCocoa.h"
+#import "ColorSerialization.h"
</ins><span class="cx"> #import "DataTransfer.h"
</span><span class="cx"> #import "DocumentFragment.h"
</span><span class="cx"> #import "Editing.h"
</span><span class="cx"> #import "EditorClient.h"
</span><ins>+#import "FontAttributes.h"
+#import "FontShadow.h"
</ins><span class="cx"> #import "Frame.h"
</span><span class="cx"> #import "FrameView.h"
</span><span class="cx"> #import "HTMLConverter.h"
</span><span class="lines">@@ -50,11 +55,13 @@
</span><span class="cx"> #import "RenderImage.h"
</span><span class="cx"> #import "RuntimeApplicationChecks.h"
</span><span class="cx"> #import "RuntimeEnabledFeatures.h"
</span><ins>+#import "SharedBuffer.h"
</ins><span class="cx"> #import "StyleProperties.h"
</span><span class="cx"> #import "WebContentReader.h"
</span><span class="cx"> #import "WebNSAttributedStringExtras.h"
</span><span class="cx"> #import "markup.h"
</span><span class="cx"> #import <AppKit/AppKit.h>
</span><ins>+#import <wtf/RetainPtr.h>
</ins><span class="cx"> #import <wtf/cocoa/NSURLExtras.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -99,6 +106,83 @@
</span><span class="cx">     client()->setInsertionPasteboard(String());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Editor::platformCopyFont()
+{
+    Pasteboard pasteboard(PagePasteboardContext::create(m_document.pageID()), NSPasteboardNameFont);
+
+    auto fontSampleString = adoptNS([[NSAttributedString alloc] initWithString:@"x" attributes:fontAttributesAtSelectionStart().createDictionary().get()]);
+    auto fontData = RetainPtr([fontSampleString RTFFromRange:NSMakeRange(0, [fontSampleString length]) documentAttributes:@{ }]);
+
+    PasteboardBuffer pasteboardBuffer;
+    pasteboardBuffer.contentOrigin = m_document.originIdentifierForPasteboard();
+    pasteboardBuffer.type = legacyFontPasteboardType();
+    pasteboardBuffer.data = SharedBuffer::create(fontData.get());
+    pasteboard.write(pasteboardBuffer);
+}
+
+void Editor::platformPasteFont()
+{
+    Pasteboard pasteboard(PagePasteboardContext::create(m_document.pageID()), NSPasteboardNameFont);
+
+    client()->setInsertionPasteboard(pasteboard.name());
+
+    RetainPtr<NSData> fontData;
+    if (auto buffer = pasteboard.readBuffer(std::nullopt, legacyFontPasteboardType()))
+        fontData = buffer->createNSData();
+    auto fontSampleString = adoptNS([[NSAttributedString alloc] initWithRTF:fontData.get() documentAttributes:nil]);
+    auto fontAttributes = RetainPtr([fontSampleString fontAttributesInRange:NSMakeRange(0, 1)]);
+
+    auto style = MutableStyleProperties::create();
+
+    Color backgroundColor;
+    if (NSColor *nsBackgroundColor = dynamic_objc_cast<NSColor>([fontAttributes objectForKey:NSBackgroundColorAttributeName]))
+        backgroundColor = colorFromCocoaColor(nsBackgroundColor);
+    if (!backgroundColor.isValid())
+        backgroundColor = Color::transparentBlack;
+    style->setProperty(CSSPropertyBackgroundColor, CSSPrimitiveValue::create(backgroundColor));
+
+    if (NSFont *font = dynamic_objc_cast<NSFont>([fontAttributes objectForKey:NSFontAttributeName])) {
+        // FIXME: Need more sophisticated escaping code if we want to handle family names
+        // with characters like single quote or backslash in their names.
+        style->setProperty(CSSPropertyFontFamily, [NSString stringWithFormat:@"'%@'", [font familyName]]);
+        style->setProperty(CSSPropertyFontSize, CSSPrimitiveValue::create([font pointSize], CSSUnitType::CSS_PX));
+        // FIXME: Map to the entire range of CSS weight values.
+        style->setProperty(CSSPropertyFontWeight, ([NSFontManager.sharedFontManager weightOfFont:font] >= 7) ? CSSValueBold : CSSValueNormal);
+        style->setProperty(CSSPropertyFontStyle, ([NSFontManager.sharedFontManager traitsOfFont:font] & NSItalicFontMask) ? CSSValueItalic : CSSValueNormal);
+    } else {
+        style->setProperty(CSSPropertyFontFamily, "Helvetica"_s);
+        style->setProperty(CSSPropertyFontSize, CSSPrimitiveValue::create(12, CSSUnitType::CSS_PX));
+        style->setProperty(CSSPropertyFontWeight, CSSValueNormal);
+        style->setProperty(CSSPropertyFontStyle, CSSValueNormal);
+    }
+
+    Color foregroundColor;
+    if (NSColor *nsForegroundColor = dynamic_objc_cast<NSColor>([fontAttributes objectForKey:NSForegroundColorAttributeName])) {
+        foregroundColor = colorFromCocoaColor(nsForegroundColor);
+        if (!foregroundColor.isValid())
+            foregroundColor = Color::transparentBlack;
+    } else
+        foregroundColor = Color::black;
+    style->setProperty(CSSPropertyColor, CSSPrimitiveValue::create(foregroundColor));
+
+    FontShadow fontShadow;
+    if (NSShadow *nsFontShadow = dynamic_objc_cast<NSShadow>([fontAttributes objectForKey:NSShadowAttributeName]))
+        fontShadow = fontShadowFromNSShadow(nsFontShadow);
+    style->setProperty(CSSPropertyTextShadow, serializationForCSS(fontShadow));
+
+    auto superscriptStyle = [[fontAttributes objectForKey:NSSuperscriptAttributeName] intValue];
+    style->setProperty(CSSPropertyVerticalAlign, (superscriptStyle > 0) ? CSSValueSuper : ((superscriptStyle < 0) ? CSSValueSub : CSSValueBaseline));
+
+    // FIXME: Underline wins here if we have both (see bug 3790443).
+    auto underlineStyle = [[fontAttributes objectForKey:NSUnderlineStyleAttributeName] intValue];
+    auto strikethroughStyle = [[fontAttributes objectForKey:NSStrikethroughStyleAttributeName] intValue];
+    style->setProperty(CSSPropertyWebkitTextDecorationsInEffect, (underlineStyle != NSUnderlineStyleNone) ? CSSValueUnderline : ((strikethroughStyle != NSUnderlineStyleNone) ? CSSValueLineThrough : CSSValueNone));
+
+    applyStyleToSelection(style.ptr(), EditAction::PasteFont);
+
+    client()->setInsertionPasteboard(String());
+}
+
</ins><span class="cx"> void Editor::readSelectionFromPasteboard(const String& pasteboardName)
</span><span class="cx"> {
</span><span class="cx">     Pasteboard pasteboard(PagePasteboardContext::create(m_document.pageID()), pasteboardName);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingwinEditorWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/win/EditorWin.cpp (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/win/EditorWin.cpp   2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebCore/editing/win/EditorWin.cpp      2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -52,6 +52,14 @@
</span><span class="cx">         pasteAsFragment(fragment.releaseNonNull(), canSmartReplaceWithPasteboard(*pasteboard), chosePlainText, options.contains(PasteOption::IgnoreMailBlockquote) ? MailBlockquoteHandling::IgnoreBlockquote : MailBlockquoteHandling::RespectBlockquote);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Editor::platformCopyFont()
+{
+}
+
+void Editor::platformPasteFont()
+{
+}
+
</ins><span class="cx"> template <typename PlatformDragData>
</span><span class="cx"> static RefPtr<DocumentFragment> createFragmentFromPlatformData(PlatformDragData& platformDragData, Frame& frame)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebKit/ChangeLog       2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2021-12-10  Devin Rousso  <drousso@apple.com>
+
+        WKWebView doesn’t respond to -copyFont: and -pasteFont:
+        https://bugs.webkit.org/show_bug.cgi?id=191379
+        <rdar://problem/45878659>
+
+        Reviewed by Wenson Hsieh.
+
+        * UIProcess/API/mac/WKView.mm:
+        * UIProcess/API/mac/WKWebViewMac.mm:
+        Add `-copyFont:` and `-pasteFont:` methods via `WEBCORE_COMMAND`.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::pasteAccessCategoryForCommand):
+        The `PasteFont` command should be categorized as `DOMPasteAccessCategory::Fonts`.
+
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::pasteboardNameForAccessCategory):
+        (WebKit::pasteboardForAccessCategory):
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::willPerformPasteCommand):
+        Correlate `DOMPasteAccessCategory::Fonts` with `NSPasteboardNameFont`.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (pasteboardNameForAccessCategory):
+        (pasteboardForAccessCategory):
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::willPerformPasteCommand):
+        Correlate `DOMPasteAccessCategory::Fonts` with `UIPasteboardNameGeneral`.
+
</ins><span class="cx"> 2021-12-10  Eric Carlson  <eric.carlson@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [macOS] Add new screen and window capture backend
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/mac/WKView.mm (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/mac/WKView.mm  2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebKit/UIProcess/API/mac/WKView.mm     2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -205,6 +205,7 @@
</span><span class="cx"> WEBCORE_COMMAND(alignLeft)
</span><span class="cx"> WEBCORE_COMMAND(alignRight)
</span><span class="cx"> WEBCORE_COMMAND(copy)
</span><ins>+WEBCORE_COMMAND(copyFont)
</ins><span class="cx"> WEBCORE_COMMAND(cut)
</span><span class="cx"> WEBCORE_COMMAND(delete)
</span><span class="cx"> WEBCORE_COMMAND(deleteBackward)
</span><span class="lines">@@ -278,6 +279,7 @@
</span><span class="cx"> WEBCORE_COMMAND(pageUpAndModifySelection)
</span><span class="cx"> WEBCORE_COMMAND(paste)
</span><span class="cx"> WEBCORE_COMMAND(pasteAsPlainText)
</span><ins>+WEBCORE_COMMAND(pasteFont)
</ins><span class="cx"> WEBCORE_COMMAND(scrollPageDown)
</span><span class="cx"> WEBCORE_COMMAND(scrollPageUp)
</span><span class="cx"> WEBCORE_COMMAND(scrollLineDown)
</span><span class="lines">@@ -339,11 +341,9 @@
</span><span class="cx"> Editing-related methods still unimplemented that are implemented in WebKit1:
</span><span class="cx"> 
</span><span class="cx"> - (void)complete:(id)sender;
</span><del>-- (void)copyFont:(id)sender;
</del><span class="cx"> - (void)makeBaseWritingDirectionLeftToRight:(id)sender;
</span><span class="cx"> - (void)makeBaseWritingDirectionNatural:(id)sender;
</span><span class="cx"> - (void)makeBaseWritingDirectionRightToLeft:(id)sender;
</span><del>-- (void)pasteFont:(id)sender;
</del><span class="cx"> - (void)scrollLineDown:(id)sender;
</span><span class="cx"> - (void)scrollLineUp:(id)sender;
</span><span class="cx"> - (void)showGuessPanel:(id)sender;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPImacWKWebViewMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm    2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm       2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -167,6 +167,7 @@
</span><span class="cx"> WEBCORE_COMMAND(alignLeft)
</span><span class="cx"> WEBCORE_COMMAND(alignRight)
</span><span class="cx"> WEBCORE_COMMAND(copy)
</span><ins>+WEBCORE_COMMAND(copyFont)
</ins><span class="cx"> WEBCORE_COMMAND(cut)
</span><span class="cx"> WEBCORE_COMMAND(delete)
</span><span class="cx"> WEBCORE_COMMAND(deleteBackward)
</span><span class="lines">@@ -240,6 +241,7 @@
</span><span class="cx"> WEBCORE_COMMAND(pageUpAndModifySelection)
</span><span class="cx"> WEBCORE_COMMAND(paste)
</span><span class="cx"> WEBCORE_COMMAND(pasteAsPlainText)
</span><ins>+WEBCORE_COMMAND(pasteFont)
</ins><span class="cx"> WEBCORE_COMMAND(scrollLineDown)
</span><span class="cx"> WEBCORE_COMMAND(scrollLineUp)
</span><span class="cx"> WEBCORE_COMMAND(scrollToBeginningOfDocument)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessCocoaWebViewImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm       2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm  2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -4590,6 +4590,9 @@
</span><span class="cx">     switch (pasteAccessCategory) {
</span><span class="cx">     case WebCore::DOMPasteAccessCategory::General:
</span><span class="cx">         return NSPasteboardNameGeneral;
</span><ins>+
+    case WebCore::DOMPasteAccessCategory::Fonts:
+        return NSPasteboardNameFont;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -4598,6 +4601,9 @@
</span><span class="cx">     switch (pasteAccessCategory) {
</span><span class="cx">     case WebCore::DOMPasteAccessCategory::General:
</span><span class="cx">         return NSPasteboard.generalPasteboard;
</span><ins>+
+    case WebCore::DOMPasteAccessCategory::Fonts:
+        return [NSPasteboard pasteboardWithName:NSPasteboardNameFont];
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp   2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp      2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -2521,6 +2521,7 @@
</span><span class="cx">         { "PasteAndMatchStyle", DOMPasteAccessCategory::General },
</span><span class="cx">         { "PasteAsQuotation", DOMPasteAccessCategory::General },
</span><span class="cx">         { "PasteAsPlainText", DOMPasteAccessCategory::General },
</span><ins>+        { "PasteFont", DOMPasteAccessCategory::Fonts },
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     auto it = pasteCommandNames->find(commandName);
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm    2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm       2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -4173,6 +4173,7 @@
</span><span class="cx"> {
</span><span class="cx">     switch (pasteAccessCategory) {
</span><span class="cx">     case WebCore::DOMPasteAccessCategory::General:
</span><ins>+    case WebCore::DOMPasteAccessCategory::Fonts:
</ins><span class="cx">         return UIPasteboardNameGeneral;
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -4181,6 +4182,7 @@
</span><span class="cx"> {
</span><span class="cx">     switch (pasteAccessCategory) {
</span><span class="cx">     case WebCore::DOMPasteAccessCategory::General:
</span><ins>+    case WebCore::DOMPasteAccessCategory::Fonts:
</ins><span class="cx">         return UIPasteboard.generalPasteboard;
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm     2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm        2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -1548,6 +1548,7 @@
</span><span class="cx"> {
</span><span class="cx">     switch (pasteAccessCategory) {
</span><span class="cx">     case DOMPasteAccessCategory::General:
</span><ins>+    case DOMPasteAccessCategory::Fonts:
</ins><span class="cx">         grantAccessToCurrentPasteboardData(UIPasteboardNameGeneral);
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessmacWebPageProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (286893 => 286894)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm     2021-12-11 01:25:58 UTC (rev 286893)
+++ trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm        2021-12-11 02:06:54 UTC (rev 286894)
</span><span class="lines">@@ -657,6 +657,10 @@
</span><span class="cx">     case DOMPasteAccessCategory::General:
</span><span class="cx">         grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral);
</span><span class="cx">         return;
</span><ins>+
+    case DOMPasteAccessCategory::Fonts:
+        grantAccessToCurrentPasteboardData(NSPasteboardNameFont);
+        return;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>