| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** | 5 /** |
| 6 * Implementation of a custom scrolling behavior. | 6 * Implementation of a custom scrolling behavior. |
| 7 * This behavior overrides native scrolling for an area. This area can be a | 7 * This behavior overrides native scrolling for an area. This area can be a |
| 8 * single defined part of a page, the entire page, or several different parts | 8 * single defined part of a page, the entire page, or several different parts |
| 9 * of a page. | 9 * of a page. |
| 10 * | 10 * |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 FAST_SNAP_DECELERATION_FACTOR); | 204 FAST_SNAP_DECELERATION_FACTOR); |
| 205 break; | 205 break; |
| 206 */ | 206 */ |
| 207 } | 207 } |
| 208 if (handled) { | 208 if (handled) { |
| 209 e.preventDefault(); | 209 e.preventDefault(); |
| 210 } | 210 } |
| 211 }); | 211 }); |
| 212 // The scrollable element must be relatively positioned. | 212 // The scrollable element must be relatively positioned. |
| 213 assert(_scrollTechnique != ScrollerScrollTechnique.RELATIVE_POSITIONING || | 213 assert(_scrollTechnique != ScrollerScrollTechnique.RELATIVE_POSITIONING || |
| 214 new Css(window.getComputedStyle( | 214 window.getComputedStyle(_element, null).position != "static"); |
| 215 _element, null)).position != "static"); | |
| 216 _initLayer(); | 215 _initLayer(); |
| 217 } | 216 } |
| 218 | 217 |
| 219 EventListenerList get onScrollerStart() { | 218 EventListenerList get onScrollerStart() { |
| 220 if (_onScrollerStart === null) { | 219 if (_onScrollerStart === null) { |
| 221 _onScrollerStart = new SimpleEventListenerList(); | 220 _onScrollerStart = new SimpleEventListenerList(); |
| 222 } | 221 } |
| 223 return _onScrollerStart; | 222 return _onScrollerStart; |
| 224 } | 223 } |
| 225 | 224 |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 | 612 |
| 614 /** | 613 /** |
| 615 * Update the scroll technique used for animating the scrollable area. | 614 * Update the scroll technique used for animating the scrollable area. |
| 616 */ | 615 */ |
| 617 void setScrollTechnique(int technique) { | 616 void setScrollTechnique(int technique) { |
| 618 _scrollTechnique = technique; | 617 _scrollTechnique = technique; |
| 619 _setOffsetFunction = _getOffsetFunction(technique); | 618 _setOffsetFunction = _getOffsetFunction(technique); |
| 620 | 619 |
| 621 // The scrollable element must be relatively positioned. | 620 // The scrollable element must be relatively positioned. |
| 622 assert(technique != ScrollerScrollTechnique.RELATIVE_POSITIONING || | 621 assert(technique != ScrollerScrollTechnique.RELATIVE_POSITIONING || |
| 623 new Css(window.getComputedStyle(_element, null)).position | 622 window.getComputedStyle(_element, null).position != "static"); |
| 624 != "static"); | |
| 625 | 623 |
| 626 if (technique != ScrollerScrollTechnique.TRANSFORM_3D) { | 624 if (technique != ScrollerScrollTechnique.TRANSFORM_3D) { |
| 627 FxUtil.clearWebkitTransition(_element); | 625 FxUtil.clearWebkitTransition(_element); |
| 628 FxUtil.clearWebkitTransform(_element); | 626 FxUtil.clearWebkitTransform(_element); |
| 629 } | 627 } |
| 630 if (technique != ScrollerScrollTechnique.RELATIVE_POSITIONING) { | 628 if (technique != ScrollerScrollTechnique.RELATIVE_POSITIONING) { |
| 631 FxUtil.setLeftAndTop(_element, 0, 0); | 629 FxUtil.setLeftAndTop(_element, 0, 0); |
| 632 } | 630 } |
| 633 _setOffsetFunction(_element, _contentOffset.x, _contentOffset.y); | 631 _setOffsetFunction(_element, _contentOffset.x, _contentOffset.y); |
| 634 } | 632 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 for (EventListener listener in _listeners) { | 796 for (EventListener listener in _listeners) { |
| 799 listener(evt); | 797 listener(evt); |
| 800 } | 798 } |
| 801 } | 799 } |
| 802 } | 800 } |
| 803 | 801 |
| 804 class ScrollerScrollTechnique { | 802 class ScrollerScrollTechnique { |
| 805 static final TRANSFORM_3D = 1; | 803 static final TRANSFORM_3D = 1; |
| 806 static final RELATIVE_POSITIONING = 2; | 804 static final RELATIVE_POSITIONING = 2; |
| 807 } | 805 } |
| OLD | NEW |