Space between double underlines does not scale with font size
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Mar 2014 23:49:27 +0000 (23:49 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Mar 2014 23:49:27 +0000 (23:49 +0000)
commit03fa0ca4b48c69094ba6bf728bc3b041b85f8b87
tree894a8028cff8fab54747b63bbdd3a8faad123fdf
parentb12e428d532c21cb1937d89bf55d00fad32fe630
Space between double underlines does not scale with font size
https://bugs.webkit.org/show_bug.cgi?id=129521

Reviewed by Simon Fraser.

Source/WebCore:

This patch moves the logic about how far to draw the second underline (when text-decoration-style: double
is specified) from InlineTextBox to GraphicsContext, because GraphicsContext is the authoritative source
about how thick underlines should be. The space between the two underlines is set to the thickness of
each of the underlines.

This patch also deletes some unused code in InlineTextBox that was never getting triggered, in addition
to unifying drawLineForText with drawLinesForText. This didn't have any performance impact in my testing.

Test: fast/css3-text/css3-text-decoration/text-decoration-style-double-space-scales.html

* platform/graphics/GraphicsContext.h: drawLineForText takes a boolean for if we should draw double
underlines.
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawLineForText):
(WebCore::GraphicsContext::drawLinesForText):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawLineForText):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::GraphicsContext::drawLineForText):
* rendering/InlineTextBox.cpp: Use new boolean argument
(WebCore::drawSkipInkUnderline):
(WebCore::InlineTextBox::paintDecoration):

LayoutTests:

This test renders large text with a double underline, but then barely clips off the bottom underline
using overflow: hidden. It makes sure that this is exactly the same as a single underline. If the
space between the two underlines does not scale with font size, it will appear as though there is a
single thick underline (because they will be drawn on top of each other) and will thus fail this test.

* fast/css3-text/css3-text-decoration/text-decoration-style-double-space-scales-expected.html: Added.
* fast/css3-text/css3-text-decoration/text-decoration-style-double-space-scales.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-style-double-space-scales-expected.html [new file with mode: 0644]
LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-style-double-space-scales.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
Source/WebCore/rendering/InlineTextBox.cpp