Skip to content

Commit 5f18c2a

Browse files
committed
REGRESSION: File attachment icons appear upside down
https://bugs.webkit.org/show_bug.cgi?id=248910 rdar://103089779 Reviewed by Simon Fraser. Prior to WebKit#4954, attachment icons on macOS were flipped in `IconMac` to preserve the correct orientation, however this change removed that behavior in its refactoring. This PR fixes this by adding back the flipping behavior where its needed for attachemnts, which is in `RenderThemeMac::iconForAttachment`. * Source/WebCore/rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::iconForAttachment): Canonical link: https://commits.webkit.org/257524@main
1 parent f01451c commit 5f18c2a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Source/WebCore/rendering/RenderThemeMac.mm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,8 +2369,14 @@ static void TrackGradientInterpolate(void*, const CGFloat* inData, CGFloat* outD
23692369
if (fileName.isNull() && attachmentType.isNull() && title.isNull())
23702370
return nil;
23712371

2372-
if (auto icon = WebCore::iconForAttachment(fileName, attachmentType, title))
2373-
return adoptNS([[NSImage alloc] initWithCGImage:icon->image()->platformImage().get() size:NSZeroSize]);
2372+
if (auto icon = WebCore::iconForAttachment(fileName, attachmentType, title)) {
2373+
auto imageForIcon = adoptNS([[NSImage alloc] initWithCGImage:icon->image()->platformImage().get() size:NSZeroSize]);
2374+
// Need this because WebCore uses AppKit's flipped coordinate system exclusively.
2375+
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
2376+
[imageForIcon setFlipped:YES];
2377+
ALLOW_DEPRECATED_DECLARATIONS_END
2378+
return imageForIcon;
2379+
}
23742380

23752381
return nil;
23762382
}

0 commit comments

Comments
 (0)