W3C home > Mailing lists > Public > public-css-testsuite@w3.org > June 2011

[RC6] units-001, units-004 and units-005 invalid: fractional pixel problem

From: Gérard Talbot <css21testsuite@gtalbot.org>
Date: Tue, 21 Jun 2011 14:28:49 -0700
Message-ID: <640d25c1295ddbcdd57c37bfc3d9bd1d.squirrel@cp3.shieldhost.com>
To: "Public CSS test suite mailing list" <public-css-testsuite@w3.org>
Hello,


http://test.csswg.org/suites/css2.1/20110323/html4/units-001.htm (RC6)

http://test.csswg.org/suites/css2.1/nightly-unstable/html4/units-001.htm


3rd row: .ex { width: 15.625ex; }

16 mult by 0.8 == 12.8 which is rounded up to 13px by browsers like
Konqueror 4.6.4 and Firefox 4.0.1. Then 13 mult by 15.625 == 203.125px.
The testcase should use a font-size of 20px so that 1ex gives a whole
integer.

-------------


http://test.csswg.org/suites/css2.1/20110323/html4/units-004.htm (RC6)

http://test.csswg.org/suites/css2.1/nightly-unstable/html4/units-004.htm


bottom half: .ex { width: 20.8333ex; height: 10.41667ex; background:
green; }


(width): 12 mult by 0.8 == 9.6 which is rounded up to 10px by browsers
like Konqueror 4.6.4 and Firefox 4.0.1. Then 10px mult by 20.8333 ==
208.333.

(height) Also 12 mult by 0.8 == 9.6 which is rounded up to 10. Then 10
mult by 10.41667 == 104.1667. The problem is font-size: 12px which can
be and would be better replaced by font-size: 20px.

-------------


http://test.csswg.org/suites/css2.1/20110323/html4/units-005.htm (RC6)

http://test.csswg.org/suites/css2.1/nightly-unstable/html4/units-005.htm


div { width: 8.7em; height: 8.7em; background: red; border: solid lime; }
span { float: left; width: 0.87em; height: 0.87em; background: green; }


8.7 mult by 16 == 139.2 which is rounded down to 139px by browsers like
Konqueror 4.6.4 and Chrome 12.0.742.100.

0.87 mult by 16 == 13.92 which is rounded down to 13px by browsers like
Konqueror 4.6.4 and Chrome 12.0.742.100; then 13px mult by 10 == 130px,
therefore the 9px red gap (139px minus 130px) displayed.

In Opera 11.11, 0.87 mult by 16 == 13.92 is rounded up to 14, so only 9
spans (not 10) can fit onto one line. The rendered content is perfectly
explainable here.

Again, with a font-size of 20px and with a sensible value for em (8.7
and 0.87 is not what I would call an ideal or best factor for a
testcase), the whole problem can be elegantly avoided for all browsers.


Gérard
-- 
Contributions to the CSS 2.1 test suite:
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/

CSS 2.1 Test suite RC6, March 23rd 2011
http://test.csswg.org/suites/css2.1/20110323/html4/toc.html

CSS 2.1 test suite contributors:
http://test.csswg.org/source/contributors/
Received on Tuesday, 21 June 2011 21:29:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 21 June 2011 21:29:47 GMT