[MSHTA] Implement MSHTA.exe (#577) CORE-12813
[reactos.git] / dll / win32 / mshtml / htmldoc.c
1 /*
2 * Copyright 2005-2009 Jacek Caban for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19 #include "mshtml_private.h"
20
21 static HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *doc_node, HTMLDocumentNode **ret);
22
23 HRESULT get_doc_elem_by_id(HTMLDocumentNode *doc, const WCHAR *id, HTMLElement **ret)
24 {
25 nsIDOMNodeList *nsnode_list;
26 nsIDOMElement *nselem;
27 nsIDOMNode *nsnode;
28 nsAString id_str;
29 nsresult nsres;
30 HRESULT hres;
31
32 if(!doc->nsdoc) {
33 WARN("NULL nsdoc\n");
34 return E_UNEXPECTED;
35 }
36
37 nsAString_InitDepend(&id_str, id);
38 /* get element by id attribute */
39 nsres = nsIDOMHTMLDocument_GetElementById(doc->nsdoc, &id_str, &nselem);
40 if(FAILED(nsres)) {
41 ERR("GetElementById failed: %08x\n", nsres);
42 nsAString_Finish(&id_str);
43 return E_FAIL;
44 }
45
46 /* get first element by name attribute */
47 nsres = nsIDOMHTMLDocument_GetElementsByName(doc->nsdoc, &id_str, &nsnode_list);
48 nsAString_Finish(&id_str);
49 if(FAILED(nsres)) {
50 ERR("getElementsByName failed: %08x\n", nsres);
51 if(nselem)
52 nsIDOMElement_Release(nselem);
53 return E_FAIL;
54 }
55
56 nsres = nsIDOMNodeList_Item(nsnode_list, 0, &nsnode);
57 nsIDOMNodeList_Release(nsnode_list);
58 assert(nsres == NS_OK);
59
60 if(nsnode && nselem) {
61 UINT16 pos;
62
63 nsres = nsIDOMNode_CompareDocumentPosition(nsnode, (nsIDOMNode*)nselem, &pos);
64 if(NS_FAILED(nsres)) {
65 FIXME("CompareDocumentPosition failed: 0x%08x\n", nsres);
66 nsIDOMNode_Release(nsnode);
67 nsIDOMElement_Release(nselem);
68 return E_FAIL;
69 }
70
71 TRACE("CompareDocumentPosition gave: 0x%x\n", pos);
72 if(!(pos & (DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_CONTAINS))) {
73 nsIDOMElement_Release(nselem);
74 nselem = NULL;
75 }
76 }
77
78 if(nsnode) {
79 if(!nselem) {
80 nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMElement, (void**)&nselem);
81 assert(nsres == NS_OK);
82 }
83 nsIDOMNode_Release(nsnode);
84 }
85
86 if(!nselem) {
87 *ret = NULL;
88 return S_OK;
89 }
90
91 hres = get_elem(doc, nselem, ret);
92 nsIDOMElement_Release(nselem);
93 return hres;
94 }
95
96 UINT get_document_charset(HTMLDocumentNode *doc)
97 {
98 nsAString charset_str;
99 UINT ret = 0;
100 nsresult nsres;
101
102 if(doc->charset)
103 return doc->charset;
104
105 nsAString_Init(&charset_str, NULL);
106 nsres = nsIDOMHTMLDocument_GetCharacterSet(doc->nsdoc, &charset_str);
107 if(NS_SUCCEEDED(nsres)) {
108 const PRUnichar *charset;
109
110 nsAString_GetData(&charset_str, &charset);
111
112 if(*charset) {
113 BSTR str = SysAllocString(charset);
114 ret = cp_from_charset_string(str);
115 SysFreeString(str);
116 }
117 }else {
118 ERR("GetCharset failed: %08x\n", nsres);
119 }
120 nsAString_Finish(&charset_str);
121
122 if(!ret)
123 return CP_UTF8;
124
125 return doc->charset = ret;
126 }
127
128 static inline HTMLDocument *impl_from_IHTMLDocument2(IHTMLDocument2 *iface)
129 {
130 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument2_iface);
131 }
132
133 static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID riid, void **ppv)
134 {
135 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
136
137 return htmldoc_query_interface(This, riid, ppv);
138 }
139
140 static ULONG WINAPI HTMLDocument_AddRef(IHTMLDocument2 *iface)
141 {
142 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
143
144 return htmldoc_addref(This);
145 }
146
147 static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
148 {
149 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
150
151 return htmldoc_release(This);
152 }
153
154 static HRESULT WINAPI HTMLDocument_GetTypeInfoCount(IHTMLDocument2 *iface, UINT *pctinfo)
155 {
156 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
157
158 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
159 }
160
161 static HRESULT WINAPI HTMLDocument_GetTypeInfo(IHTMLDocument2 *iface, UINT iTInfo,
162 LCID lcid, ITypeInfo **ppTInfo)
163 {
164 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
165
166 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
167 }
168
169 static HRESULT WINAPI HTMLDocument_GetIDsOfNames(IHTMLDocument2 *iface, REFIID riid,
170 LPOLESTR *rgszNames, UINT cNames,
171 LCID lcid, DISPID *rgDispId)
172 {
173 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
174
175 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
176 rgDispId);
177 }
178
179 static HRESULT WINAPI HTMLDocument_Invoke(IHTMLDocument2 *iface, DISPID dispIdMember,
180 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
181 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
182 {
183 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
184
185 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
186 pDispParams, pVarResult, pExcepInfo, puArgErr);
187 }
188
189 static HRESULT WINAPI HTMLDocument_get_Script(IHTMLDocument2 *iface, IDispatch **p)
190 {
191 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
192
193 TRACE("(%p)->(%p)\n", This, p);
194
195 *p = (IDispatch*)&This->window->base.IHTMLWindow2_iface;
196 IDispatch_AddRef(*p);
197 return S_OK;
198 }
199
200 static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCollection **p)
201 {
202 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
203 nsIDOMElement *nselem = NULL;
204 HTMLDOMNode *node;
205 nsresult nsres;
206 HRESULT hres;
207
208 TRACE("(%p)->(%p)\n", This, p);
209
210 if(!This->doc_node->nsdoc) {
211 WARN("NULL nsdoc\n");
212 return E_UNEXPECTED;
213 }
214
215 nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
216 if(NS_FAILED(nsres)) {
217 ERR("GetDocumentElement failed: %08x\n", nsres);
218 return E_FAIL;
219 }
220
221 if(!nselem) {
222 *p = NULL;
223 return S_OK;
224 }
225
226 hres = get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE, &node);
227 nsIDOMElement_Release(nselem);
228 if(FAILED(hres))
229 return hres;
230
231 *p = create_all_collection(node, TRUE);
232 node_release(node);
233 return hres;
234 }
235
236 static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement **p)
237 {
238 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
239 nsIDOMHTMLElement *nsbody = NULL;
240 HTMLDOMNode *node;
241 HRESULT hres;
242
243 TRACE("(%p)->(%p)\n", This, p);
244
245 if(This->doc_node->nsdoc) {
246 nsresult nsres;
247
248 nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
249 if(NS_FAILED(nsres)) {
250 TRACE("Could not get body: %08x\n", nsres);
251 return E_UNEXPECTED;
252 }
253 }
254
255 if(!nsbody) {
256 *p = NULL;
257 return S_OK;
258 }
259
260 hres = get_node(This->doc_node, (nsIDOMNode*)nsbody, TRUE, &node);
261 nsIDOMHTMLElement_Release(nsbody);
262 if(FAILED(hres))
263 return hres;
264
265 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
266 node_release(node);
267 return hres;
268 }
269
270 static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTMLElement **p)
271 {
272 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
273 nsIDOMElement *nselem;
274 HTMLElement *elem;
275 nsresult nsres;
276 HRESULT hres;
277
278 TRACE("(%p)->(%p)\n", This, p);
279
280 if(!This->doc_node->nsdoc) {
281 *p = NULL;
282 return S_OK;
283 }
284
285 /*
286 * NOTE: Gecko may return an active element even if the document is not visible.
287 * IE returns NULL in this case.
288 */
289 nsres = nsIDOMHTMLDocument_GetActiveElement(This->doc_node->nsdoc, &nselem);
290 if(NS_FAILED(nsres)) {
291 ERR("GetActiveElement failed: %08x\n", nsres);
292 return E_FAIL;
293 }
294
295 if(!nselem) {
296 *p = NULL;
297 return S_OK;
298 }
299
300 hres = get_elem(This->doc_node, nselem, &elem);
301 nsIDOMElement_Release(nselem);
302 if(FAILED(hres))
303 return hres;
304
305 *p = &elem->IHTMLElement_iface;
306 return S_OK;
307 }
308
309 static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p)
310 {
311 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
312 nsIDOMHTMLCollection *nscoll = NULL;
313 nsresult nsres;
314
315 TRACE("(%p)->(%p)\n", This, p);
316
317 if(!p)
318 return E_INVALIDARG;
319
320 *p = NULL;
321
322 if(!This->doc_node->nsdoc) {
323 WARN("NULL nsdoc\n");
324 return E_UNEXPECTED;
325 }
326
327 nsres = nsIDOMHTMLDocument_GetImages(This->doc_node->nsdoc, &nscoll);
328 if(NS_FAILED(nsres)) {
329 ERR("GetImages failed: %08x\n", nsres);
330 return E_FAIL;
331 }
332
333 if(nscoll) {
334 *p = create_collection_from_htmlcol(This->doc_node, nscoll);
335 nsIDOMHTMLCollection_Release(nscoll);
336 }
337
338 return S_OK;
339 }
340
341 static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLElementCollection **p)
342 {
343 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
344 nsIDOMHTMLCollection *nscoll = NULL;
345 nsresult nsres;
346
347 TRACE("(%p)->(%p)\n", This, p);
348
349 if(!p)
350 return E_INVALIDARG;
351
352 *p = NULL;
353
354 if(!This->doc_node->nsdoc) {
355 WARN("NULL nsdoc\n");
356 return E_UNEXPECTED;
357 }
358
359 nsres = nsIDOMHTMLDocument_GetApplets(This->doc_node->nsdoc, &nscoll);
360 if(NS_FAILED(nsres)) {
361 ERR("GetApplets failed: %08x\n", nsres);
362 return E_FAIL;
363 }
364
365 if(nscoll) {
366 *p = create_collection_from_htmlcol(This->doc_node, nscoll);
367 nsIDOMHTMLCollection_Release(nscoll);
368 }
369
370 return S_OK;
371 }
372
373 static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElementCollection **p)
374 {
375 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
376 nsIDOMHTMLCollection *nscoll = NULL;
377 nsresult nsres;
378
379 TRACE("(%p)->(%p)\n", This, p);
380
381 if(!p)
382 return E_INVALIDARG;
383
384 *p = NULL;
385
386 if(!This->doc_node->nsdoc) {
387 WARN("NULL nsdoc\n");
388 return E_UNEXPECTED;
389 }
390
391 nsres = nsIDOMHTMLDocument_GetLinks(This->doc_node->nsdoc, &nscoll);
392 if(NS_FAILED(nsres)) {
393 ERR("GetLinks failed: %08x\n", nsres);
394 return E_FAIL;
395 }
396
397 if(nscoll) {
398 *p = create_collection_from_htmlcol(This->doc_node, nscoll);
399 nsIDOMHTMLCollection_Release(nscoll);
400 }
401
402 return S_OK;
403 }
404
405 static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElementCollection **p)
406 {
407 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
408 nsIDOMHTMLCollection *nscoll = NULL;
409 nsresult nsres;
410
411 TRACE("(%p)->(%p)\n", This, p);
412
413 if(!p)
414 return E_INVALIDARG;
415
416 *p = NULL;
417
418 if(!This->doc_node->nsdoc) {
419 WARN("NULL nsdoc\n");
420 return E_UNEXPECTED;
421 }
422
423 nsres = nsIDOMHTMLDocument_GetForms(This->doc_node->nsdoc, &nscoll);
424 if(NS_FAILED(nsres)) {
425 ERR("GetForms failed: %08x\n", nsres);
426 return E_FAIL;
427 }
428
429 if(nscoll) {
430 *p = create_collection_from_htmlcol(This->doc_node, nscoll);
431 nsIDOMHTMLCollection_Release(nscoll);
432 }
433
434 return S_OK;
435 }
436
437 static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLElementCollection **p)
438 {
439 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
440 nsIDOMHTMLCollection *nscoll = NULL;
441 nsresult nsres;
442
443 TRACE("(%p)->(%p)\n", This, p);
444
445 if(!p)
446 return E_INVALIDARG;
447
448 *p = NULL;
449
450 if(!This->doc_node->nsdoc) {
451 WARN("NULL nsdoc\n");
452 return E_UNEXPECTED;
453 }
454
455 nsres = nsIDOMHTMLDocument_GetAnchors(This->doc_node->nsdoc, &nscoll);
456 if(NS_FAILED(nsres)) {
457 ERR("GetAnchors failed: %08x\n", nsres);
458 return E_FAIL;
459 }
460
461 if(nscoll) {
462 *p = create_collection_from_htmlcol(This->doc_node, nscoll);
463 nsIDOMHTMLCollection_Release(nscoll);
464 }
465
466 return S_OK;
467 }
468
469 static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v)
470 {
471 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
472 nsAString nsstr;
473 nsresult nsres;
474
475 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
476
477 if(!This->doc_node->nsdoc) {
478 WARN("NULL nsdoc\n");
479 return E_UNEXPECTED;
480 }
481
482 nsAString_InitDepend(&nsstr, v);
483 nsres = nsIDOMHTMLDocument_SetTitle(This->doc_node->nsdoc, &nsstr);
484 nsAString_Finish(&nsstr);
485 if(NS_FAILED(nsres))
486 ERR("SetTitle failed: %08x\n", nsres);
487
488 return S_OK;
489 }
490
491 static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p)
492 {
493 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
494 const PRUnichar *ret;
495 nsAString nsstr;
496 nsresult nsres;
497
498 TRACE("(%p)->(%p)\n", This, p);
499
500 if(!This->doc_node->nsdoc) {
501 WARN("NULL nsdoc\n");
502 return E_UNEXPECTED;
503 }
504
505
506 nsAString_Init(&nsstr, NULL);
507 nsres = nsIDOMHTMLDocument_GetTitle(This->doc_node->nsdoc, &nsstr);
508 if (NS_SUCCEEDED(nsres)) {
509 nsAString_GetData(&nsstr, &ret);
510 *p = SysAllocString(ret);
511 }
512 nsAString_Finish(&nsstr);
513
514 if(NS_FAILED(nsres)) {
515 ERR("GetTitle failed: %08x\n", nsres);
516 return E_FAIL;
517 }
518
519 return S_OK;
520 }
521
522 static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p)
523 {
524 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
525 nsIDOMHTMLCollection *nscoll = NULL;
526 nsresult nsres;
527
528 TRACE("(%p)->(%p)\n", This, p);
529
530 if(!p)
531 return E_INVALIDARG;
532
533 *p = NULL;
534
535 if(!This->doc_node->nsdoc) {
536 WARN("NULL nsdoc\n");
537 return E_UNEXPECTED;
538 }
539
540 nsres = nsIDOMHTMLDocument_GetScripts(This->doc_node->nsdoc, &nscoll);
541 if(NS_FAILED(nsres)) {
542 ERR("GetImages failed: %08x\n", nsres);
543 return E_FAIL;
544 }
545
546 if(nscoll) {
547 *p = create_collection_from_htmlcol(This->doc_node, nscoll);
548 nsIDOMHTMLCollection_Release(nscoll);
549 }
550
551 return S_OK;
552 }
553
554 static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v)
555 {
556 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
557 HRESULT hres;
558
559 static const WCHAR onW[] = {'o','n',0};
560
561 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
562
563 if(strcmpiW(v, onW)) {
564 FIXME("Unsupported arg %s\n", debugstr_w(v));
565 return E_NOTIMPL;
566 }
567
568 hres = setup_edit_mode(This->doc_obj);
569 if(FAILED(hres))
570 return hres;
571
572 call_property_onchanged(&This->cp_container, DISPID_IHTMLDOCUMENT2_DESIGNMODE);
573 return S_OK;
574 }
575
576 static HRESULT WINAPI HTMLDocument_get_designMode(IHTMLDocument2 *iface, BSTR *p)
577 {
578 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
579 static const WCHAR szOff[] = {'O','f','f',0};
580 FIXME("(%p)->(%p) always returning Off\n", This, p);
581
582 if(!p)
583 return E_INVALIDARG;
584
585 *p = SysAllocString(szOff);
586
587 return S_OK;
588 }
589
590 static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSelectionObject **p)
591 {
592 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
593 nsISelection *nsselection;
594 nsresult nsres;
595
596 TRACE("(%p)->(%p)\n", This, p);
597
598 nsres = nsIDOMWindow_GetSelection(This->window->nswindow, &nsselection);
599 if(NS_FAILED(nsres)) {
600 ERR("GetSelection failed: %08x\n", nsres);
601 return E_FAIL;
602 }
603
604 return HTMLSelectionObject_Create(This->doc_node, nsselection, p);
605 }
606
607 static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p)
608 {
609 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
610
611
612 TRACE("(%p)->(%p)\n", iface, p);
613
614 if(!p)
615 return E_POINTER;
616
617 return get_readystate_string(This->window->readystate, p);
618 }
619
620 static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p)
621 {
622 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
623
624 TRACE("(%p)->(%p)\n", This, p);
625
626 return IHTMLWindow2_get_frames(&This->window->base.IHTMLWindow2_iface, p);
627 }
628
629 static HRESULT WINAPI HTMLDocument_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p)
630 {
631 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
632 FIXME("(%p)->(%p)\n", This, p);
633 return E_NOTIMPL;
634 }
635
636 static HRESULT WINAPI HTMLDocument_get_plugins(IHTMLDocument2 *iface, IHTMLElementCollection **p)
637 {
638 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
639 FIXME("(%p)->(%p)\n", This, p);
640 return E_NOTIMPL;
641 }
642
643 static HRESULT WINAPI HTMLDocument_put_alinkColor(IHTMLDocument2 *iface, VARIANT v)
644 {
645 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
646 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
647 return E_NOTIMPL;
648 }
649
650 static HRESULT WINAPI HTMLDocument_get_alinkColor(IHTMLDocument2 *iface, VARIANT *p)
651 {
652 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
653 FIXME("(%p)->(%p)\n", This, p);
654 return E_NOTIMPL;
655 }
656
657 static HRESULT WINAPI HTMLDocument_put_bgColor(IHTMLDocument2 *iface, VARIANT v)
658 {
659 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
660 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
661 return E_NOTIMPL;
662 }
663
664 static HRESULT WINAPI HTMLDocument_get_bgColor(IHTMLDocument2 *iface, VARIANT *p)
665 {
666 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
667 FIXME("(%p)->(%p)\n", This, p);
668 return E_NOTIMPL;
669 }
670
671 static HRESULT WINAPI HTMLDocument_put_fgColor(IHTMLDocument2 *iface, VARIANT v)
672 {
673 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
674 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
675 return E_NOTIMPL;
676 }
677
678 static HRESULT WINAPI HTMLDocument_get_fgColor(IHTMLDocument2 *iface, VARIANT *p)
679 {
680 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
681 FIXME("(%p)->(%p)\n", This, p);
682 return E_NOTIMPL;
683 }
684
685 static HRESULT WINAPI HTMLDocument_put_linkColor(IHTMLDocument2 *iface, VARIANT v)
686 {
687 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
688 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
689 return E_NOTIMPL;
690 }
691
692 static HRESULT WINAPI HTMLDocument_get_linkColor(IHTMLDocument2 *iface, VARIANT *p)
693 {
694 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
695 FIXME("(%p)->(%p)\n", This, p);
696 return E_NOTIMPL;
697 }
698
699 static HRESULT WINAPI HTMLDocument_put_vlinkColor(IHTMLDocument2 *iface, VARIANT v)
700 {
701 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
702 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
703 return E_NOTIMPL;
704 }
705
706 static HRESULT WINAPI HTMLDocument_get_vlinkColor(IHTMLDocument2 *iface, VARIANT *p)
707 {
708 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
709 FIXME("(%p)->(%p)\n", This, p);
710 return E_NOTIMPL;
711 }
712
713 static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p)
714 {
715 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
716
717 FIXME("(%p)->(%p)\n", This, p);
718
719 *p = NULL;
720 return S_OK;
721 }
722
723 static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p)
724 {
725 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
726
727 TRACE("(%p)->(%p)\n", This, p);
728
729 if(!This->doc_node->nsdoc) {
730 WARN("NULL nsdoc\n");
731 return E_UNEXPECTED;
732 }
733
734 return IHTMLWindow2_get_location(&This->window->base.IHTMLWindow2_iface, p);
735 }
736
737 static HRESULT WINAPI HTMLDocument_get_lastModified(IHTMLDocument2 *iface, BSTR *p)
738 {
739 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
740 FIXME("(%p)->(%p)\n", This, p);
741 return E_NOTIMPL;
742 }
743
744 static HRESULT WINAPI HTMLDocument_put_URL(IHTMLDocument2 *iface, BSTR v)
745 {
746 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
747
748 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
749
750 if(!This->window) {
751 FIXME("No window available\n");
752 return E_FAIL;
753 }
754
755 return navigate_url(This->window, v, This->window->uri, BINDING_NAVIGATED);
756 }
757
758 static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
759 {
760 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
761
762 static const WCHAR about_blank_url[] =
763 {'a','b','o','u','t',':','b','l','a','n','k',0};
764
765 TRACE("(%p)->(%p)\n", iface, p);
766
767 *p = SysAllocString(This->window->url ? This->window->url : about_blank_url);
768 return *p ? S_OK : E_OUTOFMEMORY;
769 }
770
771 static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
772 {
773 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
774 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
775 return E_NOTIMPL;
776 }
777
778 static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
779 {
780 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
781 HRESULT hres;
782
783 TRACE("(%p)->(%p)\n", This, p);
784
785 if(!This->window || !This->window->uri) {
786 FIXME("No current URI\n");
787 return E_FAIL;
788 }
789
790 hres = IUri_GetHost(This->window->uri, p);
791 return FAILED(hres) ? hres : S_OK;
792 }
793
794 static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v)
795 {
796 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
797 BOOL bret;
798
799 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
800
801 bret = InternetSetCookieExW(This->window->url, NULL, v, 0, 0);
802 if(!bret) {
803 FIXME("InternetSetCookieExW failed: %u\n", GetLastError());
804 return HRESULT_FROM_WIN32(GetLastError());
805 }
806
807 return S_OK;
808 }
809
810 static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p)
811 {
812 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
813 DWORD size;
814 BOOL bret;
815
816 TRACE("(%p)->(%p)\n", This, p);
817
818 size = 0;
819 bret = InternetGetCookieExW(This->window->url, NULL, NULL, &size, 0, NULL);
820 if(!bret) {
821 switch(GetLastError()) {
822 case ERROR_INSUFFICIENT_BUFFER:
823 break;
824 case ERROR_NO_MORE_ITEMS:
825 *p = NULL;
826 return S_OK;
827 default:
828 FIXME("InternetGetCookieExW failed: %u\n", GetLastError());
829 return HRESULT_FROM_WIN32(GetLastError());
830 }
831 }
832
833 if(!size) {
834 *p = NULL;
835 return S_OK;
836 }
837
838 *p = SysAllocStringLen(NULL, size/sizeof(WCHAR)-1);
839 if(!*p)
840 return E_OUTOFMEMORY;
841
842 bret = InternetGetCookieExW(This->window->url, NULL, *p, &size, 0, NULL);
843 if(!bret) {
844 ERR("InternetGetCookieExW failed: %u\n", GetLastError());
845 return E_FAIL;
846 }
847
848 return S_OK;
849 }
850
851 static HRESULT WINAPI HTMLDocument_put_expando(IHTMLDocument2 *iface, VARIANT_BOOL v)
852 {
853 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
854 FIXME("(%p)->(%x)\n", This, v);
855 return E_NOTIMPL;
856 }
857
858 static HRESULT WINAPI HTMLDocument_get_expando(IHTMLDocument2 *iface, VARIANT_BOOL *p)
859 {
860 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
861 FIXME("(%p)->(%p)\n", This, p);
862 return E_NOTIMPL;
863 }
864
865 static HRESULT WINAPI HTMLDocument_put_charset(IHTMLDocument2 *iface, BSTR v)
866 {
867 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
868 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
869 return E_NOTIMPL;
870 }
871
872 static HRESULT WINAPI HTMLDocument_get_charset(IHTMLDocument2 *iface, BSTR *p)
873 {
874 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
875 nsAString charset_str;
876 nsresult nsres;
877
878 TRACE("(%p)->(%p)\n", This, p);
879
880 if(!This->doc_node->nsdoc) {
881 FIXME("NULL nsdoc\n");
882 return E_FAIL;
883 }
884
885 nsAString_Init(&charset_str, NULL);
886 nsres = nsIDOMHTMLDocument_GetCharacterSet(This->doc_node->nsdoc, &charset_str);
887 return return_nsstr(nsres, &charset_str, p);
888 }
889
890 static HRESULT WINAPI HTMLDocument_put_defaultCharset(IHTMLDocument2 *iface, BSTR v)
891 {
892 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
893 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
894 return E_NOTIMPL;
895 }
896
897 static HRESULT WINAPI HTMLDocument_get_defaultCharset(IHTMLDocument2 *iface, BSTR *p)
898 {
899 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
900 FIXME("(%p)->(%p)\n", This, p);
901 return E_NOTIMPL;
902 }
903
904 static HRESULT WINAPI HTMLDocument_get_mimeType(IHTMLDocument2 *iface, BSTR *p)
905 {
906 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
907 FIXME("(%p)->(%p)\n", This, p);
908 return E_NOTIMPL;
909 }
910
911 static HRESULT WINAPI HTMLDocument_get_fileSize(IHTMLDocument2 *iface, BSTR *p)
912 {
913 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
914 FIXME("(%p)->(%p)\n", This, p);
915 return E_NOTIMPL;
916 }
917
918 static HRESULT WINAPI HTMLDocument_get_fileCreatedDate(IHTMLDocument2 *iface, BSTR *p)
919 {
920 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
921 FIXME("(%p)->(%p)\n", This, p);
922 return E_NOTIMPL;
923 }
924
925 static HRESULT WINAPI HTMLDocument_get_fileModifiedDate(IHTMLDocument2 *iface, BSTR *p)
926 {
927 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
928 FIXME("(%p)->(%p)\n", This, p);
929 return E_NOTIMPL;
930 }
931
932 static HRESULT WINAPI HTMLDocument_get_fileUpdatedDate(IHTMLDocument2 *iface, BSTR *p)
933 {
934 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
935 FIXME("(%p)->(%p)\n", This, p);
936 return E_NOTIMPL;
937 }
938
939 static HRESULT WINAPI HTMLDocument_get_security(IHTMLDocument2 *iface, BSTR *p)
940 {
941 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
942 FIXME("(%p)->(%p)\n", This, p);
943 return E_NOTIMPL;
944 }
945
946 static HRESULT WINAPI HTMLDocument_get_protocol(IHTMLDocument2 *iface, BSTR *p)
947 {
948 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
949 FIXME("(%p)->(%p)\n", This, p);
950 return E_NOTIMPL;
951 }
952
953 static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
954 {
955 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
956 FIXME("(%p)->(%p)\n", This, p);
957 return E_NOTIMPL;
958 }
959
960 static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
961 {
962 VARIANT *var, tmp;
963 JSContext *jsctx;
964 nsAString nsstr;
965 ULONG i, argc;
966 nsresult nsres;
967 HRESULT hres;
968
969 if(!This->doc_node->nsdoc) {
970 WARN("NULL nsdoc\n");
971 return E_UNEXPECTED;
972 }
973
974 if (!psarray)
975 return S_OK;
976
977 if(psarray->cDims != 1) {
978 FIXME("cDims=%d\n", psarray->cDims);
979 return E_INVALIDARG;
980 }
981
982 hres = SafeArrayAccessData(psarray, (void**)&var);
983 if(FAILED(hres)) {
984 WARN("SafeArrayAccessData failed: %08x\n", hres);
985 return hres;
986 }
987
988 V_VT(&tmp) = VT_EMPTY;
989
990 jsctx = get_context_from_document(This->doc_node->nsdoc);
991 argc = psarray->rgsabound[0].cElements;
992 for(i=0; i < argc; i++) {
993 if(V_VT(var+i) == VT_BSTR) {
994 nsAString_InitDepend(&nsstr, V_BSTR(var+i));
995 }else {
996 hres = VariantChangeTypeEx(&tmp, var+i, MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, VT_BSTR);
997 if(FAILED(hres)) {
998 WARN("Could not convert %s to string\n", debugstr_variant(var+i));
999 break;
1000 }
1001 nsAString_InitDepend(&nsstr, V_BSTR(&tmp));
1002 }
1003
1004 if(!ln || i != argc-1)
1005 nsres = nsIDOMHTMLDocument_Write(This->doc_node->nsdoc, &nsstr, jsctx);
1006 else
1007 nsres = nsIDOMHTMLDocument_Writeln(This->doc_node->nsdoc, &nsstr, jsctx);
1008 nsAString_Finish(&nsstr);
1009 if(V_VT(var+i) != VT_BSTR)
1010 VariantClear(&tmp);
1011 if(NS_FAILED(nsres)) {
1012 ERR("Write failed: %08x\n", nsres);
1013 hres = E_FAIL;
1014 break;
1015 }
1016 }
1017
1018 SafeArrayUnaccessData(psarray);
1019
1020 return hres;
1021 }
1022
1023 static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray)
1024 {
1025 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1026
1027 TRACE("(%p)->(%p)\n", iface, psarray);
1028
1029 return document_write(This, psarray, FALSE);
1030 }
1031
1032 static HRESULT WINAPI HTMLDocument_writeln(IHTMLDocument2 *iface, SAFEARRAY *psarray)
1033 {
1034 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1035
1036 TRACE("(%p)->(%p)\n", This, psarray);
1037
1038 return document_write(This, psarray, TRUE);
1039 }
1040
1041 static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT name,
1042 VARIANT features, VARIANT replace, IDispatch **pomWindowResult)
1043 {
1044 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1045 nsISupports *tmp;
1046 nsresult nsres;
1047
1048 static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0};
1049
1050 TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_w(url), debugstr_variant(&name),
1051 debugstr_variant(&features), debugstr_variant(&replace), pomWindowResult);
1052
1053 if(!This->doc_node->nsdoc) {
1054 ERR("!nsdoc\n");
1055 return E_NOTIMPL;
1056 }
1057
1058 if(!url || strcmpW(url, text_htmlW) || V_VT(&name) != VT_ERROR
1059 || V_VT(&features) != VT_ERROR || V_VT(&replace) != VT_ERROR)
1060 FIXME("unsupported args\n");
1061
1062 nsres = nsIDOMHTMLDocument_Open(This->doc_node->nsdoc, NULL, NULL, NULL,
1063 get_context_from_document(This->doc_node->nsdoc), 0, &tmp);
1064 if(NS_FAILED(nsres)) {
1065 ERR("Open failed: %08x\n", nsres);
1066 return E_FAIL;
1067 }
1068
1069 if(tmp)
1070 nsISupports_Release(tmp);
1071
1072 *pomWindowResult = (IDispatch*)&This->window->base.IHTMLWindow2_iface;
1073 IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface);
1074 return S_OK;
1075 }
1076
1077 static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface)
1078 {
1079 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1080 nsresult nsres;
1081
1082 TRACE("(%p)\n", This);
1083
1084 if(!This->doc_node->nsdoc) {
1085 ERR("!nsdoc\n");
1086 return E_NOTIMPL;
1087 }
1088
1089 nsres = nsIDOMHTMLDocument_Close(This->doc_node->nsdoc);
1090 if(NS_FAILED(nsres)) {
1091 ERR("Close failed: %08x\n", nsres);
1092 return E_FAIL;
1093 }
1094
1095 return S_OK;
1096 }
1097
1098 static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface)
1099 {
1100 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1101 nsresult nsres;
1102
1103 TRACE("(%p)\n", This);
1104
1105 nsres = nsIDOMHTMLDocument_Clear(This->doc_node->nsdoc);
1106 if(NS_FAILED(nsres)) {
1107 ERR("Clear failed: %08x\n", nsres);
1108 return E_FAIL;
1109 }
1110
1111 return S_OK;
1112 }
1113
1114 static const WCHAR copyW[] =
1115 {'c','o','p','y',0};
1116 static const WCHAR cutW[] =
1117 {'c','u','t',0};
1118 static const WCHAR fontnameW[] =
1119 {'f','o','n','t','n','a','m','e',0};
1120 static const WCHAR fontsizeW[] =
1121 {'f','o','n','t','s','i','z','e',0};
1122 static const WCHAR indentW[] =
1123 {'i','n','d','e','n','t',0};
1124 static const WCHAR insertorderedlistW[] =
1125 {'i','n','s','e','r','t','o','r','d','e','r','e','d','l','i','s','t',0};
1126 static const WCHAR insertunorderedlistW[] =
1127 {'i','n','s','e','r','t','u','n','o','r','d','e','r','e','d','l','i','s','t',0};
1128 static const WCHAR outdentW[] =
1129 {'o','u','t','d','e','n','t',0};
1130 static const WCHAR pasteW[] =
1131 {'p','a','s','t','e',0};
1132 static const WCHAR respectvisibilityindesignW[] =
1133 {'r','e','s','p','e','c','t','v','i','s','i','b','i','l','i','t','y','i','n','d','e','s','i','g','n',0};
1134
1135 static const struct {
1136 const WCHAR *name;
1137 OLECMDID id;
1138 }command_names[] = {
1139 {copyW, IDM_COPY},
1140 {cutW, IDM_CUT},
1141 {fontnameW, IDM_FONTNAME},
1142 {fontsizeW, IDM_FONTSIZE},
1143 {indentW, IDM_INDENT},
1144 {insertorderedlistW, IDM_ORDERLIST},
1145 {insertunorderedlistW, IDM_UNORDERLIST},
1146 {outdentW, IDM_OUTDENT},
1147 {pasteW, IDM_PASTE},
1148 {respectvisibilityindesignW, IDM_RESPECTVISIBILITY_INDESIGN}
1149 };
1150
1151 static BOOL cmdid_from_string(const WCHAR *str, OLECMDID *cmdid)
1152 {
1153 int i;
1154
1155 for(i = 0; i < sizeof(command_names)/sizeof(*command_names); i++) {
1156 if(!strcmpiW(command_names[i].name, str)) {
1157 *cmdid = command_names[i].id;
1158 return TRUE;
1159 }
1160 }
1161
1162 FIXME("Unknown command %s\n", debugstr_w(str));
1163 return FALSE;
1164 }
1165
1166 static HRESULT WINAPI HTMLDocument_queryCommandSupported(IHTMLDocument2 *iface, BSTR cmdID,
1167 VARIANT_BOOL *pfRet)
1168 {
1169 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1170 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1171 return E_NOTIMPL;
1172 }
1173
1174 static HRESULT WINAPI HTMLDocument_queryCommandEnabled(IHTMLDocument2 *iface, BSTR cmdID,
1175 VARIANT_BOOL *pfRet)
1176 {
1177 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1178 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1179 return E_NOTIMPL;
1180 }
1181
1182 static HRESULT WINAPI HTMLDocument_queryCommandState(IHTMLDocument2 *iface, BSTR cmdID,
1183 VARIANT_BOOL *pfRet)
1184 {
1185 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1186 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1187 return E_NOTIMPL;
1188 }
1189
1190 static HRESULT WINAPI HTMLDocument_queryCommandIndeterm(IHTMLDocument2 *iface, BSTR cmdID,
1191 VARIANT_BOOL *pfRet)
1192 {
1193 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1194 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1195 return E_NOTIMPL;
1196 }
1197
1198 static HRESULT WINAPI HTMLDocument_queryCommandText(IHTMLDocument2 *iface, BSTR cmdID,
1199 BSTR *pfRet)
1200 {
1201 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1202 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1203 return E_NOTIMPL;
1204 }
1205
1206 static HRESULT WINAPI HTMLDocument_queryCommandValue(IHTMLDocument2 *iface, BSTR cmdID,
1207 VARIANT *pfRet)
1208 {
1209 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1210 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1211 return E_NOTIMPL;
1212 }
1213
1214 static HRESULT WINAPI HTMLDocument_execCommand(IHTMLDocument2 *iface, BSTR cmdID,
1215 VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL *pfRet)
1216 {
1217 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1218 OLECMDID cmdid;
1219 VARIANT ret;
1220 HRESULT hres;
1221
1222 TRACE("(%p)->(%s %x %s %p)\n", This, debugstr_w(cmdID), showUI, debugstr_variant(&value), pfRet);
1223
1224 if(!cmdid_from_string(cmdID, &cmdid))
1225 return OLECMDERR_E_NOTSUPPORTED;
1226
1227 V_VT(&ret) = VT_EMPTY;
1228 hres = IOleCommandTarget_Exec(&This->IOleCommandTarget_iface, &CGID_MSHTML, cmdid,
1229 showUI ? 0 : OLECMDEXECOPT_DONTPROMPTUSER, &value, &ret);
1230 if(FAILED(hres))
1231 return hres;
1232
1233 if(V_VT(&ret) != VT_EMPTY) {
1234 FIXME("Handle ret %s\n", debugstr_variant(&ret));
1235 VariantClear(&ret);
1236 }
1237
1238 *pfRet = VARIANT_TRUE;
1239 return S_OK;
1240 }
1241
1242 static HRESULT WINAPI HTMLDocument_execCommandShowHelp(IHTMLDocument2 *iface, BSTR cmdID,
1243 VARIANT_BOOL *pfRet)
1244 {
1245 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1246 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
1247 return E_NOTIMPL;
1248 }
1249
1250 static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTag,
1251 IHTMLElement **newElem)
1252 {
1253 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1254 HTMLElement *elem;
1255 HRESULT hres;
1256
1257 TRACE("(%p)->(%s %p)\n", This, debugstr_w(eTag), newElem);
1258
1259 hres = create_element(This->doc_node, eTag, &elem);
1260 if(FAILED(hres))
1261 return hres;
1262
1263 *newElem = &elem->IHTMLElement_iface;
1264 return S_OK;
1265 }
1266
1267 static HRESULT WINAPI HTMLDocument_put_onhelp(IHTMLDocument2 *iface, VARIANT v)
1268 {
1269 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1270 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1271 return E_NOTIMPL;
1272 }
1273
1274 static HRESULT WINAPI HTMLDocument_get_onhelp(IHTMLDocument2 *iface, VARIANT *p)
1275 {
1276 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1277 FIXME("(%p)->(%p)\n", This, p);
1278 return E_NOTIMPL;
1279 }
1280
1281 static HRESULT WINAPI HTMLDocument_put_onclick(IHTMLDocument2 *iface, VARIANT v)
1282 {
1283 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1284
1285 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1286
1287 return set_doc_event(This, EVENTID_CLICK, &v);
1288 }
1289
1290 static HRESULT WINAPI HTMLDocument_get_onclick(IHTMLDocument2 *iface, VARIANT *p)
1291 {
1292 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1293
1294 TRACE("(%p)->(%p)\n", This, p);
1295
1296 return get_doc_event(This, EVENTID_CLICK, p);
1297 }
1298
1299 static HRESULT WINAPI HTMLDocument_put_ondblclick(IHTMLDocument2 *iface, VARIANT v)
1300 {
1301 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1302
1303 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1304
1305 return set_doc_event(This, EVENTID_DBLCLICK, &v);
1306 }
1307
1308 static HRESULT WINAPI HTMLDocument_get_ondblclick(IHTMLDocument2 *iface, VARIANT *p)
1309 {
1310 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1311
1312 TRACE("(%p)->(%p)\n", This, p);
1313
1314 return get_doc_event(This, EVENTID_DBLCLICK, p);
1315 }
1316
1317 static HRESULT WINAPI HTMLDocument_put_onkeyup(IHTMLDocument2 *iface, VARIANT v)
1318 {
1319 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1320
1321 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1322
1323 return set_doc_event(This, EVENTID_KEYUP, &v);
1324 }
1325
1326 static HRESULT WINAPI HTMLDocument_get_onkeyup(IHTMLDocument2 *iface, VARIANT *p)
1327 {
1328 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1329
1330 TRACE("(%p)->(%p)\n", This, p);
1331
1332 return get_doc_event(This, EVENTID_KEYUP, p);
1333 }
1334
1335 static HRESULT WINAPI HTMLDocument_put_onkeydown(IHTMLDocument2 *iface, VARIANT v)
1336 {
1337 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1338
1339 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1340
1341 return set_doc_event(This, EVENTID_KEYDOWN, &v);
1342 }
1343
1344 static HRESULT WINAPI HTMLDocument_get_onkeydown(IHTMLDocument2 *iface, VARIANT *p)
1345 {
1346 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1347
1348 TRACE("(%p)->(%p)\n", This, p);
1349
1350 return get_doc_event(This, EVENTID_KEYDOWN, p);
1351 }
1352
1353 static HRESULT WINAPI HTMLDocument_put_onkeypress(IHTMLDocument2 *iface, VARIANT v)
1354 {
1355 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1356
1357 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1358
1359 return set_doc_event(This, EVENTID_KEYPRESS, &v);
1360 }
1361
1362 static HRESULT WINAPI HTMLDocument_get_onkeypress(IHTMLDocument2 *iface, VARIANT *p)
1363 {
1364 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1365
1366 TRACE("(%p)->(%p)\n", This, p);
1367
1368 return get_doc_event(This, EVENTID_KEYPRESS, p);
1369 }
1370
1371 static HRESULT WINAPI HTMLDocument_put_onmouseup(IHTMLDocument2 *iface, VARIANT v)
1372 {
1373 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1374
1375 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1376
1377 return set_doc_event(This, EVENTID_MOUSEUP, &v);
1378 }
1379
1380 static HRESULT WINAPI HTMLDocument_get_onmouseup(IHTMLDocument2 *iface, VARIANT *p)
1381 {
1382 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1383
1384 TRACE("(%p)->(%p)\n", This, p);
1385
1386 return get_doc_event(This, EVENTID_MOUSEUP, p);
1387 }
1388
1389 static HRESULT WINAPI HTMLDocument_put_onmousedown(IHTMLDocument2 *iface, VARIANT v)
1390 {
1391 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1392
1393 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1394
1395 return set_doc_event(This, EVENTID_MOUSEDOWN, &v);
1396 }
1397
1398 static HRESULT WINAPI HTMLDocument_get_onmousedown(IHTMLDocument2 *iface, VARIANT *p)
1399 {
1400 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1401
1402 TRACE("(%p)->(%p)\n", This, p);
1403
1404 return get_doc_event(This, EVENTID_MOUSEDOWN, p);
1405 }
1406
1407 static HRESULT WINAPI HTMLDocument_put_onmousemove(IHTMLDocument2 *iface, VARIANT v)
1408 {
1409 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1410
1411 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1412
1413 return set_doc_event(This, EVENTID_MOUSEMOVE, &v);
1414 }
1415
1416 static HRESULT WINAPI HTMLDocument_get_onmousemove(IHTMLDocument2 *iface, VARIANT *p)
1417 {
1418 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1419
1420 TRACE("(%p)->(%p)\n", This, p);
1421
1422 return get_doc_event(This, EVENTID_MOUSEMOVE, p);
1423 }
1424
1425 static HRESULT WINAPI HTMLDocument_put_onmouseout(IHTMLDocument2 *iface, VARIANT v)
1426 {
1427 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1428
1429 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1430
1431 return set_doc_event(This, EVENTID_MOUSEOUT, &v);
1432 }
1433
1434 static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT *p)
1435 {
1436 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1437
1438 TRACE("(%p)->(%p)\n", This, p);
1439
1440 return get_doc_event(This, EVENTID_MOUSEOUT, p);
1441 }
1442
1443 static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v)
1444 {
1445 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1446
1447 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1448
1449 return set_doc_event(This, EVENTID_MOUSEOVER, &v);
1450 }
1451
1452 static HRESULT WINAPI HTMLDocument_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p)
1453 {
1454 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1455
1456 TRACE("(%p)->(%p)\n", This, p);
1457
1458 return get_doc_event(This, EVENTID_MOUSEOVER, p);
1459 }
1460
1461 static HRESULT WINAPI HTMLDocument_put_onreadystatechange(IHTMLDocument2 *iface, VARIANT v)
1462 {
1463 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1464
1465 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1466
1467 return set_doc_event(This, EVENTID_READYSTATECHANGE, &v);
1468 }
1469
1470 static HRESULT WINAPI HTMLDocument_get_onreadystatechange(IHTMLDocument2 *iface, VARIANT *p)
1471 {
1472 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1473
1474 TRACE("(%p)->(%p)\n", This, p);
1475
1476 return get_doc_event(This, EVENTID_READYSTATECHANGE, p);
1477 }
1478
1479 static HRESULT WINAPI HTMLDocument_put_onafterupdate(IHTMLDocument2 *iface, VARIANT v)
1480 {
1481 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1482 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1483 return E_NOTIMPL;
1484 }
1485
1486 static HRESULT WINAPI HTMLDocument_get_onafterupdate(IHTMLDocument2 *iface, VARIANT *p)
1487 {
1488 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1489 FIXME("(%p)->(%p)\n", This, p);
1490 return E_NOTIMPL;
1491 }
1492
1493 static HRESULT WINAPI HTMLDocument_put_onrowexit(IHTMLDocument2 *iface, VARIANT v)
1494 {
1495 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1496 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1497 return E_NOTIMPL;
1498 }
1499
1500 static HRESULT WINAPI HTMLDocument_get_onrowexit(IHTMLDocument2 *iface, VARIANT *p)
1501 {
1502 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1503 FIXME("(%p)->(%p)\n", This, p);
1504 return E_NOTIMPL;
1505 }
1506
1507 static HRESULT WINAPI HTMLDocument_put_onrowenter(IHTMLDocument2 *iface, VARIANT v)
1508 {
1509 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1510 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1511 return E_NOTIMPL;
1512 }
1513
1514 static HRESULT WINAPI HTMLDocument_get_onrowenter(IHTMLDocument2 *iface, VARIANT *p)
1515 {
1516 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1517 FIXME("(%p)->(%p)\n", This, p);
1518 return E_NOTIMPL;
1519 }
1520
1521 static HRESULT WINAPI HTMLDocument_put_ondragstart(IHTMLDocument2 *iface, VARIANT v)
1522 {
1523 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1524
1525 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1526
1527 return set_doc_event(This, EVENTID_DRAGSTART, &v);
1528 }
1529
1530 static HRESULT WINAPI HTMLDocument_get_ondragstart(IHTMLDocument2 *iface, VARIANT *p)
1531 {
1532 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1533
1534 TRACE("(%p)->(%p)\n", This, p);
1535
1536 return get_doc_event(This, EVENTID_DRAGSTART, p);
1537 }
1538
1539 static HRESULT WINAPI HTMLDocument_put_onselectstart(IHTMLDocument2 *iface, VARIANT v)
1540 {
1541 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1542
1543 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
1544
1545 return set_doc_event(This, EVENTID_SELECTSTART, &v);
1546 }
1547
1548 static HRESULT WINAPI HTMLDocument_get_onselectstart(IHTMLDocument2 *iface, VARIANT *p)
1549 {
1550 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1551
1552 TRACE("(%p)->(%p)\n", This, p);
1553
1554 return get_doc_event(This, EVENTID_SELECTSTART, p);
1555 }
1556
1557 static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, LONG x, LONG y,
1558 IHTMLElement **elementHit)
1559 {
1560 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1561 nsIDOMElement *nselem;
1562 HTMLDOMNode *node;
1563 nsresult nsres;
1564 HRESULT hres;
1565
1566 TRACE("(%p)->(%d %d %p)\n", This, x, y, elementHit);
1567
1568 nsres = nsIDOMHTMLDocument_ElementFromPoint(This->doc_node->nsdoc, x, y, &nselem);
1569 if(NS_FAILED(nsres)) {
1570 ERR("ElementFromPoint failed: %08x\n", nsres);
1571 return E_FAIL;
1572 }
1573
1574 if(!nselem) {
1575 *elementHit = NULL;
1576 return S_OK;
1577 }
1578
1579 hres = get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE, &node);
1580 nsIDOMElement_Release(nselem);
1581 if(FAILED(hres))
1582 return hres;
1583
1584 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)elementHit);
1585 node_release(node);
1586 return hres;
1587 }
1588
1589 static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p)
1590 {
1591 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1592
1593 TRACE("(%p)->(%p)\n", This, p);
1594
1595 *p = &This->window->base.IHTMLWindow2_iface;
1596 IHTMLWindow2_AddRef(*p);
1597 return S_OK;
1598 }
1599
1600 static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
1601 IHTMLStyleSheetsCollection **p)
1602 {
1603 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1604 nsIDOMStyleSheetList *nsstylelist;
1605 nsresult nsres;
1606
1607 TRACE("(%p)->(%p)\n", This, p);
1608
1609 *p = NULL;
1610
1611 if(!This->doc_node->nsdoc) {
1612 WARN("NULL nsdoc\n");
1613 return E_UNEXPECTED;
1614 }
1615
1616 nsres = nsIDOMHTMLDocument_GetStyleSheets(This->doc_node->nsdoc, &nsstylelist);
1617 if(NS_FAILED(nsres)) {
1618 ERR("GetStyleSheets failed: %08x\n", nsres);
1619 return E_FAIL;
1620 }
1621
1622 *p = HTMLStyleSheetsCollection_Create(nsstylelist);
1623 nsIDOMStyleSheetList_Release(nsstylelist);
1624
1625 return S_OK;
1626 }
1627
1628 static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v)
1629 {
1630 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1631 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1632 return E_NOTIMPL;
1633 }
1634
1635 static HRESULT WINAPI HTMLDocument_get_onbeforeupdate(IHTMLDocument2 *iface, VARIANT *p)
1636 {
1637 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1638 FIXME("(%p)->(%p)\n", This, p);
1639 return E_NOTIMPL;
1640 }
1641
1642 static HRESULT WINAPI HTMLDocument_put_onerrorupdate(IHTMLDocument2 *iface, VARIANT v)
1643 {
1644 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1645 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
1646 return E_NOTIMPL;
1647 }
1648
1649 static HRESULT WINAPI HTMLDocument_get_onerrorupdate(IHTMLDocument2 *iface, VARIANT *p)
1650 {
1651 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1652 FIXME("(%p)->(%p)\n", This, p);
1653 return E_NOTIMPL;
1654 }
1655
1656 static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String)
1657 {
1658 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1659
1660 static const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0};
1661
1662 TRACE("(%p)->(%p)\n", This, String);
1663
1664 if(!String)
1665 return E_INVALIDARG;
1666
1667 *String = SysAllocString(objectW);
1668 return *String ? S_OK : E_OUTOFMEMORY;
1669
1670 }
1671
1672 static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR bstrHref,
1673 LONG lIndex, IHTMLStyleSheet **ppnewStyleSheet)
1674 {
1675 HTMLDocument *This = impl_from_IHTMLDocument2(iface);
1676 nsIDOMHTMLHeadElement *head_elem;
1677 IHTMLStyleElement *style_elem;
1678 HTMLElement *elem;
1679 nsresult nsres;
1680 HRESULT hres;
1681
1682 static const WCHAR styleW[] = {'s','t','y','l','e',0};
1683
1684 TRACE("(%p)->(%s %d %p)\n", This, debugstr_w(bstrHref), lIndex, ppnewStyleSheet);
1685
1686 if(!This->doc_node->nsdoc) {
1687 FIXME("not a real doc object\n");
1688 return E_NOTIMPL;
1689 }
1690
1691 if(lIndex != -1)
1692 FIXME("Unsupported lIndex %d\n", lIndex);
1693
1694 if(bstrHref && *bstrHref) {
1695 FIXME("semi-stub for href %s\n", debugstr_w(bstrHref));
1696 *ppnewStyleSheet = HTMLStyleSheet_Create(NULL);
1697 return S_OK;
1698 }
1699
1700 hres = create_element(This->doc_node, styleW, &elem);
1701 if(FAILED(hres))
1702 return hres;
1703
1704 nsres = nsIDOMHTMLDocument_GetHead(This->doc_node->nsdoc, &head_elem);
1705 if(NS_SUCCEEDED(nsres)) {
1706 nsIDOMNode *head_node, *tmp_node;
1707
1708 nsres = nsIDOMHTMLHeadElement_QueryInterface(head_elem, &IID_nsIDOMNode, (void**)&head_node);
1709 nsIDOMHTMLHeadElement_Release(head_elem);
1710 assert(nsres == NS_OK);
1711
1712 nsres = nsIDOMNode_AppendChild(head_node, elem->node.nsnode, &tmp_node);
1713 nsIDOMNode_Release(head_node);
1714 if(NS_SUCCEEDED(nsres) && tmp_node)
1715 nsIDOMNode_Release(tmp_node);
1716 }
1717 if(NS_FAILED(nsres)) {
1718 IHTMLElement_Release(&elem->IHTMLElement_iface);
1719 return E_FAIL;
1720 }
1721
1722 hres = IHTMLElement_QueryInterface(&elem->IHTMLElement_iface, &IID_IHTMLStyleElement, (void**)&style_elem);
1723 assert(hres == S_OK);
1724 IHTMLElement_Release(&elem->IHTMLElement_iface);
1725
1726 hres = IHTMLStyleElement_get_styleSheet(style_elem, ppnewStyleSheet);
1727 IHTMLStyleElement_Release(style_elem);
1728 return hres;
1729 }
1730
1731 static const IHTMLDocument2Vtbl HTMLDocumentVtbl = {
1732 HTMLDocument_QueryInterface,
1733 HTMLDocument_AddRef,
1734 HTMLDocument_Release,
1735 HTMLDocument_GetTypeInfoCount,
1736 HTMLDocument_GetTypeInfo,
1737 HTMLDocument_GetIDsOfNames,
1738 HTMLDocument_Invoke,
1739 HTMLDocument_get_Script,
1740 HTMLDocument_get_all,
1741 HTMLDocument_get_body,
1742 HTMLDocument_get_activeElement,
1743 HTMLDocument_get_images,
1744 HTMLDocument_get_applets,
1745 HTMLDocument_get_links,
1746 HTMLDocument_get_forms,
1747 HTMLDocument_get_anchors,
1748 HTMLDocument_put_title,
1749 HTMLDocument_get_title,
1750 HTMLDocument_get_scripts,
1751 HTMLDocument_put_designMode,
1752 HTMLDocument_get_designMode,
1753 HTMLDocument_get_selection,
1754 HTMLDocument_get_readyState,
1755 HTMLDocument_get_frames,
1756 HTMLDocument_get_embeds,
1757 HTMLDocument_get_plugins,
1758 HTMLDocument_put_alinkColor,
1759 HTMLDocument_get_alinkColor,
1760 HTMLDocument_put_bgColor,
1761 HTMLDocument_get_bgColor,
1762 HTMLDocument_put_fgColor,
1763 HTMLDocument_get_fgColor,
1764 HTMLDocument_put_linkColor,
1765 HTMLDocument_get_linkColor,
1766 HTMLDocument_put_vlinkColor,
1767 HTMLDocument_get_vlinkColor,
1768 HTMLDocument_get_referrer,
1769 HTMLDocument_get_location,
1770 HTMLDocument_get_lastModified,
1771 HTMLDocument_put_URL,
1772 HTMLDocument_get_URL,
1773 HTMLDocument_put_domain,
1774 HTMLDocument_get_domain,
1775 HTMLDocument_put_cookie,
1776 HTMLDocument_get_cookie,
1777 HTMLDocument_put_expando,
1778 HTMLDocument_get_expando,
1779 HTMLDocument_put_charset,
1780 HTMLDocument_get_charset,
1781 HTMLDocument_put_defaultCharset,
1782 HTMLDocument_get_defaultCharset,
1783 HTMLDocument_get_mimeType,
1784 HTMLDocument_get_fileSize,
1785 HTMLDocument_get_fileCreatedDate,
1786 HTMLDocument_get_fileModifiedDate,
1787 HTMLDocument_get_fileUpdatedDate,
1788 HTMLDocument_get_security,
1789 HTMLDocument_get_protocol,
1790 HTMLDocument_get_nameProp,
1791 HTMLDocument_write,
1792 HTMLDocument_writeln,
1793 HTMLDocument_open,
1794 HTMLDocument_close,
1795 HTMLDocument_clear,
1796 HTMLDocument_queryCommandSupported,
1797 HTMLDocument_queryCommandEnabled,
1798 HTMLDocument_queryCommandState,
1799 HTMLDocument_queryCommandIndeterm,
1800 HTMLDocument_queryCommandText,
1801 HTMLDocument_queryCommandValue,
1802 HTMLDocument_execCommand,
1803 HTMLDocument_execCommandShowHelp,
1804 HTMLDocument_createElement,
1805 HTMLDocument_put_onhelp,
1806 HTMLDocument_get_onhelp,
1807 HTMLDocument_put_onclick,
1808 HTMLDocument_get_onclick,
1809 HTMLDocument_put_ondblclick,
1810 HTMLDocument_get_ondblclick,
1811 HTMLDocument_put_onkeyup,
1812 HTMLDocument_get_onkeyup,
1813 HTMLDocument_put_onkeydown,
1814 HTMLDocument_get_onkeydown,
1815 HTMLDocument_put_onkeypress,
1816 HTMLDocument_get_onkeypress,
1817 HTMLDocument_put_onmouseup,
1818 HTMLDocument_get_onmouseup,
1819 HTMLDocument_put_onmousedown,
1820 HTMLDocument_get_onmousedown,
1821 HTMLDocument_put_onmousemove,
1822 HTMLDocument_get_onmousemove,
1823 HTMLDocument_put_onmouseout,
1824 HTMLDocument_get_onmouseout,
1825 HTMLDocument_put_onmouseover,
1826 HTMLDocument_get_onmouseover,
1827 HTMLDocument_put_onreadystatechange,
1828 HTMLDocument_get_onreadystatechange,
1829 HTMLDocument_put_onafterupdate,
1830 HTMLDocument_get_onafterupdate,
1831 HTMLDocument_put_onrowexit,
1832 HTMLDocument_get_onrowexit,
1833 HTMLDocument_put_onrowenter,
1834 HTMLDocument_get_onrowenter,
1835 HTMLDocument_put_ondragstart,
1836 HTMLDocument_get_ondragstart,
1837 HTMLDocument_put_onselectstart,
1838 HTMLDocument_get_onselectstart,
1839 HTMLDocument_elementFromPoint,
1840 HTMLDocument_get_parentWindow,
1841 HTMLDocument_get_styleSheets,
1842 HTMLDocument_put_onbeforeupdate,
1843 HTMLDocument_get_onbeforeupdate,
1844 HTMLDocument_put_onerrorupdate,
1845 HTMLDocument_get_onerrorupdate,
1846 HTMLDocument_toString,
1847 HTMLDocument_createStyleSheet
1848 };
1849
1850 static inline HTMLDocument *impl_from_IHTMLDocument3(IHTMLDocument3 *iface)
1851 {
1852 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument3_iface);
1853 }
1854
1855 static HRESULT WINAPI HTMLDocument3_QueryInterface(IHTMLDocument3 *iface,
1856 REFIID riid, void **ppv)
1857 {
1858 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1859 return htmldoc_query_interface(This, riid, ppv);
1860 }
1861
1862 static ULONG WINAPI HTMLDocument3_AddRef(IHTMLDocument3 *iface)
1863 {
1864 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1865 return htmldoc_addref(This);
1866 }
1867
1868 static ULONG WINAPI HTMLDocument3_Release(IHTMLDocument3 *iface)
1869 {
1870 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1871 return htmldoc_release(This);
1872 }
1873
1874 static HRESULT WINAPI HTMLDocument3_GetTypeInfoCount(IHTMLDocument3 *iface, UINT *pctinfo)
1875 {
1876 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1877 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
1878 }
1879
1880 static HRESULT WINAPI HTMLDocument3_GetTypeInfo(IHTMLDocument3 *iface, UINT iTInfo,
1881 LCID lcid, ITypeInfo **ppTInfo)
1882 {
1883 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1884 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1885 }
1886
1887 static HRESULT WINAPI HTMLDocument3_GetIDsOfNames(IHTMLDocument3 *iface, REFIID riid,
1888 LPOLESTR *rgszNames, UINT cNames,
1889 LCID lcid, DISPID *rgDispId)
1890 {
1891 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1892 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
1893 rgDispId);
1894 }
1895
1896 static HRESULT WINAPI HTMLDocument3_Invoke(IHTMLDocument3 *iface, DISPID dispIdMember,
1897 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1898 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1899 {
1900 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1901 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
1902 pDispParams, pVarResult, pExcepInfo, puArgErr);
1903 }
1904
1905 static HRESULT WINAPI HTMLDocument3_releaseCapture(IHTMLDocument3 *iface)
1906 {
1907 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1908 FIXME("(%p)\n", This);
1909 return E_NOTIMPL;
1910 }
1911
1912 static HRESULT WINAPI HTMLDocument3_recalc(IHTMLDocument3 *iface, VARIANT_BOOL fForce)
1913 {
1914 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1915
1916 WARN("(%p)->(%x)\n", This, fForce);
1917
1918 /* Doing nothing here should be fine for us. */
1919 return S_OK;
1920 }
1921
1922 static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR text,
1923 IHTMLDOMNode **newTextNode)
1924 {
1925 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1926 nsIDOMText *nstext;
1927 HTMLDOMNode *node;
1928 nsAString text_str;
1929 nsresult nsres;
1930 HRESULT hres;
1931
1932 TRACE("(%p)->(%s %p)\n", This, debugstr_w(text), newTextNode);
1933
1934 if(!This->doc_node->nsdoc) {
1935 WARN("NULL nsdoc\n");
1936 return E_UNEXPECTED;
1937 }
1938
1939 nsAString_InitDepend(&text_str, text);
1940 nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &text_str, &nstext);
1941 nsAString_Finish(&text_str);
1942 if(NS_FAILED(nsres)) {
1943 ERR("CreateTextNode failed: %08x\n", nsres);
1944 return E_FAIL;
1945 }
1946
1947 hres = HTMLDOMTextNode_Create(This->doc_node, (nsIDOMNode*)nstext, &node);
1948 nsIDOMText_Release(nstext);
1949 if(FAILED(hres))
1950 return hres;
1951
1952 *newTextNode = &node->IHTMLDOMNode_iface;
1953 return S_OK;
1954 }
1955
1956 static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p)
1957 {
1958 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
1959 nsIDOMElement *nselem = NULL;
1960 HTMLDOMNode *node;
1961 nsresult nsres;
1962 HRESULT hres;
1963
1964 TRACE("(%p)->(%p)\n", This, p);
1965
1966 if(This->window->readystate == READYSTATE_UNINITIALIZED) {
1967 *p = NULL;
1968 return S_OK;
1969 }
1970
1971 if(!This->doc_node->nsdoc) {
1972 WARN("NULL nsdoc\n");
1973 return E_UNEXPECTED;
1974 }
1975
1976 nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
1977 if(NS_FAILED(nsres)) {
1978 ERR("GetDocumentElement failed: %08x\n", nsres);
1979 return E_FAIL;
1980 }
1981
1982 if(!nselem) {
1983 *p = NULL;
1984 return S_OK;
1985 }
1986
1987 hres = get_node(This->doc_node, (nsIDOMNode *)nselem, TRUE, &node);
1988 nsIDOMElement_Release(nselem);
1989 if(FAILED(hres))
1990 return hres;
1991
1992 hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
1993 node_release(node);
1994 return hres;
1995 }
1996
1997 static HRESULT WINAPI HTMLDocument3_uniqueID(IHTMLDocument3 *iface, BSTR *p)
1998 {
1999 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2000 FIXME("(%p)->(%p)\n", This, p);
2001 return E_NOTIMPL;
2002 }
2003
2004 static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR event,
2005 IDispatch* pDisp, VARIANT_BOOL *pfResult)
2006 {
2007 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2008
2009 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
2010
2011 return attach_event(&This->doc_node->node.event_target, event, pDisp, pfResult);
2012 }
2013
2014 static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR event,
2015 IDispatch *pDisp)
2016 {
2017 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2018
2019 TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
2020
2021 return detach_event(&This->doc_node->node.event_target, event, pDisp);
2022 }
2023
2024 static HRESULT WINAPI HTMLDocument3_put_onrowsdelete(IHTMLDocument3 *iface, VARIANT v)
2025 {
2026 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2027 FIXME("(%p)->()\n", This);
2028 return E_NOTIMPL;
2029 }
2030
2031 static HRESULT WINAPI HTMLDocument3_get_onrowsdelete(IHTMLDocument3 *iface, VARIANT *p)
2032 {
2033 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2034 FIXME("(%p)->(%p)\n", This, p);
2035 return E_NOTIMPL;
2036 }
2037
2038 static HRESULT WINAPI HTMLDocument3_put_onrowsinserted(IHTMLDocument3 *iface, VARIANT v)
2039 {
2040 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2041 FIXME("(%p)->()\n", This);
2042 return E_NOTIMPL;
2043 }
2044
2045 static HRESULT WINAPI HTMLDocument3_get_onrowsinserted(IHTMLDocument3 *iface, VARIANT *p)
2046 {
2047 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2048 FIXME("(%p)->(%p)\n", This, p);
2049 return E_NOTIMPL;
2050 }
2051
2052 static HRESULT WINAPI HTMLDocument3_put_oncellchange(IHTMLDocument3 *iface, VARIANT v)
2053 {
2054 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2055 FIXME("(%p)->()\n", This);
2056 return E_NOTIMPL;
2057 }
2058
2059 static HRESULT WINAPI HTMLDocument3_get_oncellchange(IHTMLDocument3 *iface, VARIANT *p)
2060 {
2061 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2062 FIXME("(%p)->(%p)\n", This, p);
2063 return E_NOTIMPL;
2064 }
2065
2066 static HRESULT WINAPI HTMLDocument3_put_ondatasetchanged(IHTMLDocument3 *iface, VARIANT v)
2067 {
2068 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2069 FIXME("(%p)->()\n", This);
2070 return E_NOTIMPL;
2071 }
2072
2073 static HRESULT WINAPI HTMLDocument3_get_ondatasetchanged(IHTMLDocument3 *iface, VARIANT *p)
2074 {
2075 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2076 FIXME("(%p)->(%p)\n", This, p);
2077 return E_NOTIMPL;
2078 }
2079
2080 static HRESULT WINAPI HTMLDocument3_put_ondataavailable(IHTMLDocument3 *iface, VARIANT v)
2081 {
2082 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2083 FIXME("(%p)->()\n", This);
2084 return E_NOTIMPL;
2085 }
2086
2087 static HRESULT WINAPI HTMLDocument3_get_ondataavailable(IHTMLDocument3 *iface, VARIANT *p)
2088 {
2089 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2090 FIXME("(%p)->(%p)\n", This, p);
2091 return E_NOTIMPL;
2092 }
2093
2094 static HRESULT WINAPI HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT v)
2095 {
2096 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2097 FIXME("(%p)->()\n", This);
2098 return E_NOTIMPL;
2099 }
2100
2101 static HRESULT WINAPI HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT *p)
2102 {
2103 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2104 FIXME("(%p)->(%p)\n", This, p);
2105 return E_NOTIMPL;
2106 }
2107
2108 static HRESULT WINAPI HTMLDocument3_put_onpropertychange(IHTMLDocument3 *iface, VARIANT v)
2109 {
2110 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2111 FIXME("(%p)->()\n", This);
2112 return E_NOTIMPL;
2113 }
2114
2115 static HRESULT WINAPI HTMLDocument3_get_onpropertychange(IHTMLDocument3 *iface, VARIANT *p)
2116 {
2117 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2118 FIXME("(%p)->(%p)\n", This, p);
2119 return E_NOTIMPL;
2120 }
2121
2122 static HRESULT WINAPI HTMLDocument3_put_dir(IHTMLDocument3 *iface, BSTR v)
2123 {
2124 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2125 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2126 return E_NOTIMPL;
2127 }
2128
2129 static HRESULT WINAPI HTMLDocument3_get_dir(IHTMLDocument3 *iface, BSTR *p)
2130 {
2131 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2132 FIXME("(%p)->(%p)\n", This, p);
2133 return E_NOTIMPL;
2134 }
2135
2136 static HRESULT WINAPI HTMLDocument3_put_oncontextmenu(IHTMLDocument3 *iface, VARIANT v)
2137 {
2138 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2139
2140 TRACE("(%p)->()\n", This);
2141
2142 return set_doc_event(This, EVENTID_CONTEXTMENU, &v);
2143 }
2144
2145 static HRESULT WINAPI HTMLDocument3_get_oncontextmenu(IHTMLDocument3 *iface, VARIANT *p)
2146 {
2147 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2148
2149 TRACE("(%p)->(%p)\n", This, p);
2150
2151 return get_doc_event(This, EVENTID_CONTEXTMENU, p);
2152 }
2153
2154 static HRESULT WINAPI HTMLDocument3_put_onstop(IHTMLDocument3 *iface, VARIANT v)
2155 {
2156 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2157 FIXME("(%p)->()\n", This);
2158 return E_NOTIMPL;
2159 }
2160
2161 static HRESULT WINAPI HTMLDocument3_get_onstop(IHTMLDocument3 *iface, VARIANT *p)
2162 {
2163 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2164 FIXME("(%p)->(%p)\n", This, p);
2165 return E_NOTIMPL;
2166 }
2167
2168 static HRESULT WINAPI HTMLDocument3_createDocumentFragment(IHTMLDocument3 *iface,
2169 IHTMLDocument2 **ppNewDoc)
2170 {
2171 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2172 nsIDOMDocumentFragment *doc_frag;
2173 HTMLDocumentNode *docnode;
2174 nsresult nsres;
2175 HRESULT hres;
2176
2177 TRACE("(%p)->(%p)\n", This, ppNewDoc);
2178
2179 if(!This->doc_node->nsdoc) {
2180 FIXME("NULL nsdoc\n");
2181 return E_NOTIMPL;
2182 }
2183
2184 nsres = nsIDOMHTMLDocument_CreateDocumentFragment(This->doc_node->nsdoc, &doc_frag);
2185 if(NS_FAILED(nsres)) {
2186 ERR("CreateDocumentFragment failed: %08x\n", nsres);
2187 return E_FAIL;
2188 }
2189
2190 hres = create_document_fragment((nsIDOMNode*)doc_frag, This->doc_node, &docnode);
2191 nsIDOMDocumentFragment_Release(doc_frag);
2192 if(FAILED(hres))
2193 return hres;
2194
2195 *ppNewDoc = &docnode->basedoc.IHTMLDocument2_iface;
2196 return S_OK;
2197 }
2198
2199 static HRESULT WINAPI HTMLDocument3_get_parentDocument(IHTMLDocument3 *iface,
2200 IHTMLDocument2 **p)
2201 {
2202 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2203 FIXME("(%p)->(%p)\n", This, p);
2204 return E_NOTIMPL;
2205 }
2206
2207 static HRESULT WINAPI HTMLDocument3_put_enableDownload(IHTMLDocument3 *iface,
2208 VARIANT_BOOL v)
2209 {
2210 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2211 FIXME("(%p)->(%x)\n", This, v);
2212 return E_NOTIMPL;
2213 }
2214
2215 static HRESULT WINAPI HTMLDocument3_get_enableDownload(IHTMLDocument3 *iface,
2216 VARIANT_BOOL *p)
2217 {
2218 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2219 FIXME("(%p)->(%p)\n", This, p);
2220 return E_NOTIMPL;
2221 }
2222
2223 static HRESULT WINAPI HTMLDocument3_put_baseUrl(IHTMLDocument3 *iface, BSTR v)
2224 {
2225 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2226 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2227 return E_NOTIMPL;
2228 }
2229
2230 static HRESULT WINAPI HTMLDocument3_get_baseUrl(IHTMLDocument3 *iface, BSTR *p)
2231 {
2232 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2233 FIXME("(%p)->(%p)\n", This, p);
2234 return E_NOTIMPL;
2235 }
2236
2237 static HRESULT WINAPI HTMLDocument3_get_childNodes(IHTMLDocument3 *iface, IDispatch **p)
2238 {
2239 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2240
2241 TRACE("(%p)->(%p)\n", This, p);
2242
2243 return IHTMLDOMNode_get_childNodes(&This->doc_node->node.IHTMLDOMNode_iface, p);
2244 }
2245
2246 static HRESULT WINAPI HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3 *iface,
2247 VARIANT_BOOL v)
2248 {
2249 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2250 FIXME("(%p)->()\n", This);
2251 return E_NOTIMPL;
2252 }
2253
2254 static HRESULT WINAPI HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3 *iface,
2255 VARIANT_BOOL *p)
2256 {
2257 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2258 FIXME("(%p)->(%p)\n", This, p);
2259 return E_NOTIMPL;
2260 }
2261
2262 static HRESULT WINAPI HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT v)
2263 {
2264 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2265 FIXME("(%p)->()\n", This);
2266 return E_NOTIMPL;
2267 }
2268
2269 static HRESULT WINAPI HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT *p)
2270 {
2271 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2272 FIXME("(%p)->(%p)\n", This, p);
2273 return E_NOTIMPL;
2274 }
2275
2276 static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BSTR v,
2277 IHTMLElementCollection **ppelColl)
2278 {
2279 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2280 nsIDOMNodeList *node_list;
2281 nsAString selector_str;
2282 WCHAR *selector;
2283 nsresult nsres;
2284
2285 static const WCHAR formatW[] = {'*','[','i','d','=','%','s',']',',','*','[','n','a','m','e','=','%','s',']',0};
2286
2287 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), ppelColl);
2288
2289 if(!This->doc_node || !This->doc_node->nsdoc) {
2290 /* We should probably return an empty collection. */
2291 FIXME("No nsdoc\n");
2292 return E_NOTIMPL;
2293 }
2294
2295 selector = heap_alloc(2*SysStringLen(v)*sizeof(WCHAR) + sizeof(formatW));
2296 if(!selector)
2297 return E_OUTOFMEMORY;
2298 sprintfW(selector, formatW, v, v);
2299
2300 /*
2301 * NOTE: IE getElementsByName implementation differs from Gecko. It searches both name and id attributes.
2302 * That's why we use CSS selector instead. We should also use name only when it applies to given element
2303 * types and search should be case insensitive. Those are currently not supported properly.
2304 */
2305 nsAString_InitDepend(&selector_str, selector);
2306 nsres = nsIDOMHTMLDocument_QuerySelectorAll(This->doc_node->nsdoc, &selector_str, &node_list);
2307 nsAString_Finish(&selector_str);
2308 heap_free(selector);
2309 if(NS_FAILED(nsres)) {
2310 ERR("QuerySelectorAll failed: %08x\n", nsres);
2311 return E_FAIL;
2312 }
2313
2314 *ppelColl = create_collection_from_nodelist(This->doc_node, node_list);
2315 nsIDOMNodeList_Release(node_list);
2316 return S_OK;
2317 }
2318
2319
2320 static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v,
2321 IHTMLElement **pel)
2322 {
2323 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2324 HTMLElement *elem;
2325 HRESULT hres;
2326
2327 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
2328
2329 hres = get_doc_elem_by_id(This->doc_node, v, &elem);
2330 if(FAILED(hres) || !elem) {
2331 *pel = NULL;
2332 return hres;
2333 }
2334
2335 *pel = &elem->IHTMLElement_iface;
2336 return S_OK;
2337 }
2338
2339
2340 static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface, BSTR v,
2341 IHTMLElementCollection **pelColl)
2342 {
2343 HTMLDocument *This = impl_from_IHTMLDocument3(iface);
2344 nsIDOMNodeList *nslist;
2345 nsAString id_str;
2346 nsresult nsres;
2347
2348 TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
2349
2350 if(!This->doc_node->nsdoc) {
2351 WARN("NULL nsdoc\n");
2352 return E_UNEXPECTED;
2353 }
2354
2355 nsAString_InitDepend(&id_str, v);
2356 nsres = nsIDOMHTMLDocument_GetElementsByTagName(This->doc_node->nsdoc, &id_str, &nslist);
2357 nsAString_Finish(&id_str);
2358 if(FAILED(nsres)) {
2359 ERR("GetElementByName failed: %08x\n", nsres);
2360 return E_FAIL;
2361 }
2362
2363 *pelColl = create_collection_from_nodelist(This->doc_node, nslist);
2364 nsIDOMNodeList_Release(nslist);
2365
2366 return S_OK;
2367 }
2368
2369 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl = {
2370 HTMLDocument3_QueryInterface,
2371 HTMLDocument3_AddRef,
2372 HTMLDocument3_Release,
2373 HTMLDocument3_GetTypeInfoCount,
2374 HTMLDocument3_GetTypeInfo,
2375 HTMLDocument3_GetIDsOfNames,
2376 HTMLDocument3_Invoke,
2377 HTMLDocument3_releaseCapture,
2378 HTMLDocument3_recalc,
2379 HTMLDocument3_createTextNode,
2380 HTMLDocument3_get_documentElement,
2381 HTMLDocument3_uniqueID,
2382 HTMLDocument3_attachEvent,
2383 HTMLDocument3_detachEvent,
2384 HTMLDocument3_put_onrowsdelete,
2385 HTMLDocument3_get_onrowsdelete,
2386 HTMLDocument3_put_onrowsinserted,
2387 HTMLDocument3_get_onrowsinserted,
2388 HTMLDocument3_put_oncellchange,
2389 HTMLDocument3_get_oncellchange,
2390 HTMLDocument3_put_ondatasetchanged,
2391 HTMLDocument3_get_ondatasetchanged,
2392 HTMLDocument3_put_ondataavailable,
2393 HTMLDocument3_get_ondataavailable,
2394 HTMLDocument3_put_ondatasetcomplete,
2395 HTMLDocument3_get_ondatasetcomplete,
2396 HTMLDocument3_put_onpropertychange,
2397 HTMLDocument3_get_onpropertychange,
2398 HTMLDocument3_put_dir,
2399 HTMLDocument3_get_dir,
2400 HTMLDocument3_put_oncontextmenu,
2401 HTMLDocument3_get_oncontextmenu,
2402 HTMLDocument3_put_onstop,
2403 HTMLDocument3_get_onstop,
2404 HTMLDocument3_createDocumentFragment,
2405 HTMLDocument3_get_parentDocument,
2406 HTMLDocument3_put_enableDownload,
2407 HTMLDocument3_get_enableDownload,
2408 HTMLDocument3_put_baseUrl,
2409 HTMLDocument3_get_baseUrl,
2410 HTMLDocument3_get_childNodes,
2411 HTMLDocument3_put_inheritStyleSheets,
2412 HTMLDocument3_get_inheritStyleSheets,
2413 HTMLDocument3_put_onbeforeeditfocus,
2414 HTMLDocument3_get_onbeforeeditfocus,
2415 HTMLDocument3_getElementsByName,
2416 HTMLDocument3_getElementById,
2417 HTMLDocument3_getElementsByTagName
2418 };
2419
2420 static inline HTMLDocument *impl_from_IHTMLDocument4(IHTMLDocument4 *iface)
2421 {
2422 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument4_iface);
2423 }
2424
2425 static HRESULT WINAPI HTMLDocument4_QueryInterface(IHTMLDocument4 *iface,
2426 REFIID riid, void **ppv)
2427 {
2428 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2429 return htmldoc_query_interface(This, riid, ppv);
2430 }
2431
2432 static ULONG WINAPI HTMLDocument4_AddRef(IHTMLDocument4 *iface)
2433 {
2434 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2435 return htmldoc_addref(This);
2436 }
2437
2438 static ULONG WINAPI HTMLDocument4_Release(IHTMLDocument4 *iface)
2439 {
2440 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2441 return htmldoc_release(This);
2442 }
2443
2444 static HRESULT WINAPI HTMLDocument4_GetTypeInfoCount(IHTMLDocument4 *iface, UINT *pctinfo)
2445 {
2446 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2447 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
2448 }
2449
2450 static HRESULT WINAPI HTMLDocument4_GetTypeInfo(IHTMLDocument4 *iface, UINT iTInfo,
2451 LCID lcid, ITypeInfo **ppTInfo)
2452 {
2453 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2454 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2455 }
2456
2457 static HRESULT WINAPI HTMLDocument4_GetIDsOfNames(IHTMLDocument4 *iface, REFIID riid,
2458 LPOLESTR *rgszNames, UINT cNames,
2459 LCID lcid, DISPID *rgDispId)
2460 {
2461 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2462 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
2463 rgDispId);
2464 }
2465
2466 static HRESULT WINAPI HTMLDocument4_Invoke(IHTMLDocument4 *iface, DISPID dispIdMember,
2467 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2468 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2469 {
2470 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2471 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2472 pDispParams, pVarResult, pExcepInfo, puArgErr);
2473 }
2474
2475 static HRESULT WINAPI HTMLDocument4_focus(IHTMLDocument4 *iface)
2476 {
2477 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2478 nsIDOMHTMLElement *nsbody;
2479 nsresult nsres;
2480
2481 TRACE("(%p)->()\n", This);
2482
2483 nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
2484 if(NS_FAILED(nsres) || !nsbody) {
2485 ERR("GetBody failed: %08x\n", nsres);
2486 return E_FAIL;
2487 }
2488
2489 nsres = nsIDOMHTMLElement_Focus(nsbody);
2490 nsIDOMHTMLElement_Release(nsbody);
2491 if(NS_FAILED(nsres)) {
2492 ERR("Focus failed: %08x\n", nsres);
2493 return E_FAIL;
2494 }
2495
2496 return S_OK;
2497 }
2498
2499 static HRESULT WINAPI HTMLDocument4_hasFocus(IHTMLDocument4 *iface, VARIANT_BOOL *pfFocus)
2500 {
2501 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2502 FIXME("(%p)->(%p)\n", This, pfFocus);
2503 return E_NOTIMPL;
2504 }
2505
2506 static HRESULT WINAPI HTMLDocument4_put_onselectionchange(IHTMLDocument4 *iface, VARIANT v)
2507 {
2508 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2509 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2510 return E_NOTIMPL;
2511 }
2512
2513 static HRESULT WINAPI HTMLDocument4_get_onselectionchange(IHTMLDocument4 *iface, VARIANT *p)
2514 {
2515 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2516 FIXME("(%p)->(%p)\n", This, p);
2517 return E_NOTIMPL;
2518 }
2519
2520 static HRESULT WINAPI HTMLDocument4_get_namespace(IHTMLDocument4 *iface, IDispatch **p)
2521 {
2522 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2523 FIXME("(%p)->(%p)\n", This, p);
2524 return E_NOTIMPL;
2525 }
2526
2527 static HRESULT WINAPI HTMLDocument4_createDocumentFromUrl(IHTMLDocument4 *iface, BSTR bstrUrl,
2528 BSTR bstrOptions, IHTMLDocument2 **newDoc)
2529 {
2530 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2531 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(bstrUrl), debugstr_w(bstrOptions), newDoc);
2532 return E_NOTIMPL;
2533 }
2534
2535 static HRESULT WINAPI HTMLDocument4_put_media(IHTMLDocument4 *iface, BSTR v)
2536 {
2537 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2538 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
2539 return E_NOTIMPL;
2540 }
2541
2542 static HRESULT WINAPI HTMLDocument4_get_media(IHTMLDocument4 *iface, BSTR *p)
2543 {
2544 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2545 FIXME("(%p)->(%p)\n", This, p);
2546 return E_NOTIMPL;
2547 }
2548
2549 static HRESULT WINAPI HTMLDocument4_createEventObject(IHTMLDocument4 *iface,
2550 VARIANT *pvarEventObject, IHTMLEventObj **ppEventObj)
2551 {
2552 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2553
2554 TRACE("(%p)->(%s %p)\n", This, debugstr_variant(pvarEventObject), ppEventObj);
2555
2556 if(pvarEventObject && V_VT(pvarEventObject) != VT_ERROR && V_VT(pvarEventObject) != VT_EMPTY) {
2557 FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject));
2558 return E_NOTIMPL;
2559 }
2560
2561 return create_event_obj(ppEventObj);
2562 }
2563
2564 static HRESULT WINAPI HTMLDocument4_fireEvent(IHTMLDocument4 *iface, BSTR bstrEventName,
2565 VARIANT *pvarEventObject, VARIANT_BOOL *pfCanceled)
2566 {
2567 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2568
2569 TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCanceled);
2570
2571 return dispatch_event(&This->doc_node->node, bstrEventName, pvarEventObject, pfCanceled);
2572 }
2573
2574 static HRESULT WINAPI HTMLDocument4_createRenderStyle(IHTMLDocument4 *iface, BSTR v,
2575 IHTMLRenderStyle **ppIHTMLRenderStyle)
2576 {
2577 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2578 FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppIHTMLRenderStyle);
2579 return E_NOTIMPL;
2580 }
2581
2582 static HRESULT WINAPI HTMLDocument4_put_oncontrolselect(IHTMLDocument4 *iface, VARIANT v)
2583 {
2584 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2585 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2586 return E_NOTIMPL;
2587 }
2588
2589 static HRESULT WINAPI HTMLDocument4_get_oncontrolselect(IHTMLDocument4 *iface, VARIANT *p)
2590 {
2591 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2592 FIXME("(%p)->(%p)\n", This, p);
2593 return E_NOTIMPL;
2594 }
2595
2596 static HRESULT WINAPI HTMLDocument4_get_URLEncoded(IHTMLDocument4 *iface, BSTR *p)
2597 {
2598 HTMLDocument *This = impl_from_IHTMLDocument4(iface);
2599 FIXME("(%p)->(%p)\n", This, p);
2600 return E_NOTIMPL;
2601 }
2602
2603 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl = {
2604 HTMLDocument4_QueryInterface,
2605 HTMLDocument4_AddRef,
2606 HTMLDocument4_Release,
2607 HTMLDocument4_GetTypeInfoCount,
2608 HTMLDocument4_GetTypeInfo,
2609 HTMLDocument4_GetIDsOfNames,
2610 HTMLDocument4_Invoke,
2611 HTMLDocument4_focus,
2612 HTMLDocument4_hasFocus,
2613 HTMLDocument4_put_onselectionchange,
2614 HTMLDocument4_get_onselectionchange,
2615 HTMLDocument4_get_namespace,
2616 HTMLDocument4_createDocumentFromUrl,
2617 HTMLDocument4_put_media,
2618 HTMLDocument4_get_media,
2619 HTMLDocument4_createEventObject,
2620 HTMLDocument4_fireEvent,
2621 HTMLDocument4_createRenderStyle,
2622 HTMLDocument4_put_oncontrolselect,
2623 HTMLDocument4_get_oncontrolselect,
2624 HTMLDocument4_get_URLEncoded
2625 };
2626
2627 static inline HTMLDocument *impl_from_IHTMLDocument5(IHTMLDocument5 *iface)
2628 {
2629 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument5_iface);
2630 }
2631
2632 static HRESULT WINAPI HTMLDocument5_QueryInterface(IHTMLDocument5 *iface,
2633 REFIID riid, void **ppv)
2634 {
2635 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2636 return htmldoc_query_interface(This, riid, ppv);
2637 }
2638
2639 static ULONG WINAPI HTMLDocument5_AddRef(IHTMLDocument5 *iface)
2640 {
2641 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2642 return htmldoc_addref(This);
2643 }
2644
2645 static ULONG WINAPI HTMLDocument5_Release(IHTMLDocument5 *iface)
2646 {
2647 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2648 return htmldoc_release(This);
2649 }
2650
2651 static HRESULT WINAPI HTMLDocument5_GetTypeInfoCount(IHTMLDocument5 *iface, UINT *pctinfo)
2652 {
2653 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2654 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
2655 }
2656
2657 static HRESULT WINAPI HTMLDocument5_GetTypeInfo(IHTMLDocument5 *iface, UINT iTInfo,
2658 LCID lcid, ITypeInfo **ppTInfo)
2659 {
2660 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2661 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2662 }
2663
2664 static HRESULT WINAPI HTMLDocument5_GetIDsOfNames(IHTMLDocument5 *iface, REFIID riid,
2665 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
2666 {
2667 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2668 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
2669 rgDispId);
2670 }
2671
2672 static HRESULT WINAPI HTMLDocument5_Invoke(IHTMLDocument5 *iface, DISPID dispIdMember,
2673 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2674 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2675 {
2676 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2677 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2678 pDispParams, pVarResult, pExcepInfo, puArgErr);
2679 }
2680
2681 static HRESULT WINAPI HTMLDocument5_put_onmousewheel(IHTMLDocument5 *iface, VARIANT v)
2682 {
2683 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2684 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2685 return E_NOTIMPL;
2686 }
2687
2688 static HRESULT WINAPI HTMLDocument5_get_onmousewheel(IHTMLDocument5 *iface, VARIANT *p)
2689 {
2690 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2691 FIXME("(%p)->(%p)\n", This, p);
2692 return E_NOTIMPL;
2693 }
2694
2695 static HRESULT WINAPI HTMLDocument5_get_doctype(IHTMLDocument5 *iface, IHTMLDOMNode **p)
2696 {
2697 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2698 FIXME("(%p)->(%p)\n", This, p);
2699 return E_NOTIMPL;
2700 }
2701
2702 static HRESULT WINAPI HTMLDocument5_get_implementation(IHTMLDocument5 *iface, IHTMLDOMImplementation **p)
2703 {
2704 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2705 HTMLDocumentNode *doc_node = This->doc_node;
2706
2707 TRACE("(%p)->(%p)\n", This, p);
2708
2709 if(!doc_node->dom_implementation) {
2710 HRESULT hres;
2711
2712 hres = create_dom_implementation(&doc_node->dom_implementation);
2713 if(FAILED(hres))
2714 return hres;
2715 }
2716
2717 IHTMLDOMImplementation_AddRef(doc_node->dom_implementation);
2718 *p = doc_node->dom_implementation;
2719 return S_OK;
2720 }
2721
2722 static HRESULT WINAPI HTMLDocument5_createAttribute(IHTMLDocument5 *iface, BSTR bstrattrName,
2723 IHTMLDOMAttribute **ppattribute)
2724 {
2725 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2726 HTMLDOMAttribute *attr;
2727 HRESULT hres;
2728
2729 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrattrName), ppattribute);
2730
2731 hres = HTMLDOMAttribute_Create(bstrattrName, NULL, 0, &attr);
2732 if(FAILED(hres))
2733 return hres;
2734
2735 *ppattribute = &attr->IHTMLDOMAttribute_iface;
2736 return S_OK;
2737 }
2738
2739 static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bstrdata,
2740 IHTMLDOMNode **ppRetNode)
2741 {
2742 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2743 nsIDOMComment *nscomment;
2744 HTMLElement *elem;
2745 nsAString str;
2746 nsresult nsres;
2747 HRESULT hres;
2748
2749 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrdata), ppRetNode);
2750
2751 if(!This->doc_node->nsdoc) {
2752 WARN("NULL nsdoc\n");
2753 return E_UNEXPECTED;
2754 }
2755
2756 nsAString_InitDepend(&str, bstrdata);
2757 nsres = nsIDOMHTMLDocument_CreateComment(This->doc_node->nsdoc, &str, &nscomment);
2758 nsAString_Finish(&str);
2759 if(NS_FAILED(nsres)) {
2760 ERR("CreateTextNode failed: %08x\n", nsres);
2761 return E_FAIL;
2762 }
2763
2764 hres = HTMLCommentElement_Create(This->doc_node, (nsIDOMNode*)nscomment, &elem);
2765 nsIDOMComment_Release(nscomment);
2766 if(FAILED(hres))
2767 return hres;
2768
2769 *ppRetNode = &elem->node.IHTMLDOMNode_iface;
2770 return S_OK;
2771 }
2772
2773 static HRESULT WINAPI HTMLDocument5_put_onfocusin(IHTMLDocument5 *iface, VARIANT v)
2774 {
2775 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2776 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2777 return E_NOTIMPL;
2778 }
2779
2780 static HRESULT WINAPI HTMLDocument5_get_onfocusin(IHTMLDocument5 *iface, VARIANT *p)
2781 {
2782 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2783 FIXME("(%p)->(%p)\n", This, p);
2784 return E_NOTIMPL;
2785 }
2786
2787 static HRESULT WINAPI HTMLDocument5_put_onfocusout(IHTMLDocument5 *iface, VARIANT v)
2788 {
2789 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2790 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2791 return E_NOTIMPL;
2792 }
2793
2794 static HRESULT WINAPI HTMLDocument5_get_onfocusout(IHTMLDocument5 *iface, VARIANT *p)
2795 {
2796 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2797 FIXME("(%p)->(%p)\n", This, p);
2798 return E_NOTIMPL;
2799 }
2800
2801 static HRESULT WINAPI HTMLDocument5_put_onactivate(IHTMLDocument5 *iface, VARIANT v)
2802 {
2803 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2804 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2805 return E_NOTIMPL;
2806 }
2807
2808 static HRESULT WINAPI HTMLDocument5_get_onactivate(IHTMLDocument5 *iface, VARIANT *p)
2809 {
2810 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2811 FIXME("(%p)->(%p)\n", This, p);
2812 return E_NOTIMPL;
2813 }
2814
2815 static HRESULT WINAPI HTMLDocument5_put_ondeactivate(IHTMLDocument5 *iface, VARIANT v)
2816 {
2817 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2818 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2819 return E_NOTIMPL;
2820 }
2821
2822 static HRESULT WINAPI HTMLDocument5_get_ondeactivate(IHTMLDocument5 *iface, VARIANT *p)
2823 {
2824 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2825 FIXME("(%p)->(%p)\n", This, p);
2826 return E_NOTIMPL;
2827 }
2828
2829 static HRESULT WINAPI HTMLDocument5_put_onbeforeactivate(IHTMLDocument5 *iface, VARIANT v)
2830 {
2831 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2832 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2833 return E_NOTIMPL;
2834 }
2835
2836 static HRESULT WINAPI HTMLDocument5_get_onbeforeactivate(IHTMLDocument5 *iface, VARIANT *p)
2837 {
2838 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2839 FIXME("(%p)->(%p)\n", This, p);
2840 return E_NOTIMPL;
2841 }
2842
2843 static HRESULT WINAPI HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5 *iface, VARIANT v)
2844 {
2845 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2846 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2847 return E_NOTIMPL;
2848 }
2849
2850 static HRESULT WINAPI HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5 *iface, VARIANT *p)
2851 {
2852 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2853 FIXME("(%p)->(%p)\n", This, p);
2854 return E_NOTIMPL;
2855 }
2856
2857 static HRESULT WINAPI HTMLDocument5_get_compatMode(IHTMLDocument5 *iface, BSTR *p)
2858 {
2859 HTMLDocument *This = impl_from_IHTMLDocument5(iface);
2860 nsAString mode_str;
2861 nsresult nsres;
2862
2863 TRACE("(%p)->(%p)\n", This, p);
2864
2865 if(!This->doc_node->nsdoc) {
2866 WARN("NULL nsdoc\n");
2867 return E_UNEXPECTED;
2868 }
2869
2870 nsAString_Init(&mode_str, NULL);
2871 nsres = nsIDOMHTMLDocument_GetCompatMode(This->doc_node->nsdoc, &mode_str);
2872 return return_nsstr(nsres, &mode_str, p);
2873 }
2874
2875 static const IHTMLDocument5Vtbl HTMLDocument5Vtbl = {
2876 HTMLDocument5_QueryInterface,
2877 HTMLDocument5_AddRef,
2878 HTMLDocument5_Release,
2879 HTMLDocument5_GetTypeInfoCount,
2880 HTMLDocument5_GetTypeInfo,
2881 HTMLDocument5_GetIDsOfNames,
2882 HTMLDocument5_Invoke,
2883 HTMLDocument5_put_onmousewheel,
2884 HTMLDocument5_get_onmousewheel,
2885 HTMLDocument5_get_doctype,
2886 HTMLDocument5_get_implementation,
2887 HTMLDocument5_createAttribute,
2888 HTMLDocument5_createComment,
2889 HTMLDocument5_put_onfocusin,
2890 HTMLDocument5_get_onfocusin,
2891 HTMLDocument5_put_onfocusout,
2892 HTMLDocument5_get_onfocusout,
2893 HTMLDocument5_put_onactivate,
2894 HTMLDocument5_get_onactivate,
2895 HTMLDocument5_put_ondeactivate,
2896 HTMLDocument5_get_ondeactivate,
2897 HTMLDocument5_put_onbeforeactivate,
2898 HTMLDocument5_get_onbeforeactivate,
2899 HTMLDocument5_put_onbeforedeactivate,
2900 HTMLDocument5_get_onbeforedeactivate,
2901 HTMLDocument5_get_compatMode
2902 };
2903
2904 static inline HTMLDocument *impl_from_IHTMLDocument6(IHTMLDocument6 *iface)
2905 {
2906 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument6_iface);
2907 }
2908
2909 static HRESULT WINAPI HTMLDocument6_QueryInterface(IHTMLDocument6 *iface,
2910 REFIID riid, void **ppv)
2911 {
2912 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2913 return htmldoc_query_interface(This, riid, ppv);
2914 }
2915
2916 static ULONG WINAPI HTMLDocument6_AddRef(IHTMLDocument6 *iface)
2917 {
2918 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2919 return htmldoc_addref(This);
2920 }
2921
2922 static ULONG WINAPI HTMLDocument6_Release(IHTMLDocument6 *iface)
2923 {
2924 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2925 return htmldoc_release(This);
2926 }
2927
2928 static HRESULT WINAPI HTMLDocument6_GetTypeInfoCount(IHTMLDocument6 *iface, UINT *pctinfo)
2929 {
2930 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2931 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
2932 }
2933
2934 static HRESULT WINAPI HTMLDocument6_GetTypeInfo(IHTMLDocument6 *iface, UINT iTInfo,
2935 LCID lcid, ITypeInfo **ppTInfo)
2936 {
2937 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2938 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2939 }
2940
2941 static HRESULT WINAPI HTMLDocument6_GetIDsOfNames(IHTMLDocument6 *iface, REFIID riid,
2942 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
2943 {
2944 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2945 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
2946 rgDispId);
2947 }
2948
2949 static HRESULT WINAPI HTMLDocument6_Invoke(IHTMLDocument6 *iface, DISPID dispIdMember,
2950 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2951 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2952 {
2953 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2954 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2955 pDispParams, pVarResult, pExcepInfo, puArgErr);
2956 }
2957
2958 static HRESULT WINAPI HTMLDocument6_get_compatible(IHTMLDocument6 *iface,
2959 IHTMLDocumentCompatibleInfoCollection **p)
2960 {
2961 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2962 FIXME("(%p)->(%p)\n", This, p);
2963 return E_NOTIMPL;
2964 }
2965
2966 static HRESULT WINAPI HTMLDocument6_get_documentMode(IHTMLDocument6 *iface,
2967 VARIANT *p)
2968 {
2969 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2970 FIXME("(%p)->(%p)\n", This, p);
2971 return E_NOTIMPL;
2972 }
2973
2974 static HRESULT WINAPI HTMLDocument6_get_onstorage(IHTMLDocument6 *iface,
2975 VARIANT *p)
2976 {
2977 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2978 FIXME("(%p)->(%p)\n", This, p);
2979 return E_NOTIMPL;
2980 }
2981
2982 static HRESULT WINAPI HTMLDocument6_put_onstorage(IHTMLDocument6 *iface, VARIANT v)
2983 {
2984 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2985 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
2986 return E_NOTIMPL;
2987 }
2988
2989 static HRESULT WINAPI HTMLDocument6_get_onstoragecommit(IHTMLDocument6 *iface,
2990 VARIANT *p)
2991 {
2992 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
2993 FIXME("(%p)->(%p)\n", This, p);
2994 return E_NOTIMPL;
2995 }
2996
2997 static HRESULT WINAPI HTMLDocument6_put_onstoragecommit(IHTMLDocument6 *iface, VARIANT v)
2998 {
2999 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
3000 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3001 return E_NOTIMPL;
3002 }
3003
3004 static HRESULT WINAPI HTMLDocument6_getElementById(IHTMLDocument6 *iface,
3005 BSTR bstrId, IHTMLElement2 **p)
3006 {
3007 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
3008 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrId), p);
3009 return E_NOTIMPL;
3010 }
3011
3012 static HRESULT WINAPI HTMLDocument6_updateSettings(IHTMLDocument6 *iface)
3013 {
3014 HTMLDocument *This = impl_from_IHTMLDocument6(iface);
3015 FIXME("(%p)->()\n", This);
3016 return E_NOTIMPL;
3017 }
3018
3019 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl = {
3020 HTMLDocument6_QueryInterface,
3021 HTMLDocument6_AddRef,
3022 HTMLDocument6_Release,
3023 HTMLDocument6_GetTypeInfoCount,
3024 HTMLDocument6_GetTypeInfo,
3025 HTMLDocument6_GetIDsOfNames,
3026 HTMLDocument6_Invoke,
3027 HTMLDocument6_get_compatible,
3028 HTMLDocument6_get_documentMode,
3029 HTMLDocument6_put_onstorage,
3030 HTMLDocument6_get_onstorage,
3031 HTMLDocument6_put_onstoragecommit,
3032 HTMLDocument6_get_onstoragecommit,
3033 HTMLDocument6_getElementById,
3034 HTMLDocument6_updateSettings
3035 };
3036
3037 static inline HTMLDocument *impl_from_IHTMLDocument7(IHTMLDocument7 *iface)
3038 {
3039 return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument7_iface);
3040 }
3041
3042 static HRESULT WINAPI HTMLDocument7_QueryInterface(IHTMLDocument7 *iface, REFIID riid, void **ppv)
3043 {
3044 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3045 return htmldoc_query_interface(This, riid, ppv);
3046 }
3047
3048 static ULONG WINAPI HTMLDocument7_AddRef(IHTMLDocument7 *iface)
3049 {
3050 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3051 return htmldoc_addref(This);
3052 }
3053
3054 static ULONG WINAPI HTMLDocument7_Release(IHTMLDocument7 *iface)
3055 {
3056 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3057 return htmldoc_release(This);
3058 }
3059
3060 static HRESULT WINAPI HTMLDocument7_GetTypeInfoCount(IHTMLDocument7 *iface, UINT *pctinfo)
3061 {
3062 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3063 return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
3064 }
3065
3066 static HRESULT WINAPI HTMLDocument7_GetTypeInfo(IHTMLDocument7 *iface, UINT iTInfo,
3067 LCID lcid, ITypeInfo **ppTInfo)
3068 {
3069 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3070 return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
3071 }
3072
3073 static HRESULT WINAPI HTMLDocument7_GetIDsOfNames(IHTMLDocument7 *iface, REFIID riid,
3074 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
3075 {
3076 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3077 return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
3078 rgDispId);
3079 }
3080
3081 static HRESULT WINAPI HTMLDocument7_Invoke(IHTMLDocument7 *iface, DISPID dispIdMember,
3082 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
3083 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
3084 {
3085 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3086 return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
3087 pDispParams, pVarResult, pExcepInfo, puArgErr);
3088 }
3089
3090 static HRESULT WINAPI HTMLDocument7_get_defaultView(IHTMLDocument7 *iface, IHTMLWindow2 **p)
3091 {
3092 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3093 FIXME("(%p)->(%p)\n", This, p);
3094 return E_NOTIMPL;
3095 }
3096
3097 static HRESULT WINAPI HTMLDocument7_createCDATASection(IHTMLDocument7 *iface, BSTR text, IHTMLDOMNode **newCDATASectionNode)
3098 {
3099 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3100 FIXME("(%p)->(%p)\n", This, newCDATASectionNode);
3101 return E_NOTIMPL;
3102 }
3103
3104 static HRESULT WINAPI HTMLDocument7_getSelection(IHTMLDocument7 *iface, IHTMLSelection **ppIHTMLSelection)
3105 {
3106 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3107 FIXME("(%p)->(%p)\n", This, ppIHTMLSelection);
3108 return E_NOTIMPL;
3109 }
3110
3111 static HRESULT WINAPI HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7 *iface, VARIANT *pvarNS,
3112 BSTR bstrLocalName, IHTMLElementCollection **pelColl)
3113 {
3114 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3115 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrLocalName), pelColl);
3116 return E_NOTIMPL;
3117 }
3118
3119 static HRESULT WINAPI HTMLDocument7_createElementNS(IHTMLDocument7 *iface, VARIANT *pvarNS, BSTR bstrTag, IHTMLElement **newElem)
3120 {
3121 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3122 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrTag), newElem);
3123 return E_NOTIMPL;
3124 }
3125
3126 static HRESULT WINAPI HTMLDocument7_createAttributeNS(IHTMLDocument7 *iface, VARIANT *pvarNS,
3127 BSTR bstrAttrName, IHTMLDOMAttribute **ppAttribute)
3128 {
3129 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3130 FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrAttrName), ppAttribute);
3131 return E_NOTIMPL;
3132 }
3133
3134 static HRESULT WINAPI HTMLDocument7_put_onmsthumbnailclick(IHTMLDocument7 *iface, VARIANT v)
3135 {
3136 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3137 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3138 return E_NOTIMPL;
3139 }
3140
3141 static HRESULT WINAPI HTMLDocument7_get_onmsthumbnailclick(IHTMLDocument7 *iface, VARIANT *p)
3142 {
3143 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3144 FIXME("(%p)->(%p)\n", This, p);
3145 return E_NOTIMPL;
3146 }
3147
3148 static HRESULT WINAPI HTMLDocument7_get_characterSet(IHTMLDocument7 *iface, BSTR *p)
3149 {
3150 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3151 FIXME("(%p)->(%p)\n", This, p);
3152 return E_NOTIMPL;
3153 }
3154
3155 static HRESULT WINAPI HTMLDocument7_createElement(IHTMLDocument7 *iface, BSTR bstrTag, IHTMLElement **newElem)
3156 {
3157 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3158 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrTag), newElem);
3159 return E_NOTIMPL;
3160 }
3161
3162 static HRESULT WINAPI HTMLDocument7_createAttribute(IHTMLDocument7 *iface, BSTR bstrAttrName, IHTMLDOMAttribute **ppAttribute)
3163 {
3164 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3165 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrAttrName), ppAttribute);
3166 return E_NOTIMPL;
3167 }
3168
3169 static HRESULT WINAPI HTMLDocument7_getElementByClassName(IHTMLDocument7 *iface, BSTR v, IHTMLElementCollection **pel)
3170 {
3171 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3172 FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
3173 return E_NOTIMPL;
3174 }
3175
3176 static HRESULT WINAPI HTMLDocument7_createProcessingInstruction(IHTMLDocument7 *iface, BSTR target,
3177 BSTR data, IDOMProcessingInstruction **newProcessingInstruction)
3178 {
3179 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3180 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(target), debugstr_w(data), newProcessingInstruction);
3181 return E_NOTIMPL;
3182 }
3183
3184 static HRESULT WINAPI HTMLDocument7_adoptNode(IHTMLDocument7 *iface, IHTMLDOMNode *pNodeSource, IHTMLDOMNode3 **ppNodeDest)
3185 {
3186 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3187 FIXME("(%p)->(%p %p)\n", This, pNodeSource, ppNodeDest);
3188 return E_NOTIMPL;
3189 }
3190
3191 static HRESULT WINAPI HTMLDocument7_put_onmssitemodejumplistitemremoved(IHTMLDocument7 *iface, VARIANT v)
3192 {
3193 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3194 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3195 return E_NOTIMPL;
3196 }
3197
3198 static HRESULT WINAPI HTMLDocument7_get_onmssitemodejumplistitemremoved(IHTMLDocument7 *iface, VARIANT *p)
3199 {
3200 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3201 FIXME("(%p)->(%p)\n", This, p);
3202 return E_NOTIMPL;
3203 }
3204
3205 static HRESULT WINAPI HTMLDocument7_get_all(IHTMLDocument7 *iface, IHTMLElementCollection **p)
3206 {
3207 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3208 FIXME("(%p)->(%p)\n", This, p);
3209 return E_NOTIMPL;
3210 }
3211
3212 static HRESULT WINAPI HTMLDocument7_get_inputEncoding(IHTMLDocument7 *iface, BSTR *p)
3213 {
3214 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3215 FIXME("(%p)->(%p)\n", This, p);
3216 return E_NOTIMPL;
3217 }
3218
3219 static HRESULT WINAPI HTMLDocument7_get_xmlEncoding(IHTMLDocument7 *iface, BSTR *p)
3220 {
3221 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3222 FIXME("(%p)->(%p)\n", This, p);
3223 return E_NOTIMPL;
3224 }
3225
3226 static HRESULT WINAPI HTMLDocument7_put_xmlStandalone(IHTMLDocument7 *iface, VARIANT_BOOL v)
3227 {
3228 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3229 FIXME("(%p)->(%x)\n", This, v);
3230 return E_NOTIMPL;
3231 }
3232
3233 static HRESULT WINAPI HTMLDocument7_get_xmlStandalone(IHTMLDocument7 *iface, VARIANT_BOOL *p)
3234 {
3235 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3236 FIXME("(%p)->(%p)\n", This, p);
3237 return E_NOTIMPL;
3238 }
3239
3240 static HRESULT WINAPI HTMLDocument7_put_xmlVersion(IHTMLDocument7 *iface, BSTR v)
3241 {
3242 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3243 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
3244 return E_NOTIMPL;
3245 }
3246
3247 static HRESULT WINAPI HTMLDocument7_get_xmlVersion(IHTMLDocument7 *iface, BSTR *p)
3248 {
3249 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3250 FIXME("(%p)->(%p)\n", This, p);
3251 return E_NOTIMPL;
3252 }
3253
3254 static HRESULT WINAPI HTMLDocument7_hasAttributes(IHTMLDocument7 *iface, VARIANT_BOOL *pfHasAttributes)
3255 {
3256 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3257 FIXME("(%p)->(%p)\n", This, pfHasAttributes);
3258 return E_NOTIMPL;
3259 }
3260
3261 static HRESULT WINAPI HTMLDocument7_put_onabort(IHTMLDocument7 *iface, VARIANT v)
3262 {
3263 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3264 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3265 return E_NOTIMPL;
3266 }
3267
3268 static HRESULT WINAPI HTMLDocument7_get_onabort(IHTMLDocument7 *iface, VARIANT *p)
3269 {
3270 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3271 FIXME("(%p)->(%p)\n", This, p);
3272 return E_NOTIMPL;
3273 }
3274
3275 static HRESULT WINAPI HTMLDocument7_put_onblur(IHTMLDocument7 *iface, VARIANT v)
3276 {
3277 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3278 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3279 return E_NOTIMPL;
3280 }
3281
3282 static HRESULT WINAPI HTMLDocument7_get_onblur(IHTMLDocument7 *iface, VARIANT *p)
3283 {
3284 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3285 FIXME("(%p)->(%p)\n", This, p);
3286 return E_NOTIMPL;
3287 }
3288
3289 static HRESULT WINAPI HTMLDocument7_put_oncanplay(IHTMLDocument7 *iface, VARIANT v)
3290 {
3291 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3292 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3293 return E_NOTIMPL;
3294 }
3295
3296 static HRESULT WINAPI HTMLDocument7_get_oncanplay(IHTMLDocument7 *iface, VARIANT *p)
3297 {
3298 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3299 FIXME("(%p)->(%p)\n", This, p);
3300 return E_NOTIMPL;
3301 }
3302
3303 static HRESULT WINAPI HTMLDocument7_put_oncanplaythrough(IHTMLDocument7 *iface, VARIANT v)
3304 {
3305 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3306 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3307 return E_NOTIMPL;
3308 }
3309
3310 static HRESULT WINAPI HTMLDocument7_get_oncanplaythrough(IHTMLDocument7 *iface, VARIANT *p)
3311 {
3312 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3313 FIXME("(%p)->(%p)\n", This, p);
3314 return E_NOTIMPL;
3315 }
3316
3317 static HRESULT WINAPI HTMLDocument7_put_onchange(IHTMLDocument7 *iface, VARIANT v)
3318 {
3319 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3320 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3321 return E_NOTIMPL;
3322 }
3323
3324 static HRESULT WINAPI HTMLDocument7_get_onchange(IHTMLDocument7 *iface, VARIANT *p)
3325 {
3326 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3327 FIXME("(%p)->(%p)\n", This, p);
3328 return E_NOTIMPL;
3329 }
3330
3331 static HRESULT WINAPI HTMLDocument7_put_ondrag(IHTMLDocument7 *iface, VARIANT v)
3332 {
3333 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3334 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3335 return E_NOTIMPL;
3336 }
3337
3338 static HRESULT WINAPI HTMLDocument7_get_ondrag(IHTMLDocument7 *iface, VARIANT *p)
3339 {
3340 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3341 FIXME("(%p)->(%p)\n", This, p);
3342 return E_NOTIMPL;
3343 }
3344
3345 static HRESULT WINAPI HTMLDocument7_put_ondragend(IHTMLDocument7 *iface, VARIANT v)
3346 {
3347 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3348 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3349 return E_NOTIMPL;
3350 }
3351
3352 static HRESULT WINAPI HTMLDocument7_get_ondragend(IHTMLDocument7 *iface, VARIANT *p)
3353 {
3354 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3355 FIXME("(%p)->(%p)\n", This, p);
3356 return E_NOTIMPL;
3357 }
3358
3359 static HRESULT WINAPI HTMLDocument7_put_ondragenter(IHTMLDocument7 *iface, VARIANT v)
3360 {
3361 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3362 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3363 return E_NOTIMPL;
3364 }
3365
3366 static HRESULT WINAPI HTMLDocument7_get_ondragenter(IHTMLDocument7 *iface, VARIANT *p)
3367 {
3368 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3369 FIXME("(%p)->(%p)\n", This, p);
3370 return E_NOTIMPL;
3371 }
3372
3373 static HRESULT WINAPI HTMLDocument7_put_ondragleave(IHTMLDocument7 *iface, VARIANT v)
3374 {
3375 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3376 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3377 return E_NOTIMPL;
3378 }
3379
3380 static HRESULT WINAPI HTMLDocument7_get_ondragleave(IHTMLDocument7 *iface, VARIANT *p)
3381 {
3382 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3383 FIXME("(%p)->(%p)\n", This, p);
3384 return E_NOTIMPL;
3385 }
3386
3387 static HRESULT WINAPI HTMLDocument7_put_ondragover(IHTMLDocument7 *iface, VARIANT v)
3388 {
3389 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3390 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3391 return E_NOTIMPL;
3392 }
3393
3394 static HRESULT WINAPI HTMLDocument7_get_ondragover(IHTMLDocument7 *iface, VARIANT *p)
3395 {
3396 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3397 FIXME("(%p)->(%p)\n", This, p);
3398 return E_NOTIMPL;
3399 }
3400
3401 static HRESULT WINAPI HTMLDocument7_put_ondrop(IHTMLDocument7 *iface, VARIANT v)
3402 {
3403 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3404 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3405 return E_NOTIMPL;
3406 }
3407
3408 static HRESULT WINAPI HTMLDocument7_get_ondrop(IHTMLDocument7 *iface, VARIANT *p)
3409 {
3410 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3411 FIXME("(%p)->(%p)\n", This, p);
3412 return E_NOTIMPL;
3413 }
3414
3415 static HRESULT WINAPI HTMLDocument7_put_ondurationchange(IHTMLDocument7 *iface, VARIANT v)
3416 {
3417 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3418 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3419 return E_NOTIMPL;
3420 }
3421
3422 static HRESULT WINAPI HTMLDocument7_get_ondurationchange(IHTMLDocument7 *iface, VARIANT *p)
3423 {
3424 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3425 FIXME("(%p)->(%p)\n", This, p);
3426 return E_NOTIMPL;
3427 }
3428
3429 static HRESULT WINAPI HTMLDocument7_put_onemptied(IHTMLDocument7 *iface, VARIANT v)
3430 {
3431 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3432 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3433 return E_NOTIMPL;
3434 }
3435
3436 static HRESULT WINAPI HTMLDocument7_get_onemptied(IHTMLDocument7 *iface, VARIANT *p)
3437 {
3438 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3439 FIXME("(%p)->(%p)\n", This, p);
3440 return E_NOTIMPL;
3441 }
3442
3443 static HRESULT WINAPI HTMLDocument7_put_onended(IHTMLDocument7 *iface, VARIANT v)
3444 {
3445 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3446 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3447 return E_NOTIMPL;
3448 }
3449
3450 static HRESULT WINAPI HTMLDocument7_get_onended(IHTMLDocument7 *iface, VARIANT *p)
3451 {
3452 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3453 FIXME("(%p)->(%p)\n", This, p);
3454 return E_NOTIMPL;
3455 }
3456
3457 static HRESULT WINAPI HTMLDocument7_put_onerror(IHTMLDocument7 *iface, VARIANT v)
3458 {
3459 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3460 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3461 return E_NOTIMPL;
3462 }
3463
3464 static HRESULT WINAPI HTMLDocument7_get_onerror(IHTMLDocument7 *iface, VARIANT *p)
3465 {
3466 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3467 FIXME("(%p)->(%p)\n", This, p);
3468 return E_NOTIMPL;
3469 }
3470
3471 static HRESULT WINAPI HTMLDocument7_put_onfocus(IHTMLDocument7 *iface, VARIANT v)
3472 {
3473 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3474 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3475 return E_NOTIMPL;
3476 }
3477
3478 static HRESULT WINAPI HTMLDocument7_get_onfocus(IHTMLDocument7 *iface, VARIANT *p)
3479 {
3480 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3481 FIXME("(%p)->(%p)\n", This, p);
3482 return E_NOTIMPL;
3483 }
3484
3485 static HRESULT WINAPI HTMLDocument7_put_oninput(IHTMLDocument7 *iface, VARIANT v)
3486 {
3487 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3488 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3489 return E_NOTIMPL;
3490 }
3491
3492 static HRESULT WINAPI HTMLDocument7_get_oninput(IHTMLDocument7 *iface, VARIANT *p)
3493 {
3494 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3495 FIXME("(%p)->(%p)\n", This, p);
3496 return E_NOTIMPL;
3497 }
3498
3499 static HRESULT WINAPI HTMLDocument7_put_onload(IHTMLDocument7 *iface, VARIANT v)
3500 {
3501 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3502 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3503 return E_NOTIMPL;
3504 }
3505
3506 static HRESULT WINAPI HTMLDocument7_get_onload(IHTMLDocument7 *iface, VARIANT *p)
3507 {
3508 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3509 FIXME("(%p)->(%p)\n", This, p);
3510 return E_NOTIMPL;
3511 }
3512
3513 static HRESULT WINAPI HTMLDocument7_put_onloadeddata(IHTMLDocument7 *iface, VARIANT v)
3514 {
3515 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3516 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3517 return E_NOTIMPL;
3518 }
3519
3520 static HRESULT WINAPI HTMLDocument7_get_onloadeddata(IHTMLDocument7 *iface, VARIANT *p)
3521 {
3522 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3523 FIXME("(%p)->(%p)\n", This, p);
3524 return E_NOTIMPL;
3525 }
3526
3527 static HRESULT WINAPI HTMLDocument7_put_onloadedmetadata(IHTMLDocument7 *iface, VARIANT v)
3528 {
3529 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3530 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3531 return E_NOTIMPL;
3532 }
3533
3534 static HRESULT WINAPI HTMLDocument7_get_onloadedmetadata(IHTMLDocument7 *iface, VARIANT *p)
3535 {
3536 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3537 FIXME("(%p)->(%p)\n", This, p);
3538 return E_NOTIMPL;
3539 }
3540
3541 static HRESULT WINAPI HTMLDocument7_put_onloadstart(IHTMLDocument7 *iface, VARIANT v)
3542 {
3543 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3544 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3545 return E_NOTIMPL;
3546 }
3547
3548 static HRESULT WINAPI HTMLDocument7_get_onloadstart(IHTMLDocument7 *iface, VARIANT *p)
3549 {
3550 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3551 FIXME("(%p)->(%p)\n", This, p);
3552 return E_NOTIMPL;
3553 }
3554
3555 static HRESULT WINAPI HTMLDocument7_put_onpause(IHTMLDocument7 *iface, VARIANT v)
3556 {
3557 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3558 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3559 return E_NOTIMPL;
3560 }
3561
3562 static HRESULT WINAPI HTMLDocument7_get_onpause(IHTMLDocument7 *iface, VARIANT *p)
3563 {
3564 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3565 FIXME("(%p)->(%p)\n", This, p);
3566 return E_NOTIMPL;
3567 }
3568
3569 static HRESULT WINAPI HTMLDocument7_put_onplay(IHTMLDocument7 *iface, VARIANT v)
3570 {
3571 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3572 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3573 return E_NOTIMPL;
3574 }
3575
3576 static HRESULT WINAPI HTMLDocument7_get_onplay(IHTMLDocument7 *iface, VARIANT *p)
3577 {
3578 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3579 FIXME("(%p)->(%p)\n", This, p);
3580 return E_NOTIMPL;
3581 }
3582
3583 static HRESULT WINAPI HTMLDocument7_put_onplaying(IHTMLDocument7 *iface, VARIANT v)
3584 {
3585 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3586 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3587 return E_NOTIMPL;
3588 }
3589
3590 static HRESULT WINAPI HTMLDocument7_get_onplaying(IHTMLDocument7 *iface, VARIANT *p)
3591 {
3592 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3593 FIXME("(%p)->(%p)\n", This, p);
3594 return E_NOTIMPL;
3595 }
3596
3597 static HRESULT WINAPI HTMLDocument7_put_onprogress(IHTMLDocument7 *iface, VARIANT v)
3598 {
3599 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3600 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3601 return E_NOTIMPL;
3602 }
3603
3604 static HRESULT WINAPI HTMLDocument7_get_onprogress(IHTMLDocument7 *iface, VARIANT *p)
3605 {
3606 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3607 FIXME("(%p)->(%p)\n", This, p);
3608 return E_NOTIMPL;
3609 }
3610
3611 static HRESULT WINAPI HTMLDocument7_put_onratechange(IHTMLDocument7 *iface, VARIANT v)
3612 {
3613 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3614 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3615 return E_NOTIMPL;
3616 }
3617
3618 static HRESULT WINAPI HTMLDocument7_get_onratechange(IHTMLDocument7 *iface, VARIANT *p)
3619 {
3620 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3621 FIXME("(%p)->(%p)\n", This, p);
3622 return E_NOTIMPL;
3623 }
3624
3625 static HRESULT WINAPI HTMLDocument7_put_onreset(IHTMLDocument7 *iface, VARIANT v)
3626 {
3627 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3628 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3629 return E_NOTIMPL;
3630 }
3631
3632 static HRESULT WINAPI HTMLDocument7_get_onreset(IHTMLDocument7 *iface, VARIANT *p)
3633 {
3634 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3635 FIXME("(%p)->(%p)\n", This, p);
3636 return E_NOTIMPL;
3637 }
3638
3639 static HRESULT WINAPI HTMLDocument7_put_onscroll(IHTMLDocument7 *iface, VARIANT v)
3640 {
3641 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3642 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3643 return E_NOTIMPL;
3644 }
3645
3646 static HRESULT WINAPI HTMLDocument7_get_onscroll(IHTMLDocument7 *iface, VARIANT *p)
3647 {
3648 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3649 FIXME("(%p)->(%p)\n", This, p);
3650 return E_NOTIMPL;
3651 }
3652
3653 static HRESULT WINAPI HTMLDocument7_put_onseekend(IHTMLDocument7 *iface, VARIANT v)
3654 {
3655 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3656 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3657 return E_NOTIMPL;
3658 }
3659
3660 static HRESULT WINAPI HTMLDocument7_get_onseekend(IHTMLDocument7 *iface, VARIANT *p)
3661 {
3662 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3663 FIXME("(%p)->(%p)\n", This, p);
3664 return E_NOTIMPL;
3665 }
3666
3667 static HRESULT WINAPI HTMLDocument7_put_onseeking(IHTMLDocument7 *iface, VARIANT v)
3668 {
3669 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3670 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3671 return E_NOTIMPL;
3672 }
3673
3674 static HRESULT WINAPI HTMLDocument7_get_onseeking(IHTMLDocument7 *iface, VARIANT *p)
3675 {
3676 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3677 FIXME("(%p)->(%p)\n", This, p);
3678 return E_NOTIMPL;
3679 }
3680
3681 static HRESULT WINAPI HTMLDocument7_put_onselect(IHTMLDocument7 *iface, VARIANT v)
3682 {
3683 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3684 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3685 return E_NOTIMPL;
3686 }
3687
3688 static HRESULT WINAPI HTMLDocument7_get_onselect(IHTMLDocument7 *iface, VARIANT *p)
3689 {
3690 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3691 FIXME("(%p)->(%p)\n", This, p);
3692 return E_NOTIMPL;
3693 }
3694
3695 static HRESULT WINAPI HTMLDocument7_put_onstalled(IHTMLDocument7 *iface, VARIANT v)
3696 {
3697 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3698 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3699 return E_NOTIMPL;
3700 }
3701
3702 static HRESULT WINAPI HTMLDocument7_get_onstalled(IHTMLDocument7 *iface, VARIANT *p)
3703 {
3704 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3705 FIXME("(%p)->(%p)\n", This, p);
3706 return E_NOTIMPL;
3707 }
3708
3709 static HRESULT WINAPI HTMLDocument7_put_onsubmit(IHTMLDocument7 *iface, VARIANT v)
3710 {
3711 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3712 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3713 return E_NOTIMPL;
3714 }
3715
3716 static HRESULT WINAPI HTMLDocument7_get_onsubmit(IHTMLDocument7 *iface, VARIANT *p)
3717 {
3718 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3719 FIXME("(%p)->(%p)\n", This, p);
3720 return E_NOTIMPL;
3721 }
3722
3723 static HRESULT WINAPI HTMLDocument7_put_onsuspend(IHTMLDocument7 *iface, VARIANT v)
3724 {
3725 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3726 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3727 return E_NOTIMPL;
3728 }
3729
3730 static HRESULT WINAPI HTMLDocument7_get_onsuspend(IHTMLDocument7 *iface, VARIANT *p)
3731 {
3732 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3733 FIXME("(%p)->(%p)\n", This, p);
3734 return E_NOTIMPL;
3735 }
3736
3737 static HRESULT WINAPI HTMLDocument7_put_ontimeupdate(IHTMLDocument7 *iface, VARIANT v)
3738 {
3739 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3740 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3741 return E_NOTIMPL;
3742 }
3743
3744 static HRESULT WINAPI HTMLDocument7_get_ontimeupdate(IHTMLDocument7 *iface, VARIANT *p)
3745 {
3746 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3747 FIXME("(%p)->(%p)\n", This, p);
3748 return E_NOTIMPL;
3749 }
3750
3751 static HRESULT WINAPI HTMLDocument7_put_onvolumechange(IHTMLDocument7 *iface, VARIANT v)
3752 {
3753 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3754 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3755 return E_NOTIMPL;
3756 }
3757
3758 static HRESULT WINAPI HTMLDocument7_get_onvolumechange(IHTMLDocument7 *iface, VARIANT *p)
3759 {
3760 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3761 FIXME("(%p)->(%p)\n", This, p);
3762 return E_NOTIMPL;
3763 }
3764
3765 static HRESULT WINAPI HTMLDocument7_put_onwaiting(IHTMLDocument7 *iface, VARIANT v)
3766 {
3767 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3768 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
3769 return E_NOTIMPL;
3770 }
3771
3772 static HRESULT WINAPI HTMLDocument7_get_onwaiting(IHTMLDocument7 *iface, VARIANT *p)
3773 {
3774 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3775 FIXME("(%p)->(%p)\n", This, p);
3776 return E_NOTIMPL;
3777 }
3778
3779 static HRESULT WINAPI HTMLDocument7_normalize(IHTMLDocument7 *iface)
3780 {
3781 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3782 FIXME("(%p)\n", This);
3783 return E_NOTIMPL;
3784 }
3785
3786 static HRESULT WINAPI HTMLDocument7_importNode(IHTMLDocument7 *iface, IHTMLDOMNode *pNodeSource,
3787 VARIANT_BOOL fDeep, IHTMLDOMNode3 **ppNodeDest)
3788 {
3789 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3790 FIXME("(%p)->(%p %x %p)\n", This, pNodeSource, fDeep, ppNodeDest);
3791 return E_NOTIMPL;
3792 }
3793
3794 static HRESULT WINAPI HTMLDocument7_get_parentWindow(IHTMLDocument7 *iface, IHTMLWindow2 **p)
3795 {
3796 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3797 FIXME("(%p)->(%p)\n", This, p);
3798 return E_NOTIMPL;
3799 }
3800
3801 static HRESULT WINAPI HTMLDocument7_put_body(IHTMLDocument7 *iface, IHTMLElement *v)
3802 {
3803 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3804 FIXME("(%p)->(%p)\n", This, v);
3805 return E_NOTIMPL;
3806 }
3807
3808 static HRESULT WINAPI HTMLDocument7_get_body(IHTMLDocument7 *iface, IHTMLElement **p)
3809 {
3810 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3811 FIXME("(%p)->(%p)\n", This, p);
3812 return E_NOTIMPL;
3813 }
3814
3815 static HRESULT WINAPI HTMLDocument7_get_head(IHTMLDocument7 *iface, IHTMLElement **p)
3816 {
3817 HTMLDocument *This = impl_from_IHTMLDocument7(iface);
3818 FIXME("(%p)->(%p)\n", This, p);
3819 return E_NOTIMPL;
3820 }
3821
3822 static const IHTMLDocument7Vtbl HTMLDocument7Vtbl = {
3823 HTMLDocument7_QueryInterface,
3824 HTMLDocument7_AddRef,
3825 HTMLDocument7_Release,
3826 HTMLDocument7_GetTypeInfoCount,
3827 HTMLDocument7_GetTypeInfo,
3828 HTMLDocument7_GetIDsOfNames,
3829 HTMLDocument7_Invoke,
3830 HTMLDocument7_get_defaultView,
3831 HTMLDocument7_createCDATASection,
3832 HTMLDocument7_getSelection,
3833 HTMLDocument7_getElementsByTagNameNS,
3834 HTMLDocument7_createElementNS,
3835 HTMLDocument7_createAttributeNS,
3836 HTMLDocument7_put_onmsthumbnailclick,
3837 HTMLDocument7_get_onmsthumbnailclick,
3838 HTMLDocument7_get_characterSet,
3839 HTMLDocument7_createElement,
3840 HTMLDocument7_createAttribute,
3841 HTMLDocument7_getElementByClassName,
3842 HTMLDocument7_createProcessingInstruction,
3843 HTMLDocument7_adoptNode,
3844 HTMLDocument7_put_onmssitemodejumplistitemremoved,
3845 HTMLDocument7_get_onmssitemodejumplistitemremoved,
3846 HTMLDocument7_get_all,
3847 HTMLDocument7_get_inputEncoding,
3848 HTMLDocument7_get_xmlEncoding,
3849 HTMLDocument7_put_xmlStandalone,
3850 HTMLDocument7_get_xmlStandalone,
3851 HTMLDocument7_put_xmlVersion,
3852 HTMLDocument7_get_xmlVersion,
3853 HTMLDocument7_hasAttributes,
3854 HTMLDocument7_put_onabort,
3855 HTMLDocument7_get_onabort,
3856 HTMLDocument7_put_onblur,
3857 HTMLDocument7_get_onblur,
3858 HTMLDocument7_put_oncanplay,
3859 HTMLDocument7_get_oncanplay,
3860 HTMLDocument7_put_oncanplaythrough,
3861 HTMLDocument7_get_oncanplaythrough,
3862 HTMLDocument7_put_onchange,
3863 HTMLDocument7_get_onchange,
3864 HTMLDocument7_put_ondrag,
3865 HTMLDocument7_get_ondrag,
3866 HTMLDocument7_put_ondragend,
3867 HTMLDocument7_get_ondragend,
3868 HTMLDocument7_put_ondragenter,
3869 HTMLDocument7_get_ondragenter,
3870 HTMLDocument7_put_ondragleave,
3871 HTMLDocument7_get_ondragleave,
3872 HTMLDocument7_put_ondragover,
3873 HTMLDocument7_get_ondragover,
3874 HTMLDocument7_put_ondrop,
3875 HTMLDocument7_get_ondrop,
3876 HTMLDocument7_put_ondurationchange,
3877 HTMLDocument7_get_ondurationchange,
3878 HTMLDocument7_put_onemptied,
3879 HTMLDocument7_get_onemptied,
3880 HTMLDocument7_put_onended,
3881 HTMLDocument7_get_onended,
3882 HTMLDocument7_put_onerror,
3883 HTMLDocument7_get_onerror,
3884 HTMLDocument7_put_onfocus,
3885 HTMLDocument7_get_onfocus,
3886 HTMLDocument7_put_oninput,
3887 HTMLDocument7_get_oninput,
3888 HTMLDocument7_put_onload,
3889 HTMLDocument7_get_onload,
3890 HTMLDocument7_put_onloadeddata,
3891 HTMLDocument7_get_onloadeddata,
3892 HTMLDocument7_put_onloadedmetadata,
3893 HTMLDocument7_get_onloadedmetadata,
3894 HTMLDocument7_put_onloadstart,
3895 HTMLDocument7_get_onloadstart,
3896 HTMLDocument7_put_onpause,
3897 HTMLDocument7_get_onpause,
3898 HTMLDocument7_put_onplay,
3899 HTMLDocument7_get_onplay,
3900 HTMLDocument7_put_onplaying,
3901 HTMLDocument7_get_onplaying,
3902 HTMLDocument7_put_onprogress,
3903 HTMLDocument7_get_onprogress,
3904 HTMLDocument7_put_onratechange,
3905 HTMLDocument7_get_onratechange,
3906 HTMLDocument7_put_onreset,
3907 HTMLDocument7_get_onreset,
3908 HTMLDocument7_put_onscroll,
3909 HTMLDocument7_get_onscroll,
3910 HTMLDocument7_put_onseekend,
3911 HTMLDocument7_get_onseekend,
3912 HTMLDocument7_put_onseeking,
3913 HTMLDocument7_get_onseeking,
3914 HTMLDocument7_put_onselect,
3915 HTMLDocument7_get_onselect,
3916 HTMLDocument7_put_onstalled,
3917 HTMLDocument7_get_onstalled,
3918 HTMLDocument7_put_onsubmit,
3919 HTMLDocument7_get_onsubmit,
3920 HTMLDocument7_put_onsuspend,
3921 HTMLDocument7_get_onsuspend,
3922 HTMLDocument7_put_ontimeupdate,
3923 HTMLDocument7_get_ontimeupdate,
3924 HTMLDocument7_put_onvolumechange,
3925 HTMLDocument7_get_onvolumechange,
3926 HTMLDocument7_put_onwaiting,
3927 HTMLDocument7_get_onwaiting,
3928 HTMLDocument7_normalize,
3929 HTMLDocument7_importNode,
3930 HTMLDocument7_get_parentWindow,
3931 HTMLDocument7_put_body,
3932 HTMLDocument7_get_body,
3933 HTMLDocument7_get_head
3934 };
3935
3936 static void HTMLDocument_on_advise(IUnknown *iface, cp_static_data_t *cp)
3937 {
3938 HTMLDocument *This = impl_from_IHTMLDocument2((IHTMLDocument2*)iface);
3939
3940 if(This->window)
3941 update_doc_cp_events(This->doc_node, cp);
3942 }
3943
3944 static inline HTMLDocument *impl_from_ISupportErrorInfo(ISupportErrorInfo *iface)
3945 {
3946 return CONTAINING_RECORD(iface, HTMLDocument, ISupportErrorInfo_iface);
3947 }
3948
3949 static HRESULT WINAPI SupportErrorInfo_QueryInterface(ISupportErrorInfo *iface, REFIID riid, void **ppv)
3950 {
3951 HTMLDocument *This = impl_from_ISupportErrorInfo(iface);
3952 return htmldoc_query_interface(This, riid, ppv);
3953 }
3954
3955 static ULONG WINAPI SupportErrorInfo_AddRef(ISupportErrorInfo *iface)
3956 {
3957 HTMLDocument *This = impl_from_ISupportErrorInfo(iface);
3958 return htmldoc_addref(This);
3959 }
3960
3961 static ULONG WINAPI SupportErrorInfo_Release(ISupportErrorInfo *iface)
3962 {
3963 HTMLDocument *This = impl_from_ISupportErrorInfo(iface);
3964 return htmldoc_release(This);
3965 }
3966
3967 static HRESULT WINAPI SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo *iface, REFIID riid)
3968 {
3969 FIXME("(%p)->(%s)\n", iface, debugstr_mshtml_guid(riid));
3970 return S_FALSE;
3971 }
3972
3973 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl = {
3974 SupportErrorInfo_QueryInterface,
3975 SupportErrorInfo_AddRef,
3976 SupportErrorInfo_Release,
3977 SupportErrorInfo_InterfaceSupportsErrorInfo
3978 };
3979
3980 static inline HTMLDocument *impl_from_IDispatchEx(IDispatchEx *iface)
3981 {
3982 return CONTAINING_RECORD(iface, HTMLDocument, IDispatchEx_iface);
3983 }
3984
3985 static HRESULT dispid_from_elem_name(HTMLDocumentNode *This, BSTR name, DISPID *dispid)
3986 {
3987 nsIDOMNodeList *node_list;
3988 nsAString name_str;
3989 UINT32 len;
3990 unsigned i;
3991 nsresult nsres;
3992
3993 if(!This->nsdoc)
3994 return DISP_E_UNKNOWNNAME;
3995
3996 nsAString_InitDepend(&name_str, name);
3997 nsres = nsIDOMHTMLDocument_GetElementsByName(This->nsdoc, &name_str, &node_list);
3998 nsAString_Finish(&name_str);
3999 if(NS_FAILED(nsres))
4000 return E_FAIL;
4001
4002 nsres = nsIDOMNodeList_GetLength(node_list, &len);
4003 nsIDOMNodeList_Release(node_list);
4004 if(NS_FAILED(nsres))
4005 return E_FAIL;
4006
4007 if(!len)
4008 return DISP_E_UNKNOWNNAME;
4009
4010 for(i=0; i < This->elem_vars_cnt; i++) {
4011 if(!strcmpW(name, This->elem_vars[i])) {
4012 *dispid = MSHTML_DISPID_CUSTOM_MIN+i;
4013 return S_OK;
4014 }
4015 }
4016
4017 if(This->elem_vars_cnt == This->elem_vars_size) {
4018 WCHAR **new_vars;
4019
4020 if(This->elem_vars_size) {
4021 new_vars = heap_realloc(This->elem_vars, This->elem_vars_size*2*sizeof(WCHAR*));
4022 if(!new_vars)
4023 return E_OUTOFMEMORY;
4024 This->elem_vars_size *= 2;
4025 }else {
4026 new_vars = heap_alloc(16*sizeof(WCHAR*));
4027 if(!new_vars)
4028 return E_OUTOFMEMORY;
4029 This->elem_vars_size = 16;
4030 }
4031
4032 This->elem_vars = new_vars;
4033 }
4034
4035 This->elem_vars[This->elem_vars_cnt] = heap_strdupW(name);
4036 if(!This->elem_vars[This->elem_vars_cnt])
4037 return E_OUTOFMEMORY;
4038
4039 *dispid = MSHTML_DISPID_CUSTOM_MIN+This->elem_vars_cnt++;
4040 return S_OK;
4041 }
4042
4043 static HRESULT WINAPI DocDispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
4044 {
4045 HTMLDocument *This = impl_from_IDispatchEx(iface);
4046
4047 return htmldoc_query_interface(This, riid, ppv);
4048 }
4049
4050 static ULONG WINAPI DocDispatchEx_AddRef(IDispatchEx *iface)
4051 {
4052 HTMLDocument *This = impl_from_IDispatchEx(iface);
4053
4054 return htmldoc_addref(This);
4055 }
4056
4057 static ULONG WINAPI DocDispatchEx_Release(IDispatchEx *iface)
4058 {
4059 HTMLDocument *This = impl_from_IDispatchEx(iface);
4060
4061 return htmldoc_release(This);
4062 }
4063
4064 static HRESULT WINAPI DocDispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
4065 {
4066 HTMLDocument *This = impl_from_IDispatchEx(iface);
4067
4068 return IDispatchEx_GetTypeInfoCount(This->dispex, pctinfo);
4069 }
4070
4071 static HRESULT WINAPI DocDispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
4072 LCID lcid, ITypeInfo **ppTInfo)
4073 {
4074 HTMLDocument *This = impl_from_IDispatchEx(iface);
4075
4076 return IDispatchEx_GetTypeInfo(This->dispex, iTInfo, lcid, ppTInfo);
4077 }
4078
4079 static HRESULT WINAPI DocDispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
4080 LPOLESTR *rgszNames, UINT cNames,
4081 LCID lcid, DISPID *rgDispId)
4082 {
4083 HTMLDocument *This = impl_from_IDispatchEx(iface);
4084
4085 return IDispatchEx_GetIDsOfNames(This->dispex, riid, rgszNames, cNames, lcid, rgDispId);
4086 }
4087
4088 static HRESULT WINAPI DocDispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
4089 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
4090 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
4091 {
4092 HTMLDocument *This = impl_from_IDispatchEx(iface);
4093
4094 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
4095 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
4096
4097 switch(dispIdMember) {
4098 case DISPID_READYSTATE:
4099 TRACE("DISPID_READYSTATE\n");
4100
4101 if(!(wFlags & DISPATCH_PROPERTYGET))
4102 return E_INVALIDARG;
4103
4104 V_VT(pVarResult) = VT_I4;
4105 V_I4(pVarResult) = This->window->readystate;
4106 return S_OK;
4107 }
4108
4109 return IDispatchEx_Invoke(This->dispex, dispIdMember, riid, lcid, wFlags, pDispParams,
4110 pVarResult, pExcepInfo, puArgErr);
4111 }
4112
4113 static HRESULT WINAPI DocDispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
4114 {
4115 HTMLDocument *This = impl_from_IDispatchEx(iface);
4116 HRESULT hres;
4117
4118 hres = IDispatchEx_GetDispID(This->dispex, bstrName, grfdex, pid);
4119 if(hres != DISP_E_UNKNOWNNAME)
4120 return hres;
4121
4122 return dispid_from_elem_name(This->doc_node, bstrName, pid);
4123 }
4124
4125 static HRESULT WINAPI DocDispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
4126 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
4127 {
4128 HTMLDocument *This = impl_from_IDispatchEx(iface);
4129
4130 if(This->window && id == DISPID_IHTMLDOCUMENT2_LOCATION && (wFlags & DISPATCH_PROPERTYPUT))
4131 return IDispatchEx_InvokeEx(&This->window->base.IDispatchEx_iface, DISPID_IHTMLWINDOW2_LOCATION,
4132 lcid, wFlags, pdp, pvarRes, pei, pspCaller);
4133
4134
4135 return IDispatchEx_InvokeEx(This->dispex, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
4136 }
4137
4138 static HRESULT WINAPI DocDispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
4139 {
4140 HTMLDocument *This = impl_from_IDispatchEx(iface);
4141
4142 return IDispatchEx_DeleteMemberByName(This->dispex, bstrName, grfdex);
4143 }
4144
4145 static HRESULT WINAPI DocDispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
4146 {
4147 HTMLDocument *This = impl_from_IDispatchEx(iface);
4148
4149 return IDispatchEx_DeleteMemberByDispID(This->dispex, id);
4150 }
4151
4152 static HRESULT WINAPI DocDispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
4153 {
4154 HTMLDocument *This = impl_from_IDispatchEx(iface);
4155
4156 return IDispatchEx_GetMemberProperties(This->dispex, id, grfdexFetch, pgrfdex);
4157 }
4158
4159 static HRESULT WINAPI DocDispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
4160 {
4161 HTMLDocument *This = impl_from_IDispatchEx(iface);
4162
4163 return IDispatchEx_GetMemberName(This->dispex, id, pbstrName);
4164 }
4165
4166 static HRESULT WINAPI DocDispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
4167 {
4168 HTMLDocument *This = impl_from_IDispatchEx(iface);
4169
4170 return IDispatchEx_GetNextDispID(This->dispex, grfdex, id, pid);
4171 }
4172
4173 static HRESULT WINAPI DocDispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
4174 {
4175 HTMLDocument *This = impl_from_IDispatchEx(iface);
4176
4177 return IDispatchEx_GetNameSpaceParent(This->dispex, ppunk);
4178 }
4179
4180 static const IDispatchExVtbl DocDispatchExVtbl = {
4181 DocDispatchEx_QueryInterface,
4182 DocDispatchEx_AddRef,
4183 DocDispatchEx_Release,
4184 DocDispatchEx_GetTypeInfoCount,
4185 DocDispatchEx_GetTypeInfo,
4186 DocDispatchEx_GetIDsOfNames,
4187 DocDispatchEx_Invoke,
4188 DocDispatchEx_GetDispID,
4189 DocDispatchEx_InvokeEx,
4190 DocDispatchEx_DeleteMemberByName,
4191 DocDispatchEx_DeleteMemberByDispID,
4192 DocDispatchEx_GetMemberProperties,
4193 DocDispatchEx_GetMemberName,
4194 DocDispatchEx_GetNextDispID,
4195 DocDispatchEx_GetNameSpaceParent
4196 };
4197
4198 static inline HTMLDocument *impl_from_IProvideClassInfo(IProvideClassInfo *iface)
4199 {
4200 return CONTAINING_RECORD(iface, HTMLDocument, IProvideClassInfo_iface);
4201 }
4202
4203 static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideClassInfo *iface,
4204 REFIID riid, void **ppv)
4205 {
4206 HTMLDocument *This = impl_from_IProvideClassInfo(iface);
4207 return htmldoc_query_interface(This, riid, ppv);
4208 }
4209
4210 static ULONG WINAPI ProvideClassInfo_AddRef(IProvideClassInfo *iface)
4211 {
4212 HTMLDocument *This = impl_from_IProvideClassInfo(iface);
4213 return htmldoc_addref(This);
4214 }
4215
4216 static ULONG WINAPI ProvideClassInfo_Release(IProvideClassInfo *iface)
4217 {
4218 HTMLDocument *This = impl_from_IProvideClassInfo(iface);
4219 return htmldoc_release(This);
4220 }
4221
4222 static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideClassInfo* iface,
4223 ITypeInfo **ppTI)
4224 {
4225 HTMLDocument *This = impl_from_IProvideClassInfo(iface);
4226 TRACE("(%p)->(%p)\n", This, ppTI);
4227 return get_htmldoc_classinfo(ppTI);
4228 }
4229
4230 static const IProvideClassInfoVtbl ProvideClassInfoVtbl = {
4231 ProvideClassInfo_QueryInterface,
4232 ProvideClassInfo_AddRef,
4233 ProvideClassInfo_Release,
4234 ProvideClassInfo_GetClassInfo
4235 };
4236
4237 static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
4238 {
4239 *ppv = NULL;
4240
4241 if(IsEqualGUID(&IID_IUnknown, riid))
4242 *ppv = &This->IHTMLDocument2_iface;
4243 else if(IsEqualGUID(&IID_IDispatch, riid))
4244 *ppv = &This->IDispatchEx_iface;
4245 else if(IsEqualGUID(&IID_IDispatchEx, riid))
4246 *ppv = &This->IDispatchEx_iface;
4247 else if(IsEqualGUID(&IID_IHTMLDocument, riid))
4248 *ppv = &This->IHTMLDocument2_iface;
4249 else if(IsEqualGUID(&IID_IHTMLDocument2, riid))
4250 *ppv = &This->IHTMLDocument2_iface;
4251 else if(IsEqualGUID(&IID_IHTMLDocument3, riid))
4252 *ppv = &This->IHTMLDocument3_iface;
4253 else if(IsEqualGUID(&IID_IHTMLDocument4, riid))
4254 *ppv = &This->IHTMLDocument4_iface;
4255 else if(IsEqualGUID(&IID_IHTMLDocument5, riid))
4256 *ppv = &This->IHTMLDocument5_iface;
4257 else if(IsEqualGUID(&IID_IHTMLDocument6, riid))
4258 *ppv = &This->IHTMLDocument6_iface;
4259 else if(IsEqualGUID(&IID_IHTMLDocument7, riid))
4260 *ppv = &This->IHTMLDocument7_iface;
4261 else if(IsEqualGUID(&IID_IPersist, riid))
4262 *ppv = &This->IPersistFile_iface;
4263 else if(IsEqualGUID(&IID_IPersistMoniker, riid))
4264 *ppv = &This->IPersistMoniker_iface;
4265 else if(IsEqualGUID(&IID_IPersistFile, riid))
4266 *ppv = &This->IPersistFile_iface;
4267 else if(IsEqualGUID(&IID_IMonikerProp, riid))
4268 *ppv = &This->IMonikerProp_iface;
4269 else if(IsEqualGUID(&IID_IOleObject, riid))
4270 *ppv = &This->IOleObject_iface;
4271 else if(IsEqualGUID(&IID_IOleDocument, riid))
4272 *ppv = &This->IOleDocument_iface;
4273 else if(IsEqualGUID(&IID_IOleDocumentView, riid))
4274 *ppv = &This->IOleDocumentView_iface;
4275 else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid))
4276 *ppv = &This->IOleInPlaceActiveObject_iface;
4277 else if(IsEqualGUID(&IID_IViewObject, riid))
4278 *ppv = &This->IViewObjectEx_iface;
4279 else if(IsEqualGUID(&IID_IViewObject2, riid))
4280 *ppv = &This->IViewObjectEx_iface;
4281 else if(IsEqualGUID(&IID_IViewObjectEx, riid))
4282 *ppv = &This->IViewObjectEx_iface;
4283 else if(IsEqualGUID(&IID_IOleWindow, riid))
4284 *ppv = &This->IOleInPlaceActiveObject_iface;
4285 else if(IsEqualGUID(&IID_IOleInPlaceObject, riid))
4286 *ppv = &This->IOleInPlaceObjectWindowless_iface;
4287 else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid))
4288 *ppv = &This->IOleInPlaceObjectWindowless_iface;
4289 else if(IsEqualGUID(&IID_IServiceProvider, riid))
4290 *ppv = &This->IServiceProvider_iface;
4291 else if(IsEqualGUID(&IID_IOleCommandTarget, riid))
4292 *ppv = &This->IOleCommandTarget_iface;
4293 else if(IsEqualGUID(&IID_IOleControl, riid))
4294 *ppv = &This->IOleControl_iface;
4295 else if(IsEqualGUID(&IID_IHlinkTarget, riid))
4296 *ppv = &This->IHlinkTarget_iface;
4297 else if(IsEqualGUID(&IID_IConnectionPointContainer, riid))
4298 *ppv = &This->cp_container.IConnectionPointContainer_iface;
4299 else if(IsEqualGUID(&IID_IPersistStreamInit, riid))
4300 *ppv = &This->IPersistStreamInit_iface;
4301 else if(IsEqualGUID(&DIID_DispHTMLDocument, riid))
4302 *ppv = &This->IHTMLDocument2_iface;
4303 else if(IsEqualGUID(&IID_ISupportErrorInfo, riid))
4304 *ppv = &This->ISupportErrorInfo_iface;
4305 else if(IsEqualGUID(&IID_IPersistHistory, riid))
4306 *ppv = &This->IPersistHistory_iface;
4307 else if(IsEqualGUID(&IID_IObjectWithSite, riid))
4308 *ppv = &This->IObjectWithSite_iface;
4309 else if(IsEqualGUID(&IID_IOleContainer, riid))
4310 *ppv = &This->IOleContainer_iface;
4311 else if(IsEqualGUID(&IID_IObjectSafety, riid))
4312 *ppv = &This->IObjectSafety_iface;
4313 else if(IsEqualGUID(&IID_IProvideClassInfo, riid))
4314 *ppv = &This->IProvideClassInfo_iface;
4315 else if(IsEqualGUID(&CLSID_CMarkup, riid)) {
4316 FIXME("(%p)->(CLSID_CMarkup %p)\n", This, ppv);
4317 *ppv = NULL;
4318 }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
4319 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
4320 *ppv = NULL;
4321 }else if(IsEqualGUID(&IID_IPersistPropertyBag, riid)) {
4322 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This, ppv);
4323 *ppv = NULL;
4324 }else if(IsEqualGUID(&IID_IMarshal, riid)) {
4325 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppv);
4326 *ppv = NULL;
4327 }else if(IsEqualGUID(&IID_IExternalConnection, riid)) {
4328 TRACE("(%p)->(IID_IExternalConnection %p) returning NULL\n", This, ppv);
4329 *ppv = NULL;
4330 }else if(IsEqualGUID(&IID_IStdMarshalInfo, riid)) {
4331 TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This, ppv);
4332 *ppv = NULL;
4333 }else {
4334 return FALSE;
4335 }
4336
4337 if(*ppv)
4338 IUnknown_AddRef((IUnknown*)*ppv);
4339 return TRUE;
4340 }
4341
4342 static cp_static_data_t HTMLDocumentEvents_data = { HTMLDocumentEvents_tid, HTMLDocument_on_advise };
4343
4344 static const cpc_entry_t HTMLDocument_cpc[] = {
4345 {&IID_IDispatch, &HTMLDocumentEvents_data},
4346 {&IID_IPropertyNotifySink},
4347 {&DIID_HTMLDocumentEvents, &HTMLDocumentEvents_data},
4348 {&DIID_HTMLDocumentEvents2},
4349 {NULL}
4350 };
4351
4352 static void init_doc(HTMLDocument *doc, IUnknown *unk_impl, IDispatchEx *dispex)
4353 {
4354 doc->IHTMLDocument2_iface.lpVtbl = &HTMLDocumentVtbl;
4355 doc->IHTMLDocument3_iface.lpVtbl = &HTMLDocument3Vtbl;
4356 doc->IHTMLDocument4_iface.lpVtbl = &HTMLDocument4Vtbl;
4357 doc->IHTMLDocument5_iface.lpVtbl = &HTMLDocument5Vtbl;
4358 doc->IHTMLDocument6_iface.lpVtbl = &HTMLDocument6Vtbl;
4359 doc->IHTMLDocument7_iface.lpVtbl = &HTMLDocument7Vtbl;
4360 doc->IDispatchEx_iface.lpVtbl = &DocDispatchExVtbl;
4361 doc->ISupportErrorInfo_iface.lpVtbl = &SupportErrorInfoVtbl;
4362 doc->IProvideClassInfo_iface.lpVtbl = &ProvideClassInfoVtbl;
4363
4364 doc->unk_impl = unk_impl;
4365 doc->dispex = dispex;
4366 doc->task_magic = get_task_target_magic();
4367
4368 HTMLDocument_Persist_Init(doc);
4369 HTMLDocument_OleCmd_Init(doc);
4370 HTMLDocument_OleObj_Init(doc);
4371 HTMLDocument_View_Init(doc);
4372 HTMLDocument_Window_Init(doc);
4373 HTMLDocument_Service_Init(doc);
4374 HTMLDocument_Hlink_Init(doc);
4375
4376 ConnectionPointContainer_Init(&doc->cp_container, (IUnknown*)&doc->IHTMLDocument2_iface, HTMLDocument_cpc);
4377 }
4378
4379 static void destroy_htmldoc(HTMLDocument *This)
4380 {
4381 remove_target_tasks(This->task_magic);
4382
4383 ConnectionPointContainer_Destroy(&This->cp_container);
4384 }
4385
4386 static inline HTMLDocumentNode *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
4387 {
4388 return CONTAINING_RECORD(iface, HTMLDocumentNode, node);
4389 }
4390
4391 static HRESULT HTMLDocumentNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
4392 {
4393 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4394
4395 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
4396
4397 if(htmldoc_qi(&This->basedoc, riid, ppv))
4398 return *ppv ? S_OK : E_NOINTERFACE;
4399
4400 if(IsEqualGUID(&IID_IInternetHostSecurityManager, riid))
4401 *ppv = &This->IInternetHostSecurityManager_iface;
4402 else
4403 return HTMLDOMNode_QI(&This->node, riid, ppv);
4404
4405 IUnknown_AddRef((IUnknown*)*ppv);
4406 return S_OK;
4407 }
4408
4409 static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
4410 {
4411 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4412 unsigned i;
4413
4414 for(i=0; i < This->elem_vars_cnt; i++)
4415 heap_free(This->elem_vars[i]);
4416 heap_free(This->elem_vars);
4417
4418 detach_events(This);
4419 if(This->body_event_target)
4420 release_event_target(This->body_event_target);
4421 if(This->catmgr)
4422 ICatInformation_Release(This->catmgr);
4423
4424 detach_selection(This);
4425 detach_ranges(This);
4426
4427 while(!list_empty(&This->plugin_hosts))
4428 detach_plugin_host(LIST_ENTRY(list_head(&This->plugin_hosts), PluginHost, entry));
4429
4430 if(!This->nsdoc && This->window) {
4431 /* document fragments own reference to inner window */
4432 IHTMLWindow2_Release(&This->window->base.IHTMLWindow2_iface);
4433 This->window = NULL;
4434 }
4435
4436 heap_free(This->event_vector);
4437 destroy_htmldoc(&This->basedoc);
4438 }
4439
4440 static HRESULT HTMLDocumentNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
4441 {
4442 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4443 FIXME("%p\n", This);
4444 return E_NOTIMPL;
4445 }
4446
4447 static void HTMLDocumentNode_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
4448 {
4449 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4450
4451 if(This->nsdoc)
4452 note_cc_edge((nsISupports*)This->nsdoc, "This->nsdoc", cb);
4453 }
4454
4455 static void HTMLDocumentNode_unlink(HTMLDOMNode *iface)
4456 {
4457 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4458
4459 if(This->nsdoc) {
4460 nsIDOMHTMLDocument *nsdoc = This->nsdoc;
4461
4462 release_document_mutation(This);
4463 This->nsdoc = NULL;
4464 nsIDOMHTMLDocument_Release(nsdoc);
4465 This->window = NULL;
4466 }
4467 }
4468
4469 static const NodeImplVtbl HTMLDocumentNodeImplVtbl = {
4470 HTMLDocumentNode_QI,
4471 HTMLDocumentNode_destructor,
4472 HTMLDocument_cpc,
4473 HTMLDocumentNode_clone,
4474 NULL,
4475 NULL,
4476 NULL,
4477 NULL,
4478 NULL,
4479 NULL,
4480 NULL,
4481 NULL,
4482 NULL,
4483 NULL,
4484 NULL,
4485 HTMLDocumentNode_traverse,
4486 HTMLDocumentNode_unlink
4487 };
4488
4489 static HRESULT HTMLDocumentFragment_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
4490 {
4491 HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
4492 HTMLDocumentNode *new_node;
4493 HRESULT hres;
4494
4495 hres = create_document_fragment(nsnode, This->node.doc, &new_node);
4496 if(FAILED(hres))
4497 return hres;
4498
4499 *ret = &new_node->node;
4500 return S_OK;
4501 }
4502
4503 static inline HTMLDocumentNode *impl_from_DispatchEx(DispatchEx *iface)
4504 {
4505 return CONTAINING_RECORD(iface, HTMLDocumentNode, node.event_target.dispex);
4506 }
4507
4508 static HRESULT HTMLDocumentNode_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
4509 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
4510 {
4511 HTMLDocumentNode *This = impl_from_DispatchEx(dispex);
4512 nsIDOMNodeList *node_list;
4513 nsAString name_str;
4514 nsIDOMNode *nsnode;
4515 HTMLDOMNode *node;
4516 unsigned i;
4517 nsresult nsres;
4518 HRESULT hres;
4519
4520 if(flags != DISPATCH_PROPERTYGET && flags != (DISPATCH_METHOD|DISPATCH_PROPERTYGET)) {
4521 FIXME("unsupported flags %x\n", flags);
4522 return E_NOTIMPL;
4523 }
4524
4525 i = id - MSHTML_DISPID_CUSTOM_MIN;
4526
4527 if(!This->nsdoc || i >= This->elem_vars_cnt)
4528 return DISP_E_UNKNOWNNAME;
4529
4530 nsAString_InitDepend(&name_str, This->elem_vars[i]);
4531 nsres = nsIDOMHTMLDocument_GetElementsByName(This->nsdoc, &name_str, &node_list);
4532 nsAString_Finish(&name_str);
4533 if(NS_FAILED(nsres))
4534 return E_FAIL;
4535
4536 nsres = nsIDOMNodeList_Item(node_list, 0, &nsnode);
4537 nsIDOMNodeList_Release(node_list);
4538 if(NS_FAILED(nsres) || !nsnode)
4539 return DISP_E_UNKNOWNNAME;
4540
4541 hres = get_node(This, nsnode, TRUE, &node);
4542 if(FAILED(hres))
4543 return hres;
4544
4545 V_VT(res) = VT_DISPATCH;
4546 V_DISPATCH(res) = (IDispatch*)&node->IHTMLDOMNode_iface;
4547 return S_OK;
4548 }
4549
4550 static void HTMLDocumentNode_bind_event(DispatchEx *dispex, int eid)
4551 {
4552 HTMLDocumentNode *This = impl_from_DispatchEx(dispex);
4553 ensure_doc_nsevent_handler(This, eid);
4554 }
4555
4556 static const dispex_static_data_vtbl_t HTMLDocumentNode_dispex_vtbl = {
4557 NULL,
4558 NULL,
4559 HTMLDocumentNode_invoke,
4560 NULL,
4561 NULL,
4562 HTMLDocumentNode_bind_event
4563 };
4564
4565 static const NodeImplVtbl HTMLDocumentFragmentImplVtbl = {
4566 HTMLDocumentNode_QI,
4567 HTMLDocumentNode_destructor,
4568 HTMLDocument_cpc,
4569 HTMLDocumentFragment_clone
4570 };
4571
4572 static const tid_t HTMLDocumentNode_iface_tids[] = {
4573 IHTMLDOMNode_tid,
4574 IHTMLDOMNode2_tid,
4575 IHTMLDocument2_tid,
4576 IHTMLDocument3_tid,
4577 IHTMLDocument4_tid,
4578 IHTMLDocument5_tid,
4579 0
4580 };
4581
4582 static dispex_static_data_t HTMLDocumentNode_dispex = {
4583 &HTMLDocumentNode_dispex_vtbl,
4584 DispHTMLDocument_tid,
4585 NULL,
4586 HTMLDocumentNode_iface_tids
4587 };
4588
4589 static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindow *window)
4590 {
4591 HTMLDocumentNode *doc;
4592
4593 doc = heap_alloc_zero(sizeof(HTMLDocumentNode));
4594 if(!doc)
4595 return NULL;
4596
4597 doc->ref = 1;
4598 doc->basedoc.doc_node = doc;
4599 doc->basedoc.doc_obj = doc_obj;
4600 doc->basedoc.window = window->base.outer_window;
4601 doc->window = window;
4602
4603 init_dispex(&doc->node.event_target.dispex, (IUnknown*)&doc->node.IHTMLDOMNode_iface,
4604 &HTMLDocumentNode_dispex);
4605 init_doc(&doc->basedoc, (IUnknown*)&doc->node.IHTMLDOMNode_iface,
4606 &doc->node.event_target.dispex.IDispatchEx_iface);
4607 HTMLDocumentNode_SecMgr_Init(doc);
4608
4609 list_init(&doc->selection_list);
4610 list_init(&doc->range_list);
4611 list_init(&doc->plugin_hosts);
4612
4613 return doc;
4614 }
4615
4616 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_obj, HTMLInnerWindow *window, HTMLDocumentNode **ret)
4617 {
4618 HTMLDocumentNode *doc;
4619
4620 doc = alloc_doc_node(doc_obj, window);
4621 if(!doc)
4622 return E_OUTOFMEMORY;
4623
4624 if(!doc_obj->basedoc.window || window->base.outer_window == doc_obj->basedoc.window)
4625 doc->basedoc.cp_container.forward_container = &doc_obj->basedoc.cp_container;
4626
4627 HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc);
4628
4629 nsIDOMHTMLDocument_AddRef(nsdoc);
4630 doc->nsdoc = nsdoc;
4631
4632 init_document_mutation(doc);
4633 doc_init_events(doc);
4634
4635 doc->node.vtbl = &HTMLDocumentNodeImplVtbl;
4636 doc->node.cp_container = &doc->basedoc.cp_container;
4637
4638 *ret = doc;
4639 return S_OK;
4640 }
4641
4642 static HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *doc_node, HTMLDocumentNode **ret)
4643 {
4644 HTMLDocumentNode *doc_frag;
4645
4646 doc_frag = alloc_doc_node(doc_node->basedoc.doc_obj, doc_node->window);
4647 if(!doc_frag)
4648 return E_OUTOFMEMORY;
4649
4650 IHTMLWindow2_AddRef(&doc_frag->window->base.IHTMLWindow2_iface);
4651
4652 HTMLDOMNode_Init(doc_node, &doc_frag->node, nsnode);
4653 doc_frag->node.vtbl = &HTMLDocumentFragmentImplVtbl;
4654 doc_frag->node.cp_container = &doc_frag->basedoc.cp_container;
4655
4656 *ret = doc_frag;
4657 return S_OK;
4658 }
4659
4660 /**********************************************************
4661 * ICustomDoc implementation
4662 */
4663
4664 static inline HTMLDocumentObj *impl_from_ICustomDoc(ICustomDoc *iface)
4665 {
4666 return CONTAINING_RECORD(iface, HTMLDocumentObj, ICustomDoc_iface);
4667 }
4668
4669 static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, void **ppv)
4670 {
4671 HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
4672
4673 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
4674
4675 if(htmldoc_qi(&This->basedoc, riid, ppv))
4676 return *ppv ? S_OK : E_NOINTERFACE;
4677
4678 if(IsEqualGUID(&IID_ICustomDoc, riid)) {
4679 *ppv = &This->ICustomDoc_iface;
4680 }else if(IsEqualGUID(&IID_ITargetContainer, riid)) {
4681 *ppv = &This->ITargetContainer_iface;
4682 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
4683 return *ppv ? S_OK : E_NOINTERFACE;
4684 }else {
4685 FIXME("Unimplemented interface %s\n", debugstr_mshtml_guid(riid));
4686 *ppv = NULL;
4687 return E_NOINTERFACE;
4688 }
4689
4690 IUnknown_AddRef((IUnknown*)*ppv);
4691 return S_OK;
4692 }
4693
4694 static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface)
4695 {
4696 HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
4697 ULONG ref = InterlockedIncrement(&This->ref);
4698
4699 TRACE("(%p) ref = %u\n", This, ref);
4700
4701 return ref;
4702 }
4703
4704 static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
4705 {
4706 HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
4707 ULONG ref = InterlockedDecrement(&This->ref);
4708
4709 TRACE("(%p) ref = %u\n", This, ref);
4710
4711 if(!ref) {
4712 nsIDOMWindowUtils *window_utils = NULL;
4713
4714 if(This->basedoc.window && This->basedoc.window->nswindow)
4715 get_nsinterface((nsISupports*)This->basedoc.window->nswindow, &IID_nsIDOMWindowUtils, (void**)&window_utils);
4716
4717 if(This->basedoc.doc_node) {
4718 This->basedoc.doc_node->basedoc.doc_obj = NULL;
4719 htmldoc_release(&This->basedoc.doc_node->basedoc);
4720 }
4721 if(This->basedoc.window) {
4722 This->basedoc.window->doc_obj = NULL;
4723 IHTMLWindow2_Release(&This->basedoc.window->base.IHTMLWindow2_iface);
4724 }
4725 if(This->basedoc.advise_holder)
4726 IOleAdviseHolder_Release(This->basedoc.advise_holder);
4727
4728 if(This->view_sink)
4729 IAdviseSink_Release(This->view_sink);
4730 if(This->client)
4731 IOleObject_SetClientSite(&This->basedoc.IOleObject_iface, NULL);
4732 if(This->hostui)
4733 ICustomDoc_SetUIHandler(&This->ICustomDoc_iface, NULL);
4734 if(This->in_place_active)
4735 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->basedoc.IOleInPlaceObjectWindowless_iface);
4736 if(This->ipsite)
4737 IOleDocumentView_SetInPlaceSite(&This->basedoc.IOleDocumentView_iface, NULL);
4738 if(This->undomgr)
4739 IOleUndoManager_Release(This->undomgr);
4740 if(This->editsvcs)
4741 IHTMLEditServices_Release(This->editsvcs);
4742 if(This->tooltips_hwnd)
4743 DestroyWindow(This->tooltips_hwnd);
4744
4745 if(This->hwnd)
4746 DestroyWindow(This->hwnd);
4747 heap_free(This->mime);
4748
4749 destroy_htmldoc(&This->basedoc);
4750 release_dispex(&This->dispex);
4751
4752 if(This->nscontainer)
4753 NSContainer_Release(This->nscontainer);
4754 heap_free(This);
4755
4756 /* Force cycle collection */
4757 if(window_utils) {
4758 nsIDOMWindowUtils_CycleCollect(window_utils, NULL, 0);
4759 nsIDOMWindowUtils_Release(window_utils);
4760 }
4761 }
4762
4763 return ref;
4764 }
4765
4766 static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler)
4767 {
4768 HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
4769 IOleCommandTarget *cmdtrg;
4770 HRESULT hres;
4771
4772 TRACE("(%p)->(%p)\n", This, pUIHandler);
4773
4774 if(This->custom_hostui && This->hostui == pUIHandler)
4775 return S_OK;
4776
4777 This->custom_hostui = TRUE;
4778
4779 if(This->hostui)
4780 IDocHostUIHandler_Release(This->hostui);
4781 if(pUIHandler)
4782 IDocHostUIHandler_AddRef(pUIHandler);
4783 This->hostui = pUIHandler;
4784 if(!pUIHandler)
4785 return S_OK;
4786
4787 hres = IDocHostUIHandler_QueryInterface(pUIHandler, &IID_IOleCommandTarget, (void**)&cmdtrg);
4788 if(SUCCEEDED(hres)) {
4789 FIXME("custom UI handler supports IOleCommandTarget\n");
4790 IOleCommandTarget_Release(cmdtrg);
4791 }
4792
4793 return S_OK;
4794 }
4795
4796 static const ICustomDocVtbl CustomDocVtbl = {
4797 CustomDoc_QueryInterface,
4798 CustomDoc_AddRef,
4799 CustomDoc_Release,
4800 CustomDoc_SetUIHandler
4801 };
4802
4803 static const tid_t HTMLDocumentObj_iface_tids[] = {
4804 IHTMLDocument2_tid,
4805 IHTMLDocument3_tid,
4806 IHTMLDocument4_tid,
4807 IHTMLDocument5_tid,
4808 0
4809 };
4810 static dispex_static_data_t HTMLDocumentObj_dispex = {
4811 NULL,
4812 DispHTMLDocument_tid,
4813 NULL,
4814 HTMLDocumentObj_iface_tids
4815 };
4816
4817 HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
4818 {
4819 HTMLDocumentObj *doc;
4820 nsIDOMWindow *nswindow = NULL;
4821 nsresult nsres;
4822 HRESULT hres;
4823
4824 TRACE("(%p %s %p)\n", pUnkOuter, debugstr_mshtml_guid(riid), ppvObject);
4825
4826 doc = heap_alloc_zero(sizeof(HTMLDocumentObj));
4827 if(!doc)
4828 return E_OUTOFMEMORY;
4829
4830 init_dispex(&doc->dispex, (IUnknown*)&doc->ICustomDoc_iface, &HTMLDocumentObj_dispex);
4831 init_doc(&doc->basedoc, (IUnknown*)&doc->ICustomDoc_iface, &doc->dispex.IDispatchEx_iface);
4832 TargetContainer_Init(doc);
4833
4834 doc->ICustomDoc_iface.lpVtbl = &CustomDocVtbl;
4835 doc->ref = 1;
4836 doc->basedoc.doc_obj = doc;
4837
4838 doc->usermode = UNKNOWN_USERMODE;
4839
4840 init_binding_ui(doc);
4841
4842 hres = create_nscontainer(doc, &doc->nscontainer);
4843 if(FAILED(hres)) {
4844 ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n");
4845 htmldoc_release(&doc->basedoc);
4846 return hres;
4847 }
4848
4849 hres = htmldoc_query_interface(&doc->basedoc, riid, ppvObject);
4850 htmldoc_release(&doc->basedoc);
4851 if(FAILED(hres))
4852 return hres;
4853
4854 nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &nswindow);
4855 if(NS_FAILED(nsres))
4856 ERR("GetContentDOMWindow failed: %08x\n", nsres);
4857
4858 hres = HTMLOuterWindow_Create(doc, nswindow, NULL /* FIXME */, &doc->basedoc.window);
4859 if(nswindow)
4860 nsIDOMWindow_Release(nswindow);
4861 if(FAILED(hres)) {
4862 htmldoc_release(&doc->basedoc);
4863 return hres;
4864 }
4865
4866 if(!doc->basedoc.doc_node && doc->basedoc.window->base.inner_window->doc) {
4867 doc->basedoc.doc_node = doc->basedoc.window->base.inner_window->doc;
4868 htmldoc_addref(&doc->basedoc.doc_node->basedoc);
4869 }
4870
4871 get_thread_hwnd();
4872
4873 return S_OK;
4874 }