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 e842da76f51f777e892a866573ffe328ef9bb1e8..a49a9792c068dd87a63411b98b85a11f389a9818 100644 |
--- a/tools/dom/templates/html/impl/impl_WheelEvent.darttemplate |
+++ b/tools/dom/templates/html/impl/impl_WheelEvent.darttemplate |
@@ -6,13 +6,16 @@ part of html; |
$(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
- 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]) { |
- |
+ factory WheelEvent(String type, |
+ {Window view, int deltaX: 0, int deltaY: 0, |
+ int detail: 0, int screenX: 0, int screenY: 0, int clientX: 0, |
+ int clientY: 0, int button: 0, bool canBubble: true, |
+ bool cancelable: true, bool ctrlKey: false, bool altKey: false, |
+ bool shiftKey: false, bool metaKey: false, EventTarget relatedTarget}) { |
+ |
+ if (view == null) { |
+ view = window; |
+ } |
var eventType = 'WheelEvent'; |
if (_Device.isFirefox) { |
eventType = 'MouseScrollEvents'; |
@@ -35,19 +38,19 @@ $if DART2JS |
} |
event._initWheelEvent(type, canBubble, cancelable, view, detail, screenX, |
screenY, clientX, clientY, button, relatedTarget, modifiers.join(' '), |
- wheelDeltaX, wheelDeltaY, 0, 0); |
+ deltaX, deltaY, 0, 0); |
} else if (event._hasInitMouseScrollEvent) { |
var axis = 0; |
var detail = 0; |
- if (wheelDeltaX != 0 && wheelDeltaY != 0) { |
+ if (deltaX != 0 && deltaY != 0) { |
throw UnsupportedError( |
- 'Cannot modify wheelDeltaX and wheelDeltaY simultaneously'); |
+ 'Cannot modify deltaX and deltaY simultaneously'); |
} |
- if (wheelDeltaY != 0) { |
- detail = wheelDeltaY; |
+ if (deltaY != 0) { |
+ detail = deltaY; |
axis = JS('int', 'MouseScrollEvent.VERTICAL_AXIS'); |
- } else if (wheelDeltaX != 0) { |
- detail = wheelDeltaX; |
+ } else if (deltaX != 0) { |
+ detail = deltaX; |
axis = JS('int', 'MouseScrollEvent.HORIZONTAL_AXIS'); |
} |
event._initMouseScrollEvent(type, canBubble, cancelable, view, detail, |
@@ -59,8 +62,8 @@ $endif |
event.$dom_initMouseEvent(type, canBubble, cancelable, view, detail, |
screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, |
metaKey, button, relatedTarget); |
- event.$dom_initWebKitWheelEvent(wheelDeltaX, |
- wheelDeltaY ~/ 120, // Chrome does an auto-convert to pixels. |
+ event.$dom_initWebKitWheelEvent(deltaX, |
+ deltaY ~/ 120, // Chrome does an auto-convert to pixels. |
view, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, |
metaKey); |
$if DART2JS |