RESOLVED FIXED Bug 233764
Make enum values consistent in ApplicationManifest::Icon::Purpose and _WKApplicationManifestIconPurpose
https://bugs.webkit.org/show_bug.cgi?id=233764
Summary Make enum values consistent in ApplicationManifest::Icon::Purpose and _WKAppl...
rginsberg
Reported 2021-12-02 09:54:24 PST
`Icon::Purpose` values are 1 (`1 << 0`), 2 (`1 << 1`), and 4 (`1 << 2`), but the default values for an enum are 0, 1, 2, which is used in `_WKApplicationManifestIcon`. This results in the purpose values being mis-translated in `_WKApplicationManifest`. In `WKApplicationManifest` an icon with the `purpose` set to `Any` in the manifest file, will have it's `purposes` set to `_WKApplicationManifestIconPurposeMonochrome`.
Attachments
Patch (2.02 KB, patch)
2021-12-02 10:56 PST, rginsberg
bfulgham: review-
Patch (1.88 KB, patch)
2021-12-02 15:11 PST, rginsberg
no flags
Radar WebKit Bug Importer
Comment 1 2021-12-02 09:54:45 PST
rginsberg
Comment 2 2021-12-02 10:56:22 PST
Brent Fulgham
Comment 3 2021-12-02 14:03:54 PST
Comment on attachment 445744 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=445744&action=review This looks fine, but I suggest following the model of the underling WebCore type and use the bitwise-shift to show the mask values. > Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h:46 > + _WKApplicationManifestIconPurposeAny = 1, We should follow the behavior of the WebCore::ApplicationManifest::Icon::Purpose enum: _WKApplicationManifestIconPurposeAny = (1 << 0), > Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h:47 > + _WKApplicationManifestIconPurposeMonochrome = 2, _WKApplicationManifestIconPurposeMonochrome = (1 << 1), > Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h:48 > + _WKApplicationManifestIconPurposeMaskable = 4, _WKApplicationManifestIconPurposeMaskable = (1 << 2),
rginsberg
Comment 4 2021-12-02 15:11:58 PST
rginsberg
Comment 5 2021-12-02 15:12:23 PST
(In reply to Brent Fulgham from comment #3) > Comment on attachment 445744 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=445744&action=review > > This looks fine, but I suggest following the model of the underling WebCore > type and use the bitwise-shift to show the mask values. > > > Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h:46 > > + _WKApplicationManifestIconPurposeAny = 1, > > We should follow the behavior of the > WebCore::ApplicationManifest::Icon::Purpose enum: > > _WKApplicationManifestIconPurposeAny = (1 << 0), > > > Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h:47 > > + _WKApplicationManifestIconPurposeMonochrome = 2, > > _WKApplicationManifestIconPurposeMonochrome = (1 << 1), > > > Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h:48 > > + _WKApplicationManifestIconPurposeMaskable = 4, > > _WKApplicationManifestIconPurposeMaskable = (1 << 2), Thanks! Just uploaded a patch that uses this model
Brent Fulgham
Comment 6 2021-12-02 15:16:26 PST
Comment on attachment 445778 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=445778&action=review r=me > Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h:48 > + _WKApplicationManifestIconPurposeMaskable = (1 << 2), Thank you for adjusting this!
Brent Fulgham
Comment 7 2021-12-02 15:16:49 PST
I'll cq+ this change once EWS finishes.
EWS
Comment 8 2021-12-02 17:42:23 PST
Committed r286470 (244810@main): <https://commits.webkit.org/244810@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 445778 [details].
Note You need to log in before you can comment on or make changes to this bug.