REGRESSION (r230930): Link drag image is very blurry
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jun 2018 18:20:44 +0000 (18:20 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jun 2018 18:20:44 +0000 (18:20 +0000)
commitd948cea0bdb67a1b6dd3061fec7ed9af6f0afd32
tree9b06febfd36eb50b7e4e00a698580d40855dfe3e
parent1abe2a1ec62001fd0a00d06271cc79e5a1910545
REGRESSION (r230930): Link drag image is very blurry
https://bugs.webkit.org/show_bug.cgi?id=186435
<rdar://problem/40797202>

Reviewed by Tim Horton.

Source/WebCore:

Tell NSImage the proper display scale factor it needs when performing a 'lockFocus' by passing
the correct scaling transform as an NSImageHintCTM.

I reviewed the other drag operations (selection, image, and attachment) and confirmed through
manual testing that these operations already properly scale the images. It appears that links
were the only place where we relied on NSImage to determine and use the relevant device scale
factor.

* SourcesCocoa.txt: Add new WebKitNSImageExtras.mm file.
* WebCore.xcodeproj/project.pbxproj: Update for new files.
* platform/graphics/mac/WebKitNSImageExtras.h: Added.
* platform/graphics/mac/WebKitNSImageExtras.mm: Added.
(-[NSImage _web_lockFocusWithTransform:]): Helper method that takes a device scale factor, creates the
relevant scaling NSAffineTransform and passes it to the internal NSImage 'lockFocusWithRect' as the
NSImageHintCTM hint.
* platform/mac/DragImageMac.mm:
(WebCore::createDragImageForLink): Use the new helper function.

Source/WebCore/PAL:

Add the necessary NSImage SPI to our SPI headers.

* PAL.xcodeproj/project.pbxproj:
* pal/spi/mac/NSImageSPI.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232628 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
Source/WebCore/PAL/pal/spi/mac/NSImageSPI.h [new file with mode: 0644]
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/graphics/mac/WebKitNSImageExtras.h [new file with mode: 0644]
Source/WebCore/platform/graphics/mac/WebKitNSImageExtras.mm [new file with mode: 0644]
Source/WebCore/platform/mac/DragImageMac.mm