RESOLVED FIXED293778
Refactor RenderThemeMac::iconForAttachment to return the same data as RenderThemeIOS (i.e., image as well as its size)
https://bugs.webkit.org/show_bug.cgi?id=293778
Summary Refactor RenderThemeMac::iconForAttachment to return the same data as RenderT...
Brent Fulgham
Reported 2025-05-29 17:20:30 PDT
As noted in Bug 242269 (and associated rdar://96315732), the return types for `iconForAttachment` differs for the iOS and macOS implementations. This is confusing/ Modify the macOS implementation to have the same behavior as iOS so we can reduce the amount of #if/def code elsewhere.
Attachments
Brent Fulgham
Comment 1 2025-05-29 17:30:53 PDT
iOS Code: struct IconAndSize { RetainPtr<UIImage> icon; FloatSize size; }; RenderThemeIOS::IconAndSize RenderThemeIOS::iconForAttachment(const String& fileName, const String& attachmentType, const String& title) macOS Code: RetainPtr<NSImage> RenderThemeMac::iconForAttachment(const String& fileName, const String& attachmentType, const String& title)
Radar WebKit Bug Importer
Comment 2 2025-05-29 17:34:26 PDT
Brent Fulgham
Comment 3 2025-05-29 17:35:54 PDT
A good refactor would do the following: 1. Move the `IconAndSize` struct from RenderThemeIOS.h to RenderThemeCocoa.h 2. Use #if/def in RenderThemeCocoa.h so that we have the right image type for each platform. #if PLATFORM(IOS_FAMILY) RetainPtr<UIImage> image; #else RetainPtr<NSImage> image; #endif 3. Modify the two classes to use this new uniform data type. 4. Update the macOS implementation to return the image + its size, just like the iOS one does.
Ian Gower
Comment 4 2025-05-30 12:50:29 PDT
EWS
Comment 5 2025-06-02 13:43:41 PDT
Committed 295710@main (422447d43000): <https://commits.webkit.org/295710@main> Reviewed commits have been landed. Closing PR #46092 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.