[Webkit-unassigned] [Bug 126844] New: getComputedStyle rounds off fractional pixel values
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun Jan 12 08:16:32 PST 2014
https://bugs.webkit.org/show_bug.cgi?id=126844
Summary: getComputedStyle rounds off fractional pixel values
Product: WebKit
Version: 528+ (Nightly build)
Platform: Macintosh Intel
URL: http://codepen.io/desandro/pen/CEfJF
OS/Version: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Layout and Rendering
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: desandrocodes at gmail.com
See example http://codepen.io/desandro/pen/CEfJF
The value of getComputedStyle( elem ).width is returned as 199px for an element that has CSS `width: 66.666%`, and it's parent element has `width: 300px`. Other browsers keep the fractional pixel value, i.e. 199.98px. I expected the value to either have the fractional pixel, or round up to the nearest integer, instead of rounding off any fractional pixel value.
I imagine this behavior might be by design, as it 199px is the rendered width of the element, and it prevents rounding errors to overshoot the true value. That said, I thought it was worth documenting.
I have found that using `calc()` values for `width` produces closer-to-expected values. So for that example, changing width to `calc( 100% * 2 /3 )` returns `200px`. See http://codepen.io/desandro/pen/CKwfd
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list