| 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..1e4b2396e6d7f60ab1d554d120f6296c79536366 100644
|
| --- a/tools/dom/templates/html/impl/impl_WheelEvent.darttemplate
|
| +++ b/tools/dom/templates/html/impl/impl_WheelEvent.darttemplate
|
| @@ -22,6 +22,13 @@ $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
|
| }
|
| final event = document.$dom_createEvent(eventType);
|
| $if DART2JS
|
| + // If polyfilling, then flip these because we'll flip them back to match
|
| + // the W3C standard:
|
| + // http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-WheelEvent-deltaY
|
| + if (JS('bool', '#.deltaY === undefined', event)) {
|
| + deltaX = -deltaX;
|
| + deltaY = -deltaY;
|
| + }
|
| if (event._hasInitWheelEvent) {
|
| var modifiers = [];
|
| if (ctrlKey) {
|
| @@ -57,6 +64,11 @@ $if DART2JS
|
| screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
|
| metaKey, button, relatedTarget, axis);
|
| } else {
|
| +$else
|
| + // Dartium always needs these flipped because we're essentially always
|
| + // polyfilling (see similar dart2js code as well)
|
| + deltaX = -deltaX;
|
| + deltaY = -deltaY;
|
| $endif
|
| // Fallthrough for Dartium.
|
| event.$dom_initMouseEvent(type, canBubble, cancelable, view, detail,
|
| @@ -76,6 +88,14 @@ $endif
|
| $!MEMBERS
|
|
|
| $if DART2JS
|
| + /**
|
| + * The amount that is expected to scroll vertically, in units determined by
|
| + * [deltaMode].
|
| + *
|
| + * See also:
|
| + *
|
| + * * [WheelEvent.deltaY](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-WheelEvent-deltaY) from the W3C.
|
| + */
|
| @DomName('WheelEvent.deltaY')
|
| num get deltaY {
|
| if (JS('bool', '#.deltaY !== undefined', this)) {
|
| @@ -83,7 +103,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
|
|
|
| @@ -93,10 +113,10 @@ $if DART2JS
|
| var detail = this._detail;
|
| // 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;
|
| + if (detail.abs() < 100) {
|
| + return -detail * 40;
|
| }
|
| - return detail;
|
| + return -detail;
|
| }
|
| return 0;
|
| }
|
| @@ -104,6 +124,14 @@ $if DART2JS
|
| 'deltaY is not supported');
|
| }
|
|
|
| + /**
|
| + * The amount that is expected to scroll horizontally, in units determined by
|
| + * [deltaMode].
|
| + *
|
| + * See also:
|
| + *
|
| + * * [WheelEvent.deltaX](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-WheelEvent-deltaX) from the W3C.
|
| + */
|
| @DomName('WheelEvent.deltaX')
|
| num get deltaX {
|
| if (JS('bool', '#.deltaX !== undefined', this)) {
|
| @@ -111,7 +139,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 +152,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;
|
| }
|
| @@ -193,9 +221,26 @@ $if DART2JS
|
| int deltaMode) native;
|
|
|
| $else
|
| + /**
|
| + * The amount that is expected to scroll horizontally, in units determined by
|
| + * [deltaMode].
|
| + *
|
| + * See also:
|
| + *
|
| + * * [WheelEvent.deltaX](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-WheelEvent-deltaX) from the W3C.
|
| + */
|
| @DomName('WheelEvent.deltaX')
|
| - num get deltaX => $dom_wheelDeltaX;
|
| + num get deltaX => -$dom_wheelDeltaX;
|
| +
|
| + /**
|
| + * The amount that is expected to scroll vertically, in units determined by
|
| + * [deltaMode].
|
| + *
|
| + * See also:
|
| + *
|
| + * * [WheelEvent.deltaY](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-WheelEvent-deltaY) from the W3C.
|
| + */
|
| @DomName('WheelEvent.deltaY')
|
| - num get deltaY => $dom_wheelDeltaY;
|
| + num get deltaY => -$dom_wheelDeltaY;
|
| $endif
|
| }
|
|
|