Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: tools/dom/templates/html/impl/impl_WheelEvent.darttemplate

Issue 13465021: Flipping the direction of WheelEvent.deltaX/Y to follow standards (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698