Bug 17628 - delta attributes of WheelEvent should be double rather than float
Summary: delta attributes of WheelEvent should be double rather than float
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - DOM3 Events (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Travis Leithead [MSFT]
QA Contact: public-webapps-bugzilla
Keywords: needsReview
Depends on:
Reported: 2012-06-28 10:17 UTC by Masayuki Nakano
Modified: 2012-09-12 04:31 UTC (History)
4 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Masayuki Nakano 2012-06-28 10:17:05 UTC
I think that the type of deltaX, deltaY and deltaZ attributes of WheelEvent should be double rather than float.

If they are float, the initialized values of untrusted events and the result of the attributes cannot match easily.

For example:

var e = new WheelEvent("wheel", { deltaX: 1/3 });
alert(e.deltaX == 1/3);

The result could be false due to the fractional error.

float is useful when a lot of values are stored in arrays. However, delta values are not so. So, I think that the type of delta values should be double.

The example may not be a realistic situation. However, if web application developers met to this problem, they would feel strange.

Currently, I'm working on implementing D3E WheelEvent on Gecko. We're using double for them.
Comment 1 Travis Leithead [MSFT] 2012-08-23 20:29:58 UTC
Double is fine.
Comment 2 Olli Pettay 2012-08-23 20:33:27 UTC
FYI, Gecko uses double already.
Comment 3 Travis Leithead [MSFT] 2012-08-23 20:36:21 UTC
Fixed in revision 237:

Comment 4 Masayuki Nakano 2012-09-12 04:31:21 UTC

  readonly attribute double         deltaX;
  readonly attribute double         deltaY;
  readonly attribute double         deltaZ;
  readonly attribute unsigned long deltaMode;

The indentation is wrong. I guess that you just replaced "float" with "double". The length is increased 1 character.