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 class DocumentEventsImplementation extends ElementEventsImplementation | 5 class DocumentEventsImplementation extends ElementEventsImplementation |
6 implements DocumentEvents { | 6 implements DocumentEvents { |
7 | 7 |
8 DocumentEventsImplementation._wrap(_ptr) : super._wrap(_ptr); | 8 DocumentEventsImplementation._wrap(_ptr) : super._wrap(_ptr); |
9 | 9 |
10 EventListenerList get readyStateChange() => _get('readystatechange'); | 10 EventListenerList get readyStateChange() => _get('readystatechange'); |
11 | 11 |
12 EventListenerList get selectionChange() => _get('selectionchange'); | 12 EventListenerList get selectionChange() => _get('selectionchange'); |
13 | 13 |
14 EventListenerList get contentLoaded() => _get('DOMContentLoaded'); | 14 EventListenerList get contentLoaded() => _get('DOMContentLoaded'); |
15 } | 15 } |
16 | 16 |
17 class DocumentWrappingImplementation extends ElementWrappingImplementation imple
ments Document { | 17 class DocumentWrappingImplementation extends ElementWrappingImplementation imple
ments Document { |
18 | 18 |
19 final _documentPtr; | 19 final _documentPtr; |
20 | 20 |
21 DocumentWrappingImplementation._wrap(this._documentPtr, ptr) : super._wrap(ptr
) { | 21 DocumentWrappingImplementation._wrap(this._documentPtr, ptr) : super._wrap(ptr
) { |
22 // We have to set the back ptr on the document as well as the documentElemen
t | 22 // We have to set the back ptr on the document as well as the documentElemen
t |
23 // so that it is always simple to detect when an existing wrapper exists. | 23 // so that it is always simple to detect when an existing wrapper exists. |
24 _documentPtr.dartObjectLocalStorage = this; | 24 _documentPtr.dartObjectLocalStorage = this; |
25 } | 25 } |
26 | 26 |
| 27 /** @domName HTMLDocument.activeElement */ |
27 Element get activeElement() => LevelDom.wrapElement(_documentPtr.activeElement
); | 28 Element get activeElement() => LevelDom.wrapElement(_documentPtr.activeElement
); |
28 | 29 |
29 Node get parent() => null; | 30 Node get parent() => null; |
30 | 31 |
| 32 /** @domName Document.body */ |
31 Element get body() => LevelDom.wrapElement(_documentPtr.body); | 33 Element get body() => LevelDom.wrapElement(_documentPtr.body); |
32 | 34 |
| 35 /** @domName Document.body */ |
33 void set body(Element value) { _documentPtr.body = LevelDom.unwrap(value); } | 36 void set body(Element value) { _documentPtr.body = LevelDom.unwrap(value); } |
34 | 37 |
| 38 /** @domName Document.charset */ |
35 String get charset() => _documentPtr.charset; | 39 String get charset() => _documentPtr.charset; |
36 | 40 |
| 41 /** @domName Document.charset */ |
37 void set charset(String value) { _documentPtr.charset = value; } | 42 void set charset(String value) { _documentPtr.charset = value; } |
38 | 43 |
| 44 /** @domName Document.cookie */ |
39 String get cookie() => _documentPtr.cookie; | 45 String get cookie() => _documentPtr.cookie; |
40 | 46 |
| 47 /** @domName Document.cookie */ |
41 void set cookie(String value) { _documentPtr.cookie = value; } | 48 void set cookie(String value) { _documentPtr.cookie = value; } |
42 | 49 |
| 50 /** @domName Document.defaultView */ |
43 Window get window() => LevelDom.wrapWindow(_documentPtr.defaultView); | 51 Window get window() => LevelDom.wrapWindow(_documentPtr.defaultView); |
44 | 52 |
| 53 /** @domName HTMLDocument.designMode */ |
45 void set designMode(String value) { _documentPtr.designMode = value; } | 54 void set designMode(String value) { _documentPtr.designMode = value; } |
46 | 55 |
| 56 /** @domName Document.domain */ |
47 String get domain() => _documentPtr.domain; | 57 String get domain() => _documentPtr.domain; |
48 | 58 |
| 59 /** @domName Document.head */ |
49 HeadElement get head() => LevelDom.wrapHeadElement(_documentPtr.head); | 60 HeadElement get head() => LevelDom.wrapHeadElement(_documentPtr.head); |
50 | 61 |
| 62 /** @domName Document.lastModified */ |
51 String get lastModified() => _documentPtr.lastModified; | 63 String get lastModified() => _documentPtr.lastModified; |
52 | 64 |
| 65 /** @domName Document.readyState */ |
53 String get readyState() => _documentPtr.readyState; | 66 String get readyState() => _documentPtr.readyState; |
54 | 67 |
| 68 /** @domName Document.referrer */ |
55 String get referrer() => _documentPtr.referrer; | 69 String get referrer() => _documentPtr.referrer; |
56 | 70 |
| 71 /** @domName Document.styleSheets */ |
57 StyleSheetList get styleSheets() => LevelDom.wrapStyleSheetList(_documentPtr.s
tyleSheets); | 72 StyleSheetList get styleSheets() => LevelDom.wrapStyleSheetList(_documentPtr.s
tyleSheets); |
58 | 73 |
| 74 /** @domName Document.title */ |
59 String get title() => _documentPtr.title; | 75 String get title() => _documentPtr.title; |
60 | 76 |
| 77 /** @domName Document.title */ |
61 void set title(String value) { _documentPtr.title = value; } | 78 void set title(String value) { _documentPtr.title = value; } |
62 | 79 |
| 80 /** @domName Document.webkitHidden */ |
63 bool get webkitHidden() => _documentPtr.webkitHidden; | 81 bool get webkitHidden() => _documentPtr.webkitHidden; |
64 | 82 |
| 83 /** @domName Document.webkitVisibilityState */ |
65 String get webkitVisibilityState() => _documentPtr.webkitVisibilityState; | 84 String get webkitVisibilityState() => _documentPtr.webkitVisibilityState; |
66 | 85 |
| 86 /** @domName Document.caretRangeFromPoint */ |
67 Future<Range> caretRangeFromPoint([int x = null, int y = null]) { | 87 Future<Range> caretRangeFromPoint([int x = null, int y = null]) { |
68 return _createMeasurementFuture( | 88 return _createMeasurementFuture( |
69 () => LevelDom.wrapRange(_documentPtr.caretRangeFromPoint(x, y)), | 89 () => LevelDom.wrapRange(_documentPtr.caretRangeFromPoint(x, y)), |
70 new Completer<Range>()); | 90 new Completer<Range>()); |
71 } | 91 } |
72 | 92 |
| 93 /** @domName Document.createElement */ |
73 Element createElement([String tagName = null]) { | 94 Element createElement([String tagName = null]) { |
74 return LevelDom.wrapElement(_documentPtr.createElement(tagName)); | 95 return LevelDom.wrapElement(_documentPtr.createElement(tagName)); |
75 } | 96 } |
76 | 97 |
| 98 /** @domName Document.createEvent */ |
77 Event createEvent([String eventType = null]) { | 99 Event createEvent([String eventType = null]) { |
78 return LevelDom.wrapEvent(_documentPtr.createEvent(eventType)); | 100 return LevelDom.wrapEvent(_documentPtr.createEvent(eventType)); |
79 } | 101 } |
80 | 102 |
| 103 /** @domName Document.elementFromPoint */ |
81 Future<Element> elementFromPoint([int x = null, int y = null]) { | 104 Future<Element> elementFromPoint([int x = null, int y = null]) { |
82 return _createMeasurementFuture( | 105 return _createMeasurementFuture( |
83 () => LevelDom.wrapElement(_documentPtr.elementFromPoint(x, y)), | 106 () => LevelDom.wrapElement(_documentPtr.elementFromPoint(x, y)), |
84 new Completer<Element>()); | 107 new Completer<Element>()); |
85 } | 108 } |
86 | 109 |
| 110 /** @domName Document.execCommand */ |
87 bool execCommand([String command = null, bool userInterface = null, String val
ue = null]) { | 111 bool execCommand([String command = null, bool userInterface = null, String val
ue = null]) { |
88 return _documentPtr.execCommand(command, userInterface, value); | 112 return _documentPtr.execCommand(command, userInterface, value); |
89 } | 113 } |
90 | 114 |
| 115 /** @domName Document.getCSSCanvasContext */ |
91 CanvasRenderingContext getCSSCanvasContext(String contextId, String name, | 116 CanvasRenderingContext getCSSCanvasContext(String contextId, String name, |
92 int width, int height) { | 117 int width, int height) { |
93 return LevelDom.wrapCanvasRenderingContext(_documentPtr.getCSSCanvasContext(
contextId, name, width, height)); | 118 return LevelDom.wrapCanvasRenderingContext(_documentPtr.getCSSCanvasContext(
contextId, name, width, height)); |
94 } | 119 } |
95 | 120 |
| 121 /** @domName Document.queryCommandEnabled */ |
96 bool queryCommandEnabled([String command = null]) { | 122 bool queryCommandEnabled([String command = null]) { |
97 return _documentPtr.queryCommandEnabled(command); | 123 return _documentPtr.queryCommandEnabled(command); |
98 } | 124 } |
99 | 125 |
| 126 /** @domName Document.queryCommandIndeterm */ |
100 bool queryCommandIndeterm([String command = null]) { | 127 bool queryCommandIndeterm([String command = null]) { |
101 return _documentPtr.queryCommandIndeterm(command); | 128 return _documentPtr.queryCommandIndeterm(command); |
102 } | 129 } |
103 | 130 |
| 131 /** @domName Document.queryCommandState */ |
104 bool queryCommandState([String command = null]) { | 132 bool queryCommandState([String command = null]) { |
105 return _documentPtr.queryCommandState(command); | 133 return _documentPtr.queryCommandState(command); |
106 } | 134 } |
107 | 135 |
| 136 /** @domName Document.queryCommandSupported */ |
108 bool queryCommandSupported([String command = null]) { | 137 bool queryCommandSupported([String command = null]) { |
109 return _documentPtr.queryCommandSupported(command); | 138 return _documentPtr.queryCommandSupported(command); |
110 } | 139 } |
111 | 140 |
| 141 /** @domName Document.queryCommandValue */ |
112 String queryCommandValue([String command = null]) { | 142 String queryCommandValue([String command = null]) { |
113 return _documentPtr.queryCommandValue(command); | 143 return _documentPtr.queryCommandValue(command); |
114 } | 144 } |
115 | 145 |
116 String get manifest() => _ptr.manifest; | 146 String get manifest() => _ptr.manifest; |
117 | 147 |
118 void set manifest(String value) { _ptr.manifest = value; } | 148 void set manifest(String value) { _ptr.manifest = value; } |
119 | 149 |
120 DocumentEvents get on() { | 150 DocumentEvents get on() { |
121 if (_on === null) { | 151 if (_on === null) { |
122 _on = new DocumentEventsImplementation._wrap(_ptr); | 152 _on = new DocumentEventsImplementation._wrap(_ptr); |
123 } | 153 } |
124 return _on; | 154 return _on; |
125 } | 155 } |
126 } | 156 } |
OLD | NEW |