OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 class _DocumentImpl extends _ElementImpl |
| 6 implements Document |
| 7 native "*HTMLHtmlElement" { |
| 8 |
| 9 _ElementImpl get activeElement() native "return this.parentNode.activeElement;
"; |
| 10 |
| 11 _ElementImpl get body() native "return this.parentNode.body;"; |
| 12 |
| 13 void set body(_ElementImpl value) native "this.parentNode.body = value;"; |
| 14 |
| 15 String get charset() native "return this.parentNode.charset;"; |
| 16 |
| 17 void set charset(String value) native "this.parentNode.charset = value;"; |
| 18 |
| 19 String get cookie() native "return this.parentNode.cookie;"; |
| 20 |
| 21 void set cookie(String value) native "this.parentNode.cookie = value;"; |
| 22 |
| 23 _WindowImpl get window() native "return this.parentNode.defaultView;"; |
| 24 |
| 25 String get domain() native "return this.parentNode.domain;"; |
| 26 |
| 27 _HeadElementImpl get head() native "return this.parentNode.head;"; |
| 28 |
| 29 String get lastModified() native "return this.parentNode.lastModified;"; |
| 30 |
| 31 String get preferredStylesheetSet() native "return this.parentNode.preferredSt
ylesheetSet;"; |
| 32 |
| 33 String get readyState() native "return this.parentNode.readyState;"; |
| 34 |
| 35 String get referrer() native "return this.parentNode.referrer;"; |
| 36 |
| 37 String get selectedStylesheetSet() native "return this.parentNode.selectedStyl
esheetSet;"; |
| 38 |
| 39 void set selectedStylesheetSet(String value) native "this.parentNode.selectedS
tylesheetSet = value;"; |
| 40 |
| 41 _StyleSheetListImpl get styleSheets() native "return this.parentNode.styleShee
ts;"; |
| 42 |
| 43 _ElementImpl get webkitCurrentFullScreenElement() native "return this.parentNo
de.webkitCurrentFullScreenElement;"; |
| 44 |
| 45 bool get webkitFullScreenKeyboardInputAllowed() native "return this.parentNode
.webkitFullScreenKeyboardInputAllowed;"; |
| 46 |
| 47 bool get webkitHidden() native "return this.parentNode.webkitHidden;"; |
| 48 |
| 49 bool get webkitIsFullScreen() native "return this.parentNode.webkitIsFullScree
n;"; |
| 50 |
| 51 String get webkitVisibilityState() native "return this.parentNode.webkitVisibi
lityState;"; |
| 52 |
| 53 _DocumentEventsImpl get on() => |
| 54 new _DocumentEventsImpl(_jsDocument); |
| 55 |
| 56 _RangeImpl caretRangeFromPoint(int x, int y) native "return this.parentNode.ca
retRangeFromPoint(x, y);"; |
| 57 |
| 58 _CDATASectionImpl createCDATASection(String data) native "return this.parentNo
de.createCDATASection(data);"; |
| 59 |
| 60 _DocumentFragmentImpl createDocumentFragment() native "return this.parentNode.
createDocumentFragment();"; |
| 61 |
| 62 _ElementImpl _createElement(String tagName) native "return this.parentNode.cre
ateElement(tagName);"; |
| 63 |
| 64 _EventImpl _createEvent(String eventType) native "return this.parentNode.creat
eEvent(eventType);"; |
| 65 |
| 66 _RangeImpl createRange() native "return this.parentNode.createRange();"; |
| 67 |
| 68 _TextImpl _createTextNode(String data) native "return this.parentNode.createTe
xtNode(data);"; |
| 69 |
| 70 _TouchImpl createTouch(_WindowImpl window, _EventTargetImpl target, int identi
fier, int pageX, int pageY, int screenX, int screenY, int webkitRadiusX, int web
kitRadiusY, num webkitRotationAngle, num webkitForce) native "return this.parent
Node.createTouch(window, target, identifier, pageX, pageY, screenX, screenY, web
kitRadiusX, webkitRadiusY, webkitRotationAngle, webkitForce);"; |
| 71 |
| 72 _TouchListImpl _createTouchList() native "return this.parentNode.createTouchLi
st();"; |
| 73 |
| 74 _ElementImpl elementFromPoint(int x, int y) native "return this.parentNode.ele
mentFromPoint(x, y);"; |
| 75 |
| 76 bool execCommand(String command, bool userInterface, String value) native "ret
urn this.parentNode.execCommand(command, userInterface, value);"; |
| 77 |
| 78 Object getCSSCanvasContext(String contextId, String name, int width, int heigh
t) native "return this.parentNode.getCSSCanvasContext(contextId, name, width, he
ight);"; |
| 79 |
| 80 bool queryCommandEnabled(String command) native "return this.parentNode.queryC
ommandEnabled(command);"; |
| 81 |
| 82 bool queryCommandIndeterm(String command) native "return this.parentNode.query
CommandIndeterm(command);"; |
| 83 |
| 84 bool queryCommandState(String command) native "return this.parentNode.queryCom
mandState(command);"; |
| 85 |
| 86 bool queryCommandSupported(String command) native "return this.parentNode.quer
yCommandSupported(command);"; |
| 87 |
| 88 String queryCommandValue(String command) native "return this.parentNode.queryC
ommandValue(command);"; |
| 89 |
| 90 void webkitCancelFullScreen() native "this.parentNode.webkitCancelFullScreen()
;"; |
| 91 |
| 92 _WebKitNamedFlowImpl webkitGetFlowByName(String name) native "return this.pare
ntNode.webkitGetFlowByName(name);"; |
| 93 |
| 94 |
| 95 // TODO(jacobr): remove these methods and let them be generated automatically |
| 96 // once dart supports defining fields with the same name in an interface and |
| 97 // its parent interface. |
| 98 String get title() native "return this.parentNode.title;"; |
| 99 void set title(String value) native "this.parentNode.title = value;"; |
| 100 |
| 101 |
| 102 // For efficiency and simplicity, we always use the HtmlElement as the |
| 103 // Document but sometimes internally we need the real JS document object. |
| 104 _NodeImpl get _jsDocument() native "return this.parentNode;"; |
| 105 |
| 106 // The document doesn't have a parent element. |
| 107 _ElementImpl get parent() => null; |
| 108 } |
| 109 |
| 110 // This class should not be externally visible. If a user ever gets access to |
| 111 // a _SecretHtmlDocumentImpl object that is a bug. This object is hidden by |
| 112 // adding checks to all methods that could an HTMLDocument. We believe that |
| 113 // list is limited to Event.target, and HTMLHtmlElement.parent. |
| 114 class _SecretHtmlDocumentImpl extends _NodeImpl implements Node |
| 115 native "*HTMLDocument" { |
| 116 _DocumentImpl get _documentElement() native "return this.documentElement;"; |
| 117 } |
| 118 |
| 119 EventTarget _FixHtmlDocumentReference(EventTarget eventTarget) { |
| 120 if (eventTarget is _SecretHtmlDocumentImpl) { |
| 121 _SecretHtmlDocumentImpl secretDocument = eventTarget; |
| 122 return secretDocument._documentElement; |
| 123 } else { |
| 124 return eventTarget; |
| 125 } |
| 126 } |
| 127 |
| 128 class _DocumentEventsImpl extends _ElementEventsImpl implements DocumentEvents { |
| 129 _DocumentEventsImpl(_ptr) : super(_ptr); |
| 130 |
| 131 EventListenerList get abort() => _get('abort'); |
| 132 |
| 133 EventListenerList get beforeCopy() => _get('beforecopy'); |
| 134 |
| 135 EventListenerList get beforeCut() => _get('beforecut'); |
| 136 |
| 137 EventListenerList get beforePaste() => _get('beforepaste'); |
| 138 |
| 139 EventListenerList get blur() => _get('blur'); |
| 140 |
| 141 EventListenerList get change() => _get('change'); |
| 142 |
| 143 EventListenerList get click() => _get('click'); |
| 144 |
| 145 EventListenerList get contextMenu() => _get('contextmenu'); |
| 146 |
| 147 EventListenerList get copy() => _get('copy'); |
| 148 |
| 149 EventListenerList get cut() => _get('cut'); |
| 150 |
| 151 EventListenerList get doubleClick() => _get('dblclick'); |
| 152 |
| 153 EventListenerList get drag() => _get('drag'); |
| 154 |
| 155 EventListenerList get dragEnd() => _get('dragend'); |
| 156 |
| 157 EventListenerList get dragEnter() => _get('dragenter'); |
| 158 |
| 159 EventListenerList get dragLeave() => _get('dragleave'); |
| 160 |
| 161 EventListenerList get dragOver() => _get('dragover'); |
| 162 |
| 163 EventListenerList get dragStart() => _get('dragstart'); |
| 164 |
| 165 EventListenerList get drop() => _get('drop'); |
| 166 |
| 167 EventListenerList get error() => _get('error'); |
| 168 |
| 169 EventListenerList get focus() => _get('focus'); |
| 170 |
| 171 EventListenerList get fullscreenChange() => _get('webkitfullscreenchange'); |
| 172 |
| 173 EventListenerList get fullscreenError() => _get('webkitfullscreenerror'); |
| 174 |
| 175 EventListenerList get input() => _get('input'); |
| 176 |
| 177 EventListenerList get invalid() => _get('invalid'); |
| 178 |
| 179 EventListenerList get keyDown() => _get('keydown'); |
| 180 |
| 181 EventListenerList get keyPress() => _get('keypress'); |
| 182 |
| 183 EventListenerList get keyUp() => _get('keyup'); |
| 184 |
| 185 EventListenerList get load() => _get('load'); |
| 186 |
| 187 EventListenerList get mouseDown() => _get('mousedown'); |
| 188 |
| 189 EventListenerList get mouseMove() => _get('mousemove'); |
| 190 |
| 191 EventListenerList get mouseOut() => _get('mouseout'); |
| 192 |
| 193 EventListenerList get mouseOver() => _get('mouseover'); |
| 194 |
| 195 EventListenerList get mouseUp() => _get('mouseup'); |
| 196 |
| 197 EventListenerList get mouseWheel() => _get('mousewheel'); |
| 198 |
| 199 EventListenerList get paste() => _get('paste'); |
| 200 |
| 201 EventListenerList get readyStateChange() => _get('readystatechange'); |
| 202 |
| 203 EventListenerList get reset() => _get('reset'); |
| 204 |
| 205 EventListenerList get scroll() => _get('scroll'); |
| 206 |
| 207 EventListenerList get search() => _get('search'); |
| 208 |
| 209 EventListenerList get select() => _get('select'); |
| 210 |
| 211 EventListenerList get selectStart() => _get('selectstart'); |
| 212 |
| 213 EventListenerList get selectionChange() => _get('selectionchange'); |
| 214 |
| 215 EventListenerList get submit() => _get('submit'); |
| 216 |
| 217 EventListenerList get touchCancel() => _get('touchcancel'); |
| 218 |
| 219 EventListenerList get touchEnd() => _get('touchend'); |
| 220 |
| 221 EventListenerList get touchMove() => _get('touchmove'); |
| 222 |
| 223 EventListenerList get touchStart() => _get('touchstart'); |
| 224 } |
OLD | NEW |