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