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