Bug 235449 - REGRESSION(r282320): [Cocoa] User-installed fonts don't work in the GPU Process (in WKWebView)
Summary: REGRESSION(r282320): [Cocoa] User-installed fonts don't work in the GPU Proce...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-01-21 11:18 PST by Myles C. Maxfield
Modified: 2022-01-24 23:13 PST (History)
2 users (show)

See Also:


Attachments
WIP (5.10 KB, patch)
2022-01-21 11:19 PST, Myles C. Maxfield
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (7.91 KB, patch)
2022-01-21 12:38 PST, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (8.46 KB, patch)
2022-01-21 13:03 PST, Myles C. Maxfield
darin: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch for committing (9.97 KB, patch)
2022-01-24 20:28 PST, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch for committing (10.06 KB, patch)
2022-01-24 20:29 PST, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch for committing (10.06 KB, patch)
2022-01-24 20:30 PST, Myles C. Maxfield
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2022-01-21 11:18:19 PST
[Cocoa] User-installed fonts don't work in the GPU Process (in WKWebView)
Comment 1 Myles C. Maxfield 2022-01-21 11:19:17 PST
Created attachment 449673 [details]
WIP
Comment 2 Myles C. Maxfield 2022-01-21 11:19:48 PST
<rdar://problem/84958961>
Comment 3 Myles C. Maxfield 2022-01-21 11:34:22 PST
Comment on attachment 449673 [details]
WIP

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

> Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h:99
> +typedef CF_OPTIONS(uint32_t, CTFontDescriptorOptions) {
> +};

Apparently there has to be something inside the {}s :(
Comment 4 Myles C. Maxfield 2022-01-21 12:38:09 PST
Created attachment 449687 [details]
Patch
Comment 5 Myles C. Maxfield 2022-01-21 13:03:14 PST
Created attachment 449689 [details]
Patch
Comment 6 Darin Adler 2022-01-21 13:38:05 PST
Comment on attachment 449689 [details]
Patch

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

> Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h:100
> +typedef CF_OPTIONS(uint32_t, CTFontDescriptorOptions) {
> +    kCTFontDescriptorOptionThisIsNotARealOption = 0xFFFFFFFF
> +};

Or we could just typedef it to uint32_t.

> Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:468
>          encoder << String(string);

Seems a shame we have to convert CFString to String just to encode it on the wire. A repeated pattern.
Comment 7 Myles C. Maxfield 2022-01-24 12:23:01 PST
Comment on attachment 449689 [details]
Patch

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

>> Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h:100
>> +};
> 
> Or we could just typedef it to uint32_t.

Do you think the typedef is preferable? I think I actually prefer the CF_OPTIONS thing, just because it more closely matches the original source.

I don't want to delay this bug fix any longer, so I'll land this as is and if you prefer the typedef I'll make a follow-up patch.

>> Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:468
>>          encoder << String(string);
> 
> Seems a shame we have to convert CFString to String just to encode it on the wire. A repeated pattern.

I believe we send CFStrings in other places ... let me see if I can fix this...
Comment 8 Darin Adler 2022-01-24 12:28:12 PST
Comment on attachment 449689 [details]
Patch

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

>>> Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h:100
>>> +};
>> 
>> Or we could just typedef it to uint32_t.
> 
> Do you think the typedef is preferable? I think I actually prefer the CF_OPTIONS thing, just because it more closely matches the original source.
> 
> I don't want to delay this bug fix any longer, so I'll land this as is and if you prefer the typedef I'll make a follow-up patch.

This is fine. I didn’t mean to cause delay!
Comment 9 Myles C. Maxfield 2022-01-24 15:45:44 PST
Comment on attachment 449689 [details]
Patch

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

>>> Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:468
>>>          encoder << String(string);
>> 
>> Seems a shame we have to convert CFString to String just to encode it on the wire. A repeated pattern.
> 
> I believe we send CFStrings in other places ... let me see if I can fix this...

Oh, yeah, of course - ArgumentCodersCF.h!
Comment 10 Darin Adler 2022-01-24 15:46:49 PST
Comment on attachment 449689 [details]
Patch

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

>>>> Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:468
>>>>          encoder << String(string);
>>> 
>>> Seems a shame we have to convert CFString to String just to encode it on the wire. A repeated pattern.
>> 
>> I believe we send CFStrings in other places ... let me see if I can fix this...
> 
> Oh, yeah, of course - ArgumentCodersCF.h!

Should find the others who are calling String() just to encode a CFStringRef. I bet this is not the only place.
Comment 11 Myles C. Maxfield 2022-01-24 20:28:09 PST
Created attachment 449891 [details]
Patch for committing
Comment 12 Myles C. Maxfield 2022-01-24 20:29:23 PST
Created attachment 449892 [details]
Patch for committing
Comment 13 Myles C. Maxfield 2022-01-24 20:30:32 PST
Created attachment 449893 [details]
Patch for committing
Comment 14 Darin Adler 2022-01-24 21:33:15 PST
Comment on attachment 449893 [details]
Patch for committing

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

Fine to land as-is, but I see one further refinement.

> Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:486
>          auto currentPostScriptName = adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontNameAttribute)));

Given we only call CFEqual on this, we don’t need the static_cast to CFStringRef. I suggest just taking it out.
Comment 15 Myles C. Maxfield 2022-01-24 22:44:54 PST
Comment on attachment 449893 [details]
Patch for committing

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

>> Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:486
>>          auto currentPostScriptName = adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontNameAttribute)));
> 
> Given we only call CFEqual on this, we don’t need the static_cast to CFStringRef. I suggest just taking it out.

🆒

I think I agree with you. This is more readable now.
Comment 16 Myles C. Maxfield 2022-01-24 23:13:47 PST
Committed r288543 (246375@trunk): <https://commits.webkit.org/246375@trunk>