| 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.dynamic.dartObjectLocalStorage = this; | 25 _documentPtr.dynamic.dartObjectLocalStorage = this; |
| 25 } | 26 } |
| 26 | 27 |
| 27 /** @domName HTMLDocument.activeElement */ | 28 /** @domName activeElement */ |
| 28 Element get activeElement() => LevelDom.wrapElement(_documentPtr.dynamic.activ
eElement); | 29 Element get activeElement() => LevelDom.wrapElement(_documentPtr.dynamic.activ
eElement); |
| 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.dynamic.designMode = value; } | 55 void set designMode(String value) { _documentPtr.dynamic.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.createEvent */ | 94 /** @domName createEvent */ |
| 94 Event createEvent(String eventType) { | 95 Event createEvent(String eventType) { |
| 95 return LevelDom.wrapEvent(_documentPtr.createEvent(eventType)); | 96 return LevelDom.wrapEvent(_documentPtr.createEvent(eventType)); |
| 96 } | 97 } |
| 97 | 98 |
| 98 /** @domName Document.elementFromPoint */ | 99 /** @domName elementFromPoint */ |
| 99 Future<Element> elementFromPoint([int x = null, int y = null]) { | 100 Future<Element> elementFromPoint([int x = null, int y = null]) { |
| 100 return _createMeasurementFuture( | 101 return _createMeasurementFuture( |
| 101 () => LevelDom.wrapElement(_documentPtr.elementFromPoint(x, y)), | 102 () => LevelDom.wrapElement(_documentPtr.elementFromPoint(x, y)), |
| 102 new Completer<Element>()); | 103 new Completer<Element>()); |
| 103 } | 104 } |
| 104 | 105 |
| 105 /** @domName Document.execCommand */ | 106 /** @domName execCommand */ |
| 106 bool execCommand([String command = null, bool userInterface = null, String val
ue = null]) { | 107 bool execCommand([String command = null, bool userInterface = null, String val
ue = null]) { |
| 107 return _documentPtr.execCommand(command, userInterface, value); | 108 return _documentPtr.execCommand(command, userInterface, value); |
| 108 } | 109 } |
| 109 | 110 |
| 110 /** @domName Document.getCSSCanvasContext */ | 111 /** @domName getCSSCanvasContext */ |
| 111 CanvasRenderingContext getCSSCanvasContext(String contextId, String name, | 112 CanvasRenderingContext getCSSCanvasContext(String contextId, String name, |
| 112 int width, int height) { | 113 int width, int height) { |
| 113 return LevelDom.wrapCanvasRenderingContext(_documentPtr.getCSSCanvasContext(
contextId, name, width, height)); | 114 return LevelDom.wrapCanvasRenderingContext(_documentPtr.getCSSCanvasContext(
contextId, name, width, height)); |
| 114 } | 115 } |
| 115 | 116 |
| 116 /** @domName Document.queryCommandEnabled */ | 117 /** @domName queryCommandEnabled */ |
| 117 bool queryCommandEnabled([String command = null]) { | 118 bool queryCommandEnabled([String command = null]) { |
| 118 return _documentPtr.queryCommandEnabled(command); | 119 return _documentPtr.queryCommandEnabled(command); |
| 119 } | 120 } |
| 120 | 121 |
| 121 /** @domName Document.queryCommandIndeterm */ | 122 /** @domName queryCommandIndeterm */ |
| 122 bool queryCommandIndeterm([String command = null]) { | 123 bool queryCommandIndeterm([String command = null]) { |
| 123 return _documentPtr.queryCommandIndeterm(command); | 124 return _documentPtr.queryCommandIndeterm(command); |
| 124 } | 125 } |
| 125 | 126 |
| 126 /** @domName Document.queryCommandState */ | 127 /** @domName queryCommandState */ |
| 127 bool queryCommandState([String command = null]) { | 128 bool queryCommandState([String command = null]) { |
| 128 return _documentPtr.queryCommandState(command); | 129 return _documentPtr.queryCommandState(command); |
| 129 } | 130 } |
| 130 | 131 |
| 131 /** @domName Document.queryCommandSupported */ | 132 /** @domName queryCommandSupported */ |
| 132 bool queryCommandSupported([String command = null]) { | 133 bool queryCommandSupported([String command = null]) { |
| 133 return _documentPtr.queryCommandSupported(command); | 134 return _documentPtr.queryCommandSupported(command); |
| 134 } | 135 } |
| 135 | 136 |
| 136 /** @domName Document.queryCommandValue */ | 137 /** @domName queryCommandValue */ |
| 137 String queryCommandValue([String command = null]) { | 138 String queryCommandValue([String command = null]) { |
| 138 return _documentPtr.queryCommandValue(command); | 139 return _documentPtr.queryCommandValue(command); |
| 139 } | 140 } |
| 140 | 141 |
| 142 /** @domName HTMLHtmlElement.manifest */ |
| 141 String get manifest() => _ptr.manifest; | 143 String get manifest() => _ptr.manifest; |
| 142 | 144 |
| 145 /** @domName HTMLHtmlElement.manifest */ |
| 143 void set manifest(String value) { _ptr.manifest = value; } | 146 void set manifest(String value) { _ptr.manifest = value; } |
| 144 | 147 |
| 145 DocumentEvents get on() { | 148 DocumentEvents get on() { |
| 146 if (_on === null) { | 149 if (_on === null) { |
| 147 _on = new DocumentEventsImplementation._wrap(_ptr); | 150 _on = new DocumentEventsImplementation._wrap(_ptr); |
| 148 } | 151 } |
| 149 return _on; | 152 return _on; |
| 150 } | 153 } |
| 151 } | 154 } |
| OLD | NEW |