Antialias underlines if they're not axis-aligned
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Oct 2013 20:14:40 +0000 (20:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Oct 2013 20:14:40 +0000 (20:14 +0000)
commit449ada81fb49d083e6d455199c9ca2c869ee1e02
tree8978d24ad9a22ff89d2d7c62e146416f8252b827
parenta94f377a5d627d705779189f6b2b8271f896232a
Antialias underlines if they're not axis-aligned
https://bugs.webkit.org/show_bug.cgi?id=123004

Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2013-10-23
Reviewed by Simon Fraser.

Source/WebCore:

In order to make underlines crisp, GraphicsContext:drawLineForText
modifies the bounds of the underline rect in order to make the rect
device-pixel-aligned, and then turns off antialiasing when drawing
the line. This makes sense when the underline is axis-aligned, but
doesn't when the rect is rotated or skewed. Therefore, we should
only opt-in to this behavior if the underline we're about to draw
is axis-aligned. This requires figuring out whether or not the
current transformation is axis-aligned every time
GraphicsContext::drawLineForText is called, which will incur a small
performance hit. However, this is justified by underlines looking
much better (antialiased) when the context is rotated or skewed.

Tests: svg/custom/foreign-object-skew.html
       svg/zoom/page/zoom-foreignObject.html
       svg/zoom/text/zoom-foreignObject.html:

* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawLineForText):

LayoutTests:

Updating tests that draw underlines in a non-axis-aligned
GraphicsContext. The expected .png's should show an antialiased
underline. However, underlines which are axis-aligned should still
be unchanged.

* platform/mac/svg/custom/foreign-object-skew-expected.png:
* platform/mac/svg/zoom/page/zoom-foreignObject-expected.png:
* platform/mac/svg/zoom/text/zoom-foreignObject-expected.png:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/platform/mac/svg/custom/foreign-object-skew-expected.png
LayoutTests/platform/mac/svg/zoom/page/zoom-foreignObject-expected.png
LayoutTests/platform/mac/svg/zoom/text/zoom-foreignObject-expected.png
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp