Index: sdk/lib/html/dartium/html_dartium.dart |
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart |
index bef76ac9f1ce8830871c7c7fe9ac0e025aa6da7a..23c337210f66d17c2d493eb438b7e2ae0bd271da 100644 |
--- a/sdk/lib/html/dartium/html_dartium.dart |
+++ b/sdk/lib/html/dartium/html_dartium.dart |
@@ -24068,6 +24068,31 @@ class WebSocketEvents extends Events { |
@DomName('WheelEvent') |
class WheelEvent extends MouseEvent { |
+ |
+ factory WheelEvent(String type, Window view, int wheelDeltaX, int wheelDeltaY, |
+ int detail, int screenX, int screenY, int clientX, int clientY, |
+ int button, |
+ [bool canBubble = true, bool cancelable = true, bool ctrlKey = false, |
+ bool altKey = false, bool shiftKey = false, bool metaKey = false, |
+ EventTarget relatedTarget = null]) { |
+ |
+ var eventType = 'WheelEvent'; |
+ if (_Device.isFirefox) { |
+ eventType = 'MouseScrollEvents'; |
+ } |
+ final event = document.$dom_createEvent(eventType); |
+ // Fallthrough for Dartium. |
+ event.$dom_initMouseEvent(type, canBubble, cancelable, view, detail, |
+ screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, |
+ metaKey, button, relatedTarget); |
+ event.$dom_initWebKitWheelEvent(wheelDeltaX, |
+ (wheelDeltaY / 120).toInt(), // Chrome does an auto-convert to pixels. |
+ view, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, |
+ metaKey); |
+ |
+ return event; |
+ } |
+ |
WheelEvent.internal() : super.internal(); |
@DomName('WheelEvent.webkitDirectionInvertedFromDevice') |
@@ -24080,7 +24105,7 @@ class WheelEvent extends MouseEvent { |
int get $dom_wheelDeltaY native "WheelEvent_wheelDeltaY_Getter"; |
@DomName('WheelEvent.initWebKitWheelEvent') |
- void initWebKitWheelEvent(int wheelDeltaX, int wheelDeltaY, Window view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) native "WheelEvent_initWebKitWheelEvent_Callback"; |
+ 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 "WheelEvent_initWebKitWheelEvent_Callback"; |
@DomName('WheelEvent.deltaX') |
@@ -27789,6 +27814,21 @@ class EventStreamProvider<T extends Event> { |
return new _EventStream(e, _eventType, useCapture); |
} |
} |
+ |
+/** |
+ * A factory to expose DOM events as streams, where the DOM event name has to |
+ * be determined on the fly (for example, mouse wheel events). |
+ */ |
+class _CustomEventStreamProvider<T extends Event> |
+ implements EventStreamProvider<T> { |
+ |
+ final _eventTypeGetter; |
+ const _CustomEventStreamProvider(this._eventTypeGetter); |
+ |
+ Stream<T> forTarget(EventTarget e, {bool useCapture: false}) { |
+ return new _EventStream(e, _eventTypeGetter(e), useCapture); |
+ } |
+} |
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |