Bug 123236 - Gaps between underlines in adjacent underlined text runs
Summary: Gaps between underlines in adjacent underlined text runs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
: 123234 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-10-23 17:06 PDT by Myles C. Maxfield
Modified: 2013-10-24 12:51 PDT (History)
10 users (show)

See Also:


Attachments
Patch (11.50 KB, patch)
2013-10-23 17:39 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (6.61 KB, patch)
2013-10-24 12:05 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (6.60 KB, patch)
2013-10-24 12:16 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (6.70 KB, patch)
2013-10-24 12:25 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2013-10-23 17:06:46 PDT
Don't round horizontal underline extents
Comment 1 Myles C. Maxfield 2013-10-23 17:39:10 PDT
Created attachment 215013 [details]
Patch
Comment 2 Myles C. Maxfield 2013-10-23 17:39:53 PDT
*** Bug 123234 has been marked as a duplicate of this bug. ***
Comment 3 Radar WebKit Bug Importer 2013-10-23 17:40:57 PDT
<rdar://problem/15305380>
Comment 4 Darin Adler 2013-10-23 23:40:16 PDT
Comment on attachment 215013 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=215013&action=review

Looks like a good fix.

> Source/WebCore/ChangeLog:27
> +        There are two pieces to this change. The first piece is in
> +        InlineTextBox::paint(). When we were computing the bounding
> +        box for the InlineTextBox, we were putting the floating-point
> +        extents we received from the InlineBox into a LayoutSize. If
> +        a LayoutSize were fixed-point with sufficient precision, this
> +        would be okay, but right now a LayoutSize is simply an int,
> +        meaning that we were clamping the underline boundaries to
> +        integral values. Instead, we should be using the same unit
> +        throughout all of this code, which means that the bounding
> +        box should use floats instead.
> +
> +        In addition, inside GraphicsContext::drawLineForText(), we are
> +        rounding the underline to pixel boundaries so that it appears
> +        very crisp on the screen. However, this does not play well with
> +        these fractional underline extents. We should change the
> +        rounding mode to perform floating point addition before rounding,
> +        rather than rounding position and width before adding them
> +        together. Note that this will not blend the pixel in question
> +        between two colors; instead, whichever run contains the center
> +        of the disputed pixel will win.

Next time, please write a much smaller comment, and do it per-function.

> Source/WebCore/ChangeLog:32
> +        (WebCore::GraphicsContext::drawLineForText): Second part (See above)

I would say something like: “Round each end of the underline to a pixel boundary.”

> Source/WebCore/ChangeLog:34
> +        (WebCore::InlineTextBox::paint): First part (See above)

I would say something like: “Don’t convert to a LayoutSize just to convert to a FloatSize.”

> LayoutTests/ChangeLog:14
> +        This test contains two adjacent text runs. The first one has a
> +        x-position of 21.3 with a width of 44.4. The second one has a
> +        x-position of (21.3 + 44.4 =) 65.7. If we naively rounded these
> +        to pixel coordinates, the left run would be rounded to a
> +        x-position of 21 with a width of 44, so it would extend to pixel
> +        65. However, the next run's x-position would be rounded to 66,
> +        so there is a single pixel gap between the supposedly adjacent run.
> +        This test makes sure that the above scenerio does not occur,
> +        and that this "gap" pixel is filled in.

This comment is also too long, and more importantly, it would be much more appropriate in the test rather than in the change log.

> LayoutTests/ChangeLog:17
> +        * platform/mac/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes-expected.png: Added.

Could we make this a reference test somehow? Maybe use a canvas to draw the underline?
Comment 5 WebKit Commit Bot 2013-10-23 23:41:19 PDT
Comment on attachment 215013 [details]
Patch

Rejecting attachment 215013 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-01', 'validate-changelog', '--check-oops', '--non-interactive', 215013, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

/Volumes/Data/EWS/WebKit/LayoutTests/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).

Full output: http://webkit-queues.appspot.com/results/11168023
Comment 6 Simon Fraser (smfr) 2013-10-24 11:13:36 PDT
Comment on attachment 215013 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=215013&action=review

> Source/WebCore/ChangeLog:3
> +        Don't round horizontal underline extents

This actually doesn't describe the user-visible symptom (underline gaps).

>> LayoutTests/ChangeLog:17
>> +        * platform/mac/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes-expected.png: Added.
> 
> Could we make this a reference test somehow? Maybe use a canvas to draw the underline?

Agreed, I don't think a ref test would be hard.
Comment 7 Myles C. Maxfield 2013-10-24 12:02:53 PDT
Comment on attachment 215013 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=215013&action=review

>> Source/WebCore/ChangeLog:3
>> +        Don't round horizontal underline extents
> 
> This actually doesn't describe the user-visible symptom (underline gaps).

Done.

>> Source/WebCore/ChangeLog:27
>> +        of the disputed pixel will win.
> 
> Next time, please write a much smaller comment, and do it per-function.

I'm not quite sure what you mean by "per-function", but I made it smaller. Do you mean that I should move it below after the bullet points?

>> Source/WebCore/ChangeLog:32
>> +        (WebCore::GraphicsContext::drawLineForText): Second part (See above)
> 
> I would say something like: “Round each end of the underline to a pixel boundary.”

Done.

>> Source/WebCore/ChangeLog:34
>> +        (WebCore::InlineTextBox::paint): First part (See above)
> 
> I would say something like: “Don’t convert to a LayoutSize just to convert to a FloatSize.”

Done.

>> LayoutTests/ChangeLog:14
>> +        and that this "gap" pixel is filled in.
> 
> This comment is also too long, and more importantly, it would be much more appropriate in the test rather than in the change log.

Done.

>>> LayoutTests/ChangeLog:17
>>> +        * platform/mac/fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes-expected.png: Added.
>> 
>> Could we make this a reference test somehow? Maybe use a canvas to draw the underline?
> 
> Agreed, I don't think a ref test would be hard.

Done.
Comment 8 Myles C. Maxfield 2013-10-24 12:05:02 PDT
Created attachment 215089 [details]
Patch
Comment 9 Simon Fraser (smfr) 2013-10-24 12:12:34 PDT
Comment on attachment 215089 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=215089&action=review

> Source/WebCore/ChangeLog:4
> +        Fill in gaps in underlines between adjacent text runs
> +        https://bugs.webkit.org/show_bug.cgi?id=123236

Bug titles should describe problems, not fixes. "Gaps between adjacent underlined text runs"

> LayoutTests/ChangeLog:3
> +        Don't round horizontal underline extents

Still wrong.
Comment 10 Myles C. Maxfield 2013-10-24 12:16:10 PDT
Created attachment 215092 [details]
Patch
Comment 11 WebKit Commit Bot 2013-10-24 12:21:39 PDT
Comment on attachment 215092 [details]
Patch

Rejecting attachment 215092 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-02', 'validate-changelog', '--check-oops', '--non-interactive', 215092, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

/Volumes/Data/EWS/WebKit/LayoutTests/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).

Full output: http://webkit-queues.appspot.com/results/10218151
Comment 12 Myles C. Maxfield 2013-10-24 12:25:27 PDT
Created attachment 215094 [details]
Patch
Comment 13 Simon Fraser (smfr) 2013-10-24 12:26:43 PDT
Comment on attachment 215094 [details]
Patch

Perfect.
Comment 14 Myles C. Maxfield 2013-10-24 12:32:04 PDT
\o/
Comment 15 WebKit Commit Bot 2013-10-24 12:51:53 PDT
Comment on attachment 215094 [details]
Patch

Clearing flags on attachment: 215094

Committed r157948: <http://trac.webkit.org/changeset/157948>
Comment 16 WebKit Commit Bot 2013-10-24 12:51:57 PDT
All reviewed patches have been landed.  Closing bug.