ws2_32/tests: Initialize a test buffer (valgrind).
[wine/wine-gecko.git] / dlls / mshtml / htmldoc.c
blob6992c93b5ac0e8ef07e3dee59289aaf247a39f8a
1 /*
2 * Copyright 2005-2009 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
23 #include <assert.h>
25 #define COBJMACROS
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "wininet.h"
31 #include "ole2.h"
32 #include "perhist.h"
33 #include "mshtmdid.h"
35 #include "wine/debug.h"
37 #include "mshtml_private.h"
38 #include "htmlevent.h"
39 #include "pluginhost.h"
40 #include "binding.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
44 HRESULT get_doc_elem_by_id(HTMLDocumentNode *doc, const WCHAR *id, HTMLElement **ret)
46 nsIDOMNodeList *nsnode_list;
47 nsIDOMElement *nselem;
48 nsIDOMNode *nsnode;
49 nsAString id_str;
50 nsresult nsres;
51 HRESULT hres;
53 if(!doc->nsdoc) {
54 WARN("NULL nsdoc\n");
55 return E_UNEXPECTED;
58 nsAString_InitDepend(&id_str, id);
59 /* get element by id attribute */
60 nsres = nsIDOMHTMLDocument_GetElementById(doc->nsdoc, &id_str, &nselem);
61 if(FAILED(nsres)) {
62 ERR("GetElementById failed: %08x\n", nsres);
63 nsAString_Finish(&id_str);
64 return E_FAIL;
67 /* get first element by name attribute */
68 nsres = nsIDOMHTMLDocument_GetElementsByName(doc->nsdoc, &id_str, &nsnode_list);
69 nsAString_Finish(&id_str);
70 if(FAILED(nsres)) {
71 ERR("getElementsByName failed: %08x\n", nsres);
72 if(nselem)
73 nsIDOMElement_Release(nselem);
74 return E_FAIL;
77 nsres = nsIDOMNodeList_Item(nsnode_list, 0, &nsnode);
78 nsIDOMNodeList_Release(nsnode_list);
79 assert(nsres == NS_OK);
81 if(nsnode && nselem) {
82 UINT16 pos;
84 nsres = nsIDOMNode_CompareDocumentPosition(nsnode, (nsIDOMNode*)nselem, &pos);
85 if(NS_FAILED(nsres)) {
86 FIXME("CompareDocumentPosition failed: 0x%08x\n", nsres);
87 nsIDOMNode_Release(nsnode);
88 nsIDOMElement_Release(nselem);
89 return E_FAIL;
92 TRACE("CompareDocumentPosition gave: 0x%x\n", pos);
93 if(!(pos & (DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_CONTAINS))) {
94 nsIDOMElement_Release(nselem);
95 nselem = NULL;
99 if(nsnode) {
100 if(!nselem) {
101 nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMElement, (void**)&nselem);
102 assert(nsres == NS_OK);
104 nsIDOMNode_Release(nsnode);
107 if(!nselem) {
108 *ret = NULL;
109 return S_OK;
112 hres = get_elem(doc, nselem, ret);
113 nsIDOMElement_Release(nselem);
114 return hres;
117 static inline HTMLDocument *impl_from_IHTMLDocument2(IHTMLDocument2 *iface)
119 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument2_iface);
122 static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID riid, void **ppv)
124 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
126 return htmldoc_query_interface(This, riid, ppv);
129 static ULONG WINAPI HTMLDocument_AddRef(IHTMLDocument2 *iface)
131 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
133 return htmldoc_addref(This);
136 static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
138 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
140 return htmldoc_release(This);
143 static HRESULT WINAPI HTMLDocument_GetTypeInfoCount(IHTMLDocument2 *iface, UINT *pctinfo)
145 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
147 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
150 static HRESULT WINAPI HTMLDocument_GetTypeInfo(IHTMLDocument2 *iface, UINT iTInfo,
151 LCID lcid, ITypeInfo **ppTInfo)
153 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
155 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
158 static HRESULT WINAPI HTMLDocument_GetIDsOfNames(IHTMLDocument2 *iface, REFIID riid,
159 LPOLESTR *rgszNames, UINT cNames,
160 LCID lcid, DISPID *rgDispId)
162 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
164 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
165 rgDispId);
168 static HRESULT WINAPI HTMLDocument_Invoke(IHTMLDocument2 *iface, DISPID dispIdMember,
169 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
170 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
172 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
174 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
175 pDispParams, pVarResult, pExcepInfo, puArgErr);
178 static HRESULT WINAPI HTMLDocument_get_Script(IHTMLDocument2 *iface, IDispatch **p)
180 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
182 TRACE("(%p)->(%p)\n", This, p);
184 *p = (IDispatch*)&This->window->base.IHTMLWindow2_iface;
185 IDispatch_AddRef(*p);
186 return S_OK;
189 static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCollection **p)
191 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
192 nsIDOMElement *nselem = NULL;
193 HTMLDOMNode *node;
194 nsresult nsres;
195 HRESULT hres;
197 TRACE("(%p)->(%p)\n", This, p);
199 if(!This->doc_node->nsdoc) {
200 WARN("NULL nsdoc\n");
201 return E_UNEXPECTED;
204 nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
205 if(NS_FAILED(nsres)) {
206 ERR("GetDocumentElement failed: %08x\n", nsres);
207 return E_FAIL;
210 if(!nselem) {
211 *p = NULL;
212 return S_OK;
215 hres = get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE, &node);
216 nsIDOMElement_Release(nselem);
217 if(FAILED(hres))
218 return hres;
220 *p = create_all_collection(node, TRUE);
221 node_release(node);
222 return hres;
225 static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement **p)
227 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
228 nsIDOMHTMLElement *nsbody = NULL;
229 HTMLDOMNode *node;
230 HRESULT hres;
232 TRACE("(%p)->(%p)\n", This, p);
234 if(This->doc_node->nsdoc) {
235 nsresult nsres;
237 nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
238 if(NS_FAILED(nsres)) {
239 TRACE("Could not get body: %08x\n", nsres);
240 return E_UNEXPECTED;
244 if(!nsbody) {
245 *p = NULL;
246 return S_OK;
249 hres = get_node(This->doc_node, (nsIDOMNode*)nsbody, TRUE, &node);
250 nsIDOMHTMLElement_Release(nsbody);
251 if(FAILED(hres))
252 return hres;
254 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
255 node_release(node);
256 return hres;
259 static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTMLElement **p)
261 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
262 nsIDOMElement *nselem;
263 HTMLElement *elem;
264 nsresult nsres;
265 HRESULT hres;
267 TRACE("(%p)->(%p)\n", This, p);
269 if(!This->doc_node->nsdoc) {
270 *p = NULL;
271 return S_OK;
275 * NOTE: Gecko may return an active element even if the document is not visible.
276 * IE returns NULL in this case.
278 nsres = nsIDOMHTMLDocument_GetActiveElement(This->doc_node->nsdoc, &nselem);
279 if(NS_FAILED(nsres)) {
280 ERR("GetActiveElement failed: %08x\n", nsres);
281 return E_FAIL;
284 hres = get_elem(This->doc_node, nselem, &elem);
285 nsIDOMElement_Release(nselem);
286 if(FAILED(hres))
287 return hres;
289 *p = &elem->IHTMLElement_iface;
290 return S_OK;
293 static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p)
295 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
296 nsIDOMHTMLCollection *nscoll = NULL;
297 nsresult nsres;
299 TRACE("(%p)->(%p)\n", This, p);
301 if(!p)
302 return E_INVALIDARG;
304 *p = NULL;
306 if(!This->doc_node->nsdoc) {
307 WARN("NULL nsdoc\n");
308 return E_UNEXPECTED;
311 nsres = nsIDOMHTMLDocument_GetImages(This->doc_node->nsdoc, &nscoll);
312 if(NS_FAILED(nsres)) {
313 ERR("GetImages failed: %08x\n", nsres);
314 return E_FAIL;
317 if(nscoll) {
318 *p = create_collection_from_htmlcol(This->doc_node, nscoll);
319 nsIDOMHTMLCollection_Release(nscoll);
322 return S_OK;
325 static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLElementCollection **p)
327 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
328 nsIDOMHTMLCollection *nscoll = NULL;
329 nsresult nsres;
331 TRACE("(%p)->(%p)\n", This, p);
333 if(!p)
334 return E_INVALIDARG;
336 *p = NULL;
338 if(!This->doc_node->nsdoc) {
339 WARN("NULL nsdoc\n");
340 return E_UNEXPECTED;
343 nsres = nsIDOMHTMLDocument_GetApplets(This->doc_node->nsdoc, &nscoll);
344 if(NS_FAILED(nsres)) {
345 ERR("GetApplets failed: %08x\n", nsres);
346 return E_FAIL;
349 if(nscoll) {
350 *p = create_collection_from_htmlcol(This->doc_node, nscoll);
351 nsIDOMHTMLCollection_Release(nscoll);
354 return S_OK;
357 static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElementCollection **p)
359 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
360 nsIDOMHTMLCollection *nscoll = NULL;
361 nsresult nsres;
363 TRACE("(%p)->(%p)\n", This, p);
365 if(!p)
366 return E_INVALIDARG;
368 *p = NULL;
370 if(!This->doc_node->nsdoc) {
371 WARN("NULL nsdoc\n");
372 return E_UNEXPECTED;
375 nsres = nsIDOMHTMLDocument_GetLinks(This->doc_node->nsdoc, &nscoll);
376 if(NS_FAILED(nsres)) {
377 ERR("GetLinks failed: %08x\n", nsres);
378 return E_FAIL;
381 if(nscoll) {
382 *p = create_collection_from_htmlcol(This->doc_node, nscoll);
383 nsIDOMHTMLCollection_Release(nscoll);
386 return S_OK;
389 static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElementCollection **p)
391 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
392 nsIDOMHTMLCollection *nscoll = NULL;
393 nsresult nsres;
395 TRACE("(%p)->(%p)\n", This, p);
397 if(!p)
398 return E_INVALIDARG;
400 *p = NULL;
402 if(!This->doc_node->nsdoc) {
403 WARN("NULL nsdoc\n");
404 return E_UNEXPECTED;
407 nsres = nsIDOMHTMLDocument_GetForms(This->doc_node->nsdoc, &nscoll);
408 if(NS_FAILED(nsres)) {
409 ERR("GetForms failed: %08x\n", nsres);
410 return E_FAIL;
413 if(nscoll) {
414 *p = create_collection_from_htmlcol(This->doc_node, nscoll);
415 nsIDOMHTMLCollection_Release(nscoll);
418 return S_OK;
421 static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLElementCollection **p)
423 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
424 nsIDOMHTMLCollection *nscoll = NULL;
425 nsresult nsres;
427 TRACE("(%p)->(%p)\n", This, p);
429 if(!p)
430 return E_INVALIDARG;
432 *p = NULL;
434 if(!This->doc_node->nsdoc) {
435 WARN("NULL nsdoc\n");
436 return E_UNEXPECTED;
439 nsres = nsIDOMHTMLDocument_GetAnchors(This->doc_node->nsdoc, &nscoll);
440 if(NS_FAILED(nsres)) {
441 ERR("GetAnchors failed: %08x\n", nsres);
442 return E_FAIL;
445 if(nscoll) {
446 *p = create_collection_from_htmlcol(This->doc_node, nscoll);
447 nsIDOMHTMLCollection_Release(nscoll);
450 return S_OK;
453 static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v)
455 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
456 nsAString nsstr;
457 nsresult nsres;
459 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
461 if(!This->doc_node->nsdoc) {
462 WARN("NULL nsdoc\n");
463 return E_UNEXPECTED;
466 nsAString_InitDepend(&nsstr, v);
467 nsres = nsIDOMHTMLDocument_SetTitle(This->doc_node->nsdoc, &nsstr);
468 nsAString_Finish(&nsstr);
469 if(NS_FAILED(nsres))
470 ERR("SetTitle failed: %08x\n", nsres);
472 return S_OK;
475 static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p)
477 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
478 const PRUnichar *ret;
479 nsAString nsstr;
480 nsresult nsres;
482 TRACE("(%p)->(%p)\n", This, p);
484 if(!This->doc_node->nsdoc) {
485 WARN("NULL nsdoc\n");
486 return E_UNEXPECTED;
490 nsAString_Init(&nsstr, NULL);
491 nsres = nsIDOMHTMLDocument_GetTitle(This->doc_node->nsdoc, &nsstr);
492 if (NS_SUCCEEDED(nsres)) {
493 nsAString_GetData(&nsstr, &ret);
494 *p = SysAllocString(ret);
496 nsAString_Finish(&nsstr);
498 if(NS_FAILED(nsres)) {
499 ERR("GetTitle failed: %08x\n", nsres);
500 return E_FAIL;
503 return S_OK;
506 static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p)
508 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
509 nsIDOMHTMLCollection *nscoll = NULL;
510 nsresult nsres;
512 TRACE("(%p)->(%p)\n", This, p);
514 if(!p)
515 return E_INVALIDARG;
517 *p = NULL;
519 if(!This->doc_node->nsdoc) {
520 WARN("NULL nsdoc\n");
521 return E_UNEXPECTED;
524 nsres = nsIDOMHTMLDocument_GetScripts(This->doc_node->nsdoc, &nscoll);
525 if(NS_FAILED(nsres)) {
526 ERR("GetImages failed: %08x\n", nsres);
527 return E_FAIL;
530 if(nscoll) {
531 *p = create_collection_from_htmlcol(This->doc_node, nscoll);
532 nsIDOMHTMLCollection_Release(nscoll);
535 return S_OK;
538 static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v)
540 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
541 HRESULT hres;
543 static const WCHAR onW[] = {'o','n',0};
545 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
547 if(strcmpiW(v, onW)) {
548 FIXME("Unsupported arg %s\n", debugstr_w(v));
549 return E_NOTIMPL;
552 hres = setup_edit_mode(This->doc_obj);
553 if(FAILED(hres))
554 return hres;
556 call_property_onchanged(&This->cp_container, DISPID_IHTMLDOCUMENT2_DESIGNMODE);
557 return S_OK;
560 static HRESULT WINAPI HTMLDocument_get_designMode(IHTMLDocument2 *iface, BSTR *p)
562 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
563 static const WCHAR szOff[] = {'O','f','f',0};
564 FIXME("(%p)->(%p) always returning Off\n", This, p);
566 if(!p)
567 return E_INVALIDARG;
569 *p = SysAllocString(szOff);
571 return S_OK;
574 static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSelectionObject **p)
576 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
577 nsISelection *nsselection;
578 nsresult nsres;
580 TRACE("(%p)->(%p)\n", This, p);
582 nsres = nsIDOMWindow_GetSelection(This->window->nswindow, &nsselection);
583 if(NS_FAILED(nsres)) {
584 ERR("GetSelection failed: %08x\n", nsres);
585 return E_FAIL;
588 return HTMLSelectionObject_Create(This->doc_node, nsselection, p);
591 static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p)
593 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
595 static const WCHAR wszUninitialized[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
596 static const WCHAR wszLoading[] = {'l','o','a','d','i','n','g',0};
597 static const WCHAR wszLoaded[] = {'l','o','a','d','e','d',0};
598 static const WCHAR wszInteractive[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
599 static const WCHAR wszComplete[] = {'c','o','m','p','l','e','t','e',0};
601 static const LPCWSTR readystate_str[] = {
602 wszUninitialized,
603 wszLoading,
604 wszLoaded,
605 wszInteractive,
606 wszComplete
609 TRACE("(%p)->(%p)\n", iface, p);
611 if(!p)
612 return E_POINTER;
614 *p = SysAllocString(readystate_str[This->window->readystate]);
615 return S_OK;
618 static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p)
620 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
622 TRACE("(%p)->(%p)\n", This, p);
624 return IHTMLWindow2_get_frames(&This->window->base.IHTMLWindow2_iface, p);
627 static HRESULT WINAPI HTMLDocument_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p)
629 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
630 FIXME("(%p)->(%p)\n", This, p);
631 return E_NOTIMPL;
634 static HRESULT WINAPI HTMLDocument_get_plugins(IHTMLDocument2 *iface, IHTMLElementCollection **p)
636 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
637 FIXME("(%p)->(%p)\n", This, p);
638 return E_NOTIMPL;
641 static HRESULT WINAPI HTMLDocument_put_alinkColor(IHTMLDocument2 *iface, VARIANT v)
643 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
644 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
645 return E_NOTIMPL;
648 static HRESULT WINAPI HTMLDocument_get_alinkColor(IHTMLDocument2 *iface, VARIANT *p)
650 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
651 FIXME("(%p)->(%p)\n", This, p);
652 return E_NOTIMPL;
655 static HRESULT WINAPI HTMLDocument_put_bgColor(IHTMLDocument2 *iface, VARIANT v)
657 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
658 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
659 return E_NOTIMPL;
662 static HRESULT WINAPI HTMLDocument_get_bgColor(IHTMLDocument2 *iface, VARIANT *p)
664 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
665 FIXME("(%p)->(%p)\n", This, p);
666 return E_NOTIMPL;
669 static HRESULT WINAPI HTMLDocument_put_fgColor(IHTMLDocument2 *iface, VARIANT v)
671 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
672 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
673 return E_NOTIMPL;
676 static HRESULT WINAPI HTMLDocument_get_fgColor(IHTMLDocument2 *iface, VARIANT *p)
678 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
679 FIXME("(%p)->(%p)\n", This, p);
680 return E_NOTIMPL;
683 static HRESULT WINAPI HTMLDocument_put_linkColor(IHTMLDocument2 *iface, VARIANT v)
685 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
686 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
687 return E_NOTIMPL;
690 static HRESULT WINAPI HTMLDocument_get_linkColor(IHTMLDocument2 *iface, VARIANT *p)
692 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
693 FIXME("(%p)->(%p)\n", This, p);
694 return E_NOTIMPL;
697 static HRESULT WINAPI HTMLDocument_put_vlinkColor(IHTMLDocument2 *iface, VARIANT v)
699 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
700 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
701 return E_NOTIMPL;
704 static HRESULT WINAPI HTMLDocument_get_vlinkColor(IHTMLDocument2 *iface, VARIANT *p)
706 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
707 FIXME("(%p)->(%p)\n", This, p);
708 return E_NOTIMPL;
711 static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p)
713 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
715 FIXME("(%p)->(%p)\n", This, p);
717 *p = NULL;
718 return S_OK;
721 static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p)
723 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
725 TRACE("(%p)->(%p)\n", This, p);
727 if(!This->doc_node->nsdoc) {
728 WARN("NULL nsdoc\n");
729 return E_UNEXPECTED;
732 return IHTMLWindow2_get_location(&This->window->base.IHTMLWindow2_iface, p);
735 static HRESULT WINAPI HTMLDocument_get_lastModified(IHTMLDocument2 *iface, BSTR *p)
737 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
738 FIXME("(%p)->(%p)\n", This, p);
739 return E_NOTIMPL;
742 static HRESULT WINAPI HTMLDocument_put_URL(IHTMLDocument2 *iface, BSTR v)
744 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
746 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
748 if(!This->window) {
749 FIXME("No window available\n");
750 return E_FAIL;
753 return navigate_url(This->window, v, This->window->uri, BINDING_NAVIGATED);
756 static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
758 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
760 static const WCHAR about_blank_url[] =
761 {'a','b','o','u','t',':','b','l','a','n','k',0};
763 TRACE("(%p)->(%p)\n", iface, p);
765 *p = SysAllocString(This->window->url ? This->window->url : about_blank_url);
766 return *p ? S_OK : E_OUTOFMEMORY;
769 static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
771 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
772 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
773 return E_NOTIMPL;
776 static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
778 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
779 HRESULT hres;
781 TRACE("(%p)->(%p)\n", This, p);
783 if(!This->window || !This->window->uri) {
784 FIXME("No current URI\n");
785 return E_FAIL;
788 hres = IUri_GetHost(This->window->uri, p);
789 return FAILED(hres) ? hres : S_OK;
792 static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v)
794 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
795 BOOL bret;
797 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
799 bret = InternetSetCookieExW(This->window->url, NULL, v, 0, 0);
800 if(!bret) {
801 FIXME("InternetSetCookieExW failed: %u\n", GetLastError());
802 return HRESULT_FROM_WIN32(GetLastError());
805 return S_OK;
808 static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p)
810 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
811 DWORD size;
812 BOOL bret;
814 TRACE("(%p)->(%p)\n", This, p);
816 size = 0;
817 bret = InternetGetCookieExW(This->window->url, NULL, NULL, &size, 0, NULL);
818 if(!bret) {
819 switch(GetLastError()) {
820 case ERROR_INSUFFICIENT_BUFFER:
821 break;
822 case ERROR_NO_MORE_ITEMS:
823 *p = NULL;
824 return S_OK;
825 default:
826 FIXME("InternetGetCookieExW failed: %u\n", GetLastError());
827 return HRESULT_FROM_WIN32(GetLastError());
831 if(!size) {
832 *p = NULL;
833 return S_OK;
836 *p = SysAllocStringLen(NULL, size/sizeof(WCHAR)-1);
837 if(!*p)
838 return E_OUTOFMEMORY;
840 bret = InternetGetCookieExW(This->window->url, NULL, *p, &size, 0, NULL);
841 if(!bret) {
842 ERR("InternetGetCookieExW failed: %u\n", GetLastError());
843 return E_FAIL;
846 return S_OK;
849 static HRESULT WINAPI HTMLDocument_put_expando(IHTMLDocument2 *iface, VARIANT_BOOL v)
851 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
852 FIXME("(%p)->(%x)\n", This, v);
853 return E_NOTIMPL;
856 static HRESULT WINAPI HTMLDocument_get_expando(IHTMLDocument2 *iface, VARIANT_BOOL *p)
858 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
859 FIXME("(%p)->(%p)\n", This, p);
860 return E_NOTIMPL;
863 static HRESULT WINAPI HTMLDocument_put_charset(IHTMLDocument2 *iface, BSTR v)
865 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
866 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
867 return E_NOTIMPL;
870 static HRESULT WINAPI HTMLDocument_get_charset(IHTMLDocument2 *iface, BSTR *p)
872 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
873 nsAString charset_str;
874 nsresult nsres;
876 TRACE("(%p)->(%p)\n", This, p);
878 if(!This->doc_node->nsdoc) {
879 FIXME("NULL nsdoc\n");
880 return E_FAIL;
883 nsAString_Init(&charset_str, NULL);
884 nsres = nsIDOMHTMLDocument_GetCharacterSet(This->doc_node->nsdoc, &charset_str);
885 return return_nsstr(nsres, &charset_str, p);
888 static HRESULT WINAPI HTMLDocument_put_defaultCharset(IHTMLDocument2 *iface, BSTR v)
890 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
891 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
892 return E_NOTIMPL;
895 static HRESULT WINAPI HTMLDocument_get_defaultCharset(IHTMLDocument2 *iface, BSTR *p)
897 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
898 FIXME("(%p)->(%p)\n", This, p);
899 return E_NOTIMPL;
902 static HRESULT WINAPI HTMLDocument_get_mimeType(IHTMLDocument2 *iface, BSTR *p)
904 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
905 FIXME("(%p)->(%p)\n", This, p);
906 return E_NOTIMPL;
909 static HRESULT WINAPI HTMLDocument_get_fileSize(IHTMLDocument2 *iface, BSTR *p)
911 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
912 FIXME("(%p)->(%p)\n", This, p);
913 return E_NOTIMPL;
916 static HRESULT WINAPI HTMLDocument_get_fileCreatedDate(IHTMLDocument2 *iface, BSTR *p)
918 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
919 FIXME("(%p)->(%p)\n", This, p);
920 return E_NOTIMPL;
923 static HRESULT WINAPI HTMLDocument_get_fileModifiedDate(IHTMLDocument2 *iface, BSTR *p)
925 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
926 FIXME("(%p)->(%p)\n", This, p);
927 return E_NOTIMPL;
930 static HRESULT WINAPI HTMLDocument_get_fileUpdatedDate(IHTMLDocument2 *iface, BSTR *p)
932 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
933 FIXME("(%p)->(%p)\n", This, p);
934 return E_NOTIMPL;
937 static HRESULT WINAPI HTMLDocument_get_security(IHTMLDocument2 *iface, BSTR *p)
939 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
940 FIXME("(%p)->(%p)\n", This, p);
941 return E_NOTIMPL;
944 static HRESULT WINAPI HTMLDocument_get_protocol(IHTMLDocument2 *iface, BSTR *p)
946 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
947 FIXME("(%p)->(%p)\n", This, p);
948 return E_NOTIMPL;
951 static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
953 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
954 FIXME("(%p)->(%p)\n", This, p);
955 return E_NOTIMPL;
958 static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
960 VARIANT *var, tmp;
961 JSContext *jsctx;
962 nsAString nsstr;
963 ULONG i, argc;
964 nsresult nsres;
965 HRESULT hres;
967 if(!This->doc_node->nsdoc) {
968 WARN("NULL nsdoc\n");
969 return E_UNEXPECTED;
972 if (!psarray)
973 return S_OK;
975 if(psarray->cDims != 1) {
976 FIXME("cDims=%d\n", psarray->cDims);
977 return E_INVALIDARG;
980 hres = SafeArrayAccessData(psarray, (void**)&var);
981 if(FAILED(hres)) {
982 WARN("SafeArrayAccessData failed: %08x\n", hres);
983 return hres;
986 V_VT(&tmp) = VT_EMPTY;
988 jsctx = get_context_from_document(This->doc_node->nsdoc);
989 argc = psarray->rgsabound[0].cElements;
990 for(i=0; i < argc; i++) {
991 if(V_VT(var+i) == VT_BSTR) {
992 nsAString_InitDepend(&nsstr, V_BSTR(var+i));
993 }else {
994 hres = VariantChangeTypeEx(&tmp, var+i, MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, VT_BSTR);
995 if(FAILED(hres)) {
996 WARN("Could not convert %s to string\n", debugstr_variant(var+i));
997 break;
999 nsAString_InitDepend(&nsstr, V_BSTR(&tmp));
1002 if(!ln || i != argc-1)
1003 nsres = nsIDOMHTMLDocument_Write(This->doc_node->nsdoc, &nsstr, jsctx);
1004 else
1005 nsres = nsIDOMHTMLDocument_Writeln(This->doc_node->nsdoc, &nsstr, jsctx);
1006 nsAString_Finish(&nsstr);
1007 if(V_VT(var+i) != VT_BSTR)
1008 VariantClear(&tmp);
1009 if(NS_FAILED(nsres)) {
1010 ERR("Write failed: %08x\n", nsres);
1011 hres = E_FAIL;
1012 break;
1016 SafeArrayUnaccessData(psarray);
1018 return hres;
1021 static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray)
1023 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1025 TRACE("(%p)->(%p)\n", iface, psarray);
1027 return document_write(This, psarray, FALSE);
1030 static HRESULT WINAPI HTMLDocument_writeln(IHTMLDocument2 *iface, SAFEARRAY *psarray)
1032 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1034 TRACE("(%p)->(%p)\n", This, psarray);
1036 return document_write(This, psarray, TRUE);
1039 static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT name,
1040 VARIANT features, VARIANT replace, IDispatch **pomWindowResult)
1042 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1043 nsISupports *tmp;
1044 nsresult nsres;
1046 static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0};
1048 TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_w(url), debugstr_variant(&name),
1049 debugstr_variant(&features), debugstr_variant(&replace), pomWindowResult);
1051 if(!This->doc_node->nsdoc) {
1052 ERR("!nsdoc\n");
1053 return E_NOTIMPL;
1056 if(!url || strcmpW(url, text_htmlW) || V_VT(&name) != VT_ERROR
1057 || V_VT(&features) != VT_ERROR || V_VT(&replace) != VT_ERROR)
1058 FIXME("unsupported args\n");
1060 nsres = nsIDOMHTMLDocument_Open(This->doc_node->nsdoc, NULL, NULL, NULL,
1061 get_context_from_document(This->doc_node->nsdoc), 0, &tmp);
1062 if(NS_FAILED(nsres)) {
1063 ERR("Open failed: %08x\n", nsres);
1064 return E_FAIL;
1067 if(tmp)
1068 nsISupports_Release(tmp);
1070 *pomWindowResult = (IDispatch*)&This->window->base.IHTMLWindow2_iface;
1071 IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface);
1072 return S_OK;
1075 static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface)
1077 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1078 nsresult nsres;
1080 TRACE("(%p)\n", This);
1082 if(!This->doc_node->nsdoc) {
1083 ERR("!nsdoc\n");
1084 return E_NOTIMPL;
1087 nsres = nsIDOMHTMLDocument_Close(This->doc_node->nsdoc);
1088 if(NS_FAILED(nsres)) {
1089 ERR("Close failed: %08x\n", nsres);
1090 return E_FAIL;
1093 return S_OK;
1096 static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface)
1098 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1099 nsresult nsres;
1101 TRACE("(%p)\n", This);
1103 nsres = nsIDOMHTMLDocument_Clear(This->doc_node->nsdoc);
1104 if(NS_FAILED(nsres)) {
1105 ERR("Clear failed: %08x\n", nsres);
1106 return E_FAIL;
1109 return S_OK;
1112 static HRESULT WINAPI HTMLDocument_queryCommandSupported(IHTMLDocument2 *iface, BSTR cmdID,
1113 VARIANT_BOOL *pfRet)
1115 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1116 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1117 return E_NOTIMPL;
1120 static HRESULT WINAPI HTMLDocument_queryCommandEnabled(IHTMLDocument2 *iface, BSTR cmdID,
1121 VARIANT_BOOL *pfRet)
1123 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1124 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1125 return E_NOTIMPL;
1128 static HRESULT WINAPI HTMLDocument_queryCommandState(IHTMLDocument2 *iface, BSTR cmdID,
1129 VARIANT_BOOL *pfRet)
1131 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1132 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1133 return E_NOTIMPL;
1136 static HRESULT WINAPI HTMLDocument_queryCommandIndeterm(IHTMLDocument2 *iface, BSTR cmdID,
1137 VARIANT_BOOL *pfRet)
1139 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1140 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1141 return E_NOTIMPL;
1144 static HRESULT WINAPI HTMLDocument_queryCommandText(IHTMLDocument2 *iface, BSTR cmdID,
1145 BSTR *pfRet)
1147 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1148 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1149 return E_NOTIMPL;
1152 static HRESULT WINAPI HTMLDocument_queryCommandValue(IHTMLDocument2 *iface, BSTR cmdID,
1153 VARIANT *pfRet)
1155 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1156 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1157 return E_NOTIMPL;
1160 static HRESULT WINAPI HTMLDocument_execCommand(IHTMLDocument2 *iface, BSTR cmdID,
1161 VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL *pfRet)
1163 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1164 FIXME("(%p)->(%s %x %s %p)\n", This, debugstr_w(cmdID), showUI, debugstr_variant(&value), pfRet);
1165 return E_NOTIMPL;
1168 static HRESULT WINAPI HTMLDocument_execCommandShowHelp(IHTMLDocument2 *iface, BSTR cmdID,
1169 VARIANT_BOOL *pfRet)
1171 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1172 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1173 return E_NOTIMPL;
1176 static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTag,
1177 IHTMLElement **newElem)
1179 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1180 HTMLElement *elem;
1181 HRESULT hres;
1183 TRACE("(%p)->(%s %p)\n", This, debugstr_w(eTag), newElem);
1185 hres = create_element(This->doc_node, eTag, &elem);
1186 if(FAILED(hres))
1187 return hres;
1189 *newElem = &elem->IHTMLElement_iface;
1190 return S_OK;
1193 static HRESULT WINAPI HTMLDocument_put_onhelp(IHTMLDocument2 *iface, VARIANT v)
1195 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1196 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1197 return E_NOTIMPL;
1200 static HRESULT WINAPI HTMLDocument_get_onhelp(IHTMLDocument2 *iface, VARIANT *p)
1202 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1203 FIXME("(%p)->(%p)\n", This, p);
1204 return E_NOTIMPL;
1207 static HRESULT WINAPI HTMLDocument_put_onclick(IHTMLDocument2 *iface, VARIANT v)
1209 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1211 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1213 return set_doc_event(This, EVENTID_CLICK, &v);
1216 static HRESULT WINAPI HTMLDocument_get_onclick(IHTMLDocument2 *iface, VARIANT *p)
1218 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1220 TRACE("(%p)->(%p)\n", This, p);
1222 return get_doc_event(This, EVENTID_CLICK, p);
1225 static HRESULT WINAPI HTMLDocument_put_ondblclick(IHTMLDocument2 *iface, VARIANT v)
1227 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1228 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1229 return E_NOTIMPL;
1232 static HRESULT WINAPI HTMLDocument_get_ondblclick(IHTMLDocument2 *iface, VARIANT *p)
1234 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1235 FIXME("(%p)->(%p)\n", This, p);
1236 return E_NOTIMPL;
1239 static HRESULT WINAPI HTMLDocument_put_onkeyup(IHTMLDocument2 *iface, VARIANT v)
1241 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1243 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1245 return set_doc_event(This, EVENTID_KEYUP, &v);
1248 static HRESULT WINAPI HTMLDocument_get_onkeyup(IHTMLDocument2 *iface, VARIANT *p)
1250 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1252 TRACE("(%p)->(%p)\n", This, p);
1254 return get_doc_event(This, EVENTID_KEYUP, p);
1257 static HRESULT WINAPI HTMLDocument_put_onkeydown(IHTMLDocument2 *iface, VARIANT v)
1259 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1261 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1263 return set_doc_event(This, EVENTID_KEYDOWN, &v);
1266 static HRESULT WINAPI HTMLDocument_get_onkeydown(IHTMLDocument2 *iface, VARIANT *p)
1268 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1270 TRACE("(%p)->(%p)\n", This, p);
1272 return get_doc_event(This, EVENTID_KEYDOWN, p);
1275 static HRESULT WINAPI HTMLDocument_put_onkeypress(IHTMLDocument2 *iface, VARIANT v)
1277 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1279 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1281 return set_doc_event(This, EVENTID_KEYPRESS, &v);
1284 static HRESULT WINAPI HTMLDocument_get_onkeypress(IHTMLDocument2 *iface, VARIANT *p)
1286 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1288 TRACE("(%p)->(%p)\n", This, p);
1290 return get_doc_event(This, EVENTID_KEYPRESS, p);
1293 static HRESULT WINAPI HTMLDocument_put_onmouseup(IHTMLDocument2 *iface, VARIANT v)
1295 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1297 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1299 return set_doc_event(This, EVENTID_MOUSEUP, &v);
1302 static HRESULT WINAPI HTMLDocument_get_onmouseup(IHTMLDocument2 *iface, VARIANT *p)
1304 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1306 TRACE("(%p)->(%p)\n", This, p);
1308 return get_doc_event(This, EVENTID_MOUSEUP, p);
1311 static HRESULT WINAPI HTMLDocument_put_onmousedown(IHTMLDocument2 *iface, VARIANT v)
1313 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1315 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1317 return set_doc_event(This, EVENTID_MOUSEDOWN, &v);
1320 static HRESULT WINAPI HTMLDocument_get_onmousedown(IHTMLDocument2 *iface, VARIANT *p)
1322 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1324 TRACE("(%p)->(%p)\n", This, p);
1326 return get_doc_event(This, EVENTID_MOUSEDOWN, p);
1329 static HRESULT WINAPI HTMLDocument_put_onmousemove(IHTMLDocument2 *iface, VARIANT v)
1331 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1333 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1335 return set_doc_event(This, EVENTID_MOUSEMOVE, &v);
1338 static HRESULT WINAPI HTMLDocument_get_onmousemove(IHTMLDocument2 *iface, VARIANT *p)
1340 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1342 TRACE("(%p)->(%p)\n", This, p);
1344 return get_doc_event(This, EVENTID_MOUSEMOVE, p);
1347 static HRESULT WINAPI HTMLDocument_put_onmouseout(IHTMLDocument2 *iface, VARIANT v)
1349 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1351 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1353 return set_doc_event(This, EVENTID_MOUSEOUT, &v);
1356 static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT *p)
1358 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1360 TRACE("(%p)->(%p)\n", This, p);
1362 return get_doc_event(This, EVENTID_MOUSEOUT, p);
1365 static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v)
1367 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1369 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1371 return set_doc_event(This, EVENTID_MOUSEOVER, &v);
1374 static HRESULT WINAPI HTMLDocument_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p)
1376 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1378 TRACE("(%p)->(%p)\n", This, p);
1380 return get_doc_event(This, EVENTID_MOUSEOVER, p);
1383 static HRESULT WINAPI HTMLDocument_put_onreadystatechange(IHTMLDocument2 *iface, VARIANT v)
1385 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1387 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1389 return set_doc_event(This, EVENTID_READYSTATECHANGE, &v);
1392 static HRESULT WINAPI HTMLDocument_get_onreadystatechange(IHTMLDocument2 *iface, VARIANT *p)
1394 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1396 TRACE("(%p)->(%p)\n", This, p);
1398 return get_doc_event(This, EVENTID_READYSTATECHANGE, p);
1401 static HRESULT WINAPI HTMLDocument_put_onafterupdate(IHTMLDocument2 *iface, VARIANT v)
1403 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1404 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1405 return E_NOTIMPL;
1408 static HRESULT WINAPI HTMLDocument_get_onafterupdate(IHTMLDocument2 *iface, VARIANT *p)
1410 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1411 FIXME("(%p)->(%p)\n", This, p);
1412 return E_NOTIMPL;
1415 static HRESULT WINAPI HTMLDocument_put_onrowexit(IHTMLDocument2 *iface, VARIANT v)
1417 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1418 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1419 return E_NOTIMPL;
1422 static HRESULT WINAPI HTMLDocument_get_onrowexit(IHTMLDocument2 *iface, VARIANT *p)
1424 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1425 FIXME("(%p)->(%p)\n", This, p);
1426 return E_NOTIMPL;
1429 static HRESULT WINAPI HTMLDocument_put_onrowenter(IHTMLDocument2 *iface, VARIANT v)
1431 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1432 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1433 return E_NOTIMPL;
1436 static HRESULT WINAPI HTMLDocument_get_onrowenter(IHTMLDocument2 *iface, VARIANT *p)
1438 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1439 FIXME("(%p)->(%p)\n", This, p);
1440 return E_NOTIMPL;
1443 static HRESULT WINAPI HTMLDocument_put_ondragstart(IHTMLDocument2 *iface, VARIANT v)
1445 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1447 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1449 return set_doc_event(This, EVENTID_DRAGSTART, &v);
1452 static HRESULT WINAPI HTMLDocument_get_ondragstart(IHTMLDocument2 *iface, VARIANT *p)
1454 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1456 TRACE("(%p)->(%p)\n", This, p);
1458 return get_doc_event(This, EVENTID_DRAGSTART, p);
1461 static HRESULT WINAPI HTMLDocument_put_onselectstart(IHTMLDocument2 *iface, VARIANT v)
1463 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1465 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1467 return set_doc_event(This, EVENTID_SELECTSTART, &v);
1470 static HRESULT WINAPI HTMLDocument_get_onselectstart(IHTMLDocument2 *iface, VARIANT *p)
1472 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1474 TRACE("(%p)->(%p)\n", This, p);
1476 return get_doc_event(This, EVENTID_SELECTSTART, p);
1479 static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, LONG x, LONG y,
1480 IHTMLElement **elementHit)
1482 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1483 nsIDOMElement *nselem;
1484 HTMLDOMNode *node;
1485 nsresult nsres;
1486 HRESULT hres;
1488 TRACE("(%p)->(%d %d %p)\n", This, x, y, elementHit);
1490 nsres = nsIDOMHTMLDocument_ElementFromPoint(This->doc_node->nsdoc, x, y, &nselem);
1491 if(NS_FAILED(nsres)) {
1492 ERR("ElementFromPoint failed: %08x\n", nsres);
1493 return E_FAIL;
1496 if(!nselem) {
1497 *elementHit = NULL;
1498 return S_OK;
1501 hres = get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE, &node);
1502 nsIDOMElement_Release(nselem);
1503 if(FAILED(hres))
1504 return hres;
1506 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)elementHit);
1507 node_release(node);
1508 return hres;
1511 static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p)
1513 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1515 TRACE("(%p)->(%p)\n", This, p);
1517 *p = &This->window->base.IHTMLWindow2_iface;
1518 IHTMLWindow2_AddRef(*p);
1519 return S_OK;
1522 static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
1523 IHTMLStyleSheetsCollection **p)
1525 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1526 nsIDOMStyleSheetList *nsstylelist;
1527 nsresult nsres;
1529 TRACE("(%p)->(%p)\n", This, p);
1531 *p = NULL;
1533 if(!This->doc_node->nsdoc) {
1534 WARN("NULL nsdoc\n");
1535 return E_UNEXPECTED;
1538 nsres = nsIDOMHTMLDocument_GetStyleSheets(This->doc_node->nsdoc, &nsstylelist);
1539 if(NS_FAILED(nsres)) {
1540 ERR("GetStyleSheets failed: %08x\n", nsres);
1541 return E_FAIL;
1544 *p = HTMLStyleSheetsCollection_Create(nsstylelist);
1545 nsIDOMStyleSheetList_Release(nsstylelist);
1547 return S_OK;
1550 static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v)
1552 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1553 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1554 return E_NOTIMPL;
1557 static HRESULT WINAPI HTMLDocument_get_onbeforeupdate(IHTMLDocument2 *iface, VARIANT *p)
1559 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1560 FIXME("(%p)->(%p)\n", This, p);
1561 return E_NOTIMPL;
1564 static HRESULT WINAPI HTMLDocument_put_onerrorupdate(IHTMLDocument2 *iface, VARIANT v)
1566 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1567 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1568 return E_NOTIMPL;
1571 static HRESULT WINAPI HTMLDocument_get_onerrorupdate(IHTMLDocument2 *iface, VARIANT *p)
1573 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1574 FIXME("(%p)->(%p)\n", This, p);
1575 return E_NOTIMPL;
1578 static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String)
1580 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1582 static const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0};
1584 TRACE("(%p)->(%p)\n", This, String);
1586 if(!String)
1587 return E_INVALIDARG;
1589 *String = SysAllocString(objectW);
1590 return *String ? S_OK : E_OUTOFMEMORY;
1594 static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR bstrHref,
1595 LONG lIndex, IHTMLStyleSheet **ppnewStyleSheet)
1597 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1598 nsIDOMHTMLHeadElement *head_elem;
1599 IHTMLStyleElement *style_elem;
1600 HTMLElement *elem;
1601 nsresult nsres;
1602 HRESULT hres;
1604 static const WCHAR styleW[] = {'s','t','y','l','e',0};
1606 TRACE("(%p)->(%s %d %p)\n", This, debugstr_w(bstrHref), lIndex, ppnewStyleSheet);
1608 if(!This->doc_node->nsdoc) {
1609 FIXME("not a real doc object\n");
1610 return E_NOTIMPL;
1613 if(lIndex != -1)
1614 FIXME("Unsupported lIndex %d\n", lIndex);
1616 if(bstrHref) {
1617 FIXME("semi-stub for href %s\n", debugstr_w(bstrHref));
1618 *ppnewStyleSheet = HTMLStyleSheet_Create(NULL);
1619 return S_OK;
1622 hres = create_element(This->doc_node, styleW, &elem);
1623 if(FAILED(hres))
1624 return hres;
1626 nsres = nsIDOMHTMLDocument_GetHead(This->doc_node->nsdoc, &head_elem);
1627 if(NS_SUCCEEDED(nsres)) {
1628 nsIDOMNode *tmp_node;
1630 nsres = nsIDOMHTMLHeadElement_AppendChild(head_elem, (nsIDOMNode*)elem->nselem, &tmp_node);
1631 nsIDOMHTMLHeadElement_Release(head_elem);
1632 if(NS_SUCCEEDED(nsres) && tmp_node)
1633 nsIDOMNode_Release(tmp_node);
1635 if(NS_FAILED(nsres)) {
1636 IHTMLElement_Release(&elem->IHTMLElement_iface);
1637 return E_FAIL;
1640 hres = IHTMLElement_QueryInterface(&elem->IHTMLElement_iface, &IID_IHTMLStyleElement, (void**)&style_elem);
1641 assert(hres == S_OK);
1642 IHTMLElement_Release(&elem->IHTMLElement_iface);
1644 hres = IHTMLStyleElement_get_styleSheet(style_elem, ppnewStyleSheet);
1645 IHTMLStyleElement_Release(style_elem);
1646 return hres;
1649 static const IHTMLDocument2Vtbl HTMLDocumentVtbl = {
1650 HTMLDocument_QueryInterface,
1651 HTMLDocument_AddRef,
1652 HTMLDocument_Release,
1653 HTMLDocument_GetTypeInfoCount,
1654 HTMLDocument_GetTypeInfo,
1655 HTMLDocument_GetIDsOfNames,
1656 HTMLDocument_Invoke,
1657 HTMLDocument_get_Script,
1658 HTMLDocument_get_all,
1659 HTMLDocument_get_body,
1660 HTMLDocument_get_activeElement,
1661 HTMLDocument_get_images,
1662 HTMLDocument_get_applets,
1663 HTMLDocument_get_links,
1664 HTMLDocument_get_forms,
1665 HTMLDocument_get_anchors,
1666 HTMLDocument_put_title,
1667 HTMLDocument_get_title,
1668 HTMLDocument_get_scripts,
1669 HTMLDocument_put_designMode,
1670 HTMLDocument_get_designMode,
1671 HTMLDocument_get_selection,
1672 HTMLDocument_get_readyState,
1673 HTMLDocument_get_frames,
1674 HTMLDocument_get_embeds,
1675 HTMLDocument_get_plugins,
1676 HTMLDocument_put_alinkColor,
1677 HTMLDocument_get_alinkColor,
1678 HTMLDocument_put_bgColor,
1679 HTMLDocument_get_bgColor,
1680 HTMLDocument_put_fgColor,
1681 HTMLDocument_get_fgColor,
1682 HTMLDocument_put_linkColor,
1683 HTMLDocument_get_linkColor,
1684 HTMLDocument_put_vlinkColor,
1685 HTMLDocument_get_vlinkColor,
1686 HTMLDocument_get_referrer,
1687 HTMLDocument_get_location,
1688 HTMLDocument_get_lastModified,
1689 HTMLDocument_put_URL,
1690 HTMLDocument_get_URL,
1691 HTMLDocument_put_domain,
1692 HTMLDocument_get_domain,
1693 HTMLDocument_put_cookie,
1694 HTMLDocument_get_cookie,
1695 HTMLDocument_put_expando,
1696 HTMLDocument_get_expando,
1697 HTMLDocument_put_charset,
1698 HTMLDocument_get_charset,
1699 HTMLDocument_put_defaultCharset,
1700 HTMLDocument_get_defaultCharset,
1701 HTMLDocument_get_mimeType,
1702 HTMLDocument_get_fileSize,
1703 HTMLDocument_get_fileCreatedDate,
1704 HTMLDocument_get_fileModifiedDate,
1705 HTMLDocument_get_fileUpdatedDate,
1706 HTMLDocument_get_security,
1707 HTMLDocument_get_protocol,
1708 HTMLDocument_get_nameProp,
1709 HTMLDocument_write,
1710 HTMLDocument_writeln,
1711 HTMLDocument_open,
1712 HTMLDocument_close,
1713 HTMLDocument_clear,
1714 HTMLDocument_queryCommandSupported,
1715 HTMLDocument_queryCommandEnabled,
1716 HTMLDocument_queryCommandState,
1717 HTMLDocument_queryCommandIndeterm,
1718 HTMLDocument_queryCommandText,
1719 HTMLDocument_queryCommandValue,
1720 HTMLDocument_execCommand,
1721 HTMLDocument_execCommandShowHelp,
1722 HTMLDocument_createElement,
1723 HTMLDocument_put_onhelp,
1724 HTMLDocument_get_onhelp,
1725 HTMLDocument_put_onclick,
1726 HTMLDocument_get_onclick,
1727 HTMLDocument_put_ondblclick,
1728 HTMLDocument_get_ondblclick,
1729 HTMLDocument_put_onkeyup,
1730 HTMLDocument_get_onkeyup,
1731 HTMLDocument_put_onkeydown,
1732 HTMLDocument_get_onkeydown,
1733 HTMLDocument_put_onkeypress,
1734 HTMLDocument_get_onkeypress,
1735 HTMLDocument_put_onmouseup,
1736 HTMLDocument_get_onmouseup,
1737 HTMLDocument_put_onmousedown,
1738 HTMLDocument_get_onmousedown,
1739 HTMLDocument_put_onmousemove,
1740 HTMLDocument_get_onmousemove,
1741 HTMLDocument_put_onmouseout,
1742 HTMLDocument_get_onmouseout,
1743 HTMLDocument_put_onmouseover,
1744 HTMLDocument_get_onmouseover,
1745 HTMLDocument_put_onreadystatechange,
1746 HTMLDocument_get_onreadystatechange,
1747 HTMLDocument_put_onafterupdate,
1748 HTMLDocument_get_onafterupdate,
1749 HTMLDocument_put_onrowexit,
1750 HTMLDocument_get_onrowexit,
1751 HTMLDocument_put_onrowenter,
1752 HTMLDocument_get_onrowenter,
1753 HTMLDocument_put_ondragstart,
1754 HTMLDocument_get_ondragstart,
1755 HTMLDocument_put_onselectstart,
1756 HTMLDocument_get_onselectstart,
1757 HTMLDocument_elementFromPoint,
1758 HTMLDocument_get_parentWindow,
1759 HTMLDocument_get_styleSheets,
1760 HTMLDocument_put_onbeforeupdate,
1761 HTMLDocument_get_onbeforeupdate,
1762 HTMLDocument_put_onerrorupdate,
1763 HTMLDocument_get_onerrorupdate,
1764 HTMLDocument_toString,
1765 HTMLDocument_createStyleSheet
1768 static inline HTMLDocument *impl_from_IHTMLDocument3(IHTMLDocument3 *iface)
1770 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument3_iface);
1773 static HRESULT WINAPI HTMLDocument3_QueryInterface(IHTMLDocument3 *iface,
1774 REFIID riid, void **ppv)
1776 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1777 return htmldoc_query_interface(This, riid, ppv);
1780 static ULONG WINAPI HTMLDocument3_AddRef(IHTMLDocument3 *iface)
1782 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1783 return htmldoc_addref(This);
1786 static ULONG WINAPI HTMLDocument3_Release(IHTMLDocument3 *iface)
1788 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1789 return htmldoc_release(This);
1792 static HRESULT WINAPI HTMLDocument3_GetTypeInfoCount(IHTMLDocument3 *iface, UINT *pctinfo)
1794 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1795 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
1798 static HRESULT WINAPI HTMLDocument3_GetTypeInfo(IHTMLDocument3 *iface, UINT iTInfo,
1799 LCID lcid, ITypeInfo **ppTInfo)
1801 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1802 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1805 static HRESULT WINAPI HTMLDocument3_GetIDsOfNames(IHTMLDocument3 *iface, REFIID riid,
1806 LPOLESTR *rgszNames, UINT cNames,
1807 LCID lcid, DISPID *rgDispId)
1809 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1810 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
1811 rgDispId);
1814 static HRESULT WINAPI HTMLDocument3_Invoke(IHTMLDocument3 *iface, DISPID dispIdMember,
1815 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1816 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1818 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1819 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
1820 pDispParams, pVarResult, pExcepInfo, puArgErr);
1823 static HRESULT WINAPI HTMLDocument3_releaseCapture(IHTMLDocument3 *iface)
1825 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1826 FIXME("(%p)\n", This);
1827 return E_NOTIMPL;
1830 static HRESULT WINAPI HTMLDocument3_recalc(IHTMLDocument3 *iface, VARIANT_BOOL fForce)
1832 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1833 FIXME("(%p)->(%x)\n", This, fForce);
1834 return E_NOTIMPL;
1837 static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR text,
1838 IHTMLDOMNode **newTextNode)
1840 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1841 nsIDOMText *nstext;
1842 HTMLDOMNode *node;
1843 nsAString text_str;
1844 nsresult nsres;
1845 HRESULT hres;
1847 TRACE("(%p)->(%s %p)\n", This, debugstr_w(text), newTextNode);
1849 if(!This->doc_node->nsdoc) {
1850 WARN("NULL nsdoc\n");
1851 return E_UNEXPECTED;
1854 nsAString_InitDepend(&text_str, text);
1855 nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &text_str, &nstext);
1856 nsAString_Finish(&text_str);
1857 if(NS_FAILED(nsres)) {
1858 ERR("CreateTextNode failed: %08x\n", nsres);
1859 return E_FAIL;
1862 hres = HTMLDOMTextNode_Create(This->doc_node, (nsIDOMNode*)nstext, &node);
1863 nsIDOMText_Release(nstext);
1864 if(FAILED(hres))
1865 return hres;
1867 *newTextNode = &node->IHTMLDOMNode_iface;
1868 return S_OK;
1871 static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p)
1873 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1874 nsIDOMElement *nselem = NULL;
1875 HTMLDOMNode *node;
1876 nsresult nsres;
1877 HRESULT hres;
1879 TRACE("(%p)->(%p)\n", This, p);
1881 if(This->window->readystate == READYSTATE_UNINITIALIZED) {
1882 *p = NULL;
1883 return S_OK;
1886 if(!This->doc_node->nsdoc) {
1887 WARN("NULL nsdoc\n");
1888 return E_UNEXPECTED;
1891 nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
1892 if(NS_FAILED(nsres)) {
1893 ERR("GetDocumentElement failed: %08x\n", nsres);
1894 return E_FAIL;
1897 if(!nselem) {
1898 *p = NULL;
1899 return S_OK;
1902 hres = get_node(This->doc_node, (nsIDOMNode *)nselem, TRUE, &node);
1903 nsIDOMElement_Release(nselem);
1904 if(FAILED(hres))
1905 return hres;
1907 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
1908 node_release(node);
1909 return hres;
1912 static HRESULT WINAPI HTMLDocument3_uniqueID(IHTMLDocument3 *iface, BSTR *p)
1914 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1915 FIXME("(%p)->(%p)\n", This, p);
1916 return E_NOTIMPL;
1919 static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR event,
1920 IDispatch* pDisp, VARIANT_BOOL *pfResult)
1922 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1924 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
1926 return attach_event(&This->doc_node->node.event_target, This, event, pDisp, pfResult);
1929 static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR event,
1930 IDispatch *pDisp)
1932 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1934 TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
1936 return detach_event(This->doc_node->node.event_target, This, event, pDisp);
1939 static HRESULT WINAPI HTMLDocument3_put_onrowsdelete(IHTMLDocument3 *iface, VARIANT v)
1941 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1942 FIXME("(%p)->()\n", This);
1943 return E_NOTIMPL;
1946 static HRESULT WINAPI HTMLDocument3_get_onrowsdelete(IHTMLDocument3 *iface, VARIANT *p)
1948 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1949 FIXME("(%p)->(%p)\n", This, p);
1950 return E_NOTIMPL;
1953 static HRESULT WINAPI HTMLDocument3_put_onrowsinserted(IHTMLDocument3 *iface, VARIANT v)
1955 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1956 FIXME("(%p)->()\n", This);
1957 return E_NOTIMPL;
1960 static HRESULT WINAPI HTMLDocument3_get_onrowsinserted(IHTMLDocument3 *iface, VARIANT *p)
1962 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1963 FIXME("(%p)->(%p)\n", This, p);
1964 return E_NOTIMPL;
1967 static HRESULT WINAPI HTMLDocument3_put_oncellchange(IHTMLDocument3 *iface, VARIANT v)
1969 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1970 FIXME("(%p)->()\n", This);
1971 return E_NOTIMPL;
1974 static HRESULT WINAPI HTMLDocument3_get_oncellchange(IHTMLDocument3 *iface, VARIANT *p)
1976 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1977 FIXME("(%p)->(%p)\n", This, p);
1978 return E_NOTIMPL;
1981 static HRESULT WINAPI HTMLDocument3_put_ondatasetchanged(IHTMLDocument3 *iface, VARIANT v)
1983 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1984 FIXME("(%p)->()\n", This);
1985 return E_NOTIMPL;
1988 static HRESULT WINAPI HTMLDocument3_get_ondatasetchanged(IHTMLDocument3 *iface, VARIANT *p)
1990 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1991 FIXME("(%p)->(%p)\n", This, p);
1992 return E_NOTIMPL;
1995 static HRESULT WINAPI HTMLDocument3_put_ondataavailable(IHTMLDocument3 *iface, VARIANT v)
1997 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1998 FIXME("(%p)->()\n", This);
1999 return E_NOTIMPL;
2002 static HRESULT WINAPI HTMLDocument3_get_ondataavailable(IHTMLDocument3 *iface, VARIANT *p)
2004 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2005 FIXME("(%p)->(%p)\n", This, p);
2006 return E_NOTIMPL;
2009 static HRESULT WINAPI HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT v)
2011 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2012 FIXME("(%p)->()\n", This);
2013 return E_NOTIMPL;
2016 static HRESULT WINAPI HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT *p)
2018 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2019 FIXME("(%p)->(%p)\n", This, p);
2020 return E_NOTIMPL;
2023 static HRESULT WINAPI HTMLDocument3_put_onpropertychange(IHTMLDocument3 *iface, VARIANT v)
2025 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2026 FIXME("(%p)->()\n", This);
2027 return E_NOTIMPL;
2030 static HRESULT WINAPI HTMLDocument3_get_onpropertychange(IHTMLDocument3 *iface, VARIANT *p)
2032 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2033 FIXME("(%p)->(%p)\n", This, p);
2034 return E_NOTIMPL;
2037 static HRESULT WINAPI HTMLDocument3_put_dir(IHTMLDocument3 *iface, BSTR v)
2039 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2040 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2041 return E_NOTIMPL;
2044 static HRESULT WINAPI HTMLDocument3_get_dir(IHTMLDocument3 *iface, BSTR *p)
2046 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2047 FIXME("(%p)->(%p)\n", This, p);
2048 return E_NOTIMPL;
2051 static HRESULT WINAPI HTMLDocument3_put_oncontextmenu(IHTMLDocument3 *iface, VARIANT v)
2053 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2055 TRACE("(%p)->()\n", This);
2057 return set_doc_event(This, EVENTID_CONTEXTMENU, &v);
2060 static HRESULT WINAPI HTMLDocument3_get_oncontextmenu(IHTMLDocument3 *iface, VARIANT *p)
2062 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2064 TRACE("(%p)->(%p)\n", This, p);
2066 return get_doc_event(This, EVENTID_CONTEXTMENU, p);
2069 static HRESULT WINAPI HTMLDocument3_put_onstop(IHTMLDocument3 *iface, VARIANT v)
2071 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2072 FIXME("(%p)->()\n", This);
2073 return E_NOTIMPL;
2076 static HRESULT WINAPI HTMLDocument3_get_onstop(IHTMLDocument3 *iface, VARIANT *p)
2078 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2079 FIXME("(%p)->(%p)\n", This, p);
2080 return E_NOTIMPL;
2083 static HRESULT WINAPI HTMLDocument3_createDocumentFragment(IHTMLDocument3 *iface,
2084 IHTMLDocument2 **ppNewDoc)
2086 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2087 nsIDOMDocumentFragment *doc_frag;
2088 HTMLDocumentNode *docnode;
2089 nsresult nsres;
2090 HRESULT hres;
2092 TRACE("(%p)->(%p)\n", This, ppNewDoc);
2094 if(!This->doc_node->nsdoc) {
2095 FIXME("NULL nsdoc\n");
2096 return E_NOTIMPL;
2099 nsres = nsIDOMHTMLDocument_CreateDocumentFragment(This->doc_node->nsdoc, &doc_frag);
2100 if(NS_FAILED(nsres)) {
2101 ERR("CreateDocumentFragment failed: %08x\n", nsres);
2102 return E_FAIL;
2105 hres = create_document_fragment((nsIDOMNode*)doc_frag, This->doc_node, &docnode);
2106 nsIDOMDocumentFragment_Release(doc_frag);
2107 if(FAILED(hres))
2108 return hres;
2110 *ppNewDoc = &docnode->basedoc.IHTMLDocument2_iface;
2111 return S_OK;
2114 static HRESULT WINAPI HTMLDocument3_get_parentDocument(IHTMLDocument3 *iface,
2115 IHTMLDocument2 **p)
2117 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2118 FIXME("(%p)->(%p)\n", This, p);
2119 return E_NOTIMPL;
2122 static HRESULT WINAPI HTMLDocument3_put_enableDownload(IHTMLDocument3 *iface,
2123 VARIANT_BOOL v)
2125 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2126 FIXME("(%p)->(%x)\n", This, v);
2127 return E_NOTIMPL;
2130 static HRESULT WINAPI HTMLDocument3_get_enableDownload(IHTMLDocument3 *iface,
2131 VARIANT_BOOL *p)
2133 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2134 FIXME("(%p)->(%p)\n", This, p);
2135 return E_NOTIMPL;
2138 static HRESULT WINAPI HTMLDocument3_put_baseUrl(IHTMLDocument3 *iface, BSTR v)
2140 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2141 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2142 return E_NOTIMPL;
2145 static HRESULT WINAPI HTMLDocument3_get_baseUrl(IHTMLDocument3 *iface, BSTR *p)
2147 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2148 FIXME("(%p)->(%p)\n", This, p);
2149 return E_NOTIMPL;
2152 static HRESULT WINAPI HTMLDocument3_get_childNodes(IHTMLDocument3 *iface, IDispatch **p)
2154 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2156 TRACE("(%p)->(%p)\n", This, p);
2158 return IHTMLDOMNode_get_childNodes(&This->doc_node->node.IHTMLDOMNode_iface, p);
2161 static HRESULT WINAPI HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3 *iface,
2162 VARIANT_BOOL v)
2164 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2165 FIXME("(%p)->()\n", This);
2166 return E_NOTIMPL;
2169 static HRESULT WINAPI HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3 *iface,
2170 VARIANT_BOOL *p)
2172 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2173 FIXME("(%p)->(%p)\n", This, p);
2174 return E_NOTIMPL;
2177 static HRESULT WINAPI HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT v)
2179 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2180 FIXME("(%p)->()\n", This);
2181 return E_NOTIMPL;
2184 static HRESULT WINAPI HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT *p)
2186 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2187 FIXME("(%p)->(%p)\n", This, p);
2188 return E_NOTIMPL;
2191 static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BSTR v,
2192 IHTMLElementCollection **ppelColl)
2194 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2195 nsIDOMNodeList *node_list;
2196 nsAString selector_str;
2197 WCHAR *selector;
2198 nsresult nsres;
2200 static const WCHAR formatW[] = {'*','[','i','d','=','%','s',']',',','*','[','n','a','m','e','=','%','s',']',0};
2202 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), ppelColl);
2204 if(!This->doc_node || !This->doc_node->nsdoc) {
2205 /* We should probably return an empty collection. */
2206 FIXME("No nsdoc\n");
2207 return E_NOTIMPL;
2210 selector = heap_alloc(2*SysStringLen(v)*sizeof(WCHAR) + sizeof(formatW));
2211 if(!selector)
2212 return E_OUTOFMEMORY;
2213 sprintfW(selector, formatW, v, v);
2216 * NOTE: IE getElementsByName implementation differs from Gecko. It searches both name and id attributes.
2217 * That's why we use CSS selector instead. We should also use name only when it applies to given element
2218 * types and search should be case insensitive. Those are currently not supported properly.
2220 nsAString_InitDepend(&selector_str, selector);
2221 nsres = nsIDOMNodeSelector_QuerySelectorAll(This->doc_node->nsnode_selector, &selector_str, &node_list);
2222 nsAString_Finish(&selector_str);
2223 heap_free(selector);
2224 if(NS_FAILED(nsres)) {
2225 ERR("QuerySelectorAll failed: %08x\n", nsres);
2226 return E_FAIL;
2229 *ppelColl = create_collection_from_nodelist(This->doc_node, node_list);
2230 nsIDOMNodeList_Release(node_list);
2231 return S_OK;
2235 static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v,
2236 IHTMLElement **pel)
2238 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2239 HTMLElement *elem;
2240 HRESULT hres;
2242 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
2244 hres = get_doc_elem_by_id(This->doc_node, v, &elem);
2245 if(FAILED(hres) || !elem) {
2246 *pel = NULL;
2247 return hres;
2250 *pel = &elem->IHTMLElement_iface;
2251 return S_OK;
2255 static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface, BSTR v,
2256 IHTMLElementCollection **pelColl)
2258 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2259 nsIDOMNodeList *nslist;
2260 nsAString id_str;
2261 nsresult nsres;
2263 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
2265 if(!This->doc_node->nsdoc) {
2266 WARN("NULL nsdoc\n");
2267 return E_UNEXPECTED;
2270 nsAString_InitDepend(&id_str, v);
2271 nsres = nsIDOMHTMLDocument_GetElementsByTagName(This->doc_node->nsdoc, &id_str, &nslist);
2272 nsAString_Finish(&id_str);
2273 if(FAILED(nsres)) {
2274 ERR("GetElementByName failed: %08x\n", nsres);
2275 return E_FAIL;
2278 *pelColl = create_collection_from_nodelist(This->doc_node, nslist);
2279 nsIDOMNodeList_Release(nslist);
2281 return S_OK;
2284 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl = {
2285 HTMLDocument3_QueryInterface,
2286 HTMLDocument3_AddRef,
2287 HTMLDocument3_Release,
2288 HTMLDocument3_GetTypeInfoCount,
2289 HTMLDocument3_GetTypeInfo,
2290 HTMLDocument3_GetIDsOfNames,
2291 HTMLDocument3_Invoke,
2292 HTMLDocument3_releaseCapture,
2293 HTMLDocument3_recalc,
2294 HTMLDocument3_createTextNode,
2295 HTMLDocument3_get_documentElement,
2296 HTMLDocument3_uniqueID,
2297 HTMLDocument3_attachEvent,
2298 HTMLDocument3_detachEvent,
2299 HTMLDocument3_put_onrowsdelete,
2300 HTMLDocument3_get_onrowsdelete,
2301 HTMLDocument3_put_onrowsinserted,
2302 HTMLDocument3_get_onrowsinserted,
2303 HTMLDocument3_put_oncellchange,
2304 HTMLDocument3_get_oncellchange,
2305 HTMLDocument3_put_ondatasetchanged,
2306 HTMLDocument3_get_ondatasetchanged,
2307 HTMLDocument3_put_ondataavailable,
2308 HTMLDocument3_get_ondataavailable,
2309 HTMLDocument3_put_ondatasetcomplete,
2310 HTMLDocument3_get_ondatasetcomplete,
2311 HTMLDocument3_put_onpropertychange,
2312 HTMLDocument3_get_onpropertychange,
2313 HTMLDocument3_put_dir,
2314 HTMLDocument3_get_dir,
2315 HTMLDocument3_put_oncontextmenu,
2316 HTMLDocument3_get_oncontextmenu,
2317 HTMLDocument3_put_onstop,
2318 HTMLDocument3_get_onstop,
2319 HTMLDocument3_createDocumentFragment,
2320 HTMLDocument3_get_parentDocument,
2321 HTMLDocument3_put_enableDownload,
2322 HTMLDocument3_get_enableDownload,
2323 HTMLDocument3_put_baseUrl,
2324 HTMLDocument3_get_baseUrl,
2325 HTMLDocument3_get_childNodes,
2326 HTMLDocument3_put_inheritStyleSheets,
2327 HTMLDocument3_get_inheritStyleSheets,
2328 HTMLDocument3_put_onbeforeeditfocus,
2329 HTMLDocument3_get_onbeforeeditfocus,
2330 HTMLDocument3_getElementsByName,
2331 HTMLDocument3_getElementById,
2332 HTMLDocument3_getElementsByTagName
2335 static inline HTMLDocument *impl_from_IHTMLDocument4(IHTMLDocument4 *iface)
2337 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument4_iface);
2340 static HRESULT WINAPI HTMLDocument4_QueryInterface(IHTMLDocument4 *iface,
2341 REFIID riid, void **ppv)
2343 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2344 return htmldoc_query_interface(This, riid, ppv);
2347 static ULONG WINAPI HTMLDocument4_AddRef(IHTMLDocument4 *iface)
2349 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2350 return htmldoc_addref(This);
2353 static ULONG WINAPI HTMLDocument4_Release(IHTMLDocument4 *iface)
2355 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2356 return htmldoc_release(This);
2359 static HRESULT WINAPI HTMLDocument4_GetTypeInfoCount(IHTMLDocument4 *iface, UINT *pctinfo)
2361 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2362 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
2365 static HRESULT WINAPI HTMLDocument4_GetTypeInfo(IHTMLDocument4 *iface, UINT iTInfo,
2366 LCID lcid, ITypeInfo **ppTInfo)
2368 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2369 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2372 static HRESULT WINAPI HTMLDocument4_GetIDsOfNames(IHTMLDocument4 *iface, REFIID riid,
2373 LPOLESTR *rgszNames, UINT cNames,
2374 LCID lcid, DISPID *rgDispId)
2376 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2377 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
2378 rgDispId);
2381 static HRESULT WINAPI HTMLDocument4_Invoke(IHTMLDocument4 *iface, DISPID dispIdMember,
2382 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2383 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2385 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2386 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2387 pDispParams, pVarResult, pExcepInfo, puArgErr);
2390 static HRESULT WINAPI HTMLDocument4_focus(IHTMLDocument4 *iface)
2392 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2393 nsIDOMHTMLElement *nsbody;
2394 nsresult nsres;
2396 TRACE("(%p)->()\n", This);
2398 nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
2399 if(NS_FAILED(nsres) || !nsbody) {
2400 ERR("GetBody failed: %08x\n", nsres);
2401 return E_FAIL;
2404 nsres = nsIDOMHTMLElement_Focus(nsbody);
2405 nsIDOMHTMLElement_Release(nsbody);
2406 if(NS_FAILED(nsres)) {
2407 ERR("Focus failed: %08x\n", nsres);
2408 return E_FAIL;
2411 return S_OK;
2414 static HRESULT WINAPI HTMLDocument4_hasFocus(IHTMLDocument4 *iface, VARIANT_BOOL *pfFocus)
2416 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2417 FIXME("(%p)->(%p)\n", This, pfFocus);
2418 return E_NOTIMPL;
2421 static HRESULT WINAPI HTMLDocument4_put_onselectionchange(IHTMLDocument4 *iface, VARIANT v)
2423 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2424 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2425 return E_NOTIMPL;
2428 static HRESULT WINAPI HTMLDocument4_get_onselectionchange(IHTMLDocument4 *iface, VARIANT *p)
2430 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2431 FIXME("(%p)->(%p)\n", This, p);
2432 return E_NOTIMPL;
2435 static HRESULT WINAPI HTMLDocument4_get_namespace(IHTMLDocument4 *iface, IDispatch **p)
2437 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2438 FIXME("(%p)->(%p)\n", This, p);
2439 return E_NOTIMPL;
2442 static HRESULT WINAPI HTMLDocument4_createDocumentFromUrl(IHTMLDocument4 *iface, BSTR bstrUrl,
2443 BSTR bstrOptions, IHTMLDocument2 **newDoc)
2445 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2446 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(bstrUrl), debugstr_w(bstrOptions), newDoc);
2447 return E_NOTIMPL;
2450 static HRESULT WINAPI HTMLDocument4_put_media(IHTMLDocument4 *iface, BSTR v)
2452 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2453 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2454 return E_NOTIMPL;
2457 static HRESULT WINAPI HTMLDocument4_get_media(IHTMLDocument4 *iface, BSTR *p)
2459 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2460 FIXME("(%p)->(%p)\n", This, p);
2461 return E_NOTIMPL;
2464 static HRESULT WINAPI HTMLDocument4_createEventObject(IHTMLDocument4 *iface,
2465 VARIANT *pvarEventObject, IHTMLEventObj **ppEventObj)
2467 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2469 TRACE("(%p)->(%s %p)\n", This, debugstr_variant(pvarEventObject), ppEventObj);
2471 if(pvarEventObject && V_VT(pvarEventObject) != VT_ERROR && V_VT(pvarEventObject) != VT_EMPTY) {
2472 FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject));
2473 return E_NOTIMPL;
2476 return create_event_obj(ppEventObj);
2479 static HRESULT WINAPI HTMLDocument4_fireEvent(IHTMLDocument4 *iface, BSTR bstrEventName,
2480 VARIANT *pvarEventObject, VARIANT_BOOL *pfCanceled)
2482 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2484 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCanceled);
2486 return dispatch_event(&This->doc_node->node, bstrEventName, pvarEventObject, pfCanceled);
2489 static HRESULT WINAPI HTMLDocument4_createRenderStyle(IHTMLDocument4 *iface, BSTR v,
2490 IHTMLRenderStyle **ppIHTMLRenderStyle)
2492 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2493 FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppIHTMLRenderStyle);
2494 return E_NOTIMPL;
2497 static HRESULT WINAPI HTMLDocument4_put_oncontrolselect(IHTMLDocument4 *iface, VARIANT v)
2499 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2500 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2501 return E_NOTIMPL;
2504 static HRESULT WINAPI HTMLDocument4_get_oncontrolselect(IHTMLDocument4 *iface, VARIANT *p)
2506 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2507 FIXME("(%p)->(%p)\n", This, p);
2508 return E_NOTIMPL;
2511 static HRESULT WINAPI HTMLDocument4_get_URLEncoded(IHTMLDocument4 *iface, BSTR *p)
2513 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2514 FIXME("(%p)->(%p)\n", This, p);
2515 return E_NOTIMPL;
2518 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl = {
2519 HTMLDocument4_QueryInterface,
2520 HTMLDocument4_AddRef,
2521 HTMLDocument4_Release,
2522 HTMLDocument4_GetTypeInfoCount,
2523 HTMLDocument4_GetTypeInfo,
2524 HTMLDocument4_GetIDsOfNames,
2525 HTMLDocument4_Invoke,
2526 HTMLDocument4_focus,
2527 HTMLDocument4_hasFocus,
2528 HTMLDocument4_put_onselectionchange,
2529 HTMLDocument4_get_onselectionchange,
2530 HTMLDocument4_get_namespace,
2531 HTMLDocument4_createDocumentFromUrl,
2532 HTMLDocument4_put_media,
2533 HTMLDocument4_get_media,
2534 HTMLDocument4_createEventObject,
2535 HTMLDocument4_fireEvent,
2536 HTMLDocument4_createRenderStyle,
2537 HTMLDocument4_put_oncontrolselect,
2538 HTMLDocument4_get_oncontrolselect,
2539 HTMLDocument4_get_URLEncoded
2542 static inline HTMLDocument *impl_from_IHTMLDocument5(IHTMLDocument5 *iface)
2544 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument5_iface);
2547 static HRESULT WINAPI HTMLDocument5_QueryInterface(IHTMLDocument5 *iface,
2548 REFIID riid, void **ppv)
2550 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2551 return htmldoc_query_interface(This, riid, ppv);
2554 static ULONG WINAPI HTMLDocument5_AddRef(IHTMLDocument5 *iface)
2556 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2557 return htmldoc_addref(This);
2560 static ULONG WINAPI HTMLDocument5_Release(IHTMLDocument5 *iface)
2562 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2563 return htmldoc_release(This);
2566 static HRESULT WINAPI HTMLDocument5_GetTypeInfoCount(IHTMLDocument5 *iface, UINT *pctinfo)
2568 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2569 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
2572 static HRESULT WINAPI HTMLDocument5_GetTypeInfo(IHTMLDocument5 *iface, UINT iTInfo,
2573 LCID lcid, ITypeInfo **ppTInfo)
2575 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2576 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2579 static HRESULT WINAPI HTMLDocument5_GetIDsOfNames(IHTMLDocument5 *iface, REFIID riid,
2580 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
2582 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2583 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
2584 rgDispId);
2587 static HRESULT WINAPI HTMLDocument5_Invoke(IHTMLDocument5 *iface, DISPID dispIdMember,
2588 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2589 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2591 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2592 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2593 pDispParams, pVarResult, pExcepInfo, puArgErr);
2596 static HRESULT WINAPI HTMLDocument5_put_onmousewheel(IHTMLDocument5 *iface, VARIANT v)
2598 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2599 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2600 return E_NOTIMPL;
2603 static HRESULT WINAPI HTMLDocument5_get_onmousewheel(IHTMLDocument5 *iface, VARIANT *p)
2605 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2606 FIXME("(%p)->(%p)\n", This, p);
2607 return E_NOTIMPL;
2610 static HRESULT WINAPI HTMLDocument5_get_doctype(IHTMLDocument5 *iface, IHTMLDOMNode **p)
2612 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2613 FIXME("(%p)->(%p)\n", This, p);
2614 return E_NOTIMPL;
2617 static HRESULT WINAPI HTMLDocument5_get_implementation(IHTMLDocument5 *iface, IHTMLDOMImplementation **p)
2619 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2620 FIXME("(%p)->(%p)\n", This, p);
2621 return E_NOTIMPL;
2624 static HRESULT WINAPI HTMLDocument5_createAttribute(IHTMLDocument5 *iface, BSTR bstrattrName,
2625 IHTMLDOMAttribute **ppattribute)
2627 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2628 HTMLDOMAttribute *attr;
2629 HRESULT hres;
2631 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrattrName), ppattribute);
2633 hres = HTMLDOMAttribute_Create(bstrattrName, NULL, 0, &attr);
2634 if(FAILED(hres))
2635 return hres;
2637 *ppattribute = &attr->IHTMLDOMAttribute_iface;
2638 return S_OK;
2641 static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bstrdata,
2642 IHTMLDOMNode **ppRetNode)
2644 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2645 nsIDOMComment *nscomment;
2646 HTMLElement *elem;
2647 nsAString str;
2648 nsresult nsres;
2649 HRESULT hres;
2651 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrdata), ppRetNode);
2653 if(!This->doc_node->nsdoc) {
2654 WARN("NULL nsdoc\n");
2655 return E_UNEXPECTED;
2658 nsAString_InitDepend(&str, bstrdata);
2659 nsres = nsIDOMHTMLDocument_CreateComment(This->doc_node->nsdoc, &str, &nscomment);
2660 nsAString_Finish(&str);
2661 if(NS_FAILED(nsres)) {
2662 ERR("CreateTextNode failed: %08x\n", nsres);
2663 return E_FAIL;
2666 hres = HTMLCommentElement_Create(This->doc_node, (nsIDOMNode*)nscomment, &elem);
2667 nsIDOMComment_Release(nscomment);
2668 if(FAILED(hres))
2669 return hres;
2671 *ppRetNode = &elem->node.IHTMLDOMNode_iface;
2672 return S_OK;
2675 static HRESULT WINAPI HTMLDocument5_put_onfocusin(IHTMLDocument5 *iface, VARIANT v)
2677 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2678 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2679 return E_NOTIMPL;
2682 static HRESULT WINAPI HTMLDocument5_get_onfocusin(IHTMLDocument5 *iface, VARIANT *p)
2684 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2685 FIXME("(%p)->(%p)\n", This, p);
2686 return E_NOTIMPL;
2689 static HRESULT WINAPI HTMLDocument5_put_onfocusout(IHTMLDocument5 *iface, VARIANT v)
2691 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2692 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2693 return E_NOTIMPL;
2696 static HRESULT WINAPI HTMLDocument5_get_onfocusout(IHTMLDocument5 *iface, VARIANT *p)
2698 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2699 FIXME("(%p)->(%p)\n", This, p);
2700 return E_NOTIMPL;
2703 static HRESULT WINAPI HTMLDocument5_put_onactivate(IHTMLDocument5 *iface, VARIANT v)
2705 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2706 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2707 return E_NOTIMPL;
2710 static HRESULT WINAPI HTMLDocument5_get_onactivate(IHTMLDocument5 *iface, VARIANT *p)
2712 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2713 FIXME("(%p)->(%p)\n", This, p);
2714 return E_NOTIMPL;
2717 static HRESULT WINAPI HTMLDocument5_put_ondeactivate(IHTMLDocument5 *iface, VARIANT v)
2719 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2720 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2721 return E_NOTIMPL;
2724 static HRESULT WINAPI HTMLDocument5_get_ondeactivate(IHTMLDocument5 *iface, VARIANT *p)
2726 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2727 FIXME("(%p)->(%p)\n", This, p);
2728 return E_NOTIMPL;
2731 static HRESULT WINAPI HTMLDocument5_put_onbeforeactivate(IHTMLDocument5 *iface, VARIANT v)
2733 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2734 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2735 return E_NOTIMPL;
2738 static HRESULT WINAPI HTMLDocument5_get_onbeforeactivate(IHTMLDocument5 *iface, VARIANT *p)
2740 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2741 FIXME("(%p)->(%p)\n", This, p);
2742 return E_NOTIMPL;
2745 static HRESULT WINAPI HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5 *iface, VARIANT v)
2747 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2748 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2749 return E_NOTIMPL;
2752 static HRESULT WINAPI HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5 *iface, VARIANT *p)
2754 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2755 FIXME("(%p)->(%p)\n", This, p);
2756 return E_NOTIMPL;
2759 static HRESULT WINAPI HTMLDocument5_get_compatMode(IHTMLDocument5 *iface, BSTR *p)
2761 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2762 nsAString mode_str;
2763 const PRUnichar *mode;
2765 TRACE("(%p)->(%p)\n", This, p);
2767 if(!This->doc_node->nsdoc) {
2768 WARN("NULL nsdoc\n");
2769 return E_UNEXPECTED;
2772 nsAString_Init(&mode_str, NULL);
2773 nsIDOMHTMLDocument_GetCompatMode(This->doc_node->nsdoc, &mode_str);
2775 nsAString_GetData(&mode_str, &mode);
2776 *p = SysAllocString(mode);
2777 nsAString_Finish(&mode_str);
2779 return S_OK;
2782 static const IHTMLDocument5Vtbl HTMLDocument5Vtbl = {
2783 HTMLDocument5_QueryInterface,
2784 HTMLDocument5_AddRef,
2785 HTMLDocument5_Release,
2786 HTMLDocument5_GetTypeInfoCount,
2787 HTMLDocument5_GetTypeInfo,
2788 HTMLDocument5_GetIDsOfNames,
2789 HTMLDocument5_Invoke,
2790 HTMLDocument5_put_onmousewheel,
2791 HTMLDocument5_get_onmousewheel,
2792 HTMLDocument5_get_doctype,
2793 HTMLDocument5_get_implementation,
2794 HTMLDocument5_createAttribute,
2795 HTMLDocument5_createComment,
2796 HTMLDocument5_put_onfocusin,
2797 HTMLDocument5_get_onfocusin,
2798 HTMLDocument5_put_onfocusout,
2799 HTMLDocument5_get_onfocusout,
2800 HTMLDocument5_put_onactivate,
2801 HTMLDocument5_get_onactivate,
2802 HTMLDocument5_put_ondeactivate,
2803 HTMLDocument5_get_ondeactivate,
2804 HTMLDocument5_put_onbeforeactivate,
2805 HTMLDocument5_get_onbeforeactivate,
2806 HTMLDocument5_put_onbeforedeactivate,
2807 HTMLDocument5_get_onbeforedeactivate,
2808 HTMLDocument5_get_compatMode
2811 static inline HTMLDocument *impl_from_IHTMLDocument6(IHTMLDocument6 *iface)
2813 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument6_iface);
2816 static HRESULT WINAPI HTMLDocument6_QueryInterface(IHTMLDocument6 *iface,
2817 REFIID riid, void **ppv)
2819 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2820 return htmldoc_query_interface(This, riid, ppv);
2823 static ULONG WINAPI HTMLDocument6_AddRef(IHTMLDocument6 *iface)
2825 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2826 return htmldoc_addref(This);
2829 static ULONG WINAPI HTMLDocument6_Release(IHTMLDocument6 *iface)
2831 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2832 return htmldoc_release(This);
2835 static HRESULT WINAPI HTMLDocument6_GetTypeInfoCount(IHTMLDocument6 *iface, UINT *pctinfo)
2837 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2838 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
2841 static HRESULT WINAPI HTMLDocument6_GetTypeInfo(IHTMLDocument6 *iface, UINT iTInfo,
2842 LCID lcid, ITypeInfo **ppTInfo)
2844 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2845 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2848 static HRESULT WINAPI HTMLDocument6_GetIDsOfNames(IHTMLDocument6 *iface, REFIID riid,
2849 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
2851 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2852 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
2853 rgDispId);
2856 static HRESULT WINAPI HTMLDocument6_Invoke(IHTMLDocument6 *iface, DISPID dispIdMember,
2857 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2858 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2860 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2861 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2862 pDispParams, pVarResult, pExcepInfo, puArgErr);
2865 static HRESULT WINAPI HTMLDocument6_get_compatible(IHTMLDocument6 *iface,
2866 IHTMLDocumentCompatibleInfoCollection **p)
2868 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2869 FIXME("(%p)->(%p)\n", This, p);
2870 return E_NOTIMPL;
2873 static HRESULT WINAPI HTMLDocument6_get_documentMode(IHTMLDocument6 *iface,
2874 VARIANT *p)
2876 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2877 FIXME("(%p)->(%p)\n", This, p);
2878 return E_NOTIMPL;
2881 static HRESULT WINAPI HTMLDocument6_get_onstorage(IHTMLDocument6 *iface,
2882 VARIANT *p)
2884 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2885 FIXME("(%p)->(%p)\n", This, p);
2886 return E_NOTIMPL;
2889 static HRESULT WINAPI HTMLDocument6_put_onstorage(IHTMLDocument6 *iface, VARIANT v)
2891 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2892 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2893 return E_NOTIMPL;
2896 static HRESULT WINAPI HTMLDocument6_get_onstoragecommit(IHTMLDocument6 *iface,
2897 VARIANT *p)
2899 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2900 FIXME("(%p)->(%p)\n", This, p);
2901 return E_NOTIMPL;
2904 static HRESULT WINAPI HTMLDocument6_put_onstoragecommit(IHTMLDocument6 *iface, VARIANT v)
2906 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2907 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2908 return E_NOTIMPL;
2911 static HRESULT WINAPI HTMLDocument6_getElementById(IHTMLDocument6 *iface,
2912 BSTR bstrId, IHTMLElement2 **p)
2914 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2915 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrId), p);
2916 return E_NOTIMPL;
2919 static HRESULT WINAPI HTMLDocument6_updateSettings(IHTMLDocument6 *iface)
2921 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2922 FIXME("(%p)->()\n", This);
2923 return E_NOTIMPL;
2926 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl = {
2927 HTMLDocument6_QueryInterface,
2928 HTMLDocument6_AddRef,
2929 HTMLDocument6_Release,
2930 HTMLDocument6_GetTypeInfoCount,
2931 HTMLDocument6_GetTypeInfo,
2932 HTMLDocument6_GetIDsOfNames,
2933 HTMLDocument6_Invoke,
2934 HTMLDocument6_get_compatible,
2935 HTMLDocument6_get_documentMode,
2936 HTMLDocument6_put_onstorage,
2937 HTMLDocument6_get_onstorage,
2938 HTMLDocument6_put_onstoragecommit,
2939 HTMLDocument6_get_onstoragecommit,
2940 HTMLDocument6_getElementById,
2941 HTMLDocument6_updateSettings
2944 static inline HTMLDocument *impl_from_IHTMLDocument7(IHTMLDocument7 *iface)
2946 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument7_iface);
2949 static HRESULT WINAPI HTMLDocument7_QueryInterface(IHTMLDocument7 *iface, REFIID riid, void **ppv)
2951 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2952 return htmldoc_query_interface(This, riid, ppv);
2955 static ULONG WINAPI HTMLDocument7_AddRef(IHTMLDocument7 *iface)
2957 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2958 return htmldoc_addref(This);
2961 static ULONG WINAPI HTMLDocument7_Release(IHTMLDocument7 *iface)
2963 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2964 return htmldoc_release(This);
2967 static HRESULT WINAPI HTMLDocument7_GetTypeInfoCount(IHTMLDocument7 *iface, UINT *pctinfo)
2969 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2970 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
2973 static HRESULT WINAPI HTMLDocument7_GetTypeInfo(IHTMLDocument7 *iface, UINT iTInfo,
2974 LCID lcid, ITypeInfo **ppTInfo)
2976 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2977 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2980 static HRESULT WINAPI HTMLDocument7_GetIDsOfNames(IHTMLDocument7 *iface, REFIID riid,
2981 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
2983 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2984 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
2985 rgDispId);
2988 static HRESULT WINAPI HTMLDocument7_Invoke(IHTMLDocument7 *iface, DISPID dispIdMember,
2989 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2990 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2992 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2993 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2994 pDispParams, pVarResult, pExcepInfo, puArgErr);
2997 static HRESULT WINAPI HTMLDocument7_get_defaultView(IHTMLDocument7 *iface, IHTMLWindow2 **p)
2999 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3000 FIXME("(%p)->(%p)\n", This, p);
3001 return E_NOTIMPL;
3004 static HRESULT WINAPI HTMLDocument7_createCDATASection(IHTMLDocument7 *iface, BSTR text, IHTMLDOMNode **newCDATASectionNode)
3006 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3007 FIXME("(%p)->(%p)\n", This, newCDATASectionNode);
3008 return E_NOTIMPL;
3011 static HRESULT WINAPI HTMLDocument7_getSelection(IHTMLDocument7 *iface, IHTMLSelection **ppIHTMLSelection)
3013 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3014 FIXME("(%p)->(%p)\n", This, ppIHTMLSelection);
3015 return E_NOTIMPL;
3018 static HRESULT WINAPI HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7 *iface, VARIANT *pvarNS,
3019 BSTR bstrLocalName, IHTMLElementCollection **pelColl)
3021 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3022 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrLocalName), pelColl);
3023 return E_NOTIMPL;
3026 static HRESULT WINAPI HTMLDocument7_createElementNS(IHTMLDocument7 *iface, VARIANT *pvarNS, BSTR bstrTag, IHTMLElement **newElem)
3028 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3029 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrTag), newElem);
3030 return E_NOTIMPL;
3033 static HRESULT WINAPI HTMLDocument7_createAttributeNS(IHTMLDocument7 *iface, VARIANT *pvarNS,
3034 BSTR bstrAttrName, IHTMLDOMAttribute **ppAttribute)
3036 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3037 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrAttrName), ppAttribute);
3038 return E_NOTIMPL;
3041 static HRESULT WINAPI HTMLDocument7_put_onmsthumbnailclick(IHTMLDocument7 *iface, VARIANT v)
3043 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3044 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3045 return E_NOTIMPL;
3048 static HRESULT WINAPI HTMLDocument7_get_onmsthumbnailclick(IHTMLDocument7 *iface, VARIANT *p)
3050 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3051 FIXME("(%p)->(%p)\n", This, p);
3052 return E_NOTIMPL;
3055 static HRESULT WINAPI HTMLDocument7_get_characterSet(IHTMLDocument7 *iface, BSTR *p)
3057 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3058 FIXME("(%p)->(%p)\n", This, p);
3059 return E_NOTIMPL;
3062 static HRESULT WINAPI HTMLDocument7_createElement(IHTMLDocument7 *iface, BSTR bstrTag, IHTMLElement **newElem)
3064 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3065 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrTag), newElem);
3066 return E_NOTIMPL;
3069 static HRESULT WINAPI HTMLDocument7_createAttribute(IHTMLDocument7 *iface, BSTR bstrAttrName, IHTMLDOMAttribute **ppAttribute)
3071 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3072 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrAttrName), ppAttribute);
3073 return E_NOTIMPL;
3076 static HRESULT WINAPI HTMLDocument7_getElementByClassName(IHTMLDocument7 *iface, BSTR v, IHTMLElementCollection **pel)
3078 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3079 FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
3080 return E_NOTIMPL;
3083 static HRESULT WINAPI HTMLDocument7_createProcessingInstruction(IHTMLDocument7 *iface, BSTR target,
3084 BSTR data, IDOMProcessingInstruction **newProcessingInstruction)
3086 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3087 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(target), debugstr_w(data), newProcessingInstruction);
3088 return E_NOTIMPL;
3091 static HRESULT WINAPI HTMLDocument7_adoptNode(IHTMLDocument7 *iface, IHTMLDOMNode *pNodeSource, IHTMLDOMNode3 **ppNodeDest)
3093 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3094 FIXME("(%p)->(%p %p)\n", This, pNodeSource, ppNodeDest);
3095 return E_NOTIMPL;
3098 static HRESULT WINAPI HTMLDocument7_put_onmssitemodejumplistitemremoved(IHTMLDocument7 *iface, VARIANT v)
3100 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3101 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3102 return E_NOTIMPL;
3105 static HRESULT WINAPI HTMLDocument7_get_onmssitemodejumplistitemremoved(IHTMLDocument7 *iface, VARIANT *p)
3107 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3108 FIXME("(%p)->(%p)\n", This, p);
3109 return E_NOTIMPL;
3112 static HRESULT WINAPI HTMLDocument7_get_all(IHTMLDocument7 *iface, IHTMLElementCollection **p)
3114 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3115 FIXME("(%p)->(%p)\n", This, p);
3116 return E_NOTIMPL;
3119 static HRESULT WINAPI HTMLDocument7_get_inputEncoding(IHTMLDocument7 *iface, BSTR *p)
3121 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3122 FIXME("(%p)->(%p)\n", This, p);
3123 return E_NOTIMPL;
3126 static HRESULT WINAPI HTMLDocument7_get_xmlEncoding(IHTMLDocument7 *iface, BSTR *p)
3128 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3129 FIXME("(%p)->(%p)\n", This, p);
3130 return E_NOTIMPL;
3133 static HRESULT WINAPI HTMLDocument7_put_xmlStandalone(IHTMLDocument7 *iface, VARIANT_BOOL v)
3135 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3136 FIXME("(%p)->(%x)\n", This, v);
3137 return E_NOTIMPL;
3140 static HRESULT WINAPI HTMLDocument7_get_xmlStandalone(IHTMLDocument7 *iface, VARIANT_BOOL *p)
3142 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3143 FIXME("(%p)->(%p)\n", This, p);
3144 return E_NOTIMPL;
3147 static HRESULT WINAPI HTMLDocument7_put_xmlVersion(IHTMLDocument7 *iface, BSTR v)
3149 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3150 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
3151 return E_NOTIMPL;
3154 static HRESULT WINAPI HTMLDocument7_get_xmlVersion(IHTMLDocument7 *iface, BSTR *p)
3156 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3157 FIXME("(%p)->(%p)\n", This, p);
3158 return E_NOTIMPL;
3161 static HRESULT WINAPI HTMLDocument7_hasAttributes(IHTMLDocument7 *iface, VARIANT_BOOL *pfHasAttributes)
3163 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3164 FIXME("(%p)->(%p)\n", This, pfHasAttributes);
3165 return E_NOTIMPL;
3168 static HRESULT WINAPI HTMLDocument7_put_onabort(IHTMLDocument7 *iface, VARIANT v)
3170 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3171 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3172 return E_NOTIMPL;
3175 static HRESULT WINAPI HTMLDocument7_get_onabort(IHTMLDocument7 *iface, VARIANT *p)
3177 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3178 FIXME("(%p)->(%p)\n", This, p);
3179 return E_NOTIMPL;
3182 static HRESULT WINAPI HTMLDocument7_put_onblur(IHTMLDocument7 *iface, VARIANT v)
3184 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3185 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3186 return E_NOTIMPL;
3189 static HRESULT WINAPI HTMLDocument7_get_onblur(IHTMLDocument7 *iface, VARIANT *p)
3191 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3192 FIXME("(%p)->(%p)\n", This, p);
3193 return E_NOTIMPL;
3196 static HRESULT WINAPI HTMLDocument7_put_oncanplay(IHTMLDocument7 *iface, VARIANT v)
3198 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3199 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3200 return E_NOTIMPL;
3203 static HRESULT WINAPI HTMLDocument7_get_oncanplay(IHTMLDocument7 *iface, VARIANT *p)
3205 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3206 FIXME("(%p)->(%p)\n", This, p);
3207 return E_NOTIMPL;
3210 static HRESULT WINAPI HTMLDocument7_put_oncanplaythrough(IHTMLDocument7 *iface, VARIANT v)
3212 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3213 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3214 return E_NOTIMPL;
3217 static HRESULT WINAPI HTMLDocument7_get_oncanplaythrough(IHTMLDocument7 *iface, VARIANT *p)
3219 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3220 FIXME("(%p)->(%p)\n", This, p);
3221 return E_NOTIMPL;
3224 static HRESULT WINAPI HTMLDocument7_put_onchange(IHTMLDocument7 *iface, VARIANT v)
3226 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3227 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3228 return E_NOTIMPL;
3231 static HRESULT WINAPI HTMLDocument7_get_onchange(IHTMLDocument7 *iface, VARIANT *p)
3233 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3234 FIXME("(%p)->(%p)\n", This, p);
3235 return E_NOTIMPL;
3238 static HRESULT WINAPI HTMLDocument7_put_ondrag(IHTMLDocument7 *iface, VARIANT v)
3240 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3241 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3242 return E_NOTIMPL;
3245 static HRESULT WINAPI HTMLDocument7_get_ondrag(IHTMLDocument7 *iface, VARIANT *p)
3247 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3248 FIXME("(%p)->(%p)\n", This, p);
3249 return E_NOTIMPL;
3252 static HRESULT WINAPI HTMLDocument7_put_ondragend(IHTMLDocument7 *iface, VARIANT v)
3254 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3255 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3256 return E_NOTIMPL;
3259 static HRESULT WINAPI HTMLDocument7_get_ondragend(IHTMLDocument7 *iface, VARIANT *p)
3261 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3262 FIXME("(%p)->(%p)\n", This, p);
3263 return E_NOTIMPL;
3266 static HRESULT WINAPI HTMLDocument7_put_ondragenter(IHTMLDocument7 *iface, VARIANT v)
3268 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3269 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3270 return E_NOTIMPL;
3273 static HRESULT WINAPI HTMLDocument7_get_ondragenter(IHTMLDocument7 *iface, VARIANT *p)
3275 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3276 FIXME("(%p)->(%p)\n", This, p);
3277 return E_NOTIMPL;
3280 static HRESULT WINAPI HTMLDocument7_put_ondragleave(IHTMLDocument7 *iface, VARIANT v)
3282 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3283 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3284 return E_NOTIMPL;
3287 static HRESULT WINAPI HTMLDocument7_get_ondragleave(IHTMLDocument7 *iface, VARIANT *p)
3289 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3290 FIXME("(%p)->(%p)\n", This, p);
3291 return E_NOTIMPL;
3294 static HRESULT WINAPI HTMLDocument7_put_ondragover(IHTMLDocument7 *iface, VARIANT v)
3296 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3297 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3298 return E_NOTIMPL;
3301 static HRESULT WINAPI HTMLDocument7_get_ondragover(IHTMLDocument7 *iface, VARIANT *p)
3303 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3304 FIXME("(%p)->(%p)\n", This, p);
3305 return E_NOTIMPL;
3308 static HRESULT WINAPI HTMLDocument7_put_ondrop(IHTMLDocument7 *iface, VARIANT v)
3310 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3311 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3312 return E_NOTIMPL;
3315 static HRESULT WINAPI HTMLDocument7_get_ondrop(IHTMLDocument7 *iface, VARIANT *p)
3317 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3318 FIXME("(%p)->(%p)\n", This, p);
3319 return E_NOTIMPL;
3322 static HRESULT WINAPI HTMLDocument7_put_ondurationchange(IHTMLDocument7 *iface, VARIANT v)
3324 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3325 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3326 return E_NOTIMPL;
3329 static HRESULT WINAPI HTMLDocument7_get_ondurationchange(IHTMLDocument7 *iface, VARIANT *p)
3331 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3332 FIXME("(%p)->(%p)\n", This, p);
3333 return E_NOTIMPL;
3336 static HRESULT WINAPI HTMLDocument7_put_onemptied(IHTMLDocument7 *iface, VARIANT v)
3338 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3339 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3340 return E_NOTIMPL;
3343 static HRESULT WINAPI HTMLDocument7_get_onemptied(IHTMLDocument7 *iface, VARIANT *p)
3345 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3346 FIXME("(%p)->(%p)\n", This, p);
3347 return E_NOTIMPL;
3350 static HRESULT WINAPI HTMLDocument7_put_onended(IHTMLDocument7 *iface, VARIANT v)
3352 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3353 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3354 return E_NOTIMPL;
3357 static HRESULT WINAPI HTMLDocument7_get_onended(IHTMLDocument7 *iface, VARIANT *p)
3359 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3360 FIXME("(%p)->(%p)\n", This, p);
3361 return E_NOTIMPL;
3364 static HRESULT WINAPI HTMLDocument7_put_onerror(IHTMLDocument7 *iface, VARIANT v)
3366 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3367 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3368 return E_NOTIMPL;
3371 static HRESULT WINAPI HTMLDocument7_get_onerror(IHTMLDocument7 *iface, VARIANT *p)
3373 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3374 FIXME("(%p)->(%p)\n", This, p);
3375 return E_NOTIMPL;
3378 static HRESULT WINAPI HTMLDocument7_put_onfocus(IHTMLDocument7 *iface, VARIANT v)
3380 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3381 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3382 return E_NOTIMPL;
3385 static HRESULT WINAPI HTMLDocument7_get_onfocus(IHTMLDocument7 *iface, VARIANT *p)
3387 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3388 FIXME("(%p)->(%p)\n", This, p);
3389 return E_NOTIMPL;
3392 static HRESULT WINAPI HTMLDocument7_put_oninput(IHTMLDocument7 *iface, VARIANT v)
3394 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3395 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3396 return E_NOTIMPL;
3399 static HRESULT WINAPI HTMLDocument7_get_oninput(IHTMLDocument7 *iface, VARIANT *p)
3401 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3402 FIXME("(%p)->(%p)\n", This, p);
3403 return E_NOTIMPL;
3406 static HRESULT WINAPI HTMLDocument7_put_onload(IHTMLDocument7 *iface, VARIANT v)
3408 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3409 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3410 return E_NOTIMPL;
3413 static HRESULT WINAPI HTMLDocument7_get_onload(IHTMLDocument7 *iface, VARIANT *p)
3415 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3416 FIXME("(%p)->(%p)\n", This, p);
3417 return E_NOTIMPL;
3420 static HRESULT WINAPI HTMLDocument7_put_onloadeddata(IHTMLDocument7 *iface, VARIANT v)
3422 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3423 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3424 return E_NOTIMPL;
3427 static HRESULT WINAPI HTMLDocument7_get_onloadeddata(IHTMLDocument7 *iface, VARIANT *p)
3429 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3430 FIXME("(%p)->(%p)\n", This, p);
3431 return E_NOTIMPL;
3434 static HRESULT WINAPI HTMLDocument7_put_onloadedmetadata(IHTMLDocument7 *iface, VARIANT v)
3436 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3437 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3438 return E_NOTIMPL;
3441 static HRESULT WINAPI HTMLDocument7_get_onloadedmetadata(IHTMLDocument7 *iface, VARIANT *p)
3443 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3444 FIXME("(%p)->(%p)\n", This, p);
3445 return E_NOTIMPL;
3448 static HRESULT WINAPI HTMLDocument7_put_onloadstart(IHTMLDocument7 *iface, VARIANT v)
3450 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3451 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3452 return E_NOTIMPL;
3455 static HRESULT WINAPI HTMLDocument7_get_onloadstart(IHTMLDocument7 *iface, VARIANT *p)
3457 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3458 FIXME("(%p)->(%p)\n", This, p);
3459 return E_NOTIMPL;
3462 static HRESULT WINAPI HTMLDocument7_put_onpause(IHTMLDocument7 *iface, VARIANT v)
3464 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3465 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3466 return E_NOTIMPL;
3469 static HRESULT WINAPI HTMLDocument7_get_onpause(IHTMLDocument7 *iface, VARIANT *p)
3471 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3472 FIXME("(%p)->(%p)\n", This, p);
3473 return E_NOTIMPL;
3476 static HRESULT WINAPI HTMLDocument7_put_onplay(IHTMLDocument7 *iface, VARIANT v)
3478 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3479 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3480 return E_NOTIMPL;
3483 static HRESULT WINAPI HTMLDocument7_get_onplay(IHTMLDocument7 *iface, VARIANT *p)
3485 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3486 FIXME("(%p)->(%p)\n", This, p);
3487 return E_NOTIMPL;
3490 static HRESULT WINAPI HTMLDocument7_put_onplaying(IHTMLDocument7 *iface, VARIANT v)
3492 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3493 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3494 return E_NOTIMPL;
3497 static HRESULT WINAPI HTMLDocument7_get_onplaying(IHTMLDocument7 *iface, VARIANT *p)
3499 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3500 FIXME("(%p)->(%p)\n", This, p);
3501 return E_NOTIMPL;
3504 static HRESULT WINAPI HTMLDocument7_put_onprogress(IHTMLDocument7 *iface, VARIANT v)
3506 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3507 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3508 return E_NOTIMPL;
3511 static HRESULT WINAPI HTMLDocument7_get_onprogress(IHTMLDocument7 *iface, VARIANT *p)
3513 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3514 FIXME("(%p)->(%p)\n", This, p);
3515 return E_NOTIMPL;
3518 static HRESULT WINAPI HTMLDocument7_put_onratechange(IHTMLDocument7 *iface, VARIANT v)
3520 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3521 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3522 return E_NOTIMPL;
3525 static HRESULT WINAPI HTMLDocument7_get_onratechange(IHTMLDocument7 *iface, VARIANT *p)
3527 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3528 FIXME("(%p)->(%p)\n", This, p);
3529 return E_NOTIMPL;
3532 static HRESULT WINAPI HTMLDocument7_put_onreset(IHTMLDocument7 *iface, VARIANT v)
3534 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3535 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3536 return E_NOTIMPL;
3539 static HRESULT WINAPI HTMLDocument7_get_onreset(IHTMLDocument7 *iface, VARIANT *p)
3541 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3542 FIXME("(%p)->(%p)\n", This, p);
3543 return E_NOTIMPL;
3546 static HRESULT WINAPI HTMLDocument7_put_onscroll(IHTMLDocument7 *iface, VARIANT v)
3548 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3549 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3550 return E_NOTIMPL;
3553 static HRESULT WINAPI HTMLDocument7_get_onscroll(IHTMLDocument7 *iface, VARIANT *p)
3555 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3556 FIXME("(%p)->(%p)\n", This, p);
3557 return E_NOTIMPL;
3560 static HRESULT WINAPI HTMLDocument7_put_onseekend(IHTMLDocument7 *iface, VARIANT v)
3562 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3563 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3564 return E_NOTIMPL;
3567 static HRESULT WINAPI HTMLDocument7_get_onseekend(IHTMLDocument7 *iface, VARIANT *p)
3569 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3570 FIXME("(%p)->(%p)\n", This, p);
3571 return E_NOTIMPL;
3574 static HRESULT WINAPI HTMLDocument7_put_onseeking(IHTMLDocument7 *iface, VARIANT v)
3576 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3577 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3578 return E_NOTIMPL;
3581 static HRESULT WINAPI HTMLDocument7_get_onseeking(IHTMLDocument7 *iface, VARIANT *p)
3583 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3584 FIXME("(%p)->(%p)\n", This, p);
3585 return E_NOTIMPL;
3588 static HRESULT WINAPI HTMLDocument7_put_onselect(IHTMLDocument7 *iface, VARIANT v)
3590 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3591 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3592 return E_NOTIMPL;
3595 static HRESULT WINAPI HTMLDocument7_get_onselect(IHTMLDocument7 *iface, VARIANT *p)
3597 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3598 FIXME("(%p)->(%p)\n", This, p);
3599 return E_NOTIMPL;
3602 static HRESULT WINAPI HTMLDocument7_put_onstalled(IHTMLDocument7 *iface, VARIANT v)
3604 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3605 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3606 return E_NOTIMPL;
3609 static HRESULT WINAPI HTMLDocument7_get_onstalled(IHTMLDocument7 *iface, VARIANT *p)
3611 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3612 FIXME("(%p)->(%p)\n", This, p);
3613 return E_NOTIMPL;
3616 static HRESULT WINAPI HTMLDocument7_put_onsubmit(IHTMLDocument7 *iface, VARIANT v)
3618 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3619 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3620 return E_NOTIMPL;
3623 static HRESULT WINAPI HTMLDocument7_get_onsubmit(IHTMLDocument7 *iface, VARIANT *p)
3625 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3626 FIXME("(%p)->(%p)\n", This, p);
3627 return E_NOTIMPL;
3630 static HRESULT WINAPI HTMLDocument7_put_onsuspend(IHTMLDocument7 *iface, VARIANT v)
3632 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3633 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3634 return E_NOTIMPL;
3637 static HRESULT WINAPI HTMLDocument7_get_onsuspend(IHTMLDocument7 *iface, VARIANT *p)
3639 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3640 FIXME("(%p)->(%p)\n", This, p);
3641 return E_NOTIMPL;
3644 static HRESULT WINAPI HTMLDocument7_put_ontimeupdate(IHTMLDocument7 *iface, VARIANT v)
3646 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3647 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3648 return E_NOTIMPL;
3651 static HRESULT WINAPI HTMLDocument7_get_ontimeupdate(IHTMLDocument7 *iface, VARIANT *p)
3653 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3654 FIXME("(%p)->(%p)\n", This, p);
3655 return E_NOTIMPL;
3658 static HRESULT WINAPI HTMLDocument7_put_onvolumechange(IHTMLDocument7 *iface, VARIANT v)
3660 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3661 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3662 return E_NOTIMPL;
3665 static HRESULT WINAPI HTMLDocument7_get_onvolumechange(IHTMLDocument7 *iface, VARIANT *p)
3667 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3668 FIXME("(%p)->(%p)\n", This, p);
3669 return E_NOTIMPL;
3672 static HRESULT WINAPI HTMLDocument7_put_onwaiting(IHTMLDocument7 *iface, VARIANT v)
3674 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3675 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3676 return E_NOTIMPL;
3679 static HRESULT WINAPI HTMLDocument7_get_onwaiting(IHTMLDocument7 *iface, VARIANT *p)
3681 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3682 FIXME("(%p)->(%p)\n", This, p);
3683 return E_NOTIMPL;
3686 static HRESULT WINAPI HTMLDocument7_normalize(IHTMLDocument7 *iface)
3688 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3689 FIXME("(%p)\n", This);
3690 return E_NOTIMPL;
3693 static HRESULT WINAPI HTMLDocument7_importNode(IHTMLDocument7 *iface, IHTMLDOMNode *pNodeSource,
3694 VARIANT_BOOL fDeep, IHTMLDOMNode3 **ppNodeDest)
3696 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3697 FIXME("(%p)->(%p %x %p)\n", This, pNodeSource, fDeep, ppNodeDest);
3698 return E_NOTIMPL;
3701 static HRESULT WINAPI HTMLDocument7_get_parentWindow(IHTMLDocument7 *iface, IHTMLWindow2 **p)
3703 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3704 FIXME("(%p)->(%p)\n", This, p);
3705 return E_NOTIMPL;
3708 static HRESULT WINAPI HTMLDocument7_put_body(IHTMLDocument7 *iface, IHTMLElement *v)
3710 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3711 FIXME("(%p)->(%p)\n", This, v);
3712 return E_NOTIMPL;
3715 static HRESULT WINAPI HTMLDocument7_get_body(IHTMLDocument7 *iface, IHTMLElement **p)
3717 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3718 FIXME("(%p)->(%p)\n", This, p);
3719 return E_NOTIMPL;
3722 static HRESULT WINAPI HTMLDocument7_get_head(IHTMLDocument7 *iface, IHTMLElement **p)
3724 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3725 FIXME("(%p)->(%p)\n", This, p);
3726 return E_NOTIMPL;
3729 static const IHTMLDocument7Vtbl HTMLDocument7Vtbl = {
3730 HTMLDocument7_QueryInterface,
3731 HTMLDocument7_AddRef,
3732 HTMLDocument7_Release,
3733 HTMLDocument7_GetTypeInfoCount,
3734 HTMLDocument7_GetTypeInfo,
3735 HTMLDocument7_GetIDsOfNames,
3736 HTMLDocument7_Invoke,
3737 HTMLDocument7_get_defaultView,
3738 HTMLDocument7_createCDATASection,
3739 HTMLDocument7_getSelection,
3740 HTMLDocument7_getElementsByTagNameNS,
3741 HTMLDocument7_createElementNS,
3742 HTMLDocument7_createAttributeNS,
3743 HTMLDocument7_put_onmsthumbnailclick,
3744 HTMLDocument7_get_onmsthumbnailclick,
3745 HTMLDocument7_get_characterSet,
3746 HTMLDocument7_createElement,
3747 HTMLDocument7_createAttribute,
3748 HTMLDocument7_getElementByClassName,
3749 HTMLDocument7_createProcessingInstruction,
3750 HTMLDocument7_adoptNode,
3751 HTMLDocument7_put_onmssitemodejumplistitemremoved,
3752 HTMLDocument7_get_onmssitemodejumplistitemremoved,
3753 HTMLDocument7_get_all,
3754 HTMLDocument7_get_inputEncoding,
3755 HTMLDocument7_get_xmlEncoding,
3756 HTMLDocument7_put_xmlStandalone,
3757 HTMLDocument7_get_xmlStandalone,
3758 HTMLDocument7_put_xmlVersion,
3759 HTMLDocument7_get_xmlVersion,
3760 HTMLDocument7_hasAttributes,
3761 HTMLDocument7_put_onabort,
3762 HTMLDocument7_get_onabort,
3763 HTMLDocument7_put_onblur,
3764 HTMLDocument7_get_onblur,
3765 HTMLDocument7_put_oncanplay,
3766 HTMLDocument7_get_oncanplay,
3767 HTMLDocument7_put_oncanplaythrough,
3768 HTMLDocument7_get_oncanplaythrough,
3769 HTMLDocument7_put_onchange,
3770 HTMLDocument7_get_onchange,
3771 HTMLDocument7_put_ondrag,
3772 HTMLDocument7_get_ondrag,
3773 HTMLDocument7_put_ondragend,
3774 HTMLDocument7_get_ondragend,
3775 HTMLDocument7_put_ondragenter,
3776 HTMLDocument7_get_ondragenter,
3777 HTMLDocument7_put_ondragleave,
3778 HTMLDocument7_get_ondragleave,
3779 HTMLDocument7_put_ondragover,
3780 HTMLDocument7_get_ondragover,
3781 HTMLDocument7_put_ondrop,
3782 HTMLDocument7_get_ondrop,
3783 HTMLDocument7_put_ondurationchange,
3784 HTMLDocument7_get_ondurationchange,
3785 HTMLDocument7_put_onemptied,
3786 HTMLDocument7_get_onemptied,
3787 HTMLDocument7_put_onended,
3788 HTMLDocument7_get_onended,
3789 HTMLDocument7_put_onerror,
3790 HTMLDocument7_get_onerror,
3791 HTMLDocument7_put_onfocus,
3792 HTMLDocument7_get_onfocus,
3793 HTMLDocument7_put_oninput,
3794 HTMLDocument7_get_oninput,
3795 HTMLDocument7_put_onload,
3796 HTMLDocument7_get_onload,
3797 HTMLDocument7_put_onloadeddata,
3798 HTMLDocument7_get_onloadeddata,
3799 HTMLDocument7_put_onloadedmetadata,
3800 HTMLDocument7_get_onloadedmetadata,
3801 HTMLDocument7_put_onloadstart,
3802 HTMLDocument7_get_onloadstart,
3803 HTMLDocument7_put_onpause,
3804 HTMLDocument7_get_onpause,
3805 HTMLDocument7_put_onplay,
3806 HTMLDocument7_get_onplay,
3807 HTMLDocument7_put_onplaying,
3808 HTMLDocument7_get_onplaying,
3809 HTMLDocument7_put_onprogress,
3810 HTMLDocument7_get_onprogress,
3811 HTMLDocument7_put_onratechange,
3812 HTMLDocument7_get_onratechange,
3813 HTMLDocument7_put_onreset,
3814 HTMLDocument7_get_onreset,
3815 HTMLDocument7_put_onscroll,
3816 HTMLDocument7_get_onscroll,
3817 HTMLDocument7_put_onseekend,
3818 HTMLDocument7_get_onseekend,
3819 HTMLDocument7_put_onseeking,
3820 HTMLDocument7_get_onseeking,
3821 HTMLDocument7_put_onselect,
3822 HTMLDocument7_get_onselect,
3823 HTMLDocument7_put_onstalled,
3824 HTMLDocument7_get_onstalled,
3825 HTMLDocument7_put_onsubmit,
3826 HTMLDocument7_get_onsubmit,
3827 HTMLDocument7_put_onsuspend,
3828 HTMLDocument7_get_onsuspend,
3829 HTMLDocument7_put_ontimeupdate,
3830 HTMLDocument7_get_ontimeupdate,
3831 HTMLDocument7_put_onvolumechange,
3832 HTMLDocument7_get_onvolumechange,
3833 HTMLDocument7_put_onwaiting,
3834 HTMLDocument7_get_onwaiting,
3835 HTMLDocument7_normalize,
3836 HTMLDocument7_importNode,
3837 HTMLDocument7_get_parentWindow,
3838 HTMLDocument7_put_body,
3839 HTMLDocument7_get_body,
3840 HTMLDocument7_get_head
3843 static void HTMLDocument_on_advise(IUnknown *iface, cp_static_data_t *cp)
3845 HTMLDocument *This = impl_from_IHTMLDocument2((IHTMLDocument2*)iface);
3847 if(This->window)
3848 update_cp_events(This->window->base.inner_window, &This->doc_node->node.event_target, cp);
3851 static inline HTMLDocument *impl_from_ISupportErrorInfo(ISupportErrorInfo *iface)
3853 return CONTAINING_RECORD(iface, HTMLDocument, ISupportErrorInfo_iface);
3856 static HRESULT WINAPI SupportErrorInfo_QueryInterface(ISupportErrorInfo *iface, REFIID riid, void **ppv)
3858 HTMLDocument *This = impl_from_ISupportErrorInfo(iface);
3859 return htmldoc_query_interface(This, riid, ppv);
3862 static ULONG WINAPI SupportErrorInfo_AddRef(ISupportErrorInfo *iface)
3864 HTMLDocument *This = impl_from_ISupportErrorInfo(iface);
3865 return htmldoc_addref(This);
3868 static ULONG WINAPI SupportErrorInfo_Release(ISupportErrorInfo *iface)
3870 HTMLDocument *This = impl_from_ISupportErrorInfo(iface);
3871 return htmldoc_release(This);
3874 static HRESULT WINAPI SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo *iface, REFIID riid)
3876 FIXME("(%p)->(%s)\n", iface, debugstr_mshtml_guid(riid));
3877 return S_FALSE;
3880 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl = {
3881 SupportErrorInfo_QueryInterface,
3882 SupportErrorInfo_AddRef,
3883 SupportErrorInfo_Release,
3884 SupportErrorInfo_InterfaceSupportsErrorInfo
3887 static inline HTMLDocument *impl_from_IDispatchEx(IDispatchEx *iface)
3889 return CONTAINING_RECORD(iface, HTMLDocument, IDispatchEx_iface);
3892 static HRESULT dispid_from_elem_name(HTMLDocumentNode *This, BSTR name, DISPID *dispid)
3894 nsIDOMNodeList *node_list;
3895 nsAString name_str;
3896 UINT32 len;
3897 unsigned i;
3898 nsresult nsres;
3900 if(!This->nsdoc)
3901 return DISP_E_UNKNOWNNAME;
3903 nsAString_InitDepend(&name_str, name);
3904 nsres = nsIDOMHTMLDocument_GetElementsByName(This->nsdoc, &name_str, &node_list);
3905 nsAString_Finish(&name_str);
3906 if(NS_FAILED(nsres))
3907 return E_FAIL;
3909 nsres = nsIDOMNodeList_GetLength(node_list, &len);
3910 nsIDOMNodeList_Release(node_list);
3911 if(NS_FAILED(nsres))
3912 return E_FAIL;
3914 if(!len)
3915 return DISP_E_UNKNOWNNAME;
3917 for(i=0; i < This->elem_vars_cnt; i++) {
3918 if(!strcmpW(name, This->elem_vars[i])) {
3919 *dispid = MSHTML_DISPID_CUSTOM_MIN+i;
3920 return S_OK;
3924 if(This->elem_vars_cnt == This->elem_vars_size) {
3925 WCHAR **new_vars;
3927 if(This->elem_vars_size) {
3928 new_vars = heap_realloc(This->elem_vars, This->elem_vars_size*2*sizeof(WCHAR*));
3929 if(!new_vars)
3930 return E_OUTOFMEMORY;
3931 This->elem_vars_size *= 2;
3932 }else {
3933 new_vars = heap_alloc(16*sizeof(WCHAR*));
3934 if(!new_vars)
3935 return E_OUTOFMEMORY;
3936 This->elem_vars_size = 16;
3939 This->elem_vars = new_vars;
3942 This->elem_vars[This->elem_vars_cnt] = heap_strdupW(name);
3943 if(!This->elem_vars[This->elem_vars_cnt])
3944 return E_OUTOFMEMORY;
3946 *dispid = MSHTML_DISPID_CUSTOM_MIN+This->elem_vars_cnt++;
3947 return S_OK;
3950 static HRESULT WINAPI DocDispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
3952 HTMLDocument *This = impl_from_IDispatchEx(iface);
3954 return htmldoc_query_interface(This, riid, ppv);
3957 static ULONG WINAPI DocDispatchEx_AddRef(IDispatchEx *iface)
3959 HTMLDocument *This = impl_from_IDispatchEx(iface);
3961 return htmldoc_addref(This);
3964 static ULONG WINAPI DocDispatchEx_Release(IDispatchEx *iface)
3966 HTMLDocument *This = impl_from_IDispatchEx(iface);
3968 return htmldoc_release(This);
3971 static HRESULT WINAPI DocDispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
3973 HTMLDocument *This = impl_from_IDispatchEx(iface);
3975 return IDispatchEx_GetTypeInfoCount(This->dispex, pctinfo);
3978 static HRESULT WINAPI DocDispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
3979 LCID lcid, ITypeInfo **ppTInfo)
3981 HTMLDocument *This = impl_from_IDispatchEx(iface);
3983 return IDispatchEx_GetTypeInfo(This->dispex, iTInfo, lcid, ppTInfo);
3986 static HRESULT WINAPI DocDispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
3987 LPOLESTR *rgszNames, UINT cNames,
3988 LCID lcid, DISPID *rgDispId)
3990 HTMLDocument *This = impl_from_IDispatchEx(iface);
3992 return IDispatchEx_GetIDsOfNames(This->dispex, riid, rgszNames, cNames, lcid, rgDispId);
3995 static HRESULT WINAPI DocDispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
3996 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
3997 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
3999 HTMLDocument *This = impl_from_IDispatchEx(iface);
4001 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
4002 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
4004 switch(dispIdMember) {
4005 case DISPID_READYSTATE:
4006 TRACE("DISPID_READYSTATE\n");
4008 if(!(wFlags & DISPATCH_PROPERTYGET))
4009 return E_INVALIDARG;
4011 V_VT(pVarResult) = VT_I4;
4012 V_I4(pVarResult) = This->window->readystate;
4013 return S_OK;
4016 return IDispatchEx_Invoke(This->dispex, dispIdMember, riid, lcid, wFlags, pDispParams,
4017 pVarResult, pExcepInfo, puArgErr);
4020 static HRESULT WINAPI DocDispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
4022 HTMLDocument *This = impl_from_IDispatchEx(iface);
4023 HRESULT hres;
4025 hres = IDispatchEx_GetDispID(This->dispex, bstrName, grfdex, pid);
4026 if(hres != DISP_E_UNKNOWNNAME)
4027 return hres;
4029 return dispid_from_elem_name(This->doc_node, bstrName, pid);
4032 static HRESULT WINAPI DocDispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
4033 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
4035 HTMLDocument *This = impl_from_IDispatchEx(iface);
4037 if(This->window && id == DISPID_IHTMLDOCUMENT2_LOCATION && (wFlags & DISPATCH_PROPERTYPUT))
4038 return IDispatchEx_InvokeEx(&This->window->base.IDispatchEx_iface, DISPID_IHTMLWINDOW2_LOCATION,
4039 lcid, wFlags, pdp, pvarRes, pei, pspCaller);
4042 return IDispatchEx_InvokeEx(This->dispex, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
4045 static HRESULT WINAPI DocDispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
4047 HTMLDocument *This = impl_from_IDispatchEx(iface);
4049 return IDispatchEx_DeleteMemberByName(This->dispex, bstrName, grfdex);
4052 static HRESULT WINAPI DocDispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
4054 HTMLDocument *This = impl_from_IDispatchEx(iface);
4056 return IDispatchEx_DeleteMemberByDispID(This->dispex, id);
4059 static HRESULT WINAPI DocDispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
4061 HTMLDocument *This = impl_from_IDispatchEx(iface);
4063 return IDispatchEx_GetMemberProperties(This->dispex, id, grfdexFetch, pgrfdex);
4066 static HRESULT WINAPI DocDispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
4068 HTMLDocument *This = impl_from_IDispatchEx(iface);
4070 return IDispatchEx_GetMemberName(This->dispex, id, pbstrName);
4073 static HRESULT WINAPI DocDispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
4075 HTMLDocument *This = impl_from_IDispatchEx(iface);
4077 return IDispatchEx_GetNextDispID(This->dispex, grfdex, id, pid);
4080 static HRESULT WINAPI DocDispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
4082 HTMLDocument *This = impl_from_IDispatchEx(iface);
4084 return IDispatchEx_GetNameSpaceParent(This->dispex, ppunk);
4087 static const IDispatchExVtbl DocDispatchExVtbl = {
4088 DocDispatchEx_QueryInterface,
4089 DocDispatchEx_AddRef,
4090 DocDispatchEx_Release,
4091 DocDispatchEx_GetTypeInfoCount,
4092 DocDispatchEx_GetTypeInfo,
4093 DocDispatchEx_GetIDsOfNames,
4094 DocDispatchEx_Invoke,
4095 DocDispatchEx_GetDispID,
4096 DocDispatchEx_InvokeEx,
4097 DocDispatchEx_DeleteMemberByName,
4098 DocDispatchEx_DeleteMemberByDispID,
4099 DocDispatchEx_GetMemberProperties,
4100 DocDispatchEx_GetMemberName,
4101 DocDispatchEx_GetNextDispID,
4102 DocDispatchEx_GetNameSpaceParent
4105 static inline HTMLDocument *impl_from_IProvideClassInfo(IProvideClassInfo *iface)
4107 return CONTAINING_RECORD(iface, HTMLDocument, IProvideClassInfo_iface);
4110 static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideClassInfo *iface,
4111 REFIID riid, void **ppv)
4113 HTMLDocument *This = impl_from_IProvideClassInfo(iface);
4114 return htmldoc_query_interface(This, riid, ppv);
4117 static ULONG WINAPI ProvideClassInfo_AddRef(IProvideClassInfo *iface)
4119 HTMLDocument *This = impl_from_IProvideClassInfo(iface);
4120 return htmldoc_addref(This);
4123 static ULONG WINAPI ProvideClassInfo_Release(IProvideClassInfo *iface)
4125 HTMLDocument *This = impl_from_IProvideClassInfo(iface);
4126 return htmldoc_release(This);
4129 static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideClassInfo* iface,
4130 ITypeInfo **ppTI)
4132 HTMLDocument *This = impl_from_IProvideClassInfo(iface);
4133 TRACE("(%p)->(%p)\n", This, ppTI);
4134 return get_htmldoc_classinfo(ppTI);
4137 static const IProvideClassInfoVtbl ProvideClassInfoVtbl = {
4138 ProvideClassInfo_QueryInterface,
4139 ProvideClassInfo_AddRef,
4140 ProvideClassInfo_Release,
4141 ProvideClassInfo_GetClassInfo
4144 static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
4146 *ppv = NULL;
4148 if(IsEqualGUID(&IID_IUnknown, riid))
4149 *ppv = &This->IHTMLDocument2_iface;
4150 else if(IsEqualGUID(&IID_IDispatch, riid))
4151 *ppv = &This->IDispatchEx_iface;
4152 else if(IsEqualGUID(&IID_IDispatchEx, riid))
4153 *ppv = &This->IDispatchEx_iface;
4154 else if(IsEqualGUID(&IID_IHTMLDocument, riid))
4155 *ppv = &This->IHTMLDocument2_iface;
4156 else if(IsEqualGUID(&IID_IHTMLDocument2, riid))
4157 *ppv = &This->IHTMLDocument2_iface;
4158 else if(IsEqualGUID(&IID_IHTMLDocument3, riid))
4159 *ppv = &This->IHTMLDocument3_iface;
4160 else if(IsEqualGUID(&IID_IHTMLDocument4, riid))
4161 *ppv = &This->IHTMLDocument4_iface;
4162 else if(IsEqualGUID(&IID_IHTMLDocument5, riid))
4163 *ppv = &This->IHTMLDocument5_iface;
4164 else if(IsEqualGUID(&IID_IHTMLDocument6, riid))
4165 *ppv = &This->IHTMLDocument6_iface;
4166 else if(IsEqualGUID(&IID_IHTMLDocument7, riid))
4167 *ppv = &This->IHTMLDocument7_iface;
4168 else if(IsEqualGUID(&IID_IPersist, riid))
4169 *ppv = &This->IPersistFile_iface;
4170 else if(IsEqualGUID(&IID_IPersistMoniker, riid))
4171 *ppv = &This->IPersistMoniker_iface;
4172 else if(IsEqualGUID(&IID_IPersistFile, riid))
4173 *ppv = &This->IPersistFile_iface;
4174 else if(IsEqualGUID(&IID_IMonikerProp, riid))
4175 *ppv = &This->IMonikerProp_iface;
4176 else if(IsEqualGUID(&IID_IOleObject, riid))
4177 *ppv = &This->IOleObject_iface;
4178 else if(IsEqualGUID(&IID_IOleDocument, riid))
4179 *ppv = &This->IOleDocument_iface;
4180 else if(IsEqualGUID(&IID_IOleDocumentView, riid))
4181 *ppv = &This->IOleDocumentView_iface;
4182 else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid))
4183 *ppv = &This->IOleInPlaceActiveObject_iface;
4184 else if(IsEqualGUID(&IID_IViewObject, riid))
4185 *ppv = &This->IViewObjectEx_iface;
4186 else if(IsEqualGUID(&IID_IViewObject2, riid))
4187 *ppv = &This->IViewObjectEx_iface;
4188 else if(IsEqualGUID(&IID_IViewObjectEx, riid))
4189 *ppv = &This->IViewObjectEx_iface;
4190 else if(IsEqualGUID(&IID_IOleWindow, riid))
4191 *ppv = &This->IOleInPlaceActiveObject_iface;
4192 else if(IsEqualGUID(&IID_IOleInPlaceObject, riid))
4193 *ppv = &This->IOleInPlaceObjectWindowless_iface;
4194 else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid))
4195 *ppv = &This->IOleInPlaceObjectWindowless_iface;
4196 else if(IsEqualGUID(&IID_IServiceProvider, riid))
4197 *ppv = &This->IServiceProvider_iface;
4198 else if(IsEqualGUID(&IID_IOleCommandTarget, riid))
4199 *ppv = &This->IOleCommandTarget_iface;
4200 else if(IsEqualGUID(&IID_IOleControl, riid))
4201 *ppv = &This->IOleControl_iface;
4202 else if(IsEqualGUID(&IID_IHlinkTarget, riid))
4203 *ppv = &This->IHlinkTarget_iface;
4204 else if(IsEqualGUID(&IID_IConnectionPointContainer, riid))
4205 *ppv = &This->cp_container.IConnectionPointContainer_iface;
4206 else if(IsEqualGUID(&IID_IPersistStreamInit, riid))
4207 *ppv = &This->IPersistStreamInit_iface;
4208 else if(IsEqualGUID(&DIID_DispHTMLDocument, riid))
4209 *ppv = &This->IHTMLDocument2_iface;
4210 else if(IsEqualGUID(&IID_ISupportErrorInfo, riid))
4211 *ppv = &This->ISupportErrorInfo_iface;
4212 else if(IsEqualGUID(&IID_IPersistHistory, riid))
4213 *ppv = &This->IPersistHistory_iface;
4214 else if(IsEqualGUID(&IID_IObjectWithSite, riid))
4215 *ppv = &This->IObjectWithSite_iface;
4216 else if(IsEqualGUID(&IID_IOleContainer, riid))
4217 *ppv = &This->IOleContainer_iface;
4218 else if(IsEqualGUID(&IID_IObjectSafety, riid))
4219 *ppv = &This->IObjectSafety_iface;
4220 else if(IsEqualGUID(&IID_IProvideClassInfo, riid))
4221 *ppv = &This->IProvideClassInfo_iface;
4222 else if(IsEqualGUID(&CLSID_CMarkup, riid)) {
4223 FIXME("(%p)->(CLSID_CMarkup %p)\n", This, ppv);
4224 *ppv = NULL;
4225 }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
4226 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
4227 *ppv = NULL;
4228 }else if(IsEqualGUID(&IID_IPersistPropertyBag, riid)) {
4229 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This, ppv);
4230 *ppv = NULL;
4231 }else if(IsEqualGUID(&IID_IMarshal, riid)) {
4232 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppv);
4233 *ppv = NULL;
4234 }else if(IsEqualGUID(&IID_IExternalConnection, riid)) {
4235 TRACE("(%p)->(IID_IExternalConnection %p) returning NULL\n", This, ppv);
4236 *ppv = NULL;
4237 }else if(IsEqualGUID(&IID_IStdMarshalInfo, riid)) {
4238 TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This, ppv);
4239 *ppv = NULL;
4240 }else {
4241 return FALSE;
4244 if(*ppv)
4245 IUnknown_AddRef((IUnknown*)*ppv);
4246 return TRUE;
4249 static cp_static_data_t HTMLDocumentEvents_data = { HTMLDocumentEvents_tid, HTMLDocument_on_advise };
4251 static const cpc_entry_t HTMLDocument_cpc[] = {
4252 {&IID_IDispatch, &HTMLDocumentEvents_data},
4253 {&IID_IPropertyNotifySink},
4254 {&DIID_HTMLDocumentEvents, &HTMLDocumentEvents_data},
4255 {&DIID_HTMLDocumentEvents2},
4256 {NULL}
4259 static void init_doc(HTMLDocument *doc, IUnknown *unk_impl, IDispatchEx *dispex)
4261 doc->IHTMLDocument2_iface.lpVtbl = &HTMLDocumentVtbl;
4262 doc->IHTMLDocument3_iface.lpVtbl = &HTMLDocument3Vtbl;
4263 doc->IHTMLDocument4_iface.lpVtbl = &HTMLDocument4Vtbl;
4264 doc->IHTMLDocument5_iface.lpVtbl = &HTMLDocument5Vtbl;
4265 doc->IHTMLDocument6_iface.lpVtbl = &HTMLDocument6Vtbl;
4266 doc->IHTMLDocument7_iface.lpVtbl = &HTMLDocument7Vtbl;
4267 doc->IDispatchEx_iface.lpVtbl = &DocDispatchExVtbl;
4268 doc->ISupportErrorInfo_iface.lpVtbl = &SupportErrorInfoVtbl;
4269 doc->IProvideClassInfo_iface.lpVtbl = &ProvideClassInfoVtbl;
4271 doc->unk_impl = unk_impl;
4272 doc->dispex = dispex;
4273 doc->task_magic = get_task_target_magic();
4275 HTMLDocument_Persist_Init(doc);
4276 HTMLDocument_OleCmd_Init(doc);
4277 HTMLDocument_OleObj_Init(doc);
4278 HTMLDocument_View_Init(doc);
4279 HTMLDocument_Window_Init(doc);
4280 HTMLDocument_Service_Init(doc);
4281 HTMLDocument_Hlink_Init(doc);
4283 ConnectionPointContainer_Init(&doc->cp_container, (IUnknown*)&doc->IHTMLDocument2_iface, HTMLDocument_cpc);
4286 static void destroy_htmldoc(HTMLDocument *This)
4288 remove_target_tasks(This->task_magic);
4290 ConnectionPointContainer_Destroy(&This->cp_container);
4293 static inline HTMLDocumentNode *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
4295 return CONTAINING_RECORD(iface, HTMLDocumentNode, node);
4298 static HRESULT HTMLDocumentNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
4300 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4302 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
4304 if(htmldoc_qi(&This->basedoc, riid, ppv))
4305 return *ppv ? S_OK : E_NOINTERFACE;
4307 if(IsEqualGUID(&IID_IInternetHostSecurityManager, riid))
4308 *ppv = &This->IInternetHostSecurityManager_iface;
4309 else
4310 return HTMLDOMNode_QI(&This->node, riid, ppv);
4312 IUnknown_AddRef((IUnknown*)*ppv);
4313 return S_OK;
4316 static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
4318 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4319 unsigned i;
4321 for(i=0; i < This->elem_vars_cnt; i++)
4322 heap_free(This->elem_vars[i]);
4323 heap_free(This->elem_vars);
4325 detach_events(This);
4326 if(This->body_event_target)
4327 release_event_target(This->body_event_target);
4328 if(This->catmgr)
4329 ICatInformation_Release(This->catmgr);
4331 detach_selection(This);
4332 detach_ranges(This);
4334 while(!list_empty(&This->plugin_hosts))
4335 detach_plugin_host(LIST_ENTRY(list_head(&This->plugin_hosts), PluginHost, entry));
4337 if(This->nsnode_selector) {
4338 nsIDOMNodeSelector_Release(This->nsnode_selector);
4339 This->nsnode_selector = NULL;
4342 if(!This->nsdoc && This->window) {
4343 /* document fragments own reference to inner window */
4344 IHTMLWindow2_Release(&This->window->base.IHTMLWindow2_iface);
4345 This->window = NULL;
4348 heap_free(This->event_vector);
4349 destroy_htmldoc(&This->basedoc);
4352 static HRESULT HTMLDocumentNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
4354 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4355 FIXME("%p\n", This);
4356 return E_NOTIMPL;
4359 static void HTMLDocumentNode_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
4361 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4363 if(This->nsnode_selector)
4364 note_cc_edge((nsISupports*)This->nsnode_selector, "This->nsnode_selector", cb);
4365 if(This->nsdoc)
4366 note_cc_edge((nsISupports*)This->nsdoc, "This->nsdoc", cb);
4369 static void HTMLDocumentNode_unlink(HTMLDOMNode *iface)
4371 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4373 if(This->nsnode_selector) {
4374 nsIDOMNodeSelector_Release(This->nsnode_selector);
4375 This->nsnode_selector = NULL;
4378 if(This->nsdoc) {
4379 nsIDOMHTMLDocument *nsdoc = This->nsdoc;
4381 release_document_mutation(This);
4382 This->nsdoc = NULL;
4383 nsIDOMHTMLDocument_Release(nsdoc);
4384 This->window = NULL;
4388 static const NodeImplVtbl HTMLDocumentNodeImplVtbl = {
4389 HTMLDocumentNode_QI,
4390 HTMLDocumentNode_destructor,
4391 HTMLDocument_cpc,
4392 HTMLDocumentNode_clone,
4393 NULL,
4394 NULL,
4395 NULL,
4396 NULL,
4397 NULL,
4398 NULL,
4399 NULL,
4400 NULL,
4401 NULL,
4402 NULL,
4403 NULL,
4404 HTMLDocumentNode_traverse,
4405 HTMLDocumentNode_unlink
4408 static HRESULT HTMLDocumentFragment_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
4410 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4411 HTMLDocumentNode *new_node;
4412 HRESULT hres;
4414 hres = create_document_fragment(nsnode, This->node.doc, &new_node);
4415 if(FAILED(hres))
4416 return hres;
4418 *ret = &new_node->node;
4419 return S_OK;
4422 static inline HTMLDocumentNode *impl_from_DispatchEx(DispatchEx *iface)
4424 return CONTAINING_RECORD(iface, HTMLDocumentNode, node.dispex);
4427 static HRESULT HTMLDocumentNode_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
4428 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
4430 HTMLDocumentNode *This = impl_from_DispatchEx(dispex);
4431 nsIDOMNodeList *node_list;
4432 nsAString name_str;
4433 nsIDOMNode *nsnode;
4434 HTMLDOMNode *node;
4435 unsigned i;
4436 nsresult nsres;
4437 HRESULT hres;
4439 if(flags != DISPATCH_PROPERTYGET && flags != (DISPATCH_METHOD|DISPATCH_PROPERTYGET)) {
4440 FIXME("unsupported flags %x\n", flags);
4441 return E_NOTIMPL;
4444 i = id - MSHTML_DISPID_CUSTOM_MIN;
4446 if(!This->nsdoc || i >= This->elem_vars_cnt)
4447 return DISP_E_UNKNOWNNAME;
4449 nsAString_InitDepend(&name_str, This->elem_vars[i]);
4450 nsres = nsIDOMHTMLDocument_GetElementsByName(This->nsdoc, &name_str, &node_list);
4451 nsAString_Finish(&name_str);
4452 if(NS_FAILED(nsres))
4453 return E_FAIL;
4455 nsres = nsIDOMNodeList_Item(node_list, 0, &nsnode);
4456 nsIDOMNodeList_Release(node_list);
4457 if(NS_FAILED(nsres) || !nsnode)
4458 return DISP_E_UNKNOWNNAME;
4460 hres = get_node(This, nsnode, TRUE, &node);
4461 if(FAILED(hres))
4462 return hres;
4464 V_VT(res) = VT_DISPATCH;
4465 V_DISPATCH(res) = (IDispatch*)&node->IHTMLDOMNode_iface;
4466 return S_OK;
4470 static const dispex_static_data_vtbl_t HTMLDocumentNode_dispex_vtbl = {
4471 NULL,
4472 NULL,
4473 HTMLDocumentNode_invoke,
4474 NULL
4477 static const NodeImplVtbl HTMLDocumentFragmentImplVtbl = {
4478 HTMLDocumentNode_QI,
4479 HTMLDocumentNode_destructor,
4480 HTMLDocument_cpc,
4481 HTMLDocumentFragment_clone
4484 static const tid_t HTMLDocumentNode_iface_tids[] = {
4485 IHTMLDOMNode_tid,
4486 IHTMLDOMNode2_tid,
4487 IHTMLDocument2_tid,
4488 IHTMLDocument3_tid,
4489 IHTMLDocument4_tid,
4490 IHTMLDocument5_tid,
4494 static dispex_static_data_t HTMLDocumentNode_dispex = {
4495 &HTMLDocumentNode_dispex_vtbl,
4496 DispHTMLDocument_tid,
4497 NULL,
4498 HTMLDocumentNode_iface_tids
4501 static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindow *window)
4503 HTMLDocumentNode *doc;
4505 doc = heap_alloc_zero(sizeof(HTMLDocumentNode));
4506 if(!doc)
4507 return NULL;
4509 doc->ref = 1;
4510 doc->basedoc.doc_node = doc;
4511 doc->basedoc.doc_obj = doc_obj;
4512 doc->basedoc.window = window->base.outer_window;
4513 doc->window = window;
4515 init_dispex(&doc->node.dispex, (IUnknown*)&doc->node.IHTMLDOMNode_iface,
4516 &HTMLDocumentNode_dispex);
4517 init_doc(&doc->basedoc, (IUnknown*)&doc->node.IHTMLDOMNode_iface,
4518 &doc->node.dispex.IDispatchEx_iface);
4519 HTMLDocumentNode_SecMgr_Init(doc);
4521 list_init(&doc->selection_list);
4522 list_init(&doc->range_list);
4523 list_init(&doc->plugin_hosts);
4525 return doc;
4528 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_obj, HTMLInnerWindow *window, HTMLDocumentNode **ret)
4530 HTMLDocumentNode *doc;
4531 nsresult nsres;
4533 doc = alloc_doc_node(doc_obj, window);
4534 if(!doc)
4535 return E_OUTOFMEMORY;
4537 if(!doc_obj->basedoc.window || window->base.outer_window == doc_obj->basedoc.window)
4538 doc->basedoc.cp_container.forward_container = &doc_obj->basedoc.cp_container;
4540 HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc);
4542 nsIDOMHTMLDocument_AddRef(nsdoc);
4543 doc->nsdoc = nsdoc;
4545 nsres = nsIDOMHTMLDocument_QueryInterface(nsdoc, &IID_nsIDOMNodeSelector, (void**)&doc->nsnode_selector);
4546 assert(nsres == NS_OK);
4548 init_document_mutation(doc);
4549 doc_init_events(doc);
4551 doc->node.vtbl = &HTMLDocumentNodeImplVtbl;
4552 doc->node.cp_container = &doc->basedoc.cp_container;
4554 *ret = doc;
4555 return S_OK;
4558 HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *doc_node, HTMLDocumentNode **ret)
4560 HTMLDocumentNode *doc_frag;
4562 doc_frag = alloc_doc_node(doc_node->basedoc.doc_obj, doc_node->window);
4563 if(!doc_frag)
4564 return E_OUTOFMEMORY;
4566 IHTMLWindow2_AddRef(&doc_frag->window->base.IHTMLWindow2_iface);
4568 HTMLDOMNode_Init(doc_node, &doc_frag->node, nsnode);
4569 doc_frag->node.vtbl = &HTMLDocumentFragmentImplVtbl;
4570 doc_frag->node.cp_container = &doc_frag->basedoc.cp_container;
4572 *ret = doc_frag;
4573 return S_OK;
4576 /**********************************************************
4577 * ICustomDoc implementation
4580 static inline HTMLDocumentObj *impl_from_ICustomDoc(ICustomDoc *iface)
4582 return CONTAINING_RECORD(iface, HTMLDocumentObj, ICustomDoc_iface);
4585 static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, void **ppv)
4587 HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
4589 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
4591 if(htmldoc_qi(&This->basedoc, riid, ppv))
4592 return *ppv ? S_OK : E_NOINTERFACE;
4594 if(IsEqualGUID(&IID_ICustomDoc, riid)) {
4595 *ppv = &This->ICustomDoc_iface;
4596 }else if(IsEqualGUID(&IID_ITargetContainer, riid)) {
4597 *ppv = &This->ITargetContainer_iface;
4598 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
4599 return *ppv ? S_OK : E_NOINTERFACE;
4600 }else {
4601 FIXME("Unimplemented interface %s\n", debugstr_mshtml_guid(riid));
4602 *ppv = NULL;
4603 return E_NOINTERFACE;
4606 IUnknown_AddRef((IUnknown*)*ppv);
4607 return S_OK;
4610 static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface)
4612 HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
4613 ULONG ref = InterlockedIncrement(&This->ref);
4615 TRACE("(%p) ref = %u\n", This, ref);
4617 return ref;
4620 static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
4622 HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
4623 ULONG ref = InterlockedDecrement(&This->ref);
4625 TRACE("(%p) ref = %u\n", This, ref);
4627 if(!ref) {
4628 nsIDOMWindowUtils *window_utils = NULL;
4630 if(This->basedoc.window && This->basedoc.window->nswindow)
4631 get_nsinterface((nsISupports*)This->basedoc.window->nswindow, &IID_nsIDOMWindowUtils, (void**)&window_utils);
4633 if(This->basedoc.doc_node) {
4634 This->basedoc.doc_node->basedoc.doc_obj = NULL;
4635 htmldoc_release(&This->basedoc.doc_node->basedoc);
4637 if(This->basedoc.window) {
4638 This->basedoc.window->doc_obj = NULL;
4639 IHTMLWindow2_Release(&This->basedoc.window->base.IHTMLWindow2_iface);
4641 if(This->basedoc.advise_holder)
4642 IOleAdviseHolder_Release(This->basedoc.advise_holder);
4644 if(This->view_sink)
4645 IAdviseSink_Release(This->view_sink);
4646 if(This->client)
4647 IOleObject_SetClientSite(&This->basedoc.IOleObject_iface, NULL);
4648 if(This->hostui)
4649 ICustomDoc_SetUIHandler(&This->ICustomDoc_iface, NULL);
4650 if(This->in_place_active)
4651 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->basedoc.IOleInPlaceObjectWindowless_iface);
4652 if(This->ipsite)
4653 IOleDocumentView_SetInPlaceSite(&This->basedoc.IOleDocumentView_iface, NULL);
4654 if(This->undomgr)
4655 IOleUndoManager_Release(This->undomgr);
4656 if(This->tooltips_hwnd)
4657 DestroyWindow(This->tooltips_hwnd);
4659 if(This->hwnd)
4660 DestroyWindow(This->hwnd);
4661 heap_free(This->mime);
4663 destroy_htmldoc(&This->basedoc);
4664 release_dispex(&This->dispex);
4666 if(This->nscontainer)
4667 NSContainer_Release(This->nscontainer);
4668 heap_free(This);
4670 /* Force cycle collection */
4671 if(window_utils) {
4672 nsIDOMWindowUtils_CycleCollect(window_utils, NULL, 0);
4673 nsIDOMWindowUtils_Release(window_utils);
4677 return ref;
4680 static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler)
4682 HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
4683 IOleCommandTarget *cmdtrg;
4684 HRESULT hres;
4686 TRACE("(%p)->(%p)\n", This, pUIHandler);
4688 if(This->custom_hostui && This->hostui == pUIHandler)
4689 return S_OK;
4691 This->custom_hostui = TRUE;
4693 if(This->hostui)
4694 IDocHostUIHandler_Release(This->hostui);
4695 if(pUIHandler)
4696 IDocHostUIHandler_AddRef(pUIHandler);
4697 This->hostui = pUIHandler;
4698 if(!pUIHandler)
4699 return S_OK;
4701 hres = IDocHostUIHandler_QueryInterface(pUIHandler, &IID_IOleCommandTarget, (void**)&cmdtrg);
4702 if(SUCCEEDED(hres)) {
4703 FIXME("custom UI handler supports IOleCommandTarget\n");
4704 IOleCommandTarget_Release(cmdtrg);
4707 return S_OK;
4710 static const ICustomDocVtbl CustomDocVtbl = {
4711 CustomDoc_QueryInterface,
4712 CustomDoc_AddRef,
4713 CustomDoc_Release,
4714 CustomDoc_SetUIHandler
4717 static const tid_t HTMLDocumentObj_iface_tids[] = {
4718 IHTMLDocument2_tid,
4719 IHTMLDocument3_tid,
4720 IHTMLDocument4_tid,
4721 IHTMLDocument5_tid,
4724 static dispex_static_data_t HTMLDocumentObj_dispex = {
4725 NULL,
4726 DispHTMLDocument_tid,
4727 NULL,
4728 HTMLDocumentObj_iface_tids
4731 HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
4733 HTMLDocumentObj *doc;
4734 nsIDOMWindow *nswindow = NULL;
4735 nsresult nsres;
4736 HRESULT hres;
4738 TRACE("(%p %s %p)\n", pUnkOuter, debugstr_mshtml_guid(riid), ppvObject);
4740 doc = heap_alloc_zero(sizeof(HTMLDocumentObj));
4741 if(!doc)
4742 return E_OUTOFMEMORY;
4744 init_dispex(&doc->dispex, (IUnknown*)&doc->ICustomDoc_iface, &HTMLDocumentObj_dispex);
4745 init_doc(&doc->basedoc, (IUnknown*)&doc->ICustomDoc_iface, &doc->dispex.IDispatchEx_iface);
4746 TargetContainer_Init(doc);
4748 doc->ICustomDoc_iface.lpVtbl = &CustomDocVtbl;
4749 doc->ref = 1;
4750 doc->basedoc.doc_obj = doc;
4752 doc->usermode = UNKNOWN_USERMODE;
4754 init_binding_ui(doc);
4756 hres = create_nscontainer(doc, &doc->nscontainer);
4757 if(FAILED(hres)) {
4758 ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n");
4759 htmldoc_release(&doc->basedoc);
4760 return hres;
4763 hres = htmldoc_query_interface(&doc->basedoc, riid, ppvObject);
4764 htmldoc_release(&doc->basedoc);
4765 if(FAILED(hres))
4766 return hres;
4768 nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &nswindow);
4769 if(NS_FAILED(nsres))
4770 ERR("GetContentDOMWindow failed: %08x\n", nsres);
4772 hres = HTMLOuterWindow_Create(doc, nswindow, NULL /* FIXME */, &doc->basedoc.window);
4773 if(nswindow)
4774 nsIDOMWindow_Release(nswindow);
4775 if(FAILED(hres)) {
4776 htmldoc_release(&doc->basedoc);
4777 return hres;
4780 if(!doc->basedoc.doc_node && doc->basedoc.window->base.inner_window->doc) {
4781 doc->basedoc.doc_node = doc->basedoc.window->base.inner_window->doc;
4782 htmldoc_addref(&doc->basedoc.doc_node->basedoc);
4785 get_thread_hwnd();
4787 return S_OK;