RESOLVED FIXED190120
[macOS] [WK2] NSFontPanel UI (font color, text decorations, font shadow) doesn't update on selection change
https://bugs.webkit.org/show_bug.cgi?id=190120
Summary [macOS] [WK2] NSFontPanel UI (font color, text decorations, font shadow) does...
Wenson Hsieh
Reported 2018-09-30 15:36:25 PDT
To reproduce: 1. Load "data:text/html,<body contenteditable>" in a WKWebView (e.g. using MiniBrowser) 2. Typing some text, select all, and open the font panel (CMD+T) 3. Modify some of the font attributes (e.g. add a font shadow, strike-through, underline, and change the font color) 4. Change the selection to any other part of the text Observed: font attributes are default values. Expected: font attributes should reflect attributes at the current selection.
Attachments
Patch (44.46 KB, patch)
2018-10-05 09:42 PDT, Wenson Hsieh
no flags
Depends on #234770 (41.75 KB, patch)
2021-12-31 15:57 PST, Wenson Hsieh
no flags
Rebase on trunk (41.76 KB, patch)
2022-01-01 13:28 PST, Wenson Hsieh
no flags
For landing (41.54 KB, patch)
2022-01-12 09:51 PST, Wenson Hsieh
no flags
Radar WebKit Bug Importer
Comment 1 2018-09-30 15:36:52 PDT
Wenson Hsieh
Comment 2 2018-09-30 18:54:35 PDT
WebViewImpl::updateFontPanelIfNeeded already updates NSFontManager's selected font, but this isn't enough; we also need to call -setSelectedAttributes:isMultiple:.
Wenson Hsieh
Comment 3 2018-10-05 09:42:18 PDT Comment hidden (obsolete)
Wenson Hsieh
Comment 4 2021-09-20 13:45:24 PDT Comment hidden (obsolete)
Wenson Hsieh
Comment 5 2021-12-31 15:57:12 PST Comment hidden (obsolete)
Wenson Hsieh
Comment 6 2022-01-01 13:28:17 PST
Created attachment 448162 [details] Rebase on trunk
Darin Adler
Comment 7 2022-01-11 13:32:44 PST
Comment on attachment 448162 [details] Rebase on trunk View in context: https://bugs.webkit.org/attachment.cgi?id=448162&action=review > Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:3060 > + auto attributesDictionary = attributes.createDictionary(); > + if (NSFont *nsFont = [attributesDictionary objectForKey:NSFontAttributeName]) { Seems a small waste to build the whole dictionary just to get the font.
Wenson Hsieh
Comment 8 2022-01-12 07:54:07 PST
Comment on attachment 448162 [details] Rebase on trunk View in context: https://bugs.webkit.org/attachment.cgi?id=448162&action=review Thanks for the review! >> Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:3060 >> + if (NSFont *nsFont = [attributesDictionary objectForKey:NSFontAttributeName]) { > > Seems a small waste to build the whole dictionary just to get the font. Good point — changed this so that we only create the attributes dictionary in the case where the platform NSFont exists.
Wenson Hsieh
Comment 9 2022-01-12 09:51:07 PST
Created attachment 448957 [details] For landing
EWS
Comment 10 2022-01-12 15:00:15 PST
Committed r287953 (245982@main): <https://commits.webkit.org/245982@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 448957 [details].
Note You need to log in before you can comment on or make changes to this bug.