Bug 125963

Summary: Subpixel layout: RenderLineBreak/RenderInline/RenderBlock::baselinePosition return value needs flooring (apple.com).
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED INVALID    
Severity: Normal CC: hyatt, jonlee, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 126283    
Attachments:
Description Flags
test case
none
screenshots
none
screenshot (apple.com)
none
test case (apple.com) none

zalan
Reported 2013-12-18 16:44:29 PST
Created attachment 219589 [details] test case In RenderBlock::baselinePosition the baseline value is calculated as follows: font baseline + (lineHeight - fontHeight)/2 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; The font metric values are CSS pixel values, lineHeight() returns LayoutUnit. While calculating the baseline, the CSS pixel values (font metrics) get converted to layout units and at the end the result gets floored to CSS pixel value (return value). The floored return value can end up being different, if the /2 operation results in a negative value with fraction. subpixel on: ascent: 9px + offset: -0.5px = 8.5px -> 8px subpixel off: ascent: 9px + offset: -0.5px -> 0px = 9px observed on cnn.com
Attachments
test case (152 bytes, text/html)
2013-12-18 16:44 PST, zalan
no flags
screenshots (293.13 KB, image/gif)
2013-12-18 19:36 PST, zalan
no flags
screenshot (apple.com) (277.08 KB, image/gif)
2013-12-19 15:35 PST, zalan
no flags
test case (apple.com) (273 bytes, text/html)
2013-12-19 15:53 PST, zalan
no flags
zalan
Comment 1 2013-12-18 16:46:32 PST
zalan
Comment 2 2013-12-18 19:36:14 PST
Created attachment 219605 [details] screenshots adding anim gif to demonstrate the off-by-one rendering.
zalan
Comment 3 2013-12-19 15:35:00 PST
Created attachment 219692 [details] screenshot (apple.com) RenderInline::baselinePosition has the exact same calculation as RenderBlock and the missing rounding shows up on apple.com (screenshot attached)
zalan
Comment 4 2013-12-19 15:53:07 PST
Created attachment 219694 [details] test case (apple.com)
zalan
Comment 5 2013-12-23 13:38:45 PST
And by flooring, I meant bias vertical centering similar to bug 101848
zalan
Comment 6 2014-01-15 10:34:42 PST
The current subpixel rendering is closer to FF's rendering than it would be with the rounding (supbixel off in practice)
Note You need to log in before you can comment on or make changes to this bug.