RESOLVED FIXED 132770
[Mac] [iOS] Underlines are too low
https://bugs.webkit.org/show_bug.cgi?id=132770
Summary [Mac] [iOS] Underlines are too low
Myles C. Maxfield
Reported 2014-05-09 22:47:32 PDT
[Mac] [iOS] Underlines are too low
Attachments
Patch (7.33 KB, patch)
2014-05-09 22:50 PDT, Myles C. Maxfield
darin: review+
Myles C. Maxfield
Comment 1 2014-05-09 22:50:10 PDT
Myles C. Maxfield
Comment 2 2014-05-09 22:54:55 PDT
Darin Adler
Comment 3 2014-05-10 11:37:09 PDT
Comment on attachment 231215 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=231215&action=review > Source/WebCore/rendering/InlineTextBox.cpp:1015 > + float textDecorationThickness = roundf(fontSizeScaling); Seems really strange to “round a scaling”; why do strokes need to be integers? Wouldn’t the pixel ratio have something to do with the rounding we want to do, rather than just integer boundaries. Rationale might be helpful. Is it really OK to round the thickness down to 0 if the font size is <1/2 the size of the text decoration base font size? I think getting rid of the fontSizeScaling local would be helpful, since it would be incorrect to use that value in the code below.
zalan
Comment 4 2014-05-10 11:46:52 PDT
(In reply to comment #3) > (From update of attachment 231215 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=231215&action=review > > > Source/WebCore/rendering/InlineTextBox.cpp:1015 > > + float textDecorationThickness = roundf(fontSizeScaling); > > Seems really strange to “round a scaling”; why do strokes need to be integers? Wouldn’t the pixel ratio have something to do with the rounding we want to do, rather than just integer boundaries. Rationale might be helpful. Agree, integral rounding at painting time needs strong justification.
Myles C. Maxfield
Comment 5 2014-05-11 10:17:31 PDT
*** Bug 132722 has been marked as a duplicate of this bug. ***
Myles C. Maxfield
Comment 6 2014-05-11 10:22:52 PDT
Comment on attachment 231215 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=231215&action=review >>> Source/WebCore/rendering/InlineTextBox.cpp:1015 >>> + float textDecorationThickness = roundf(fontSizeScaling); >> >> Seems really strange to “round a scaling”; why do strokes need to be integers? Wouldn’t the pixel ratio have something to do with the rounding we want to do, rather than just integer boundaries. Rationale might be helpful. >> >> Is it really OK to round the thickness down to 0 if the font size is <1/2 the size of the text decoration base font size? >> >> I think getting rid of the fontSizeScaling local would be helpful, since it would be incorrect to use that value in the code below. > > Agree, integral rounding at painting time needs strong justification. Done. I was keeping the roundf() from above, but I think the two of you are right.
Myles C. Maxfield
Comment 7 2014-05-11 10:36:54 PDT
Darin Adler
Comment 8 2014-05-11 10:42:12 PDT
While the roundf is probably not right, removing it could have big effects; we might start drawing anti-aliased grey underlines that don’t look good where before we would be rounding up or down and drawing much-different-looking black underlines. We need to follow up with plenty of testing.
zalan
Comment 9 2014-05-11 11:56:42 PDT
(In reply to comment #7) > https://trac.webkit.org/changeset/168599 +float textDecorationThickness = renderer().style().fontSize() / textDecorationBaseFontSize; This should be pixel snapped to avoid lines like 1.6px -to not to produce anti-aliased lines. +FloatPoint deviceOrigin = FloatPoint(roundf(devicePoint.x()), ceilf(devicePoint.y())); This is integral rounding, so it will most likely end up snapping to wrong coordinates in certain edge cases. I think we should not round in this function at all and the caller (or where we have the context of the rounding strategy) should do the snapping instead.
Myles C. Maxfield
Comment 10 2014-05-13 14:33:47 PDT
(In reply to comment #9) > (In reply to comment #7) > > https://trac.webkit.org/changeset/168599 > +float textDecorationThickness = renderer().style().fontSize() / textDecorationBaseFontSize; > This should be pixel snapped to avoid lines like 1.6px -to not to produce anti-aliased lines. > > +FloatPoint deviceOrigin = FloatPoint(roundf(devicePoint.x()), ceilf(devicePoint.y())); > This is integral rounding, so it will most likely end up snapping to wrong coordinates in certain edge cases. I think we should not round in this function at all and the caller (or where we have the context of the rounding strategy) should do the snapping instead. <rdar://problem/16903502>
Myles C. Maxfield
Comment 11 2014-05-14 12:10:16 PDT
(In reply to comment #10) > (In reply to comment #9) > > (In reply to comment #7) > > > https://trac.webkit.org/changeset/168599 > > +float textDecorationThickness = renderer().style().fontSize() / textDecorationBaseFontSize; > > This should be pixel snapped to avoid lines like 1.6px -to not to produce anti-aliased lines. > > > > +FloatPoint deviceOrigin = FloatPoint(roundf(devicePoint.x()), ceilf(devicePoint.y())); > > This is integral rounding, so it will most likely end up snapping to wrong coordinates in certain edge cases. I think we should not round in this function at all and the caller (or where we have the context of the rounding strategy) should do the snapping instead. > > <rdar://problem/16903502> I confused the Radar Bug Importer with my last comment. The new radar I filed for moving the pixel-snapping code is at <rdar://problem/16903502> <rdar://problem/16364632>
Myles C. Maxfield
Comment 12 2014-05-19 17:26:41 PDT
Note You need to log in before you can comment on or make changes to this bug.