Chromium Code Reviews| Index: tools/dom/templates/html/impl/impl_WheelEvent.darttemplate |
| diff --git a/tools/dom/templates/html/impl/impl_WheelEvent.darttemplate b/tools/dom/templates/html/impl/impl_WheelEvent.darttemplate |
| index 93da12737b89fb857bb4f42dff7ce764a8122475..502ac9c36415573f2967cecc907d6ab00b8556ae 100644 |
| --- a/tools/dom/templates/html/impl/impl_WheelEvent.darttemplate |
| +++ b/tools/dom/templates/html/impl/impl_WheelEvent.darttemplate |
| @@ -22,6 +22,11 @@ $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| } |
| final event = document.$dom_createEvent(eventType); |
| $if DART2JS |
| + // If polyfilling, then flip these to match W3C wheel spec. |
|
Emily Fortuna
2013/04/02 23:59:09
Can you link to the w3c spec or (better) say which
blois
2013/04/03 00:35:34
Added link to the spec, but it doesn't actually sp
|
| + if (JS('bool', '#.deltaY === undefined', event)) { |
| + deltaX = -deltaX; |
| + deltaY = -deltaY; |
| + } |
| if (event._hasInitWheelEvent) { |
| var modifiers = []; |
| if (ctrlKey) { |
| @@ -83,7 +88,7 @@ $if DART2JS |
| return this._deltaY; |
| } else if (JS('bool', '#.wheelDelta !== undefined', this)) { |
| // Chrome and IE |
| - return this._wheelDelta; |
| + return -this._wheelDelta; |
| } else if (JS('bool', '#.detail !== undefined', this)) { |
| // Firefox |
| @@ -94,9 +99,9 @@ $if DART2JS |
| // Firefox is normally the number of lines to scale (normally 3) |
| // so multiply it by 40 to get pixels to move, matching IE & WebKit. |
| if (detail < 100) { |
| - return detail * 40; |
| + return -detail * 40; |
| } |
| - return detail; |
| + return -detail; |
| } |
| return 0; |
| } |
| @@ -111,7 +116,7 @@ $if DART2JS |
| return this._deltaX; |
| } else if (JS('bool', '#.wheelDeltaX !== undefined', this)) { |
| // Chrome |
| - return this._wheelDeltaX; |
| + return -this._wheelDeltaX; |
| } else if (JS('bool', '#.detail !== undefined', this)) { |
| // Firefox and IE. |
| // IE will have detail set but will not set axis. |
| @@ -124,9 +129,9 @@ $if DART2JS |
| // Firefox is normally the number of lines to scale (normally 3) |
| // so multiply it by 40 to get pixels to move, matching IE & WebKit. |
| if (detail < 100) { |
| - return detail * 40; |
| + return -detail * 40; |
| } |
| - return detail; |
| + return -detail; |
| } |
| return 0; |
| } |
| @@ -194,8 +199,8 @@ $if DART2JS |
| $else |
| @DomName('WheelEvent.deltaX') |
| - num get deltaX => $dom_wheelDeltaX; |
| + num get deltaX => -$dom_wheelDeltaX; |
| @DomName('WheelEvent.deltaY') |
| - num get deltaY => $dom_wheelDeltaY; |
| + num get deltaY => -$dom_wheelDeltaY; |
| $endif |
| } |