Bug 230792 - base-palette can accept "light" or "dark"
Summary: base-palette can accept "light" or "dark"
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on: 230800 231029
Blocks: 230446
  Show dependency treegraph
 
Reported: 2021-09-25 03:42 PDT by Myles C. Maxfield
Modified: 2021-10-01 14:01 PDT (History)
11 users (show)

See Also:


Attachments
Patch to make FontCreationContext optional (36.94 KB, patch)
2021-09-25 15:05 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch to implement light/dark (15.48 KB, patch)
2021-09-25 15:05 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (18.63 KB, patch)
2021-09-25 18:25 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (19.45 KB, patch)
2021-09-28 22:32 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Test font (5.56 KB, application/zip)
2021-09-29 11:52 PDT, Myles C. Maxfield
no flags Details
Patch (111.49 KB, patch)
2021-09-30 11:55 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (111.56 KB, patch)
2021-09-30 17:39 PDT, Myles C. Maxfield
simon.fraser: review+
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-09-25 03:42:11 PDT
-
Comment 1 Radar WebKit Bug Importer 2021-09-25 03:43:08 PDT
<rdar://problem/83530228>
Comment 3 Myles C. Maxfield 2021-09-25 15:05:05 PDT
Created attachment 439273 [details]
Patch to make FontCreationContext optional
Comment 4 Myles C. Maxfield 2021-09-25 15:05:32 PDT
Created attachment 439274 [details]
Patch to implement light/dark
Comment 5 Myles C. Maxfield 2021-09-25 18:07:27 PDT
Comment on attachment 439273 [details]
Patch to make FontCreationContext optional

The FontCreationContext work is moved to https://bugs.webkit.org/show_bug.cgi?id=230800
Comment 6 Myles C. Maxfield 2021-09-25 18:25:42 PDT
Created attachment 439279 [details]
Patch

EWS will be red because this patch depends on https://bugs.webkit.org/show_bug.cgi?id=230800.
Comment 7 Myles C. Maxfield 2021-09-25 18:31:36 PDT
This patch needs tests.
Comment 8 Myles C. Maxfield 2021-09-28 22:32:12 PDT
Created attachment 439566 [details]
Patch
Comment 9 Myles C. Maxfield 2021-09-29 11:52:53 PDT
Created attachment 439636 [details]
Test font
Comment 10 Myles C. Maxfield 2021-09-30 11:55:04 PDT
Created attachment 439763 [details]
Patch
Comment 11 EWS Watchlist 2021-09-30 11:56:33 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 12 Myles C. Maxfield 2021-09-30 17:27:15 PDT
Comment on attachment 439763 [details]
Patch

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

> LayoutTests/imported/w3c/ChangeLog:9
> +        I will open a WPT PR for these posthaste.

https://github.com/web-platform-tests/wpt/pull/31044
Comment 13 Myles C. Maxfield 2021-09-30 17:39:58 PDT
Created attachment 439805 [details]
Patch
Comment 14 Simon Fraser (smfr) 2021-10-01 12:59:56 PDT
Comment on attachment 439805 [details]
Patch

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

> Source/WebCore/ChangeLog:26
> +            int64_t integer;

Does the spec require these be 64-bit?

> Source/WebCore/platform/graphics/FontPaletteValues.h:40
> +    FontPaletteIndex()

= default

> Source/WebCore/platform/graphics/FontPaletteValues.h:83
> +    enum class Type {

: uint8_t ?

> Source/WebCore/platform/graphics/FontPaletteValues.h:88
> +    } type { Type::String };

I like to use 'const' for members that can only ever be set in the constructor.

> Source/WebCore/platform/graphics/FontPaletteValues.h:90
> +    unsigned integer { 0 };

You had int64_t in the changelog

> Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:472
> +        int64_t rawIndex = basePalette.integer; // There is no kCFNumberUIntType.
> +        auto number = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &rawIndex));
> +        CFDictionaryAddValue(attributes, kCTFontPaletteAttribute, number.get());

Can author-supplied values conflict with kCTFontPaletteLight, kCTFontPaletteDark?
Comment 15 Myles C. Maxfield 2021-10-01 13:06:41 PDT
Comment on attachment 439805 [details]
Patch

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

>> Source/WebCore/ChangeLog:26
>> +            int64_t integer;
> 
> Does the spec require these be 64-bit?

Nope. In fact, our parser clamps to 32-bit. I'll update the changelog to be "unsigned" to match the implementation.

>> Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:472
>> +        CFDictionaryAddValue(attributes, kCTFontPaletteAttribute, number.get());
> 
> Can author-supplied values conflict with kCTFontPaletteLight, kCTFontPaletteDark?

It depends if https://github.com/w3c/csswg-drafts/issues/6627 is accepted or not. If it's accepted (which I hope it is), there won't be a collision.
Comment 16 Myles C. Maxfield 2021-10-01 13:37:33 PDT
Comment on attachment 439805 [details]
Patch

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

>> Source/WebCore/platform/graphics/FontPaletteValues.h:88
>> +    } type { Type::String };
> 
> I like to use 'const' for members that can only ever be set in the constructor.

It looks like that, because this is used as a key in a hash map, and our hash map infrastructure uses operator= to overwrite the buckets in the table, all the fields have to be assignable. :(
Comment 17 Myles C. Maxfield 2021-10-01 14:01:00 PDT
Committed r283398 (242402@main): <https://commits.webkit.org/242402@main>