Title: [157948] trunk
- Revision
- 157948
- Author
- [email protected]
- Date
- 2013-10-24 12:53:35 -0700 (Thu, 24 Oct 2013)
Log Message
Gaps between underlines in adjacent underlined text runs
https://bugs.webkit.org/show_bug.cgi?id=123236
Patch by Myles C. Maxfield <[email protected]> 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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (157947 => 157948)
--- trunk/LayoutTests/ChangeLog 2013-10-24 19:39:46 UTC (rev 157947)
+++ trunk/LayoutTests/ChangeLog 2013-10-24 19:53:35 UTC (rev 157948)
@@ -1,3 +1,19 @@
+2013-10-24 Myles C. Maxfield <[email protected]>
+
+ Gaps between underlines in adjacent underlined text runs
+ https://bugs.webkit.org/show_bug.cgi?id=123236
+
+ Reviewed by Simon Fraser and Darin Adler.
+
+ 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.
+
2013-10-24 Joseph Pecoraro <[email protected]>
Fix unnecessary alerted value leaking into another test.
Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes-expected.html (0 => 157948)
--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes-expected.html 2013-10-24 19:53:35 UTC (rev 157948)
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+</head>
+<body>
+<p>
+This test makes sure that math is being performed before rounding occurs.
+In the following run, the "aa" has a fractional x-coordinate value of
+between .3 and .5. In addition that run's width also has this property.
+If you round the x-coordinate and width before you add them together to
+get the coordinate of the right-side of the run, you would see that the
+run is a pixel shorter than it should be.
+</p>
+<u>aaaa</u> <u>aaaaa</u>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes.html (0 => 157948)
--- trunk/LayoutTests/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes.html (rev 0)
+++ trunk/LayoutTests/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes.html 2013-10-24 19:53:35 UTC (rev 157948)
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+</head>
+<body>
+<p>
+This test makes sure that math is being performed before rounding occurs.
+In the following run, the "aa" has a fractional x-coordinate value of
+between .3 and .5. In addition that run's width also has this property.
+If you round the x-coordinate and width before you add them together to
+get the coordinate of the right-side of the run, you would see that the
+run is a pixel shorter than it should be.
+</p>
+<u>aaaa</u> <u>aa</u><u>aaa</u>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (157947 => 157948)
--- trunk/Source/WebCore/ChangeLog 2013-10-24 19:39:46 UTC (rev 157947)
+++ trunk/Source/WebCore/ChangeLog 2013-10-24 19:53:35 UTC (rev 157948)
@@ -1,3 +1,32 @@
+2013-10-24 Myles C. Maxfield <[email protected]>
+
+ Gaps between underlines in adjacent underlined text runs
+ https://bugs.webkit.org/show_bug.cgi?id=123236
+
+ Reviewed by Simon Fraser and Darin Adler.
+
+ 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
+
2013-10-24 Andreas Kling <[email protected]>
SVGRenderingContext should wrap a RenderElement.
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (157947 => 157948)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2013-10-24 19:39:46 UTC (rev 157947)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2013-10-24 19:53:35 UTC (rev 157948)
@@ -1261,7 +1261,7 @@
// We try to round all parameters to integer boundaries in device space. If rounding pixels in device space
// makes our thickness more than double, then there must be a shrinking-scale factor and rounding to pixels
// in device space will make the underlines too thick.
- CGRect lineRect = roundToDevicePixels(FloatRect(x, y, lineLength, adjustedThickness), RoundOriginAndDimensions);
+ CGRect lineRect = roundToDevicePixels(FloatRect(x, y, lineLength, adjustedThickness), RoundAllSides);
if (lineRect.size.height < thickness * 2.0) {
x = lineRect.origin.x;
y = lineRect.origin.y;
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (157947 => 157948)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2013-10-24 19:39:46 UTC (rev 157947)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2013-10-24 19:53:35 UTC (rev 157948)
@@ -530,7 +530,7 @@
FloatPoint boxOrigin = locationIncludingFlipping();
boxOrigin.move(adjustedPaintOffset.x(), adjustedPaintOffset.y());
- FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), logicalHeight()));
+ FloatRect boxRect(boxOrigin, FloatSize(logicalWidth(), logicalHeight()));
RenderCombineText* combinedText = lineStyle.hasTextCombine() && renderer().isCombineText() && toRenderCombineText(renderer()).isCombined() ? &toRenderCombineText(renderer()) : 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes