DOMCoreClasses.h 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  1. /*
  2. * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
  14. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  17. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  20. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  21. * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  23. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #ifndef DOMCoreClasses_H
  26. #define DOMCoreClasses_H
  27. #include "WebKit.h"
  28. #include "WebScriptObject.h"
  29. namespace WebCore {
  30. class Element;
  31. class Document;
  32. class DOMWindow;
  33. class Node;
  34. class NodeList;
  35. }
  36. class DOMObject : public WebScriptObject, public IDOMObject {
  37. public:
  38. // IUnknown
  39. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
  40. virtual ULONG STDMETHODCALLTYPE AddRef(void) { return WebScriptObject::AddRef(); }
  41. virtual ULONG STDMETHODCALLTYPE Release(void) { return WebScriptObject::Release(); }
  42. // IWebScriptObject
  43. virtual HRESULT STDMETHODCALLTYPE throwException(
  44. /* [in] */ BSTR exceptionMessage,
  45. /* [retval][out] */ BOOL* result) { return WebScriptObject::throwException(exceptionMessage, result); }
  46. virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
  47. /* [in] */ BSTR name,
  48. /* [size_is][in] */ const VARIANT args[ ],
  49. /* [in] */ int cArgs,
  50. /* [retval][out] */ VARIANT* result) { return WebScriptObject::callWebScriptMethod(name, args, cArgs, result); }
  51. virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
  52. /* [in] */ BSTR script,
  53. /* [retval][out] */ VARIANT* result) { return WebScriptObject::evaluateWebScript(script, result); }
  54. virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
  55. /* [in] */ BSTR name) { return WebScriptObject::removeWebScriptKey(name); }
  56. virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
  57. /* [retval][out] */ BSTR* stringRepresentation) { return WebScriptObject::stringRepresentation(stringRepresentation); }
  58. virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
  59. /* [in] */ unsigned int index,
  60. /* [retval][out] */ VARIANT* result) { return WebScriptObject::webScriptValueAtIndex(index, result); }
  61. virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
  62. /* [in] */ unsigned int index,
  63. /* [in] */ VARIANT val) { return WebScriptObject::setWebScriptValueAtIndex(index, val); }
  64. virtual HRESULT STDMETHODCALLTYPE setException(
  65. /* [in] */ BSTR description) { return WebScriptObject::setException(description); }
  66. };
  67. class DECLSPEC_UUID("062AEEE3-9E42-44DC-A8A9-236B216FE011") DOMNode : public DOMObject, public IDOMNode, public IDOMEventTarget {
  68. protected:
  69. DOMNode(WebCore::Node* n);
  70. ~DOMNode();
  71. public:
  72. static IDOMNode* createInstance(WebCore::Node* n);
  73. public:
  74. // IUnknown
  75. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
  76. virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
  77. virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); }
  78. // IWebScriptObject
  79. virtual HRESULT STDMETHODCALLTYPE throwException(
  80. /* [in] */ BSTR exceptionMessage,
  81. /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); }
  82. virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
  83. /* [in] */ BSTR name,
  84. /* [size_is][in] */ const VARIANT args[ ],
  85. /* [in] */ int cArgs,
  86. /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
  87. virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
  88. /* [in] */ BSTR script,
  89. /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); }
  90. virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
  91. /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
  92. virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
  93. /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
  94. virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
  95. /* [in] */ unsigned int index,
  96. /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); }
  97. virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
  98. /* [in] */ unsigned int index,
  99. /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
  100. virtual HRESULT STDMETHODCALLTYPE setException(
  101. /* [in] */ BSTR description) { return DOMObject::setException(description); }
  102. // IDOMNode
  103. virtual HRESULT STDMETHODCALLTYPE nodeName(
  104. /* [retval][out] */ BSTR* result);
  105. virtual HRESULT STDMETHODCALLTYPE nodeValue(
  106. /* [retval][out] */ BSTR* result);
  107. virtual HRESULT STDMETHODCALLTYPE setNodeValue(
  108. /* [in] */ BSTR value);
  109. virtual HRESULT STDMETHODCALLTYPE nodeType(
  110. /* [retval][out] */ unsigned short* result);
  111. virtual HRESULT STDMETHODCALLTYPE parentNode(
  112. /* [retval][out] */ IDOMNode** result);
  113. virtual HRESULT STDMETHODCALLTYPE childNodes(
  114. /* [retval][out] */ IDOMNodeList** result);
  115. virtual HRESULT STDMETHODCALLTYPE firstChild(
  116. /* [retval][out] */ IDOMNode** result);
  117. virtual HRESULT STDMETHODCALLTYPE lastChild(
  118. /* [retval][out] */ IDOMNode** result);
  119. virtual HRESULT STDMETHODCALLTYPE previousSibling(
  120. /* [retval][out] */ IDOMNode** result);
  121. virtual HRESULT STDMETHODCALLTYPE nextSibling(
  122. /* [retval][out] */ IDOMNode** result);
  123. virtual HRESULT STDMETHODCALLTYPE attributes(
  124. /* [retval][out] */ IDOMNamedNodeMap** result);
  125. virtual HRESULT STDMETHODCALLTYPE ownerDocument(
  126. /* [retval][out] */ IDOMDocument** result);
  127. virtual HRESULT STDMETHODCALLTYPE insertBefore(
  128. /* [in] */ IDOMNode* newChild,
  129. /* [in] */ IDOMNode* refChild,
  130. /* [retval][out] */ IDOMNode** result);
  131. virtual HRESULT STDMETHODCALLTYPE replaceChild(
  132. /* [in] */ IDOMNode* newChild,
  133. /* [in] */ IDOMNode* oldChild,
  134. /* [retval][out] */ IDOMNode** result);
  135. virtual HRESULT STDMETHODCALLTYPE removeChild(
  136. /* [in] */ IDOMNode* oldChild,
  137. /* [retval][out] */ IDOMNode** result);
  138. virtual HRESULT STDMETHODCALLTYPE appendChild(
  139. /* [in] */ IDOMNode* oldChild,
  140. /* [retval][out] */ IDOMNode** result);
  141. virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
  142. /* [retval][out] */ BOOL* result);
  143. virtual HRESULT STDMETHODCALLTYPE cloneNode(
  144. /* [in] */ BOOL deep,
  145. /* [retval][out] */ IDOMNode** result);
  146. virtual HRESULT STDMETHODCALLTYPE normalize( void);
  147. virtual HRESULT STDMETHODCALLTYPE isSupported(
  148. /* [in] */ BSTR feature,
  149. /* [in] */ BSTR version,
  150. /* [retval][out] */ BOOL* result);
  151. virtual HRESULT STDMETHODCALLTYPE namespaceURI(
  152. /* [retval][out] */ BSTR* result);
  153. virtual HRESULT STDMETHODCALLTYPE prefix(
  154. /* [retval][out] */ BSTR* result);
  155. virtual HRESULT STDMETHODCALLTYPE setPrefix(
  156. /* [in] */ BSTR prefix);
  157. virtual HRESULT STDMETHODCALLTYPE localName(
  158. /* [retval][out] */ BSTR* result);
  159. virtual HRESULT STDMETHODCALLTYPE hasAttributes(
  160. /* [retval][out] */ BOOL* result);
  161. virtual HRESULT STDMETHODCALLTYPE isSameNode(
  162. /* [in] */ IDOMNode* other,
  163. /* [retval][out] */ BOOL* result);
  164. virtual HRESULT STDMETHODCALLTYPE isEqualNode(
  165. /* [in] */ IDOMNode* other,
  166. /* [retval][out] */ BOOL* result);
  167. virtual HRESULT STDMETHODCALLTYPE textContent(
  168. /* [retval][out] */ BSTR* result);
  169. virtual HRESULT STDMETHODCALLTYPE setTextContent(
  170. /* [in] */ BSTR text);
  171. // IDOMEventTarget
  172. virtual HRESULT STDMETHODCALLTYPE addEventListener(
  173. /* [in] */ BSTR type,
  174. /* [in] */ IDOMEventListener *listener,
  175. /* [in] */ BOOL useCapture);
  176. virtual HRESULT STDMETHODCALLTYPE removeEventListener(
  177. /* [in] */ BSTR type,
  178. /* [in] */ IDOMEventListener *listener,
  179. /* [in] */ BOOL useCapture);
  180. virtual HRESULT STDMETHODCALLTYPE dispatchEvent(
  181. /* [in] */ IDOMEvent *evt,
  182. /* [retval][out] */ BOOL* result);
  183. // DOMNode
  184. WebCore::Node* node() const { return m_node; }
  185. protected:
  186. WebCore::Node* m_node;
  187. };
  188. class DOMNodeList : public DOMObject, public IDOMNodeList {
  189. protected:
  190. DOMNodeList(WebCore::NodeList* l);
  191. ~DOMNodeList();
  192. public:
  193. static IDOMNodeList* createInstance(WebCore::NodeList* l);
  194. public:
  195. // IUnknown
  196. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
  197. virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
  198. virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); }
  199. // IWebScriptObject
  200. virtual HRESULT STDMETHODCALLTYPE throwException(
  201. /* [in] */ BSTR exceptionMessage,
  202. /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); }
  203. virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
  204. /* [in] */ BSTR name,
  205. /* [size_is][in] */ const VARIANT args[ ],
  206. /* [in] */ int cArgs,
  207. /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
  208. virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
  209. /* [in] */ BSTR script,
  210. /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); }
  211. virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
  212. /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
  213. virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
  214. /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
  215. virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
  216. /* [in] */ unsigned int index,
  217. /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); }
  218. virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
  219. /* [in] */ unsigned int index,
  220. /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
  221. virtual HRESULT STDMETHODCALLTYPE setException(
  222. /* [in] */ BSTR description) { return DOMObject::setException(description); }
  223. // IDOMNodeList
  224. virtual HRESULT STDMETHODCALLTYPE item(
  225. /* [in] */ UINT index,
  226. /* [retval][out] */ IDOMNode** result);
  227. virtual HRESULT STDMETHODCALLTYPE length(
  228. /* [retval][out] */ UINT* result);
  229. protected:
  230. WebCore::NodeList* m_nodeList;
  231. };
  232. class DOMDocument : public DOMNode, public IDOMDocument, public IDOMViewCSS, public IDOMDocumentEvent {
  233. protected:
  234. DOMDocument(WebCore::Document* d);
  235. ~DOMDocument();
  236. public:
  237. static IDOMDocument* createInstance(WebCore::Document* d);
  238. public:
  239. // IUnknown
  240. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
  241. virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMNode::AddRef(); }
  242. virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMNode::Release(); }
  243. // IWebScriptObject
  244. virtual HRESULT STDMETHODCALLTYPE throwException(
  245. /* [in] */ BSTR exceptionMessage,
  246. /* [retval][out] */ BOOL* result) { return DOMNode::throwException(exceptionMessage, result); }
  247. virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
  248. /* [in] */ BSTR name,
  249. /* [size_is][in] */ const VARIANT args[ ],
  250. /* [in] */ int cArgs,
  251. /* [retval][out] */ VARIANT* result) { return DOMNode::callWebScriptMethod(name, args, cArgs, result); }
  252. virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
  253. /* [in] */ BSTR script,
  254. /* [retval][out] */ VARIANT* result) { return DOMNode::evaluateWebScript(script, result); }
  255. virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
  256. /* [in] */ BSTR name) { return DOMNode::removeWebScriptKey(name); }
  257. virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
  258. /* [retval][out] */ BSTR* stringRepresentation) { return DOMNode::stringRepresentation(stringRepresentation); }
  259. virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
  260. /* [in] */ unsigned int index,
  261. /* [retval][out] */ VARIANT* result) { return DOMNode::webScriptValueAtIndex(index, result); }
  262. virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
  263. /* [in] */ unsigned int index,
  264. /* [in] */ VARIANT val) { return DOMNode::setWebScriptValueAtIndex(index, val); }
  265. virtual HRESULT STDMETHODCALLTYPE setException(
  266. /* [in] */ BSTR description) { return DOMNode::setException(description); }
  267. // IDOMNode
  268. virtual HRESULT STDMETHODCALLTYPE nodeName(
  269. /* [retval][out] */ BSTR* result) { return DOMNode::nodeName(result); }
  270. virtual HRESULT STDMETHODCALLTYPE nodeValue(
  271. /* [retval][out] */ BSTR* result) { return DOMNode::nodeValue(result); }
  272. virtual HRESULT STDMETHODCALLTYPE setNodeValue(
  273. /* [in] */ BSTR value) { return DOMNode::setNodeValue(value); }
  274. virtual HRESULT STDMETHODCALLTYPE nodeType(
  275. /* [retval][out] */ unsigned short* result) { return DOMNode::nodeType(result); }
  276. virtual HRESULT STDMETHODCALLTYPE parentNode(
  277. /* [retval][out] */ IDOMNode** result) { return DOMNode::parentNode(result); }
  278. virtual HRESULT STDMETHODCALLTYPE childNodes(
  279. /* [retval][out] */ IDOMNodeList** result) { return DOMNode::childNodes(result); }
  280. virtual HRESULT STDMETHODCALLTYPE firstChild(
  281. /* [retval][out] */ IDOMNode** result) { return DOMNode::firstChild(result); }
  282. virtual HRESULT STDMETHODCALLTYPE lastChild(
  283. /* [retval][out] */ IDOMNode** result) { return DOMNode::lastChild(result); }
  284. virtual HRESULT STDMETHODCALLTYPE previousSibling(
  285. /* [retval][out] */ IDOMNode** result) { return DOMNode::previousSibling(result); }
  286. virtual HRESULT STDMETHODCALLTYPE nextSibling(
  287. /* [retval][out] */ IDOMNode** result) { return DOMNode::nextSibling(result); }
  288. virtual HRESULT STDMETHODCALLTYPE attributes(
  289. /* [retval][out] */ IDOMNamedNodeMap** result) { return DOMNode::attributes(result); }
  290. virtual HRESULT STDMETHODCALLTYPE ownerDocument(
  291. /* [retval][out] */ IDOMDocument** result) { return DOMNode::ownerDocument(result); }
  292. virtual HRESULT STDMETHODCALLTYPE insertBefore(
  293. /* [in] */ IDOMNode* newChild,
  294. /* [in] */ IDOMNode* refChild,
  295. /* [retval][out] */ IDOMNode** result) { return DOMNode::insertBefore(newChild, refChild, result); }
  296. virtual HRESULT STDMETHODCALLTYPE replaceChild(
  297. /* [in] */ IDOMNode* newChild,
  298. /* [in] */ IDOMNode* oldChild,
  299. /* [retval][out] */ IDOMNode** result) { return DOMNode::replaceChild(newChild, oldChild, result); }
  300. virtual HRESULT STDMETHODCALLTYPE removeChild(
  301. /* [in] */ IDOMNode* oldChild,
  302. /* [retval][out] */ IDOMNode** result) { return DOMNode::removeChild(oldChild, result); }
  303. virtual HRESULT STDMETHODCALLTYPE appendChild(
  304. /* [in] */ IDOMNode* oldChild,
  305. /* [retval][out] */ IDOMNode** result) { return DOMNode::appendChild(oldChild, result); }
  306. virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
  307. /* [retval][out] */ BOOL* result) { return DOMNode::hasChildNodes(result); }
  308. virtual HRESULT STDMETHODCALLTYPE cloneNode(
  309. /* [in] */ BOOL deep,
  310. /* [retval][out] */ IDOMNode** result) { return DOMNode::cloneNode(deep, result); }
  311. virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMNode::normalize(); }
  312. virtual HRESULT STDMETHODCALLTYPE isSupported(
  313. /* [in] */ BSTR feature,
  314. /* [in] */ BSTR version,
  315. /* [retval][out] */ BOOL* result) { return DOMNode::isSupported(feature, version, result); }
  316. virtual HRESULT STDMETHODCALLTYPE namespaceURI(
  317. /* [retval][out] */ BSTR* result) { return DOMNode::namespaceURI(result); }
  318. virtual HRESULT STDMETHODCALLTYPE prefix(
  319. /* [retval][out] */ BSTR* result) { return DOMNode::prefix(result); }
  320. virtual HRESULT STDMETHODCALLTYPE setPrefix(
  321. /* [in] */ BSTR prefix) { return DOMNode::setPrefix(prefix); }
  322. virtual HRESULT STDMETHODCALLTYPE localName(
  323. /* [retval][out] */ BSTR* result) { return DOMNode::localName(result); }
  324. virtual HRESULT STDMETHODCALLTYPE hasAttributes(
  325. /* [retval][out] */ BOOL* result) { return DOMNode::hasAttributes(result); }
  326. virtual HRESULT STDMETHODCALLTYPE isSameNode(
  327. /* [in] */ IDOMNode* other,
  328. /* [retval][out] */ BOOL* result) { return DOMNode::isSameNode(other, result); }
  329. virtual HRESULT STDMETHODCALLTYPE isEqualNode(
  330. /* [in] */ IDOMNode* other,
  331. /* [retval][out] */ BOOL* result) { return DOMNode::isEqualNode(other, result); }
  332. virtual HRESULT STDMETHODCALLTYPE textContent(
  333. /* [retval][out] */ BSTR* result) { return DOMNode::textContent(result); }
  334. virtual HRESULT STDMETHODCALLTYPE setTextContent(
  335. /* [in] */ BSTR text) { return DOMNode::setTextContent(text); }
  336. // IDOMDocument
  337. virtual HRESULT STDMETHODCALLTYPE doctype(
  338. /* [retval][out] */ IDOMDocumentType** result);
  339. virtual HRESULT STDMETHODCALLTYPE implementation(
  340. /* [retval][out] */ IDOMImplementation** result);
  341. virtual HRESULT STDMETHODCALLTYPE documentElement(
  342. /* [retval][out] */ IDOMElement** result);
  343. virtual HRESULT STDMETHODCALLTYPE createElement(
  344. /* [in] */ BSTR tagName,
  345. /* [retval][out] */ IDOMElement** result);
  346. virtual HRESULT STDMETHODCALLTYPE createDocumentFragment(
  347. /* [retval][out] */ IDOMDocumentFragment** result);
  348. virtual HRESULT STDMETHODCALLTYPE createTextNode(
  349. /* [in] */ BSTR data,
  350. /* [retval][out] */ IDOMText** result);
  351. virtual HRESULT STDMETHODCALLTYPE createComment(
  352. /* [in] */ BSTR data,
  353. /* [retval][out] */ IDOMComment** result);
  354. virtual HRESULT STDMETHODCALLTYPE createCDATASection(
  355. /* [in] */ BSTR data,
  356. /* [retval][out] */ IDOMCDATASection** result);
  357. virtual HRESULT STDMETHODCALLTYPE createProcessingInstruction(
  358. /* [in] */ BSTR target,
  359. /* [in] */ BSTR data,
  360. /* [retval][out] */ IDOMProcessingInstruction** result);
  361. virtual HRESULT STDMETHODCALLTYPE createAttribute(
  362. /* [in] */ BSTR name,
  363. /* [retval][out] */ IDOMAttr** result);
  364. virtual HRESULT STDMETHODCALLTYPE createEntityReference(
  365. /* [in] */ BSTR name,
  366. /* [retval][out] */ IDOMEntityReference** result);
  367. virtual HRESULT STDMETHODCALLTYPE getElementsByTagName(
  368. /* [in] */ BSTR tagName,
  369. /* [retval][out] */ IDOMNodeList** result);
  370. virtual HRESULT STDMETHODCALLTYPE importNode(
  371. /* [in] */ IDOMNode* importedNode,
  372. /* [in] */ BOOL deep,
  373. /* [retval][out] */ IDOMNode** result);
  374. virtual HRESULT STDMETHODCALLTYPE createElementNS(
  375. /* [in] */ BSTR namespaceURI,
  376. /* [in] */ BSTR qualifiedName,
  377. /* [retval][out] */ IDOMElement** result);
  378. virtual HRESULT STDMETHODCALLTYPE createAttributeNS(
  379. /* [in] */ BSTR namespaceURI,
  380. /* [in] */ BSTR qualifiedName,
  381. /* [retval][out] */ IDOMAttr** result);
  382. virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS(
  383. /* [in] */ BSTR namespaceURI,
  384. /* [in] */ BSTR localName,
  385. /* [retval][out] */ IDOMNodeList** result);
  386. virtual HRESULT STDMETHODCALLTYPE getElementById(
  387. /* [in] */ BSTR elementId,
  388. /* [retval][out] */ IDOMElement** result);
  389. // IDOMViewCSS
  390. virtual HRESULT STDMETHODCALLTYPE getComputedStyle(
  391. /* [in] */ IDOMElement* elt,
  392. /* [in] */ BSTR pseudoElt,
  393. /* [retval][out] */ IDOMCSSStyleDeclaration** result);
  394. // IDOMDocumentEvent
  395. virtual HRESULT STDMETHODCALLTYPE createEvent(
  396. /* [in] */ BSTR eventType,
  397. /* [retval][out] */ IDOMEvent** result);
  398. // DOMDocument
  399. WebCore::Document* document() { return m_document; }
  400. protected:
  401. WebCore::Document* m_document;
  402. };
  403. class DOMWindow : public DOMObject, public IDOMWindow, public IDOMEventTarget {
  404. protected:
  405. DOMWindow(WebCore::DOMWindow*);
  406. ~DOMWindow();
  407. public:
  408. static IDOMWindow* createInstance(WebCore::DOMWindow*);
  409. public:
  410. // IUnknown
  411. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
  412. virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
  413. virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); }
  414. // IWebScriptObject
  415. virtual HRESULT STDMETHODCALLTYPE throwException(
  416. /* [in] */ BSTR exceptionMessage,
  417. /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); }
  418. virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
  419. /* [in] */ BSTR name,
  420. /* [size_is][in] */ const VARIANT args[ ],
  421. /* [in] */ int cArgs,
  422. /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); }
  423. virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
  424. /* [in] */ BSTR script,
  425. /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); }
  426. virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
  427. /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); }
  428. virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
  429. /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); }
  430. virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
  431. /* [in] */ unsigned int index,
  432. /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); }
  433. virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
  434. /* [in] */ unsigned int index,
  435. /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); }
  436. virtual HRESULT STDMETHODCALLTYPE setException(
  437. /* [in] */ BSTR description) { return DOMObject::setException(description); }
  438. virtual HRESULT STDMETHODCALLTYPE document(
  439. /* [out, retval] */ IDOMDocument**);
  440. virtual HRESULT STDMETHODCALLTYPE getComputedStyle(
  441. /* [in] */ IDOMElement*,
  442. /* [in] */ BSTR);
  443. virtual HRESULT STDMETHODCALLTYPE getMatchedCSSRules(
  444. /* [in] */ IDOMElement*,
  445. /* [in] */ BSTR,
  446. /* [in] */ BOOL,
  447. /* [out, retval] */ IDOMCSSRuleList**);
  448. virtual HRESULT STDMETHODCALLTYPE devicePixelRatio(
  449. /* [out, retval] */ double*);
  450. virtual HRESULT STDMETHODCALLTYPE addEventListener(
  451. /* [in] */ BSTR,
  452. /* [in] */ IDOMEventListener *,
  453. /* [in] */ BOOL);
  454. virtual HRESULT STDMETHODCALLTYPE removeEventListener(
  455. /* [in] */ BSTR,
  456. /* [in] */ IDOMEventListener *,
  457. /* [in] */ BOOL);
  458. virtual HRESULT STDMETHODCALLTYPE dispatchEvent(
  459. /* [in] */ IDOMEvent *,
  460. /* [retval][out] */ BOOL *);
  461. // DOMWindow
  462. WebCore::DOMWindow* window() { return m_window; }
  463. protected:
  464. WebCore::DOMWindow* m_window;
  465. };
  466. class DOMElement : public DOMNode, public IDOMElement, public IDOMElementPrivate, public IDOMNodeExtensions, public IDOMElementCSSInlineStyle, public IDOMElementExtensions {
  467. protected:
  468. DOMElement(WebCore::Element* e);
  469. ~DOMElement();
  470. public:
  471. static IDOMElement* createInstance(WebCore::Element* e);
  472. // IUnknown
  473. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
  474. virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMNode::AddRef(); }
  475. virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMNode::Release(); }
  476. // IWebScriptObject
  477. virtual HRESULT STDMETHODCALLTYPE throwException(
  478. /* [in] */ BSTR exceptionMessage,
  479. /* [retval][out] */ BOOL* result) { return DOMNode::throwException(exceptionMessage, result); }
  480. virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(
  481. /* [in] */ BSTR name,
  482. /* [size_is][in] */ const VARIANT args[ ],
  483. /* [in] */ int cArgs,
  484. /* [retval][out] */ VARIANT* result) { return DOMNode::callWebScriptMethod(name, args, cArgs, result); }
  485. virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(
  486. /* [in] */ BSTR script,
  487. /* [retval][out] */ VARIANT* result) { return DOMNode::evaluateWebScript(script, result); }
  488. virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(
  489. /* [in] */ BSTR name) { return DOMNode::removeWebScriptKey(name); }
  490. virtual HRESULT STDMETHODCALLTYPE stringRepresentation(
  491. /* [retval][out] */ BSTR* stringRepresentation) { return DOMNode::stringRepresentation(stringRepresentation); }
  492. virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(
  493. /* [in] */ unsigned int index,
  494. /* [retval][out] */ VARIANT* result) { return DOMNode::webScriptValueAtIndex(index, result); }
  495. virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(
  496. /* [in] */ unsigned int index,
  497. /* [in] */ VARIANT val) { return DOMNode::setWebScriptValueAtIndex(index, val); }
  498. virtual HRESULT STDMETHODCALLTYPE setException(
  499. /* [in] */ BSTR description) { return DOMNode::setException(description); }
  500. // IDOMNode
  501. virtual HRESULT STDMETHODCALLTYPE nodeName(
  502. /* [retval][out] */ BSTR* result) { return DOMNode::nodeName(result); }
  503. virtual HRESULT STDMETHODCALLTYPE nodeValue(
  504. /* [retval][out] */ BSTR* result) { return DOMNode::nodeValue(result); }
  505. virtual HRESULT STDMETHODCALLTYPE setNodeValue(
  506. /* [in] */ BSTR value) { return DOMNode::setNodeValue(value); }
  507. virtual HRESULT STDMETHODCALLTYPE nodeType(
  508. /* [retval][out] */ unsigned short* result) { return DOMNode::nodeType(result); }
  509. virtual HRESULT STDMETHODCALLTYPE parentNode(
  510. /* [retval][out] */ IDOMNode** result) { return DOMNode::parentNode(result); }
  511. virtual HRESULT STDMETHODCALLTYPE childNodes(
  512. /* [retval][out] */ IDOMNodeList** result) { return DOMNode::childNodes(result); }
  513. virtual HRESULT STDMETHODCALLTYPE firstChild(
  514. /* [retval][out] */ IDOMNode** result) { return DOMNode::firstChild(result); }
  515. virtual HRESULT STDMETHODCALLTYPE lastChild(
  516. /* [retval][out] */ IDOMNode** result) { return DOMNode::lastChild(result); }
  517. virtual HRESULT STDMETHODCALLTYPE previousSibling(
  518. /* [retval][out] */ IDOMNode** result) { return DOMNode::previousSibling(result); }
  519. virtual HRESULT STDMETHODCALLTYPE nextSibling(
  520. /* [retval][out] */ IDOMNode** result) { return DOMNode::nextSibling(result); }
  521. virtual HRESULT STDMETHODCALLTYPE attributes(
  522. /* [retval][out] */ IDOMNamedNodeMap** result) { return DOMNode::attributes(result); }
  523. virtual HRESULT STDMETHODCALLTYPE ownerDocument(
  524. /* [retval][out] */ IDOMDocument** result) { return DOMNode::ownerDocument(result); }
  525. virtual HRESULT STDMETHODCALLTYPE insertBefore(
  526. /* [in] */ IDOMNode* newChild,
  527. /* [in] */ IDOMNode* refChild,
  528. /* [retval][out] */ IDOMNode** result) { return DOMNode::insertBefore(newChild, refChild, result); }
  529. virtual HRESULT STDMETHODCALLTYPE replaceChild(
  530. /* [in] */ IDOMNode* newChild,
  531. /* [in] */ IDOMNode* oldChild,
  532. /* [retval][out] */ IDOMNode** result) { return DOMNode::replaceChild(newChild, oldChild, result); }
  533. virtual HRESULT STDMETHODCALLTYPE removeChild(
  534. /* [in] */ IDOMNode* oldChild,
  535. /* [retval][out] */ IDOMNode** result) { return DOMNode::removeChild(oldChild, result); }
  536. virtual HRESULT STDMETHODCALLTYPE appendChild(
  537. /* [in] */ IDOMNode* oldChild,
  538. /* [retval][out] */ IDOMNode** result) { return DOMNode::appendChild(oldChild, result); }
  539. virtual HRESULT STDMETHODCALLTYPE hasChildNodes(
  540. /* [retval][out] */ BOOL* result) { return DOMNode::hasChildNodes(result); }
  541. virtual HRESULT STDMETHODCALLTYPE cloneNode(
  542. /* [in] */ BOOL deep,
  543. /* [retval][out] */ IDOMNode** result) { return DOMNode::cloneNode(deep, result); }
  544. virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMNode::normalize(); }
  545. virtual HRESULT STDMETHODCALLTYPE isSupported(
  546. /* [in] */ BSTR feature,
  547. /* [in] */ BSTR version,
  548. /* [retval][out] */ BOOL* result) { return DOMNode::isSupported(feature, version, result); }
  549. virtual HRESULT STDMETHODCALLTYPE namespaceURI(
  550. /* [retval][out] */ BSTR* result) { return DOMNode::namespaceURI(result); }
  551. virtual HRESULT STDMETHODCALLTYPE prefix(
  552. /* [retval][out] */ BSTR* result) { return DOMNode::prefix(result); }
  553. virtual HRESULT STDMETHODCALLTYPE setPrefix(
  554. /* [in] */ BSTR prefix) { return DOMNode::setPrefix(prefix); }
  555. virtual HRESULT STDMETHODCALLTYPE localName(
  556. /* [retval][out] */ BSTR* result) { return DOMNode::localName(result); }
  557. virtual HRESULT STDMETHODCALLTYPE hasAttributes(
  558. /* [retval][out] */ BOOL* result) { return DOMNode::hasAttributes(result); }
  559. virtual HRESULT STDMETHODCALLTYPE isSameNode(
  560. /* [in] */ IDOMNode* other,
  561. /* [retval][out] */ BOOL* result) { return DOMNode::isSameNode(other, result); }
  562. virtual HRESULT STDMETHODCALLTYPE isEqualNode(
  563. /* [in] */ IDOMNode* other,
  564. /* [retval][out] */ BOOL* result) { return DOMNode::isEqualNode(other, result); }
  565. virtual HRESULT STDMETHODCALLTYPE textContent(
  566. /* [retval][out] */ BSTR* result) { return DOMNode::textContent(result); }
  567. virtual HRESULT STDMETHODCALLTYPE setTextContent(
  568. /* [in] */ BSTR text) { return DOMNode::setTextContent(text); }
  569. // IDOMElement
  570. virtual HRESULT STDMETHODCALLTYPE tagName(
  571. /* [retval][out] */ BSTR* result);
  572. virtual HRESULT STDMETHODCALLTYPE getAttribute(
  573. /* [in] */ BSTR name,
  574. /* [retval][out] */ BSTR* result);
  575. virtual HRESULT STDMETHODCALLTYPE setAttribute(
  576. /* [in] */ BSTR name,
  577. /* [in] */ BSTR value);
  578. virtual HRESULT STDMETHODCALLTYPE removeAttribute(
  579. /* [in] */ BSTR name);
  580. virtual HRESULT STDMETHODCALLTYPE getAttributeNode(
  581. /* [in] */ BSTR name,
  582. /* [retval][out] */ IDOMAttr** result);
  583. virtual HRESULT STDMETHODCALLTYPE setAttributeNode(
  584. /* [in] */ IDOMAttr *newAttr,
  585. /* [retval][out] */ IDOMAttr** result);
  586. virtual HRESULT STDMETHODCALLTYPE removeAttributeNode(
  587. /* [in] */ IDOMAttr *oldAttr,
  588. /* [retval][out] */ IDOMAttr** result);
  589. virtual HRESULT STDMETHODCALLTYPE getElementsByTagName(
  590. /* [in] */ BSTR name,
  591. /* [retval][out] */ IDOMNodeList** result);
  592. virtual HRESULT STDMETHODCALLTYPE getAttributeNS(
  593. /* [in] */ BSTR namespaceURI,
  594. /* [in] */ BSTR localName,
  595. /* [retval][out] */ BSTR* result);
  596. virtual HRESULT STDMETHODCALLTYPE setAttributeNS(
  597. /* [in] */ BSTR namespaceURI,
  598. /* [in] */ BSTR qualifiedName,
  599. /* [in] */ BSTR value);
  600. virtual HRESULT STDMETHODCALLTYPE removeAttributeNS(
  601. /* [in] */ BSTR namespaceURI,
  602. /* [in] */ BSTR localName);
  603. virtual HRESULT STDMETHODCALLTYPE getAttributeNodeNS(
  604. /* [in] */ BSTR namespaceURI,
  605. /* [in] */ BSTR localName,
  606. /* [retval][out] */ IDOMAttr** result);
  607. virtual HRESULT STDMETHODCALLTYPE setAttributeNodeNS(
  608. /* [in] */ IDOMAttr *newAttr,
  609. /* [retval][out] */ IDOMAttr** result);
  610. virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS(
  611. /* [in] */ BSTR namespaceURI,
  612. /* [in] */ BSTR localName,
  613. /* [retval][out] */ IDOMNodeList** result);
  614. virtual HRESULT STDMETHODCALLTYPE hasAttribute(
  615. /* [in] */ BSTR name,
  616. /* [retval][out] */ BOOL* result);
  617. virtual HRESULT STDMETHODCALLTYPE hasAttributeNS(
  618. /* [in] */ BSTR namespaceURI,
  619. /* [in] */ BSTR localName,
  620. /* [retval][out] */ BOOL* result);
  621. virtual HRESULT STDMETHODCALLTYPE focus( void);
  622. virtual HRESULT STDMETHODCALLTYPE blur( void);
  623. // IDOMNodeExtensions
  624. virtual HRESULT STDMETHODCALLTYPE boundingBox(
  625. /* [retval][out] */ LPRECT rect);
  626. virtual HRESULT STDMETHODCALLTYPE lineBoxRects(
  627. /* [size_is][in] */ RECT* rects,
  628. /* [in] */ int cRects);
  629. // IDOMElementPrivate
  630. virtual HRESULT STDMETHODCALLTYPE coreElement(
  631. void** element);
  632. virtual HRESULT STDMETHODCALLTYPE isEqual(
  633. /* [in] */ IDOMElement* other,
  634. /* [retval][out] */ BOOL* result);
  635. virtual HRESULT STDMETHODCALLTYPE isFocused(
  636. /* [retval][out] */ BOOL* result);
  637. virtual HRESULT STDMETHODCALLTYPE innerText(
  638. /* [retval][out] */ BSTR* result);
  639. virtual HRESULT STDMETHODCALLTYPE font(
  640. WebFontDescription* webFontDescription);
  641. virtual HRESULT STDMETHODCALLTYPE renderedImage(
  642. /* [retval][out] */ HBITMAP* image);
  643. virtual HRESULT STDMETHODCALLTYPE markerTextForListItem(
  644. /* [retval][out] */ BSTR* markerText);
  645. virtual HRESULT STDMETHODCALLTYPE shadowPseudoId(
  646. /* [retval][out] */ BSTR* result);
  647. // IDOMElementCSSInlineStyle
  648. virtual HRESULT STDMETHODCALLTYPE style(
  649. /* [retval][out] */ IDOMCSSStyleDeclaration** result);
  650. // IDOMElementExtensions
  651. virtual HRESULT STDMETHODCALLTYPE offsetLeft(
  652. /* [retval][out] */ int* result);
  653. virtual HRESULT STDMETHODCALLTYPE offsetTop(
  654. /* [retval][out] */ int* result);
  655. virtual HRESULT STDMETHODCALLTYPE offsetWidth(
  656. /* [retval][out] */ int* result);
  657. virtual HRESULT STDMETHODCALLTYPE offsetHeight(
  658. /* [retval][out] */ int* result);
  659. virtual HRESULT STDMETHODCALLTYPE offsetParent(
  660. /* [retval][out] */ IDOMElement** result);
  661. virtual HRESULT STDMETHODCALLTYPE clientWidth(
  662. /* [retval][out] */ int* result);
  663. virtual HRESULT STDMETHODCALLTYPE clientHeight(
  664. /* [retval][out] */ int* result);
  665. virtual HRESULT STDMETHODCALLTYPE scrollLeft(
  666. /* [retval][out] */ int* result);
  667. virtual HRESULT STDMETHODCALLTYPE setScrollLeft(
  668. /* [in] */ int newScrollLeft);
  669. virtual HRESULT STDMETHODCALLTYPE scrollTop(
  670. /* [retval][out] */ int* result);
  671. virtual HRESULT STDMETHODCALLTYPE setScrollTop(
  672. /* [in] */ int newScrollTop);
  673. virtual HRESULT STDMETHODCALLTYPE scrollWidth(
  674. /* [retval][out] */ int* result);
  675. virtual HRESULT STDMETHODCALLTYPE scrollHeight(
  676. /* [retval][out] */ int* result);
  677. virtual HRESULT STDMETHODCALLTYPE scrollIntoView(
  678. /* [in] */ BOOL alignWithTop);
  679. virtual HRESULT STDMETHODCALLTYPE scrollIntoViewIfNeeded(
  680. /* [in] */ BOOL centerIfNeeded);
  681. // DOMElement
  682. WebCore::Element* element() { return m_element; }
  683. protected:
  684. WebCore::Element* m_element;
  685. };
  686. #endif