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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

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:
Download patch
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 95c8ab0732542b22c791417b26ccd2f72b485a1d..a541a048873201b4cb6a90b8cd7988f82df1e38b 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -26438,6 +26438,11 @@ class WheelEvent extends MouseEvent native "*WheelEvent" {
eventType = 'MouseScrollEvents';
}
final event = document.$dom_createEvent(eventType);
+ // If polyfilling, then flip these to match W3C wheel spec.
+ if (JS('bool', '#.deltaY === undefined', event)) {
+ deltaX = -deltaX;
+ deltaY = -deltaY;
+ }
if (event._hasInitWheelEvent) {
var modifiers = [];
if (ctrlKey) {
@@ -26514,7 +26519,7 @@ class WheelEvent extends MouseEvent native "*WheelEvent" {
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
@@ -26525,9 +26530,9 @@ class WheelEvent extends MouseEvent native "*WheelEvent" {
// 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;
}
@@ -26542,7 +26547,7 @@ class WheelEvent extends MouseEvent native "*WheelEvent" {
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.
@@ -26555,9 +26560,9 @@ class WheelEvent extends MouseEvent native "*WheelEvent" {
// 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;
}
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | tools/dom/templates/html/impl/impl_WheelEvent.darttemplate » ('J')

Powered by Google App Engine
This is Rietveld 408576698