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

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
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 08cbe48100ecbbc0d7dc14bc98805c648dffd6f6..f2f1d73194219eb6e503bbbe6a14b48342242c6d 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -24671,6 +24671,13 @@ class WheelEvent extends MouseEvent native "*WheelEvent" {
eventType = 'MouseScrollEvents';
}
final event = document.$dom_createEvent(eventType);
+ // 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) {
@@ -24740,6 +24747,14 @@ class WheelEvent extends MouseEvent native "*WheelEvent" {
void $dom_initWebKitWheelEvent(int wheelDeltaX, int wheelDeltaY, Window view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) native;
+ /**
+ * 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)) {
@@ -24747,7 +24762,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
@@ -24758,9 +24773,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;
}
@@ -24768,6 +24783,14 @@ class WheelEvent extends MouseEvent native "*WheelEvent" {
'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)) {
@@ -24775,7 +24798,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.
@@ -24788,9 +24811,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698