Bug 125757

Summary: Subpixel layout: Rounding padding vales pushes the content 1px off.
Product: WebKit Reporter: alan baradlay <zalan>
Component: Layout and RenderingAssignee: alan baradlay <zalan>
Status: RESOLVED INVALID    
Severity: Normal CC: hyatt, jonlee, koivisto, 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
screenshot(wikipedia)
none
regressed test case (wikipedia)
none
Testing FF's rendering. none

alan baradlay
Reported 2013-12-15 12:22:46 PST
<html> <head> <style> body { font-size: 99%; padding-left: 0.5em; } </style> </head> <body>This line is pushed to left by 1px. (body's padding-left is 0.5em with font-size: 99%.)</body> </html>
Attachments
test case (205 bytes, text/html)
2013-12-15 12:23 PST, alan baradlay
no flags
screenshot(wikipedia) (304.78 KB, image/gif)
2013-12-19 17:00 PST, alan baradlay
no flags
regressed test case (wikipedia) (139 bytes, text/html)
2013-12-19 17:01 PST, alan baradlay
no flags
Testing FF's rendering. (118.77 KB, image/jpeg)
2014-01-14 15:06 PST, alan baradlay
no flags
alan baradlay
Comment 1 2013-12-15 12:23:50 PST
Created attachment 219279 [details] test case
alan baradlay
Comment 2 2013-12-15 12:26:19 PST
alan baradlay
Comment 3 2013-12-16 14:31:54 PST
This is the result of clamping float values at LayoutUnit(float) to int when minimumValueForLength() is called. computed minimum value: 6.8; subpixel on: LayoutUnit value -> 435 (which eventually gets pixelsnapped to 7px) subpixel off: LayoutUnit value -> 6 as the result of the clamping. It mainly (most visibly) effects paddings and margins, but it can push pixels off by 1 at other places too (like with text-indent, width properties) div { font-size: 99%; text-indent: 1em; } div { font-size: 99%; width: 1em; display: inline-block; }
Simon Fraser (smfr)
Comment 4 2013-12-18 11:26:11 PST
I think it's OK to have a behavior change with subpixel when authors are using percentages. We should check Firefox behavior.
alan baradlay
Comment 5 2013-12-19 17:00:45 PST
Created attachment 219704 [details] screenshot(wikipedia) Rounding these values would also regress some content including wikipedia. <html> <head> <style> div { margin-top: -1.4em; margin-bottom: 1.4em } </style> </head> <body> <div></div> foo </body> </html>
alan baradlay
Comment 6 2013-12-19 17:01:22 PST
Created attachment 219705 [details] regressed test case (wikipedia)
alan baradlay
Comment 7 2014-01-14 15:06:30 PST
Created attachment 221209 [details] Testing FF's rendering. The new off-by-one rendering matches FF's (v26.0) rendering. (top to bottom: subpixel on, FF, subpixel off)
Note You need to log in before you can comment on or make changes to this bug.