2 * Copyright 2005-2009 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/debug.h"
35 #include "mshtml_private.h"
36 #include "htmlevent.h"
37 #include "pluginhost.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
42 static HRESULT
create_document_fragment(nsIDOMNode
*nsnode
, HTMLDocumentNode
*doc_node
, HTMLDocumentNode
**ret
);
44 HRESULT
get_doc_elem_by_id(HTMLDocumentNode
*doc
, const WCHAR
*id
, HTMLElement
**ret
)
46 nsIDOMNodeList
*nsnode_list
;
47 nsIDOMNode
*nsnode
= NULL
;
48 nsIDOMElement
*nselem
;
53 if(!doc
->dom_document
) {
54 WARN("NULL dom_document\n");
58 nsAString_InitDepend(&id_str
, id
);
59 /* get element by id attribute */
60 nsres
= nsIDOMDocument_GetElementById(doc
->dom_document
, &id_str
, &nselem
);
62 ERR("GetElementById failed: %08lx\n", nsres
);
63 nsAString_Finish(&id_str
);
67 /* get first element by name attribute */
68 if(doc
->html_document
) {
69 nsres
= nsIDOMHTMLDocument_GetElementsByName(doc
->html_document
, &id_str
, &nsnode_list
);
70 nsAString_Finish(&id_str
);
72 ERR("getElementsByName failed: %08lx\n", nsres
);
74 nsIDOMElement_Release(nselem
);
78 nsres
= nsIDOMNodeList_Item(nsnode_list
, 0, &nsnode
);
79 nsIDOMNodeList_Release(nsnode_list
);
80 assert(nsres
== NS_OK
);
83 if(nsnode
&& nselem
) {
86 nsres
= nsIDOMNode_CompareDocumentPosition(nsnode
, (nsIDOMNode
*)nselem
, &pos
);
87 if(NS_FAILED(nsres
)) {
88 FIXME("CompareDocumentPosition failed: 0x%08lx\n", nsres
);
89 nsIDOMNode_Release(nsnode
);
90 nsIDOMElement_Release(nselem
);
94 TRACE("CompareDocumentPosition gave: 0x%x\n", pos
);
95 if(!(pos
& (DOCUMENT_POSITION_PRECEDING
| DOCUMENT_POSITION_CONTAINS
))) {
96 nsIDOMElement_Release(nselem
);
103 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMElement
, (void**)&nselem
);
104 assert(nsres
== NS_OK
);
106 nsIDOMNode_Release(nsnode
);
114 hres
= get_element(nselem
, ret
);
115 nsIDOMElement_Release(nselem
);
119 UINT
get_document_charset(HTMLDocumentNode
*doc
)
121 nsAString charset_str
;
128 nsAString_Init(&charset_str
, NULL
);
129 nsres
= nsIDOMDocument_GetCharacterSet(doc
->dom_document
, &charset_str
);
130 if(NS_SUCCEEDED(nsres
)) {
131 const PRUnichar
*charset
;
133 nsAString_GetData(&charset_str
, &charset
);
136 BSTR str
= SysAllocString(charset
);
137 ret
= cp_from_charset_string(str
);
141 ERR("GetCharset failed: %08lx\n", nsres
);
143 nsAString_Finish(&charset_str
);
148 return doc
->charset
= ret
;
153 IDOMDocumentType IDOMDocumentType_iface
;
156 static inline DocumentType
*impl_from_IDOMDocumentType(IDOMDocumentType
*iface
)
158 return CONTAINING_RECORD(iface
, DocumentType
, IDOMDocumentType_iface
);
161 static HRESULT WINAPI
DocumentType_QueryInterface(IDOMDocumentType
*iface
, REFIID riid
, void **ppv
)
163 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
165 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
168 static ULONG WINAPI
DocumentType_AddRef(IDOMDocumentType
*iface
)
170 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
172 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
175 static ULONG WINAPI
DocumentType_Release(IDOMDocumentType
*iface
)
177 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
179 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
182 static HRESULT WINAPI
DocumentType_GetTypeInfoCount(IDOMDocumentType
*iface
, UINT
*pctinfo
)
184 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
186 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
189 static HRESULT WINAPI
DocumentType_GetTypeInfo(IDOMDocumentType
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
191 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
193 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
196 static HRESULT WINAPI
DocumentType_GetIDsOfNames(IDOMDocumentType
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
197 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
199 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
201 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
,
202 cNames
, lcid
, rgDispId
);
205 static HRESULT WINAPI
DocumentType_Invoke(IDOMDocumentType
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
206 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
208 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
210 return IDispatchEx_Invoke(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
,
211 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
214 static HRESULT WINAPI
DocumentType_get_name(IDOMDocumentType
*iface
, BSTR
*p
)
216 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
220 TRACE("(%p)->(%p)\n", This
, p
);
222 nsAString_Init(&nsstr
, NULL
);
223 nsres
= nsIDOMDocumentType_GetName((nsIDOMDocumentType
*)This
->node
.nsnode
, &nsstr
);
224 return return_nsstr(nsres
, &nsstr
, p
);
227 static HRESULT WINAPI
DocumentType_get_entities(IDOMDocumentType
*iface
, IDispatch
**p
)
229 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
231 FIXME("(%p)->(%p)\n", This
, p
);
236 static HRESULT WINAPI
DocumentType_get_notations(IDOMDocumentType
*iface
, IDispatch
**p
)
238 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
240 FIXME("(%p)->(%p)\n", This
, p
);
245 static HRESULT WINAPI
DocumentType_get_publicId(IDOMDocumentType
*iface
, VARIANT
*p
)
247 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
249 FIXME("(%p)->(%p)\n", This
, p
);
254 static HRESULT WINAPI
DocumentType_get_systemId(IDOMDocumentType
*iface
, VARIANT
*p
)
256 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
258 FIXME("(%p)->(%p)\n", This
, p
);
263 static HRESULT WINAPI
DocumentType_get_internalSubset(IDOMDocumentType
*iface
, VARIANT
*p
)
265 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
267 FIXME("(%p)->(%p)\n", This
, p
);
272 static const IDOMDocumentTypeVtbl DocumentTypeVtbl
= {
273 DocumentType_QueryInterface
,
275 DocumentType_Release
,
276 DocumentType_GetTypeInfoCount
,
277 DocumentType_GetTypeInfo
,
278 DocumentType_GetIDsOfNames
,
280 DocumentType_get_name
,
281 DocumentType_get_entities
,
282 DocumentType_get_notations
,
283 DocumentType_get_publicId
,
284 DocumentType_get_systemId
,
285 DocumentType_get_internalSubset
288 static inline DocumentType
*DocumentType_from_HTMLDOMNode(HTMLDOMNode
*iface
)
290 return CONTAINING_RECORD(iface
, DocumentType
, node
);
293 static inline DocumentType
*DocumentType_from_DispatchEx(DispatchEx
*iface
)
295 return CONTAINING_RECORD(iface
, DocumentType
, node
.event_target
.dispex
);
298 static HRESULT
DocumentType_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
300 DocumentType
*This
= DocumentType_from_HTMLDOMNode(iface
);
302 return create_doctype_node(This
->node
.doc
, nsnode
, ret
);
305 static const cpc_entry_t DocumentType_cpc
[] = {{NULL
}};
307 static const NodeImplVtbl DocumentTypeImplVtbl
= {
308 .cpc_entries
= DocumentType_cpc
,
309 .clone
= DocumentType_clone
312 static void *DocumentType_query_interface(DispatchEx
*dispex
, REFIID riid
)
314 DocumentType
*This
= DocumentType_from_DispatchEx(dispex
);
316 if(IsEqualGUID(&IID_IDOMDocumentType
, riid
))
317 return &This
->IDOMDocumentType_iface
;
319 return HTMLDOMNode_query_interface(&This
->node
.event_target
.dispex
, riid
);
322 static nsISupports
*DocumentType_get_gecko_target(DispatchEx
*dispex
)
324 DocumentType
*This
= DocumentType_from_DispatchEx(dispex
);
325 return (nsISupports
*)This
->node
.nsnode
;
328 static EventTarget
*DocumentType_get_parent_event_target(DispatchEx
*dispex
)
330 DocumentType
*This
= DocumentType_from_DispatchEx(dispex
);
336 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &nsnode
);
337 assert(nsres
== NS_OK
);
341 hres
= get_node(nsnode
, TRUE
, &node
);
342 nsIDOMNode_Release(nsnode
);
346 return &node
->event_target
;
349 static IHTMLEventObj
*DocumentType_set_current_event(DispatchEx
*dispex
, IHTMLEventObj
*event
)
351 DocumentType
*This
= DocumentType_from_DispatchEx(dispex
);
352 return default_set_current_event(This
->node
.doc
->window
, event
);
355 static const event_target_vtbl_t DocumentType_event_target_vtbl
= {
357 .query_interface
= DocumentType_query_interface
,
358 .destructor
= HTMLDOMNode_destructor
,
359 .traverse
= HTMLDOMNode_traverse
,
360 .unlink
= HTMLDOMNode_unlink
362 .get_gecko_target
= DocumentType_get_gecko_target
,
363 .get_parent_event_target
= DocumentType_get_parent_event_target
,
364 .set_current_event
= DocumentType_set_current_event
367 static const tid_t DocumentType_iface_tids
[] = {
368 IDOMDocumentType_tid
,
375 static dispex_static_data_t DocumentType_dispex
= {
377 &DocumentType_event_target_vtbl
.dispex_vtbl
,
378 DispDOMDocumentType_tid
,
379 DocumentType_iface_tids
382 HRESULT
create_doctype_node(HTMLDocumentNode
*doc
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
384 nsIDOMDocumentType
*nsdoctype
;
385 DocumentType
*doctype
;
388 if(!(doctype
= calloc(1, sizeof(*doctype
))))
389 return E_OUTOFMEMORY
;
391 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMDocumentType
, (void**)&nsdoctype
);
392 assert(nsres
== NS_OK
);
394 doctype
->node
.vtbl
= &DocumentTypeImplVtbl
;
395 doctype
->IDOMDocumentType_iface
.lpVtbl
= &DocumentTypeVtbl
;
396 HTMLDOMNode_Init(doc
, &doctype
->node
, (nsIDOMNode
*)nsdoctype
, &DocumentType_dispex
);
397 nsIDOMDocumentType_Release(nsdoctype
);
399 *ret
= &doctype
->node
;
403 static inline HTMLDocumentNode
*impl_from_IHTMLDocument2(IHTMLDocument2
*iface
)
405 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument2_iface
);
408 static HRESULT WINAPI
HTMLDocument_QueryInterface(IHTMLDocument2
*iface
, REFIID riid
, void **ppv
)
410 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
412 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
415 static ULONG WINAPI
HTMLDocument_AddRef(IHTMLDocument2
*iface
)
417 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
419 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
422 static ULONG WINAPI
HTMLDocument_Release(IHTMLDocument2
*iface
)
424 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
426 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
429 static HRESULT WINAPI
HTMLDocument_GetTypeInfoCount(IHTMLDocument2
*iface
, UINT
*pctinfo
)
431 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
433 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
436 static HRESULT WINAPI
HTMLDocument_GetTypeInfo(IHTMLDocument2
*iface
, UINT iTInfo
, LCID lcid
,
439 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
441 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
444 static HRESULT WINAPI
HTMLDocument_GetIDsOfNames(IHTMLDocument2
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
445 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
447 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
449 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
453 static HRESULT WINAPI
HTMLDocument_Invoke(IHTMLDocument2
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
454 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
456 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
458 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
459 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
462 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
464 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
467 TRACE("(%p)->(%p)\n", This
, p
);
469 hres
= IHTMLDocument7_get_parentWindow(&This
->IHTMLDocument7_iface
, (IHTMLWindow2
**)p
);
470 return hres
== S_OK
&& !*p
? E_PENDING
: hres
;
473 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
475 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
477 TRACE("(%p)->(%p)\n", This
, p
);
478 *p
= create_all_collection(&This
->node
, FALSE
);
483 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
485 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
486 nsIDOMElement
*nsbody
= NULL
;
487 HTMLElement
*element
;
491 TRACE("(%p)->(%p)\n", This
, p
);
493 if(This
->html_document
) {
494 nsres
= nsIDOMHTMLDocument_GetBody(This
->html_document
, (nsIDOMHTMLElement
**)&nsbody
);
495 if(NS_FAILED(nsres
)) {
496 TRACE("Could not get body: %08lx\n", nsres
);
500 nsAString nsnode_name
;
501 nsIDOMDocumentFragment
*frag
;
503 nsres
= nsIDOMNode_QueryInterface(This
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&frag
);
504 if(!NS_FAILED(nsres
)) {
505 nsAString_InitDepend(&nsnode_name
, L
"BODY");
506 nsIDOMDocumentFragment_QuerySelector(frag
, &nsnode_name
, &nsbody
);
507 nsAString_Finish(&nsnode_name
);
508 nsIDOMDocumentFragment_Release(frag
);
517 hres
= get_element(nsbody
, &element
);
518 nsIDOMElement_Release(nsbody
);
522 *p
= &element
->IHTMLElement_iface
;
526 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
528 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
529 nsIDOMElement
*nselem
;
534 TRACE("(%p)->(%p)\n", This
, p
);
536 if(!This
->dom_document
) {
542 * NOTE: Gecko may return an active element even if the document is not visible.
543 * IE returns NULL in this case.
545 nsres
= nsIDOMDocument_GetActiveElement(This
->dom_document
, &nselem
);
546 if(NS_FAILED(nsres
)) {
547 ERR("GetActiveElement failed: %08lx\n", nsres
);
556 hres
= get_element(nselem
, &elem
);
557 nsIDOMElement_Release(nselem
);
561 *p
= &elem
->IHTMLElement_iface
;
565 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
567 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
568 nsIDOMHTMLCollection
*nscoll
= NULL
;
571 TRACE("(%p)->(%p)\n", This
, p
);
578 if(!This
->dom_document
) {
579 WARN("NULL dom_document\n");
583 if(!This
->html_document
) {
584 FIXME("Not implemented for XML document\n");
588 nsres
= nsIDOMHTMLDocument_GetImages(This
->html_document
, &nscoll
);
589 if(NS_FAILED(nsres
)) {
590 ERR("GetImages failed: %08lx\n", nsres
);
595 *p
= create_collection_from_htmlcol(nscoll
, This
->document_mode
);
596 nsIDOMHTMLCollection_Release(nscoll
);
602 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
604 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
605 nsIDOMHTMLCollection
*nscoll
= NULL
;
608 TRACE("(%p)->(%p)\n", This
, p
);
615 if(!This
->dom_document
) {
616 WARN("NULL dom_document\n");
620 if(!This
->html_document
) {
621 FIXME("Not implemented for XML document\n");
625 nsres
= nsIDOMHTMLDocument_GetApplets(This
->html_document
, &nscoll
);
626 if(NS_FAILED(nsres
)) {
627 ERR("GetApplets failed: %08lx\n", nsres
);
632 *p
= create_collection_from_htmlcol(nscoll
, This
->document_mode
);
633 nsIDOMHTMLCollection_Release(nscoll
);
639 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
641 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
642 nsIDOMHTMLCollection
*nscoll
= NULL
;
645 TRACE("(%p)->(%p)\n", This
, p
);
652 if(!This
->dom_document
) {
653 WARN("NULL dom_document\n");
657 if(!This
->html_document
) {
658 FIXME("Not implemented for XML document\n");
662 nsres
= nsIDOMHTMLDocument_GetLinks(This
->html_document
, &nscoll
);
663 if(NS_FAILED(nsres
)) {
664 ERR("GetLinks failed: %08lx\n", nsres
);
669 *p
= create_collection_from_htmlcol(nscoll
, This
->document_mode
);
670 nsIDOMHTMLCollection_Release(nscoll
);
676 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
678 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
679 nsIDOMHTMLCollection
*nscoll
= NULL
;
682 TRACE("(%p)->(%p)\n", This
, p
);
689 if(!This
->dom_document
) {
690 WARN("NULL dom_document\n");
694 if(!This
->html_document
) {
695 FIXME("Not implemented for XML document\n");
699 nsres
= nsIDOMHTMLDocument_GetForms(This
->html_document
, &nscoll
);
700 if(NS_FAILED(nsres
)) {
701 ERR("GetForms failed: %08lx\n", nsres
);
706 *p
= create_collection_from_htmlcol(nscoll
, This
->document_mode
);
707 nsIDOMHTMLCollection_Release(nscoll
);
713 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
715 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
716 nsIDOMHTMLCollection
*nscoll
= NULL
;
719 TRACE("(%p)->(%p)\n", This
, p
);
726 if(!This
->dom_document
) {
727 WARN("NULL dom_document\n");
731 if(!This
->html_document
) {
732 FIXME("Not implemented for XML document\n");
736 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->html_document
, &nscoll
);
737 if(NS_FAILED(nsres
)) {
738 ERR("GetAnchors failed: %08lx\n", nsres
);
743 *p
= create_collection_from_htmlcol(nscoll
, This
->document_mode
);
744 nsIDOMHTMLCollection_Release(nscoll
);
750 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
752 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
756 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
758 if(!This
->dom_document
) {
759 WARN("NULL dom_document\n");
763 nsAString_InitDepend(&nsstr
, v
);
764 nsres
= nsIDOMDocument_SetTitle(This
->dom_document
, &nsstr
);
765 nsAString_Finish(&nsstr
);
767 ERR("SetTitle failed: %08lx\n", nsres
);
772 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
774 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
775 const PRUnichar
*ret
;
779 TRACE("(%p)->(%p)\n", This
, p
);
781 if(!This
->dom_document
) {
782 WARN("NULL dom_document\n");
787 nsAString_Init(&nsstr
, NULL
);
788 nsres
= nsIDOMDocument_GetTitle(This
->dom_document
, &nsstr
);
789 if (NS_SUCCEEDED(nsres
)) {
790 nsAString_GetData(&nsstr
, &ret
);
791 *p
= SysAllocString(ret
);
793 nsAString_Finish(&nsstr
);
795 if(NS_FAILED(nsres
)) {
796 ERR("GetTitle failed: %08lx\n", nsres
);
803 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
805 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
806 nsIDOMHTMLCollection
*nscoll
= NULL
;
809 TRACE("(%p)->(%p)\n", This
, p
);
816 if(!This
->dom_document
) {
817 WARN("NULL dom_document\n");
821 if(!This
->html_document
) {
822 FIXME("Not implemented for XML document\n");
826 nsres
= nsIDOMHTMLDocument_GetScripts(This
->html_document
, &nscoll
);
827 if(NS_FAILED(nsres
)) {
828 ERR("GetImages failed: %08lx\n", nsres
);
833 *p
= create_collection_from_htmlcol(nscoll
, This
->document_mode
);
834 nsIDOMHTMLCollection_Release(nscoll
);
840 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
842 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
843 HTMLDocumentObj
*doc_obj
;
846 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
848 if(wcsicmp(v
, L
"on")) {
849 FIXME("Unsupported arg %s\n", debugstr_w(v
));
853 doc_obj
= This
->doc_obj
;
854 IUnknown_AddRef(doc_obj
->outer_unk
);
855 hres
= setup_edit_mode(doc_obj
);
856 IUnknown_Release(doc_obj
->outer_unk
);
860 call_property_onchanged(&This
->cp_container
, DISPID_IHTMLDOCUMENT2_DESIGNMODE
);
864 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
866 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
867 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
872 *p
= SysAllocString(L
"Off");
877 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
879 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
880 nsISelection
*nsselection
;
883 TRACE("(%p)->(%p)\n", This
, p
);
885 if(!This
->html_document
) {
886 FIXME("Not implemented for XML document\n");
890 nsres
= nsIDOMHTMLDocument_GetSelection(This
->html_document
, &nsselection
);
891 if(NS_FAILED(nsres
)) {
892 ERR("GetSelection failed: %08lx\n", nsres
);
896 return HTMLSelectionObject_Create(This
, nsselection
, p
);
899 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
901 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
903 TRACE("(%p)->(%p)\n", iface
, p
);
908 return get_readystate_string(This
->outer_window
? This
->outer_window
->readystate
: 0, p
);
911 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
913 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
915 TRACE("(%p)->(%p)\n", This
, p
);
917 if(!This
->outer_window
) {
918 /* Not implemented by IE */
921 return IHTMLWindow2_get_frames(&This
->outer_window
->base
.IHTMLWindow2_iface
, p
);
924 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
926 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
927 FIXME("(%p)->(%p)\n", This
, p
);
931 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
933 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
934 FIXME("(%p)->(%p)\n", This
, p
);
938 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
940 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
941 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
945 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
947 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
948 FIXME("(%p)->(%p)\n", This
, p
);
952 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
954 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
955 IHTMLElement
*element
= NULL
;
956 IHTMLBodyElement
*body
;
959 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
961 hr
= IHTMLDocument2_get_body(iface
, &element
);
964 ERR("Failed to get body (0x%08lx)\n", hr
);
970 FIXME("Empty body element.\n");
974 hr
= IHTMLElement_QueryInterface(element
, &IID_IHTMLBodyElement
, (void**)&body
);
977 hr
= IHTMLBodyElement_put_bgColor(body
, v
);
978 IHTMLBodyElement_Release(body
);
980 IHTMLElement_Release(element
);
985 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
987 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
992 TRACE("(%p)->(%p)\n", This
, p
);
994 if(!This
->dom_document
) {
995 WARN("NULL dom_document\n");
999 if(!This
->html_document
) {
1000 FIXME("Not implemented for XML document\n");
1004 nsAString_Init(&nsstr
, NULL
);
1005 nsres
= nsIDOMHTMLDocument_GetBgColor(This
->html_document
, &nsstr
);
1006 hres
= return_nsstr_variant(nsres
, &nsstr
, NSSTR_COLOR
, p
);
1007 if(hres
== S_OK
&& V_VT(p
) == VT_BSTR
&& !V_BSTR(p
)) {
1008 TRACE("default #ffffff\n");
1009 if(!(V_BSTR(p
) = SysAllocString(L
"#ffffff")))
1010 hres
= E_OUTOFMEMORY
;
1015 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
1017 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1018 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1022 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
1024 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1025 FIXME("(%p)->(%p)\n", This
, p
);
1029 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
1031 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1032 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1036 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
1038 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1039 FIXME("(%p)->(%p)\n", This
, p
);
1043 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
1045 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1046 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1050 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
1052 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1053 FIXME("(%p)->(%p)\n", This
, p
);
1057 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
1059 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1063 TRACE("(%p)->(%p)\n", This
, p
);
1065 nsAString_InitDepend(&nsstr
, NULL
);
1066 nsres
= nsIDOMDocument_GetReferrer(This
->dom_document
, &nsstr
);
1067 return return_nsstr(nsres
, &nsstr
, p
);
1070 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
1072 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1074 TRACE("(%p)->(%p)\n", This
, p
);
1076 if(!This
->dom_document
|| !This
->window
) {
1077 WARN("NULL window\n");
1078 return E_UNEXPECTED
;
1081 return IHTMLWindow2_get_location(&This
->window
->base
.IHTMLWindow2_iface
, p
);
1084 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
1086 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1087 FIXME("(%p)->(%p)\n", This
, p
);
1091 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
1093 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1095 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1097 if(!This
->outer_window
) {
1098 FIXME("No window available\n");
1102 return navigate_url(This
->outer_window
, v
, This
->outer_window
->uri
, BINDING_NAVIGATED
);
1105 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
1107 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1109 TRACE("(%p)->(%p)\n", iface
, p
);
1111 *p
= SysAllocString(This
->outer_window
&& This
->outer_window
->url
? This
->outer_window
->url
: L
"about:blank");
1112 return *p
? S_OK
: E_OUTOFMEMORY
;
1115 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
1117 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1121 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1123 if(!This
->html_document
) {
1124 FIXME("Not implemented for XML document\n");
1128 nsAString_InitDepend(&nsstr
, v
);
1129 nsres
= nsIDOMHTMLDocument_SetDomain(This
->html_document
, &nsstr
);
1130 nsAString_Finish(&nsstr
);
1131 if(NS_FAILED(nsres
)) {
1132 ERR("SetDomain failed: %08lx\n", nsres
);
1133 return E_INVALIDARG
;
1139 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
1141 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1145 TRACE("(%p)->(%p)\n", This
, p
);
1147 if(!This
->html_document
) {
1148 FIXME("Not implemented for XML document\n");
1152 if(This
->outer_window
&& !This
->outer_window
->uri
)
1155 nsAString_Init(&nsstr
, NULL
);
1156 nsres
= nsIDOMHTMLDocument_GetDomain(This
->html_document
, &nsstr
);
1157 if(NS_SUCCEEDED(nsres
) && This
->outer_window
&& This
->outer_window
->uri
) {
1158 const PRUnichar
*str
;
1161 nsAString_GetData(&nsstr
, &str
);
1163 TRACE("Gecko returned empty string, fallback to loaded URL.\n");
1164 nsAString_Finish(&nsstr
);
1165 hres
= IUri_GetHost(This
->outer_window
->uri
, p
);
1166 return FAILED(hres
) ? hres
: S_OK
;
1170 return return_nsstr(nsres
, &nsstr
, p
);
1173 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
1175 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1178 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1180 if(!This
->outer_window
)
1183 bret
= InternetSetCookieExW(This
->outer_window
->url
, NULL
, v
, 0, 0);
1185 FIXME("InternetSetCookieExW failed: %lu\n", GetLastError());
1186 return HRESULT_FROM_WIN32(GetLastError());
1192 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
1194 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1198 TRACE("(%p)->(%p)\n", This
, p
);
1200 if(!This
->outer_window
) {
1206 bret
= InternetGetCookieExW(This
->outer_window
->url
, NULL
, NULL
, &size
, 0, NULL
);
1207 if(!bret
&& GetLastError() != ERROR_INSUFFICIENT_BUFFER
) {
1208 WARN("InternetGetCookieExW failed: %lu\n", GetLastError());
1218 *p
= SysAllocStringLen(NULL
, size
/sizeof(WCHAR
)-1);
1220 return E_OUTOFMEMORY
;
1222 bret
= InternetGetCookieExW(This
->outer_window
->url
, NULL
, *p
, &size
, 0, NULL
);
1224 ERR("InternetGetCookieExW failed: %lu\n", GetLastError());
1231 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
1233 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1234 FIXME("(%p)->(%x)\n", This
, v
);
1238 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
1240 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1241 FIXME("(%p)->(%p)\n", This
, p
);
1245 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
1247 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1248 FIXME("(%p)->(%s) returning S_OK\n", This
, debugstr_w(v
));
1252 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
1254 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1256 TRACE("(%p)->(%p)\n", This
, p
);
1258 return IHTMLDocument7_get_characterSet(&This
->IHTMLDocument7_iface
, p
);
1261 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
1263 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1264 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1268 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
1270 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1272 TRACE("(%p)->(%p)\n", This
, p
);
1274 *p
= charset_string_from_cp(GetACP());
1275 return *p
? S_OK
: E_OUTOFMEMORY
;
1278 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
1280 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1281 const PRUnichar
*content_type
;
1286 TRACE("(%p)->(%p)\n", This
, p
);
1290 if(This
->window
&& This
->window
->base
.outer_window
->readystate
== READYSTATE_UNINITIALIZED
)
1291 return (*p
= SysAllocString(L
"")) ? S_OK
: E_FAIL
;
1293 nsAString_InitDepend(&nsstr
, NULL
);
1294 nsres
= nsIDOMDocument_GetContentType(This
->dom_document
, &nsstr
);
1295 if(NS_FAILED(nsres
))
1296 return map_nsresult(nsres
);
1298 nsAString_GetData(&nsstr
, &content_type
);
1299 hres
= get_mime_type_display_name(content_type
, p
);
1300 nsAString_Finish(&nsstr
);
1304 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
1306 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1307 FIXME("(%p)->(%p)\n", This
, p
);
1311 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
1313 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1314 FIXME("(%p)->(%p)\n", This
, p
);
1318 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
1320 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1321 FIXME("(%p)->(%p)\n", This
, p
);
1325 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
1327 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1328 FIXME("(%p)->(%p)\n", This
, p
);
1332 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
1334 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1335 FIXME("(%p)->(%p)\n", This
, p
);
1339 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
1341 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1342 FIXME("(%p)->(%p)\n", This
, p
);
1346 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
1348 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1349 FIXME("(%p)->(%p)\n", This
, p
);
1353 static HRESULT
document_write(HTMLDocumentNode
*This
, SAFEARRAY
*psarray
, BOOL ln
)
1362 if(!This
->dom_document
) {
1363 WARN("NULL dom_document\n");
1364 return E_UNEXPECTED
;
1367 if(!This
->html_document
) {
1368 FIXME("Not implemented for XML document\n");
1375 if(psarray
->cDims
!= 1) {
1376 FIXME("cDims=%d\n", psarray
->cDims
);
1377 return E_INVALIDARG
;
1380 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
1382 WARN("SafeArrayAccessData failed: %08lx\n", hres
);
1386 V_VT(&tmp
) = VT_EMPTY
;
1388 jsctx
= get_context_from_document(This
->dom_document
);
1389 argc
= psarray
->rgsabound
[0].cElements
;
1390 for(i
=0; i
< argc
; i
++) {
1391 if(V_VT(var
+i
) == VT_BSTR
) {
1392 nsAString_InitDepend(&nsstr
, V_BSTR(var
+i
));
1394 hres
= VariantChangeTypeEx(&tmp
, var
+i
, MAKELCID(MAKELANGID(LANG_ENGLISH
,SUBLANG_ENGLISH_US
),SORT_DEFAULT
), 0, VT_BSTR
);
1396 WARN("Could not convert %s to string\n", debugstr_variant(var
+i
));
1399 nsAString_InitDepend(&nsstr
, V_BSTR(&tmp
));
1402 if(!ln
|| i
!= argc
-1)
1403 nsres
= nsIDOMHTMLDocument_Write(This
->html_document
, &nsstr
, jsctx
);
1405 nsres
= nsIDOMHTMLDocument_Writeln(This
->html_document
, &nsstr
, jsctx
);
1406 nsAString_Finish(&nsstr
);
1407 if(V_VT(var
+i
) != VT_BSTR
)
1409 if(NS_FAILED(nsres
)) {
1410 ERR("Write failed: %08lx\n", nsres
);
1416 SafeArrayUnaccessData(psarray
);
1421 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
1423 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1425 TRACE("(%p)->(%p)\n", iface
, psarray
);
1427 return document_write(This
, psarray
, FALSE
);
1430 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
1432 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1434 TRACE("(%p)->(%p)\n", This
, psarray
);
1436 return document_write(This
, psarray
, TRUE
);
1439 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
1440 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
1442 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1446 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
1447 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
1449 *pomWindowResult
= NULL
;
1451 if(!This
->outer_window
)
1454 if(!This
->dom_document
) {
1455 ERR("!dom_document\n");
1459 if(!This
->html_document
) {
1460 FIXME("Not implemented for XML document\n");
1464 if(!url
|| wcscmp(url
, L
"text/html") || V_VT(&name
) != VT_ERROR
1465 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
1466 FIXME("unsupported args\n");
1468 nsres
= nsIDOMHTMLDocument_Open(This
->html_document
, NULL
, NULL
, NULL
,
1469 get_context_from_document(This
->dom_document
), 0, &tmp
);
1470 if(NS_FAILED(nsres
)) {
1471 ERR("Open failed: %08lx\n", nsres
);
1476 nsISupports_Release(tmp
);
1478 *pomWindowResult
= (IDispatch
*)&This
->outer_window
->base
.IHTMLWindow2_iface
;
1479 IHTMLWindow2_AddRef(&This
->outer_window
->base
.IHTMLWindow2_iface
);
1483 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
1485 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1488 TRACE("(%p)\n", This
);
1490 if(!This
->dom_document
) {
1491 ERR("!dom_document\n");
1495 if(!This
->html_document
) {
1496 FIXME("Not implemented for XML document\n");
1500 nsres
= nsIDOMHTMLDocument_Close(This
->html_document
);
1501 if(NS_FAILED(nsres
)) {
1502 ERR("Close failed: %08lx\n", nsres
);
1509 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
1511 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1514 TRACE("(%p)\n", This
);
1516 if(!This
->html_document
) {
1517 FIXME("Not implemented for XML document\n");
1521 nsres
= nsIDOMHTMLDocument_Clear(This
->html_document
);
1522 if(NS_FAILED(nsres
)) {
1523 ERR("Clear failed: %08lx\n", nsres
);
1530 static const struct {
1533 }command_names
[] = {
1534 {L
"copy", IDM_COPY
},
1536 {L
"fontname", IDM_FONTNAME
},
1537 {L
"fontsize", IDM_FONTSIZE
},
1538 {L
"indent", IDM_INDENT
},
1539 {L
"insertorderedlist", IDM_ORDERLIST
},
1540 {L
"insertunorderedlist", IDM_UNORDERLIST
},
1541 {L
"outdent", IDM_OUTDENT
},
1542 {L
"paste", IDM_PASTE
},
1543 {L
"respectvisibilityindesign", IDM_RESPECTVISIBILITY_INDESIGN
}
1546 static BOOL
cmdid_from_string(const WCHAR
*str
, OLECMDID
*cmdid
)
1550 for(i
= 0; i
< ARRAY_SIZE(command_names
); i
++) {
1551 if(!wcsicmp(command_names
[i
].name
, str
)) {
1552 *cmdid
= command_names
[i
].id
;
1557 FIXME("Unknown command %s\n", debugstr_w(str
));
1561 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
1562 VARIANT_BOOL
*pfRet
)
1564 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1565 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1569 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
1570 VARIANT_BOOL
*pfRet
)
1572 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1573 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1577 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
1578 VARIANT_BOOL
*pfRet
)
1580 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1581 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1585 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
1586 VARIANT_BOOL
*pfRet
)
1588 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1589 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1593 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
1596 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1597 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1601 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
1604 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1605 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1609 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
1610 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
1612 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1617 TRACE("(%p)->(%s %x %s %p)\n", This
, debugstr_w(cmdID
), showUI
, debugstr_variant(&value
), pfRet
);
1619 if(!cmdid_from_string(cmdID
, &cmdid
))
1620 return OLECMDERR_E_NOTSUPPORTED
;
1622 V_VT(&ret
) = VT_EMPTY
;
1623 hres
= IOleCommandTarget_Exec(&This
->IOleCommandTarget_iface
, &CGID_MSHTML
, cmdid
,
1624 showUI
? 0 : OLECMDEXECOPT_DONTPROMPTUSER
, &value
, &ret
);
1628 if(V_VT(&ret
) != VT_EMPTY
) {
1629 FIXME("Handle ret %s\n", debugstr_variant(&ret
));
1633 *pfRet
= VARIANT_TRUE
;
1637 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
1638 VARIANT_BOOL
*pfRet
)
1640 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1641 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1645 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
1646 IHTMLElement
**newElem
)
1648 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1652 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1654 hres
= create_element(This
, eTag
, &elem
);
1658 *newElem
= &elem
->IHTMLElement_iface
;
1662 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1664 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1665 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1669 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1671 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1672 FIXME("(%p)->(%p)\n", This
, p
);
1676 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1678 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1680 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1682 return set_doc_event(This
, EVENTID_CLICK
, &v
);
1685 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1687 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1689 TRACE("(%p)->(%p)\n", This
, p
);
1691 return get_doc_event(This
, EVENTID_CLICK
, p
);
1694 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1696 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1698 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1700 return set_doc_event(This
, EVENTID_DBLCLICK
, &v
);
1703 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1705 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1707 TRACE("(%p)->(%p)\n", This
, p
);
1709 return get_doc_event(This
, EVENTID_DBLCLICK
, p
);
1712 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1714 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1716 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1718 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1721 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1723 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1725 TRACE("(%p)->(%p)\n", This
, p
);
1727 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1730 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1732 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1734 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1736 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1739 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1741 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1743 TRACE("(%p)->(%p)\n", This
, p
);
1745 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1748 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1750 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1752 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1754 return set_doc_event(This
, EVENTID_KEYPRESS
, &v
);
1757 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1759 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1761 TRACE("(%p)->(%p)\n", This
, p
);
1763 return get_doc_event(This
, EVENTID_KEYPRESS
, p
);
1766 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1768 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1770 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1772 return set_doc_event(This
, EVENTID_MOUSEUP
, &v
);
1775 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1777 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1779 TRACE("(%p)->(%p)\n", This
, p
);
1781 return get_doc_event(This
, EVENTID_MOUSEUP
, p
);
1784 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1786 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1788 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1790 return set_doc_event(This
, EVENTID_MOUSEDOWN
, &v
);
1793 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1795 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1797 TRACE("(%p)->(%p)\n", This
, p
);
1799 return get_doc_event(This
, EVENTID_MOUSEDOWN
, p
);
1802 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1804 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1806 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1808 return set_doc_event(This
, EVENTID_MOUSEMOVE
, &v
);
1811 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1813 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1815 TRACE("(%p)->(%p)\n", This
, p
);
1817 return get_doc_event(This
, EVENTID_MOUSEMOVE
, p
);
1820 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1822 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1824 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1826 return set_doc_event(This
, EVENTID_MOUSEOUT
, &v
);
1829 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1831 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1833 TRACE("(%p)->(%p)\n", This
, p
);
1835 return get_doc_event(This
, EVENTID_MOUSEOUT
, p
);
1838 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1840 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1842 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1844 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1847 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1849 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1851 TRACE("(%p)->(%p)\n", This
, p
);
1853 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1856 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1858 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1860 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1862 return set_doc_event(This
, EVENTID_READYSTATECHANGE
, &v
);
1865 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1867 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1869 TRACE("(%p)->(%p)\n", This
, p
);
1871 return get_doc_event(This
, EVENTID_READYSTATECHANGE
, p
);
1874 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1876 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1877 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1881 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1883 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1884 FIXME("(%p)->(%p)\n", This
, p
);
1888 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1890 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1891 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1895 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1897 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1898 FIXME("(%p)->(%p)\n", This
, p
);
1902 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1904 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1905 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1909 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1911 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1912 FIXME("(%p)->(%p)\n", This
, p
);
1916 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1918 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1920 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1922 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1925 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1927 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1929 TRACE("(%p)->(%p)\n", This
, p
);
1931 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1934 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1936 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1938 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1940 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1943 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1945 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1947 TRACE("(%p)->(%p)\n", This
, p
);
1949 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1952 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, LONG x
, LONG y
,
1953 IHTMLElement
**elementHit
)
1955 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1956 nsIDOMElement
*nselem
;
1957 HTMLElement
*element
;
1961 TRACE("(%p)->(%ld %ld %p)\n", This
, x
, y
, elementHit
);
1963 nsres
= nsIDOMDocument_ElementFromPoint(This
->dom_document
, x
, y
, &nselem
);
1964 if(NS_FAILED(nsres
)) {
1965 ERR("ElementFromPoint failed: %08lx\n", nsres
);
1974 hres
= get_element(nselem
, &element
);
1975 nsIDOMElement_Release(nselem
);
1979 *elementHit
= &element
->IHTMLElement_iface
;
1983 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1985 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1988 TRACE("(%p)->(%p)\n", This
, p
);
1990 hres
= IHTMLDocument7_get_defaultView(&This
->IHTMLDocument7_iface
, p
);
1991 return hres
== S_OK
&& !*p
? E_FAIL
: hres
;
1994 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1995 IHTMLStyleSheetsCollection
**p
)
1997 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1998 nsIDOMStyleSheetList
*nsstylelist
;
2002 TRACE("(%p)->(%p)\n", This
, p
);
2006 if(!This
->dom_document
) {
2007 WARN("NULL dom_document\n");
2008 return E_UNEXPECTED
;
2011 nsres
= nsIDOMDocument_GetStyleSheets(This
->dom_document
, &nsstylelist
);
2012 if(NS_FAILED(nsres
)) {
2013 ERR("GetStyleSheets failed: %08lx\n", nsres
);
2014 return map_nsresult(nsres
);
2017 hres
= create_style_sheet_collection(nsstylelist
,
2018 dispex_compat_mode(&This
->node
.event_target
.dispex
), p
);
2019 nsIDOMStyleSheetList_Release(nsstylelist
);
2023 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
2025 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
2026 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2030 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
2032 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
2033 FIXME("(%p)->(%p)\n", This
, p
);
2037 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
2039 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
2040 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2044 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
2046 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
2047 FIXME("(%p)->(%p)\n", This
, p
);
2051 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
2053 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
2055 TRACE("(%p)->(%p)\n", This
, String
);
2057 return dispex_to_string(&This
->node
.event_target
.dispex
, String
);
2060 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
2061 LONG lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
2063 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
2064 nsIDOMHTMLHeadElement
*head_elem
;
2065 IHTMLStyleElement
*style_elem
;
2070 TRACE("(%p)->(%s %ld %p)\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
2072 if(!This
->dom_document
) {
2073 FIXME("not a real doc object\n");
2077 if(!This
->html_document
) {
2078 FIXME("Not implemented for XML document\n");
2083 FIXME("Unsupported lIndex %ld\n", lIndex
);
2085 if(bstrHref
&& *bstrHref
) {
2086 FIXME("semi-stub for href %s\n", debugstr_w(bstrHref
));
2087 return create_style_sheet(NULL
, dispex_compat_mode(&This
->node
.event_target
.dispex
),
2091 hres
= create_element(This
, L
"style", &elem
);
2095 nsres
= nsIDOMHTMLDocument_GetHead(This
->html_document
, &head_elem
);
2096 if(NS_SUCCEEDED(nsres
)) {
2097 nsIDOMNode
*head_node
, *tmp_node
;
2099 nsres
= nsIDOMHTMLHeadElement_QueryInterface(head_elem
, &IID_nsIDOMNode
, (void**)&head_node
);
2100 nsIDOMHTMLHeadElement_Release(head_elem
);
2101 assert(nsres
== NS_OK
);
2103 nsres
= nsIDOMNode_AppendChild(head_node
, elem
->node
.nsnode
, &tmp_node
);
2104 nsIDOMNode_Release(head_node
);
2105 if(NS_SUCCEEDED(nsres
) && tmp_node
)
2106 nsIDOMNode_Release(tmp_node
);
2108 if(NS_FAILED(nsres
)) {
2109 IHTMLElement_Release(&elem
->IHTMLElement_iface
);
2113 hres
= IHTMLElement_QueryInterface(&elem
->IHTMLElement_iface
, &IID_IHTMLStyleElement
, (void**)&style_elem
);
2114 assert(hres
== S_OK
);
2115 IHTMLElement_Release(&elem
->IHTMLElement_iface
);
2117 hres
= IHTMLStyleElement_get_styleSheet(style_elem
, ppnewStyleSheet
);
2118 IHTMLStyleElement_Release(style_elem
);
2122 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
2123 HTMLDocument_QueryInterface
,
2124 HTMLDocument_AddRef
,
2125 HTMLDocument_Release
,
2126 HTMLDocument_GetTypeInfoCount
,
2127 HTMLDocument_GetTypeInfo
,
2128 HTMLDocument_GetIDsOfNames
,
2129 HTMLDocument_Invoke
,
2130 HTMLDocument_get_Script
,
2131 HTMLDocument_get_all
,
2132 HTMLDocument_get_body
,
2133 HTMLDocument_get_activeElement
,
2134 HTMLDocument_get_images
,
2135 HTMLDocument_get_applets
,
2136 HTMLDocument_get_links
,
2137 HTMLDocument_get_forms
,
2138 HTMLDocument_get_anchors
,
2139 HTMLDocument_put_title
,
2140 HTMLDocument_get_title
,
2141 HTMLDocument_get_scripts
,
2142 HTMLDocument_put_designMode
,
2143 HTMLDocument_get_designMode
,
2144 HTMLDocument_get_selection
,
2145 HTMLDocument_get_readyState
,
2146 HTMLDocument_get_frames
,
2147 HTMLDocument_get_embeds
,
2148 HTMLDocument_get_plugins
,
2149 HTMLDocument_put_alinkColor
,
2150 HTMLDocument_get_alinkColor
,
2151 HTMLDocument_put_bgColor
,
2152 HTMLDocument_get_bgColor
,
2153 HTMLDocument_put_fgColor
,
2154 HTMLDocument_get_fgColor
,
2155 HTMLDocument_put_linkColor
,
2156 HTMLDocument_get_linkColor
,
2157 HTMLDocument_put_vlinkColor
,
2158 HTMLDocument_get_vlinkColor
,
2159 HTMLDocument_get_referrer
,
2160 HTMLDocument_get_location
,
2161 HTMLDocument_get_lastModified
,
2162 HTMLDocument_put_URL
,
2163 HTMLDocument_get_URL
,
2164 HTMLDocument_put_domain
,
2165 HTMLDocument_get_domain
,
2166 HTMLDocument_put_cookie
,
2167 HTMLDocument_get_cookie
,
2168 HTMLDocument_put_expando
,
2169 HTMLDocument_get_expando
,
2170 HTMLDocument_put_charset
,
2171 HTMLDocument_get_charset
,
2172 HTMLDocument_put_defaultCharset
,
2173 HTMLDocument_get_defaultCharset
,
2174 HTMLDocument_get_mimeType
,
2175 HTMLDocument_get_fileSize
,
2176 HTMLDocument_get_fileCreatedDate
,
2177 HTMLDocument_get_fileModifiedDate
,
2178 HTMLDocument_get_fileUpdatedDate
,
2179 HTMLDocument_get_security
,
2180 HTMLDocument_get_protocol
,
2181 HTMLDocument_get_nameProp
,
2183 HTMLDocument_writeln
,
2187 HTMLDocument_queryCommandSupported
,
2188 HTMLDocument_queryCommandEnabled
,
2189 HTMLDocument_queryCommandState
,
2190 HTMLDocument_queryCommandIndeterm
,
2191 HTMLDocument_queryCommandText
,
2192 HTMLDocument_queryCommandValue
,
2193 HTMLDocument_execCommand
,
2194 HTMLDocument_execCommandShowHelp
,
2195 HTMLDocument_createElement
,
2196 HTMLDocument_put_onhelp
,
2197 HTMLDocument_get_onhelp
,
2198 HTMLDocument_put_onclick
,
2199 HTMLDocument_get_onclick
,
2200 HTMLDocument_put_ondblclick
,
2201 HTMLDocument_get_ondblclick
,
2202 HTMLDocument_put_onkeyup
,
2203 HTMLDocument_get_onkeyup
,
2204 HTMLDocument_put_onkeydown
,
2205 HTMLDocument_get_onkeydown
,
2206 HTMLDocument_put_onkeypress
,
2207 HTMLDocument_get_onkeypress
,
2208 HTMLDocument_put_onmouseup
,
2209 HTMLDocument_get_onmouseup
,
2210 HTMLDocument_put_onmousedown
,
2211 HTMLDocument_get_onmousedown
,
2212 HTMLDocument_put_onmousemove
,
2213 HTMLDocument_get_onmousemove
,
2214 HTMLDocument_put_onmouseout
,
2215 HTMLDocument_get_onmouseout
,
2216 HTMLDocument_put_onmouseover
,
2217 HTMLDocument_get_onmouseover
,
2218 HTMLDocument_put_onreadystatechange
,
2219 HTMLDocument_get_onreadystatechange
,
2220 HTMLDocument_put_onafterupdate
,
2221 HTMLDocument_get_onafterupdate
,
2222 HTMLDocument_put_onrowexit
,
2223 HTMLDocument_get_onrowexit
,
2224 HTMLDocument_put_onrowenter
,
2225 HTMLDocument_get_onrowenter
,
2226 HTMLDocument_put_ondragstart
,
2227 HTMLDocument_get_ondragstart
,
2228 HTMLDocument_put_onselectstart
,
2229 HTMLDocument_get_onselectstart
,
2230 HTMLDocument_elementFromPoint
,
2231 HTMLDocument_get_parentWindow
,
2232 HTMLDocument_get_styleSheets
,
2233 HTMLDocument_put_onbeforeupdate
,
2234 HTMLDocument_get_onbeforeupdate
,
2235 HTMLDocument_put_onerrorupdate
,
2236 HTMLDocument_get_onerrorupdate
,
2237 HTMLDocument_toString
,
2238 HTMLDocument_createStyleSheet
2241 static inline HTMLDocumentNode
*impl_from_IHTMLDocument3(IHTMLDocument3
*iface
)
2243 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument3_iface
);
2246 static HRESULT WINAPI
HTMLDocument3_QueryInterface(IHTMLDocument3
*iface
, REFIID riid
, void **ppv
)
2248 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2249 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
2252 static ULONG WINAPI
HTMLDocument3_AddRef(IHTMLDocument3
*iface
)
2254 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2255 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
2258 static ULONG WINAPI
HTMLDocument3_Release(IHTMLDocument3
*iface
)
2260 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2261 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
2264 static HRESULT WINAPI
HTMLDocument3_GetTypeInfoCount(IHTMLDocument3
*iface
, UINT
*pctinfo
)
2266 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2267 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2270 static HRESULT WINAPI
HTMLDocument3_GetTypeInfo(IHTMLDocument3
*iface
, UINT iTInfo
, LCID lcid
,
2271 ITypeInfo
**ppTInfo
)
2273 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2274 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2277 static HRESULT WINAPI
HTMLDocument3_GetIDsOfNames(IHTMLDocument3
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
2278 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2280 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2281 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2284 static HRESULT WINAPI
HTMLDocument3_Invoke(IHTMLDocument3
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
2285 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2287 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2288 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2289 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2292 static HRESULT WINAPI
HTMLDocument3_releaseCapture(IHTMLDocument3
*iface
)
2294 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2295 FIXME("(%p)\n", This
);
2299 static HRESULT WINAPI
HTMLDocument3_recalc(IHTMLDocument3
*iface
, VARIANT_BOOL fForce
)
2301 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2303 WARN("(%p)->(%x)\n", This
, fForce
);
2305 /* Doing nothing here should be fine for us. */
2309 static HRESULT WINAPI
HTMLDocument3_createTextNode(IHTMLDocument3
*iface
, BSTR text
, IHTMLDOMNode
**newTextNode
)
2311 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2318 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(text
), newTextNode
);
2320 if(!This
->dom_document
) {
2321 WARN("NULL dom_document\n");
2322 return E_UNEXPECTED
;
2325 nsAString_InitDepend(&text_str
, text
);
2326 nsres
= nsIDOMDocument_CreateTextNode(This
->dom_document
, &text_str
, &nstext
);
2327 nsAString_Finish(&text_str
);
2328 if(NS_FAILED(nsres
)) {
2329 ERR("CreateTextNode failed: %08lx\n", nsres
);
2333 hres
= HTMLDOMTextNode_Create(This
, (nsIDOMNode
*)nstext
, &node
);
2334 nsIDOMText_Release(nstext
);
2338 *newTextNode
= &node
->IHTMLDOMNode_iface
;
2342 static HRESULT WINAPI
HTMLDocument3_get_documentElement(IHTMLDocument3
*iface
, IHTMLElement
**p
)
2344 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2345 nsIDOMElement
*nselem
= NULL
;
2346 HTMLElement
*element
;
2350 TRACE("(%p)->(%p)\n", This
, p
);
2352 if(This
->outer_window
&& This
->outer_window
->readystate
== READYSTATE_UNINITIALIZED
) {
2357 if(!This
->dom_document
) {
2358 WARN("NULL dom_document\n");
2359 return E_UNEXPECTED
;
2362 nsres
= nsIDOMDocument_GetDocumentElement(This
->dom_document
, &nselem
);
2363 if(NS_FAILED(nsres
)) {
2364 ERR("GetDocumentElement failed: %08lx\n", nsres
);
2373 hres
= get_element(nselem
, &element
);
2374 nsIDOMElement_Release(nselem
);
2378 *p
= &element
->IHTMLElement_iface
;
2382 static HRESULT WINAPI
HTMLDocument3_get_uniqueID(IHTMLDocument3
*iface
, BSTR
*p
)
2384 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2386 TRACE("(%p)->(%p)\n", This
, p
);
2388 return elem_unique_id(++This
->unique_id
, p
);
2391 static HRESULT WINAPI
HTMLDocument3_attachEvent(IHTMLDocument3
*iface
, BSTR event
, IDispatch
* pDisp
,
2392 VARIANT_BOOL
*pfResult
)
2394 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2396 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
2398 return attach_event(&This
->node
.event_target
, event
, pDisp
, pfResult
);
2401 static HRESULT WINAPI
HTMLDocument3_detachEvent(IHTMLDocument3
*iface
, BSTR event
, IDispatch
*pDisp
)
2403 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2405 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(event
), pDisp
);
2407 return detach_event(&This
->node
.event_target
, event
, pDisp
);
2410 static HRESULT WINAPI
HTMLDocument3_put_onrowsdelete(IHTMLDocument3
*iface
, VARIANT v
)
2412 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2413 FIXME("(%p)->()\n", This
);
2417 static HRESULT WINAPI
HTMLDocument3_get_onrowsdelete(IHTMLDocument3
*iface
, VARIANT
*p
)
2419 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2420 FIXME("(%p)->(%p)\n", This
, p
);
2424 static HRESULT WINAPI
HTMLDocument3_put_onrowsinserted(IHTMLDocument3
*iface
, VARIANT v
)
2426 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2427 FIXME("(%p)->()\n", This
);
2431 static HRESULT WINAPI
HTMLDocument3_get_onrowsinserted(IHTMLDocument3
*iface
, VARIANT
*p
)
2433 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2434 FIXME("(%p)->(%p)\n", This
, p
);
2438 static HRESULT WINAPI
HTMLDocument3_put_oncellchange(IHTMLDocument3
*iface
, VARIANT v
)
2440 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2441 FIXME("(%p)->()\n", This
);
2445 static HRESULT WINAPI
HTMLDocument3_get_oncellchange(IHTMLDocument3
*iface
, VARIANT
*p
)
2447 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2448 FIXME("(%p)->(%p)\n", This
, p
);
2452 static HRESULT WINAPI
HTMLDocument3_put_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT v
)
2454 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2455 FIXME("(%p)->()\n", This
);
2459 static HRESULT WINAPI
HTMLDocument3_get_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT
*p
)
2461 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2462 FIXME("(%p)->(%p)\n", This
, p
);
2466 static HRESULT WINAPI
HTMLDocument3_put_ondataavailable(IHTMLDocument3
*iface
, VARIANT v
)
2468 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2469 FIXME("(%p)->()\n", This
);
2473 static HRESULT WINAPI
HTMLDocument3_get_ondataavailable(IHTMLDocument3
*iface
, VARIANT
*p
)
2475 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2476 FIXME("(%p)->(%p)\n", This
, p
);
2480 static HRESULT WINAPI
HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT v
)
2482 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2483 FIXME("(%p)->()\n", This
);
2487 static HRESULT WINAPI
HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT
*p
)
2489 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2490 FIXME("(%p)->(%p)\n", This
, p
);
2494 static HRESULT WINAPI
HTMLDocument3_put_onpropertychange(IHTMLDocument3
*iface
, VARIANT v
)
2496 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2497 FIXME("(%p)->()\n", This
);
2501 static HRESULT WINAPI
HTMLDocument3_get_onpropertychange(IHTMLDocument3
*iface
, VARIANT
*p
)
2503 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2504 FIXME("(%p)->(%p)\n", This
, p
);
2508 static HRESULT WINAPI
HTMLDocument3_put_dir(IHTMLDocument3
*iface
, BSTR v
)
2510 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2514 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2516 if(!This
->dom_document
) {
2517 FIXME("NULL dom_document\n");
2518 return E_UNEXPECTED
;
2521 nsAString_InitDepend(&dir_str
, v
);
2522 nsres
= nsIDOMDocument_SetDir(This
->dom_document
, &dir_str
);
2523 nsAString_Finish(&dir_str
);
2524 if(NS_FAILED(nsres
)) {
2525 ERR("SetDir failed: %08lx\n", nsres
);
2532 static HRESULT WINAPI
HTMLDocument3_get_dir(IHTMLDocument3
*iface
, BSTR
*p
)
2534 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2538 TRACE("(%p)->(%p)\n", This
, p
);
2540 if(!This
->dom_document
) {
2541 FIXME("NULL dom_document\n");
2542 return E_UNEXPECTED
;
2545 nsAString_Init(&dir_str
, NULL
);
2546 nsres
= nsIDOMDocument_GetDir(This
->dom_document
, &dir_str
);
2547 return return_nsstr(nsres
, &dir_str
, p
);
2550 static HRESULT WINAPI
HTMLDocument3_put_oncontextmenu(IHTMLDocument3
*iface
, VARIANT v
)
2552 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2554 TRACE("(%p)->()\n", This
);
2556 return set_doc_event(This
, EVENTID_CONTEXTMENU
, &v
);
2559 static HRESULT WINAPI
HTMLDocument3_get_oncontextmenu(IHTMLDocument3
*iface
, VARIANT
*p
)
2561 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2563 TRACE("(%p)->(%p)\n", This
, p
);
2565 return get_doc_event(This
, EVENTID_CONTEXTMENU
, p
);
2568 static HRESULT WINAPI
HTMLDocument3_put_onstop(IHTMLDocument3
*iface
, VARIANT v
)
2570 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2571 FIXME("(%p)->()\n", This
);
2575 static HRESULT WINAPI
HTMLDocument3_get_onstop(IHTMLDocument3
*iface
, VARIANT
*p
)
2577 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2578 FIXME("(%p)->(%p)\n", This
, p
);
2582 static HRESULT WINAPI
HTMLDocument3_createDocumentFragment(IHTMLDocument3
*iface
, IHTMLDocument2
**ppNewDoc
)
2584 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2585 nsIDOMDocumentFragment
*doc_frag
;
2586 HTMLDocumentNode
*docnode
;
2590 TRACE("(%p)->(%p)\n", This
, ppNewDoc
);
2592 if(!This
->dom_document
) {
2593 FIXME("NULL dom_document\n");
2597 nsres
= nsIDOMDocument_CreateDocumentFragment(This
->dom_document
, &doc_frag
);
2598 if(NS_FAILED(nsres
)) {
2599 ERR("CreateDocumentFragment failed: %08lx\n", nsres
);
2603 hres
= create_document_fragment((nsIDOMNode
*)doc_frag
, This
, &docnode
);
2604 nsIDOMDocumentFragment_Release(doc_frag
);
2608 *ppNewDoc
= &docnode
->IHTMLDocument2_iface
;
2612 static HRESULT WINAPI
HTMLDocument3_get_parentDocument(IHTMLDocument3
*iface
, IHTMLDocument2
**p
)
2614 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2615 FIXME("(%p)->(%p)\n", This
, p
);
2619 static HRESULT WINAPI
HTMLDocument3_put_enableDownload(IHTMLDocument3
*iface
, VARIANT_BOOL v
)
2621 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2622 FIXME("(%p)->(%x)\n", This
, v
);
2626 static HRESULT WINAPI
HTMLDocument3_get_enableDownload(IHTMLDocument3
*iface
, VARIANT_BOOL
*p
)
2628 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2629 FIXME("(%p)->(%p)\n", This
, p
);
2633 static HRESULT WINAPI
HTMLDocument3_put_baseUrl(IHTMLDocument3
*iface
, BSTR v
)
2635 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2636 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2640 static HRESULT WINAPI
HTMLDocument3_get_baseUrl(IHTMLDocument3
*iface
, BSTR
*p
)
2642 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2643 FIXME("(%p)->(%p)\n", This
, p
);
2647 static HRESULT WINAPI
HTMLDocument3_get_childNodes(IHTMLDocument3
*iface
, IDispatch
**p
)
2649 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2651 TRACE("(%p)->(%p)\n", This
, p
);
2653 return IHTMLDOMNode_get_childNodes(&This
->node
.IHTMLDOMNode_iface
, p
);
2656 static HRESULT WINAPI
HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3
*iface
, VARIANT_BOOL v
)
2658 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2659 FIXME("(%p)->()\n", This
);
2663 static HRESULT WINAPI
HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3
*iface
, VARIANT_BOOL
*p
)
2665 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2666 FIXME("(%p)->(%p)\n", This
, p
);
2670 static HRESULT WINAPI
HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT v
)
2672 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2673 FIXME("(%p)->()\n", This
);
2677 static HRESULT WINAPI
HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT
*p
)
2679 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2680 FIXME("(%p)->(%p)\n", This
, p
);
2684 static HRESULT WINAPI
HTMLDocument3_getElementsByName(IHTMLDocument3
*iface
, BSTR v
,
2685 IHTMLElementCollection
**ppelColl
)
2687 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2688 nsIDOMNodeList
*node_list
= NULL
;
2689 nsAString selector_str
;
2692 static const WCHAR formatW
[] = L
"*[id=%s],*[name=%s]";
2694 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppelColl
);
2696 if(!This
->dom_document
) {
2697 /* We should probably return an empty collection. */
2698 FIXME("No dom_document\n");
2702 selector
= malloc(2 * SysStringLen(v
) * sizeof(WCHAR
) + sizeof(formatW
));
2704 return E_OUTOFMEMORY
;
2705 swprintf(selector
, 2*SysStringLen(v
) + ARRAY_SIZE(formatW
), formatW
, v
, v
);
2708 * NOTE: IE getElementsByName implementation differs from Gecko. It searches both name and id attributes.
2709 * That's why we use CSS selector instead. We should also use name only when it applies to given element
2710 * types and search should be case insensitive. Those are currently not supported properly.
2712 nsAString_InitDepend(&selector_str
, selector
);
2713 nsres
= nsIDOMDocument_QuerySelectorAll(This
->dom_document
, &selector_str
, &node_list
);
2714 nsAString_Finish(&selector_str
);
2716 if(NS_FAILED(nsres
)) {
2717 ERR("QuerySelectorAll failed: %08lx\n", nsres
);
2719 nsIDOMNodeList_Release(node_list
);
2723 *ppelColl
= create_collection_from_nodelist(node_list
, This
->document_mode
);
2724 nsIDOMNodeList_Release(node_list
);
2729 static HRESULT WINAPI
HTMLDocument3_getElementById(IHTMLDocument3
*iface
, BSTR v
, IHTMLElement
**pel
)
2731 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2735 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
2737 hres
= get_doc_elem_by_id(This
, v
, &elem
);
2738 if(FAILED(hres
) || !elem
) {
2743 *pel
= &elem
->IHTMLElement_iface
;
2748 static HRESULT WINAPI
HTMLDocument3_getElementsByTagName(IHTMLDocument3
*iface
, BSTR v
,
2749 IHTMLElementCollection
**pelColl
)
2751 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2752 nsIDOMNodeList
*nslist
;
2756 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
2758 if(This
->dom_document
) {
2759 nsAString_InitDepend(&id_str
, v
);
2760 nsres
= nsIDOMDocument_GetElementsByTagName(This
->dom_document
, &id_str
, &nslist
);
2761 nsAString_Finish(&id_str
);
2763 ERR("GetElementByName failed: %08lx\n", nsres
);
2767 nsIDOMDocumentFragment
*docfrag
;
2772 for(ptr
=v
; *ptr
; ptr
++) {
2773 if(!iswalnum(*ptr
)) {
2774 FIXME("Unsupported invalid tag %s\n", debugstr_w(v
));
2780 nsres
= nsIDOMNode_QueryInterface(This
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&docfrag
);
2781 if(NS_FAILED(nsres
)) {
2782 ERR("Could not get nsIDOMDocumentFragment iface: %08lx\n", nsres
);
2783 return E_UNEXPECTED
;
2787 nsAString_InitDepend(&nsstr
, v
);
2788 nsres
= nsIDOMDocumentFragment_QuerySelectorAll(docfrag
, &nsstr
, &nslist
);
2789 nsAString_Finish(&nsstr
);
2790 nsIDOMDocumentFragment_Release(docfrag
);
2791 if(NS_FAILED(nsres
)) {
2792 ERR("QuerySelectorAll failed: %08lx\n", nsres
);
2794 nsIDOMNodeList_Release(nslist
);
2800 *pelColl
= create_collection_from_nodelist(nslist
, This
->document_mode
);
2801 nsIDOMNodeList_Release(nslist
);
2806 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl
= {
2807 HTMLDocument3_QueryInterface
,
2808 HTMLDocument3_AddRef
,
2809 HTMLDocument3_Release
,
2810 HTMLDocument3_GetTypeInfoCount
,
2811 HTMLDocument3_GetTypeInfo
,
2812 HTMLDocument3_GetIDsOfNames
,
2813 HTMLDocument3_Invoke
,
2814 HTMLDocument3_releaseCapture
,
2815 HTMLDocument3_recalc
,
2816 HTMLDocument3_createTextNode
,
2817 HTMLDocument3_get_documentElement
,
2818 HTMLDocument3_get_uniqueID
,
2819 HTMLDocument3_attachEvent
,
2820 HTMLDocument3_detachEvent
,
2821 HTMLDocument3_put_onrowsdelete
,
2822 HTMLDocument3_get_onrowsdelete
,
2823 HTMLDocument3_put_onrowsinserted
,
2824 HTMLDocument3_get_onrowsinserted
,
2825 HTMLDocument3_put_oncellchange
,
2826 HTMLDocument3_get_oncellchange
,
2827 HTMLDocument3_put_ondatasetchanged
,
2828 HTMLDocument3_get_ondatasetchanged
,
2829 HTMLDocument3_put_ondataavailable
,
2830 HTMLDocument3_get_ondataavailable
,
2831 HTMLDocument3_put_ondatasetcomplete
,
2832 HTMLDocument3_get_ondatasetcomplete
,
2833 HTMLDocument3_put_onpropertychange
,
2834 HTMLDocument3_get_onpropertychange
,
2835 HTMLDocument3_put_dir
,
2836 HTMLDocument3_get_dir
,
2837 HTMLDocument3_put_oncontextmenu
,
2838 HTMLDocument3_get_oncontextmenu
,
2839 HTMLDocument3_put_onstop
,
2840 HTMLDocument3_get_onstop
,
2841 HTMLDocument3_createDocumentFragment
,
2842 HTMLDocument3_get_parentDocument
,
2843 HTMLDocument3_put_enableDownload
,
2844 HTMLDocument3_get_enableDownload
,
2845 HTMLDocument3_put_baseUrl
,
2846 HTMLDocument3_get_baseUrl
,
2847 HTMLDocument3_get_childNodes
,
2848 HTMLDocument3_put_inheritStyleSheets
,
2849 HTMLDocument3_get_inheritStyleSheets
,
2850 HTMLDocument3_put_onbeforeeditfocus
,
2851 HTMLDocument3_get_onbeforeeditfocus
,
2852 HTMLDocument3_getElementsByName
,
2853 HTMLDocument3_getElementById
,
2854 HTMLDocument3_getElementsByTagName
2857 static inline HTMLDocumentNode
*impl_from_IHTMLDocument4(IHTMLDocument4
*iface
)
2859 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument4_iface
);
2862 static HRESULT WINAPI
HTMLDocument4_QueryInterface(IHTMLDocument4
*iface
, REFIID riid
, void **ppv
)
2864 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2865 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
2868 static ULONG WINAPI
HTMLDocument4_AddRef(IHTMLDocument4
*iface
)
2870 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2871 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
2874 static ULONG WINAPI
HTMLDocument4_Release(IHTMLDocument4
*iface
)
2876 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2877 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
2880 static HRESULT WINAPI
HTMLDocument4_GetTypeInfoCount(IHTMLDocument4
*iface
, UINT
*pctinfo
)
2882 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2883 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2886 static HRESULT WINAPI
HTMLDocument4_GetTypeInfo(IHTMLDocument4
*iface
, UINT iTInfo
, LCID lcid
,
2887 ITypeInfo
**ppTInfo
)
2889 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2890 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2893 static HRESULT WINAPI
HTMLDocument4_GetIDsOfNames(IHTMLDocument4
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
2894 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2896 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2897 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2900 static HRESULT WINAPI
HTMLDocument4_Invoke(IHTMLDocument4
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
2901 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2903 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2904 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2905 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2908 static HRESULT WINAPI
HTMLDocument4_focus(IHTMLDocument4
*iface
)
2910 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2911 nsIDOMHTMLElement
*nsbody
;
2914 TRACE("(%p)->()\n", This
);
2916 if(!This
->html_document
) {
2917 FIXME("Not implemented for XML document\n");
2921 nsres
= nsIDOMHTMLDocument_GetBody(This
->html_document
, &nsbody
);
2922 if(NS_FAILED(nsres
) || !nsbody
) {
2923 ERR("GetBody failed: %08lx\n", nsres
);
2927 nsres
= nsIDOMHTMLElement_Focus(nsbody
);
2928 nsIDOMHTMLElement_Release(nsbody
);
2929 if(NS_FAILED(nsres
)) {
2930 ERR("Focus failed: %08lx\n", nsres
);
2937 static HRESULT WINAPI
HTMLDocument4_hasFocus(IHTMLDocument4
*iface
, VARIANT_BOOL
*pfFocus
)
2939 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2943 TRACE("(%p)->(%p)\n", This
, pfFocus
);
2945 if(!This
->dom_document
) {
2946 FIXME("Unimplemented for fragments.\n");
2950 nsres
= nsIDOMDocument_HasFocus(This
->dom_document
, &has_focus
);
2951 assert(nsres
== NS_OK
);
2953 *pfFocus
= variant_bool(has_focus
);
2957 static HRESULT WINAPI
HTMLDocument4_put_onselectionchange(IHTMLDocument4
*iface
, VARIANT v
)
2959 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2961 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2963 return set_doc_event(This
, EVENTID_SELECTIONCHANGE
, &v
);
2966 static HRESULT WINAPI
HTMLDocument4_get_onselectionchange(IHTMLDocument4
*iface
, VARIANT
*p
)
2968 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2970 TRACE("(%p)->(%p)\n", This
, p
);
2972 return get_doc_event(This
, EVENTID_SELECTIONCHANGE
, p
);
2975 static HRESULT WINAPI
HTMLDocument4_get_namespaces(IHTMLDocument4
*iface
, IDispatch
**p
)
2977 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2979 TRACE("(%p)->(%p)\n", This
, p
);
2981 if(!This
->namespaces
) {
2984 hres
= create_namespace_collection(dispex_compat_mode(&This
->node
.event_target
.dispex
),
2990 IHTMLNamespaceCollection_AddRef(This
->namespaces
);
2991 *p
= (IDispatch
*)This
->namespaces
;
2995 static HRESULT WINAPI
HTMLDocument4_createDocumentFromUrl(IHTMLDocument4
*iface
, BSTR bstrUrl
,
2996 BSTR bstrOptions
, IHTMLDocument2
**newDoc
)
2998 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2999 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrUrl
), debugstr_w(bstrOptions
), newDoc
);
3003 static HRESULT WINAPI
HTMLDocument4_put_media(IHTMLDocument4
*iface
, BSTR v
)
3005 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3006 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
3010 static HRESULT WINAPI
HTMLDocument4_get_media(IHTMLDocument4
*iface
, BSTR
*p
)
3012 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3013 FIXME("(%p)->(%p)\n", This
, p
);
3017 static HRESULT WINAPI
HTMLDocument4_createEventObject(IHTMLDocument4
*iface
,
3018 VARIANT
*pvarEventObject
, IHTMLEventObj
**ppEventObj
)
3020 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3022 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(pvarEventObject
), ppEventObj
);
3024 if(pvarEventObject
&& V_VT(pvarEventObject
) != VT_ERROR
&& V_VT(pvarEventObject
) != VT_EMPTY
) {
3025 FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject
));
3029 return create_event_obj(dispex_compat_mode(&This
->node
.event_target
.dispex
), ppEventObj
);
3032 static HRESULT WINAPI
HTMLDocument4_fireEvent(IHTMLDocument4
*iface
, BSTR bstrEventName
,
3033 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCanceled
)
3035 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3037 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrEventName
), pvarEventObject
, pfCanceled
);
3039 return fire_event(&This
->node
, bstrEventName
, pvarEventObject
, pfCanceled
);
3042 static HRESULT WINAPI
HTMLDocument4_createRenderStyle(IHTMLDocument4
*iface
, BSTR v
,
3043 IHTMLRenderStyle
**ppIHTMLRenderStyle
)
3045 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3046 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppIHTMLRenderStyle
);
3050 static HRESULT WINAPI
HTMLDocument4_put_oncontrolselect(IHTMLDocument4
*iface
, VARIANT v
)
3052 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3053 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3057 static HRESULT WINAPI
HTMLDocument4_get_oncontrolselect(IHTMLDocument4
*iface
, VARIANT
*p
)
3059 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3060 FIXME("(%p)->(%p)\n", This
, p
);
3064 static HRESULT WINAPI
HTMLDocument4_get_URLUnencoded(IHTMLDocument4
*iface
, BSTR
*p
)
3066 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3067 FIXME("(%p)->(%p)\n", This
, p
);
3071 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl
= {
3072 HTMLDocument4_QueryInterface
,
3073 HTMLDocument4_AddRef
,
3074 HTMLDocument4_Release
,
3075 HTMLDocument4_GetTypeInfoCount
,
3076 HTMLDocument4_GetTypeInfo
,
3077 HTMLDocument4_GetIDsOfNames
,
3078 HTMLDocument4_Invoke
,
3079 HTMLDocument4_focus
,
3080 HTMLDocument4_hasFocus
,
3081 HTMLDocument4_put_onselectionchange
,
3082 HTMLDocument4_get_onselectionchange
,
3083 HTMLDocument4_get_namespaces
,
3084 HTMLDocument4_createDocumentFromUrl
,
3085 HTMLDocument4_put_media
,
3086 HTMLDocument4_get_media
,
3087 HTMLDocument4_createEventObject
,
3088 HTMLDocument4_fireEvent
,
3089 HTMLDocument4_createRenderStyle
,
3090 HTMLDocument4_put_oncontrolselect
,
3091 HTMLDocument4_get_oncontrolselect
,
3092 HTMLDocument4_get_URLUnencoded
3095 static inline HTMLDocumentNode
*impl_from_IHTMLDocument5(IHTMLDocument5
*iface
)
3097 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument5_iface
);
3100 static HRESULT WINAPI
HTMLDocument5_QueryInterface(IHTMLDocument5
*iface
, REFIID riid
, void **ppv
)
3102 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3103 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
3106 static ULONG WINAPI
HTMLDocument5_AddRef(IHTMLDocument5
*iface
)
3108 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3109 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
3112 static ULONG WINAPI
HTMLDocument5_Release(IHTMLDocument5
*iface
)
3114 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3115 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
3118 static HRESULT WINAPI
HTMLDocument5_GetTypeInfoCount(IHTMLDocument5
*iface
, UINT
*pctinfo
)
3120 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3121 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3124 static HRESULT WINAPI
HTMLDocument5_GetTypeInfo(IHTMLDocument5
*iface
, UINT iTInfo
, LCID lcid
,
3125 ITypeInfo
**ppTInfo
)
3127 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3128 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3131 static HRESULT WINAPI
HTMLDocument5_GetIDsOfNames(IHTMLDocument5
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
3132 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3134 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3135 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3138 static HRESULT WINAPI
HTMLDocument5_Invoke(IHTMLDocument5
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
3139 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3141 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3142 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3143 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3146 static HRESULT WINAPI
HTMLDocument5_put_onmousewheel(IHTMLDocument5
*iface
, VARIANT v
)
3148 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3150 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3152 return set_doc_event(This
, EVENTID_MOUSEWHEEL
, &v
);
3155 static HRESULT WINAPI
HTMLDocument5_get_onmousewheel(IHTMLDocument5
*iface
, VARIANT
*p
)
3157 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3159 TRACE("(%p)->(%p)\n", This
, p
);
3161 return get_doc_event(This
, EVENTID_MOUSEWHEEL
, p
);
3164 static HRESULT WINAPI
HTMLDocument5_get_doctype(IHTMLDocument5
*iface
, IHTMLDOMNode
**p
)
3166 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3167 nsIDOMDocumentType
*nsdoctype
;
3168 HTMLDOMNode
*doctype_node
;
3172 TRACE("(%p)->(%p)\n", This
, p
);
3174 if(dispex_compat_mode(&This
->node
.event_target
.dispex
) < COMPAT_MODE_IE9
) {
3179 nsres
= nsIDOMDocument_GetDoctype(This
->dom_document
, &nsdoctype
);
3180 if(NS_FAILED(nsres
))
3181 return map_nsresult(nsres
);
3187 hres
= get_node((nsIDOMNode
*)nsdoctype
, TRUE
, &doctype_node
);
3188 nsIDOMDocumentType_Release(nsdoctype
);
3191 *p
= &doctype_node
->IHTMLDOMNode_iface
;
3195 static HRESULT WINAPI
HTMLDocument5_get_implementation(IHTMLDocument5
*iface
, IHTMLDOMImplementation
**p
)
3197 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3199 TRACE("(%p)->(%p)\n", This
, p
);
3201 if(!This
->dom_implementation
) {
3204 hres
= create_dom_implementation(This
, &This
->dom_implementation
);
3209 IHTMLDOMImplementation_AddRef(This
->dom_implementation
);
3210 *p
= This
->dom_implementation
;
3214 static HRESULT WINAPI
HTMLDocument5_createAttribute(IHTMLDocument5
*iface
, BSTR bstrattrName
,
3215 IHTMLDOMAttribute
**ppattribute
)
3217 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3218 HTMLDOMAttribute
*attr
;
3221 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrattrName
), ppattribute
);
3223 hres
= HTMLDOMAttribute_Create(bstrattrName
, NULL
, 0, dispex_compat_mode(&This
->node
.event_target
.dispex
), &attr
);
3227 *ppattribute
= &attr
->IHTMLDOMAttribute_iface
;
3231 static HRESULT WINAPI
HTMLDocument5_createComment(IHTMLDocument5
*iface
, BSTR bstrdata
,
3232 IHTMLDOMNode
**ppRetNode
)
3234 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3235 nsIDOMComment
*nscomment
;
3241 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrdata
), ppRetNode
);
3243 if(!This
->dom_document
) {
3244 WARN("NULL dom_document\n");
3245 return E_UNEXPECTED
;
3248 nsAString_InitDepend(&str
, bstrdata
);
3249 nsres
= nsIDOMDocument_CreateComment(This
->dom_document
, &str
, &nscomment
);
3250 nsAString_Finish(&str
);
3251 if(NS_FAILED(nsres
)) {
3252 ERR("CreateTextNode failed: %08lx\n", nsres
);
3256 hres
= HTMLCommentElement_Create(This
, (nsIDOMNode
*)nscomment
, &elem
);
3257 nsIDOMComment_Release(nscomment
);
3261 *ppRetNode
= &elem
->node
.IHTMLDOMNode_iface
;
3265 static HRESULT WINAPI
HTMLDocument5_put_onfocusin(IHTMLDocument5
*iface
, VARIANT v
)
3267 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3269 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3271 return set_doc_event(This
, EVENTID_FOCUSIN
, &v
);
3274 static HRESULT WINAPI
HTMLDocument5_get_onfocusin(IHTMLDocument5
*iface
, VARIANT
*p
)
3276 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3278 TRACE("(%p)->(%p)\n", This
, p
);
3280 return get_doc_event(This
, EVENTID_FOCUSIN
, p
);
3283 static HRESULT WINAPI
HTMLDocument5_put_onfocusout(IHTMLDocument5
*iface
, VARIANT v
)
3285 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3287 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3289 return set_doc_event(This
, EVENTID_FOCUSOUT
, &v
);
3292 static HRESULT WINAPI
HTMLDocument5_get_onfocusout(IHTMLDocument5
*iface
, VARIANT
*p
)
3294 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3296 TRACE("(%p)->(%p)\n", This
, p
);
3298 return get_doc_event(This
, EVENTID_FOCUSOUT
, p
);
3301 static HRESULT WINAPI
HTMLDocument5_put_onactivate(IHTMLDocument5
*iface
, VARIANT v
)
3303 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3304 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3308 static HRESULT WINAPI
HTMLDocument5_get_onactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3310 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3311 FIXME("(%p)->(%p)\n", This
, p
);
3315 static HRESULT WINAPI
HTMLDocument5_put_ondeactivate(IHTMLDocument5
*iface
, VARIANT v
)
3317 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3318 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3322 static HRESULT WINAPI
HTMLDocument5_get_ondeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3324 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3325 FIXME("(%p)->(%p)\n", This
, p
);
3329 static HRESULT WINAPI
HTMLDocument5_put_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT v
)
3331 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3332 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3336 static HRESULT WINAPI
HTMLDocument5_get_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3338 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3339 FIXME("(%p)->(%p)\n", This
, p
);
3343 static HRESULT WINAPI
HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT v
)
3345 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3346 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3350 static HRESULT WINAPI
HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3352 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3353 FIXME("(%p)->(%p)\n", This
, p
);
3357 static HRESULT WINAPI
HTMLDocument5_get_compatMode(IHTMLDocument5
*iface
, BSTR
*p
)
3359 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3361 TRACE("(%p)->(%p)\n", This
, p
);
3363 *p
= SysAllocString(This
->document_mode
<= COMPAT_MODE_IE5
? L
"BackCompat" : L
"CSS1Compat");
3364 return *p
? S_OK
: E_OUTOFMEMORY
;
3367 static const IHTMLDocument5Vtbl HTMLDocument5Vtbl
= {
3368 HTMLDocument5_QueryInterface
,
3369 HTMLDocument5_AddRef
,
3370 HTMLDocument5_Release
,
3371 HTMLDocument5_GetTypeInfoCount
,
3372 HTMLDocument5_GetTypeInfo
,
3373 HTMLDocument5_GetIDsOfNames
,
3374 HTMLDocument5_Invoke
,
3375 HTMLDocument5_put_onmousewheel
,
3376 HTMLDocument5_get_onmousewheel
,
3377 HTMLDocument5_get_doctype
,
3378 HTMLDocument5_get_implementation
,
3379 HTMLDocument5_createAttribute
,
3380 HTMLDocument5_createComment
,
3381 HTMLDocument5_put_onfocusin
,
3382 HTMLDocument5_get_onfocusin
,
3383 HTMLDocument5_put_onfocusout
,
3384 HTMLDocument5_get_onfocusout
,
3385 HTMLDocument5_put_onactivate
,
3386 HTMLDocument5_get_onactivate
,
3387 HTMLDocument5_put_ondeactivate
,
3388 HTMLDocument5_get_ondeactivate
,
3389 HTMLDocument5_put_onbeforeactivate
,
3390 HTMLDocument5_get_onbeforeactivate
,
3391 HTMLDocument5_put_onbeforedeactivate
,
3392 HTMLDocument5_get_onbeforedeactivate
,
3393 HTMLDocument5_get_compatMode
3396 static inline HTMLDocumentNode
*impl_from_IHTMLDocument6(IHTMLDocument6
*iface
)
3398 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument6_iface
);
3401 static HRESULT WINAPI
HTMLDocument6_QueryInterface(IHTMLDocument6
*iface
, REFIID riid
, void **ppv
)
3403 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3404 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
3407 static ULONG WINAPI
HTMLDocument6_AddRef(IHTMLDocument6
*iface
)
3409 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3410 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
3413 static ULONG WINAPI
HTMLDocument6_Release(IHTMLDocument6
*iface
)
3415 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3416 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
3419 static HRESULT WINAPI
HTMLDocument6_GetTypeInfoCount(IHTMLDocument6
*iface
, UINT
*pctinfo
)
3421 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3422 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3425 static HRESULT WINAPI
HTMLDocument6_GetTypeInfo(IHTMLDocument6
*iface
, UINT iTInfo
, LCID lcid
,
3426 ITypeInfo
**ppTInfo
)
3428 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3429 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3432 static HRESULT WINAPI
HTMLDocument6_GetIDsOfNames(IHTMLDocument6
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
3433 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3435 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3436 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3439 static HRESULT WINAPI
HTMLDocument6_Invoke(IHTMLDocument6
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
3440 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3442 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3443 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3444 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3447 static HRESULT WINAPI
HTMLDocument6_get_compatible(IHTMLDocument6
*iface
,
3448 IHTMLDocumentCompatibleInfoCollection
**p
)
3450 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3451 FIXME("(%p)->(%p)\n", This
, p
);
3455 static HRESULT WINAPI
HTMLDocument6_get_documentMode(IHTMLDocument6
*iface
, VARIANT
*p
)
3457 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3459 TRACE("(%p)->(%p)\n", This
, p
);
3462 V_R4(p
) = compat_mode_info
[This
->document_mode
].document_mode
;
3466 static HRESULT WINAPI
HTMLDocument6_get_onstorage(IHTMLDocument6
*iface
,
3469 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3471 TRACE("(%p)->(%p)\n", This
, p
);
3473 return get_doc_event(This
, EVENTID_STORAGE
, p
);
3476 static HRESULT WINAPI
HTMLDocument6_put_onstorage(IHTMLDocument6
*iface
, VARIANT v
)
3478 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3480 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3482 return set_doc_event(This
, EVENTID_STORAGE
, &v
);
3485 static HRESULT WINAPI
HTMLDocument6_get_onstoragecommit(IHTMLDocument6
*iface
,
3488 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3490 TRACE("(%p)->(%p)\n", This
, p
);
3492 return get_doc_event(This
, EVENTID_STORAGECOMMIT
, p
);
3495 static HRESULT WINAPI
HTMLDocument6_put_onstoragecommit(IHTMLDocument6
*iface
, VARIANT v
)
3497 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3499 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3501 return set_doc_event(This
, EVENTID_STORAGECOMMIT
, &v
);
3504 static HRESULT WINAPI
HTMLDocument6_getElementById(IHTMLDocument6
*iface
,
3505 BSTR bstrId
, IHTMLElement2
**p
)
3507 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3508 nsIDOMElement
*nselem
;
3514 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrId
), p
);
3517 * Unlike IHTMLDocument3 implementation, this is standard compliant and does
3518 * not search for name attributes, so we may simply let Gecko do the right thing.
3521 if(!This
->dom_document
) {
3522 FIXME("Not a document\n");
3526 nsAString_InitDepend(&nsstr
, bstrId
);
3527 nsres
= nsIDOMDocument_GetElementById(This
->dom_document
, &nsstr
, &nselem
);
3528 nsAString_Finish(&nsstr
);
3529 if(NS_FAILED(nsres
)) {
3530 ERR("GetElementById failed: %08lx\n", nsres
);
3539 hres
= get_element(nselem
, &elem
);
3540 nsIDOMElement_Release(nselem
);
3544 *p
= &elem
->IHTMLElement2_iface
;
3548 static HRESULT WINAPI
HTMLDocument6_updateSettings(IHTMLDocument6
*iface
)
3550 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3551 FIXME("(%p)->()\n", This
);
3555 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl
= {
3556 HTMLDocument6_QueryInterface
,
3557 HTMLDocument6_AddRef
,
3558 HTMLDocument6_Release
,
3559 HTMLDocument6_GetTypeInfoCount
,
3560 HTMLDocument6_GetTypeInfo
,
3561 HTMLDocument6_GetIDsOfNames
,
3562 HTMLDocument6_Invoke
,
3563 HTMLDocument6_get_compatible
,
3564 HTMLDocument6_get_documentMode
,
3565 HTMLDocument6_put_onstorage
,
3566 HTMLDocument6_get_onstorage
,
3567 HTMLDocument6_put_onstoragecommit
,
3568 HTMLDocument6_get_onstoragecommit
,
3569 HTMLDocument6_getElementById
,
3570 HTMLDocument6_updateSettings
3573 static inline HTMLDocumentNode
*impl_from_IHTMLDocument7(IHTMLDocument7
*iface
)
3575 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument7_iface
);
3578 static HRESULT WINAPI
HTMLDocument7_QueryInterface(IHTMLDocument7
*iface
, REFIID riid
, void **ppv
)
3580 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3581 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
3584 static ULONG WINAPI
HTMLDocument7_AddRef(IHTMLDocument7
*iface
)
3586 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3587 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
3590 static ULONG WINAPI
HTMLDocument7_Release(IHTMLDocument7
*iface
)
3592 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3593 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
3596 static HRESULT WINAPI
HTMLDocument7_GetTypeInfoCount(IHTMLDocument7
*iface
, UINT
*pctinfo
)
3598 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3599 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3602 static HRESULT WINAPI
HTMLDocument7_GetTypeInfo(IHTMLDocument7
*iface
, UINT iTInfo
, LCID lcid
,
3603 ITypeInfo
**ppTInfo
)
3605 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3606 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3609 static HRESULT WINAPI
HTMLDocument7_GetIDsOfNames(IHTMLDocument7
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
3610 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3612 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3613 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3616 static HRESULT WINAPI
HTMLDocument7_Invoke(IHTMLDocument7
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
3617 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3619 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3620 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3621 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3624 static HRESULT WINAPI
HTMLDocument7_get_defaultView(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
3626 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3628 TRACE("(%p)->(%p)\n", This
, p
);
3630 if(This
->window
&& This
->window
->base
.outer_window
) {
3631 *p
= &This
->window
->base
.outer_window
->base
.IHTMLWindow2_iface
;
3632 IHTMLWindow2_AddRef(*p
);
3639 static HRESULT WINAPI
HTMLDocument7_createCDATASection(IHTMLDocument7
*iface
, BSTR text
, IHTMLDOMNode
**newCDATASectionNode
)
3641 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3642 FIXME("(%p)->(%p)\n", This
, newCDATASectionNode
);
3646 static HRESULT WINAPI
HTMLDocument7_getSelection(IHTMLDocument7
*iface
, IHTMLSelection
**ppIHTMLSelection
)
3648 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3649 FIXME("(%p)->(%p)\n", This
, ppIHTMLSelection
);
3653 static HRESULT WINAPI
HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3654 BSTR bstrLocalName
, IHTMLElementCollection
**pelColl
)
3656 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3657 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrLocalName
), pelColl
);
3661 static HRESULT WINAPI
HTMLDocument7_createElementNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
, BSTR bstrTag
, IHTMLElement
**newElem
)
3663 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3664 nsIDOMElement
*dom_element
;
3665 HTMLElement
*element
;
3670 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrTag
), newElem
);
3672 if(!This
->dom_document
) {
3673 FIXME("NULL dom_document\n");
3677 if(pvarNS
&& V_VT(pvarNS
) != VT_NULL
&& V_VT(pvarNS
) != VT_BSTR
)
3678 FIXME("Unsupported namespace %s\n", debugstr_variant(pvarNS
));
3680 nsAString_InitDepend(&ns
, pvarNS
&& V_VT(pvarNS
) == VT_BSTR
? V_BSTR(pvarNS
) : NULL
);
3681 nsAString_InitDepend(&tag
, bstrTag
);
3682 nsres
= nsIDOMDocument_CreateElementNS(This
->dom_document
, &ns
, &tag
, &dom_element
);
3683 nsAString_Finish(&ns
);
3684 nsAString_Finish(&tag
);
3685 if(NS_FAILED(nsres
)) {
3686 WARN("CreateElementNS failed: %08lx\n", nsres
);
3687 return map_nsresult(nsres
);
3690 hres
= HTMLElement_Create(This
, (nsIDOMNode
*)dom_element
, FALSE
, &element
);
3691 nsIDOMElement_Release(dom_element
);
3695 *newElem
= &element
->IHTMLElement_iface
;
3699 static HRESULT WINAPI
HTMLDocument7_createAttributeNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3700 BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3702 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3703 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrAttrName
), ppAttribute
);
3707 static HRESULT WINAPI
HTMLDocument7_put_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT v
)
3709 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3710 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3714 static HRESULT WINAPI
HTMLDocument7_get_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT
*p
)
3716 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3718 TRACE("(%p)->(%p)\n", This
, p
);
3720 return get_doc_event(This
, EVENTID_MSTHUMBNAILCLICK
, p
);
3723 static HRESULT WINAPI
HTMLDocument7_get_characterSet(IHTMLDocument7
*iface
, BSTR
*p
)
3725 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3726 nsAString charset_str
;
3729 TRACE("(%p)->(%p)\n", This
, p
);
3731 if(!This
->dom_document
) {
3732 FIXME("NULL dom_document\n");
3736 nsAString_Init(&charset_str
, NULL
);
3737 nsres
= nsIDOMDocument_GetCharacterSet(This
->dom_document
, &charset_str
);
3738 return return_nsstr(nsres
, &charset_str
, p
);
3741 static HRESULT WINAPI
HTMLDocument7_createElement(IHTMLDocument7
*iface
, BSTR bstrTag
, IHTMLElement
**newElem
)
3743 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3745 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrTag
), newElem
);
3747 return IHTMLDocument2_createElement(&This
->IHTMLDocument2_iface
, bstrTag
, newElem
);
3750 static HRESULT WINAPI
HTMLDocument7_createAttribute(IHTMLDocument7
*iface
, BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3752 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3754 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrAttrName
), ppAttribute
);
3756 return IHTMLDocument5_createAttribute(&This
->IHTMLDocument5_iface
, bstrAttrName
, ppAttribute
);
3759 static HRESULT WINAPI
HTMLDocument7_getElementsByClassName(IHTMLDocument7
*iface
, BSTR v
, IHTMLElementCollection
**pel
)
3761 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3762 nsIDOMNodeList
*nslist
;
3766 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
3768 if(!This
->dom_document
) {
3769 FIXME("NULL dom_document not supported\n");
3773 nsAString_InitDepend(&nsstr
, v
);
3774 nsres
= nsIDOMDocument_GetElementsByClassName(This
->dom_document
, &nsstr
, &nslist
);
3775 nsAString_Finish(&nsstr
);
3777 ERR("GetElementByClassName failed: %08lx\n", nsres
);
3782 *pel
= create_collection_from_nodelist(nslist
, This
->document_mode
);
3783 nsIDOMNodeList_Release(nslist
);
3787 static HRESULT WINAPI
HTMLDocument7_createProcessingInstruction(IHTMLDocument7
*iface
, BSTR target
,
3788 BSTR data
, IDOMProcessingInstruction
**newProcessingInstruction
)
3790 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3791 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(target
), debugstr_w(data
), newProcessingInstruction
);
3795 static HRESULT WINAPI
HTMLDocument7_adoptNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
, IHTMLDOMNode3
**ppNodeDest
)
3797 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3798 FIXME("(%p)->(%p %p)\n", This
, pNodeSource
, ppNodeDest
);
3802 static HRESULT WINAPI
HTMLDocument7_put_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT v
)
3804 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3805 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3809 static HRESULT WINAPI
HTMLDocument7_get_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT
*p
)
3811 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3812 FIXME("(%p)->(%p)\n", This
, p
);
3816 static HRESULT WINAPI
HTMLDocument7_get_all(IHTMLDocument7
*iface
, IHTMLElementCollection
**p
)
3818 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3820 TRACE("(%p)->(%p)\n", This
, p
);
3822 return IHTMLDocument2_get_all(&This
->IHTMLDocument2_iface
, p
);
3825 static HRESULT WINAPI
HTMLDocument7_get_inputEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3827 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3828 FIXME("(%p)->(%p)\n", This
, p
);
3832 static HRESULT WINAPI
HTMLDocument7_get_xmlEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3834 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3835 FIXME("(%p)->(%p)\n", This
, p
);
3839 static HRESULT WINAPI
HTMLDocument7_put_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL v
)
3841 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3842 FIXME("(%p)->(%x)\n", This
, v
);
3846 static HRESULT WINAPI
HTMLDocument7_get_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL
*p
)
3848 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3849 FIXME("(%p)->(%p)\n", This
, p
);
3853 static HRESULT WINAPI
HTMLDocument7_put_xmlVersion(IHTMLDocument7
*iface
, BSTR v
)
3855 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3856 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
3860 static HRESULT WINAPI
HTMLDocument7_get_xmlVersion(IHTMLDocument7
*iface
, BSTR
*p
)
3862 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3863 FIXME("(%p)->(%p)\n", This
, p
);
3867 static HRESULT WINAPI
HTMLDocument7_hasAttributes(IHTMLDocument7
*iface
, VARIANT_BOOL
*pfHasAttributes
)
3869 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3870 FIXME("(%p)->(%p)\n", This
, pfHasAttributes
);
3874 static HRESULT WINAPI
HTMLDocument7_put_onabort(IHTMLDocument7
*iface
, VARIANT v
)
3876 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3878 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3880 return set_doc_event(This
, EVENTID_ABORT
, &v
);
3883 static HRESULT WINAPI
HTMLDocument7_get_onabort(IHTMLDocument7
*iface
, VARIANT
*p
)
3885 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3887 TRACE("(%p)->(%p)\n", This
, p
);
3889 return get_doc_event(This
, EVENTID_ABORT
, p
);
3892 static HRESULT WINAPI
HTMLDocument7_put_onblur(IHTMLDocument7
*iface
, VARIANT v
)
3894 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3896 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3898 return set_doc_event(This
, EVENTID_BLUR
, &v
);
3901 static HRESULT WINAPI
HTMLDocument7_get_onblur(IHTMLDocument7
*iface
, VARIANT
*p
)
3903 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3905 TRACE("(%p)->(%p)\n", This
, p
);
3907 return get_doc_event(This
, EVENTID_BLUR
, p
);
3910 static HRESULT WINAPI
HTMLDocument7_put_oncanplay(IHTMLDocument7
*iface
, VARIANT v
)
3912 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3913 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3917 static HRESULT WINAPI
HTMLDocument7_get_oncanplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3919 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3920 FIXME("(%p)->(%p)\n", This
, p
);
3924 static HRESULT WINAPI
HTMLDocument7_put_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT v
)
3926 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3927 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3931 static HRESULT WINAPI
HTMLDocument7_get_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT
*p
)
3933 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3934 FIXME("(%p)->(%p)\n", This
, p
);
3938 static HRESULT WINAPI
HTMLDocument7_put_onchange(IHTMLDocument7
*iface
, VARIANT v
)
3940 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3942 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3944 return set_doc_event(This
, EVENTID_CHANGE
, &v
);
3947 static HRESULT WINAPI
HTMLDocument7_get_onchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3949 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3951 TRACE("(%p)->(%p)\n", This
, p
);
3953 return get_doc_event(This
, EVENTID_CHANGE
, p
);
3956 static HRESULT WINAPI
HTMLDocument7_put_ondrag(IHTMLDocument7
*iface
, VARIANT v
)
3958 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3960 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3962 return set_doc_event(This
, EVENTID_DRAG
, &v
);
3965 static HRESULT WINAPI
HTMLDocument7_get_ondrag(IHTMLDocument7
*iface
, VARIANT
*p
)
3967 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3969 TRACE("(%p)->(%p)\n", This
, p
);
3971 return get_doc_event(This
, EVENTID_DRAG
, p
);
3974 static HRESULT WINAPI
HTMLDocument7_put_ondragend(IHTMLDocument7
*iface
, VARIANT v
)
3976 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3977 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3981 static HRESULT WINAPI
HTMLDocument7_get_ondragend(IHTMLDocument7
*iface
, VARIANT
*p
)
3983 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3984 FIXME("(%p)->(%p)\n", This
, p
);
3988 static HRESULT WINAPI
HTMLDocument7_put_ondragenter(IHTMLDocument7
*iface
, VARIANT v
)
3990 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3991 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3995 static HRESULT WINAPI
HTMLDocument7_get_ondragenter(IHTMLDocument7
*iface
, VARIANT
*p
)
3997 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3998 FIXME("(%p)->(%p)\n", This
, p
);
4002 static HRESULT WINAPI
HTMLDocument7_put_ondragleave(IHTMLDocument7
*iface
, VARIANT v
)
4004 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4005 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4009 static HRESULT WINAPI
HTMLDocument7_get_ondragleave(IHTMLDocument7
*iface
, VARIANT
*p
)
4011 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4012 FIXME("(%p)->(%p)\n", This
, p
);
4016 static HRESULT WINAPI
HTMLDocument7_put_ondragover(IHTMLDocument7
*iface
, VARIANT v
)
4018 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4019 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4023 static HRESULT WINAPI
HTMLDocument7_get_ondragover(IHTMLDocument7
*iface
, VARIANT
*p
)
4025 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4026 FIXME("(%p)->(%p)\n", This
, p
);
4030 static HRESULT WINAPI
HTMLDocument7_put_ondrop(IHTMLDocument7
*iface
, VARIANT v
)
4032 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4033 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4037 static HRESULT WINAPI
HTMLDocument7_get_ondrop(IHTMLDocument7
*iface
, VARIANT
*p
)
4039 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4040 FIXME("(%p)->(%p)\n", This
, p
);
4044 static HRESULT WINAPI
HTMLDocument7_put_ondurationchange(IHTMLDocument7
*iface
, VARIANT v
)
4046 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4047 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4051 static HRESULT WINAPI
HTMLDocument7_get_ondurationchange(IHTMLDocument7
*iface
, VARIANT
*p
)
4053 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4054 FIXME("(%p)->(%p)\n", This
, p
);
4058 static HRESULT WINAPI
HTMLDocument7_put_onemptied(IHTMLDocument7
*iface
, VARIANT v
)
4060 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4061 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4065 static HRESULT WINAPI
HTMLDocument7_get_onemptied(IHTMLDocument7
*iface
, VARIANT
*p
)
4067 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4068 FIXME("(%p)->(%p)\n", This
, p
);
4072 static HRESULT WINAPI
HTMLDocument7_put_onended(IHTMLDocument7
*iface
, VARIANT v
)
4074 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4075 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4079 static HRESULT WINAPI
HTMLDocument7_get_onended(IHTMLDocument7
*iface
, VARIANT
*p
)
4081 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4082 FIXME("(%p)->(%p)\n", This
, p
);
4086 static HRESULT WINAPI
HTMLDocument7_put_onerror(IHTMLDocument7
*iface
, VARIANT v
)
4088 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4090 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4092 return set_doc_event(This
, EVENTID_ERROR
, &v
);
4095 static HRESULT WINAPI
HTMLDocument7_get_onerror(IHTMLDocument7
*iface
, VARIANT
*p
)
4097 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4099 TRACE("(%p)->(%p)\n", This
, p
);
4101 return get_doc_event(This
, EVENTID_ERROR
, p
);
4104 static HRESULT WINAPI
HTMLDocument7_put_onfocus(IHTMLDocument7
*iface
, VARIANT v
)
4106 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4108 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4110 return set_doc_event(This
, EVENTID_FOCUS
, &v
);
4113 static HRESULT WINAPI
HTMLDocument7_get_onfocus(IHTMLDocument7
*iface
, VARIANT
*p
)
4115 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4117 TRACE("(%p)->(%p)\n", This
, p
);
4119 return get_doc_event(This
, EVENTID_FOCUS
, p
);
4122 static HRESULT WINAPI
HTMLDocument7_put_oninput(IHTMLDocument7
*iface
, VARIANT v
)
4124 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4126 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4128 return set_doc_event(This
, EVENTID_INPUT
, &v
);
4131 static HRESULT WINAPI
HTMLDocument7_get_oninput(IHTMLDocument7
*iface
, VARIANT
*p
)
4133 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4135 TRACE("(%p)->(%p)\n", This
, p
);
4137 return get_doc_event(This
, EVENTID_INPUT
, p
);
4140 static HRESULT WINAPI
HTMLDocument7_put_onload(IHTMLDocument7
*iface
, VARIANT v
)
4142 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4144 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4146 return set_doc_event(This
, EVENTID_LOAD
, &v
);
4149 static HRESULT WINAPI
HTMLDocument7_get_onload(IHTMLDocument7
*iface
, VARIANT
*p
)
4151 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4153 TRACE("(%p)->(%p)\n", This
, p
);
4155 return get_doc_event(This
, EVENTID_LOAD
, p
);
4158 static HRESULT WINAPI
HTMLDocument7_put_onloadeddata(IHTMLDocument7
*iface
, VARIANT v
)
4160 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4161 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4165 static HRESULT WINAPI
HTMLDocument7_get_onloadeddata(IHTMLDocument7
*iface
, VARIANT
*p
)
4167 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4168 FIXME("(%p)->(%p)\n", This
, p
);
4172 static HRESULT WINAPI
HTMLDocument7_put_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT v
)
4174 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4175 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4179 static HRESULT WINAPI
HTMLDocument7_get_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT
*p
)
4181 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4182 FIXME("(%p)->(%p)\n", This
, p
);
4186 static HRESULT WINAPI
HTMLDocument7_put_onloadstart(IHTMLDocument7
*iface
, VARIANT v
)
4188 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4189 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4193 static HRESULT WINAPI
HTMLDocument7_get_onloadstart(IHTMLDocument7
*iface
, VARIANT
*p
)
4195 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4196 FIXME("(%p)->(%p)\n", This
, p
);
4200 static HRESULT WINAPI
HTMLDocument7_put_onpause(IHTMLDocument7
*iface
, VARIANT v
)
4202 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4203 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4207 static HRESULT WINAPI
HTMLDocument7_get_onpause(IHTMLDocument7
*iface
, VARIANT
*p
)
4209 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4210 FIXME("(%p)->(%p)\n", This
, p
);
4214 static HRESULT WINAPI
HTMLDocument7_put_onplay(IHTMLDocument7
*iface
, VARIANT v
)
4216 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4217 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4221 static HRESULT WINAPI
HTMLDocument7_get_onplay(IHTMLDocument7
*iface
, VARIANT
*p
)
4223 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4224 FIXME("(%p)->(%p)\n", This
, p
);
4228 static HRESULT WINAPI
HTMLDocument7_put_onplaying(IHTMLDocument7
*iface
, VARIANT v
)
4230 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4231 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4235 static HRESULT WINAPI
HTMLDocument7_get_onplaying(IHTMLDocument7
*iface
, VARIANT
*p
)
4237 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4238 FIXME("(%p)->(%p)\n", This
, p
);
4242 static HRESULT WINAPI
HTMLDocument7_put_onprogress(IHTMLDocument7
*iface
, VARIANT v
)
4244 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4245 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4249 static HRESULT WINAPI
HTMLDocument7_get_onprogress(IHTMLDocument7
*iface
, VARIANT
*p
)
4251 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4252 FIXME("(%p)->(%p)\n", This
, p
);
4256 static HRESULT WINAPI
HTMLDocument7_put_onratechange(IHTMLDocument7
*iface
, VARIANT v
)
4258 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4259 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4263 static HRESULT WINAPI
HTMLDocument7_get_onratechange(IHTMLDocument7
*iface
, VARIANT
*p
)
4265 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4266 FIXME("(%p)->(%p)\n", This
, p
);
4270 static HRESULT WINAPI
HTMLDocument7_put_onreset(IHTMLDocument7
*iface
, VARIANT v
)
4272 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4273 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4277 static HRESULT WINAPI
HTMLDocument7_get_onreset(IHTMLDocument7
*iface
, VARIANT
*p
)
4279 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4280 FIXME("(%p)->(%p)\n", This
, p
);
4284 static HRESULT WINAPI
HTMLDocument7_put_onscroll(IHTMLDocument7
*iface
, VARIANT v
)
4286 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4288 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4290 return set_doc_event(This
, EVENTID_SCROLL
, &v
);
4293 static HRESULT WINAPI
HTMLDocument7_get_onscroll(IHTMLDocument7
*iface
, VARIANT
*p
)
4295 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4297 TRACE("(%p)->(%p)\n", This
, p
);
4299 return get_doc_event(This
, EVENTID_SCROLL
, p
);
4302 static HRESULT WINAPI
HTMLDocument7_put_onseekend(IHTMLDocument7
*iface
, VARIANT v
)
4304 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4305 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4309 static HRESULT WINAPI
HTMLDocument7_get_onseekend(IHTMLDocument7
*iface
, VARIANT
*p
)
4311 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4312 FIXME("(%p)->(%p)\n", This
, p
);
4316 static HRESULT WINAPI
HTMLDocument7_put_onseeking(IHTMLDocument7
*iface
, VARIANT v
)
4318 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4319 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4323 static HRESULT WINAPI
HTMLDocument7_get_onseeking(IHTMLDocument7
*iface
, VARIANT
*p
)
4325 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4326 FIXME("(%p)->(%p)\n", This
, p
);
4330 static HRESULT WINAPI
HTMLDocument7_put_onselect(IHTMLDocument7
*iface
, VARIANT v
)
4332 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4333 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4337 static HRESULT WINAPI
HTMLDocument7_get_onselect(IHTMLDocument7
*iface
, VARIANT
*p
)
4339 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4340 FIXME("(%p)->(%p)\n", This
, p
);
4344 static HRESULT WINAPI
HTMLDocument7_put_onstalled(IHTMLDocument7
*iface
, VARIANT v
)
4346 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4347 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4351 static HRESULT WINAPI
HTMLDocument7_get_onstalled(IHTMLDocument7
*iface
, VARIANT
*p
)
4353 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4354 FIXME("(%p)->(%p)\n", This
, p
);
4358 static HRESULT WINAPI
HTMLDocument7_put_onsubmit(IHTMLDocument7
*iface
, VARIANT v
)
4360 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4362 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4364 return set_doc_event(This
, EVENTID_SUBMIT
, &v
);
4367 static HRESULT WINAPI
HTMLDocument7_get_onsubmit(IHTMLDocument7
*iface
, VARIANT
*p
)
4369 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4371 TRACE("(%p)->(%p)\n", This
, p
);
4373 return get_doc_event(This
, EVENTID_SUBMIT
, p
);
4376 static HRESULT WINAPI
HTMLDocument7_put_onsuspend(IHTMLDocument7
*iface
, VARIANT v
)
4378 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4379 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4383 static HRESULT WINAPI
HTMLDocument7_get_onsuspend(IHTMLDocument7
*iface
, VARIANT
*p
)
4385 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4386 FIXME("(%p)->(%p)\n", This
, p
);
4390 static HRESULT WINAPI
HTMLDocument7_put_ontimeupdate(IHTMLDocument7
*iface
, VARIANT v
)
4392 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4393 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4397 static HRESULT WINAPI
HTMLDocument7_get_ontimeupdate(IHTMLDocument7
*iface
, VARIANT
*p
)
4399 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4400 FIXME("(%p)->(%p)\n", This
, p
);
4404 static HRESULT WINAPI
HTMLDocument7_put_onvolumechange(IHTMLDocument7
*iface
, VARIANT v
)
4406 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4407 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4411 static HRESULT WINAPI
HTMLDocument7_get_onvolumechange(IHTMLDocument7
*iface
, VARIANT
*p
)
4413 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4414 FIXME("(%p)->(%p)\n", This
, p
);
4418 static HRESULT WINAPI
HTMLDocument7_put_onwaiting(IHTMLDocument7
*iface
, VARIANT v
)
4420 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4421 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4425 static HRESULT WINAPI
HTMLDocument7_get_onwaiting(IHTMLDocument7
*iface
, VARIANT
*p
)
4427 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4428 FIXME("(%p)->(%p)\n", This
, p
);
4432 static HRESULT WINAPI
HTMLDocument7_normalize(IHTMLDocument7
*iface
)
4434 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4435 FIXME("(%p)\n", This
);
4439 static HRESULT WINAPI
HTMLDocument7_importNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
,
4440 VARIANT_BOOL fDeep
, IHTMLDOMNode3
**ppNodeDest
)
4442 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4443 nsIDOMNode
*nsnode
= NULL
;
4448 TRACE("(%p)->(%p %x %p)\n", This
, pNodeSource
, fDeep
, ppNodeDest
);
4450 if(!This
->dom_document
) {
4451 WARN("NULL dom_document\n");
4452 return E_UNEXPECTED
;
4455 if(!(node
= unsafe_impl_from_IHTMLDOMNode(pNodeSource
))) {
4456 ERR("not our node\n");
4460 nsres
= nsIDOMDocument_ImportNode(This
->dom_document
, node
->nsnode
, !!fDeep
, 1, &nsnode
);
4461 if(NS_FAILED(nsres
)) {
4462 ERR("ImportNode failed: %08lx\n", nsres
);
4463 return map_nsresult(nsres
);
4471 hres
= get_node(nsnode
, TRUE
, &node
);
4472 nsIDOMNode_Release(nsnode
);
4476 *ppNodeDest
= &node
->IHTMLDOMNode3_iface
;
4480 static HRESULT WINAPI
HTMLDocument7_get_parentWindow(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
4482 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4484 TRACE("(%p)->(%p)\n", This
, p
);
4486 return IHTMLDocument7_get_defaultView(&This
->IHTMLDocument7_iface
, p
);
4489 static HRESULT WINAPI
HTMLDocument7_put_body(IHTMLDocument7
*iface
, IHTMLElement
*v
)
4491 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4492 FIXME("(%p)->(%p)\n", This
, v
);
4496 static HRESULT WINAPI
HTMLDocument7_get_body(IHTMLDocument7
*iface
, IHTMLElement
**p
)
4498 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4500 TRACE("(%p)->(%p)\n", This
, p
);
4502 return IHTMLDocument2_get_body(&This
->IHTMLDocument2_iface
, p
);
4505 static HRESULT WINAPI
HTMLDocument7_get_head(IHTMLDocument7
*iface
, IHTMLElement
**p
)
4507 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4508 nsIDOMHTMLHeadElement
*nshead
;
4509 nsIDOMElement
*nselem
;
4514 TRACE("(%p)->(%p)\n", This
, p
);
4516 if(!This
->dom_document
) {
4517 FIXME("No document\n");
4521 if(!This
->html_document
) {
4522 FIXME("Not implemented for XML document\n");
4526 nsres
= nsIDOMHTMLDocument_GetHead(This
->html_document
, &nshead
);
4527 assert(nsres
== NS_OK
);
4534 nsres
= nsIDOMHTMLHeadElement_QueryInterface(nshead
, &IID_nsIDOMElement
, (void**)&nselem
);
4535 nsIDOMHTMLHeadElement_Release(nshead
);
4536 assert(nsres
== NS_OK
);
4538 hres
= get_element(nselem
, &elem
);
4539 nsIDOMElement_Release(nselem
);
4543 *p
= &elem
->IHTMLElement_iface
;
4547 static const IHTMLDocument7Vtbl HTMLDocument7Vtbl
= {
4548 HTMLDocument7_QueryInterface
,
4549 HTMLDocument7_AddRef
,
4550 HTMLDocument7_Release
,
4551 HTMLDocument7_GetTypeInfoCount
,
4552 HTMLDocument7_GetTypeInfo
,
4553 HTMLDocument7_GetIDsOfNames
,
4554 HTMLDocument7_Invoke
,
4555 HTMLDocument7_get_defaultView
,
4556 HTMLDocument7_createCDATASection
,
4557 HTMLDocument7_getSelection
,
4558 HTMLDocument7_getElementsByTagNameNS
,
4559 HTMLDocument7_createElementNS
,
4560 HTMLDocument7_createAttributeNS
,
4561 HTMLDocument7_put_onmsthumbnailclick
,
4562 HTMLDocument7_get_onmsthumbnailclick
,
4563 HTMLDocument7_get_characterSet
,
4564 HTMLDocument7_createElement
,
4565 HTMLDocument7_createAttribute
,
4566 HTMLDocument7_getElementsByClassName
,
4567 HTMLDocument7_createProcessingInstruction
,
4568 HTMLDocument7_adoptNode
,
4569 HTMLDocument7_put_onmssitemodejumplistitemremoved
,
4570 HTMLDocument7_get_onmssitemodejumplistitemremoved
,
4571 HTMLDocument7_get_all
,
4572 HTMLDocument7_get_inputEncoding
,
4573 HTMLDocument7_get_xmlEncoding
,
4574 HTMLDocument7_put_xmlStandalone
,
4575 HTMLDocument7_get_xmlStandalone
,
4576 HTMLDocument7_put_xmlVersion
,
4577 HTMLDocument7_get_xmlVersion
,
4578 HTMLDocument7_hasAttributes
,
4579 HTMLDocument7_put_onabort
,
4580 HTMLDocument7_get_onabort
,
4581 HTMLDocument7_put_onblur
,
4582 HTMLDocument7_get_onblur
,
4583 HTMLDocument7_put_oncanplay
,
4584 HTMLDocument7_get_oncanplay
,
4585 HTMLDocument7_put_oncanplaythrough
,
4586 HTMLDocument7_get_oncanplaythrough
,
4587 HTMLDocument7_put_onchange
,
4588 HTMLDocument7_get_onchange
,
4589 HTMLDocument7_put_ondrag
,
4590 HTMLDocument7_get_ondrag
,
4591 HTMLDocument7_put_ondragend
,
4592 HTMLDocument7_get_ondragend
,
4593 HTMLDocument7_put_ondragenter
,
4594 HTMLDocument7_get_ondragenter
,
4595 HTMLDocument7_put_ondragleave
,
4596 HTMLDocument7_get_ondragleave
,
4597 HTMLDocument7_put_ondragover
,
4598 HTMLDocument7_get_ondragover
,
4599 HTMLDocument7_put_ondrop
,
4600 HTMLDocument7_get_ondrop
,
4601 HTMLDocument7_put_ondurationchange
,
4602 HTMLDocument7_get_ondurationchange
,
4603 HTMLDocument7_put_onemptied
,
4604 HTMLDocument7_get_onemptied
,
4605 HTMLDocument7_put_onended
,
4606 HTMLDocument7_get_onended
,
4607 HTMLDocument7_put_onerror
,
4608 HTMLDocument7_get_onerror
,
4609 HTMLDocument7_put_onfocus
,
4610 HTMLDocument7_get_onfocus
,
4611 HTMLDocument7_put_oninput
,
4612 HTMLDocument7_get_oninput
,
4613 HTMLDocument7_put_onload
,
4614 HTMLDocument7_get_onload
,
4615 HTMLDocument7_put_onloadeddata
,
4616 HTMLDocument7_get_onloadeddata
,
4617 HTMLDocument7_put_onloadedmetadata
,
4618 HTMLDocument7_get_onloadedmetadata
,
4619 HTMLDocument7_put_onloadstart
,
4620 HTMLDocument7_get_onloadstart
,
4621 HTMLDocument7_put_onpause
,
4622 HTMLDocument7_get_onpause
,
4623 HTMLDocument7_put_onplay
,
4624 HTMLDocument7_get_onplay
,
4625 HTMLDocument7_put_onplaying
,
4626 HTMLDocument7_get_onplaying
,
4627 HTMLDocument7_put_onprogress
,
4628 HTMLDocument7_get_onprogress
,
4629 HTMLDocument7_put_onratechange
,
4630 HTMLDocument7_get_onratechange
,
4631 HTMLDocument7_put_onreset
,
4632 HTMLDocument7_get_onreset
,
4633 HTMLDocument7_put_onscroll
,
4634 HTMLDocument7_get_onscroll
,
4635 HTMLDocument7_put_onseekend
,
4636 HTMLDocument7_get_onseekend
,
4637 HTMLDocument7_put_onseeking
,
4638 HTMLDocument7_get_onseeking
,
4639 HTMLDocument7_put_onselect
,
4640 HTMLDocument7_get_onselect
,
4641 HTMLDocument7_put_onstalled
,
4642 HTMLDocument7_get_onstalled
,
4643 HTMLDocument7_put_onsubmit
,
4644 HTMLDocument7_get_onsubmit
,
4645 HTMLDocument7_put_onsuspend
,
4646 HTMLDocument7_get_onsuspend
,
4647 HTMLDocument7_put_ontimeupdate
,
4648 HTMLDocument7_get_ontimeupdate
,
4649 HTMLDocument7_put_onvolumechange
,
4650 HTMLDocument7_get_onvolumechange
,
4651 HTMLDocument7_put_onwaiting
,
4652 HTMLDocument7_get_onwaiting
,
4653 HTMLDocument7_normalize
,
4654 HTMLDocument7_importNode
,
4655 HTMLDocument7_get_parentWindow
,
4656 HTMLDocument7_put_body
,
4657 HTMLDocument7_get_body
,
4658 HTMLDocument7_get_head
4661 static inline HTMLDocumentNode
*impl_from_IDocumentSelector(IDocumentSelector
*iface
)
4663 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDocumentSelector_iface
);
4666 static HRESULT WINAPI
DocumentSelector_QueryInterface(IDocumentSelector
*iface
, REFIID riid
, void **ppv
)
4668 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4669 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
4672 static ULONG WINAPI
DocumentSelector_AddRef(IDocumentSelector
*iface
)
4674 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4675 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
4678 static ULONG WINAPI
DocumentSelector_Release(IDocumentSelector
*iface
)
4680 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4681 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
4684 static HRESULT WINAPI
DocumentSelector_GetTypeInfoCount(IDocumentSelector
*iface
, UINT
*pctinfo
)
4686 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4687 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
4690 static HRESULT WINAPI
DocumentSelector_GetTypeInfo(IDocumentSelector
*iface
, UINT iTInfo
,
4691 LCID lcid
, ITypeInfo
**ppTInfo
)
4693 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4694 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4697 static HRESULT WINAPI
DocumentSelector_GetIDsOfNames(IDocumentSelector
*iface
, REFIID riid
,
4698 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4700 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4701 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
4705 static HRESULT WINAPI
DocumentSelector_Invoke(IDocumentSelector
*iface
, DISPID dispIdMember
, REFIID riid
,
4706 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4708 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4709 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
4710 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4713 static HRESULT WINAPI
DocumentSelector_querySelector(IDocumentSelector
*iface
, BSTR v
, IHTMLElement
**pel
)
4715 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4716 nsIDOMElement
*nselem
;
4722 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4724 nsAString_InitDepend(&nsstr
, v
);
4725 if(This
->dom_document
)
4726 nsres
= nsIDOMDocument_QuerySelector(This
->dom_document
, &nsstr
, &nselem
);
4728 nsIDOMDocumentFragment
*frag
;
4729 nsres
= nsIDOMNode_QueryInterface(This
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&frag
);
4730 if(NS_SUCCEEDED(nsres
)) {
4731 nsres
= nsIDOMDocumentFragment_QuerySelector(frag
, &nsstr
, &nselem
);
4732 nsIDOMDocumentFragment_Release(frag
);
4735 nsAString_Finish(&nsstr
);
4737 if(NS_FAILED(nsres
)) {
4738 WARN("QuerySelector failed: %08lx\n", nsres
);
4739 return map_nsresult(nsres
);
4747 hres
= get_element(nselem
, &elem
);
4748 nsIDOMElement_Release(nselem
);
4752 *pel
= &elem
->IHTMLElement_iface
;
4756 static HRESULT WINAPI
DocumentSelector_querySelectorAll(IDocumentSelector
*iface
, BSTR v
, IHTMLDOMChildrenCollection
**pel
)
4758 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4759 nsIDOMNodeList
*node_list
= NULL
;
4764 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4766 nsAString_InitDepend(&nsstr
, v
);
4767 if(This
->dom_document
)
4768 nsres
= nsIDOMDocument_QuerySelectorAll(This
->dom_document
, &nsstr
, &node_list
);
4770 nsIDOMDocumentFragment
*frag
;
4771 nsres
= nsIDOMNode_QueryInterface(This
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&frag
);
4772 if(NS_SUCCEEDED(nsres
)) {
4773 nsres
= nsIDOMDocumentFragment_QuerySelectorAll(frag
, &nsstr
, &node_list
);
4774 nsIDOMDocumentFragment_Release(frag
);
4777 nsAString_Finish(&nsstr
);
4779 if(NS_FAILED(nsres
)) {
4780 WARN("QuerySelectorAll failed: %08lx\n", nsres
);
4782 nsIDOMNodeList_Release(node_list
);
4783 return map_nsresult(nsres
);
4786 hres
= create_child_collection(node_list
, dispex_compat_mode(&This
->node
.event_target
.dispex
), pel
);
4787 nsIDOMNodeList_Release(node_list
);
4791 static const IDocumentSelectorVtbl DocumentSelectorVtbl
= {
4792 DocumentSelector_QueryInterface
,
4793 DocumentSelector_AddRef
,
4794 DocumentSelector_Release
,
4795 DocumentSelector_GetTypeInfoCount
,
4796 DocumentSelector_GetTypeInfo
,
4797 DocumentSelector_GetIDsOfNames
,
4798 DocumentSelector_Invoke
,
4799 DocumentSelector_querySelector
,
4800 DocumentSelector_querySelectorAll
4803 static inline HTMLDocumentNode
*impl_from_IDocumentEvent(IDocumentEvent
*iface
)
4805 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDocumentEvent_iface
);
4808 static HRESULT WINAPI
DocumentEvent_QueryInterface(IDocumentEvent
*iface
, REFIID riid
, void **ppv
)
4810 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4811 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
4814 static ULONG WINAPI
DocumentEvent_AddRef(IDocumentEvent
*iface
)
4816 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4817 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
4820 static ULONG WINAPI
DocumentEvent_Release(IDocumentEvent
*iface
)
4822 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4823 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
4826 static HRESULT WINAPI
DocumentEvent_GetTypeInfoCount(IDocumentEvent
*iface
, UINT
*pctinfo
)
4828 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4829 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
4832 static HRESULT WINAPI
DocumentEvent_GetTypeInfo(IDocumentEvent
*iface
, UINT iTInfo
,
4833 LCID lcid
, ITypeInfo
**ppTInfo
)
4835 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4836 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4839 static HRESULT WINAPI
DocumentEvent_GetIDsOfNames(IDocumentEvent
*iface
, REFIID riid
,
4840 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4842 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4843 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
4847 static HRESULT WINAPI
DocumentEvent_Invoke(IDocumentEvent
*iface
, DISPID dispIdMember
, REFIID riid
,
4848 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4850 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4851 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
4852 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4855 static HRESULT WINAPI
DocumentEvent_createEvent(IDocumentEvent
*iface
, BSTR eventType
, IDOMEvent
**p
)
4857 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4859 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eventType
), p
);
4861 return create_document_event_str(This
, eventType
, p
);
4864 static const IDocumentEventVtbl DocumentEventVtbl
= {
4865 DocumentEvent_QueryInterface
,
4866 DocumentEvent_AddRef
,
4867 DocumentEvent_Release
,
4868 DocumentEvent_GetTypeInfoCount
,
4869 DocumentEvent_GetTypeInfo
,
4870 DocumentEvent_GetIDsOfNames
,
4871 DocumentEvent_Invoke
,
4872 DocumentEvent_createEvent
4875 static void HTMLDocumentNode_on_advise(IUnknown
*iface
, cp_static_data_t
*cp
)
4877 HTMLDocumentNode
*This
= CONTAINING_RECORD((IHTMLDocument2
*)iface
, HTMLDocumentNode
, IHTMLDocument2_iface
);
4879 if(This
->outer_window
)
4880 update_doc_cp_events(This
, cp
);
4883 static inline HTMLDocumentNode
*impl_from_ISupportErrorInfo(ISupportErrorInfo
*iface
)
4885 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, ISupportErrorInfo_iface
);
4888 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
4890 HTMLDocumentNode
*This
= impl_from_ISupportErrorInfo(iface
);
4891 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
4894 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
4896 HTMLDocumentNode
*This
= impl_from_ISupportErrorInfo(iface
);
4897 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
4900 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
4902 HTMLDocumentNode
*This
= impl_from_ISupportErrorInfo(iface
);
4903 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
4906 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
4908 FIXME("(%p)->(%s)\n", iface
, debugstr_mshtml_guid(riid
));
4912 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
4913 SupportErrorInfo_QueryInterface
,
4914 SupportErrorInfo_AddRef
,
4915 SupportErrorInfo_Release
,
4916 SupportErrorInfo_InterfaceSupportsErrorInfo
4919 static inline HTMLDocumentNode
*impl_from_IDispatchEx(IDispatchEx
*iface
)
4921 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDispatchEx_iface
);
4924 static HRESULT
has_elem_name(nsIDOMHTMLDocument
*html_document
, const WCHAR
*name
)
4926 static const WCHAR fmt
[] = L
":-moz-any(applet,embed,form,iframe,img,object)[name=\"%s\"]";
4927 WCHAR buf
[128], *selector
= buf
;
4928 nsAString selector_str
;
4929 nsIDOMElement
*nselem
;
4933 len
= wcslen(name
) + ARRAY_SIZE(fmt
) - 2 /* %s */;
4934 if(len
> ARRAY_SIZE(buf
) && !(selector
= malloc(len
* sizeof(WCHAR
))))
4935 return E_OUTOFMEMORY
;
4936 swprintf(selector
, len
, fmt
, name
);
4938 nsAString_InitDepend(&selector_str
, selector
);
4939 nsres
= nsIDOMHTMLDocument_QuerySelector(html_document
, &selector_str
, &nselem
);
4940 nsAString_Finish(&selector_str
);
4943 if(NS_FAILED(nsres
))
4944 return map_nsresult(nsres
);
4947 return DISP_E_UNKNOWNNAME
;
4948 nsIDOMElement_Release(nselem
);
4952 static HRESULT
get_elem_by_name_or_id(nsIDOMHTMLDocument
*html_document
, const WCHAR
*name
, nsIDOMElement
**ret
)
4954 static const WCHAR fmt
[] = L
":-moz-any(embed,form,iframe,img):-moz-any([name=\"%s\"],[id=\"%s\"][name]),"
4955 L
":-moz-any(applet,object):-moz-any([name=\"%s\"],[id=\"%s\"])";
4956 WCHAR buf
[384], *selector
= buf
;
4957 nsAString selector_str
;
4958 nsIDOMElement
*nselem
;
4962 len
= wcslen(name
) * 4 + ARRAY_SIZE(fmt
) - 8 /* %s */;
4963 if(len
> ARRAY_SIZE(buf
) && !(selector
= malloc(len
* sizeof(WCHAR
))))
4964 return E_OUTOFMEMORY
;
4965 swprintf(selector
, len
, fmt
, name
, name
, name
, name
);
4967 nsAString_InitDepend(&selector_str
, selector
);
4968 nsres
= nsIDOMHTMLDocument_QuerySelector(html_document
, &selector_str
, &nselem
);
4969 nsAString_Finish(&selector_str
);
4972 if(NS_FAILED(nsres
))
4973 return map_nsresult(nsres
);
4981 nsIDOMElement_Release(nselem
);
4984 return DISP_E_UNKNOWNNAME
;
4987 static HRESULT
dispid_from_elem_name(HTMLDocumentNode
*This
, const WCHAR
*name
, DISPID
*dispid
)
4991 for(i
=0; i
< This
->elem_vars_cnt
; i
++) {
4992 if(!wcscmp(name
, This
->elem_vars
[i
])) {
4993 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
4998 if(This
->elem_vars_cnt
== This
->elem_vars_size
) {
5001 if(This
->elem_vars_size
) {
5002 new_vars
= realloc(This
->elem_vars
, This
->elem_vars_size
* 2 * sizeof(WCHAR
*));
5004 return E_OUTOFMEMORY
;
5005 This
->elem_vars_size
*= 2;
5007 new_vars
= malloc(16 * sizeof(WCHAR
*));
5009 return E_OUTOFMEMORY
;
5010 This
->elem_vars_size
= 16;
5013 This
->elem_vars
= new_vars
;
5016 This
->elem_vars
[This
->elem_vars_cnt
] = wcsdup(name
);
5017 if(!This
->elem_vars
[This
->elem_vars_cnt
])
5018 return E_OUTOFMEMORY
;
5020 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+This
->elem_vars_cnt
++;
5024 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
5026 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5028 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
5031 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
5033 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5035 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5038 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
5040 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5042 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5045 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
5047 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5049 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
5052 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
5053 LCID lcid
, ITypeInfo
**ppTInfo
)
5055 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5057 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
5060 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
5061 LPOLESTR
*rgszNames
, UINT cNames
,
5062 LCID lcid
, DISPID
*rgDispId
)
5064 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5066 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
5069 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
5070 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
5071 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
5073 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5075 TRACE("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
5076 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
5078 return IDispatchEx_InvokeEx(&This
->IDispatchEx_iface
, dispIdMember
, lcid
, wFlags
, pDispParams
,
5079 pVarResult
, pExcepInfo
, NULL
);
5082 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
5084 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5087 hres
= IDispatchEx_GetDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, bstrName
, grfdex
& ~fdexNameEnsure
, pid
);
5088 if(hres
!= DISP_E_UNKNOWNNAME
)
5091 if(This
->html_document
) {
5092 hres
= get_elem_by_name_or_id(This
->html_document
, bstrName
, NULL
);
5094 hres
= dispid_from_elem_name(This
, bstrName
, pid
);
5097 if(hres
== DISP_E_UNKNOWNNAME
&& (grfdex
& fdexNameEnsure
))
5098 hres
= dispex_get_dynid(&This
->node
.event_target
.dispex
, bstrName
, FALSE
, pid
);
5102 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
5103 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
5105 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5109 case DISPID_READYSTATE
:
5110 TRACE("DISPID_READYSTATE\n");
5112 if(!(wFlags
& DISPATCH_PROPERTYGET
))
5113 return E_INVALIDARG
;
5115 V_VT(pvarRes
) = VT_I4
;
5116 V_I4(pvarRes
) = This
->window
->base
.outer_window
->readystate
;
5123 return IDispatchEx_InvokeEx(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
5126 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
5128 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5130 return IDispatchEx_DeleteMemberByName(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, bstrName
, grfdex
);
5133 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
5135 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5137 return IDispatchEx_DeleteMemberByDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, id
);
5140 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
5142 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5144 return IDispatchEx_GetMemberProperties(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, id
, grfdexFetch
, pgrfdex
);
5147 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
5149 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5151 return IDispatchEx_GetMemberName(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, id
, pbstrName
);
5154 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
5156 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5158 return IDispatchEx_GetNextDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, grfdex
, id
, pid
);
5161 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
5163 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5165 return IDispatchEx_GetNameSpaceParent(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, ppunk
);
5168 static const IDispatchExVtbl DocDispatchExVtbl
= {
5169 DocDispatchEx_QueryInterface
,
5170 DocDispatchEx_AddRef
,
5171 DocDispatchEx_Release
,
5172 DocDispatchEx_GetTypeInfoCount
,
5173 DocDispatchEx_GetTypeInfo
,
5174 DocDispatchEx_GetIDsOfNames
,
5175 DocDispatchEx_Invoke
,
5176 DocDispatchEx_GetDispID
,
5177 DocDispatchEx_InvokeEx
,
5178 DocDispatchEx_DeleteMemberByName
,
5179 DocDispatchEx_DeleteMemberByDispID
,
5180 DocDispatchEx_GetMemberProperties
,
5181 DocDispatchEx_GetMemberName
,
5182 DocDispatchEx_GetNextDispID
,
5183 DocDispatchEx_GetNameSpaceParent
5186 static inline HTMLDocumentNode
*impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo
*iface
)
5188 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IProvideMultipleClassInfo_iface
);
5191 static HRESULT WINAPI
ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo
*iface
,
5192 REFIID riid
, void **ppv
)
5194 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5195 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
5198 static ULONG WINAPI
ProvideClassInfo_AddRef(IProvideMultipleClassInfo
*iface
)
5200 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5201 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5204 static ULONG WINAPI
ProvideClassInfo_Release(IProvideMultipleClassInfo
*iface
)
5206 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5207 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5210 static HRESULT WINAPI
ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo
*iface
, ITypeInfo
**ppTI
)
5212 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5213 TRACE("(%p)->(%p)\n", This
, ppTI
);
5214 return get_class_typeinfo(&CLSID_HTMLDocument
, ppTI
);
5217 static HRESULT WINAPI
ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo
*iface
, DWORD dwGuidKind
, GUID
*pGUID
)
5219 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5220 FIXME("(%p)->(%lu %p)\n", This
, dwGuidKind
, pGUID
);
5224 static HRESULT WINAPI
ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo
*iface
, ULONG
*pcti
)
5226 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5227 FIXME("(%p)->(%p)\n", This
, pcti
);
5232 static HRESULT WINAPI
ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo
*iface
, ULONG iti
,
5233 DWORD dwFlags
, ITypeInfo
**pptiCoClass
, DWORD
*pdwTIFlags
, ULONG
*pcdispidReserved
, IID
*piidPrimary
, IID
*piidSource
)
5235 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5236 FIXME("(%p)->(%lu %lx %p %p %p %p %p)\n", This
, iti
, dwFlags
, pptiCoClass
, pdwTIFlags
, pcdispidReserved
, piidPrimary
, piidSource
);
5240 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl
= {
5241 ProvideClassInfo_QueryInterface
,
5242 ProvideClassInfo_AddRef
,
5243 ProvideClassInfo_Release
,
5244 ProvideClassInfo_GetClassInfo
,
5245 ProvideClassInfo2_GetGUID
,
5246 ProvideMultipleClassInfo_GetMultiTypeInfoCount
,
5247 ProvideMultipleClassInfo_GetInfoOfIndex
5250 /**********************************************************
5251 * IMarkupServices implementation
5253 static inline HTMLDocumentNode
*impl_from_IMarkupServices(IMarkupServices
*iface
)
5255 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IMarkupServices_iface
);
5258 static HRESULT WINAPI
MarkupServices_QueryInterface(IMarkupServices
*iface
, REFIID riid
, void **ppvObject
)
5260 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5261 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppvObject
);
5264 static ULONG WINAPI
MarkupServices_AddRef(IMarkupServices
*iface
)
5266 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5267 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5270 static ULONG WINAPI
MarkupServices_Release(IMarkupServices
*iface
)
5272 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5273 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5276 static HRESULT WINAPI
MarkupServices_CreateMarkupPointer(IMarkupServices
*iface
, IMarkupPointer
**ppPointer
)
5278 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5280 TRACE("(%p)->(%p)\n", This
, ppPointer
);
5282 return create_markup_pointer(ppPointer
);
5285 static HRESULT WINAPI
MarkupServices_CreateMarkupContainer(IMarkupServices
*iface
, IMarkupContainer
**ppMarkupContainer
)
5287 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5288 FIXME("(%p)->(%p)\n", This
, ppMarkupContainer
);
5292 static HRESULT WINAPI
MarkupServices_CreateElement(IMarkupServices
*iface
,
5293 ELEMENT_TAG_ID tagID
, OLECHAR
*pchAttributes
, IHTMLElement
**ppElement
)
5295 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5296 FIXME("(%p)->(%d,%s,%p)\n", This
, tagID
, debugstr_w(pchAttributes
), ppElement
);
5300 static HRESULT WINAPI
MarkupServices_CloneElement(IMarkupServices
*iface
,
5301 IHTMLElement
*pElemCloneThis
, IHTMLElement
**ppElementTheClone
)
5303 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5304 FIXME("(%p)->(%p,%p)\n", This
, pElemCloneThis
, ppElementTheClone
);
5308 static HRESULT WINAPI
MarkupServices_InsertElement(IMarkupServices
*iface
,
5309 IHTMLElement
*pElementInsert
, IMarkupPointer
*pPointerStart
,
5310 IMarkupPointer
*pPointerFinish
)
5312 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5313 FIXME("(%p)->(%p,%p,%p)\n", This
, pElementInsert
, pPointerStart
, pPointerFinish
);
5317 static HRESULT WINAPI
MarkupServices_RemoveElement(IMarkupServices
*iface
, IHTMLElement
*pElementRemove
)
5319 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5320 FIXME("(%p)->(%p)\n", This
, pElementRemove
);
5324 static HRESULT WINAPI
MarkupServices_Remove(IMarkupServices
*iface
,
5325 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
5327 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5328 FIXME("(%p)->(%p,%p)\n", This
, pPointerStart
, pPointerFinish
);
5332 static HRESULT WINAPI
MarkupServices_Copy(IMarkupServices
*iface
,
5333 IMarkupPointer
*pPointerSourceStart
, IMarkupPointer
*pPointerSourceFinish
,
5334 IMarkupPointer
*pPointerTarget
)
5336 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5337 FIXME("(%p)->(%p,%p,%p)\n", This
, pPointerSourceStart
, pPointerSourceFinish
, pPointerTarget
);
5341 static HRESULT WINAPI
MarkupServices_Move(IMarkupServices
*iface
,
5342 IMarkupPointer
*pPointerSourceStart
, IMarkupPointer
*pPointerSourceFinish
,
5343 IMarkupPointer
*pPointerTarget
)
5345 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5346 FIXME("(%p)->(%p,%p,%p)\n", This
, pPointerSourceStart
, pPointerSourceFinish
, pPointerTarget
);
5350 static HRESULT WINAPI
MarkupServices_InsertText(IMarkupServices
*iface
,
5351 OLECHAR
*pchText
, LONG cch
, IMarkupPointer
*pPointerTarget
)
5353 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5354 FIXME("(%p)->(%s,%lx,%p)\n", This
, debugstr_w(pchText
), cch
, pPointerTarget
);
5358 static HRESULT WINAPI
MarkupServices_ParseString(IMarkupServices
*iface
,
5359 OLECHAR
*pchHTML
, DWORD dwFlags
, IMarkupContainer
**ppContainerResult
,
5360 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
5362 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5363 FIXME("(%p)->(%s,%lx,%p,%p,%p)\n", This
, debugstr_w(pchHTML
), dwFlags
, ppContainerResult
, pPointerStart
, pPointerFinish
);
5367 static HRESULT WINAPI
MarkupServices_ParseGlobal(IMarkupServices
*iface
,
5368 HGLOBAL hglobalHTML
, DWORD dwFlags
, IMarkupContainer
**ppContainerResult
,
5369 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
5371 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5372 FIXME("(%p)->(%s,%lx,%p,%p,%p)\n", This
, debugstr_w(hglobalHTML
), dwFlags
, ppContainerResult
, pPointerStart
, pPointerFinish
);
5376 static HRESULT WINAPI
MarkupServices_IsScopedElement(IMarkupServices
*iface
,
5377 IHTMLElement
*pElement
, BOOL
*pfScoped
)
5379 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5380 FIXME("(%p)->(%p,%p)\n", This
, pElement
, pfScoped
);
5384 static HRESULT WINAPI
MarkupServices_GetElementTagId(IMarkupServices
*iface
,
5385 IHTMLElement
*pElement
, ELEMENT_TAG_ID
*ptagId
)
5387 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5388 FIXME("(%p)->(%p,%p)\n", This
, pElement
, ptagId
);
5392 static HRESULT WINAPI
MarkupServices_GetTagIDForName(IMarkupServices
*iface
,
5393 BSTR bstrName
, ELEMENT_TAG_ID
*ptagId
)
5395 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5396 FIXME("(%p)->(%s,%p)\n", This
, debugstr_w(bstrName
), ptagId
);
5400 static HRESULT WINAPI
MarkupServices_GetNameForTagID(IMarkupServices
*iface
,
5401 ELEMENT_TAG_ID tagId
, BSTR
*pbstrName
)
5403 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5404 FIXME("(%p)->(%d,%p)\n", This
, tagId
, pbstrName
);
5408 static HRESULT WINAPI
MarkupServices_MovePointersToRange(IMarkupServices
*iface
,
5409 IHTMLTxtRange
*pIRange
, IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
5411 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5412 FIXME("(%p)->(%p,%p,%p)\n", This
, pIRange
, pPointerStart
, pPointerFinish
);
5416 static HRESULT WINAPI
MarkupServices_MoveRangeToPointers(IMarkupServices
*iface
,
5417 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
, IHTMLTxtRange
*pIRange
)
5419 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5420 FIXME("(%p)->(%p,%p,%p)\n", This
, pPointerStart
, pPointerFinish
, pIRange
);
5424 static HRESULT WINAPI
MarkupServices_BeginUndoUnit(IMarkupServices
*iface
, OLECHAR
*pchTitle
)
5426 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5427 FIXME("(%p)->(%s)\n", This
, debugstr_w(pchTitle
));
5431 static HRESULT WINAPI
MarkupServices_EndUndoUnit(IMarkupServices
*iface
)
5433 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5434 FIXME("(%p)\n", This
);
5438 static const IMarkupServicesVtbl MarkupServicesVtbl
= {
5439 MarkupServices_QueryInterface
,
5440 MarkupServices_AddRef
,
5441 MarkupServices_Release
,
5442 MarkupServices_CreateMarkupPointer
,
5443 MarkupServices_CreateMarkupContainer
,
5444 MarkupServices_CreateElement
,
5445 MarkupServices_CloneElement
,
5446 MarkupServices_InsertElement
,
5447 MarkupServices_RemoveElement
,
5448 MarkupServices_Remove
,
5449 MarkupServices_Copy
,
5450 MarkupServices_Move
,
5451 MarkupServices_InsertText
,
5452 MarkupServices_ParseString
,
5453 MarkupServices_ParseGlobal
,
5454 MarkupServices_IsScopedElement
,
5455 MarkupServices_GetElementTagId
,
5456 MarkupServices_GetTagIDForName
,
5457 MarkupServices_GetNameForTagID
,
5458 MarkupServices_MovePointersToRange
,
5459 MarkupServices_MoveRangeToPointers
,
5460 MarkupServices_BeginUndoUnit
,
5461 MarkupServices_EndUndoUnit
5464 /**********************************************************
5465 * IMarkupContainer implementation
5467 static inline HTMLDocumentNode
*impl_from_IMarkupContainer(IMarkupContainer
*iface
)
5469 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IMarkupContainer_iface
);
5472 static HRESULT WINAPI
MarkupContainer_QueryInterface(IMarkupContainer
*iface
, REFIID riid
, void **ppvObject
)
5474 HTMLDocumentNode
*This
= impl_from_IMarkupContainer(iface
);
5475 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppvObject
);
5478 static ULONG WINAPI
MarkupContainer_AddRef(IMarkupContainer
*iface
)
5480 HTMLDocumentNode
*This
= impl_from_IMarkupContainer(iface
);
5481 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5484 static ULONG WINAPI
MarkupContainer_Release(IMarkupContainer
*iface
)
5486 HTMLDocumentNode
*This
= impl_from_IMarkupContainer(iface
);
5487 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5490 static HRESULT WINAPI
MarkupContainer_OwningDoc(IMarkupContainer
*iface
, IHTMLDocument2
**ppDoc
)
5492 HTMLDocumentNode
*This
= impl_from_IMarkupContainer(iface
);
5493 FIXME("(%p)->(%p)\n", This
, ppDoc
);
5497 static const IMarkupContainerVtbl MarkupContainerVtbl
= {
5498 MarkupContainer_QueryInterface
,
5499 MarkupContainer_AddRef
,
5500 MarkupContainer_Release
,
5501 MarkupContainer_OwningDoc
5504 /**********************************************************
5505 * IDisplayServices implementation
5507 static inline HTMLDocumentNode
*impl_from_IDisplayServices(IDisplayServices
*iface
)
5509 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDisplayServices_iface
);
5512 static HRESULT WINAPI
DisplayServices_QueryInterface(IDisplayServices
*iface
, REFIID riid
, void **ppvObject
)
5514 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5515 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppvObject
);
5518 static ULONG WINAPI
DisplayServices_AddRef(IDisplayServices
*iface
)
5520 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5521 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5524 static ULONG WINAPI
DisplayServices_Release(IDisplayServices
*iface
)
5526 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5527 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5530 static HRESULT WINAPI
DisplayServices_CreateDisplayPointer(IDisplayServices
*iface
, IDisplayPointer
**ppDispPointer
)
5532 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5533 FIXME("(%p)->(%p)\n", This
, ppDispPointer
);
5537 static HRESULT WINAPI
DisplayServices_TransformRect(IDisplayServices
*iface
,
5538 RECT
*pRect
, COORD_SYSTEM eSource
, COORD_SYSTEM eDestination
, IHTMLElement
*pIElement
)
5540 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5541 FIXME("(%p)->(%s,%d,%d,%p)\n", This
, wine_dbgstr_rect(pRect
), eSource
, eDestination
, pIElement
);
5545 static HRESULT WINAPI
DisplayServices_TransformPoint(IDisplayServices
*iface
,
5546 POINT
*pPoint
, COORD_SYSTEM eSource
, COORD_SYSTEM eDestination
, IHTMLElement
*pIElement
)
5548 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5549 FIXME("(%p)->(%s,%d,%d,%p)\n", This
, wine_dbgstr_point(pPoint
), eSource
, eDestination
, pIElement
);
5553 static HRESULT WINAPI
DisplayServices_GetCaret(IDisplayServices
*iface
, IHTMLCaret
**ppCaret
)
5555 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5556 FIXME("(%p)->(%p)\n", This
, ppCaret
);
5560 static HRESULT WINAPI
DisplayServices_GetComputedStyle(IDisplayServices
*iface
,
5561 IMarkupPointer
*pPointer
, IHTMLComputedStyle
**ppComputedStyle
)
5563 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5564 FIXME("(%p)->(%p,%p)\n", This
, pPointer
, ppComputedStyle
);
5568 static HRESULT WINAPI
DisplayServices_ScrollRectIntoView(IDisplayServices
*iface
,
5569 IHTMLElement
*pIElement
, RECT rect
)
5571 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5572 FIXME("(%p)->(%p,%s)\n", This
, pIElement
, wine_dbgstr_rect(&rect
));
5576 static HRESULT WINAPI
DisplayServices_HasFlowLayout(IDisplayServices
*iface
,
5577 IHTMLElement
*pIElement
, BOOL
*pfHasFlowLayout
)
5579 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5580 FIXME("(%p)->(%p,%p)\n", This
, pIElement
, pfHasFlowLayout
);
5584 static const IDisplayServicesVtbl DisplayServicesVtbl
= {
5585 DisplayServices_QueryInterface
,
5586 DisplayServices_AddRef
,
5587 DisplayServices_Release
,
5588 DisplayServices_CreateDisplayPointer
,
5589 DisplayServices_TransformRect
,
5590 DisplayServices_TransformPoint
,
5591 DisplayServices_GetCaret
,
5592 DisplayServices_GetComputedStyle
,
5593 DisplayServices_ScrollRectIntoView
,
5594 DisplayServices_HasFlowLayout
5597 /**********************************************************
5598 * IDocumentRange implementation
5600 static inline HTMLDocumentNode
*impl_from_IDocumentRange(IDocumentRange
*iface
)
5602 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDocumentRange_iface
);
5605 static HRESULT WINAPI
DocumentRange_QueryInterface(IDocumentRange
*iface
, REFIID riid
, void **ppv
)
5607 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5609 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
5612 static ULONG WINAPI
DocumentRange_AddRef(IDocumentRange
*iface
)
5614 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5616 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5619 static ULONG WINAPI
DocumentRange_Release(IDocumentRange
*iface
)
5621 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5623 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5626 static HRESULT WINAPI
DocumentRange_GetTypeInfoCount(IDocumentRange
*iface
, UINT
*pctinfo
)
5628 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5630 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
5633 static HRESULT WINAPI
DocumentRange_GetTypeInfo(IDocumentRange
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
5635 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5637 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
5640 static HRESULT WINAPI
DocumentRange_GetIDsOfNames(IDocumentRange
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
5641 LCID lcid
, DISPID
*rgDispId
)
5643 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5645 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
5649 static HRESULT WINAPI
DocumentRange_Invoke(IDocumentRange
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
5650 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
5652 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5654 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
5655 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
5658 static HRESULT WINAPI
DocumentRange_createRange(IDocumentRange
*iface
, IHTMLDOMRange
**p
)
5660 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5661 nsIDOMRange
*nsrange
;
5664 TRACE("(%p)->(%p)\n", This
, p
);
5666 if(!This
->dom_document
) {
5667 WARN("NULL dom_document\n");
5668 return E_UNEXPECTED
;
5671 if(NS_FAILED(nsIDOMDocument_CreateRange(This
->dom_document
, &nsrange
)))
5674 hres
= create_dom_range(nsrange
, dispex_compat_mode(&This
->node
.event_target
.dispex
), p
);
5675 nsIDOMRange_Release(nsrange
);
5679 static const IDocumentRangeVtbl DocumentRangeVtbl
= {
5680 DocumentRange_QueryInterface
,
5681 DocumentRange_AddRef
,
5682 DocumentRange_Release
,
5683 DocumentRange_GetTypeInfoCount
,
5684 DocumentRange_GetTypeInfo
,
5685 DocumentRange_GetIDsOfNames
,
5686 DocumentRange_Invoke
,
5687 DocumentRange_createRange
5690 static cp_static_data_t HTMLDocumentNodeEvents_data
= { HTMLDocumentEvents_tid
, HTMLDocumentNode_on_advise
};
5691 static cp_static_data_t HTMLDocumentNodeEvents2_data
= { HTMLDocumentEvents2_tid
, HTMLDocumentNode_on_advise
, TRUE
};
5693 static const cpc_entry_t HTMLDocumentNode_cpc
[] = {
5694 {&IID_IDispatch
, &HTMLDocumentNodeEvents_data
},
5695 {&IID_IPropertyNotifySink
},
5696 {&DIID_HTMLDocumentEvents
, &HTMLDocumentNodeEvents_data
},
5697 {&DIID_HTMLDocumentEvents2
, &HTMLDocumentNodeEvents2_data
},
5701 static inline HTMLDocumentNode
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
5703 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
);
5706 void detach_document_node(HTMLDocumentNode
*doc
)
5711 HTMLInnerWindow
*window
= doc
->window
;
5713 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
5716 while(!list_empty(&doc
->plugin_hosts
))
5717 detach_plugin_host(LIST_ENTRY(list_head(&doc
->plugin_hosts
), PluginHost
, entry
));
5719 if(doc
->dom_implementation
)
5720 detach_dom_implementation(doc
->dom_implementation
);
5722 unlink_ref(&doc
->dom_implementation
);
5723 unlink_ref(&doc
->namespaces
);
5725 detach_selection(doc
);
5728 for(i
=0; i
< doc
->elem_vars_cnt
; i
++)
5729 free(doc
->elem_vars
[i
]);
5730 free(doc
->elem_vars
);
5731 doc
->elem_vars_cnt
= doc
->elem_vars_size
= 0;
5732 doc
->elem_vars
= NULL
;
5734 unlink_ref(&doc
->catmgr
);
5736 list_remove(&doc
->browser_entry
);
5737 doc
->browser
= NULL
;
5741 static HRESULT
HTMLDocumentNode_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
5743 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
5744 FIXME("%p\n", This
);
5748 static const NodeImplVtbl HTMLDocumentNodeImplVtbl
= {
5749 .clsid
= &CLSID_HTMLDocument
,
5750 .cpc_entries
= HTMLDocumentNode_cpc
,
5751 .clone
= HTMLDocumentNode_clone
,
5754 static HRESULT
HTMLDocumentFragment_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
5756 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
5757 HTMLDocumentNode
*new_node
;
5760 hres
= create_document_fragment(nsnode
, This
->node
.doc
, &new_node
);
5764 *ret
= &new_node
->node
;
5768 static inline HTMLDocumentNode
*impl_from_DispatchEx(DispatchEx
*iface
)
5770 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
.event_target
.dispex
);
5773 static void *HTMLDocumentNode_query_interface(DispatchEx
*dispex
, REFIID riid
)
5775 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5777 if(IsEqualGUID(&IID_IDispatch
, riid
) || IsEqualGUID(&IID_IDispatchEx
, riid
))
5778 return &This
->IDispatchEx_iface
;
5779 if(IsEqualGUID(&IID_IHTMLDocument
, riid
) || IsEqualGUID(&IID_IHTMLDocument2
, riid
))
5780 return &This
->IHTMLDocument2_iface
;
5781 if(IsEqualGUID(&IID_IHTMLDocument3
, riid
))
5782 return &This
->IHTMLDocument3_iface
;
5783 if(IsEqualGUID(&IID_IHTMLDocument4
, riid
))
5784 return &This
->IHTMLDocument4_iface
;
5785 if(IsEqualGUID(&IID_IHTMLDocument5
, riid
))
5786 return &This
->IHTMLDocument5_iface
;
5787 if(IsEqualGUID(&IID_IHTMLDocument6
, riid
))
5788 return &This
->IHTMLDocument6_iface
;
5789 if(IsEqualGUID(&IID_IHTMLDocument7
, riid
))
5790 return &This
->IHTMLDocument7_iface
;
5791 if(IsEqualGUID(&IID_IDocumentSelector
, riid
))
5792 return &This
->IDocumentSelector_iface
;
5793 if(IsEqualGUID(&IID_IDocumentEvent
, riid
))
5794 return &This
->IDocumentEvent_iface
;
5795 if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
))
5796 return &This
->IHTMLDocument2_iface
;
5797 if(IsEqualGUID(&IID_ISupportErrorInfo
, riid
))
5798 return &This
->ISupportErrorInfo_iface
;
5799 if(IsEqualGUID(&IID_IProvideClassInfo
, riid
))
5800 return &This
->IProvideMultipleClassInfo_iface
;
5801 if(IsEqualGUID(&IID_IProvideClassInfo2
, riid
))
5802 return &This
->IProvideMultipleClassInfo_iface
;
5803 if(IsEqualGUID(&IID_IProvideMultipleClassInfo
, riid
))
5804 return &This
->IProvideMultipleClassInfo_iface
;
5805 if(IsEqualGUID(&IID_IMarkupServices
, riid
))
5806 return &This
->IMarkupServices_iface
;
5807 if(IsEqualGUID(&IID_IMarkupContainer
, riid
))
5808 return &This
->IMarkupContainer_iface
;
5809 if(IsEqualGUID(&IID_IDisplayServices
, riid
))
5810 return &This
->IDisplayServices_iface
;
5811 if(IsEqualGUID(&IID_IDocumentRange
, riid
))
5812 return &This
->IDocumentRange_iface
;
5813 if(IsEqualGUID(&IID_IPersist
, riid
))
5814 return &This
->IPersistFile_iface
;
5815 if(IsEqualGUID(&IID_IPersistMoniker
, riid
))
5816 return &This
->IPersistMoniker_iface
;
5817 if(IsEqualGUID(&IID_IPersistFile
, riid
))
5818 return &This
->IPersistFile_iface
;
5819 if(IsEqualGUID(&IID_IMonikerProp
, riid
))
5820 return &This
->IMonikerProp_iface
;
5821 if(IsEqualGUID(&IID_IPersistStreamInit
, riid
))
5822 return &This
->IPersistStreamInit_iface
;
5823 if(IsEqualGUID(&IID_IPersistHistory
, riid
))
5824 return &This
->IPersistHistory_iface
;
5825 if(IsEqualGUID(&IID_IHlinkTarget
, riid
))
5826 return &This
->IHlinkTarget_iface
;
5827 if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
5828 return &This
->IOleCommandTarget_iface
;
5829 if(IsEqualGUID(&IID_IOleObject
, riid
))
5830 return &This
->IOleObject_iface
;
5831 if(IsEqualGUID(&IID_IOleDocument
, riid
))
5832 return &This
->IOleDocument_iface
;
5833 if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
))
5834 return &This
->IOleInPlaceActiveObject_iface
;
5835 if(IsEqualGUID(&IID_IOleWindow
, riid
))
5836 return &This
->IOleInPlaceActiveObject_iface
;
5837 if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
))
5838 return &This
->IOleInPlaceObjectWindowless_iface
;
5839 if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
))
5840 return &This
->IOleInPlaceObjectWindowless_iface
;
5841 if(IsEqualGUID(&IID_IOleControl
, riid
))
5842 return &This
->IOleControl_iface
;
5843 if(IsEqualGUID(&IID_IObjectWithSite
, riid
))
5844 return &This
->IObjectWithSite_iface
;
5845 if(IsEqualGUID(&IID_IOleContainer
, riid
))
5846 return &This
->IOleContainer_iface
;
5847 if(IsEqualGUID(&IID_IObjectSafety
, riid
))
5848 return &This
->IObjectSafety_iface
;
5849 if(IsEqualGUID(&IID_IServiceProvider
, riid
))
5850 return &This
->IServiceProvider_iface
;
5851 if(IsEqualGUID(&IID_IInternetHostSecurityManager
, riid
))
5852 return &This
->IInternetHostSecurityManager_iface
;
5853 if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
))
5854 return &This
->cp_container
.IConnectionPointContainer_iface
;
5855 if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
5856 FIXME("(%p)->(CLSID_CMarkup)\n", This
);
5858 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
5860 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
5862 }else if(IsEqualGUID(&IID_IExternalConnection
, riid
)) {
5864 }else if(IsEqualGUID(&IID_IStdMarshalInfo
, riid
)) {
5868 return HTMLDOMNode_query_interface(&This
->node
.event_target
.dispex
, riid
);
5871 static void HTMLDocumentNode_traverse(DispatchEx
*dispex
, nsCycleCollectionTraversalCallback
*cb
)
5873 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5874 HTMLDOMNode_traverse(dispex
, cb
);
5877 note_cc_edge((nsISupports
*)&This
->window
->base
.IHTMLWindow2_iface
, "window", cb
);
5878 if(This
->dom_implementation
)
5879 note_cc_edge((nsISupports
*)This
->dom_implementation
, "dom_implementation", cb
);
5880 if(This
->namespaces
)
5881 note_cc_edge((nsISupports
*)This
->namespaces
, "namespaces", cb
);
5884 static void HTMLDocumentNode_unlink(DispatchEx
*dispex
)
5886 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5887 HTMLDOMNode_unlink(dispex
);
5889 if(This
->dom_document
) {
5890 release_document_mutation(This
);
5891 detach_document_node(This
);
5892 This
->dom_document
= NULL
;
5893 This
->html_document
= NULL
;
5894 }else if(This
->window
) {
5895 detach_document_node(This
);
5899 static void HTMLDocumentNode_destructor(DispatchEx
*dispex
)
5901 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5903 free(This
->event_vector
);
5904 ConnectionPointContainer_Destroy(&This
->cp_container
);
5905 HTMLDOMNode_destructor(&This
->node
.event_target
.dispex
);
5908 static HRESULT
HTMLDocumentNode_get_name(DispatchEx
*dispex
, DISPID id
, BSTR
*name
)
5910 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5911 DWORD idx
= id
- MSHTML_DISPID_CUSTOM_MIN
;
5913 if(!This
->dom_document
|| idx
>= This
->elem_vars_cnt
)
5914 return DISP_E_MEMBERNOTFOUND
;
5916 return (*name
= SysAllocString(This
->elem_vars
[idx
])) ? S_OK
: E_OUTOFMEMORY
;
5919 static HRESULT
HTMLDocumentNode_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
5920 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
5922 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5923 nsIDOMElement
*nselem
;
5928 if(flags
!= DISPATCH_PROPERTYGET
&& flags
!= (DISPATCH_METHOD
|DISPATCH_PROPERTYGET
))
5929 return MSHTML_E_INVALID_PROPERTY
;
5931 i
= id
- MSHTML_DISPID_CUSTOM_MIN
;
5933 if(!This
->html_document
|| i
>= This
->elem_vars_cnt
)
5934 return DISP_E_MEMBERNOTFOUND
;
5936 hres
= get_elem_by_name_or_id(This
->html_document
, This
->elem_vars
[i
], &nselem
);
5940 return DISP_E_MEMBERNOTFOUND
;
5942 hres
= get_node((nsIDOMNode
*)nselem
, TRUE
, &node
);
5943 nsIDOMElement_Release(nselem
);
5947 V_VT(res
) = VT_DISPATCH
;
5948 V_DISPATCH(res
) = (IDispatch
*)&node
->IHTMLDOMNode_iface
;
5952 static HRESULT
HTMLDocumentNode_next_dispid(DispatchEx
*dispex
, DISPID id
, DISPID
*pid
)
5954 DWORD idx
= (id
== DISPID_STARTENUM
) ? 0 : id
- MSHTML_DISPID_CUSTOM_MIN
+ 1;
5955 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5956 nsIDOMNodeList
*node_list
= NULL
;
5957 const PRUnichar
*name
;
5958 nsIDOMElement
*nselem
;
5965 if(!This
->html_document
)
5968 while(idx
< This
->elem_vars_cnt
) {
5969 hres
= has_elem_name(This
->html_document
, This
->elem_vars
[idx
]);
5970 if(SUCCEEDED(hres
)) {
5971 *pid
= idx
+ MSHTML_DISPID_CUSTOM_MIN
;
5974 if(hres
!= DISP_E_UNKNOWNNAME
)
5979 /* Populate possibly missing DISPIDs */
5980 nsAString_InitDepend(&nsstr
, L
":-moz-any(applet,embed,form,iframe,img,object)[name]");
5981 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->html_document
, &nsstr
, &node_list
);
5982 nsAString_Finish(&nsstr
);
5983 if(NS_FAILED(nsres
)) {
5985 nsIDOMNodeList_Release(node_list
);
5986 return map_nsresult(nsres
);
5989 for(i
= 0, hres
= S_OK
; SUCCEEDED(hres
); i
++) {
5990 nsres
= nsIDOMNodeList_Item(node_list
, i
, &nsnode
);
5991 if(NS_FAILED(nsres
)) {
5992 hres
= map_nsresult(nsres
);
5998 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMElement
, (void**)&nselem
);
5999 nsIDOMNode_Release(nsnode
);
6003 nsres
= get_elem_attr_value(nselem
, L
"name", &nsstr
, &name
);
6004 nsIDOMElement_Release(nselem
);
6005 if(NS_FAILED(nsres
))
6006 hres
= map_nsresult(nsres
);
6008 hres
= dispid_from_elem_name(This
, name
, &id
);
6009 nsAString_Finish(&nsstr
);
6012 nsIDOMNodeList_Release(node_list
);
6016 if(idx
>= This
->elem_vars_cnt
)
6019 *pid
= idx
+ MSHTML_DISPID_CUSTOM_MIN
;
6023 static compat_mode_t
HTMLDocumentNode_get_compat_mode(DispatchEx
*dispex
)
6025 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6027 TRACE("(%p) returning %u\n", This
, This
->document_mode
);
6029 return lock_document_mode(This
);
6032 static nsISupports
*HTMLDocumentNode_get_gecko_target(DispatchEx
*dispex
)
6034 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6035 return (nsISupports
*)This
->node
.nsnode
;
6038 static void HTMLDocumentNode_bind_event(DispatchEx
*dispex
, eventid_t eid
)
6040 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6041 ensure_doc_nsevent_handler(This
, This
->node
.nsnode
, eid
);
6044 static EventTarget
*HTMLDocumentNode_get_parent_event_target(DispatchEx
*dispex
)
6046 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6049 IHTMLWindow2_AddRef(&This
->window
->base
.IHTMLWindow2_iface
);
6050 return &This
->window
->event_target
;
6053 static ConnectionPointContainer
*HTMLDocumentNode_get_cp_container(DispatchEx
*dispex
)
6055 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6056 ConnectionPointContainer
*container
= This
->doc_obj
6057 ? &This
->doc_obj
->cp_container
: &This
->cp_container
;
6058 IConnectionPointContainer_AddRef(&container
->IConnectionPointContainer_iface
);
6062 static IHTMLEventObj
*HTMLDocumentNode_set_current_event(DispatchEx
*dispex
, IHTMLEventObj
*event
)
6064 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6065 return default_set_current_event(This
->window
, event
);
6068 static HRESULT
HTMLDocumentNode_location_hook(DispatchEx
*dispex
, WORD flags
, DISPPARAMS
*dp
, VARIANT
*res
,
6069 EXCEPINFO
*ei
, IServiceProvider
*caller
)
6071 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6073 if(!(flags
& DISPATCH_PROPERTYPUT
) || !This
->outer_window
)
6076 return IDispatchEx_InvokeEx(&This
->outer_window
->base
.IDispatchEx_iface
, DISPID_IHTMLWINDOW2_LOCATION
,
6077 0, flags
, dp
, res
, ei
, caller
);
6080 static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl
= {
6082 .query_interface
= HTMLDocumentNode_query_interface
,
6083 .destructor
= HTMLDocumentNode_destructor
,
6084 .traverse
= HTMLDocumentNode_traverse
,
6085 .unlink
= HTMLDocumentNode_unlink
,
6086 .get_name
= HTMLDocumentNode_get_name
,
6087 .invoke
= HTMLDocumentNode_invoke
,
6088 .next_dispid
= HTMLDocumentNode_next_dispid
,
6089 .get_compat_mode
= HTMLDocumentNode_get_compat_mode
,
6091 .get_gecko_target
= HTMLDocumentNode_get_gecko_target
,
6092 .bind_event
= HTMLDocumentNode_bind_event
,
6093 .get_parent_event_target
= HTMLDocumentNode_get_parent_event_target
,
6094 .get_cp_container
= HTMLDocumentNode_get_cp_container
,
6095 .set_current_event
= HTMLDocumentNode_set_current_event
6098 static const NodeImplVtbl HTMLDocumentFragmentImplVtbl
= {
6099 .clsid
= &CLSID_HTMLDocument
,
6100 .cpc_entries
= HTMLDocumentNode_cpc
,
6101 .clone
= HTMLDocumentFragment_clone
,
6104 static const tid_t HTMLDocumentNode_iface_tids
[] = {
6109 IDocumentSelector_tid
,
6113 static void HTMLDocumentNode_init_dispex_info(dispex_data_t
*info
, compat_mode_t mode
)
6115 static const dispex_hook_t document2_hooks
[] = {
6116 {DISPID_IHTMLDOCUMENT2_URL
, NULL
, L
"URL"},
6117 {DISPID_IHTMLDOCUMENT2_LOCATION
, HTMLDocumentNode_location_hook
},
6120 static const dispex_hook_t document2_ie11_hooks
[] = {
6121 {DISPID_IHTMLDOCUMENT2_URL
, NULL
, L
"URL"},
6122 {DISPID_IHTMLDOCUMENT2_LOCATION
, HTMLDocumentNode_location_hook
},
6123 {DISPID_IHTMLDOCUMENT2_CREATESTYLESHEET
, NULL
},
6124 {DISPID_IHTMLDOCUMENT2_FILESIZE
, NULL
},
6125 {DISPID_IHTMLDOCUMENT2_SELECTION
, NULL
},
6128 static const dispex_hook_t document3_ie11_hooks
[] = {
6129 {DISPID_IHTMLDOCUMENT3_ATTACHEVENT
, NULL
},
6130 {DISPID_IHTMLDOCUMENT3_DETACHEVENT
, NULL
},
6133 static const dispex_hook_t document6_ie9_hooks
[] = {
6134 {DISPID_IHTMLDOCUMENT6_ONSTORAGE
},
6138 HTMLDOMNode_init_dispex_info(info
, mode
);
6140 if(mode
>= COMPAT_MODE_IE9
) {
6141 dispex_info_add_interface(info
, IHTMLDocument7_tid
, NULL
);
6142 dispex_info_add_interface(info
, IDocumentEvent_tid
, NULL
);
6145 /* Depending on compatibility version, we add interfaces in different order
6146 * so that the right getElementById implementation is used. */
6147 if(mode
< COMPAT_MODE_IE8
) {
6148 dispex_info_add_interface(info
, IHTMLDocument3_tid
, NULL
);
6149 dispex_info_add_interface(info
, IHTMLDocument6_tid
, NULL
);
6151 dispex_info_add_interface(info
, IHTMLDocument6_tid
, mode
>= COMPAT_MODE_IE9
? document6_ie9_hooks
: NULL
);
6152 dispex_info_add_interface(info
, IHTMLDocument3_tid
, mode
>= COMPAT_MODE_IE11
? document3_ie11_hooks
: NULL
);
6154 dispex_info_add_interface(info
, IHTMLDocument2_tid
, mode
>= COMPAT_MODE_IE11
? document2_ie11_hooks
: document2_hooks
);
6157 static dispex_static_data_t HTMLDocumentNode_dispex
= {
6159 &HTMLDocumentNode_event_target_vtbl
.dispex_vtbl
,
6160 DispHTMLDocument_tid
,
6161 HTMLDocumentNode_iface_tids
,
6162 HTMLDocumentNode_init_dispex_info
6165 static HTMLDocumentNode
*alloc_doc_node(HTMLDocumentObj
*doc_obj
, HTMLInnerWindow
*window
)
6167 HTMLDocumentNode
*doc
;
6169 doc
= calloc(1, sizeof(HTMLDocumentNode
));
6173 doc
->IDispatchEx_iface
.lpVtbl
= &DocDispatchExVtbl
;
6174 doc
->IHTMLDocument2_iface
.lpVtbl
= &HTMLDocumentVtbl
;
6175 doc
->IHTMLDocument3_iface
.lpVtbl
= &HTMLDocument3Vtbl
;
6176 doc
->IHTMLDocument4_iface
.lpVtbl
= &HTMLDocument4Vtbl
;
6177 doc
->IHTMLDocument5_iface
.lpVtbl
= &HTMLDocument5Vtbl
;
6178 doc
->IHTMLDocument6_iface
.lpVtbl
= &HTMLDocument6Vtbl
;
6179 doc
->IHTMLDocument7_iface
.lpVtbl
= &HTMLDocument7Vtbl
;
6180 doc
->IDocumentSelector_iface
.lpVtbl
= &DocumentSelectorVtbl
;
6181 doc
->IDocumentEvent_iface
.lpVtbl
= &DocumentEventVtbl
;
6182 doc
->ISupportErrorInfo_iface
.lpVtbl
= &SupportErrorInfoVtbl
;
6183 doc
->IProvideMultipleClassInfo_iface
.lpVtbl
= &ProvideMultipleClassInfoVtbl
;
6184 doc
->IMarkupServices_iface
.lpVtbl
= &MarkupServicesVtbl
;
6185 doc
->IMarkupContainer_iface
.lpVtbl
= &MarkupContainerVtbl
;
6186 doc
->IDisplayServices_iface
.lpVtbl
= &DisplayServicesVtbl
;
6187 doc
->IDocumentRange_iface
.lpVtbl
= &DocumentRangeVtbl
;
6189 doc
->doc_obj
= doc_obj
;
6190 doc
->outer_window
= window
? window
->base
.outer_window
: NULL
;
6191 doc
->window
= window
;
6194 IHTMLWindow2_AddRef(&window
->base
.IHTMLWindow2_iface
);
6196 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)&doc
->IHTMLDocument2_iface
, HTMLDocumentNode_cpc
);
6197 HTMLDocumentNode_Persist_Init(doc
);
6198 HTMLDocumentNode_Service_Init(doc
);
6199 HTMLDocumentNode_OleCmd_Init(doc
);
6200 HTMLDocumentNode_OleObj_Init(doc
);
6201 HTMLDocumentNode_SecMgr_Init(doc
);
6203 list_init(&doc
->selection_list
);
6204 list_init(&doc
->range_list
);
6205 list_init(&doc
->plugin_hosts
);
6210 HRESULT
create_document_node(nsIDOMDocument
*nsdoc
, GeckoBrowser
*browser
, HTMLInnerWindow
*window
,
6211 compat_mode_t parent_mode
, HTMLDocumentNode
**ret
)
6213 HTMLDocumentObj
*doc_obj
= browser
->doc
;
6214 HTMLDocumentNode
*doc
;
6216 doc
= alloc_doc_node(doc_obj
, window
);
6218 return E_OUTOFMEMORY
;
6220 if(parent_mode
>= COMPAT_MODE_IE9
) {
6221 TRACE("using parent mode %u\n", parent_mode
);
6222 doc
->document_mode
= parent_mode
;
6223 lock_document_mode(doc
);
6226 if(doc_obj
&& (!doc_obj
->window
|| (window
&& is_main_content_window(window
->base
.outer_window
))))
6227 doc
->cp_container
.forward_container
= &doc_obj
->cp_container
;
6229 /* Share reference with HTMLDOMNode */
6230 if(NS_SUCCEEDED(nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMHTMLDocument
, (void**)&doc
->html_document
))) {
6231 doc
->dom_document
= (nsIDOMDocument
*)doc
->html_document
;
6232 nsIDOMHTMLDocument_Release(doc
->html_document
);
6234 doc
->dom_document
= nsdoc
;
6235 doc
->html_document
= NULL
;
6238 HTMLDOMNode_Init(doc
, &doc
->node
, (nsIDOMNode
*)doc
->dom_document
, &HTMLDocumentNode_dispex
);
6240 init_document_mutation(doc
);
6241 doc_init_events(doc
);
6243 doc
->node
.vtbl
= &HTMLDocumentNodeImplVtbl
;
6245 list_add_head(&browser
->document_nodes
, &doc
->browser_entry
);
6246 doc
->browser
= browser
;
6248 if(browser
->usermode
== EDITMODE
&& doc
->html_document
) {
6252 nsAString_InitDepend(&mode_str
, L
"on");
6253 nsres
= nsIDOMHTMLDocument_SetDesignMode(doc
->html_document
, &mode_str
);
6254 nsAString_Finish(&mode_str
);
6255 if(NS_FAILED(nsres
))
6256 ERR("SetDesignMode failed: %08lx\n", nsres
);
6263 static HRESULT
create_document_fragment(nsIDOMNode
*nsnode
, HTMLDocumentNode
*doc_node
, HTMLDocumentNode
**ret
)
6265 HTMLDocumentNode
*doc_frag
;
6267 doc_frag
= alloc_doc_node(doc_node
->doc_obj
, doc_node
->window
);
6269 return E_OUTOFMEMORY
;
6271 HTMLDOMNode_Init(doc_node
, &doc_frag
->node
, nsnode
, &HTMLDocumentNode_dispex
);
6272 doc_frag
->node
.vtbl
= &HTMLDocumentFragmentImplVtbl
;
6273 doc_frag
->document_mode
= lock_document_mode(doc_node
);
6279 HRESULT
get_document_node(nsIDOMDocument
*dom_document
, HTMLDocumentNode
**ret
)
6284 hres
= get_node((nsIDOMNode
*)dom_document
, FALSE
, &node
);
6289 ERR("document not initialized\n");
6293 assert(node
->vtbl
== &HTMLDocumentNodeImplVtbl
);
6294 *ret
= impl_from_HTMLDOMNode(node
);