| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of html; | 5 part of html; |
| 6 | 6 $ANNOTATIONS |
| 7 /// @domName $DOMNAME | |
| 8 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 7 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 9 $!MEMBERS | 8 $!MEMBERS |
| 10 | 9 |
| 11 $if DART2JS | 10 $if DART2JS |
| 12 /** @domName WheelEvent.deltaY */ | 11 @DomName('WheelEvent.deltaY') |
| 13 num get deltaY { | 12 num get deltaY { |
| 14 if (JS('bool', '#.deltaY !== undefined', this)) { | 13 if (JS('bool', '#.deltaY !== undefined', this)) { |
| 15 // W3C WheelEvent | 14 // W3C WheelEvent |
| 16 return this._deltaY; | 15 return this._deltaY; |
| 17 } else if (JS('bool', '#.wheelDelta !== undefined', this)) { | 16 } else if (JS('bool', '#.wheelDelta !== undefined', this)) { |
| 18 // Chrome and IE | 17 // Chrome and IE |
| 19 return this._wheelDelta; | 18 return this._wheelDelta; |
| 20 } else if (JS('bool', '#.detail !== undefined', this)) { | 19 } else if (JS('bool', '#.detail !== undefined', this)) { |
| 21 // Firefox | 20 // Firefox |
| 22 | 21 |
| 23 // Handle DOMMouseScroll case where it uses detail and the axis to | 22 // Handle DOMMouseScroll case where it uses detail and the axis to |
| 24 // differentiate. | 23 // differentiate. |
| 25 if (JS('bool', '#.axis == MouseScrollEvent.VERTICAL_AXIS', this)) { | 24 if (JS('bool', '#.axis == MouseScrollEvent.VERTICAL_AXIS', this)) { |
| 26 var detail = this._detail; | 25 var detail = this._detail; |
| 27 // Firefox is normally the number of lines to scale (normally 3) | 26 // Firefox is normally the number of lines to scale (normally 3) |
| 28 // so multiply it by 40 to get pixels to move, matching IE & WebKit. | 27 // so multiply it by 40 to get pixels to move, matching IE & WebKit. |
| 29 if (detail < 100) { | 28 if (detail < 100) { |
| 30 return detail * 40; | 29 return detail * 40; |
| 31 } | 30 } |
| 32 return detail; | 31 return detail; |
| 33 } | 32 } |
| 34 return 0; | 33 return 0; |
| 35 } | 34 } |
| 36 throw new UnsupportedError( | 35 throw new UnsupportedError( |
| 37 'deltaY is not supported'); | 36 'deltaY is not supported'); |
| 38 } | 37 } |
| 39 | 38 |
| 40 /** @domName WheelEvent.deltaX */ | 39 @DomName('WheelEvent.deltaX') |
| 41 num get deltaX { | 40 num get deltaX { |
| 42 if (JS('bool', '#.deltaX !== undefined', this)) { | 41 if (JS('bool', '#.deltaX !== undefined', this)) { |
| 43 // W3C WheelEvent | 42 // W3C WheelEvent |
| 44 return this._deltaX; | 43 return this._deltaX; |
| 45 } else if (JS('bool', '#.wheelDeltaX !== undefined', this)) { | 44 } else if (JS('bool', '#.wheelDeltaX !== undefined', this)) { |
| 46 // Chrome | 45 // Chrome |
| 47 return this._wheelDeltaX; | 46 return this._wheelDeltaX; |
| 48 } else if (JS('bool', '#.detail !== undefined', this)) { | 47 } else if (JS('bool', '#.detail !== undefined', this)) { |
| 49 // Firefox and IE. | 48 // Firefox and IE. |
| 50 // IE will have detail set but will not set axis. | 49 // IE will have detail set but will not set axis. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 75 } | 74 } |
| 76 | 75 |
| 77 num get _deltaY => JS('num', '#.deltaY', this); | 76 num get _deltaY => JS('num', '#.deltaY', this); |
| 78 num get _deltaX => JS('num', '#.deltaX', this); | 77 num get _deltaX => JS('num', '#.deltaX', this); |
| 79 num get _wheelDelta => JS('num', '#.wheelDelta', this); | 78 num get _wheelDelta => JS('num', '#.wheelDelta', this); |
| 80 num get _wheelDeltaX => JS('num', '#.wheelDeltaX', this); | 79 num get _wheelDeltaX => JS('num', '#.wheelDeltaX', this); |
| 81 num get _detail => JS('num', '#.detail', this); | 80 num get _detail => JS('num', '#.detail', this); |
| 82 int get _deltaMode => JS('int', '#.deltaMode', this); | 81 int get _deltaMode => JS('int', '#.deltaMode', this); |
| 83 | 82 |
| 84 $else | 83 $else |
| 85 /** @domName WheelEvent.deltaX */ | 84 @DomName('WheelEvent.deltaX') |
| 86 num get deltaX => $dom_wheelDeltaX; | 85 num get deltaX => $dom_wheelDeltaX; |
| 87 /** @domName WheelEvent.deltaY */ | 86 @DomName('WheelEvent.deltaY') |
| 88 num get deltaY => $dom_wheelDeltaY; | 87 num get deltaY => $dom_wheelDeltaY; |
| 89 /** @domName WheelEvent.deltaMode */ | 88 @DomName('WheelEvent.deltaMode') |
| 90 int get deltaMode => 0; | 89 int get deltaMode => 0; |
| 91 | 90 |
| 92 $endif | 91 $endif |
| 93 } | 92 } |
| OLD | NEW |