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 |
7 class _Property { | 7 class _Property { |
8 _Property(this.name) : | 8 _Property(this.name) : |
9 _hasValue = false, | 9 _hasValue = false, |
10 writable = false, | 10 writable = false, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 } | 180 } |
181 | 181 |
182 static Element getAndValidateNativeType(Type type, String tagName) { | 182 static Element getAndValidateNativeType(Type type, String tagName) { |
183 var element = new Element.tag(tagName); | 183 var element = new Element.tag(tagName); |
184 if (!isTypeSubclassOf(type, element.runtimeType)) { | 184 if (!isTypeSubclassOf(type, element.runtimeType)) { |
185 return null; | 185 return null; |
186 } | 186 } |
187 return element; | 187 return element; |
188 } | 188 } |
189 | 189 |
190 // TODO(terry): Enable below for Dartium w/ interop and remove other static wi
ndow(). | 190 static window() => wrap_jso(js.context['window']); |
191 // static window() => wrap_jso(_blink.Blink_Utils.window()['window']); | |
192 static window() => _blink.Blink_Utils.window(); | |
193 | 191 |
194 static forwardingPrint(String message) => _blink.Blink_Utils.forwardingPrint(m
essage); | 192 static forwardingPrint(String message) => _blink.Blink_Utils.forwardingPrint(m
essage); |
195 static void spawnDomHelper(Function f, int replyTo) => | 193 static void spawnDomHelper(Function f, int replyTo) => |
196 _blink.Blink_Utils.spawnDomHelper(f, replyTo); | 194 _blink.Blink_Utils.spawnDomHelper(f, replyTo); |
197 | 195 |
198 // TODO(vsm): Make this API compatible with spawnUri. It should also | 196 // TODO(vsm): Make this API compatible with spawnUri. It should also |
199 // return a Future<Isolate>. | 197 // return a Future<Isolate>. |
200 static spawnDomUri(String uri) => _blink.Blink_Utils.spawnDomUri(uri); | 198 static spawnDomUri(String uri) => _blink.Blink_Utils.spawnDomUri(uri); |
201 | 199 |
202 // The following methods were added for debugger integration to make working | 200 // The following methods were added for debugger integration to make working |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 | 797 |
800 _register(document, tag, type, extendsTagName); | 798 _register(document, tag, type, extendsTagName); |
801 } | 799 } |
802 | 800 |
803 static void _register(Document document, String tag, Type customType, | 801 static void _register(Document document, String tag, Type customType, |
804 String extendsTagName) => _blink.Blink_Utils.register(unwrap_jso(document),
tag, customType, extendsTagName); | 802 String extendsTagName) => _blink.Blink_Utils.register(unwrap_jso(document),
tag, customType, extendsTagName); |
805 | 803 |
806 static Element createElement(Document document, String tagName) => | 804 static Element createElement(Document document, String tagName) => |
807 wrap_jso(_blink.Blink_Utils.createElement(unwrap_jso(document), tagName)); | 805 wrap_jso(_blink.Blink_Utils.createElement(unwrap_jso(document), tagName)); |
808 | 806 |
809 static void initializeCustomElement(HtmlElement element) => | |
810 _blink.Blink_Utils.initializeCustomElement(unwrap_jso(element)); | |
811 | |
812 static Element changeElementWrapper(HtmlElement element, Type type) => | 807 static Element changeElementWrapper(HtmlElement element, Type type) => |
813 _blink.Blink_Utils.changeElementWrapper(unwrap_jso(element), type); | 808 _blink.Blink_Utils.changeElementWrapper(unwrap_jso(element), type); |
814 } | 809 } |
815 | 810 |
816 class _DOMWindowCrossFrame extends NativeFieldWrapperClass2 implements | 811 class _DOMWindowCrossFrame extends NativeFieldWrapperClass2 implements |
817 WindowBase { | 812 WindowBase { |
| 813 /** Needed because KeyboardEvent is implements. |
| 814 * TODO(terry): Consider making blink_jsObject private (add underscore) for |
| 815 * all blink_jsObject. Then needed private wrap/unwrap_jso |
| 816 * functions that delegate to a public wrap/unwrap_jso. |
| 817 */ |
| 818 js.JsObject blink_jsObject; |
| 819 |
818 _DOMWindowCrossFrame.internal(); | 820 _DOMWindowCrossFrame.internal(); |
819 | 821 |
820 // Fields. | 822 // Fields. |
821 HistoryBase get history => _blink.Blink_DOMWindowCrossFrame.get_history(this); | 823 HistoryBase get history => _blink.Blink_DOMWindowCrossFrame.get_history(this); |
822 LocationBase get location => _blink.Blink_DOMWindowCrossFrame.get_location(thi
s); | 824 LocationBase get location => _blink.Blink_DOMWindowCrossFrame.get_location(thi
s); |
823 bool get closed => _blink.Blink_DOMWindowCrossFrame.get_closed(this); | 825 bool get closed => _blink.Blink_DOMWindowCrossFrame.get_closed(this); |
824 WindowBase get opener => _blink.Blink_DOMWindowCrossFrame.get_opener(this); | 826 WindowBase get opener => _blink.Blink_DOMWindowCrossFrame.get_opener(this); |
825 WindowBase get parent => _blink.Blink_DOMWindowCrossFrame.get_parent(this); | 827 WindowBase get parent => _blink.Blink_DOMWindowCrossFrame.get_parent(this); |
826 WindowBase get top => _blink.Blink_DOMWindowCrossFrame.get_top(this); | 828 WindowBase get top => _blink.Blink_DOMWindowCrossFrame.get_top(this); |
827 | 829 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 void go(int distance) => _blink.Blink_HistoryCrossFrame.go(this, distance); | 868 void go(int distance) => _blink.Blink_HistoryCrossFrame.go(this, distance); |
867 | 869 |
868 // Implementation support. | 870 // Implementation support. |
869 String get typeName => "History"; | 871 String get typeName => "History"; |
870 } | 872 } |
871 | 873 |
872 class _LocationCrossFrame extends NativeFieldWrapperClass2 implements LocationBa
se { | 874 class _LocationCrossFrame extends NativeFieldWrapperClass2 implements LocationBa
se { |
873 _LocationCrossFrame.internal(); | 875 _LocationCrossFrame.internal(); |
874 | 876 |
875 // Fields. | 877 // Fields. |
876 void set href(String h) => _blink.Blink_LocationCrossFrame.set_href(this, h); | 878 set href(String h) => _blink.Blink_LocationCrossFrame.set_href(this, h); |
877 | 879 |
878 // Implementation support. | 880 // Implementation support. |
879 String get typeName => "Location"; | 881 String get typeName => "Location"; |
880 } | 882 } |
881 | 883 |
882 class _DOMStringMap extends NativeFieldWrapperClass2 implements Map<String, Stri
ng> { | 884 class _DOMStringMap extends NativeFieldWrapperClass2 implements Map<String, Stri
ng> { |
883 _DOMStringMap.internal(); | 885 _DOMStringMap.internal(); |
884 | 886 |
885 bool containsValue(String value) => Maps.containsValue(this, value); | 887 bool containsValue(String value) => Maps.containsValue(this, value); |
886 bool containsKey(String key) => _blink.Blink_DOMStringMap.containsKey(this, ke
y); | 888 bool containsKey(String key) => _blink.Blink_DOMStringMap.containsKey(this, ke
y); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 new _ScheduleImmediateHelper(); | 1104 new _ScheduleImmediateHelper(); |
1103 | 1105 |
1104 get _scheduleImmediateClosure => (void callback()) { | 1106 get _scheduleImmediateClosure => (void callback()) { |
1105 _scheduleImmediateHelper._schedule(callback); | 1107 _scheduleImmediateHelper._schedule(callback); |
1106 }; | 1108 }; |
1107 | 1109 |
1108 get _pureIsolateScheduleImmediateClosure => ((void callback()) => | 1110 get _pureIsolateScheduleImmediateClosure => ((void callback()) => |
1109 throw new UnimplementedError("scheduleMicrotask in background isolates " | 1111 throw new UnimplementedError("scheduleMicrotask in background isolates " |
1110 "are not supported in the browser")); | 1112 "are not supported in the browser")); |
1111 | 1113 |
1112 void _initializeCustomElement(Element e) { | |
1113 _Utils.initializeCustomElement(e); | |
1114 } | |
1115 | |
1116 // Class for unsupported native browser 'DOM' objects. | 1114 // Class for unsupported native browser 'DOM' objects. |
1117 class _UnsupportedBrowserObject extends NativeFieldWrapperClass2 { | 1115 class _UnsupportedBrowserObject extends NativeFieldWrapperClass2 { |
1118 } | 1116 } |
OLD | NEW |