Re: [cssom-view] New WD "CSSOM View Module"

On Thu, Mar 6, 2008 at 9:30 PM, Garrett Smith <dhtmlkitchen@gmail.com>
wrote:

> Should these CSSOM properties respect sub-pixels, or should the round
> or floor to an int? IE 7 rounds with floats:
>
> http://groups.google.ca/group/comp.infosystems.www.authoring.stylesheets/browse_thread/thread/f0207ec3bd430c83
>

We round offset* for compatibility reasons.

We do not round getClientRects/getBoundingClientRect, and in fact these
often do return fractional values because we perform subpixel layout with
fractional text metrics (both glyph advances and line heights). IE always
returns integers from those APIs, but so far we haven't hit any Web
compatibility problems by returning floats (and our code *is* being
exercised by big sites that do feature detection). I think returning floats
is the right thing for the long-term.

John Resig took this further and provided a much better write up:
> http://ejohn.org/blog/sub-pixel-problems-in-css/
>

I responded to John at the time. His main problem was actually that we had a
bug in getComputedStyle; we round border widths to device pixel boundaries
during layout, but  getComputedStyle returned unrounded values. That bug has
been fixed so getComputedStyle returns the rounded border widths used for
layout.

Rob
-- 
"He was pierced for our transgressions, he was crushed for our iniquities;
the punishment that brought us peace was upon him, and by his wounds we are
healed. We all, like sheep, have gone astray, each of us has turned to his
own way; and the LORD has laid on him the iniquity of us all." [Isaiah
53:5-6]

Received on Thursday, 6 March 2008 08:45:40 UTC