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

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..eb66b088bbe706888aaa381706393b70310991fe 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;
}
@@ -33620,6 +33625,9 @@ WindowBase _convertNativeToDart_Window(win) {
}
EventTarget _convertNativeToDart_EventTarget(e) {
+ if (e == null) {
+ return e;
+ }
// Assume it's a Window if it contains the setInterval property. It may be
// from a different frame - without a patched prototype - so we cannot
// rely on Dart type checking.
« 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