Bug 225567 - [Cocoa] Disable Core Text's font cascade explicitly instead of setting the cascade to just point to LastResort
Summary: [Cocoa] Disable Core Text's font cascade explicitly instead of setting the ca...
Status: NEW
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: 215691
  Show dependency treegraph
 
Reported: 2021-05-08 17:29 PDT by Myles C. Maxfield
Modified: 2021-07-22 11:03 PDT (History)
2 users (show)

See Also:


Attachments
Patch (3.94 KB, patch)
2021-05-08 17:31 PDT, Myles C. Maxfield
ews-feeder: commit-queue-
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 2021-05-08 17:29:42 PDT
[Cocoa] Disable Core Text's font cascade explicitly instead of setting the cascade to just point to LastResort
Comment 1 Myles C. Maxfield 2021-05-08 17:31:27 PDT
Created attachment 428101 [details]
Patch
Comment 2 Darin Adler 2021-05-08 21:04:32 PDT
Comment on attachment 428101 [details]
Patch

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

> Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp:100
> +    static NeverDestroyed<RetainPtr<CTFontDescriptorRef>> descriptor;
> +    if (descriptor.get())
> +        return descriptor.get().get();

We don’t need to use this null checking style. It’s more elegant to just use "initialized the first time this is called" style.

    static NeverDestroyed<RetainPtr<CTFontDescriptorRef>> descriptor = [] {
        // body of the function, ending with ...
        return adoptCF(CTFontDescriptorCreateWithAttributes(dictionary.get()));
    };
    return descriptor.get().get();

> Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp:103
> +    CTFontFallbackOption fallbackOption = kCTFontFallbackOptionNone;
> +    auto fallbackOptionNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &fallbackOption));

To make this obviously correct, since we are using kCFNumberSInt64Type, our local variable should be of type int64_t, not CTFontFallbackOption, even though that’s what we are storing there..

> Source/WebCore/platform/graphics/coretext/FontPlatformDataCoreText.cpp:107
> +    auto dictionary = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));

Should use std::size(keys) instead of WTF_ARRAY_LENGTH(keys).
Comment 3 Radar WebKit Bug Importer 2021-05-15 17:30:17 PDT
<rdar://problem/78066207>