<rdar://problem/9018212> Underline thickness is not uniform under non-integral scale...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Apr 2011 22:15:32 +0000 (22:15 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Apr 2011 22:15:32 +0000 (22:15 +0000)
commitb2cbc02771838439e4719b42b77755863c613d34
tree1b2aecdf8eb2f715e5fd985aa9cb15f2a7b324df
parent11b92ba585f6ff97126388c48894cb1c1d866044
<rdar://problem/9018212> Underline thickness is not uniform under non-integral scale factor
https://bugs.webkit.org/show_bug.cgi?id=58083

Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/text/decorations-transformed.html

* platform/graphics/GraphicsContext.h: Added a RoundingMode enum with two values. RoundAllSides
is the existing rounding mode, where each side of the rectangle snaps to the nearest pixel
gridline. RoundOriginAndDimensions snaps the origin to the nearest pixel gridpoint and rounds
the width and the height. In this new mode, translating a rectangle in user space never changes
its dimensions in device pixels.
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::roundToDevicePixels): Implemented RoundOriginAndDimensions.
(WebCore::GraphicsContext::drawLineForText): Use RoundOriginAndDimensions, thus ensuring that
all underlines have the same thickness in device pixels.
* platform/graphics/openvg/GraphicsContextOpenVG.cpp:
(WebCore::GraphicsContext::roundToDevicePixels): Added RoundingMode parameter, but did not implement it.
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::roundToDevicePixels): Ditto.
* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::GraphicsContext::roundToDevicePixels): Ditto.
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::GraphicsContext::roundToDevicePixels): Ditto.
* platform/graphics/wx/GraphicsContextWx.cpp:
(WebCore::GraphicsContext::roundToDevicePixels): Ditto.
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintDecoration):

LayoutTests:

* fast/text/decorations-transformed.html: Added.
* platform/mac/fast/text/decorations-transformed-expected.checksum: Added.
* platform/mac/fast/text/decorations-transformed-expected.png: Added.
* platform/mac/fast/text/decorations-transformed-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/text/decorations-transformed.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/text/decorations-transformed-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/text/decorations-transformed-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/text/decorations-transformed-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp