Gaps between underlines in adjacent underlined text runs
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Oct 2013 19:53:35 +0000 (19:53 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Oct 2013 19:53:35 +0000 (19:53 +0000)
commita20bb3d084b863049fa06ba59e57ccd70879f217
treeec27863f89b0a9e7df8d1987ed129a6091348d68
parent672072d6c93a4ca1f6424ee9883dd54e453ee72b
Gaps between underlines in adjacent underlined text runs
https://bugs.webkit.org/show_bug.cgi?id=123236

Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2013-10-24
Reviewed by Simon Fraser and Darin Adler.

Source/WebCore:

There are two pieces to this change. The first piece is in
InlineTextBox::paint(). We were putting floating-point
extents into a LayoutSize, which simply uses ints (for now),
and then immediately converting this back to a FloatSize.
Instead, we should be using floats throughout all of
this code.

In addition, inside GraphicsContext::drawLineForText(), we are
rounding the underline to pixel boundaries so that it appears
very crisp on the screen. However, we should round once after
performing computations, rather than rounding twice and then
performing computations on the rounded numbers.

Test: fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes.html

* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawLineForText): Change rounding mode
    to perform computations before rounding
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint): Don't convert to a LayoutSize
    just to convert to a FloatSize

LayoutTests:

Added a test that checks that we have accurate precision in our
floating-point computations. We should perform calculations before
rounding, instead of rouding twice and performing calculations on
the rounded values.

* fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes.html: Added.
* platform/mac/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes-expected.png: Added.
* platform/mac/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157948 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/rendering/InlineTextBox.cpp