[OS X] Text dilation parameters are not restored after being set
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 May 2015 23:25:41 +0000 (23:25 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 May 2015 23:25:41 +0000 (23:25 +0000)
commit26fdeb30382a3f4049b52e428890e230a3e345cf
tree58214b26032658065baa7903ebe1942588f08fbf
parent22b1cc1931d501473d3f3e326b018eae72e24c39
[OS X] Text dilation parameters are not restored after being set
https://bugs.webkit.org/show_bug.cgi?id=144507
<rdar://problem/19446938>

Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2015-05-01
Reviewed by Simon Fraser and Ned Holbrook.

Source/WebCore:

Create a RAII class who is in charge of saving, applying, and restoring dilation parameters. Use this class
around our text drawing routines.

Note that this migrates our use of CTFontSetRenderingParameters() to CTFontSetRenderingStyle().

Test: fast/text/dilation-save-restore.html

* platform/graphics/cocoa/FontCascadeCocoa.mm:
(WebCore::RenderingStyleSaver::RenderingStyleSaver):
(WebCore::RenderingStyleSaver::~RenderingStyleSaver):
(WebCore::showGlyphsWithAdvances):
* platform/spi/cg/CoreGraphicsSPI.h:
* platform/spi/cocoa/CoreTextSPI.h:

LayoutTests:

See below.

* fast/text/dilation-save-restore-expected.html: Added. Never sets dilation parameters, draws two strings.
* fast/text/dilation-save-restore.html: Added. Draws one string without dilation, sets the dilation, then draws a
second string. If saving and restoring doesn't work correctly, these two lines will appear different.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/text/dilation-save-restore-expected.html [new file with mode: 0644]
LayoutTests/fast/text/dilation-save-restore.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm
Source/WebCore/platform/spi/cg/CoreGraphicsSPI.h
Source/WebCore/platform/spi/cocoa/CoreTextSPI.h