This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 14326 - 2d.imageData.object.round should be updated
Summary: 2d.imageData.object.round should be updated
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: testsuite (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Ms2ger
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-28 14:48 UTC by Ms2ger
Modified: 2012-03-05 17:44 UTC (History)
4 users (show)

See Also:


Attachments

Description Ms2ger 2011-09-28 14:48:15 UTC
2d.imageData.object.round should test for

"Round x to the nearest integer, choosing the even integer if it lies halfway between two."

as changed in <http://dev.w3.org/cvsweb/2006/webapi/WebIDL/Overview.html.diff?r1=1.393;r2=1.394;f=h>
Comment 1 Ms2ger 2011-10-02 15:12:38 UTC
http://dvcs.w3.org/hg/html/rev/1d201654fce1

Please review.
Comment 2 Qiankun Miao 2012-03-05 05:30:09 UTC
As defined in latest spec (Editor's Draft 29 February 2012) at http://dev.w3.org/html5/2dcontext/#imagedata, the data of imagedata is initialized to a Uint8ClampedArray object which maps to a octet type in Web IDL.  
According to the mapping rule defined at http://dev.w3.org/2006/webapi/WebIDL/#es-octet, an attribute annotated with the [Clamp] extended attribute should handle as follows:
1. Round x to the nearest integer, choosing the even integer if it lies halfway between two.
2. Set x to min(max(x, 0), 2^8 − 1).
3. Return the IDL octet value that represents the same numeric value as x.

e.g.
0.499 -> 0
0.5 -> 0
0.501 -> 1
1.499 -> 1
1.5 -> 2
1.501 -> 2
2.5 -> 2
3.5 -> 4
252.5 -> 252
253.5 -> 254
254.5 -> 254
256.5 -> 255
-0.5 -> 0
-1.5 -> 0

So this test should be updated.
Comment 3 Ms2ger 2012-03-05 17:44:08 UTC
Thanks, I've updated the approved version.

http://dvcs.w3.org/hg/html/rev/c3f2f7da0bfb