dwrite: Implement CreateFontFaceFromHdc().
[wine.git] / dlls / mshtml / htmldoc.c
blob0324a6fb11e1e9fd78895f5ef0c4c65839fc3ecb
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);
596 TRACE("(%p)->(%p)\n", iface, p);
598 if(!p)
599 return E_POINTER;
601 return get_readystate_string(This->window->readystate, p);
604 static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p)
606 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
608 TRACE("(%p)->(%p)\n", This, p);
610 return IHTMLWindow2_get_frames(&This->window->base.IHTMLWindow2_iface, p);
613 static HRESULT WINAPI HTMLDocument_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p)
615 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
616 FIXME("(%p)->(%p)\n", This, p);
617 return E_NOTIMPL;
620 static HRESULT WINAPI HTMLDocument_get_plugins(IHTMLDocument2 *iface, IHTMLElementCollection **p)
622 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
623 FIXME("(%p)->(%p)\n", This, p);
624 return E_NOTIMPL;
627 static HRESULT WINAPI HTMLDocument_put_alinkColor(IHTMLDocument2 *iface, VARIANT v)
629 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
630 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
631 return E_NOTIMPL;
634 static HRESULT WINAPI HTMLDocument_get_alinkColor(IHTMLDocument2 *iface, VARIANT *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_bgColor(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_bgColor(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_fgColor(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_fgColor(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_linkColor(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_linkColor(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_vlinkColor(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_vlinkColor(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_get_referrer(IHTMLDocument2 *iface, BSTR *p)
699 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
701 FIXME("(%p)->(%p)\n", This, p);
703 *p = NULL;
704 return S_OK;
707 static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p)
709 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
711 TRACE("(%p)->(%p)\n", This, p);
713 if(!This->doc_node->nsdoc) {
714 WARN("NULL nsdoc\n");
715 return E_UNEXPECTED;
718 return IHTMLWindow2_get_location(&This->window->base.IHTMLWindow2_iface, p);
721 static HRESULT WINAPI HTMLDocument_get_lastModified(IHTMLDocument2 *iface, BSTR *p)
723 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
724 FIXME("(%p)->(%p)\n", This, p);
725 return E_NOTIMPL;
728 static HRESULT WINAPI HTMLDocument_put_URL(IHTMLDocument2 *iface, BSTR v)
730 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
732 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
734 if(!This->window) {
735 FIXME("No window available\n");
736 return E_FAIL;
739 return navigate_url(This->window, v, This->window->uri, BINDING_NAVIGATED);
742 static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
744 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
746 static const WCHAR about_blank_url[] =
747 {'a','b','o','u','t',':','b','l','a','n','k',0};
749 TRACE("(%p)->(%p)\n", iface, p);
751 *p = SysAllocString(This->window->url ? This->window->url : about_blank_url);
752 return *p ? S_OK : E_OUTOFMEMORY;
755 static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
757 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
758 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
759 return E_NOTIMPL;
762 static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
764 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
765 HRESULT hres;
767 TRACE("(%p)->(%p)\n", This, p);
769 if(!This->window || !This->window->uri) {
770 FIXME("No current URI\n");
771 return E_FAIL;
774 hres = IUri_GetHost(This->window->uri, p);
775 return FAILED(hres) ? hres : S_OK;
778 static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v)
780 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
781 BOOL bret;
783 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
785 bret = InternetSetCookieExW(This->window->url, NULL, v, 0, 0);
786 if(!bret) {
787 FIXME("InternetSetCookieExW failed: %u\n", GetLastError());
788 return HRESULT_FROM_WIN32(GetLastError());
791 return S_OK;
794 static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p)
796 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
797 DWORD size;
798 BOOL bret;
800 TRACE("(%p)->(%p)\n", This, p);
802 size = 0;
803 bret = InternetGetCookieExW(This->window->url, NULL, NULL, &size, 0, NULL);
804 if(!bret) {
805 switch(GetLastError()) {
806 case ERROR_INSUFFICIENT_BUFFER:
807 break;
808 case ERROR_NO_MORE_ITEMS:
809 *p = NULL;
810 return S_OK;
811 default:
812 FIXME("InternetGetCookieExW failed: %u\n", GetLastError());
813 return HRESULT_FROM_WIN32(GetLastError());
817 if(!size) {
818 *p = NULL;
819 return S_OK;
822 *p = SysAllocStringLen(NULL, size/sizeof(WCHAR)-1);
823 if(!*p)
824 return E_OUTOFMEMORY;
826 bret = InternetGetCookieExW(This->window->url, NULL, *p, &size, 0, NULL);
827 if(!bret) {
828 ERR("InternetGetCookieExW failed: %u\n", GetLastError());
829 return E_FAIL;
832 return S_OK;
835 static HRESULT WINAPI HTMLDocument_put_expando(IHTMLDocument2 *iface, VARIANT_BOOL v)
837 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
838 FIXME("(%p)->(%x)\n", This, v);
839 return E_NOTIMPL;
842 static HRESULT WINAPI HTMLDocument_get_expando(IHTMLDocument2 *iface, VARIANT_BOOL *p)
844 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
845 FIXME("(%p)->(%p)\n", This, p);
846 return E_NOTIMPL;
849 static HRESULT WINAPI HTMLDocument_put_charset(IHTMLDocument2 *iface, BSTR v)
851 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
852 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
853 return E_NOTIMPL;
856 static HRESULT WINAPI HTMLDocument_get_charset(IHTMLDocument2 *iface, BSTR *p)
858 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
859 nsAString charset_str;
860 nsresult nsres;
862 TRACE("(%p)->(%p)\n", This, p);
864 if(!This->doc_node->nsdoc) {
865 FIXME("NULL nsdoc\n");
866 return E_FAIL;
869 nsAString_Init(&charset_str, NULL);
870 nsres = nsIDOMHTMLDocument_GetCharacterSet(This->doc_node->nsdoc, &charset_str);
871 return return_nsstr(nsres, &charset_str, p);
874 static HRESULT WINAPI HTMLDocument_put_defaultCharset(IHTMLDocument2 *iface, BSTR v)
876 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
877 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
878 return E_NOTIMPL;
881 static HRESULT WINAPI HTMLDocument_get_defaultCharset(IHTMLDocument2 *iface, BSTR *p)
883 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
884 FIXME("(%p)->(%p)\n", This, p);
885 return E_NOTIMPL;
888 static HRESULT WINAPI HTMLDocument_get_mimeType(IHTMLDocument2 *iface, BSTR *p)
890 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
891 FIXME("(%p)->(%p)\n", This, p);
892 return E_NOTIMPL;
895 static HRESULT WINAPI HTMLDocument_get_fileSize(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_fileCreatedDate(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_fileModifiedDate(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_fileUpdatedDate(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_security(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_protocol(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_nameProp(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 document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
946 VARIANT *var, tmp;
947 JSContext *jsctx;
948 nsAString nsstr;
949 ULONG i, argc;
950 nsresult nsres;
951 HRESULT hres;
953 if(!This->doc_node->nsdoc) {
954 WARN("NULL nsdoc\n");
955 return E_UNEXPECTED;
958 if (!psarray)
959 return S_OK;
961 if(psarray->cDims != 1) {
962 FIXME("cDims=%d\n", psarray->cDims);
963 return E_INVALIDARG;
966 hres = SafeArrayAccessData(psarray, (void**)&var);
967 if(FAILED(hres)) {
968 WARN("SafeArrayAccessData failed: %08x\n", hres);
969 return hres;
972 V_VT(&tmp) = VT_EMPTY;
974 jsctx = get_context_from_document(This->doc_node->nsdoc);
975 argc = psarray->rgsabound[0].cElements;
976 for(i=0; i < argc; i++) {
977 if(V_VT(var+i) == VT_BSTR) {
978 nsAString_InitDepend(&nsstr, V_BSTR(var+i));
979 }else {
980 hres = VariantChangeTypeEx(&tmp, var+i, MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, VT_BSTR);
981 if(FAILED(hres)) {
982 WARN("Could not convert %s to string\n", debugstr_variant(var+i));
983 break;
985 nsAString_InitDepend(&nsstr, V_BSTR(&tmp));
988 if(!ln || i != argc-1)
989 nsres = nsIDOMHTMLDocument_Write(This->doc_node->nsdoc, &nsstr, jsctx);
990 else
991 nsres = nsIDOMHTMLDocument_Writeln(This->doc_node->nsdoc, &nsstr, jsctx);
992 nsAString_Finish(&nsstr);
993 if(V_VT(var+i) != VT_BSTR)
994 VariantClear(&tmp);
995 if(NS_FAILED(nsres)) {
996 ERR("Write failed: %08x\n", nsres);
997 hres = E_FAIL;
998 break;
1002 SafeArrayUnaccessData(psarray);
1004 return hres;
1007 static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray)
1009 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1011 TRACE("(%p)->(%p)\n", iface, psarray);
1013 return document_write(This, psarray, FALSE);
1016 static HRESULT WINAPI HTMLDocument_writeln(IHTMLDocument2 *iface, SAFEARRAY *psarray)
1018 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1020 TRACE("(%p)->(%p)\n", This, psarray);
1022 return document_write(This, psarray, TRUE);
1025 static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT name,
1026 VARIANT features, VARIANT replace, IDispatch **pomWindowResult)
1028 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1029 nsISupports *tmp;
1030 nsresult nsres;
1032 static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0};
1034 TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_w(url), debugstr_variant(&name),
1035 debugstr_variant(&features), debugstr_variant(&replace), pomWindowResult);
1037 if(!This->doc_node->nsdoc) {
1038 ERR("!nsdoc\n");
1039 return E_NOTIMPL;
1042 if(!url || strcmpW(url, text_htmlW) || V_VT(&name) != VT_ERROR
1043 || V_VT(&features) != VT_ERROR || V_VT(&replace) != VT_ERROR)
1044 FIXME("unsupported args\n");
1046 nsres = nsIDOMHTMLDocument_Open(This->doc_node->nsdoc, NULL, NULL, NULL,
1047 get_context_from_document(This->doc_node->nsdoc), 0, &tmp);
1048 if(NS_FAILED(nsres)) {
1049 ERR("Open failed: %08x\n", nsres);
1050 return E_FAIL;
1053 if(tmp)
1054 nsISupports_Release(tmp);
1056 *pomWindowResult = (IDispatch*)&This->window->base.IHTMLWindow2_iface;
1057 IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface);
1058 return S_OK;
1061 static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface)
1063 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1064 nsresult nsres;
1066 TRACE("(%p)\n", This);
1068 if(!This->doc_node->nsdoc) {
1069 ERR("!nsdoc\n");
1070 return E_NOTIMPL;
1073 nsres = nsIDOMHTMLDocument_Close(This->doc_node->nsdoc);
1074 if(NS_FAILED(nsres)) {
1075 ERR("Close failed: %08x\n", nsres);
1076 return E_FAIL;
1079 return S_OK;
1082 static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface)
1084 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1085 nsresult nsres;
1087 TRACE("(%p)\n", This);
1089 nsres = nsIDOMHTMLDocument_Clear(This->doc_node->nsdoc);
1090 if(NS_FAILED(nsres)) {
1091 ERR("Clear failed: %08x\n", nsres);
1092 return E_FAIL;
1095 return S_OK;
1098 static HRESULT WINAPI HTMLDocument_queryCommandSupported(IHTMLDocument2 *iface, BSTR cmdID,
1099 VARIANT_BOOL *pfRet)
1101 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1102 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1103 return E_NOTIMPL;
1106 static HRESULT WINAPI HTMLDocument_queryCommandEnabled(IHTMLDocument2 *iface, BSTR cmdID,
1107 VARIANT_BOOL *pfRet)
1109 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1110 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1111 return E_NOTIMPL;
1114 static HRESULT WINAPI HTMLDocument_queryCommandState(IHTMLDocument2 *iface, BSTR cmdID,
1115 VARIANT_BOOL *pfRet)
1117 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1118 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1119 return E_NOTIMPL;
1122 static HRESULT WINAPI HTMLDocument_queryCommandIndeterm(IHTMLDocument2 *iface, BSTR cmdID,
1123 VARIANT_BOOL *pfRet)
1125 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1126 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1127 return E_NOTIMPL;
1130 static HRESULT WINAPI HTMLDocument_queryCommandText(IHTMLDocument2 *iface, BSTR cmdID,
1131 BSTR *pfRet)
1133 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1134 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1135 return E_NOTIMPL;
1138 static HRESULT WINAPI HTMLDocument_queryCommandValue(IHTMLDocument2 *iface, BSTR cmdID,
1139 VARIANT *pfRet)
1141 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1142 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1143 return E_NOTIMPL;
1146 static HRESULT WINAPI HTMLDocument_execCommand(IHTMLDocument2 *iface, BSTR cmdID,
1147 VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL *pfRet)
1149 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1150 FIXME("(%p)->(%s %x %s %p)\n", This, debugstr_w(cmdID), showUI, debugstr_variant(&value), pfRet);
1151 return E_NOTIMPL;
1154 static HRESULT WINAPI HTMLDocument_execCommandShowHelp(IHTMLDocument2 *iface, BSTR cmdID,
1155 VARIANT_BOOL *pfRet)
1157 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1158 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1159 return E_NOTIMPL;
1162 static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTag,
1163 IHTMLElement **newElem)
1165 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1166 HTMLElement *elem;
1167 HRESULT hres;
1169 TRACE("(%p)->(%s %p)\n", This, debugstr_w(eTag), newElem);
1171 hres = create_element(This->doc_node, eTag, &elem);
1172 if(FAILED(hres))
1173 return hres;
1175 *newElem = &elem->IHTMLElement_iface;
1176 return S_OK;
1179 static HRESULT WINAPI HTMLDocument_put_onhelp(IHTMLDocument2 *iface, VARIANT v)
1181 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1182 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1183 return E_NOTIMPL;
1186 static HRESULT WINAPI HTMLDocument_get_onhelp(IHTMLDocument2 *iface, VARIANT *p)
1188 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1189 FIXME("(%p)->(%p)\n", This, p);
1190 return E_NOTIMPL;
1193 static HRESULT WINAPI HTMLDocument_put_onclick(IHTMLDocument2 *iface, VARIANT v)
1195 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1197 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1199 return set_doc_event(This, EVENTID_CLICK, &v);
1202 static HRESULT WINAPI HTMLDocument_get_onclick(IHTMLDocument2 *iface, VARIANT *p)
1204 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1206 TRACE("(%p)->(%p)\n", This, p);
1208 return get_doc_event(This, EVENTID_CLICK, p);
1211 static HRESULT WINAPI HTMLDocument_put_ondblclick(IHTMLDocument2 *iface, VARIANT v)
1213 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1214 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1215 return E_NOTIMPL;
1218 static HRESULT WINAPI HTMLDocument_get_ondblclick(IHTMLDocument2 *iface, VARIANT *p)
1220 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1221 FIXME("(%p)->(%p)\n", This, p);
1222 return E_NOTIMPL;
1225 static HRESULT WINAPI HTMLDocument_put_onkeyup(IHTMLDocument2 *iface, VARIANT v)
1227 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1229 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1231 return set_doc_event(This, EVENTID_KEYUP, &v);
1234 static HRESULT WINAPI HTMLDocument_get_onkeyup(IHTMLDocument2 *iface, VARIANT *p)
1236 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1238 TRACE("(%p)->(%p)\n", This, p);
1240 return get_doc_event(This, EVENTID_KEYUP, p);
1243 static HRESULT WINAPI HTMLDocument_put_onkeydown(IHTMLDocument2 *iface, VARIANT v)
1245 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1247 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1249 return set_doc_event(This, EVENTID_KEYDOWN, &v);
1252 static HRESULT WINAPI HTMLDocument_get_onkeydown(IHTMLDocument2 *iface, VARIANT *p)
1254 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1256 TRACE("(%p)->(%p)\n", This, p);
1258 return get_doc_event(This, EVENTID_KEYDOWN, p);
1261 static HRESULT WINAPI HTMLDocument_put_onkeypress(IHTMLDocument2 *iface, VARIANT v)
1263 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1265 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1267 return set_doc_event(This, EVENTID_KEYPRESS, &v);
1270 static HRESULT WINAPI HTMLDocument_get_onkeypress(IHTMLDocument2 *iface, VARIANT *p)
1272 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1274 TRACE("(%p)->(%p)\n", This, p);
1276 return get_doc_event(This, EVENTID_KEYPRESS, p);
1279 static HRESULT WINAPI HTMLDocument_put_onmouseup(IHTMLDocument2 *iface, VARIANT v)
1281 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1283 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1285 return set_doc_event(This, EVENTID_MOUSEUP, &v);
1288 static HRESULT WINAPI HTMLDocument_get_onmouseup(IHTMLDocument2 *iface, VARIANT *p)
1290 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1292 TRACE("(%p)->(%p)\n", This, p);
1294 return get_doc_event(This, EVENTID_MOUSEUP, p);
1297 static HRESULT WINAPI HTMLDocument_put_onmousedown(IHTMLDocument2 *iface, VARIANT v)
1299 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1301 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1303 return set_doc_event(This, EVENTID_MOUSEDOWN, &v);
1306 static HRESULT WINAPI HTMLDocument_get_onmousedown(IHTMLDocument2 *iface, VARIANT *p)
1308 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1310 TRACE("(%p)->(%p)\n", This, p);
1312 return get_doc_event(This, EVENTID_MOUSEDOWN, p);
1315 static HRESULT WINAPI HTMLDocument_put_onmousemove(IHTMLDocument2 *iface, VARIANT v)
1317 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1319 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1321 return set_doc_event(This, EVENTID_MOUSEMOVE, &v);
1324 static HRESULT WINAPI HTMLDocument_get_onmousemove(IHTMLDocument2 *iface, VARIANT *p)
1326 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1328 TRACE("(%p)->(%p)\n", This, p);
1330 return get_doc_event(This, EVENTID_MOUSEMOVE, p);
1333 static HRESULT WINAPI HTMLDocument_put_onmouseout(IHTMLDocument2 *iface, VARIANT v)
1335 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1337 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1339 return set_doc_event(This, EVENTID_MOUSEOUT, &v);
1342 static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT *p)
1344 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1346 TRACE("(%p)->(%p)\n", This, p);
1348 return get_doc_event(This, EVENTID_MOUSEOUT, p);
1351 static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v)
1353 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1355 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1357 return set_doc_event(This, EVENTID_MOUSEOVER, &v);
1360 static HRESULT WINAPI HTMLDocument_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p)
1362 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1364 TRACE("(%p)->(%p)\n", This, p);
1366 return get_doc_event(This, EVENTID_MOUSEOVER, p);
1369 static HRESULT WINAPI HTMLDocument_put_onreadystatechange(IHTMLDocument2 *iface, VARIANT v)
1371 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1373 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1375 return set_doc_event(This, EVENTID_READYSTATECHANGE, &v);
1378 static HRESULT WINAPI HTMLDocument_get_onreadystatechange(IHTMLDocument2 *iface, VARIANT *p)
1380 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1382 TRACE("(%p)->(%p)\n", This, p);
1384 return get_doc_event(This, EVENTID_READYSTATECHANGE, p);
1387 static HRESULT WINAPI HTMLDocument_put_onafterupdate(IHTMLDocument2 *iface, VARIANT v)
1389 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1390 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1391 return E_NOTIMPL;
1394 static HRESULT WINAPI HTMLDocument_get_onafterupdate(IHTMLDocument2 *iface, VARIANT *p)
1396 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1397 FIXME("(%p)->(%p)\n", This, p);
1398 return E_NOTIMPL;
1401 static HRESULT WINAPI HTMLDocument_put_onrowexit(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_onrowexit(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_onrowenter(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_onrowenter(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_ondragstart(IHTMLDocument2 *iface, VARIANT v)
1431 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1433 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1435 return set_doc_event(This, EVENTID_DRAGSTART, &v);
1438 static HRESULT WINAPI HTMLDocument_get_ondragstart(IHTMLDocument2 *iface, VARIANT *p)
1440 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1442 TRACE("(%p)->(%p)\n", This, p);
1444 return get_doc_event(This, EVENTID_DRAGSTART, p);
1447 static HRESULT WINAPI HTMLDocument_put_onselectstart(IHTMLDocument2 *iface, VARIANT v)
1449 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1451 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1453 return set_doc_event(This, EVENTID_SELECTSTART, &v);
1456 static HRESULT WINAPI HTMLDocument_get_onselectstart(IHTMLDocument2 *iface, VARIANT *p)
1458 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1460 TRACE("(%p)->(%p)\n", This, p);
1462 return get_doc_event(This, EVENTID_SELECTSTART, p);
1465 static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, LONG x, LONG y,
1466 IHTMLElement **elementHit)
1468 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1469 nsIDOMElement *nselem;
1470 HTMLDOMNode *node;
1471 nsresult nsres;
1472 HRESULT hres;
1474 TRACE("(%p)->(%d %d %p)\n", This, x, y, elementHit);
1476 nsres = nsIDOMHTMLDocument_ElementFromPoint(This->doc_node->nsdoc, x, y, &nselem);
1477 if(NS_FAILED(nsres)) {
1478 ERR("ElementFromPoint failed: %08x\n", nsres);
1479 return E_FAIL;
1482 if(!nselem) {
1483 *elementHit = NULL;
1484 return S_OK;
1487 hres = get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE, &node);
1488 nsIDOMElement_Release(nselem);
1489 if(FAILED(hres))
1490 return hres;
1492 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)elementHit);
1493 node_release(node);
1494 return hres;
1497 static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p)
1499 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1501 TRACE("(%p)->(%p)\n", This, p);
1503 *p = &This->window->base.IHTMLWindow2_iface;
1504 IHTMLWindow2_AddRef(*p);
1505 return S_OK;
1508 static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
1509 IHTMLStyleSheetsCollection **p)
1511 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1512 nsIDOMStyleSheetList *nsstylelist;
1513 nsresult nsres;
1515 TRACE("(%p)->(%p)\n", This, p);
1517 *p = NULL;
1519 if(!This->doc_node->nsdoc) {
1520 WARN("NULL nsdoc\n");
1521 return E_UNEXPECTED;
1524 nsres = nsIDOMHTMLDocument_GetStyleSheets(This->doc_node->nsdoc, &nsstylelist);
1525 if(NS_FAILED(nsres)) {
1526 ERR("GetStyleSheets failed: %08x\n", nsres);
1527 return E_FAIL;
1530 *p = HTMLStyleSheetsCollection_Create(nsstylelist);
1531 nsIDOMStyleSheetList_Release(nsstylelist);
1533 return S_OK;
1536 static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v)
1538 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1539 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1540 return E_NOTIMPL;
1543 static HRESULT WINAPI HTMLDocument_get_onbeforeupdate(IHTMLDocument2 *iface, VARIANT *p)
1545 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1546 FIXME("(%p)->(%p)\n", This, p);
1547 return E_NOTIMPL;
1550 static HRESULT WINAPI HTMLDocument_put_onerrorupdate(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_onerrorupdate(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_toString(IHTMLDocument2 *iface, BSTR *String)
1566 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1568 static const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0};
1570 TRACE("(%p)->(%p)\n", This, String);
1572 if(!String)
1573 return E_INVALIDARG;
1575 *String = SysAllocString(objectW);
1576 return *String ? S_OK : E_OUTOFMEMORY;
1580 static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR bstrHref,
1581 LONG lIndex, IHTMLStyleSheet **ppnewStyleSheet)
1583 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1584 nsIDOMHTMLHeadElement *head_elem;
1585 IHTMLStyleElement *style_elem;
1586 HTMLElement *elem;
1587 nsresult nsres;
1588 HRESULT hres;
1590 static const WCHAR styleW[] = {'s','t','y','l','e',0};
1592 TRACE("(%p)->(%s %d %p)\n", This, debugstr_w(bstrHref), lIndex, ppnewStyleSheet);
1594 if(!This->doc_node->nsdoc) {
1595 FIXME("not a real doc object\n");
1596 return E_NOTIMPL;
1599 if(lIndex != -1)
1600 FIXME("Unsupported lIndex %d\n", lIndex);
1602 if(bstrHref) {
1603 FIXME("semi-stub for href %s\n", debugstr_w(bstrHref));
1604 *ppnewStyleSheet = HTMLStyleSheet_Create(NULL);
1605 return S_OK;
1608 hres = create_element(This->doc_node, styleW, &elem);
1609 if(FAILED(hres))
1610 return hres;
1612 nsres = nsIDOMHTMLDocument_GetHead(This->doc_node->nsdoc, &head_elem);
1613 if(NS_SUCCEEDED(nsres)) {
1614 nsIDOMNode *head_node, *tmp_node;
1616 nsres = nsIDOMHTMLHeadElement_QueryInterface(head_elem, &IID_nsIDOMNode, (void**)&head_node);
1617 nsIDOMHTMLHeadElement_Release(head_elem);
1618 assert(nsres == NS_OK);
1620 nsres = nsIDOMNode_AppendChild(head_node, elem->node.nsnode, &tmp_node);
1621 nsIDOMNode_Release(head_node);
1622 if(NS_SUCCEEDED(nsres) && tmp_node)
1623 nsIDOMNode_Release(tmp_node);
1625 if(NS_FAILED(nsres)) {
1626 IHTMLElement_Release(&elem->IHTMLElement_iface);
1627 return E_FAIL;
1630 hres = IHTMLElement_QueryInterface(&elem->IHTMLElement_iface, &IID_IHTMLStyleElement, (void**)&style_elem);
1631 assert(hres == S_OK);
1632 IHTMLElement_Release(&elem->IHTMLElement_iface);
1634 hres = IHTMLStyleElement_get_styleSheet(style_elem, ppnewStyleSheet);
1635 IHTMLStyleElement_Release(style_elem);
1636 return hres;
1639 static const IHTMLDocument2Vtbl HTMLDocumentVtbl = {
1640 HTMLDocument_QueryInterface,
1641 HTMLDocument_AddRef,
1642 HTMLDocument_Release,
1643 HTMLDocument_GetTypeInfoCount,
1644 HTMLDocument_GetTypeInfo,
1645 HTMLDocument_GetIDsOfNames,
1646 HTMLDocument_Invoke,
1647 HTMLDocument_get_Script,
1648 HTMLDocument_get_all,
1649 HTMLDocument_get_body,
1650 HTMLDocument_get_activeElement,
1651 HTMLDocument_get_images,
1652 HTMLDocument_get_applets,
1653 HTMLDocument_get_links,
1654 HTMLDocument_get_forms,
1655 HTMLDocument_get_anchors,
1656 HTMLDocument_put_title,
1657 HTMLDocument_get_title,
1658 HTMLDocument_get_scripts,
1659 HTMLDocument_put_designMode,
1660 HTMLDocument_get_designMode,
1661 HTMLDocument_get_selection,
1662 HTMLDocument_get_readyState,
1663 HTMLDocument_get_frames,
1664 HTMLDocument_get_embeds,
1665 HTMLDocument_get_plugins,
1666 HTMLDocument_put_alinkColor,
1667 HTMLDocument_get_alinkColor,
1668 HTMLDocument_put_bgColor,
1669 HTMLDocument_get_bgColor,
1670 HTMLDocument_put_fgColor,
1671 HTMLDocument_get_fgColor,
1672 HTMLDocument_put_linkColor,
1673 HTMLDocument_get_linkColor,
1674 HTMLDocument_put_vlinkColor,
1675 HTMLDocument_get_vlinkColor,
1676 HTMLDocument_get_referrer,
1677 HTMLDocument_get_location,
1678 HTMLDocument_get_lastModified,
1679 HTMLDocument_put_URL,
1680 HTMLDocument_get_URL,
1681 HTMLDocument_put_domain,
1682 HTMLDocument_get_domain,
1683 HTMLDocument_put_cookie,
1684 HTMLDocument_get_cookie,
1685 HTMLDocument_put_expando,
1686 HTMLDocument_get_expando,
1687 HTMLDocument_put_charset,
1688 HTMLDocument_get_charset,
1689 HTMLDocument_put_defaultCharset,
1690 HTMLDocument_get_defaultCharset,
1691 HTMLDocument_get_mimeType,
1692 HTMLDocument_get_fileSize,
1693 HTMLDocument_get_fileCreatedDate,
1694 HTMLDocument_get_fileModifiedDate,
1695 HTMLDocument_get_fileUpdatedDate,
1696 HTMLDocument_get_security,
1697 HTMLDocument_get_protocol,
1698 HTMLDocument_get_nameProp,
1699 HTMLDocument_write,
1700 HTMLDocument_writeln,
1701 HTMLDocument_open,
1702 HTMLDocument_close,
1703 HTMLDocument_clear,
1704 HTMLDocument_queryCommandSupported,
1705 HTMLDocument_queryCommandEnabled,
1706 HTMLDocument_queryCommandState,
1707 HTMLDocument_queryCommandIndeterm,
1708 HTMLDocument_queryCommandText,
1709 HTMLDocument_queryCommandValue,
1710 HTMLDocument_execCommand,
1711 HTMLDocument_execCommandShowHelp,
1712 HTMLDocument_createElement,
1713 HTMLDocument_put_onhelp,
1714 HTMLDocument_get_onhelp,
1715 HTMLDocument_put_onclick,
1716 HTMLDocument_get_onclick,
1717 HTMLDocument_put_ondblclick,
1718 HTMLDocument_get_ondblclick,
1719 HTMLDocument_put_onkeyup,
1720 HTMLDocument_get_onkeyup,
1721 HTMLDocument_put_onkeydown,
1722 HTMLDocument_get_onkeydown,
1723 HTMLDocument_put_onkeypress,
1724 HTMLDocument_get_onkeypress,
1725 HTMLDocument_put_onmouseup,
1726 HTMLDocument_get_onmouseup,
1727 HTMLDocument_put_onmousedown,
1728 HTMLDocument_get_onmousedown,
1729 HTMLDocument_put_onmousemove,
1730 HTMLDocument_get_onmousemove,
1731 HTMLDocument_put_onmouseout,
1732 HTMLDocument_get_onmouseout,
1733 HTMLDocument_put_onmouseover,
1734 HTMLDocument_get_onmouseover,
1735 HTMLDocument_put_onreadystatechange,
1736 HTMLDocument_get_onreadystatechange,
1737 HTMLDocument_put_onafterupdate,
1738 HTMLDocument_get_onafterupdate,
1739 HTMLDocument_put_onrowexit,
1740 HTMLDocument_get_onrowexit,
1741 HTMLDocument_put_onrowenter,
1742 HTMLDocument_get_onrowenter,
1743 HTMLDocument_put_ondragstart,
1744 HTMLDocument_get_ondragstart,
1745 HTMLDocument_put_onselectstart,
1746 HTMLDocument_get_onselectstart,
1747 HTMLDocument_elementFromPoint,
1748 HTMLDocument_get_parentWindow,
1749 HTMLDocument_get_styleSheets,
1750 HTMLDocument_put_onbeforeupdate,
1751 HTMLDocument_get_onbeforeupdate,
1752 HTMLDocument_put_onerrorupdate,
1753 HTMLDocument_get_onerrorupdate,
1754 HTMLDocument_toString,
1755 HTMLDocument_createStyleSheet
1758 static inline HTMLDocument *impl_from_IHTMLDocument3(IHTMLDocument3 *iface)
1760 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument3_iface);
1763 static HRESULT WINAPI HTMLDocument3_QueryInterface(IHTMLDocument3 *iface,
1764 REFIID riid, void **ppv)
1766 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1767 return htmldoc_query_interface(This, riid, ppv);
1770 static ULONG WINAPI HTMLDocument3_AddRef(IHTMLDocument3 *iface)
1772 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1773 return htmldoc_addref(This);
1776 static ULONG WINAPI HTMLDocument3_Release(IHTMLDocument3 *iface)
1778 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1779 return htmldoc_release(This);
1782 static HRESULT WINAPI HTMLDocument3_GetTypeInfoCount(IHTMLDocument3 *iface, UINT *pctinfo)
1784 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1785 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
1788 static HRESULT WINAPI HTMLDocument3_GetTypeInfo(IHTMLDocument3 *iface, UINT iTInfo,
1789 LCID lcid, ITypeInfo **ppTInfo)
1791 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1792 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1795 static HRESULT WINAPI HTMLDocument3_GetIDsOfNames(IHTMLDocument3 *iface, REFIID riid,
1796 LPOLESTR *rgszNames, UINT cNames,
1797 LCID lcid, DISPID *rgDispId)
1799 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1800 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
1801 rgDispId);
1804 static HRESULT WINAPI HTMLDocument3_Invoke(IHTMLDocument3 *iface, DISPID dispIdMember,
1805 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1806 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1808 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1809 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
1810 pDispParams, pVarResult, pExcepInfo, puArgErr);
1813 static HRESULT WINAPI HTMLDocument3_releaseCapture(IHTMLDocument3 *iface)
1815 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1816 FIXME("(%p)\n", This);
1817 return E_NOTIMPL;
1820 static HRESULT WINAPI HTMLDocument3_recalc(IHTMLDocument3 *iface, VARIANT_BOOL fForce)
1822 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1824 WARN("(%p)->(%x)\n", This, fForce);
1826 /* Doing nothing here should be fine for us. */
1827 return S_OK;
1830 static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR text,
1831 IHTMLDOMNode **newTextNode)
1833 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1834 nsIDOMText *nstext;
1835 HTMLDOMNode *node;
1836 nsAString text_str;
1837 nsresult nsres;
1838 HRESULT hres;
1840 TRACE("(%p)->(%s %p)\n", This, debugstr_w(text), newTextNode);
1842 if(!This->doc_node->nsdoc) {
1843 WARN("NULL nsdoc\n");
1844 return E_UNEXPECTED;
1847 nsAString_InitDepend(&text_str, text);
1848 nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &text_str, &nstext);
1849 nsAString_Finish(&text_str);
1850 if(NS_FAILED(nsres)) {
1851 ERR("CreateTextNode failed: %08x\n", nsres);
1852 return E_FAIL;
1855 hres = HTMLDOMTextNode_Create(This->doc_node, (nsIDOMNode*)nstext, &node);
1856 nsIDOMText_Release(nstext);
1857 if(FAILED(hres))
1858 return hres;
1860 *newTextNode = &node->IHTMLDOMNode_iface;
1861 return S_OK;
1864 static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p)
1866 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1867 nsIDOMElement *nselem = NULL;
1868 HTMLDOMNode *node;
1869 nsresult nsres;
1870 HRESULT hres;
1872 TRACE("(%p)->(%p)\n", This, p);
1874 if(This->window->readystate == READYSTATE_UNINITIALIZED) {
1875 *p = NULL;
1876 return S_OK;
1879 if(!This->doc_node->nsdoc) {
1880 WARN("NULL nsdoc\n");
1881 return E_UNEXPECTED;
1884 nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
1885 if(NS_FAILED(nsres)) {
1886 ERR("GetDocumentElement failed: %08x\n", nsres);
1887 return E_FAIL;
1890 if(!nselem) {
1891 *p = NULL;
1892 return S_OK;
1895 hres = get_node(This->doc_node, (nsIDOMNode *)nselem, TRUE, &node);
1896 nsIDOMElement_Release(nselem);
1897 if(FAILED(hres))
1898 return hres;
1900 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
1901 node_release(node);
1902 return hres;
1905 static HRESULT WINAPI HTMLDocument3_uniqueID(IHTMLDocument3 *iface, BSTR *p)
1907 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1908 FIXME("(%p)->(%p)\n", This, p);
1909 return E_NOTIMPL;
1912 static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR event,
1913 IDispatch* pDisp, VARIANT_BOOL *pfResult)
1915 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1917 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
1919 return attach_event(&This->doc_node->node.event_target, This, event, pDisp, pfResult);
1922 static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR event,
1923 IDispatch *pDisp)
1925 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1927 TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
1929 return detach_event(This->doc_node->node.event_target, This, event, pDisp);
1932 static HRESULT WINAPI HTMLDocument3_put_onrowsdelete(IHTMLDocument3 *iface, VARIANT v)
1934 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1935 FIXME("(%p)->()\n", This);
1936 return E_NOTIMPL;
1939 static HRESULT WINAPI HTMLDocument3_get_onrowsdelete(IHTMLDocument3 *iface, VARIANT *p)
1941 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1942 FIXME("(%p)->(%p)\n", This, p);
1943 return E_NOTIMPL;
1946 static HRESULT WINAPI HTMLDocument3_put_onrowsinserted(IHTMLDocument3 *iface, VARIANT v)
1948 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1949 FIXME("(%p)->()\n", This);
1950 return E_NOTIMPL;
1953 static HRESULT WINAPI HTMLDocument3_get_onrowsinserted(IHTMLDocument3 *iface, VARIANT *p)
1955 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1956 FIXME("(%p)->(%p)\n", This, p);
1957 return E_NOTIMPL;
1960 static HRESULT WINAPI HTMLDocument3_put_oncellchange(IHTMLDocument3 *iface, VARIANT v)
1962 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1963 FIXME("(%p)->()\n", This);
1964 return E_NOTIMPL;
1967 static HRESULT WINAPI HTMLDocument3_get_oncellchange(IHTMLDocument3 *iface, VARIANT *p)
1969 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1970 FIXME("(%p)->(%p)\n", This, p);
1971 return E_NOTIMPL;
1974 static HRESULT WINAPI HTMLDocument3_put_ondatasetchanged(IHTMLDocument3 *iface, VARIANT v)
1976 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1977 FIXME("(%p)->()\n", This);
1978 return E_NOTIMPL;
1981 static HRESULT WINAPI HTMLDocument3_get_ondatasetchanged(IHTMLDocument3 *iface, VARIANT *p)
1983 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1984 FIXME("(%p)->(%p)\n", This, p);
1985 return E_NOTIMPL;
1988 static HRESULT WINAPI HTMLDocument3_put_ondataavailable(IHTMLDocument3 *iface, VARIANT v)
1990 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1991 FIXME("(%p)->()\n", This);
1992 return E_NOTIMPL;
1995 static HRESULT WINAPI HTMLDocument3_get_ondataavailable(IHTMLDocument3 *iface, VARIANT *p)
1997 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1998 FIXME("(%p)->(%p)\n", This, p);
1999 return E_NOTIMPL;
2002 static HRESULT WINAPI HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT v)
2004 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2005 FIXME("(%p)->()\n", This);
2006 return E_NOTIMPL;
2009 static HRESULT WINAPI HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT *p)
2011 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2012 FIXME("(%p)->(%p)\n", This, p);
2013 return E_NOTIMPL;
2016 static HRESULT WINAPI HTMLDocument3_put_onpropertychange(IHTMLDocument3 *iface, VARIANT v)
2018 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2019 FIXME("(%p)->()\n", This);
2020 return E_NOTIMPL;
2023 static HRESULT WINAPI HTMLDocument3_get_onpropertychange(IHTMLDocument3 *iface, VARIANT *p)
2025 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2026 FIXME("(%p)->(%p)\n", This, p);
2027 return E_NOTIMPL;
2030 static HRESULT WINAPI HTMLDocument3_put_dir(IHTMLDocument3 *iface, BSTR v)
2032 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2033 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2034 return E_NOTIMPL;
2037 static HRESULT WINAPI HTMLDocument3_get_dir(IHTMLDocument3 *iface, BSTR *p)
2039 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2040 FIXME("(%p)->(%p)\n", This, p);
2041 return E_NOTIMPL;
2044 static HRESULT WINAPI HTMLDocument3_put_oncontextmenu(IHTMLDocument3 *iface, VARIANT v)
2046 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2048 TRACE("(%p)->()\n", This);
2050 return set_doc_event(This, EVENTID_CONTEXTMENU, &v);
2053 static HRESULT WINAPI HTMLDocument3_get_oncontextmenu(IHTMLDocument3 *iface, VARIANT *p)
2055 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2057 TRACE("(%p)->(%p)\n", This, p);
2059 return get_doc_event(This, EVENTID_CONTEXTMENU, p);
2062 static HRESULT WINAPI HTMLDocument3_put_onstop(IHTMLDocument3 *iface, VARIANT v)
2064 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2065 FIXME("(%p)->()\n", This);
2066 return E_NOTIMPL;
2069 static HRESULT WINAPI HTMLDocument3_get_onstop(IHTMLDocument3 *iface, VARIANT *p)
2071 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2072 FIXME("(%p)->(%p)\n", This, p);
2073 return E_NOTIMPL;
2076 static HRESULT WINAPI HTMLDocument3_createDocumentFragment(IHTMLDocument3 *iface,
2077 IHTMLDocument2 **ppNewDoc)
2079 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2080 nsIDOMDocumentFragment *doc_frag;
2081 HTMLDocumentNode *docnode;
2082 nsresult nsres;
2083 HRESULT hres;
2085 TRACE("(%p)->(%p)\n", This, ppNewDoc);
2087 if(!This->doc_node->nsdoc) {
2088 FIXME("NULL nsdoc\n");
2089 return E_NOTIMPL;
2092 nsres = nsIDOMHTMLDocument_CreateDocumentFragment(This->doc_node->nsdoc, &doc_frag);
2093 if(NS_FAILED(nsres)) {
2094 ERR("CreateDocumentFragment failed: %08x\n", nsres);
2095 return E_FAIL;
2098 hres = create_document_fragment((nsIDOMNode*)doc_frag, This->doc_node, &docnode);
2099 nsIDOMDocumentFragment_Release(doc_frag);
2100 if(FAILED(hres))
2101 return hres;
2103 *ppNewDoc = &docnode->basedoc.IHTMLDocument2_iface;
2104 return S_OK;
2107 static HRESULT WINAPI HTMLDocument3_get_parentDocument(IHTMLDocument3 *iface,
2108 IHTMLDocument2 **p)
2110 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2111 FIXME("(%p)->(%p)\n", This, p);
2112 return E_NOTIMPL;
2115 static HRESULT WINAPI HTMLDocument3_put_enableDownload(IHTMLDocument3 *iface,
2116 VARIANT_BOOL v)
2118 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2119 FIXME("(%p)->(%x)\n", This, v);
2120 return E_NOTIMPL;
2123 static HRESULT WINAPI HTMLDocument3_get_enableDownload(IHTMLDocument3 *iface,
2124 VARIANT_BOOL *p)
2126 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2127 FIXME("(%p)->(%p)\n", This, p);
2128 return E_NOTIMPL;
2131 static HRESULT WINAPI HTMLDocument3_put_baseUrl(IHTMLDocument3 *iface, BSTR v)
2133 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2134 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2135 return E_NOTIMPL;
2138 static HRESULT WINAPI HTMLDocument3_get_baseUrl(IHTMLDocument3 *iface, BSTR *p)
2140 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2141 FIXME("(%p)->(%p)\n", This, p);
2142 return E_NOTIMPL;
2145 static HRESULT WINAPI HTMLDocument3_get_childNodes(IHTMLDocument3 *iface, IDispatch **p)
2147 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2149 TRACE("(%p)->(%p)\n", This, p);
2151 return IHTMLDOMNode_get_childNodes(&This->doc_node->node.IHTMLDOMNode_iface, p);
2154 static HRESULT WINAPI HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3 *iface,
2155 VARIANT_BOOL v)
2157 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2158 FIXME("(%p)->()\n", This);
2159 return E_NOTIMPL;
2162 static HRESULT WINAPI HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3 *iface,
2163 VARIANT_BOOL *p)
2165 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2166 FIXME("(%p)->(%p)\n", This, p);
2167 return E_NOTIMPL;
2170 static HRESULT WINAPI HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT v)
2172 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2173 FIXME("(%p)->()\n", This);
2174 return E_NOTIMPL;
2177 static HRESULT WINAPI HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT *p)
2179 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2180 FIXME("(%p)->(%p)\n", This, p);
2181 return E_NOTIMPL;
2184 static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BSTR v,
2185 IHTMLElementCollection **ppelColl)
2187 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2188 nsIDOMNodeList *node_list;
2189 nsAString selector_str;
2190 WCHAR *selector;
2191 nsresult nsres;
2193 static const WCHAR formatW[] = {'*','[','i','d','=','%','s',']',',','*','[','n','a','m','e','=','%','s',']',0};
2195 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), ppelColl);
2197 if(!This->doc_node || !This->doc_node->nsdoc) {
2198 /* We should probably return an empty collection. */
2199 FIXME("No nsdoc\n");
2200 return E_NOTIMPL;
2203 selector = heap_alloc(2*SysStringLen(v)*sizeof(WCHAR) + sizeof(formatW));
2204 if(!selector)
2205 return E_OUTOFMEMORY;
2206 sprintfW(selector, formatW, v, v);
2209 * NOTE: IE getElementsByName implementation differs from Gecko. It searches both name and id attributes.
2210 * That's why we use CSS selector instead. We should also use name only when it applies to given element
2211 * types and search should be case insensitive. Those are currently not supported properly.
2213 nsAString_InitDepend(&selector_str, selector);
2214 nsres = nsIDOMNodeSelector_QuerySelectorAll(This->doc_node->nsnode_selector, &selector_str, &node_list);
2215 nsAString_Finish(&selector_str);
2216 heap_free(selector);
2217 if(NS_FAILED(nsres)) {
2218 ERR("QuerySelectorAll failed: %08x\n", nsres);
2219 return E_FAIL;
2222 *ppelColl = create_collection_from_nodelist(This->doc_node, node_list);
2223 nsIDOMNodeList_Release(node_list);
2224 return S_OK;
2228 static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v,
2229 IHTMLElement **pel)
2231 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2232 HTMLElement *elem;
2233 HRESULT hres;
2235 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
2237 hres = get_doc_elem_by_id(This->doc_node, v, &elem);
2238 if(FAILED(hres) || !elem) {
2239 *pel = NULL;
2240 return hres;
2243 *pel = &elem->IHTMLElement_iface;
2244 return S_OK;
2248 static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface, BSTR v,
2249 IHTMLElementCollection **pelColl)
2251 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2252 nsIDOMNodeList *nslist;
2253 nsAString id_str;
2254 nsresult nsres;
2256 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
2258 if(!This->doc_node->nsdoc) {
2259 WARN("NULL nsdoc\n");
2260 return E_UNEXPECTED;
2263 nsAString_InitDepend(&id_str, v);
2264 nsres = nsIDOMHTMLDocument_GetElementsByTagName(This->doc_node->nsdoc, &id_str, &nslist);
2265 nsAString_Finish(&id_str);
2266 if(FAILED(nsres)) {
2267 ERR("GetElementByName failed: %08x\n", nsres);
2268 return E_FAIL;
2271 *pelColl = create_collection_from_nodelist(This->doc_node, nslist);
2272 nsIDOMNodeList_Release(nslist);
2274 return S_OK;
2277 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl = {
2278 HTMLDocument3_QueryInterface,
2279 HTMLDocument3_AddRef,
2280 HTMLDocument3_Release,
2281 HTMLDocument3_GetTypeInfoCount,
2282 HTMLDocument3_GetTypeInfo,
2283 HTMLDocument3_GetIDsOfNames,
2284 HTMLDocument3_Invoke,
2285 HTMLDocument3_releaseCapture,
2286 HTMLDocument3_recalc,
2287 HTMLDocument3_createTextNode,
2288 HTMLDocument3_get_documentElement,
2289 HTMLDocument3_uniqueID,
2290 HTMLDocument3_attachEvent,
2291 HTMLDocument3_detachEvent,
2292 HTMLDocument3_put_onrowsdelete,
2293 HTMLDocument3_get_onrowsdelete,
2294 HTMLDocument3_put_onrowsinserted,
2295 HTMLDocument3_get_onrowsinserted,
2296 HTMLDocument3_put_oncellchange,
2297 HTMLDocument3_get_oncellchange,
2298 HTMLDocument3_put_ondatasetchanged,
2299 HTMLDocument3_get_ondatasetchanged,
2300 HTMLDocument3_put_ondataavailable,
2301 HTMLDocument3_get_ondataavailable,
2302 HTMLDocument3_put_ondatasetcomplete,
2303 HTMLDocument3_get_ondatasetcomplete,
2304 HTMLDocument3_put_onpropertychange,
2305 HTMLDocument3_get_onpropertychange,
2306 HTMLDocument3_put_dir,
2307 HTMLDocument3_get_dir,
2308 HTMLDocument3_put_oncontextmenu,
2309 HTMLDocument3_get_oncontextmenu,
2310 HTMLDocument3_put_onstop,
2311 HTMLDocument3_get_onstop,
2312 HTMLDocument3_createDocumentFragment,
2313 HTMLDocument3_get_parentDocument,
2314 HTMLDocument3_put_enableDownload,
2315 HTMLDocument3_get_enableDownload,
2316 HTMLDocument3_put_baseUrl,
2317 HTMLDocument3_get_baseUrl,
2318 HTMLDocument3_get_childNodes,
2319 HTMLDocument3_put_inheritStyleSheets,
2320 HTMLDocument3_get_inheritStyleSheets,
2321 HTMLDocument3_put_onbeforeeditfocus,
2322 HTMLDocument3_get_onbeforeeditfocus,
2323 HTMLDocument3_getElementsByName,
2324 HTMLDocument3_getElementById,
2325 HTMLDocument3_getElementsByTagName
2328 static inline HTMLDocument *impl_from_IHTMLDocument4(IHTMLDocument4 *iface)
2330 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument4_iface);
2333 static HRESULT WINAPI HTMLDocument4_QueryInterface(IHTMLDocument4 *iface,
2334 REFIID riid, void **ppv)
2336 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2337 return htmldoc_query_interface(This, riid, ppv);
2340 static ULONG WINAPI HTMLDocument4_AddRef(IHTMLDocument4 *iface)
2342 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2343 return htmldoc_addref(This);
2346 static ULONG WINAPI HTMLDocument4_Release(IHTMLDocument4 *iface)
2348 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2349 return htmldoc_release(This);
2352 static HRESULT WINAPI HTMLDocument4_GetTypeInfoCount(IHTMLDocument4 *iface, UINT *pctinfo)
2354 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2355 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
2358 static HRESULT WINAPI HTMLDocument4_GetTypeInfo(IHTMLDocument4 *iface, UINT iTInfo,
2359 LCID lcid, ITypeInfo **ppTInfo)
2361 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2362 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2365 static HRESULT WINAPI HTMLDocument4_GetIDsOfNames(IHTMLDocument4 *iface, REFIID riid,
2366 LPOLESTR *rgszNames, UINT cNames,
2367 LCID lcid, DISPID *rgDispId)
2369 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2370 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
2371 rgDispId);
2374 static HRESULT WINAPI HTMLDocument4_Invoke(IHTMLDocument4 *iface, DISPID dispIdMember,
2375 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2376 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2378 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2379 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2380 pDispParams, pVarResult, pExcepInfo, puArgErr);
2383 static HRESULT WINAPI HTMLDocument4_focus(IHTMLDocument4 *iface)
2385 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2386 nsIDOMHTMLElement *nsbody;
2387 nsresult nsres;
2389 TRACE("(%p)->()\n", This);
2391 nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
2392 if(NS_FAILED(nsres) || !nsbody) {
2393 ERR("GetBody failed: %08x\n", nsres);
2394 return E_FAIL;
2397 nsres = nsIDOMHTMLElement_Focus(nsbody);
2398 nsIDOMHTMLElement_Release(nsbody);
2399 if(NS_FAILED(nsres)) {
2400 ERR("Focus failed: %08x\n", nsres);
2401 return E_FAIL;
2404 return S_OK;
2407 static HRESULT WINAPI HTMLDocument4_hasFocus(IHTMLDocument4 *iface, VARIANT_BOOL *pfFocus)
2409 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2410 FIXME("(%p)->(%p)\n", This, pfFocus);
2411 return E_NOTIMPL;
2414 static HRESULT WINAPI HTMLDocument4_put_onselectionchange(IHTMLDocument4 *iface, VARIANT v)
2416 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2417 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2418 return E_NOTIMPL;
2421 static HRESULT WINAPI HTMLDocument4_get_onselectionchange(IHTMLDocument4 *iface, VARIANT *p)
2423 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2424 FIXME("(%p)->(%p)\n", This, p);
2425 return E_NOTIMPL;
2428 static HRESULT WINAPI HTMLDocument4_get_namespace(IHTMLDocument4 *iface, IDispatch **p)
2430 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2431 FIXME("(%p)->(%p)\n", This, p);
2432 return E_NOTIMPL;
2435 static HRESULT WINAPI HTMLDocument4_createDocumentFromUrl(IHTMLDocument4 *iface, BSTR bstrUrl,
2436 BSTR bstrOptions, IHTMLDocument2 **newDoc)
2438 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2439 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(bstrUrl), debugstr_w(bstrOptions), newDoc);
2440 return E_NOTIMPL;
2443 static HRESULT WINAPI HTMLDocument4_put_media(IHTMLDocument4 *iface, BSTR v)
2445 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2446 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2447 return E_NOTIMPL;
2450 static HRESULT WINAPI HTMLDocument4_get_media(IHTMLDocument4 *iface, BSTR *p)
2452 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2453 FIXME("(%p)->(%p)\n", This, p);
2454 return E_NOTIMPL;
2457 static HRESULT WINAPI HTMLDocument4_createEventObject(IHTMLDocument4 *iface,
2458 VARIANT *pvarEventObject, IHTMLEventObj **ppEventObj)
2460 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2462 TRACE("(%p)->(%s %p)\n", This, debugstr_variant(pvarEventObject), ppEventObj);
2464 if(pvarEventObject && V_VT(pvarEventObject) != VT_ERROR && V_VT(pvarEventObject) != VT_EMPTY) {
2465 FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject));
2466 return E_NOTIMPL;
2469 return create_event_obj(ppEventObj);
2472 static HRESULT WINAPI HTMLDocument4_fireEvent(IHTMLDocument4 *iface, BSTR bstrEventName,
2473 VARIANT *pvarEventObject, VARIANT_BOOL *pfCanceled)
2475 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2477 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCanceled);
2479 return dispatch_event(&This->doc_node->node, bstrEventName, pvarEventObject, pfCanceled);
2482 static HRESULT WINAPI HTMLDocument4_createRenderStyle(IHTMLDocument4 *iface, BSTR v,
2483 IHTMLRenderStyle **ppIHTMLRenderStyle)
2485 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2486 FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppIHTMLRenderStyle);
2487 return E_NOTIMPL;
2490 static HRESULT WINAPI HTMLDocument4_put_oncontrolselect(IHTMLDocument4 *iface, VARIANT v)
2492 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2493 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2494 return E_NOTIMPL;
2497 static HRESULT WINAPI HTMLDocument4_get_oncontrolselect(IHTMLDocument4 *iface, VARIANT *p)
2499 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2500 FIXME("(%p)->(%p)\n", This, p);
2501 return E_NOTIMPL;
2504 static HRESULT WINAPI HTMLDocument4_get_URLEncoded(IHTMLDocument4 *iface, BSTR *p)
2506 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2507 FIXME("(%p)->(%p)\n", This, p);
2508 return E_NOTIMPL;
2511 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl = {
2512 HTMLDocument4_QueryInterface,
2513 HTMLDocument4_AddRef,
2514 HTMLDocument4_Release,
2515 HTMLDocument4_GetTypeInfoCount,
2516 HTMLDocument4_GetTypeInfo,
2517 HTMLDocument4_GetIDsOfNames,
2518 HTMLDocument4_Invoke,
2519 HTMLDocument4_focus,
2520 HTMLDocument4_hasFocus,
2521 HTMLDocument4_put_onselectionchange,
2522 HTMLDocument4_get_onselectionchange,
2523 HTMLDocument4_get_namespace,
2524 HTMLDocument4_createDocumentFromUrl,
2525 HTMLDocument4_put_media,
2526 HTMLDocument4_get_media,
2527 HTMLDocument4_createEventObject,
2528 HTMLDocument4_fireEvent,
2529 HTMLDocument4_createRenderStyle,
2530 HTMLDocument4_put_oncontrolselect,
2531 HTMLDocument4_get_oncontrolselect,
2532 HTMLDocument4_get_URLEncoded
2535 static inline HTMLDocument *impl_from_IHTMLDocument5(IHTMLDocument5 *iface)
2537 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument5_iface);
2540 static HRESULT WINAPI HTMLDocument5_QueryInterface(IHTMLDocument5 *iface,
2541 REFIID riid, void **ppv)
2543 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2544 return htmldoc_query_interface(This, riid, ppv);
2547 static ULONG WINAPI HTMLDocument5_AddRef(IHTMLDocument5 *iface)
2549 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2550 return htmldoc_addref(This);
2553 static ULONG WINAPI HTMLDocument5_Release(IHTMLDocument5 *iface)
2555 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2556 return htmldoc_release(This);
2559 static HRESULT WINAPI HTMLDocument5_GetTypeInfoCount(IHTMLDocument5 *iface, UINT *pctinfo)
2561 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2562 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
2565 static HRESULT WINAPI HTMLDocument5_GetTypeInfo(IHTMLDocument5 *iface, UINT iTInfo,
2566 LCID lcid, ITypeInfo **ppTInfo)
2568 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2569 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2572 static HRESULT WINAPI HTMLDocument5_GetIDsOfNames(IHTMLDocument5 *iface, REFIID riid,
2573 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
2575 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2576 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
2577 rgDispId);
2580 static HRESULT WINAPI HTMLDocument5_Invoke(IHTMLDocument5 *iface, DISPID dispIdMember,
2581 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2582 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2584 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2585 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2586 pDispParams, pVarResult, pExcepInfo, puArgErr);
2589 static HRESULT WINAPI HTMLDocument5_put_onmousewheel(IHTMLDocument5 *iface, VARIANT v)
2591 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2592 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2593 return E_NOTIMPL;
2596 static HRESULT WINAPI HTMLDocument5_get_onmousewheel(IHTMLDocument5 *iface, VARIANT *p)
2598 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2599 FIXME("(%p)->(%p)\n", This, p);
2600 return E_NOTIMPL;
2603 static HRESULT WINAPI HTMLDocument5_get_doctype(IHTMLDocument5 *iface, IHTMLDOMNode **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_implementation(IHTMLDocument5 *iface, IHTMLDOMImplementation **p)
2612 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2613 HTMLDocumentNode *doc_node = This->doc_node;
2615 TRACE("(%p)->(%p)\n", This, p);
2617 if(!doc_node->dom_implementation) {
2618 HRESULT hres;
2620 hres = create_dom_implementation(&doc_node->dom_implementation);
2621 if(FAILED(hres))
2622 return hres;
2625 IHTMLDOMImplementation_AddRef(doc_node->dom_implementation);
2626 *p = doc_node->dom_implementation;
2627 return S_OK;
2630 static HRESULT WINAPI HTMLDocument5_createAttribute(IHTMLDocument5 *iface, BSTR bstrattrName,
2631 IHTMLDOMAttribute **ppattribute)
2633 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2634 HTMLDOMAttribute *attr;
2635 HRESULT hres;
2637 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrattrName), ppattribute);
2639 hres = HTMLDOMAttribute_Create(bstrattrName, NULL, 0, &attr);
2640 if(FAILED(hres))
2641 return hres;
2643 *ppattribute = &attr->IHTMLDOMAttribute_iface;
2644 return S_OK;
2647 static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bstrdata,
2648 IHTMLDOMNode **ppRetNode)
2650 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2651 nsIDOMComment *nscomment;
2652 HTMLElement *elem;
2653 nsAString str;
2654 nsresult nsres;
2655 HRESULT hres;
2657 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrdata), ppRetNode);
2659 if(!This->doc_node->nsdoc) {
2660 WARN("NULL nsdoc\n");
2661 return E_UNEXPECTED;
2664 nsAString_InitDepend(&str, bstrdata);
2665 nsres = nsIDOMHTMLDocument_CreateComment(This->doc_node->nsdoc, &str, &nscomment);
2666 nsAString_Finish(&str);
2667 if(NS_FAILED(nsres)) {
2668 ERR("CreateTextNode failed: %08x\n", nsres);
2669 return E_FAIL;
2672 hres = HTMLCommentElement_Create(This->doc_node, (nsIDOMNode*)nscomment, &elem);
2673 nsIDOMComment_Release(nscomment);
2674 if(FAILED(hres))
2675 return hres;
2677 *ppRetNode = &elem->node.IHTMLDOMNode_iface;
2678 return S_OK;
2681 static HRESULT WINAPI HTMLDocument5_put_onfocusin(IHTMLDocument5 *iface, VARIANT v)
2683 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2684 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2685 return E_NOTIMPL;
2688 static HRESULT WINAPI HTMLDocument5_get_onfocusin(IHTMLDocument5 *iface, VARIANT *p)
2690 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2691 FIXME("(%p)->(%p)\n", This, p);
2692 return E_NOTIMPL;
2695 static HRESULT WINAPI HTMLDocument5_put_onfocusout(IHTMLDocument5 *iface, VARIANT v)
2697 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2698 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2699 return E_NOTIMPL;
2702 static HRESULT WINAPI HTMLDocument5_get_onfocusout(IHTMLDocument5 *iface, VARIANT *p)
2704 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2705 FIXME("(%p)->(%p)\n", This, p);
2706 return E_NOTIMPL;
2709 static HRESULT WINAPI HTMLDocument5_put_onactivate(IHTMLDocument5 *iface, VARIANT v)
2711 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2712 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2713 return E_NOTIMPL;
2716 static HRESULT WINAPI HTMLDocument5_get_onactivate(IHTMLDocument5 *iface, VARIANT *p)
2718 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2719 FIXME("(%p)->(%p)\n", This, p);
2720 return E_NOTIMPL;
2723 static HRESULT WINAPI HTMLDocument5_put_ondeactivate(IHTMLDocument5 *iface, VARIANT v)
2725 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2726 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2727 return E_NOTIMPL;
2730 static HRESULT WINAPI HTMLDocument5_get_ondeactivate(IHTMLDocument5 *iface, VARIANT *p)
2732 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2733 FIXME("(%p)->(%p)\n", This, p);
2734 return E_NOTIMPL;
2737 static HRESULT WINAPI HTMLDocument5_put_onbeforeactivate(IHTMLDocument5 *iface, VARIANT v)
2739 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2740 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2741 return E_NOTIMPL;
2744 static HRESULT WINAPI HTMLDocument5_get_onbeforeactivate(IHTMLDocument5 *iface, VARIANT *p)
2746 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2747 FIXME("(%p)->(%p)\n", This, p);
2748 return E_NOTIMPL;
2751 static HRESULT WINAPI HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5 *iface, VARIANT v)
2753 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2754 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2755 return E_NOTIMPL;
2758 static HRESULT WINAPI HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5 *iface, VARIANT *p)
2760 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2761 FIXME("(%p)->(%p)\n", This, p);
2762 return E_NOTIMPL;
2765 static HRESULT WINAPI HTMLDocument5_get_compatMode(IHTMLDocument5 *iface, BSTR *p)
2767 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2768 nsAString mode_str;
2769 const PRUnichar *mode;
2771 TRACE("(%p)->(%p)\n", This, p);
2773 if(!This->doc_node->nsdoc) {
2774 WARN("NULL nsdoc\n");
2775 return E_UNEXPECTED;
2778 nsAString_Init(&mode_str, NULL);
2779 nsIDOMHTMLDocument_GetCompatMode(This->doc_node->nsdoc, &mode_str);
2781 nsAString_GetData(&mode_str, &mode);
2782 *p = SysAllocString(mode);
2783 nsAString_Finish(&mode_str);
2785 return S_OK;
2788 static const IHTMLDocument5Vtbl HTMLDocument5Vtbl = {
2789 HTMLDocument5_QueryInterface,
2790 HTMLDocument5_AddRef,
2791 HTMLDocument5_Release,
2792 HTMLDocument5_GetTypeInfoCount,
2793 HTMLDocument5_GetTypeInfo,
2794 HTMLDocument5_GetIDsOfNames,
2795 HTMLDocument5_Invoke,
2796 HTMLDocument5_put_onmousewheel,
2797 HTMLDocument5_get_onmousewheel,
2798 HTMLDocument5_get_doctype,
2799 HTMLDocument5_get_implementation,
2800 HTMLDocument5_createAttribute,
2801 HTMLDocument5_createComment,
2802 HTMLDocument5_put_onfocusin,
2803 HTMLDocument5_get_onfocusin,
2804 HTMLDocument5_put_onfocusout,
2805 HTMLDocument5_get_onfocusout,
2806 HTMLDocument5_put_onactivate,
2807 HTMLDocument5_get_onactivate,
2808 HTMLDocument5_put_ondeactivate,
2809 HTMLDocument5_get_ondeactivate,
2810 HTMLDocument5_put_onbeforeactivate,
2811 HTMLDocument5_get_onbeforeactivate,
2812 HTMLDocument5_put_onbeforedeactivate,
2813 HTMLDocument5_get_onbeforedeactivate,
2814 HTMLDocument5_get_compatMode
2817 static inline HTMLDocument *impl_from_IHTMLDocument6(IHTMLDocument6 *iface)
2819 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument6_iface);
2822 static HRESULT WINAPI HTMLDocument6_QueryInterface(IHTMLDocument6 *iface,
2823 REFIID riid, void **ppv)
2825 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2826 return htmldoc_query_interface(This, riid, ppv);
2829 static ULONG WINAPI HTMLDocument6_AddRef(IHTMLDocument6 *iface)
2831 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2832 return htmldoc_addref(This);
2835 static ULONG WINAPI HTMLDocument6_Release(IHTMLDocument6 *iface)
2837 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2838 return htmldoc_release(This);
2841 static HRESULT WINAPI HTMLDocument6_GetTypeInfoCount(IHTMLDocument6 *iface, UINT *pctinfo)
2843 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2844 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
2847 static HRESULT WINAPI HTMLDocument6_GetTypeInfo(IHTMLDocument6 *iface, UINT iTInfo,
2848 LCID lcid, ITypeInfo **ppTInfo)
2850 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2851 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2854 static HRESULT WINAPI HTMLDocument6_GetIDsOfNames(IHTMLDocument6 *iface, REFIID riid,
2855 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
2857 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2858 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
2859 rgDispId);
2862 static HRESULT WINAPI HTMLDocument6_Invoke(IHTMLDocument6 *iface, DISPID dispIdMember,
2863 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2864 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2866 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2867 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2868 pDispParams, pVarResult, pExcepInfo, puArgErr);
2871 static HRESULT WINAPI HTMLDocument6_get_compatible(IHTMLDocument6 *iface,
2872 IHTMLDocumentCompatibleInfoCollection **p)
2874 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2875 FIXME("(%p)->(%p)\n", This, p);
2876 return E_NOTIMPL;
2879 static HRESULT WINAPI HTMLDocument6_get_documentMode(IHTMLDocument6 *iface,
2880 VARIANT *p)
2882 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2883 FIXME("(%p)->(%p)\n", This, p);
2884 return E_NOTIMPL;
2887 static HRESULT WINAPI HTMLDocument6_get_onstorage(IHTMLDocument6 *iface,
2888 VARIANT *p)
2890 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2891 FIXME("(%p)->(%p)\n", This, p);
2892 return E_NOTIMPL;
2895 static HRESULT WINAPI HTMLDocument6_put_onstorage(IHTMLDocument6 *iface, VARIANT v)
2897 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2898 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2899 return E_NOTIMPL;
2902 static HRESULT WINAPI HTMLDocument6_get_onstoragecommit(IHTMLDocument6 *iface,
2903 VARIANT *p)
2905 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2906 FIXME("(%p)->(%p)\n", This, p);
2907 return E_NOTIMPL;
2910 static HRESULT WINAPI HTMLDocument6_put_onstoragecommit(IHTMLDocument6 *iface, VARIANT v)
2912 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2913 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2914 return E_NOTIMPL;
2917 static HRESULT WINAPI HTMLDocument6_getElementById(IHTMLDocument6 *iface,
2918 BSTR bstrId, IHTMLElement2 **p)
2920 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2921 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrId), p);
2922 return E_NOTIMPL;
2925 static HRESULT WINAPI HTMLDocument6_updateSettings(IHTMLDocument6 *iface)
2927 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2928 FIXME("(%p)->()\n", This);
2929 return E_NOTIMPL;
2932 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl = {
2933 HTMLDocument6_QueryInterface,
2934 HTMLDocument6_AddRef,
2935 HTMLDocument6_Release,
2936 HTMLDocument6_GetTypeInfoCount,
2937 HTMLDocument6_GetTypeInfo,
2938 HTMLDocument6_GetIDsOfNames,
2939 HTMLDocument6_Invoke,
2940 HTMLDocument6_get_compatible,
2941 HTMLDocument6_get_documentMode,
2942 HTMLDocument6_put_onstorage,
2943 HTMLDocument6_get_onstorage,
2944 HTMLDocument6_put_onstoragecommit,
2945 HTMLDocument6_get_onstoragecommit,
2946 HTMLDocument6_getElementById,
2947 HTMLDocument6_updateSettings
2950 static inline HTMLDocument *impl_from_IHTMLDocument7(IHTMLDocument7 *iface)
2952 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument7_iface);
2955 static HRESULT WINAPI HTMLDocument7_QueryInterface(IHTMLDocument7 *iface, REFIID riid, void **ppv)
2957 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2958 return htmldoc_query_interface(This, riid, ppv);
2961 static ULONG WINAPI HTMLDocument7_AddRef(IHTMLDocument7 *iface)
2963 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2964 return htmldoc_addref(This);
2967 static ULONG WINAPI HTMLDocument7_Release(IHTMLDocument7 *iface)
2969 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2970 return htmldoc_release(This);
2973 static HRESULT WINAPI HTMLDocument7_GetTypeInfoCount(IHTMLDocument7 *iface, UINT *pctinfo)
2975 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2976 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
2979 static HRESULT WINAPI HTMLDocument7_GetTypeInfo(IHTMLDocument7 *iface, UINT iTInfo,
2980 LCID lcid, ITypeInfo **ppTInfo)
2982 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2983 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2986 static HRESULT WINAPI HTMLDocument7_GetIDsOfNames(IHTMLDocument7 *iface, REFIID riid,
2987 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
2989 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2990 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
2991 rgDispId);
2994 static HRESULT WINAPI HTMLDocument7_Invoke(IHTMLDocument7 *iface, DISPID dispIdMember,
2995 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2996 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2998 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
2999 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
3000 pDispParams, pVarResult, pExcepInfo, puArgErr);
3003 static HRESULT WINAPI HTMLDocument7_get_defaultView(IHTMLDocument7 *iface, IHTMLWindow2 **p)
3005 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3006 FIXME("(%p)->(%p)\n", This, p);
3007 return E_NOTIMPL;
3010 static HRESULT WINAPI HTMLDocument7_createCDATASection(IHTMLDocument7 *iface, BSTR text, IHTMLDOMNode **newCDATASectionNode)
3012 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3013 FIXME("(%p)->(%p)\n", This, newCDATASectionNode);
3014 return E_NOTIMPL;
3017 static HRESULT WINAPI HTMLDocument7_getSelection(IHTMLDocument7 *iface, IHTMLSelection **ppIHTMLSelection)
3019 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3020 FIXME("(%p)->(%p)\n", This, ppIHTMLSelection);
3021 return E_NOTIMPL;
3024 static HRESULT WINAPI HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7 *iface, VARIANT *pvarNS,
3025 BSTR bstrLocalName, IHTMLElementCollection **pelColl)
3027 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3028 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrLocalName), pelColl);
3029 return E_NOTIMPL;
3032 static HRESULT WINAPI HTMLDocument7_createElementNS(IHTMLDocument7 *iface, VARIANT *pvarNS, BSTR bstrTag, IHTMLElement **newElem)
3034 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3035 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrTag), newElem);
3036 return E_NOTIMPL;
3039 static HRESULT WINAPI HTMLDocument7_createAttributeNS(IHTMLDocument7 *iface, VARIANT *pvarNS,
3040 BSTR bstrAttrName, IHTMLDOMAttribute **ppAttribute)
3042 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3043 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrAttrName), ppAttribute);
3044 return E_NOTIMPL;
3047 static HRESULT WINAPI HTMLDocument7_put_onmsthumbnailclick(IHTMLDocument7 *iface, VARIANT v)
3049 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3050 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3051 return E_NOTIMPL;
3054 static HRESULT WINAPI HTMLDocument7_get_onmsthumbnailclick(IHTMLDocument7 *iface, VARIANT *p)
3056 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3057 FIXME("(%p)->(%p)\n", This, p);
3058 return E_NOTIMPL;
3061 static HRESULT WINAPI HTMLDocument7_get_characterSet(IHTMLDocument7 *iface, BSTR *p)
3063 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3064 FIXME("(%p)->(%p)\n", This, p);
3065 return E_NOTIMPL;
3068 static HRESULT WINAPI HTMLDocument7_createElement(IHTMLDocument7 *iface, BSTR bstrTag, IHTMLElement **newElem)
3070 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3071 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrTag), newElem);
3072 return E_NOTIMPL;
3075 static HRESULT WINAPI HTMLDocument7_createAttribute(IHTMLDocument7 *iface, BSTR bstrAttrName, IHTMLDOMAttribute **ppAttribute)
3077 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3078 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrAttrName), ppAttribute);
3079 return E_NOTIMPL;
3082 static HRESULT WINAPI HTMLDocument7_getElementByClassName(IHTMLDocument7 *iface, BSTR v, IHTMLElementCollection **pel)
3084 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3085 FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
3086 return E_NOTIMPL;
3089 static HRESULT WINAPI HTMLDocument7_createProcessingInstruction(IHTMLDocument7 *iface, BSTR target,
3090 BSTR data, IDOMProcessingInstruction **newProcessingInstruction)
3092 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3093 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(target), debugstr_w(data), newProcessingInstruction);
3094 return E_NOTIMPL;
3097 static HRESULT WINAPI HTMLDocument7_adoptNode(IHTMLDocument7 *iface, IHTMLDOMNode *pNodeSource, IHTMLDOMNode3 **ppNodeDest)
3099 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3100 FIXME("(%p)->(%p %p)\n", This, pNodeSource, ppNodeDest);
3101 return E_NOTIMPL;
3104 static HRESULT WINAPI HTMLDocument7_put_onmssitemodejumplistitemremoved(IHTMLDocument7 *iface, VARIANT v)
3106 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3107 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3108 return E_NOTIMPL;
3111 static HRESULT WINAPI HTMLDocument7_get_onmssitemodejumplistitemremoved(IHTMLDocument7 *iface, VARIANT *p)
3113 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3114 FIXME("(%p)->(%p)\n", This, p);
3115 return E_NOTIMPL;
3118 static HRESULT WINAPI HTMLDocument7_get_all(IHTMLDocument7 *iface, IHTMLElementCollection **p)
3120 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3121 FIXME("(%p)->(%p)\n", This, p);
3122 return E_NOTIMPL;
3125 static HRESULT WINAPI HTMLDocument7_get_inputEncoding(IHTMLDocument7 *iface, BSTR *p)
3127 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3128 FIXME("(%p)->(%p)\n", This, p);
3129 return E_NOTIMPL;
3132 static HRESULT WINAPI HTMLDocument7_get_xmlEncoding(IHTMLDocument7 *iface, BSTR *p)
3134 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3135 FIXME("(%p)->(%p)\n", This, p);
3136 return E_NOTIMPL;
3139 static HRESULT WINAPI HTMLDocument7_put_xmlStandalone(IHTMLDocument7 *iface, VARIANT_BOOL v)
3141 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3142 FIXME("(%p)->(%x)\n", This, v);
3143 return E_NOTIMPL;
3146 static HRESULT WINAPI HTMLDocument7_get_xmlStandalone(IHTMLDocument7 *iface, VARIANT_BOOL *p)
3148 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3149 FIXME("(%p)->(%p)\n", This, p);
3150 return E_NOTIMPL;
3153 static HRESULT WINAPI HTMLDocument7_put_xmlVersion(IHTMLDocument7 *iface, BSTR v)
3155 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3156 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
3157 return E_NOTIMPL;
3160 static HRESULT WINAPI HTMLDocument7_get_xmlVersion(IHTMLDocument7 *iface, BSTR *p)
3162 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3163 FIXME("(%p)->(%p)\n", This, p);
3164 return E_NOTIMPL;
3167 static HRESULT WINAPI HTMLDocument7_hasAttributes(IHTMLDocument7 *iface, VARIANT_BOOL *pfHasAttributes)
3169 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3170 FIXME("(%p)->(%p)\n", This, pfHasAttributes);
3171 return E_NOTIMPL;
3174 static HRESULT WINAPI HTMLDocument7_put_onabort(IHTMLDocument7 *iface, VARIANT v)
3176 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3177 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3178 return E_NOTIMPL;
3181 static HRESULT WINAPI HTMLDocument7_get_onabort(IHTMLDocument7 *iface, VARIANT *p)
3183 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3184 FIXME("(%p)->(%p)\n", This, p);
3185 return E_NOTIMPL;
3188 static HRESULT WINAPI HTMLDocument7_put_onblur(IHTMLDocument7 *iface, VARIANT v)
3190 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3191 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3192 return E_NOTIMPL;
3195 static HRESULT WINAPI HTMLDocument7_get_onblur(IHTMLDocument7 *iface, VARIANT *p)
3197 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3198 FIXME("(%p)->(%p)\n", This, p);
3199 return E_NOTIMPL;
3202 static HRESULT WINAPI HTMLDocument7_put_oncanplay(IHTMLDocument7 *iface, VARIANT v)
3204 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3205 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3206 return E_NOTIMPL;
3209 static HRESULT WINAPI HTMLDocument7_get_oncanplay(IHTMLDocument7 *iface, VARIANT *p)
3211 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3212 FIXME("(%p)->(%p)\n", This, p);
3213 return E_NOTIMPL;
3216 static HRESULT WINAPI HTMLDocument7_put_oncanplaythrough(IHTMLDocument7 *iface, VARIANT v)
3218 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3219 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3220 return E_NOTIMPL;
3223 static HRESULT WINAPI HTMLDocument7_get_oncanplaythrough(IHTMLDocument7 *iface, VARIANT *p)
3225 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3226 FIXME("(%p)->(%p)\n", This, p);
3227 return E_NOTIMPL;
3230 static HRESULT WINAPI HTMLDocument7_put_onchange(IHTMLDocument7 *iface, VARIANT v)
3232 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3233 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3234 return E_NOTIMPL;
3237 static HRESULT WINAPI HTMLDocument7_get_onchange(IHTMLDocument7 *iface, VARIANT *p)
3239 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3240 FIXME("(%p)->(%p)\n", This, p);
3241 return E_NOTIMPL;
3244 static HRESULT WINAPI HTMLDocument7_put_ondrag(IHTMLDocument7 *iface, VARIANT v)
3246 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3247 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3248 return E_NOTIMPL;
3251 static HRESULT WINAPI HTMLDocument7_get_ondrag(IHTMLDocument7 *iface, VARIANT *p)
3253 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3254 FIXME("(%p)->(%p)\n", This, p);
3255 return E_NOTIMPL;
3258 static HRESULT WINAPI HTMLDocument7_put_ondragend(IHTMLDocument7 *iface, VARIANT v)
3260 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3261 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3262 return E_NOTIMPL;
3265 static HRESULT WINAPI HTMLDocument7_get_ondragend(IHTMLDocument7 *iface, VARIANT *p)
3267 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3268 FIXME("(%p)->(%p)\n", This, p);
3269 return E_NOTIMPL;
3272 static HRESULT WINAPI HTMLDocument7_put_ondragenter(IHTMLDocument7 *iface, VARIANT v)
3274 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3275 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3276 return E_NOTIMPL;
3279 static HRESULT WINAPI HTMLDocument7_get_ondragenter(IHTMLDocument7 *iface, VARIANT *p)
3281 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3282 FIXME("(%p)->(%p)\n", This, p);
3283 return E_NOTIMPL;
3286 static HRESULT WINAPI HTMLDocument7_put_ondragleave(IHTMLDocument7 *iface, VARIANT v)
3288 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3289 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3290 return E_NOTIMPL;
3293 static HRESULT WINAPI HTMLDocument7_get_ondragleave(IHTMLDocument7 *iface, VARIANT *p)
3295 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3296 FIXME("(%p)->(%p)\n", This, p);
3297 return E_NOTIMPL;
3300 static HRESULT WINAPI HTMLDocument7_put_ondragover(IHTMLDocument7 *iface, VARIANT v)
3302 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3303 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3304 return E_NOTIMPL;
3307 static HRESULT WINAPI HTMLDocument7_get_ondragover(IHTMLDocument7 *iface, VARIANT *p)
3309 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3310 FIXME("(%p)->(%p)\n", This, p);
3311 return E_NOTIMPL;
3314 static HRESULT WINAPI HTMLDocument7_put_ondrop(IHTMLDocument7 *iface, VARIANT v)
3316 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3317 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3318 return E_NOTIMPL;
3321 static HRESULT WINAPI HTMLDocument7_get_ondrop(IHTMLDocument7 *iface, VARIANT *p)
3323 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3324 FIXME("(%p)->(%p)\n", This, p);
3325 return E_NOTIMPL;
3328 static HRESULT WINAPI HTMLDocument7_put_ondurationchange(IHTMLDocument7 *iface, VARIANT v)
3330 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3331 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3332 return E_NOTIMPL;
3335 static HRESULT WINAPI HTMLDocument7_get_ondurationchange(IHTMLDocument7 *iface, VARIANT *p)
3337 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3338 FIXME("(%p)->(%p)\n", This, p);
3339 return E_NOTIMPL;
3342 static HRESULT WINAPI HTMLDocument7_put_onemptied(IHTMLDocument7 *iface, VARIANT v)
3344 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3345 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3346 return E_NOTIMPL;
3349 static HRESULT WINAPI HTMLDocument7_get_onemptied(IHTMLDocument7 *iface, VARIANT *p)
3351 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3352 FIXME("(%p)->(%p)\n", This, p);
3353 return E_NOTIMPL;
3356 static HRESULT WINAPI HTMLDocument7_put_onended(IHTMLDocument7 *iface, VARIANT v)
3358 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3359 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3360 return E_NOTIMPL;
3363 static HRESULT WINAPI HTMLDocument7_get_onended(IHTMLDocument7 *iface, VARIANT *p)
3365 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3366 FIXME("(%p)->(%p)\n", This, p);
3367 return E_NOTIMPL;
3370 static HRESULT WINAPI HTMLDocument7_put_onerror(IHTMLDocument7 *iface, VARIANT v)
3372 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3373 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3374 return E_NOTIMPL;
3377 static HRESULT WINAPI HTMLDocument7_get_onerror(IHTMLDocument7 *iface, VARIANT *p)
3379 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3380 FIXME("(%p)->(%p)\n", This, p);
3381 return E_NOTIMPL;
3384 static HRESULT WINAPI HTMLDocument7_put_onfocus(IHTMLDocument7 *iface, VARIANT v)
3386 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3387 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3388 return E_NOTIMPL;
3391 static HRESULT WINAPI HTMLDocument7_get_onfocus(IHTMLDocument7 *iface, VARIANT *p)
3393 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3394 FIXME("(%p)->(%p)\n", This, p);
3395 return E_NOTIMPL;
3398 static HRESULT WINAPI HTMLDocument7_put_oninput(IHTMLDocument7 *iface, VARIANT v)
3400 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3401 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3402 return E_NOTIMPL;
3405 static HRESULT WINAPI HTMLDocument7_get_oninput(IHTMLDocument7 *iface, VARIANT *p)
3407 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3408 FIXME("(%p)->(%p)\n", This, p);
3409 return E_NOTIMPL;
3412 static HRESULT WINAPI HTMLDocument7_put_onload(IHTMLDocument7 *iface, VARIANT v)
3414 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3415 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3416 return E_NOTIMPL;
3419 static HRESULT WINAPI HTMLDocument7_get_onload(IHTMLDocument7 *iface, VARIANT *p)
3421 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3422 FIXME("(%p)->(%p)\n", This, p);
3423 return E_NOTIMPL;
3426 static HRESULT WINAPI HTMLDocument7_put_onloadeddata(IHTMLDocument7 *iface, VARIANT v)
3428 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3429 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3430 return E_NOTIMPL;
3433 static HRESULT WINAPI HTMLDocument7_get_onloadeddata(IHTMLDocument7 *iface, VARIANT *p)
3435 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3436 FIXME("(%p)->(%p)\n", This, p);
3437 return E_NOTIMPL;
3440 static HRESULT WINAPI HTMLDocument7_put_onloadedmetadata(IHTMLDocument7 *iface, VARIANT v)
3442 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3443 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3444 return E_NOTIMPL;
3447 static HRESULT WINAPI HTMLDocument7_get_onloadedmetadata(IHTMLDocument7 *iface, VARIANT *p)
3449 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3450 FIXME("(%p)->(%p)\n", This, p);
3451 return E_NOTIMPL;
3454 static HRESULT WINAPI HTMLDocument7_put_onloadstart(IHTMLDocument7 *iface, VARIANT v)
3456 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3457 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3458 return E_NOTIMPL;
3461 static HRESULT WINAPI HTMLDocument7_get_onloadstart(IHTMLDocument7 *iface, VARIANT *p)
3463 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3464 FIXME("(%p)->(%p)\n", This, p);
3465 return E_NOTIMPL;
3468 static HRESULT WINAPI HTMLDocument7_put_onpause(IHTMLDocument7 *iface, VARIANT v)
3470 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3471 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3472 return E_NOTIMPL;
3475 static HRESULT WINAPI HTMLDocument7_get_onpause(IHTMLDocument7 *iface, VARIANT *p)
3477 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3478 FIXME("(%p)->(%p)\n", This, p);
3479 return E_NOTIMPL;
3482 static HRESULT WINAPI HTMLDocument7_put_onplay(IHTMLDocument7 *iface, VARIANT v)
3484 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3485 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3486 return E_NOTIMPL;
3489 static HRESULT WINAPI HTMLDocument7_get_onplay(IHTMLDocument7 *iface, VARIANT *p)
3491 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3492 FIXME("(%p)->(%p)\n", This, p);
3493 return E_NOTIMPL;
3496 static HRESULT WINAPI HTMLDocument7_put_onplaying(IHTMLDocument7 *iface, VARIANT v)
3498 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3499 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3500 return E_NOTIMPL;
3503 static HRESULT WINAPI HTMLDocument7_get_onplaying(IHTMLDocument7 *iface, VARIANT *p)
3505 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3506 FIXME("(%p)->(%p)\n", This, p);
3507 return E_NOTIMPL;
3510 static HRESULT WINAPI HTMLDocument7_put_onprogress(IHTMLDocument7 *iface, VARIANT v)
3512 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3513 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3514 return E_NOTIMPL;
3517 static HRESULT WINAPI HTMLDocument7_get_onprogress(IHTMLDocument7 *iface, VARIANT *p)
3519 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3520 FIXME("(%p)->(%p)\n", This, p);
3521 return E_NOTIMPL;
3524 static HRESULT WINAPI HTMLDocument7_put_onratechange(IHTMLDocument7 *iface, VARIANT v)
3526 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3527 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3528 return E_NOTIMPL;
3531 static HRESULT WINAPI HTMLDocument7_get_onratechange(IHTMLDocument7 *iface, VARIANT *p)
3533 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3534 FIXME("(%p)->(%p)\n", This, p);
3535 return E_NOTIMPL;
3538 static HRESULT WINAPI HTMLDocument7_put_onreset(IHTMLDocument7 *iface, VARIANT v)
3540 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3541 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3542 return E_NOTIMPL;
3545 static HRESULT WINAPI HTMLDocument7_get_onreset(IHTMLDocument7 *iface, VARIANT *p)
3547 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3548 FIXME("(%p)->(%p)\n", This, p);
3549 return E_NOTIMPL;
3552 static HRESULT WINAPI HTMLDocument7_put_onscroll(IHTMLDocument7 *iface, VARIANT v)
3554 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3555 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3556 return E_NOTIMPL;
3559 static HRESULT WINAPI HTMLDocument7_get_onscroll(IHTMLDocument7 *iface, VARIANT *p)
3561 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3562 FIXME("(%p)->(%p)\n", This, p);
3563 return E_NOTIMPL;
3566 static HRESULT WINAPI HTMLDocument7_put_onseekend(IHTMLDocument7 *iface, VARIANT v)
3568 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3569 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3570 return E_NOTIMPL;
3573 static HRESULT WINAPI HTMLDocument7_get_onseekend(IHTMLDocument7 *iface, VARIANT *p)
3575 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3576 FIXME("(%p)->(%p)\n", This, p);
3577 return E_NOTIMPL;
3580 static HRESULT WINAPI HTMLDocument7_put_onseeking(IHTMLDocument7 *iface, VARIANT v)
3582 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3583 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3584 return E_NOTIMPL;
3587 static HRESULT WINAPI HTMLDocument7_get_onseeking(IHTMLDocument7 *iface, VARIANT *p)
3589 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3590 FIXME("(%p)->(%p)\n", This, p);
3591 return E_NOTIMPL;
3594 static HRESULT WINAPI HTMLDocument7_put_onselect(IHTMLDocument7 *iface, VARIANT v)
3596 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3597 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3598 return E_NOTIMPL;
3601 static HRESULT WINAPI HTMLDocument7_get_onselect(IHTMLDocument7 *iface, VARIANT *p)
3603 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3604 FIXME("(%p)->(%p)\n", This, p);
3605 return E_NOTIMPL;
3608 static HRESULT WINAPI HTMLDocument7_put_onstalled(IHTMLDocument7 *iface, VARIANT v)
3610 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3611 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3612 return E_NOTIMPL;
3615 static HRESULT WINAPI HTMLDocument7_get_onstalled(IHTMLDocument7 *iface, VARIANT *p)
3617 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3618 FIXME("(%p)->(%p)\n", This, p);
3619 return E_NOTIMPL;
3622 static HRESULT WINAPI HTMLDocument7_put_onsubmit(IHTMLDocument7 *iface, VARIANT v)
3624 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3625 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3626 return E_NOTIMPL;
3629 static HRESULT WINAPI HTMLDocument7_get_onsubmit(IHTMLDocument7 *iface, VARIANT *p)
3631 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3632 FIXME("(%p)->(%p)\n", This, p);
3633 return E_NOTIMPL;
3636 static HRESULT WINAPI HTMLDocument7_put_onsuspend(IHTMLDocument7 *iface, VARIANT v)
3638 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3639 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3640 return E_NOTIMPL;
3643 static HRESULT WINAPI HTMLDocument7_get_onsuspend(IHTMLDocument7 *iface, VARIANT *p)
3645 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3646 FIXME("(%p)->(%p)\n", This, p);
3647 return E_NOTIMPL;
3650 static HRESULT WINAPI HTMLDocument7_put_ontimeupdate(IHTMLDocument7 *iface, VARIANT v)
3652 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3653 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3654 return E_NOTIMPL;
3657 static HRESULT WINAPI HTMLDocument7_get_ontimeupdate(IHTMLDocument7 *iface, VARIANT *p)
3659 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3660 FIXME("(%p)->(%p)\n", This, p);
3661 return E_NOTIMPL;
3664 static HRESULT WINAPI HTMLDocument7_put_onvolumechange(IHTMLDocument7 *iface, VARIANT v)
3666 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3667 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3668 return E_NOTIMPL;
3671 static HRESULT WINAPI HTMLDocument7_get_onvolumechange(IHTMLDocument7 *iface, VARIANT *p)
3673 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3674 FIXME("(%p)->(%p)\n", This, p);
3675 return E_NOTIMPL;
3678 static HRESULT WINAPI HTMLDocument7_put_onwaiting(IHTMLDocument7 *iface, VARIANT v)
3680 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3681 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3682 return E_NOTIMPL;
3685 static HRESULT WINAPI HTMLDocument7_get_onwaiting(IHTMLDocument7 *iface, VARIANT *p)
3687 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3688 FIXME("(%p)->(%p)\n", This, p);
3689 return E_NOTIMPL;
3692 static HRESULT WINAPI HTMLDocument7_normalize(IHTMLDocument7 *iface)
3694 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3695 FIXME("(%p)\n", This);
3696 return E_NOTIMPL;
3699 static HRESULT WINAPI HTMLDocument7_importNode(IHTMLDocument7 *iface, IHTMLDOMNode *pNodeSource,
3700 VARIANT_BOOL fDeep, IHTMLDOMNode3 **ppNodeDest)
3702 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3703 FIXME("(%p)->(%p %x %p)\n", This, pNodeSource, fDeep, ppNodeDest);
3704 return E_NOTIMPL;
3707 static HRESULT WINAPI HTMLDocument7_get_parentWindow(IHTMLDocument7 *iface, IHTMLWindow2 **p)
3709 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3710 FIXME("(%p)->(%p)\n", This, p);
3711 return E_NOTIMPL;
3714 static HRESULT WINAPI HTMLDocument7_put_body(IHTMLDocument7 *iface, IHTMLElement *v)
3716 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3717 FIXME("(%p)->(%p)\n", This, v);
3718 return E_NOTIMPL;
3721 static HRESULT WINAPI HTMLDocument7_get_body(IHTMLDocument7 *iface, IHTMLElement **p)
3723 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3724 FIXME("(%p)->(%p)\n", This, p);
3725 return E_NOTIMPL;
3728 static HRESULT WINAPI HTMLDocument7_get_head(IHTMLDocument7 *iface, IHTMLElement **p)
3730 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3731 FIXME("(%p)->(%p)\n", This, p);
3732 return E_NOTIMPL;
3735 static const IHTMLDocument7Vtbl HTMLDocument7Vtbl = {
3736 HTMLDocument7_QueryInterface,
3737 HTMLDocument7_AddRef,
3738 HTMLDocument7_Release,
3739 HTMLDocument7_GetTypeInfoCount,
3740 HTMLDocument7_GetTypeInfo,
3741 HTMLDocument7_GetIDsOfNames,
3742 HTMLDocument7_Invoke,
3743 HTMLDocument7_get_defaultView,
3744 HTMLDocument7_createCDATASection,
3745 HTMLDocument7_getSelection,
3746 HTMLDocument7_getElementsByTagNameNS,
3747 HTMLDocument7_createElementNS,
3748 HTMLDocument7_createAttributeNS,
3749 HTMLDocument7_put_onmsthumbnailclick,
3750 HTMLDocument7_get_onmsthumbnailclick,
3751 HTMLDocument7_get_characterSet,
3752 HTMLDocument7_createElement,
3753 HTMLDocument7_createAttribute,
3754 HTMLDocument7_getElementByClassName,
3755 HTMLDocument7_createProcessingInstruction,
3756 HTMLDocument7_adoptNode,
3757 HTMLDocument7_put_onmssitemodejumplistitemremoved,
3758 HTMLDocument7_get_onmssitemodejumplistitemremoved,
3759 HTMLDocument7_get_all,
3760 HTMLDocument7_get_inputEncoding,
3761 HTMLDocument7_get_xmlEncoding,
3762 HTMLDocument7_put_xmlStandalone,
3763 HTMLDocument7_get_xmlStandalone,
3764 HTMLDocument7_put_xmlVersion,
3765 HTMLDocument7_get_xmlVersion,
3766 HTMLDocument7_hasAttributes,
3767 HTMLDocument7_put_onabort,
3768 HTMLDocument7_get_onabort,
3769 HTMLDocument7_put_onblur,
3770 HTMLDocument7_get_onblur,
3771 HTMLDocument7_put_oncanplay,
3772 HTMLDocument7_get_oncanplay,
3773 HTMLDocument7_put_oncanplaythrough,
3774 HTMLDocument7_get_oncanplaythrough,
3775 HTMLDocument7_put_onchange,
3776 HTMLDocument7_get_onchange,
3777 HTMLDocument7_put_ondrag,
3778 HTMLDocument7_get_ondrag,
3779 HTMLDocument7_put_ondragend,
3780 HTMLDocument7_get_ondragend,
3781 HTMLDocument7_put_ondragenter,
3782 HTMLDocument7_get_ondragenter,
3783 HTMLDocument7_put_ondragleave,
3784 HTMLDocument7_get_ondragleave,
3785 HTMLDocument7_put_ondragover,
3786 HTMLDocument7_get_ondragover,
3787 HTMLDocument7_put_ondrop,
3788 HTMLDocument7_get_ondrop,
3789 HTMLDocument7_put_ondurationchange,
3790 HTMLDocument7_get_ondurationchange,
3791 HTMLDocument7_put_onemptied,
3792 HTMLDocument7_get_onemptied,
3793 HTMLDocument7_put_onended,
3794 HTMLDocument7_get_onended,
3795 HTMLDocument7_put_onerror,
3796 HTMLDocument7_get_onerror,
3797 HTMLDocument7_put_onfocus,
3798 HTMLDocument7_get_onfocus,
3799 HTMLDocument7_put_oninput,
3800 HTMLDocument7_get_oninput,
3801 HTMLDocument7_put_onload,
3802 HTMLDocument7_get_onload,
3803 HTMLDocument7_put_onloadeddata,
3804 HTMLDocument7_get_onloadeddata,
3805 HTMLDocument7_put_onloadedmetadata,
3806 HTMLDocument7_get_onloadedmetadata,
3807 HTMLDocument7_put_onloadstart,
3808 HTMLDocument7_get_onloadstart,
3809 HTMLDocument7_put_onpause,
3810 HTMLDocument7_get_onpause,
3811 HTMLDocument7_put_onplay,
3812 HTMLDocument7_get_onplay,
3813 HTMLDocument7_put_onplaying,
3814 HTMLDocument7_get_onplaying,
3815 HTMLDocument7_put_onprogress,
3816 HTMLDocument7_get_onprogress,
3817 HTMLDocument7_put_onratechange,
3818 HTMLDocument7_get_onratechange,
3819 HTMLDocument7_put_onreset,
3820 HTMLDocument7_get_onreset,
3821 HTMLDocument7_put_onscroll,
3822 HTMLDocument7_get_onscroll,
3823 HTMLDocument7_put_onseekend,
3824 HTMLDocument7_get_onseekend,
3825 HTMLDocument7_put_onseeking,
3826 HTMLDocument7_get_onseeking,
3827 HTMLDocument7_put_onselect,
3828 HTMLDocument7_get_onselect,
3829 HTMLDocument7_put_onstalled,
3830 HTMLDocument7_get_onstalled,
3831 HTMLDocument7_put_onsubmit,
3832 HTMLDocument7_get_onsubmit,
3833 HTMLDocument7_put_onsuspend,
3834 HTMLDocument7_get_onsuspend,
3835 HTMLDocument7_put_ontimeupdate,
3836 HTMLDocument7_get_ontimeupdate,
3837 HTMLDocument7_put_onvolumechange,
3838 HTMLDocument7_get_onvolumechange,
3839 HTMLDocument7_put_onwaiting,
3840 HTMLDocument7_get_onwaiting,
3841 HTMLDocument7_normalize,
3842 HTMLDocument7_importNode,
3843 HTMLDocument7_get_parentWindow,
3844 HTMLDocument7_put_body,
3845 HTMLDocument7_get_body,
3846 HTMLDocument7_get_head
3849 static void HTMLDocument_on_advise(IUnknown *iface, cp_static_data_t *cp)
3851 HTMLDocument *This = impl_from_IHTMLDocument2((IHTMLDocument2*)iface);
3853 if(This->window)
3854 update_cp_events(This->window->base.inner_window, &This->doc_node->node.event_target, cp);
3857 static inline HTMLDocument *impl_from_ISupportErrorInfo(ISupportErrorInfo *iface)
3859 return CONTAINING_RECORD(iface, HTMLDocument, ISupportErrorInfo_iface);
3862 static HRESULT WINAPI SupportErrorInfo_QueryInterface(ISupportErrorInfo *iface, REFIID riid, void **ppv)
3864 HTMLDocument *This = impl_from_ISupportErrorInfo(iface);
3865 return htmldoc_query_interface(This, riid, ppv);
3868 static ULONG WINAPI SupportErrorInfo_AddRef(ISupportErrorInfo *iface)
3870 HTMLDocument *This = impl_from_ISupportErrorInfo(iface);
3871 return htmldoc_addref(This);
3874 static ULONG WINAPI SupportErrorInfo_Release(ISupportErrorInfo *iface)
3876 HTMLDocument *This = impl_from_ISupportErrorInfo(iface);
3877 return htmldoc_release(This);
3880 static HRESULT WINAPI SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo *iface, REFIID riid)
3882 FIXME("(%p)->(%s)\n", iface, debugstr_mshtml_guid(riid));
3883 return S_FALSE;
3886 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl = {
3887 SupportErrorInfo_QueryInterface,
3888 SupportErrorInfo_AddRef,
3889 SupportErrorInfo_Release,
3890 SupportErrorInfo_InterfaceSupportsErrorInfo
3893 static inline HTMLDocument *impl_from_IDispatchEx(IDispatchEx *iface)
3895 return CONTAINING_RECORD(iface, HTMLDocument, IDispatchEx_iface);
3898 static HRESULT dispid_from_elem_name(HTMLDocumentNode *This, BSTR name, DISPID *dispid)
3900 nsIDOMNodeList *node_list;
3901 nsAString name_str;
3902 UINT32 len;
3903 unsigned i;
3904 nsresult nsres;
3906 if(!This->nsdoc)
3907 return DISP_E_UNKNOWNNAME;
3909 nsAString_InitDepend(&name_str, name);
3910 nsres = nsIDOMHTMLDocument_GetElementsByName(This->nsdoc, &name_str, &node_list);
3911 nsAString_Finish(&name_str);
3912 if(NS_FAILED(nsres))
3913 return E_FAIL;
3915 nsres = nsIDOMNodeList_GetLength(node_list, &len);
3916 nsIDOMNodeList_Release(node_list);
3917 if(NS_FAILED(nsres))
3918 return E_FAIL;
3920 if(!len)
3921 return DISP_E_UNKNOWNNAME;
3923 for(i=0; i < This->elem_vars_cnt; i++) {
3924 if(!strcmpW(name, This->elem_vars[i])) {
3925 *dispid = MSHTML_DISPID_CUSTOM_MIN+i;
3926 return S_OK;
3930 if(This->elem_vars_cnt == This->elem_vars_size) {
3931 WCHAR **new_vars;
3933 if(This->elem_vars_size) {
3934 new_vars = heap_realloc(This->elem_vars, This->elem_vars_size*2*sizeof(WCHAR*));
3935 if(!new_vars)
3936 return E_OUTOFMEMORY;
3937 This->elem_vars_size *= 2;
3938 }else {
3939 new_vars = heap_alloc(16*sizeof(WCHAR*));
3940 if(!new_vars)
3941 return E_OUTOFMEMORY;
3942 This->elem_vars_size = 16;
3945 This->elem_vars = new_vars;
3948 This->elem_vars[This->elem_vars_cnt] = heap_strdupW(name);
3949 if(!This->elem_vars[This->elem_vars_cnt])
3950 return E_OUTOFMEMORY;
3952 *dispid = MSHTML_DISPID_CUSTOM_MIN+This->elem_vars_cnt++;
3953 return S_OK;
3956 static HRESULT WINAPI DocDispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
3958 HTMLDocument *This = impl_from_IDispatchEx(iface);
3960 return htmldoc_query_interface(This, riid, ppv);
3963 static ULONG WINAPI DocDispatchEx_AddRef(IDispatchEx *iface)
3965 HTMLDocument *This = impl_from_IDispatchEx(iface);
3967 return htmldoc_addref(This);
3970 static ULONG WINAPI DocDispatchEx_Release(IDispatchEx *iface)
3972 HTMLDocument *This = impl_from_IDispatchEx(iface);
3974 return htmldoc_release(This);
3977 static HRESULT WINAPI DocDispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
3979 HTMLDocument *This = impl_from_IDispatchEx(iface);
3981 return IDispatchEx_GetTypeInfoCount(This->dispex, pctinfo);
3984 static HRESULT WINAPI DocDispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
3985 LCID lcid, ITypeInfo **ppTInfo)
3987 HTMLDocument *This = impl_from_IDispatchEx(iface);
3989 return IDispatchEx_GetTypeInfo(This->dispex, iTInfo, lcid, ppTInfo);
3992 static HRESULT WINAPI DocDispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
3993 LPOLESTR *rgszNames, UINT cNames,
3994 LCID lcid, DISPID *rgDispId)
3996 HTMLDocument *This = impl_from_IDispatchEx(iface);
3998 return IDispatchEx_GetIDsOfNames(This->dispex, riid, rgszNames, cNames, lcid, rgDispId);
4001 static HRESULT WINAPI DocDispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
4002 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
4003 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
4005 HTMLDocument *This = impl_from_IDispatchEx(iface);
4007 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
4008 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
4010 switch(dispIdMember) {
4011 case DISPID_READYSTATE:
4012 TRACE("DISPID_READYSTATE\n");
4014 if(!(wFlags & DISPATCH_PROPERTYGET))
4015 return E_INVALIDARG;
4017 V_VT(pVarResult) = VT_I4;
4018 V_I4(pVarResult) = This->window->readystate;
4019 return S_OK;
4022 return IDispatchEx_Invoke(This->dispex, dispIdMember, riid, lcid, wFlags, pDispParams,
4023 pVarResult, pExcepInfo, puArgErr);
4026 static HRESULT WINAPI DocDispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
4028 HTMLDocument *This = impl_from_IDispatchEx(iface);
4029 HRESULT hres;
4031 hres = IDispatchEx_GetDispID(This->dispex, bstrName, grfdex, pid);
4032 if(hres != DISP_E_UNKNOWNNAME)
4033 return hres;
4035 return dispid_from_elem_name(This->doc_node, bstrName, pid);
4038 static HRESULT WINAPI DocDispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
4039 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
4041 HTMLDocument *This = impl_from_IDispatchEx(iface);
4043 if(This->window && id == DISPID_IHTMLDOCUMENT2_LOCATION && (wFlags & DISPATCH_PROPERTYPUT))
4044 return IDispatchEx_InvokeEx(&This->window->base.IDispatchEx_iface, DISPID_IHTMLWINDOW2_LOCATION,
4045 lcid, wFlags, pdp, pvarRes, pei, pspCaller);
4048 return IDispatchEx_InvokeEx(This->dispex, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
4051 static HRESULT WINAPI DocDispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
4053 HTMLDocument *This = impl_from_IDispatchEx(iface);
4055 return IDispatchEx_DeleteMemberByName(This->dispex, bstrName, grfdex);
4058 static HRESULT WINAPI DocDispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
4060 HTMLDocument *This = impl_from_IDispatchEx(iface);
4062 return IDispatchEx_DeleteMemberByDispID(This->dispex, id);
4065 static HRESULT WINAPI DocDispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
4067 HTMLDocument *This = impl_from_IDispatchEx(iface);
4069 return IDispatchEx_GetMemberProperties(This->dispex, id, grfdexFetch, pgrfdex);
4072 static HRESULT WINAPI DocDispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
4074 HTMLDocument *This = impl_from_IDispatchEx(iface);
4076 return IDispatchEx_GetMemberName(This->dispex, id, pbstrName);
4079 static HRESULT WINAPI DocDispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
4081 HTMLDocument *This = impl_from_IDispatchEx(iface);
4083 return IDispatchEx_GetNextDispID(This->dispex, grfdex, id, pid);
4086 static HRESULT WINAPI DocDispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
4088 HTMLDocument *This = impl_from_IDispatchEx(iface);
4090 return IDispatchEx_GetNameSpaceParent(This->dispex, ppunk);
4093 static const IDispatchExVtbl DocDispatchExVtbl = {
4094 DocDispatchEx_QueryInterface,
4095 DocDispatchEx_AddRef,
4096 DocDispatchEx_Release,
4097 DocDispatchEx_GetTypeInfoCount,
4098 DocDispatchEx_GetTypeInfo,
4099 DocDispatchEx_GetIDsOfNames,
4100 DocDispatchEx_Invoke,
4101 DocDispatchEx_GetDispID,
4102 DocDispatchEx_InvokeEx,
4103 DocDispatchEx_DeleteMemberByName,
4104 DocDispatchEx_DeleteMemberByDispID,
4105 DocDispatchEx_GetMemberProperties,
4106 DocDispatchEx_GetMemberName,
4107 DocDispatchEx_GetNextDispID,
4108 DocDispatchEx_GetNameSpaceParent
4111 static inline HTMLDocument *impl_from_IProvideClassInfo(IProvideClassInfo *iface)
4113 return CONTAINING_RECORD(iface, HTMLDocument, IProvideClassInfo_iface);
4116 static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideClassInfo *iface,
4117 REFIID riid, void **ppv)
4119 HTMLDocument *This = impl_from_IProvideClassInfo(iface);
4120 return htmldoc_query_interface(This, riid, ppv);
4123 static ULONG WINAPI ProvideClassInfo_AddRef(IProvideClassInfo *iface)
4125 HTMLDocument *This = impl_from_IProvideClassInfo(iface);
4126 return htmldoc_addref(This);
4129 static ULONG WINAPI ProvideClassInfo_Release(IProvideClassInfo *iface)
4131 HTMLDocument *This = impl_from_IProvideClassInfo(iface);
4132 return htmldoc_release(This);
4135 static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideClassInfo* iface,
4136 ITypeInfo **ppTI)
4138 HTMLDocument *This = impl_from_IProvideClassInfo(iface);
4139 TRACE("(%p)->(%p)\n", This, ppTI);
4140 return get_htmldoc_classinfo(ppTI);
4143 static const IProvideClassInfoVtbl ProvideClassInfoVtbl = {
4144 ProvideClassInfo_QueryInterface,
4145 ProvideClassInfo_AddRef,
4146 ProvideClassInfo_Release,
4147 ProvideClassInfo_GetClassInfo
4150 static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
4152 *ppv = NULL;
4154 if(IsEqualGUID(&IID_IUnknown, riid))
4155 *ppv = &This->IHTMLDocument2_iface;
4156 else if(IsEqualGUID(&IID_IDispatch, riid))
4157 *ppv = &This->IDispatchEx_iface;
4158 else if(IsEqualGUID(&IID_IDispatchEx, riid))
4159 *ppv = &This->IDispatchEx_iface;
4160 else if(IsEqualGUID(&IID_IHTMLDocument, riid))
4161 *ppv = &This->IHTMLDocument2_iface;
4162 else if(IsEqualGUID(&IID_IHTMLDocument2, riid))
4163 *ppv = &This->IHTMLDocument2_iface;
4164 else if(IsEqualGUID(&IID_IHTMLDocument3, riid))
4165 *ppv = &This->IHTMLDocument3_iface;
4166 else if(IsEqualGUID(&IID_IHTMLDocument4, riid))
4167 *ppv = &This->IHTMLDocument4_iface;
4168 else if(IsEqualGUID(&IID_IHTMLDocument5, riid))
4169 *ppv = &This->IHTMLDocument5_iface;
4170 else if(IsEqualGUID(&IID_IHTMLDocument6, riid))
4171 *ppv = &This->IHTMLDocument6_iface;
4172 else if(IsEqualGUID(&IID_IHTMLDocument7, riid))
4173 *ppv = &This->IHTMLDocument7_iface;
4174 else if(IsEqualGUID(&IID_IPersist, riid))
4175 *ppv = &This->IPersistFile_iface;
4176 else if(IsEqualGUID(&IID_IPersistMoniker, riid))
4177 *ppv = &This->IPersistMoniker_iface;
4178 else if(IsEqualGUID(&IID_IPersistFile, riid))
4179 *ppv = &This->IPersistFile_iface;
4180 else if(IsEqualGUID(&IID_IMonikerProp, riid))
4181 *ppv = &This->IMonikerProp_iface;
4182 else if(IsEqualGUID(&IID_IOleObject, riid))
4183 *ppv = &This->IOleObject_iface;
4184 else if(IsEqualGUID(&IID_IOleDocument, riid))
4185 *ppv = &This->IOleDocument_iface;
4186 else if(IsEqualGUID(&IID_IOleDocumentView, riid))
4187 *ppv = &This->IOleDocumentView_iface;
4188 else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid))
4189 *ppv = &This->IOleInPlaceActiveObject_iface;
4190 else if(IsEqualGUID(&IID_IViewObject, riid))
4191 *ppv = &This->IViewObjectEx_iface;
4192 else if(IsEqualGUID(&IID_IViewObject2, riid))
4193 *ppv = &This->IViewObjectEx_iface;
4194 else if(IsEqualGUID(&IID_IViewObjectEx, riid))
4195 *ppv = &This->IViewObjectEx_iface;
4196 else if(IsEqualGUID(&IID_IOleWindow, riid))
4197 *ppv = &This->IOleInPlaceActiveObject_iface;
4198 else if(IsEqualGUID(&IID_IOleInPlaceObject, riid))
4199 *ppv = &This->IOleInPlaceObjectWindowless_iface;
4200 else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid))
4201 *ppv = &This->IOleInPlaceObjectWindowless_iface;
4202 else if(IsEqualGUID(&IID_IServiceProvider, riid))
4203 *ppv = &This->IServiceProvider_iface;
4204 else if(IsEqualGUID(&IID_IOleCommandTarget, riid))
4205 *ppv = &This->IOleCommandTarget_iface;
4206 else if(IsEqualGUID(&IID_IOleControl, riid))
4207 *ppv = &This->IOleControl_iface;
4208 else if(IsEqualGUID(&IID_IHlinkTarget, riid))
4209 *ppv = &This->IHlinkTarget_iface;
4210 else if(IsEqualGUID(&IID_IConnectionPointContainer, riid))
4211 *ppv = &This->cp_container.IConnectionPointContainer_iface;
4212 else if(IsEqualGUID(&IID_IPersistStreamInit, riid))
4213 *ppv = &This->IPersistStreamInit_iface;
4214 else if(IsEqualGUID(&DIID_DispHTMLDocument, riid))
4215 *ppv = &This->IHTMLDocument2_iface;
4216 else if(IsEqualGUID(&IID_ISupportErrorInfo, riid))
4217 *ppv = &This->ISupportErrorInfo_iface;
4218 else if(IsEqualGUID(&IID_IPersistHistory, riid))
4219 *ppv = &This->IPersistHistory_iface;
4220 else if(IsEqualGUID(&IID_IObjectWithSite, riid))
4221 *ppv = &This->IObjectWithSite_iface;
4222 else if(IsEqualGUID(&IID_IOleContainer, riid))
4223 *ppv = &This->IOleContainer_iface;
4224 else if(IsEqualGUID(&IID_IObjectSafety, riid))
4225 *ppv = &This->IObjectSafety_iface;
4226 else if(IsEqualGUID(&IID_IProvideClassInfo, riid))
4227 *ppv = &This->IProvideClassInfo_iface;
4228 else if(IsEqualGUID(&CLSID_CMarkup, riid)) {
4229 FIXME("(%p)->(CLSID_CMarkup %p)\n", This, ppv);
4230 *ppv = NULL;
4231 }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
4232 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
4233 *ppv = NULL;
4234 }else if(IsEqualGUID(&IID_IPersistPropertyBag, riid)) {
4235 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This, ppv);
4236 *ppv = NULL;
4237 }else if(IsEqualGUID(&IID_IMarshal, riid)) {
4238 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppv);
4239 *ppv = NULL;
4240 }else if(IsEqualGUID(&IID_IExternalConnection, riid)) {
4241 TRACE("(%p)->(IID_IExternalConnection %p) returning NULL\n", This, ppv);
4242 *ppv = NULL;
4243 }else if(IsEqualGUID(&IID_IStdMarshalInfo, riid)) {
4244 TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This, ppv);
4245 *ppv = NULL;
4246 }else {
4247 return FALSE;
4250 if(*ppv)
4251 IUnknown_AddRef((IUnknown*)*ppv);
4252 return TRUE;
4255 static cp_static_data_t HTMLDocumentEvents_data = { HTMLDocumentEvents_tid, HTMLDocument_on_advise };
4257 static const cpc_entry_t HTMLDocument_cpc[] = {
4258 {&IID_IDispatch, &HTMLDocumentEvents_data},
4259 {&IID_IPropertyNotifySink},
4260 {&DIID_HTMLDocumentEvents, &HTMLDocumentEvents_data},
4261 {&DIID_HTMLDocumentEvents2},
4262 {NULL}
4265 static void init_doc(HTMLDocument *doc, IUnknown *unk_impl, IDispatchEx *dispex)
4267 doc->IHTMLDocument2_iface.lpVtbl = &HTMLDocumentVtbl;
4268 doc->IHTMLDocument3_iface.lpVtbl = &HTMLDocument3Vtbl;
4269 doc->IHTMLDocument4_iface.lpVtbl = &HTMLDocument4Vtbl;
4270 doc->IHTMLDocument5_iface.lpVtbl = &HTMLDocument5Vtbl;
4271 doc->IHTMLDocument6_iface.lpVtbl = &HTMLDocument6Vtbl;
4272 doc->IHTMLDocument7_iface.lpVtbl = &HTMLDocument7Vtbl;
4273 doc->IDispatchEx_iface.lpVtbl = &DocDispatchExVtbl;
4274 doc->ISupportErrorInfo_iface.lpVtbl = &SupportErrorInfoVtbl;
4275 doc->IProvideClassInfo_iface.lpVtbl = &ProvideClassInfoVtbl;
4277 doc->unk_impl = unk_impl;
4278 doc->dispex = dispex;
4279 doc->task_magic = get_task_target_magic();
4281 HTMLDocument_Persist_Init(doc);
4282 HTMLDocument_OleCmd_Init(doc);
4283 HTMLDocument_OleObj_Init(doc);
4284 HTMLDocument_View_Init(doc);
4285 HTMLDocument_Window_Init(doc);
4286 HTMLDocument_Service_Init(doc);
4287 HTMLDocument_Hlink_Init(doc);
4289 ConnectionPointContainer_Init(&doc->cp_container, (IUnknown*)&doc->IHTMLDocument2_iface, HTMLDocument_cpc);
4292 static void destroy_htmldoc(HTMLDocument *This)
4294 remove_target_tasks(This->task_magic);
4296 ConnectionPointContainer_Destroy(&This->cp_container);
4299 static inline HTMLDocumentNode *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
4301 return CONTAINING_RECORD(iface, HTMLDocumentNode, node);
4304 static HRESULT HTMLDocumentNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
4306 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4308 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
4310 if(htmldoc_qi(&This->basedoc, riid, ppv))
4311 return *ppv ? S_OK : E_NOINTERFACE;
4313 if(IsEqualGUID(&IID_IInternetHostSecurityManager, riid))
4314 *ppv = &This->IInternetHostSecurityManager_iface;
4315 else
4316 return HTMLDOMNode_QI(&This->node, riid, ppv);
4318 IUnknown_AddRef((IUnknown*)*ppv);
4319 return S_OK;
4322 static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
4324 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4325 unsigned i;
4327 for(i=0; i < This->elem_vars_cnt; i++)
4328 heap_free(This->elem_vars[i]);
4329 heap_free(This->elem_vars);
4331 detach_events(This);
4332 if(This->body_event_target)
4333 release_event_target(This->body_event_target);
4334 if(This->catmgr)
4335 ICatInformation_Release(This->catmgr);
4337 detach_selection(This);
4338 detach_ranges(This);
4340 while(!list_empty(&This->plugin_hosts))
4341 detach_plugin_host(LIST_ENTRY(list_head(&This->plugin_hosts), PluginHost, entry));
4343 if(This->nsnode_selector) {
4344 nsIDOMNodeSelector_Release(This->nsnode_selector);
4345 This->nsnode_selector = NULL;
4348 if(!This->nsdoc && This->window) {
4349 /* document fragments own reference to inner window */
4350 IHTMLWindow2_Release(&This->window->base.IHTMLWindow2_iface);
4351 This->window = NULL;
4354 heap_free(This->event_vector);
4355 destroy_htmldoc(&This->basedoc);
4358 static HRESULT HTMLDocumentNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
4360 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4361 FIXME("%p\n", This);
4362 return E_NOTIMPL;
4365 static void HTMLDocumentNode_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
4367 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4369 if(This->nsnode_selector)
4370 note_cc_edge((nsISupports*)This->nsnode_selector, "This->nsnode_selector", cb);
4371 if(This->nsdoc)
4372 note_cc_edge((nsISupports*)This->nsdoc, "This->nsdoc", cb);
4375 static void HTMLDocumentNode_unlink(HTMLDOMNode *iface)
4377 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4379 if(This->nsnode_selector) {
4380 nsIDOMNodeSelector_Release(This->nsnode_selector);
4381 This->nsnode_selector = NULL;
4384 if(This->nsdoc) {
4385 nsIDOMHTMLDocument *nsdoc = This->nsdoc;
4387 release_document_mutation(This);
4388 This->nsdoc = NULL;
4389 nsIDOMHTMLDocument_Release(nsdoc);
4390 This->window = NULL;
4394 static const NodeImplVtbl HTMLDocumentNodeImplVtbl = {
4395 HTMLDocumentNode_QI,
4396 HTMLDocumentNode_destructor,
4397 HTMLDocument_cpc,
4398 HTMLDocumentNode_clone,
4399 NULL,
4400 NULL,
4401 NULL,
4402 NULL,
4403 NULL,
4404 NULL,
4405 NULL,
4406 NULL,
4407 NULL,
4408 NULL,
4409 NULL,
4410 HTMLDocumentNode_traverse,
4411 HTMLDocumentNode_unlink
4414 static HRESULT HTMLDocumentFragment_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
4416 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4417 HTMLDocumentNode *new_node;
4418 HRESULT hres;
4420 hres = create_document_fragment(nsnode, This->node.doc, &new_node);
4421 if(FAILED(hres))
4422 return hres;
4424 *ret = &new_node->node;
4425 return S_OK;
4428 static inline HTMLDocumentNode *impl_from_DispatchEx(DispatchEx *iface)
4430 return CONTAINING_RECORD(iface, HTMLDocumentNode, node.dispex);
4433 static HRESULT HTMLDocumentNode_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
4434 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
4436 HTMLDocumentNode *This = impl_from_DispatchEx(dispex);
4437 nsIDOMNodeList *node_list;
4438 nsAString name_str;
4439 nsIDOMNode *nsnode;
4440 HTMLDOMNode *node;
4441 unsigned i;
4442 nsresult nsres;
4443 HRESULT hres;
4445 if(flags != DISPATCH_PROPERTYGET && flags != (DISPATCH_METHOD|DISPATCH_PROPERTYGET)) {
4446 FIXME("unsupported flags %x\n", flags);
4447 return E_NOTIMPL;
4450 i = id - MSHTML_DISPID_CUSTOM_MIN;
4452 if(!This->nsdoc || i >= This->elem_vars_cnt)
4453 return DISP_E_UNKNOWNNAME;
4455 nsAString_InitDepend(&name_str, This->elem_vars[i]);
4456 nsres = nsIDOMHTMLDocument_GetElementsByName(This->nsdoc, &name_str, &node_list);
4457 nsAString_Finish(&name_str);
4458 if(NS_FAILED(nsres))
4459 return E_FAIL;
4461 nsres = nsIDOMNodeList_Item(node_list, 0, &nsnode);
4462 nsIDOMNodeList_Release(node_list);
4463 if(NS_FAILED(nsres) || !nsnode)
4464 return DISP_E_UNKNOWNNAME;
4466 hres = get_node(This, nsnode, TRUE, &node);
4467 if(FAILED(hres))
4468 return hres;
4470 V_VT(res) = VT_DISPATCH;
4471 V_DISPATCH(res) = (IDispatch*)&node->IHTMLDOMNode_iface;
4472 return S_OK;
4476 static const dispex_static_data_vtbl_t HTMLDocumentNode_dispex_vtbl = {
4477 NULL,
4478 NULL,
4479 HTMLDocumentNode_invoke,
4480 NULL
4483 static const NodeImplVtbl HTMLDocumentFragmentImplVtbl = {
4484 HTMLDocumentNode_QI,
4485 HTMLDocumentNode_destructor,
4486 HTMLDocument_cpc,
4487 HTMLDocumentFragment_clone
4490 static const tid_t HTMLDocumentNode_iface_tids[] = {
4491 IHTMLDOMNode_tid,
4492 IHTMLDOMNode2_tid,
4493 IHTMLDocument2_tid,
4494 IHTMLDocument3_tid,
4495 IHTMLDocument4_tid,
4496 IHTMLDocument5_tid,
4500 static dispex_static_data_t HTMLDocumentNode_dispex = {
4501 &HTMLDocumentNode_dispex_vtbl,
4502 DispHTMLDocument_tid,
4503 NULL,
4504 HTMLDocumentNode_iface_tids
4507 static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindow *window)
4509 HTMLDocumentNode *doc;
4511 doc = heap_alloc_zero(sizeof(HTMLDocumentNode));
4512 if(!doc)
4513 return NULL;
4515 doc->ref = 1;
4516 doc->basedoc.doc_node = doc;
4517 doc->basedoc.doc_obj = doc_obj;
4518 doc->basedoc.window = window->base.outer_window;
4519 doc->window = window;
4521 init_dispex(&doc->node.dispex, (IUnknown*)&doc->node.IHTMLDOMNode_iface,
4522 &HTMLDocumentNode_dispex);
4523 init_doc(&doc->basedoc, (IUnknown*)&doc->node.IHTMLDOMNode_iface,
4524 &doc->node.dispex.IDispatchEx_iface);
4525 HTMLDocumentNode_SecMgr_Init(doc);
4527 list_init(&doc->selection_list);
4528 list_init(&doc->range_list);
4529 list_init(&doc->plugin_hosts);
4531 return doc;
4534 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_obj, HTMLInnerWindow *window, HTMLDocumentNode **ret)
4536 HTMLDocumentNode *doc;
4537 nsresult nsres;
4539 doc = alloc_doc_node(doc_obj, window);
4540 if(!doc)
4541 return E_OUTOFMEMORY;
4543 if(!doc_obj->basedoc.window || window->base.outer_window == doc_obj->basedoc.window)
4544 doc->basedoc.cp_container.forward_container = &doc_obj->basedoc.cp_container;
4546 HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc);
4548 nsIDOMHTMLDocument_AddRef(nsdoc);
4549 doc->nsdoc = nsdoc;
4551 nsres = nsIDOMHTMLDocument_QueryInterface(nsdoc, &IID_nsIDOMNodeSelector, (void**)&doc->nsnode_selector);
4552 assert(nsres == NS_OK);
4554 init_document_mutation(doc);
4555 doc_init_events(doc);
4557 doc->node.vtbl = &HTMLDocumentNodeImplVtbl;
4558 doc->node.cp_container = &doc->basedoc.cp_container;
4560 *ret = doc;
4561 return S_OK;
4564 HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *doc_node, HTMLDocumentNode **ret)
4566 HTMLDocumentNode *doc_frag;
4568 doc_frag = alloc_doc_node(doc_node->basedoc.doc_obj, doc_node->window);
4569 if(!doc_frag)
4570 return E_OUTOFMEMORY;
4572 IHTMLWindow2_AddRef(&doc_frag->window->base.IHTMLWindow2_iface);
4574 HTMLDOMNode_Init(doc_node, &doc_frag->node, nsnode);
4575 doc_frag->node.vtbl = &HTMLDocumentFragmentImplVtbl;
4576 doc_frag->node.cp_container = &doc_frag->basedoc.cp_container;
4578 *ret = doc_frag;
4579 return S_OK;
4582 /**********************************************************
4583 * ICustomDoc implementation
4586 static inline HTMLDocumentObj *impl_from_ICustomDoc(ICustomDoc *iface)
4588 return CONTAINING_RECORD(iface, HTMLDocumentObj, ICustomDoc_iface);
4591 static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, void **ppv)
4593 HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
4595 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
4597 if(htmldoc_qi(&This->basedoc, riid, ppv))
4598 return *ppv ? S_OK : E_NOINTERFACE;
4600 if(IsEqualGUID(&IID_ICustomDoc, riid)) {
4601 *ppv = &This->ICustomDoc_iface;
4602 }else if(IsEqualGUID(&IID_ITargetContainer, riid)) {
4603 *ppv = &This->ITargetContainer_iface;
4604 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
4605 return *ppv ? S_OK : E_NOINTERFACE;
4606 }else {
4607 FIXME("Unimplemented interface %s\n", debugstr_mshtml_guid(riid));
4608 *ppv = NULL;
4609 return E_NOINTERFACE;
4612 IUnknown_AddRef((IUnknown*)*ppv);
4613 return S_OK;
4616 static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface)
4618 HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
4619 ULONG ref = InterlockedIncrement(&This->ref);
4621 TRACE("(%p) ref = %u\n", This, ref);
4623 return ref;
4626 static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
4628 HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
4629 ULONG ref = InterlockedDecrement(&This->ref);
4631 TRACE("(%p) ref = %u\n", This, ref);
4633 if(!ref) {
4634 nsIDOMWindowUtils *window_utils = NULL;
4636 if(This->basedoc.window && This->basedoc.window->nswindow)
4637 get_nsinterface((nsISupports*)This->basedoc.window->nswindow, &IID_nsIDOMWindowUtils, (void**)&window_utils);
4639 if(This->basedoc.doc_node) {
4640 This->basedoc.doc_node->basedoc.doc_obj = NULL;
4641 htmldoc_release(&This->basedoc.doc_node->basedoc);
4643 if(This->basedoc.window) {
4644 This->basedoc.window->doc_obj = NULL;
4645 IHTMLWindow2_Release(&This->basedoc.window->base.IHTMLWindow2_iface);
4647 if(This->basedoc.advise_holder)
4648 IOleAdviseHolder_Release(This->basedoc.advise_holder);
4650 if(This->view_sink)
4651 IAdviseSink_Release(This->view_sink);
4652 if(This->client)
4653 IOleObject_SetClientSite(&This->basedoc.IOleObject_iface, NULL);
4654 if(This->hostui)
4655 ICustomDoc_SetUIHandler(&This->ICustomDoc_iface, NULL);
4656 if(This->in_place_active)
4657 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->basedoc.IOleInPlaceObjectWindowless_iface);
4658 if(This->ipsite)
4659 IOleDocumentView_SetInPlaceSite(&This->basedoc.IOleDocumentView_iface, NULL);
4660 if(This->undomgr)
4661 IOleUndoManager_Release(This->undomgr);
4662 if(This->tooltips_hwnd)
4663 DestroyWindow(This->tooltips_hwnd);
4665 if(This->hwnd)
4666 DestroyWindow(This->hwnd);
4667 heap_free(This->mime);
4669 destroy_htmldoc(&This->basedoc);
4670 release_dispex(&This->dispex);
4672 if(This->nscontainer)
4673 NSContainer_Release(This->nscontainer);
4674 heap_free(This);
4676 /* Force cycle collection */
4677 if(window_utils) {
4678 nsIDOMWindowUtils_CycleCollect(window_utils, NULL, 0);
4679 nsIDOMWindowUtils_Release(window_utils);
4683 return ref;
4686 static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler)
4688 HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
4689 IOleCommandTarget *cmdtrg;
4690 HRESULT hres;
4692 TRACE("(%p)->(%p)\n", This, pUIHandler);
4694 if(This->custom_hostui && This->hostui == pUIHandler)
4695 return S_OK;
4697 This->custom_hostui = TRUE;
4699 if(This->hostui)
4700 IDocHostUIHandler_Release(This->hostui);
4701 if(pUIHandler)
4702 IDocHostUIHandler_AddRef(pUIHandler);
4703 This->hostui = pUIHandler;
4704 if(!pUIHandler)
4705 return S_OK;
4707 hres = IDocHostUIHandler_QueryInterface(pUIHandler, &IID_IOleCommandTarget, (void**)&cmdtrg);
4708 if(SUCCEEDED(hres)) {
4709 FIXME("custom UI handler supports IOleCommandTarget\n");
4710 IOleCommandTarget_Release(cmdtrg);
4713 return S_OK;
4716 static const ICustomDocVtbl CustomDocVtbl = {
4717 CustomDoc_QueryInterface,
4718 CustomDoc_AddRef,
4719 CustomDoc_Release,
4720 CustomDoc_SetUIHandler
4723 static const tid_t HTMLDocumentObj_iface_tids[] = {
4724 IHTMLDocument2_tid,
4725 IHTMLDocument3_tid,
4726 IHTMLDocument4_tid,
4727 IHTMLDocument5_tid,
4730 static dispex_static_data_t HTMLDocumentObj_dispex = {
4731 NULL,
4732 DispHTMLDocument_tid,
4733 NULL,
4734 HTMLDocumentObj_iface_tids
4737 HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
4739 HTMLDocumentObj *doc;
4740 nsIDOMWindow *nswindow = NULL;
4741 nsresult nsres;
4742 HRESULT hres;
4744 TRACE("(%p %s %p)\n", pUnkOuter, debugstr_mshtml_guid(riid), ppvObject);
4746 doc = heap_alloc_zero(sizeof(HTMLDocumentObj));
4747 if(!doc)
4748 return E_OUTOFMEMORY;
4750 init_dispex(&doc->dispex, (IUnknown*)&doc->ICustomDoc_iface, &HTMLDocumentObj_dispex);
4751 init_doc(&doc->basedoc, (IUnknown*)&doc->ICustomDoc_iface, &doc->dispex.IDispatchEx_iface);
4752 TargetContainer_Init(doc);
4754 doc->ICustomDoc_iface.lpVtbl = &CustomDocVtbl;
4755 doc->ref = 1;
4756 doc->basedoc.doc_obj = doc;
4758 doc->usermode = UNKNOWN_USERMODE;
4760 init_binding_ui(doc);
4762 hres = create_nscontainer(doc, &doc->nscontainer);
4763 if(FAILED(hres)) {
4764 ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n");
4765 htmldoc_release(&doc->basedoc);
4766 return hres;
4769 hres = htmldoc_query_interface(&doc->basedoc, riid, ppvObject);
4770 htmldoc_release(&doc->basedoc);
4771 if(FAILED(hres))
4772 return hres;
4774 nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &nswindow);
4775 if(NS_FAILED(nsres))
4776 ERR("GetContentDOMWindow failed: %08x\n", nsres);
4778 hres = HTMLOuterWindow_Create(doc, nswindow, NULL /* FIXME */, &doc->basedoc.window);
4779 if(nswindow)
4780 nsIDOMWindow_Release(nswindow);
4781 if(FAILED(hres)) {
4782 htmldoc_release(&doc->basedoc);
4783 return hres;
4786 if(!doc->basedoc.doc_node && doc->basedoc.window->base.inner_window->doc) {
4787 doc->basedoc.doc_node = doc->basedoc.window->base.inner_window->doc;
4788 htmldoc_addref(&doc->basedoc.doc_node->basedoc);
4791 get_thread_hwnd();
4793 return S_OK;