Chromium Code Reviews| 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 // 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 |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 681 } | 681 } |
| 682 } | 682 } |
| 683 } | 683 } |
| 684 throw "Incorrect number or type of arguments"; | 684 throw "Incorrect number or type of arguments"; |
| 685 } | 685 } |
| 686 | 686 |
| 687 void focus() { | 687 void focus() { |
| 688 _ptr.focus(); | 688 _ptr.focus(); |
| 689 } | 689 } |
| 690 | 690 |
| 691 CSSStyleDeclaration getComputedStyle([Element element = null, String pseudoEle ment = null]) { | |
| 692 if (element === null) { | |
| 693 if (pseudoElement === null) { | |
| 694 return LevelDom.wrapCSSStyleDeclaration(_ptr.getComputedStyle()); | |
| 695 } | |
| 696 } else { | |
| 697 if (pseudoElement === null) { | |
| 698 return LevelDom.wrapCSSStyleDeclaration(_ptr.getComputedStyle(LevelDom.u nwrap(element))); | |
| 699 } else { | |
| 700 return LevelDom.wrapCSSStyleDeclaration(_ptr.getComputedStyle(LevelDom.u nwrap(element), pseudoElement)); | |
| 701 } | |
| 702 } | |
| 703 throw "Incorrect number or type of arguments"; | |
| 704 } | |
| 705 | |
| 706 DOMSelection getSelection() { | 691 DOMSelection getSelection() { |
| 707 return LevelDom.wrapDOMSelection(_ptr.getSelection()); | 692 return LevelDom.wrapDOMSelection(_ptr.getSelection()); |
| 708 } | 693 } |
| 709 | 694 |
| 710 MediaQueryList matchMedia(String query) { | 695 MediaQueryList matchMedia(String query) { |
| 711 return LevelDom.wrapMediaQueryList(_ptr.matchMedia(query)); | 696 return LevelDom.wrapMediaQueryList(_ptr.matchMedia(query)); |
| 712 } | 697 } |
| 713 | 698 |
| 714 void moveBy(num x, num y) { | 699 void moveBy(num x, num y) { |
| 715 _ptr.moveBy(x, y); | 700 _ptr.moveBy(x, y); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 785 } | 770 } |
| 786 | 771 |
| 787 void scrollTo(int x, int y) { | 772 void scrollTo(int x, int y) { |
| 788 _ptr.scrollTo(x, y); | 773 _ptr.scrollTo(x, y); |
| 789 } | 774 } |
| 790 | 775 |
| 791 int setInterval(TimeoutHandler handler, int timeout) { | 776 int setInterval(TimeoutHandler handler, int timeout) { |
| 792 return _ptr.setInterval(handler, timeout); | 777 return _ptr.setInterval(handler, timeout); |
| 793 } | 778 } |
| 794 | 779 |
| 795 int setTimeout([TimeoutHandler handler = null, int timeout = null]) { | 780 int setTimeout(TimeoutHandler handler, int timeout) { |
|
nweiz
2011/10/28 03:58:38
Style nit: =>
Jacob
2011/10/31 22:09:50
Done.
| |
| 796 if (handler === null) { | 781 return _ptr.setTimeout(handler, timeout); |
| 797 if (timeout === null) { | |
| 798 return _ptr.setTimeout(); | |
| 799 } | |
| 800 } else { | |
| 801 if (timeout === null) { | |
| 802 return _ptr.setTimeout(handler); | |
| 803 } else { | |
| 804 return _ptr.setTimeout(handler, timeout); | |
| 805 } | |
| 806 } | |
| 807 throw "Incorrect number or type of arguments"; | |
| 808 } | 782 } |
| 809 | 783 |
| 810 Object showModalDialog(String url, [Object dialogArgs = null, String featureAr gs = null]) { | 784 Object showModalDialog(String url, [Object dialogArgs = null, String featureAr gs = null]) { |
| 811 if (dialogArgs === null) { | 785 if (dialogArgs === null) { |
| 812 if (featureArgs === null) { | 786 if (featureArgs === null) { |
| 813 return _ptr.showModalDialog(url); | 787 return _ptr.showModalDialog(url); |
| 814 } | 788 } |
| 815 } else { | 789 } else { |
| 816 if (featureArgs === null) { | 790 if (featureArgs === null) { |
| 817 return _ptr.showModalDialog(url, LevelDom.unwrap(dialogArgs)); | 791 return _ptr.showModalDialog(url, LevelDom.unwrap(dialogArgs)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 858 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromPageToNode(LevelDom .unwrap(node), LevelDom.unwrap(p))); | 832 return LevelDom.wrapPoint(_ptr.webkitConvertPointFromPageToNode(LevelDom .unwrap(node), LevelDom.unwrap(p))); |
| 859 } | 833 } |
| 860 } | 834 } |
| 861 throw "Incorrect number or type of arguments"; | 835 throw "Incorrect number or type of arguments"; |
| 862 } | 836 } |
| 863 | 837 |
| 864 int webkitRequestAnimationFrame(RequestAnimationFrameCallback callback, [Eleme nt element = null]) { | 838 int webkitRequestAnimationFrame(RequestAnimationFrameCallback callback, [Eleme nt element = null]) { |
| 865 if (element === null) { | 839 if (element === null) { |
| 866 return _ptr.webkitRequestAnimationFrame(callback); | 840 return _ptr.webkitRequestAnimationFrame(callback); |
| 867 } else { | 841 } else { |
| 868 return _ptr.webkitRequestAnimationFrame(callback, LevelDom.unwrap(element) ); | 842 return _ptr.webkitRequestAnimationFrame( |
| 843 callback, LevelDom.unwrap(element)); | |
| 869 } | 844 } |
| 870 } | 845 } |
| 871 | 846 |
| 847 void requestLayoutFrame(TimeoutHandler callback) { | |
| 848 _addMeasurementFrameCallback(callback); | |
| 849 } | |
| 850 | |
| 872 WindowEvents get on() { | 851 WindowEvents get on() { |
| 873 if (_on === null) { | 852 if (_on === null) { |
| 874 _on = new WindowEventsImplementation._wrap(_ptr); | 853 _on = new WindowEventsImplementation._wrap(_ptr); |
| 875 } | 854 } |
| 876 return _on; | 855 return _on; |
| 877 } | 856 } |
| 878 } | 857 } |
| OLD | NEW |