Bug 191379

Summary: WKWebView doesn’t respond to -copyFont: and -pasteFont:
Product: WebKit Reporter: mitz
Component: HTML EditingAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: akeerthi, cdumez, esprehn+autocc, ews-watchlist, hi, kangil.han, megan_gardner, mifenton, rniwa, simon.fraser, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 233938, 233939, 233940, 234065    
Bug Blocks: 234185    
Attachments:
Description Flags
Patch
none
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch
none
Patch none

Description mitz 2018-11-07 09:50:52 PST
WKWebView doesn’t respond to -copyFont: and -pasteFont:
Comment 1 mitz 2018-11-07 09:59:05 PST
<rdar://problem/45878659>.
Comment 2 Devin Rousso 2021-12-07 15:25:29 PST
Created attachment 446245 [details]
Patch
Comment 3 Devin Rousso 2021-12-07 17:01:05 PST
Created attachment 446257 [details]
Patch

rebase
Comment 4 Devin Rousso 2021-12-08 20:50:41 PST
Created attachment 446498 [details]
Patch
Comment 5 Devin Rousso 2021-12-10 13:21:46 PST
Created attachment 446795 [details]
Patch
Comment 6 Wenson Hsieh 2021-12-10 14:46:48 PST
Comment on attachment 446795 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=446795&action=review

r=mews

> Source/WebCore/editing/mac/EditorMac.mm:109
> +void Editor::platformCopyFont()

We should file a followup to unify this code with the WebKitLegacy implementation in WebHTMLView.

> Source/WebCore/editing/mac/EditorMac.mm:125
> +void Editor::platformPasteFont()

Same, for this.

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:4174
> +        // FIXME: Does iOS have a different pasteboard for fonts?

iOS does not support a dedicated font pasteboard, no. Falling back to the general pasteboard is probably okay here (and we can remove the FIXME).

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:4186
> +        // FIXME: Does iOS have a different pasteboard for fonts?

Ditto.

> Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:1555
> +        // FIXME: Does iOS have a different pasteboard for fonts?

Ditto.

> Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:663
> +        grantAccessToCurrentPasteboardData(NSFontPboard);

Can you use `NSPasteboardNameFont` instead of suppressing deprecation warnings?
Comment 7 Wenson Hsieh 2021-12-10 14:48:00 PST
Comment on attachment 446795 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=446795&action=review

> LayoutTests/editing/execCommand/mac/copyFont-pasteFont-expected.html:4
> +#copy {

Nit - indentation is a bit off in a few places in this file.

> LayoutTests/editing/execCommand/mac/copyFont-pasteFont.html:3
> +    <script src=../../editing.js></script>

Ditto, re: indentation.
Comment 8 Devin Rousso 2021-12-10 16:04:30 PST
Comment on attachment 446795 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=446795&action=review

>> LayoutTests/editing/execCommand/mac/copyFont-pasteFont-expected.html:4
>> +#copy {
> 
> Nit - indentation is a bit off in a few places in this file.

Oh lol that's just my personal preference.  I find that indenting inline CSS/JS to match the indentation of the surrounding DOM is odd because if you then did `style.textContent` there'd be all this extra indentation for seemingly no reason.
Comment 9 Devin Rousso 2021-12-10 16:07:37 PST
Created attachment 446837 [details]
Patch
Comment 10 Devin Rousso 2021-12-10 16:24:28 PST
Created attachment 446842 [details]
Patch
Comment 11 EWS 2021-12-10 18:08:09 PST
Committed r286894 (245122@main): <https://commits.webkit.org/245122@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 446842 [details].