OLD | NEW |
1 // Copyright (c) 2011, 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 // TODO(jacobr): define a base class containing the overlap between | 5 // TODO(jacobr): define a base class containing the overlap between |
6 // this class and ElementEvents. | 6 // this class and ElementEvents. |
7 class WindowEventsImplementation extends EventsImplementation | 7 class WindowEventsImplementation extends EventsImplementation |
8 implements WindowEvents { | 8 implements WindowEvents { |
9 WindowEventsImplementation._wrap(_ptr) : super._wrap(_ptr); | 9 WindowEventsImplementation._wrap(_ptr) : super._wrap(_ptr); |
10 | 10 |
11 EventListenerList get abort() => _get('abort'); | 11 EventListenerList get abort() => _get('abort'); |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 | 796 |
797 void stop() { | 797 void stop() { |
798 _ptr.stop(); | 798 _ptr.stop(); |
799 } | 799 } |
800 | 800 |
801 void webkitCancelRequestAnimationFrame(int id) { | 801 void webkitCancelRequestAnimationFrame(int id) { |
802 _ptr.webkitCancelRequestAnimationFrame(id); | 802 _ptr.webkitCancelRequestAnimationFrame(id); |
803 } | 803 } |
804 | 804 |
805 Point webkitConvertPointFromNodeToPage([Node node = null, Point p = null]) { | 805 Point webkitConvertPointFromNodeToPage([Node node = null, Point p = null]) { |
| 806 assert(_inMeasurementFrame); |
806 if (node === null) { | 807 if (node === null) { |
807 if (p === null) { | 808 if (p === null) { |
808 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromNodeToPage()); | 809 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromNodeToPage()); |
809 } | 810 } |
810 } else { | 811 } else { |
811 if (p === null) { | 812 if (p === null) { |
812 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromNodeToPage(LevelDom
.unwrap(node))); | 813 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromNodeToPage(LevelDom
.unwrap(node))); |
813 } else { | 814 } else { |
814 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromNodeToPage(LevelDom
.unwrap(node), LevelDom.unwrap(p))); | 815 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromNodeToPage(LevelDom
.unwrap(node), LevelDom.unwrap(p))); |
815 } | 816 } |
816 } | 817 } |
817 throw "Incorrect number or type of arguments"; | 818 throw "Incorrect number or type of arguments"; |
818 } | 819 } |
819 | 820 |
820 Point webkitConvertPointFromPageToNode([Node node = null, Point p = null]) { | 821 Point webkitConvertPointFromPageToNode([Node node = null, Point p = null]) { |
| 822 assert(_inMeasurementFrame); |
821 if (node === null) { | 823 if (node === null) { |
822 if (p === null) { | 824 if (p === null) { |
823 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromPageToNode()); | 825 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromPageToNode()); |
824 } | 826 } |
825 } else { | 827 } else { |
826 if (p === null) { | 828 if (p === null) { |
827 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromPageToNode(LevelDom
.unwrap(node))); | 829 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromPageToNode(LevelDom
.unwrap(node))); |
828 } else { | 830 } else { |
829 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromPageToNode(LevelDom
.unwrap(node), LevelDom.unwrap(p))); | 831 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromPageToNode(LevelDom
.unwrap(node), LevelDom.unwrap(p))); |
830 } | 832 } |
831 } | 833 } |
832 throw "Incorrect number or type of arguments"; | 834 throw "Incorrect number or type of arguments"; |
833 } | 835 } |
834 | 836 |
835 int webkitRequestAnimationFrame(RequestAnimationFrameCallback callback, [Eleme
nt element = null]) { | 837 int webkitRequestAnimationFrame(RequestAnimationFrameCallback callback, [Eleme
nt element = null]) { |
836 return _ptr.webkitRequestAnimationFrame(callback, LevelDom.unwrap(element)); | 838 return _ptr.webkitRequestAnimationFrame(callback, LevelDom.unwrap(element)); |
837 } | 839 } |
838 | 840 |
839 void requestLayoutFrame(TimeoutHandler callback) { | 841 void requestMeasurementFrame(MeasurementCallback callback) { |
840 _addMeasurementFrameCallback(callback); | 842 _addMeasurementFrameCallback(callback); |
841 } | 843 } |
842 | 844 |
| 845 bool get inMeasurementFrame() => _inMeasurementFrame; |
| 846 |
843 WindowEvents get on() { | 847 WindowEvents get on() { |
844 if (_on === null) { | 848 if (_on === null) { |
845 _on = new WindowEventsImplementation._wrap(_ptr); | 849 _on = new WindowEventsImplementation._wrap(_ptr); |
846 } | 850 } |
847 return _on; | 851 return _on; |
848 } | 852 } |
849 } | 853 } |
OLD | NEW |