Bug 293778
| Summary: | Refactor RenderThemeMac::iconForAttachment to return the same data as RenderThemeIOS (i.e., image as well as its size) | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Brent Fulgham <bfulgham> |
| Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Brent Fulgham
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Brent Fulgham
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
<rdar://problem/152281297>
Brent Fulgham
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
Pull request: https://github.com/WebKit/WebKit/pull/46092
EWS
Committed 295710@main (422447d43000): <https://commits.webkit.org/295710@main>
Reviewed commits have been landed. Closing PR #46092 and removing active labels.