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 26 #ifndef DOMCoreClasses_H 27 #define DOMCoreClasses_H 28 29 #include "WebKit.h" 30 #include "WebScriptObject.h" 31 32 namespace WebCore { 33 class Element; 34 class Document; 35 class Node; 36 class NodeList; 37 } 38 39 40 class DOMObject : public WebScriptObject, public IDOMObject { 41 public: 42 // IUnknown 43 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); AddRef(void)44 virtual ULONG STDMETHODCALLTYPE AddRef(void) { return WebScriptObject::AddRef(); } Release(void)45 virtual ULONG STDMETHODCALLTYPE Release(void) { return WebScriptObject::Release(); } 46 47 // IWebScriptObject throwException(BSTR exceptionMessage,BOOL * result)48 virtual HRESULT STDMETHODCALLTYPE throwException( 49 /* [in] */ BSTR exceptionMessage, 50 /* [retval][out] */ BOOL* result) { return WebScriptObject::throwException(exceptionMessage, result); } 51 callWebScriptMethod(BSTR name,const VARIANT args[],int cArgs,VARIANT * result)52 virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod( 53 /* [in] */ BSTR name, 54 /* [size_is][in] */ const VARIANT args[ ], 55 /* [in] */ int cArgs, 56 /* [retval][out] */ VARIANT* result) { return WebScriptObject::callWebScriptMethod(name, args, cArgs, result); } 57 evaluateWebScript(BSTR script,VARIANT * result)58 virtual HRESULT STDMETHODCALLTYPE evaluateWebScript( 59 /* [in] */ BSTR script, 60 /* [retval][out] */ VARIANT* result) { return WebScriptObject::evaluateWebScript(script, result); } 61 removeWebScriptKey(BSTR name)62 virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey( 63 /* [in] */ BSTR name) { return WebScriptObject::removeWebScriptKey(name); } 64 stringRepresentation(BSTR * stringRepresentation)65 virtual HRESULT STDMETHODCALLTYPE stringRepresentation( 66 /* [retval][out] */ BSTR* stringRepresentation) { return WebScriptObject::stringRepresentation(stringRepresentation); } 67 webScriptValueAtIndex(unsigned int index,VARIANT * result)68 virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex( 69 /* [in] */ unsigned int index, 70 /* [retval][out] */ VARIANT* result) { return WebScriptObject::webScriptValueAtIndex(index, result); } 71 setWebScriptValueAtIndex(unsigned int index,VARIANT val)72 virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex( 73 /* [in] */ unsigned int index, 74 /* [in] */ VARIANT val) { return WebScriptObject::setWebScriptValueAtIndex(index, val); } 75 setException(BSTR description)76 virtual HRESULT STDMETHODCALLTYPE setException( 77 /* [in] */ BSTR description) { return WebScriptObject::setException(description); } 78 }; 79 80 class DECLSPEC_UUID("062AEEE3-9E42-44DC-A8A9-236B216FE011") DOMNode : public DOMObject, public IDOMNode, public IDOMEventTarget { 81 protected: 82 DOMNode(WebCore::Node* n); 83 ~DOMNode(); 84 85 public: 86 static IDOMNode* createInstance(WebCore::Node* n); 87 88 public: 89 // IUnknown 90 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); AddRef(void)91 virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); } Release(void)92 virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); } 93 94 // IWebScriptObject throwException(BSTR exceptionMessage,BOOL * result)95 virtual HRESULT STDMETHODCALLTYPE throwException( 96 /* [in] */ BSTR exceptionMessage, 97 /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); } 98 callWebScriptMethod(BSTR name,const VARIANT args[],int cArgs,VARIANT * result)99 virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod( 100 /* [in] */ BSTR name, 101 /* [size_is][in] */ const VARIANT args[ ], 102 /* [in] */ int cArgs, 103 /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); } 104 evaluateWebScript(BSTR script,VARIANT * result)105 virtual HRESULT STDMETHODCALLTYPE evaluateWebScript( 106 /* [in] */ BSTR script, 107 /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); } 108 removeWebScriptKey(BSTR name)109 virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey( 110 /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); } 111 stringRepresentation(BSTR * stringRepresentation)112 virtual HRESULT STDMETHODCALLTYPE stringRepresentation( 113 /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); } 114 webScriptValueAtIndex(unsigned int index,VARIANT * result)115 virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex( 116 /* [in] */ unsigned int index, 117 /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); } 118 setWebScriptValueAtIndex(unsigned int index,VARIANT val)119 virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex( 120 /* [in] */ unsigned int index, 121 /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); } 122 setException(BSTR description)123 virtual HRESULT STDMETHODCALLTYPE setException( 124 /* [in] */ BSTR description) { return DOMObject::setException(description); } 125 126 // IDOMNode 127 virtual HRESULT STDMETHODCALLTYPE nodeName( 128 /* [retval][out] */ BSTR* result); 129 130 virtual HRESULT STDMETHODCALLTYPE nodeValue( 131 /* [retval][out] */ BSTR* result); 132 133 virtual HRESULT STDMETHODCALLTYPE setNodeValue( 134 /* [in] */ BSTR value); 135 136 virtual HRESULT STDMETHODCALLTYPE nodeType( 137 /* [retval][out] */ unsigned short* result); 138 139 virtual HRESULT STDMETHODCALLTYPE parentNode( 140 /* [retval][out] */ IDOMNode** result); 141 142 virtual HRESULT STDMETHODCALLTYPE childNodes( 143 /* [retval][out] */ IDOMNodeList** result); 144 145 virtual HRESULT STDMETHODCALLTYPE firstChild( 146 /* [retval][out] */ IDOMNode** result); 147 148 virtual HRESULT STDMETHODCALLTYPE lastChild( 149 /* [retval][out] */ IDOMNode** result); 150 151 virtual HRESULT STDMETHODCALLTYPE previousSibling( 152 /* [retval][out] */ IDOMNode** result); 153 154 virtual HRESULT STDMETHODCALLTYPE nextSibling( 155 /* [retval][out] */ IDOMNode** result); 156 157 virtual HRESULT STDMETHODCALLTYPE attributes( 158 /* [retval][out] */ IDOMNamedNodeMap** result); 159 160 virtual HRESULT STDMETHODCALLTYPE ownerDocument( 161 /* [retval][out] */ IDOMDocument** result); 162 163 virtual HRESULT STDMETHODCALLTYPE insertBefore( 164 /* [in] */ IDOMNode* newChild, 165 /* [in] */ IDOMNode* refChild, 166 /* [retval][out] */ IDOMNode** result); 167 168 virtual HRESULT STDMETHODCALLTYPE replaceChild( 169 /* [in] */ IDOMNode* newChild, 170 /* [in] */ IDOMNode* oldChild, 171 /* [retval][out] */ IDOMNode** result); 172 173 virtual HRESULT STDMETHODCALLTYPE removeChild( 174 /* [in] */ IDOMNode* oldChild, 175 /* [retval][out] */ IDOMNode** result); 176 177 virtual HRESULT STDMETHODCALLTYPE appendChild( 178 /* [in] */ IDOMNode* oldChild, 179 /* [retval][out] */ IDOMNode** result); 180 181 virtual HRESULT STDMETHODCALLTYPE hasChildNodes( 182 /* [retval][out] */ BOOL* result); 183 184 virtual HRESULT STDMETHODCALLTYPE cloneNode( 185 /* [in] */ BOOL deep, 186 /* [retval][out] */ IDOMNode** result); 187 188 virtual HRESULT STDMETHODCALLTYPE normalize( void); 189 190 virtual HRESULT STDMETHODCALLTYPE isSupported( 191 /* [in] */ BSTR feature, 192 /* [in] */ BSTR version, 193 /* [retval][out] */ BOOL* result); 194 195 virtual HRESULT STDMETHODCALLTYPE namespaceURI( 196 /* [retval][out] */ BSTR* result); 197 198 virtual HRESULT STDMETHODCALLTYPE prefix( 199 /* [retval][out] */ BSTR* result); 200 201 virtual HRESULT STDMETHODCALLTYPE setPrefix( 202 /* [in] */ BSTR prefix); 203 204 virtual HRESULT STDMETHODCALLTYPE localName( 205 /* [retval][out] */ BSTR* result); 206 207 virtual HRESULT STDMETHODCALLTYPE hasAttributes( 208 /* [retval][out] */ BOOL* result); 209 210 virtual HRESULT STDMETHODCALLTYPE isSameNode( 211 /* [in] */ IDOMNode* other, 212 /* [retval][out] */ BOOL* result); 213 214 virtual HRESULT STDMETHODCALLTYPE isEqualNode( 215 /* [in] */ IDOMNode* other, 216 /* [retval][out] */ BOOL* result); 217 218 virtual HRESULT STDMETHODCALLTYPE textContent( 219 /* [retval][out] */ BSTR* result); 220 221 virtual HRESULT STDMETHODCALLTYPE setTextContent( 222 /* [in] */ BSTR text); 223 224 // IDOMEventTarget 225 virtual HRESULT STDMETHODCALLTYPE addEventListener( 226 /* [in] */ BSTR type, 227 /* [in] */ IDOMEventListener *listener, 228 /* [in] */ BOOL useCapture); 229 230 virtual HRESULT STDMETHODCALLTYPE removeEventListener( 231 /* [in] */ BSTR type, 232 /* [in] */ IDOMEventListener *listener, 233 /* [in] */ BOOL useCapture); 234 235 virtual HRESULT STDMETHODCALLTYPE dispatchEvent( 236 /* [in] */ IDOMEvent *evt, 237 /* [retval][out] */ BOOL* result); 238 239 // DOMNode node()240 WebCore::Node* node() const { return m_node; } 241 242 protected: 243 WebCore::Node* m_node; 244 }; 245 246 class DOMNodeList : public DOMObject, public IDOMNodeList { 247 protected: 248 DOMNodeList(WebCore::NodeList* l); 249 ~DOMNodeList(); 250 251 public: 252 static IDOMNodeList* createInstance(WebCore::NodeList* l); 253 254 public: 255 // IUnknown 256 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); AddRef(void)257 virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); } Release(void)258 virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); } 259 260 // IWebScriptObject throwException(BSTR exceptionMessage,BOOL * result)261 virtual HRESULT STDMETHODCALLTYPE throwException( 262 /* [in] */ BSTR exceptionMessage, 263 /* [retval][out] */ BOOL* result) { return DOMObject::throwException(exceptionMessage, result); } 264 callWebScriptMethod(BSTR name,const VARIANT args[],int cArgs,VARIANT * result)265 virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod( 266 /* [in] */ BSTR name, 267 /* [size_is][in] */ const VARIANT args[ ], 268 /* [in] */ int cArgs, 269 /* [retval][out] */ VARIANT* result) { return DOMObject::callWebScriptMethod(name, args, cArgs, result); } 270 evaluateWebScript(BSTR script,VARIANT * result)271 virtual HRESULT STDMETHODCALLTYPE evaluateWebScript( 272 /* [in] */ BSTR script, 273 /* [retval][out] */ VARIANT* result) { return DOMObject::evaluateWebScript(script, result); } 274 removeWebScriptKey(BSTR name)275 virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey( 276 /* [in] */ BSTR name) { return DOMObject::removeWebScriptKey(name); } 277 stringRepresentation(BSTR * stringRepresentation)278 virtual HRESULT STDMETHODCALLTYPE stringRepresentation( 279 /* [retval][out] */ BSTR* stringRepresentation) { return DOMObject::stringRepresentation(stringRepresentation); } 280 webScriptValueAtIndex(unsigned int index,VARIANT * result)281 virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex( 282 /* [in] */ unsigned int index, 283 /* [retval][out] */ VARIANT* result) { return DOMObject::webScriptValueAtIndex(index, result); } 284 setWebScriptValueAtIndex(unsigned int index,VARIANT val)285 virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex( 286 /* [in] */ unsigned int index, 287 /* [in] */ VARIANT val) { return DOMObject::setWebScriptValueAtIndex(index, val); } 288 setException(BSTR description)289 virtual HRESULT STDMETHODCALLTYPE setException( 290 /* [in] */ BSTR description) { return DOMObject::setException(description); } 291 292 // IDOMNodeList 293 virtual HRESULT STDMETHODCALLTYPE item( 294 /* [in] */ UINT index, 295 /* [retval][out] */ IDOMNode** result); 296 297 virtual HRESULT STDMETHODCALLTYPE length( 298 /* [retval][out] */ UINT* result); 299 300 protected: 301 WebCore::NodeList* m_nodeList; 302 }; 303 304 class DOMDocument : public DOMNode, public IDOMDocument, public IDOMViewCSS, public IDOMDocumentEvent { 305 protected: 306 DOMDocument(WebCore::Document* d); 307 ~DOMDocument(); 308 309 public: 310 static IDOMDocument* createInstance(WebCore::Document* d); 311 312 public: 313 // IUnknown 314 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); AddRef(void)315 virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMNode::AddRef(); } Release(void)316 virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMNode::Release(); } 317 318 // IWebScriptObject throwException(BSTR exceptionMessage,BOOL * result)319 virtual HRESULT STDMETHODCALLTYPE throwException( 320 /* [in] */ BSTR exceptionMessage, 321 /* [retval][out] */ BOOL* result) { return DOMNode::throwException(exceptionMessage, result); } 322 callWebScriptMethod(BSTR name,const VARIANT args[],int cArgs,VARIANT * result)323 virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod( 324 /* [in] */ BSTR name, 325 /* [size_is][in] */ const VARIANT args[ ], 326 /* [in] */ int cArgs, 327 /* [retval][out] */ VARIANT* result) { return DOMNode::callWebScriptMethod(name, args, cArgs, result); } 328 evaluateWebScript(BSTR script,VARIANT * result)329 virtual HRESULT STDMETHODCALLTYPE evaluateWebScript( 330 /* [in] */ BSTR script, 331 /* [retval][out] */ VARIANT* result) { return DOMNode::evaluateWebScript(script, result); } 332 removeWebScriptKey(BSTR name)333 virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey( 334 /* [in] */ BSTR name) { return DOMNode::removeWebScriptKey(name); } 335 stringRepresentation(BSTR * stringRepresentation)336 virtual HRESULT STDMETHODCALLTYPE stringRepresentation( 337 /* [retval][out] */ BSTR* stringRepresentation) { return DOMNode::stringRepresentation(stringRepresentation); } 338 webScriptValueAtIndex(unsigned int index,VARIANT * result)339 virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex( 340 /* [in] */ unsigned int index, 341 /* [retval][out] */ VARIANT* result) { return DOMNode::webScriptValueAtIndex(index, result); } 342 setWebScriptValueAtIndex(unsigned int index,VARIANT val)343 virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex( 344 /* [in] */ unsigned int index, 345 /* [in] */ VARIANT val) { return DOMNode::setWebScriptValueAtIndex(index, val); } 346 setException(BSTR description)347 virtual HRESULT STDMETHODCALLTYPE setException( 348 /* [in] */ BSTR description) { return DOMNode::setException(description); } 349 350 // IDOMNode nodeName(BSTR * result)351 virtual HRESULT STDMETHODCALLTYPE nodeName( 352 /* [retval][out] */ BSTR* result) { return DOMNode::nodeName(result); } 353 nodeValue(BSTR * result)354 virtual HRESULT STDMETHODCALLTYPE nodeValue( 355 /* [retval][out] */ BSTR* result) { return DOMNode::nodeValue(result); } 356 setNodeValue(BSTR value)357 virtual HRESULT STDMETHODCALLTYPE setNodeValue( 358 /* [in] */ BSTR value) { return DOMNode::setNodeValue(value); } 359 nodeType(unsigned short * result)360 virtual HRESULT STDMETHODCALLTYPE nodeType( 361 /* [retval][out] */ unsigned short* result) { return DOMNode::nodeType(result); } 362 parentNode(IDOMNode ** result)363 virtual HRESULT STDMETHODCALLTYPE parentNode( 364 /* [retval][out] */ IDOMNode** result) { return DOMNode::parentNode(result); } 365 childNodes(IDOMNodeList ** result)366 virtual HRESULT STDMETHODCALLTYPE childNodes( 367 /* [retval][out] */ IDOMNodeList** result) { return DOMNode::childNodes(result); } 368 firstChild(IDOMNode ** result)369 virtual HRESULT STDMETHODCALLTYPE firstChild( 370 /* [retval][out] */ IDOMNode** result) { return DOMNode::firstChild(result); } 371 lastChild(IDOMNode ** result)372 virtual HRESULT STDMETHODCALLTYPE lastChild( 373 /* [retval][out] */ IDOMNode** result) { return DOMNode::lastChild(result); } 374 previousSibling(IDOMNode ** result)375 virtual HRESULT STDMETHODCALLTYPE previousSibling( 376 /* [retval][out] */ IDOMNode** result) { return DOMNode::previousSibling(result); } 377 nextSibling(IDOMNode ** result)378 virtual HRESULT STDMETHODCALLTYPE nextSibling( 379 /* [retval][out] */ IDOMNode** result) { return DOMNode::nextSibling(result); } 380 attributes(IDOMNamedNodeMap ** result)381 virtual HRESULT STDMETHODCALLTYPE attributes( 382 /* [retval][out] */ IDOMNamedNodeMap** result) { return DOMNode::attributes(result); } 383 ownerDocument(IDOMDocument ** result)384 virtual HRESULT STDMETHODCALLTYPE ownerDocument( 385 /* [retval][out] */ IDOMDocument** result) { return DOMNode::ownerDocument(result); } 386 insertBefore(IDOMNode * newChild,IDOMNode * refChild,IDOMNode ** result)387 virtual HRESULT STDMETHODCALLTYPE insertBefore( 388 /* [in] */ IDOMNode* newChild, 389 /* [in] */ IDOMNode* refChild, 390 /* [retval][out] */ IDOMNode** result) { return DOMNode::insertBefore(newChild, refChild, result); } 391 replaceChild(IDOMNode * newChild,IDOMNode * oldChild,IDOMNode ** result)392 virtual HRESULT STDMETHODCALLTYPE replaceChild( 393 /* [in] */ IDOMNode* newChild, 394 /* [in] */ IDOMNode* oldChild, 395 /* [retval][out] */ IDOMNode** result) { return DOMNode::replaceChild(newChild, oldChild, result); } 396 removeChild(IDOMNode * oldChild,IDOMNode ** result)397 virtual HRESULT STDMETHODCALLTYPE removeChild( 398 /* [in] */ IDOMNode* oldChild, 399 /* [retval][out] */ IDOMNode** result) { return DOMNode::removeChild(oldChild, result); } 400 appendChild(IDOMNode * oldChild,IDOMNode ** result)401 virtual HRESULT STDMETHODCALLTYPE appendChild( 402 /* [in] */ IDOMNode* oldChild, 403 /* [retval][out] */ IDOMNode** result) { return DOMNode::appendChild(oldChild, result); } 404 hasChildNodes(BOOL * result)405 virtual HRESULT STDMETHODCALLTYPE hasChildNodes( 406 /* [retval][out] */ BOOL* result) { return DOMNode::hasChildNodes(result); } 407 cloneNode(BOOL deep,IDOMNode ** result)408 virtual HRESULT STDMETHODCALLTYPE cloneNode( 409 /* [in] */ BOOL deep, 410 /* [retval][out] */ IDOMNode** result) { return DOMNode::cloneNode(deep, result); } 411 normalize(void)412 virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMNode::normalize(); } 413 isSupported(BSTR feature,BSTR version,BOOL * result)414 virtual HRESULT STDMETHODCALLTYPE isSupported( 415 /* [in] */ BSTR feature, 416 /* [in] */ BSTR version, 417 /* [retval][out] */ BOOL* result) { return DOMNode::isSupported(feature, version, result); } 418 namespaceURI(BSTR * result)419 virtual HRESULT STDMETHODCALLTYPE namespaceURI( 420 /* [retval][out] */ BSTR* result) { return DOMNode::namespaceURI(result); } 421 prefix(BSTR * result)422 virtual HRESULT STDMETHODCALLTYPE prefix( 423 /* [retval][out] */ BSTR* result) { return DOMNode::prefix(result); } 424 setPrefix(BSTR prefix)425 virtual HRESULT STDMETHODCALLTYPE setPrefix( 426 /* [in] */ BSTR prefix) { return DOMNode::setPrefix(prefix); } 427 localName(BSTR * result)428 virtual HRESULT STDMETHODCALLTYPE localName( 429 /* [retval][out] */ BSTR* result) { return DOMNode::localName(result); } 430 hasAttributes(BOOL * result)431 virtual HRESULT STDMETHODCALLTYPE hasAttributes( 432 /* [retval][out] */ BOOL* result) { return DOMNode::hasAttributes(result); } 433 isSameNode(IDOMNode * other,BOOL * result)434 virtual HRESULT STDMETHODCALLTYPE isSameNode( 435 /* [in] */ IDOMNode* other, 436 /* [retval][out] */ BOOL* result) { return DOMNode::isSameNode(other, result); } 437 isEqualNode(IDOMNode * other,BOOL * result)438 virtual HRESULT STDMETHODCALLTYPE isEqualNode( 439 /* [in] */ IDOMNode* other, 440 /* [retval][out] */ BOOL* result) { return DOMNode::isEqualNode(other, result); } 441 textContent(BSTR * result)442 virtual HRESULT STDMETHODCALLTYPE textContent( 443 /* [retval][out] */ BSTR* result) { return DOMNode::textContent(result); } 444 setTextContent(BSTR text)445 virtual HRESULT STDMETHODCALLTYPE setTextContent( 446 /* [in] */ BSTR text) { return DOMNode::setTextContent(text); } 447 448 // IDOMDocument 449 virtual HRESULT STDMETHODCALLTYPE doctype( 450 /* [retval][out] */ IDOMDocumentType** result); 451 452 virtual HRESULT STDMETHODCALLTYPE implementation( 453 /* [retval][out] */ IDOMImplementation** result); 454 455 virtual HRESULT STDMETHODCALLTYPE documentElement( 456 /* [retval][out] */ IDOMElement** result); 457 458 virtual HRESULT STDMETHODCALLTYPE createElement( 459 /* [in] */ BSTR tagName, 460 /* [retval][out] */ IDOMElement** result); 461 462 virtual HRESULT STDMETHODCALLTYPE createDocumentFragment( 463 /* [retval][out] */ IDOMDocumentFragment** result); 464 465 virtual HRESULT STDMETHODCALLTYPE createTextNode( 466 /* [in] */ BSTR data, 467 /* [retval][out] */ IDOMText** result); 468 469 virtual HRESULT STDMETHODCALLTYPE createComment( 470 /* [in] */ BSTR data, 471 /* [retval][out] */ IDOMComment** result); 472 473 virtual HRESULT STDMETHODCALLTYPE createCDATASection( 474 /* [in] */ BSTR data, 475 /* [retval][out] */ IDOMCDATASection** result); 476 477 virtual HRESULT STDMETHODCALLTYPE createProcessingInstruction( 478 /* [in] */ BSTR target, 479 /* [in] */ BSTR data, 480 /* [retval][out] */ IDOMProcessingInstruction** result); 481 482 virtual HRESULT STDMETHODCALLTYPE createAttribute( 483 /* [in] */ BSTR name, 484 /* [retval][out] */ IDOMAttr** result); 485 486 virtual HRESULT STDMETHODCALLTYPE createEntityReference( 487 /* [in] */ BSTR name, 488 /* [retval][out] */ IDOMEntityReference** result); 489 490 virtual HRESULT STDMETHODCALLTYPE getElementsByTagName( 491 /* [in] */ BSTR tagName, 492 /* [retval][out] */ IDOMNodeList** result); 493 494 virtual HRESULT STDMETHODCALLTYPE importNode( 495 /* [in] */ IDOMNode* importedNode, 496 /* [in] */ BOOL deep, 497 /* [retval][out] */ IDOMNode** result); 498 499 virtual HRESULT STDMETHODCALLTYPE createElementNS( 500 /* [in] */ BSTR namespaceURI, 501 /* [in] */ BSTR qualifiedName, 502 /* [retval][out] */ IDOMElement** result); 503 504 virtual HRESULT STDMETHODCALLTYPE createAttributeNS( 505 /* [in] */ BSTR namespaceURI, 506 /* [in] */ BSTR qualifiedName, 507 /* [retval][out] */ IDOMAttr** result); 508 509 virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS( 510 /* [in] */ BSTR namespaceURI, 511 /* [in] */ BSTR localName, 512 /* [retval][out] */ IDOMNodeList** result); 513 514 virtual HRESULT STDMETHODCALLTYPE getElementById( 515 /* [in] */ BSTR elementId, 516 /* [retval][out] */ IDOMElement** result); 517 518 // IDOMViewCSS 519 virtual HRESULT STDMETHODCALLTYPE getComputedStyle( 520 /* [in] */ IDOMElement* elt, 521 /* [in] */ BSTR pseudoElt, 522 /* [retval][out] */ IDOMCSSStyleDeclaration** result); 523 524 // IDOMDocumentEvent 525 virtual HRESULT STDMETHODCALLTYPE createEvent( 526 /* [in] */ BSTR eventType, 527 /* [retval][out] */ IDOMEvent** result); 528 529 // DOMDocument document()530 WebCore::Document* document() { return m_document; } 531 532 protected: 533 WebCore::Document* m_document; 534 }; 535 536 class DOMElement : public DOMNode, public IDOMElement, public IDOMElementPrivate, public IDOMNodeExtensions, public IDOMElementCSSInlineStyle, public IDOMElementExtensions { 537 protected: 538 DOMElement(WebCore::Element* e); 539 ~DOMElement(); 540 541 public: 542 static IDOMElement* createInstance(WebCore::Element* e); 543 544 // IUnknown 545 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); AddRef(void)546 virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMNode::AddRef(); } Release(void)547 virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMNode::Release(); } 548 549 // IWebScriptObject throwException(BSTR exceptionMessage,BOOL * result)550 virtual HRESULT STDMETHODCALLTYPE throwException( 551 /* [in] */ BSTR exceptionMessage, 552 /* [retval][out] */ BOOL* result) { return DOMNode::throwException(exceptionMessage, result); } 553 callWebScriptMethod(BSTR name,const VARIANT args[],int cArgs,VARIANT * result)554 virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod( 555 /* [in] */ BSTR name, 556 /* [size_is][in] */ const VARIANT args[ ], 557 /* [in] */ int cArgs, 558 /* [retval][out] */ VARIANT* result) { return DOMNode::callWebScriptMethod(name, args, cArgs, result); } 559 evaluateWebScript(BSTR script,VARIANT * result)560 virtual HRESULT STDMETHODCALLTYPE evaluateWebScript( 561 /* [in] */ BSTR script, 562 /* [retval][out] */ VARIANT* result) { return DOMNode::evaluateWebScript(script, result); } 563 removeWebScriptKey(BSTR name)564 virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey( 565 /* [in] */ BSTR name) { return DOMNode::removeWebScriptKey(name); } 566 stringRepresentation(BSTR * stringRepresentation)567 virtual HRESULT STDMETHODCALLTYPE stringRepresentation( 568 /* [retval][out] */ BSTR* stringRepresentation) { return DOMNode::stringRepresentation(stringRepresentation); } 569 webScriptValueAtIndex(unsigned int index,VARIANT * result)570 virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex( 571 /* [in] */ unsigned int index, 572 /* [retval][out] */ VARIANT* result) { return DOMNode::webScriptValueAtIndex(index, result); } 573 setWebScriptValueAtIndex(unsigned int index,VARIANT val)574 virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex( 575 /* [in] */ unsigned int index, 576 /* [in] */ VARIANT val) { return DOMNode::setWebScriptValueAtIndex(index, val); } 577 setException(BSTR description)578 virtual HRESULT STDMETHODCALLTYPE setException( 579 /* [in] */ BSTR description) { return DOMNode::setException(description); } 580 581 // IDOMNode nodeName(BSTR * result)582 virtual HRESULT STDMETHODCALLTYPE nodeName( 583 /* [retval][out] */ BSTR* result) { return DOMNode::nodeName(result); } 584 nodeValue(BSTR * result)585 virtual HRESULT STDMETHODCALLTYPE nodeValue( 586 /* [retval][out] */ BSTR* result) { return DOMNode::nodeValue(result); } 587 setNodeValue(BSTR value)588 virtual HRESULT STDMETHODCALLTYPE setNodeValue( 589 /* [in] */ BSTR value) { return DOMNode::setNodeValue(value); } 590 nodeType(unsigned short * result)591 virtual HRESULT STDMETHODCALLTYPE nodeType( 592 /* [retval][out] */ unsigned short* result) { return DOMNode::nodeType(result); } 593 parentNode(IDOMNode ** result)594 virtual HRESULT STDMETHODCALLTYPE parentNode( 595 /* [retval][out] */ IDOMNode** result) { return DOMNode::parentNode(result); } 596 childNodes(IDOMNodeList ** result)597 virtual HRESULT STDMETHODCALLTYPE childNodes( 598 /* [retval][out] */ IDOMNodeList** result) { return DOMNode::childNodes(result); } 599 firstChild(IDOMNode ** result)600 virtual HRESULT STDMETHODCALLTYPE firstChild( 601 /* [retval][out] */ IDOMNode** result) { return DOMNode::firstChild(result); } 602 lastChild(IDOMNode ** result)603 virtual HRESULT STDMETHODCALLTYPE lastChild( 604 /* [retval][out] */ IDOMNode** result) { return DOMNode::lastChild(result); } 605 previousSibling(IDOMNode ** result)606 virtual HRESULT STDMETHODCALLTYPE previousSibling( 607 /* [retval][out] */ IDOMNode** result) { return DOMNode::previousSibling(result); } 608 nextSibling(IDOMNode ** result)609 virtual HRESULT STDMETHODCALLTYPE nextSibling( 610 /* [retval][out] */ IDOMNode** result) { return DOMNode::nextSibling(result); } 611 attributes(IDOMNamedNodeMap ** result)612 virtual HRESULT STDMETHODCALLTYPE attributes( 613 /* [retval][out] */ IDOMNamedNodeMap** result) { return DOMNode::attributes(result); } 614 ownerDocument(IDOMDocument ** result)615 virtual HRESULT STDMETHODCALLTYPE ownerDocument( 616 /* [retval][out] */ IDOMDocument** result) { return DOMNode::ownerDocument(result); } 617 insertBefore(IDOMNode * newChild,IDOMNode * refChild,IDOMNode ** result)618 virtual HRESULT STDMETHODCALLTYPE insertBefore( 619 /* [in] */ IDOMNode* newChild, 620 /* [in] */ IDOMNode* refChild, 621 /* [retval][out] */ IDOMNode** result) { return DOMNode::insertBefore(newChild, refChild, result); } 622 replaceChild(IDOMNode * newChild,IDOMNode * oldChild,IDOMNode ** result)623 virtual HRESULT STDMETHODCALLTYPE replaceChild( 624 /* [in] */ IDOMNode* newChild, 625 /* [in] */ IDOMNode* oldChild, 626 /* [retval][out] */ IDOMNode** result) { return DOMNode::replaceChild(newChild, oldChild, result); } 627 removeChild(IDOMNode * oldChild,IDOMNode ** result)628 virtual HRESULT STDMETHODCALLTYPE removeChild( 629 /* [in] */ IDOMNode* oldChild, 630 /* [retval][out] */ IDOMNode** result) { return DOMNode::removeChild(oldChild, result); } 631 appendChild(IDOMNode * oldChild,IDOMNode ** result)632 virtual HRESULT STDMETHODCALLTYPE appendChild( 633 /* [in] */ IDOMNode* oldChild, 634 /* [retval][out] */ IDOMNode** result) { return DOMNode::appendChild(oldChild, result); } 635 hasChildNodes(BOOL * result)636 virtual HRESULT STDMETHODCALLTYPE hasChildNodes( 637 /* [retval][out] */ BOOL* result) { return DOMNode::hasChildNodes(result); } 638 cloneNode(BOOL deep,IDOMNode ** result)639 virtual HRESULT STDMETHODCALLTYPE cloneNode( 640 /* [in] */ BOOL deep, 641 /* [retval][out] */ IDOMNode** result) { return DOMNode::cloneNode(deep, result); } 642 normalize(void)643 virtual HRESULT STDMETHODCALLTYPE normalize( void) { return DOMNode::normalize(); } 644 isSupported(BSTR feature,BSTR version,BOOL * result)645 virtual HRESULT STDMETHODCALLTYPE isSupported( 646 /* [in] */ BSTR feature, 647 /* [in] */ BSTR version, 648 /* [retval][out] */ BOOL* result) { return DOMNode::isSupported(feature, version, result); } 649 namespaceURI(BSTR * result)650 virtual HRESULT STDMETHODCALLTYPE namespaceURI( 651 /* [retval][out] */ BSTR* result) { return DOMNode::namespaceURI(result); } 652 prefix(BSTR * result)653 virtual HRESULT STDMETHODCALLTYPE prefix( 654 /* [retval][out] */ BSTR* result) { return DOMNode::prefix(result); } 655 setPrefix(BSTR prefix)656 virtual HRESULT STDMETHODCALLTYPE setPrefix( 657 /* [in] */ BSTR prefix) { return DOMNode::setPrefix(prefix); } 658 localName(BSTR * result)659 virtual HRESULT STDMETHODCALLTYPE localName( 660 /* [retval][out] */ BSTR* result) { return DOMNode::localName(result); } 661 hasAttributes(BOOL * result)662 virtual HRESULT STDMETHODCALLTYPE hasAttributes( 663 /* [retval][out] */ BOOL* result) { return DOMNode::hasAttributes(result); } 664 isSameNode(IDOMNode * other,BOOL * result)665 virtual HRESULT STDMETHODCALLTYPE isSameNode( 666 /* [in] */ IDOMNode* other, 667 /* [retval][out] */ BOOL* result) { return DOMNode::isSameNode(other, result); } 668 isEqualNode(IDOMNode * other,BOOL * result)669 virtual HRESULT STDMETHODCALLTYPE isEqualNode( 670 /* [in] */ IDOMNode* other, 671 /* [retval][out] */ BOOL* result) { return DOMNode::isEqualNode(other, result); } 672 textContent(BSTR * result)673 virtual HRESULT STDMETHODCALLTYPE textContent( 674 /* [retval][out] */ BSTR* result) { return DOMNode::textContent(result); } 675 setTextContent(BSTR text)676 virtual HRESULT STDMETHODCALLTYPE setTextContent( 677 /* [in] */ BSTR text) { return DOMNode::setTextContent(text); } 678 679 // IDOMElement 680 virtual HRESULT STDMETHODCALLTYPE tagName( 681 /* [retval][out] */ BSTR* result); 682 683 virtual HRESULT STDMETHODCALLTYPE getAttribute( 684 /* [in] */ BSTR name, 685 /* [retval][out] */ BSTR* result); 686 687 virtual HRESULT STDMETHODCALLTYPE setAttribute( 688 /* [in] */ BSTR name, 689 /* [in] */ BSTR value); 690 691 virtual HRESULT STDMETHODCALLTYPE removeAttribute( 692 /* [in] */ BSTR name); 693 694 virtual HRESULT STDMETHODCALLTYPE getAttributeNode( 695 /* [in] */ BSTR name, 696 /* [retval][out] */ IDOMAttr** result); 697 698 virtual HRESULT STDMETHODCALLTYPE setAttributeNode( 699 /* [in] */ IDOMAttr *newAttr, 700 /* [retval][out] */ IDOMAttr** result); 701 702 virtual HRESULT STDMETHODCALLTYPE removeAttributeNode( 703 /* [in] */ IDOMAttr *oldAttr, 704 /* [retval][out] */ IDOMAttr** result); 705 706 virtual HRESULT STDMETHODCALLTYPE getElementsByTagName( 707 /* [in] */ BSTR name, 708 /* [retval][out] */ IDOMNodeList** result); 709 710 virtual HRESULT STDMETHODCALLTYPE getAttributeNS( 711 /* [in] */ BSTR namespaceURI, 712 /* [in] */ BSTR localName, 713 /* [retval][out] */ BSTR* result); 714 715 virtual HRESULT STDMETHODCALLTYPE setAttributeNS( 716 /* [in] */ BSTR namespaceURI, 717 /* [in] */ BSTR qualifiedName, 718 /* [in] */ BSTR value); 719 720 virtual HRESULT STDMETHODCALLTYPE removeAttributeNS( 721 /* [in] */ BSTR namespaceURI, 722 /* [in] */ BSTR localName); 723 724 virtual HRESULT STDMETHODCALLTYPE getAttributeNodeNS( 725 /* [in] */ BSTR namespaceURI, 726 /* [in] */ BSTR localName, 727 /* [retval][out] */ IDOMAttr** result); 728 729 virtual HRESULT STDMETHODCALLTYPE setAttributeNodeNS( 730 /* [in] */ IDOMAttr *newAttr, 731 /* [retval][out] */ IDOMAttr** result); 732 733 virtual HRESULT STDMETHODCALLTYPE getElementsByTagNameNS( 734 /* [in] */ BSTR namespaceURI, 735 /* [in] */ BSTR localName, 736 /* [retval][out] */ IDOMNodeList** result); 737 738 virtual HRESULT STDMETHODCALLTYPE hasAttribute( 739 /* [in] */ BSTR name, 740 /* [retval][out] */ BOOL* result); 741 742 virtual HRESULT STDMETHODCALLTYPE hasAttributeNS( 743 /* [in] */ BSTR namespaceURI, 744 /* [in] */ BSTR localName, 745 /* [retval][out] */ BOOL* result); 746 747 virtual HRESULT STDMETHODCALLTYPE focus( void); 748 749 virtual HRESULT STDMETHODCALLTYPE blur( void); 750 751 // IDOMNodeExtensions 752 virtual HRESULT STDMETHODCALLTYPE boundingBox( 753 /* [retval][out] */ LPRECT rect); 754 755 virtual HRESULT STDMETHODCALLTYPE lineBoxRects( 756 /* [size_is][in] */ RECT* rects, 757 /* [in] */ int cRects); 758 759 // IDOMElementPrivate 760 virtual HRESULT STDMETHODCALLTYPE coreElement( 761 void** element); 762 763 virtual HRESULT STDMETHODCALLTYPE isEqual( 764 /* [in] */ IDOMElement* other, 765 /* [retval][out] */ BOOL* result); 766 767 virtual HRESULT STDMETHODCALLTYPE isFocused( 768 /* [retval][out] */ BOOL* result); 769 770 virtual HRESULT STDMETHODCALLTYPE innerText( 771 /* [retval][out] */ BSTR* result); 772 773 virtual HRESULT STDMETHODCALLTYPE font( 774 WebFontDescription* webFontDescription); 775 776 virtual HRESULT STDMETHODCALLTYPE renderedImage( 777 /* [retval][out] */ HBITMAP* image); 778 779 virtual HRESULT STDMETHODCALLTYPE markerTextForListItem( 780 /* [retval][out] */ BSTR* markerText); 781 782 // IDOMElementCSSInlineStyle 783 virtual HRESULT STDMETHODCALLTYPE style( 784 /* [retval][out] */ IDOMCSSStyleDeclaration** result); 785 786 // IDOMElementExtensions 787 virtual HRESULT STDMETHODCALLTYPE offsetLeft( 788 /* [retval][out] */ int* result); 789 790 virtual HRESULT STDMETHODCALLTYPE offsetTop( 791 /* [retval][out] */ int* result); 792 793 virtual HRESULT STDMETHODCALLTYPE offsetWidth( 794 /* [retval][out] */ int* result); 795 796 virtual HRESULT STDMETHODCALLTYPE offsetHeight( 797 /* [retval][out] */ int* result); 798 799 virtual HRESULT STDMETHODCALLTYPE offsetParent( 800 /* [retval][out] */ IDOMElement** result); 801 802 virtual HRESULT STDMETHODCALLTYPE clientWidth( 803 /* [retval][out] */ int* result); 804 805 virtual HRESULT STDMETHODCALLTYPE clientHeight( 806 /* [retval][out] */ int* result); 807 808 virtual HRESULT STDMETHODCALLTYPE scrollLeft( 809 /* [retval][out] */ int* result); 810 811 virtual HRESULT STDMETHODCALLTYPE setScrollLeft( 812 /* [in] */ int newScrollLeft); 813 814 virtual HRESULT STDMETHODCALLTYPE scrollTop( 815 /* [retval][out] */ int* result); 816 817 virtual HRESULT STDMETHODCALLTYPE setScrollTop( 818 /* [in] */ int newScrollTop); 819 820 virtual HRESULT STDMETHODCALLTYPE scrollWidth( 821 /* [retval][out] */ int* result); 822 823 virtual HRESULT STDMETHODCALLTYPE scrollHeight( 824 /* [retval][out] */ int* result); 825 826 virtual HRESULT STDMETHODCALLTYPE scrollIntoView( 827 /* [in] */ BOOL alignWithTop); 828 829 virtual HRESULT STDMETHODCALLTYPE scrollIntoViewIfNeeded( 830 /* [in] */ BOOL centerIfNeeded); 831 832 // DOMElement element()833 WebCore::Element* element() { return m_element; } 834 835 protected: 836 WebCore::Element* m_element; 837 }; 838 839 #endif 840