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
;
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
);
2721 *ppelColl
= create_collection_from_nodelist(node_list
, This
->document_mode
);
2722 nsIDOMNodeList_Release(node_list
);
2727 static HRESULT WINAPI
HTMLDocument3_getElementById(IHTMLDocument3
*iface
, BSTR v
, IHTMLElement
**pel
)
2729 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2733 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
2735 hres
= get_doc_elem_by_id(This
, v
, &elem
);
2736 if(FAILED(hres
) || !elem
) {
2741 *pel
= &elem
->IHTMLElement_iface
;
2746 static HRESULT WINAPI
HTMLDocument3_getElementsByTagName(IHTMLDocument3
*iface
, BSTR v
,
2747 IHTMLElementCollection
**pelColl
)
2749 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2750 nsIDOMNodeList
*nslist
;
2754 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
2756 if(This
->dom_document
) {
2757 nsAString_InitDepend(&id_str
, v
);
2758 nsres
= nsIDOMDocument_GetElementsByTagName(This
->dom_document
, &id_str
, &nslist
);
2759 nsAString_Finish(&id_str
);
2761 ERR("GetElementByName failed: %08lx\n", nsres
);
2765 nsIDOMDocumentFragment
*docfrag
;
2770 for(ptr
=v
; *ptr
; ptr
++) {
2771 if(!iswalnum(*ptr
)) {
2772 FIXME("Unsupported invalid tag %s\n", debugstr_w(v
));
2778 nsres
= nsIDOMNode_QueryInterface(This
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&docfrag
);
2779 if(NS_FAILED(nsres
)) {
2780 ERR("Could not get nsIDOMDocumentFragment iface: %08lx\n", nsres
);
2781 return E_UNEXPECTED
;
2784 nsAString_InitDepend(&nsstr
, v
);
2785 nsres
= nsIDOMDocumentFragment_QuerySelectorAll(docfrag
, &nsstr
, &nslist
);
2786 nsAString_Finish(&nsstr
);
2787 nsIDOMDocumentFragment_Release(docfrag
);
2788 if(NS_FAILED(nsres
)) {
2789 ERR("QuerySelectorAll failed: %08lx\n", nsres
);
2795 *pelColl
= create_collection_from_nodelist(nslist
, This
->document_mode
);
2796 nsIDOMNodeList_Release(nslist
);
2801 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl
= {
2802 HTMLDocument3_QueryInterface
,
2803 HTMLDocument3_AddRef
,
2804 HTMLDocument3_Release
,
2805 HTMLDocument3_GetTypeInfoCount
,
2806 HTMLDocument3_GetTypeInfo
,
2807 HTMLDocument3_GetIDsOfNames
,
2808 HTMLDocument3_Invoke
,
2809 HTMLDocument3_releaseCapture
,
2810 HTMLDocument3_recalc
,
2811 HTMLDocument3_createTextNode
,
2812 HTMLDocument3_get_documentElement
,
2813 HTMLDocument3_get_uniqueID
,
2814 HTMLDocument3_attachEvent
,
2815 HTMLDocument3_detachEvent
,
2816 HTMLDocument3_put_onrowsdelete
,
2817 HTMLDocument3_get_onrowsdelete
,
2818 HTMLDocument3_put_onrowsinserted
,
2819 HTMLDocument3_get_onrowsinserted
,
2820 HTMLDocument3_put_oncellchange
,
2821 HTMLDocument3_get_oncellchange
,
2822 HTMLDocument3_put_ondatasetchanged
,
2823 HTMLDocument3_get_ondatasetchanged
,
2824 HTMLDocument3_put_ondataavailable
,
2825 HTMLDocument3_get_ondataavailable
,
2826 HTMLDocument3_put_ondatasetcomplete
,
2827 HTMLDocument3_get_ondatasetcomplete
,
2828 HTMLDocument3_put_onpropertychange
,
2829 HTMLDocument3_get_onpropertychange
,
2830 HTMLDocument3_put_dir
,
2831 HTMLDocument3_get_dir
,
2832 HTMLDocument3_put_oncontextmenu
,
2833 HTMLDocument3_get_oncontextmenu
,
2834 HTMLDocument3_put_onstop
,
2835 HTMLDocument3_get_onstop
,
2836 HTMLDocument3_createDocumentFragment
,
2837 HTMLDocument3_get_parentDocument
,
2838 HTMLDocument3_put_enableDownload
,
2839 HTMLDocument3_get_enableDownload
,
2840 HTMLDocument3_put_baseUrl
,
2841 HTMLDocument3_get_baseUrl
,
2842 HTMLDocument3_get_childNodes
,
2843 HTMLDocument3_put_inheritStyleSheets
,
2844 HTMLDocument3_get_inheritStyleSheets
,
2845 HTMLDocument3_put_onbeforeeditfocus
,
2846 HTMLDocument3_get_onbeforeeditfocus
,
2847 HTMLDocument3_getElementsByName
,
2848 HTMLDocument3_getElementById
,
2849 HTMLDocument3_getElementsByTagName
2852 static inline HTMLDocumentNode
*impl_from_IHTMLDocument4(IHTMLDocument4
*iface
)
2854 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument4_iface
);
2857 static HRESULT WINAPI
HTMLDocument4_QueryInterface(IHTMLDocument4
*iface
, REFIID riid
, void **ppv
)
2859 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2860 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
2863 static ULONG WINAPI
HTMLDocument4_AddRef(IHTMLDocument4
*iface
)
2865 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2866 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
2869 static ULONG WINAPI
HTMLDocument4_Release(IHTMLDocument4
*iface
)
2871 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2872 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
2875 static HRESULT WINAPI
HTMLDocument4_GetTypeInfoCount(IHTMLDocument4
*iface
, UINT
*pctinfo
)
2877 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2878 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2881 static HRESULT WINAPI
HTMLDocument4_GetTypeInfo(IHTMLDocument4
*iface
, UINT iTInfo
, LCID lcid
,
2882 ITypeInfo
**ppTInfo
)
2884 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2885 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2888 static HRESULT WINAPI
HTMLDocument4_GetIDsOfNames(IHTMLDocument4
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
2889 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2891 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2892 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
2895 static HRESULT WINAPI
HTMLDocument4_Invoke(IHTMLDocument4
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
2896 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2898 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2899 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2900 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2903 static HRESULT WINAPI
HTMLDocument4_focus(IHTMLDocument4
*iface
)
2905 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2906 nsIDOMHTMLElement
*nsbody
;
2909 TRACE("(%p)->()\n", This
);
2911 if(!This
->html_document
) {
2912 FIXME("Not implemented for XML document\n");
2916 nsres
= nsIDOMHTMLDocument_GetBody(This
->html_document
, &nsbody
);
2917 if(NS_FAILED(nsres
) || !nsbody
) {
2918 ERR("GetBody failed: %08lx\n", nsres
);
2922 nsres
= nsIDOMHTMLElement_Focus(nsbody
);
2923 nsIDOMHTMLElement_Release(nsbody
);
2924 if(NS_FAILED(nsres
)) {
2925 ERR("Focus failed: %08lx\n", nsres
);
2932 static HRESULT WINAPI
HTMLDocument4_hasFocus(IHTMLDocument4
*iface
, VARIANT_BOOL
*pfFocus
)
2934 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2938 TRACE("(%p)->(%p)\n", This
, pfFocus
);
2940 if(!This
->dom_document
) {
2941 FIXME("Unimplemented for fragments.\n");
2945 nsres
= nsIDOMDocument_HasFocus(This
->dom_document
, &has_focus
);
2946 assert(nsres
== NS_OK
);
2948 *pfFocus
= variant_bool(has_focus
);
2952 static HRESULT WINAPI
HTMLDocument4_put_onselectionchange(IHTMLDocument4
*iface
, VARIANT v
)
2954 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2956 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2958 return set_doc_event(This
, EVENTID_SELECTIONCHANGE
, &v
);
2961 static HRESULT WINAPI
HTMLDocument4_get_onselectionchange(IHTMLDocument4
*iface
, VARIANT
*p
)
2963 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2965 TRACE("(%p)->(%p)\n", This
, p
);
2967 return get_doc_event(This
, EVENTID_SELECTIONCHANGE
, p
);
2970 static HRESULT WINAPI
HTMLDocument4_get_namespaces(IHTMLDocument4
*iface
, IDispatch
**p
)
2972 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2974 TRACE("(%p)->(%p)\n", This
, p
);
2976 if(!This
->namespaces
) {
2979 hres
= create_namespace_collection(dispex_compat_mode(&This
->node
.event_target
.dispex
),
2985 IHTMLNamespaceCollection_AddRef(This
->namespaces
);
2986 *p
= (IDispatch
*)This
->namespaces
;
2990 static HRESULT WINAPI
HTMLDocument4_createDocumentFromUrl(IHTMLDocument4
*iface
, BSTR bstrUrl
,
2991 BSTR bstrOptions
, IHTMLDocument2
**newDoc
)
2993 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2994 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrUrl
), debugstr_w(bstrOptions
), newDoc
);
2998 static HRESULT WINAPI
HTMLDocument4_put_media(IHTMLDocument4
*iface
, BSTR v
)
3000 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3001 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
3005 static HRESULT WINAPI
HTMLDocument4_get_media(IHTMLDocument4
*iface
, BSTR
*p
)
3007 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3008 FIXME("(%p)->(%p)\n", This
, p
);
3012 static HRESULT WINAPI
HTMLDocument4_createEventObject(IHTMLDocument4
*iface
,
3013 VARIANT
*pvarEventObject
, IHTMLEventObj
**ppEventObj
)
3015 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3017 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(pvarEventObject
), ppEventObj
);
3019 if(pvarEventObject
&& V_VT(pvarEventObject
) != VT_ERROR
&& V_VT(pvarEventObject
) != VT_EMPTY
) {
3020 FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject
));
3024 return create_event_obj(dispex_compat_mode(&This
->node
.event_target
.dispex
), ppEventObj
);
3027 static HRESULT WINAPI
HTMLDocument4_fireEvent(IHTMLDocument4
*iface
, BSTR bstrEventName
,
3028 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCanceled
)
3030 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3032 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrEventName
), pvarEventObject
, pfCanceled
);
3034 return fire_event(&This
->node
, bstrEventName
, pvarEventObject
, pfCanceled
);
3037 static HRESULT WINAPI
HTMLDocument4_createRenderStyle(IHTMLDocument4
*iface
, BSTR v
,
3038 IHTMLRenderStyle
**ppIHTMLRenderStyle
)
3040 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3041 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppIHTMLRenderStyle
);
3045 static HRESULT WINAPI
HTMLDocument4_put_oncontrolselect(IHTMLDocument4
*iface
, VARIANT v
)
3047 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3048 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3052 static HRESULT WINAPI
HTMLDocument4_get_oncontrolselect(IHTMLDocument4
*iface
, VARIANT
*p
)
3054 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3055 FIXME("(%p)->(%p)\n", This
, p
);
3059 static HRESULT WINAPI
HTMLDocument4_get_URLUnencoded(IHTMLDocument4
*iface
, BSTR
*p
)
3061 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
3062 FIXME("(%p)->(%p)\n", This
, p
);
3066 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl
= {
3067 HTMLDocument4_QueryInterface
,
3068 HTMLDocument4_AddRef
,
3069 HTMLDocument4_Release
,
3070 HTMLDocument4_GetTypeInfoCount
,
3071 HTMLDocument4_GetTypeInfo
,
3072 HTMLDocument4_GetIDsOfNames
,
3073 HTMLDocument4_Invoke
,
3074 HTMLDocument4_focus
,
3075 HTMLDocument4_hasFocus
,
3076 HTMLDocument4_put_onselectionchange
,
3077 HTMLDocument4_get_onselectionchange
,
3078 HTMLDocument4_get_namespaces
,
3079 HTMLDocument4_createDocumentFromUrl
,
3080 HTMLDocument4_put_media
,
3081 HTMLDocument4_get_media
,
3082 HTMLDocument4_createEventObject
,
3083 HTMLDocument4_fireEvent
,
3084 HTMLDocument4_createRenderStyle
,
3085 HTMLDocument4_put_oncontrolselect
,
3086 HTMLDocument4_get_oncontrolselect
,
3087 HTMLDocument4_get_URLUnencoded
3090 static inline HTMLDocumentNode
*impl_from_IHTMLDocument5(IHTMLDocument5
*iface
)
3092 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument5_iface
);
3095 static HRESULT WINAPI
HTMLDocument5_QueryInterface(IHTMLDocument5
*iface
, REFIID riid
, void **ppv
)
3097 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3098 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
3101 static ULONG WINAPI
HTMLDocument5_AddRef(IHTMLDocument5
*iface
)
3103 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3104 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
3107 static ULONG WINAPI
HTMLDocument5_Release(IHTMLDocument5
*iface
)
3109 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3110 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
3113 static HRESULT WINAPI
HTMLDocument5_GetTypeInfoCount(IHTMLDocument5
*iface
, UINT
*pctinfo
)
3115 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3116 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3119 static HRESULT WINAPI
HTMLDocument5_GetTypeInfo(IHTMLDocument5
*iface
, UINT iTInfo
, LCID lcid
,
3120 ITypeInfo
**ppTInfo
)
3122 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3123 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3126 static HRESULT WINAPI
HTMLDocument5_GetIDsOfNames(IHTMLDocument5
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
3127 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3129 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3130 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3133 static HRESULT WINAPI
HTMLDocument5_Invoke(IHTMLDocument5
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
3134 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3136 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3137 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3138 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3141 static HRESULT WINAPI
HTMLDocument5_put_onmousewheel(IHTMLDocument5
*iface
, VARIANT v
)
3143 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3145 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3147 return set_doc_event(This
, EVENTID_MOUSEWHEEL
, &v
);
3150 static HRESULT WINAPI
HTMLDocument5_get_onmousewheel(IHTMLDocument5
*iface
, VARIANT
*p
)
3152 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3154 TRACE("(%p)->(%p)\n", This
, p
);
3156 return get_doc_event(This
, EVENTID_MOUSEWHEEL
, p
);
3159 static HRESULT WINAPI
HTMLDocument5_get_doctype(IHTMLDocument5
*iface
, IHTMLDOMNode
**p
)
3161 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3162 nsIDOMDocumentType
*nsdoctype
;
3163 HTMLDOMNode
*doctype_node
;
3167 TRACE("(%p)->(%p)\n", This
, p
);
3169 if(dispex_compat_mode(&This
->node
.event_target
.dispex
) < COMPAT_MODE_IE9
) {
3174 nsres
= nsIDOMDocument_GetDoctype(This
->dom_document
, &nsdoctype
);
3175 if(NS_FAILED(nsres
))
3176 return map_nsresult(nsres
);
3182 hres
= get_node((nsIDOMNode
*)nsdoctype
, TRUE
, &doctype_node
);
3183 nsIDOMDocumentType_Release(nsdoctype
);
3186 *p
= &doctype_node
->IHTMLDOMNode_iface
;
3190 static HRESULT WINAPI
HTMLDocument5_get_implementation(IHTMLDocument5
*iface
, IHTMLDOMImplementation
**p
)
3192 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3194 TRACE("(%p)->(%p)\n", This
, p
);
3196 if(!This
->dom_implementation
) {
3199 hres
= create_dom_implementation(This
, &This
->dom_implementation
);
3204 IHTMLDOMImplementation_AddRef(This
->dom_implementation
);
3205 *p
= This
->dom_implementation
;
3209 static HRESULT WINAPI
HTMLDocument5_createAttribute(IHTMLDocument5
*iface
, BSTR bstrattrName
,
3210 IHTMLDOMAttribute
**ppattribute
)
3212 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3213 HTMLDOMAttribute
*attr
;
3216 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrattrName
), ppattribute
);
3218 hres
= HTMLDOMAttribute_Create(bstrattrName
, NULL
, 0, dispex_compat_mode(&This
->node
.event_target
.dispex
), &attr
);
3222 *ppattribute
= &attr
->IHTMLDOMAttribute_iface
;
3226 static HRESULT WINAPI
HTMLDocument5_createComment(IHTMLDocument5
*iface
, BSTR bstrdata
,
3227 IHTMLDOMNode
**ppRetNode
)
3229 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3230 nsIDOMComment
*nscomment
;
3236 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrdata
), ppRetNode
);
3238 if(!This
->dom_document
) {
3239 WARN("NULL dom_document\n");
3240 return E_UNEXPECTED
;
3243 nsAString_InitDepend(&str
, bstrdata
);
3244 nsres
= nsIDOMDocument_CreateComment(This
->dom_document
, &str
, &nscomment
);
3245 nsAString_Finish(&str
);
3246 if(NS_FAILED(nsres
)) {
3247 ERR("CreateTextNode failed: %08lx\n", nsres
);
3251 hres
= HTMLCommentElement_Create(This
, (nsIDOMNode
*)nscomment
, &elem
);
3252 nsIDOMComment_Release(nscomment
);
3256 *ppRetNode
= &elem
->node
.IHTMLDOMNode_iface
;
3260 static HRESULT WINAPI
HTMLDocument5_put_onfocusin(IHTMLDocument5
*iface
, VARIANT v
)
3262 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3264 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3266 return set_doc_event(This
, EVENTID_FOCUSIN
, &v
);
3269 static HRESULT WINAPI
HTMLDocument5_get_onfocusin(IHTMLDocument5
*iface
, VARIANT
*p
)
3271 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3273 TRACE("(%p)->(%p)\n", This
, p
);
3275 return get_doc_event(This
, EVENTID_FOCUSIN
, p
);
3278 static HRESULT WINAPI
HTMLDocument5_put_onfocusout(IHTMLDocument5
*iface
, VARIANT v
)
3280 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3282 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3284 return set_doc_event(This
, EVENTID_FOCUSOUT
, &v
);
3287 static HRESULT WINAPI
HTMLDocument5_get_onfocusout(IHTMLDocument5
*iface
, VARIANT
*p
)
3289 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3291 TRACE("(%p)->(%p)\n", This
, p
);
3293 return get_doc_event(This
, EVENTID_FOCUSOUT
, p
);
3296 static HRESULT WINAPI
HTMLDocument5_put_onactivate(IHTMLDocument5
*iface
, VARIANT v
)
3298 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3299 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3303 static HRESULT WINAPI
HTMLDocument5_get_onactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3305 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3306 FIXME("(%p)->(%p)\n", This
, p
);
3310 static HRESULT WINAPI
HTMLDocument5_put_ondeactivate(IHTMLDocument5
*iface
, VARIANT v
)
3312 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3313 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3317 static HRESULT WINAPI
HTMLDocument5_get_ondeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3319 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3320 FIXME("(%p)->(%p)\n", This
, p
);
3324 static HRESULT WINAPI
HTMLDocument5_put_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT v
)
3326 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3327 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3331 static HRESULT WINAPI
HTMLDocument5_get_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3333 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3334 FIXME("(%p)->(%p)\n", This
, p
);
3338 static HRESULT WINAPI
HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT v
)
3340 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3341 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3345 static HRESULT WINAPI
HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3347 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3348 FIXME("(%p)->(%p)\n", This
, p
);
3352 static HRESULT WINAPI
HTMLDocument5_get_compatMode(IHTMLDocument5
*iface
, BSTR
*p
)
3354 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3356 TRACE("(%p)->(%p)\n", This
, p
);
3358 *p
= SysAllocString(This
->document_mode
<= COMPAT_MODE_IE5
? L
"BackCompat" : L
"CSS1Compat");
3359 return *p
? S_OK
: E_OUTOFMEMORY
;
3362 static const IHTMLDocument5Vtbl HTMLDocument5Vtbl
= {
3363 HTMLDocument5_QueryInterface
,
3364 HTMLDocument5_AddRef
,
3365 HTMLDocument5_Release
,
3366 HTMLDocument5_GetTypeInfoCount
,
3367 HTMLDocument5_GetTypeInfo
,
3368 HTMLDocument5_GetIDsOfNames
,
3369 HTMLDocument5_Invoke
,
3370 HTMLDocument5_put_onmousewheel
,
3371 HTMLDocument5_get_onmousewheel
,
3372 HTMLDocument5_get_doctype
,
3373 HTMLDocument5_get_implementation
,
3374 HTMLDocument5_createAttribute
,
3375 HTMLDocument5_createComment
,
3376 HTMLDocument5_put_onfocusin
,
3377 HTMLDocument5_get_onfocusin
,
3378 HTMLDocument5_put_onfocusout
,
3379 HTMLDocument5_get_onfocusout
,
3380 HTMLDocument5_put_onactivate
,
3381 HTMLDocument5_get_onactivate
,
3382 HTMLDocument5_put_ondeactivate
,
3383 HTMLDocument5_get_ondeactivate
,
3384 HTMLDocument5_put_onbeforeactivate
,
3385 HTMLDocument5_get_onbeforeactivate
,
3386 HTMLDocument5_put_onbeforedeactivate
,
3387 HTMLDocument5_get_onbeforedeactivate
,
3388 HTMLDocument5_get_compatMode
3391 static inline HTMLDocumentNode
*impl_from_IHTMLDocument6(IHTMLDocument6
*iface
)
3393 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument6_iface
);
3396 static HRESULT WINAPI
HTMLDocument6_QueryInterface(IHTMLDocument6
*iface
, REFIID riid
, void **ppv
)
3398 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3399 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
3402 static ULONG WINAPI
HTMLDocument6_AddRef(IHTMLDocument6
*iface
)
3404 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3405 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
3408 static ULONG WINAPI
HTMLDocument6_Release(IHTMLDocument6
*iface
)
3410 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3411 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
3414 static HRESULT WINAPI
HTMLDocument6_GetTypeInfoCount(IHTMLDocument6
*iface
, UINT
*pctinfo
)
3416 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3417 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3420 static HRESULT WINAPI
HTMLDocument6_GetTypeInfo(IHTMLDocument6
*iface
, UINT iTInfo
, LCID lcid
,
3421 ITypeInfo
**ppTInfo
)
3423 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3424 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3427 static HRESULT WINAPI
HTMLDocument6_GetIDsOfNames(IHTMLDocument6
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
3428 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3430 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3431 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3434 static HRESULT WINAPI
HTMLDocument6_Invoke(IHTMLDocument6
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
3435 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3437 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3438 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3439 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3442 static HRESULT WINAPI
HTMLDocument6_get_compatible(IHTMLDocument6
*iface
,
3443 IHTMLDocumentCompatibleInfoCollection
**p
)
3445 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3446 FIXME("(%p)->(%p)\n", This
, p
);
3450 static HRESULT WINAPI
HTMLDocument6_get_documentMode(IHTMLDocument6
*iface
, VARIANT
*p
)
3452 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3454 TRACE("(%p)->(%p)\n", This
, p
);
3457 V_R4(p
) = compat_mode_info
[This
->document_mode
].document_mode
;
3461 static HRESULT WINAPI
HTMLDocument6_get_onstorage(IHTMLDocument6
*iface
,
3464 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3466 TRACE("(%p)->(%p)\n", This
, p
);
3468 return get_doc_event(This
, EVENTID_STORAGE
, p
);
3471 static HRESULT WINAPI
HTMLDocument6_put_onstorage(IHTMLDocument6
*iface
, VARIANT v
)
3473 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3475 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3477 return set_doc_event(This
, EVENTID_STORAGE
, &v
);
3480 static HRESULT WINAPI
HTMLDocument6_get_onstoragecommit(IHTMLDocument6
*iface
,
3483 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3485 TRACE("(%p)->(%p)\n", This
, p
);
3487 return get_doc_event(This
, EVENTID_STORAGECOMMIT
, p
);
3490 static HRESULT WINAPI
HTMLDocument6_put_onstoragecommit(IHTMLDocument6
*iface
, VARIANT v
)
3492 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3494 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3496 return set_doc_event(This
, EVENTID_STORAGECOMMIT
, &v
);
3499 static HRESULT WINAPI
HTMLDocument6_getElementById(IHTMLDocument6
*iface
,
3500 BSTR bstrId
, IHTMLElement2
**p
)
3502 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3503 nsIDOMElement
*nselem
;
3509 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrId
), p
);
3512 * Unlike IHTMLDocument3 implementation, this is standard compliant and does
3513 * not search for name attributes, so we may simply let Gecko do the right thing.
3516 if(!This
->dom_document
) {
3517 FIXME("Not a document\n");
3521 nsAString_InitDepend(&nsstr
, bstrId
);
3522 nsres
= nsIDOMDocument_GetElementById(This
->dom_document
, &nsstr
, &nselem
);
3523 nsAString_Finish(&nsstr
);
3524 if(NS_FAILED(nsres
)) {
3525 ERR("GetElementById failed: %08lx\n", nsres
);
3534 hres
= get_element(nselem
, &elem
);
3535 nsIDOMElement_Release(nselem
);
3539 *p
= &elem
->IHTMLElement2_iface
;
3543 static HRESULT WINAPI
HTMLDocument6_updateSettings(IHTMLDocument6
*iface
)
3545 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3546 FIXME("(%p)->()\n", This
);
3550 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl
= {
3551 HTMLDocument6_QueryInterface
,
3552 HTMLDocument6_AddRef
,
3553 HTMLDocument6_Release
,
3554 HTMLDocument6_GetTypeInfoCount
,
3555 HTMLDocument6_GetTypeInfo
,
3556 HTMLDocument6_GetIDsOfNames
,
3557 HTMLDocument6_Invoke
,
3558 HTMLDocument6_get_compatible
,
3559 HTMLDocument6_get_documentMode
,
3560 HTMLDocument6_put_onstorage
,
3561 HTMLDocument6_get_onstorage
,
3562 HTMLDocument6_put_onstoragecommit
,
3563 HTMLDocument6_get_onstoragecommit
,
3564 HTMLDocument6_getElementById
,
3565 HTMLDocument6_updateSettings
3568 static inline HTMLDocumentNode
*impl_from_IHTMLDocument7(IHTMLDocument7
*iface
)
3570 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument7_iface
);
3573 static HRESULT WINAPI
HTMLDocument7_QueryInterface(IHTMLDocument7
*iface
, REFIID riid
, void **ppv
)
3575 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3576 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
3579 static ULONG WINAPI
HTMLDocument7_AddRef(IHTMLDocument7
*iface
)
3581 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3582 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
3585 static ULONG WINAPI
HTMLDocument7_Release(IHTMLDocument7
*iface
)
3587 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3588 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
3591 static HRESULT WINAPI
HTMLDocument7_GetTypeInfoCount(IHTMLDocument7
*iface
, UINT
*pctinfo
)
3593 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3594 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3597 static HRESULT WINAPI
HTMLDocument7_GetTypeInfo(IHTMLDocument7
*iface
, UINT iTInfo
, LCID lcid
,
3598 ITypeInfo
**ppTInfo
)
3600 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3601 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3604 static HRESULT WINAPI
HTMLDocument7_GetIDsOfNames(IHTMLDocument7
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
3605 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3607 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3608 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
3611 static HRESULT WINAPI
HTMLDocument7_Invoke(IHTMLDocument7
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
3612 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3614 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3615 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3616 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3619 static HRESULT WINAPI
HTMLDocument7_get_defaultView(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
3621 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3623 TRACE("(%p)->(%p)\n", This
, p
);
3625 if(This
->window
&& This
->window
->base
.outer_window
) {
3626 *p
= &This
->window
->base
.outer_window
->base
.IHTMLWindow2_iface
;
3627 IHTMLWindow2_AddRef(*p
);
3634 static HRESULT WINAPI
HTMLDocument7_createCDATASection(IHTMLDocument7
*iface
, BSTR text
, IHTMLDOMNode
**newCDATASectionNode
)
3636 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3637 FIXME("(%p)->(%p)\n", This
, newCDATASectionNode
);
3641 static HRESULT WINAPI
HTMLDocument7_getSelection(IHTMLDocument7
*iface
, IHTMLSelection
**ppIHTMLSelection
)
3643 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3644 FIXME("(%p)->(%p)\n", This
, ppIHTMLSelection
);
3648 static HRESULT WINAPI
HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3649 BSTR bstrLocalName
, IHTMLElementCollection
**pelColl
)
3651 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3652 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrLocalName
), pelColl
);
3656 static HRESULT WINAPI
HTMLDocument7_createElementNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
, BSTR bstrTag
, IHTMLElement
**newElem
)
3658 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3659 nsIDOMElement
*dom_element
;
3660 HTMLElement
*element
;
3665 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrTag
), newElem
);
3667 if(!This
->dom_document
) {
3668 FIXME("NULL dom_document\n");
3672 if(pvarNS
&& V_VT(pvarNS
) != VT_NULL
&& V_VT(pvarNS
) != VT_BSTR
)
3673 FIXME("Unsupported namespace %s\n", debugstr_variant(pvarNS
));
3675 nsAString_InitDepend(&ns
, pvarNS
&& V_VT(pvarNS
) == VT_BSTR
? V_BSTR(pvarNS
) : NULL
);
3676 nsAString_InitDepend(&tag
, bstrTag
);
3677 nsres
= nsIDOMDocument_CreateElementNS(This
->dom_document
, &ns
, &tag
, &dom_element
);
3678 nsAString_Finish(&ns
);
3679 nsAString_Finish(&tag
);
3680 if(NS_FAILED(nsres
)) {
3681 WARN("CreateElementNS failed: %08lx\n", nsres
);
3682 return map_nsresult(nsres
);
3685 hres
= HTMLElement_Create(This
, (nsIDOMNode
*)dom_element
, FALSE
, &element
);
3686 nsIDOMElement_Release(dom_element
);
3690 *newElem
= &element
->IHTMLElement_iface
;
3694 static HRESULT WINAPI
HTMLDocument7_createAttributeNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3695 BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3697 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3698 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrAttrName
), ppAttribute
);
3702 static HRESULT WINAPI
HTMLDocument7_put_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT v
)
3704 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3705 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3709 static HRESULT WINAPI
HTMLDocument7_get_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT
*p
)
3711 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3713 TRACE("(%p)->(%p)\n", This
, p
);
3715 return get_doc_event(This
, EVENTID_MSTHUMBNAILCLICK
, p
);
3718 static HRESULT WINAPI
HTMLDocument7_get_characterSet(IHTMLDocument7
*iface
, BSTR
*p
)
3720 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3721 nsAString charset_str
;
3724 TRACE("(%p)->(%p)\n", This
, p
);
3726 if(!This
->dom_document
) {
3727 FIXME("NULL dom_document\n");
3731 nsAString_Init(&charset_str
, NULL
);
3732 nsres
= nsIDOMDocument_GetCharacterSet(This
->dom_document
, &charset_str
);
3733 return return_nsstr(nsres
, &charset_str
, p
);
3736 static HRESULT WINAPI
HTMLDocument7_createElement(IHTMLDocument7
*iface
, BSTR bstrTag
, IHTMLElement
**newElem
)
3738 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3740 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrTag
), newElem
);
3742 return IHTMLDocument2_createElement(&This
->IHTMLDocument2_iface
, bstrTag
, newElem
);
3745 static HRESULT WINAPI
HTMLDocument7_createAttribute(IHTMLDocument7
*iface
, BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3747 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3749 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrAttrName
), ppAttribute
);
3751 return IHTMLDocument5_createAttribute(&This
->IHTMLDocument5_iface
, bstrAttrName
, ppAttribute
);
3754 static HRESULT WINAPI
HTMLDocument7_getElementsByClassName(IHTMLDocument7
*iface
, BSTR v
, IHTMLElementCollection
**pel
)
3756 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3757 nsIDOMNodeList
*nslist
;
3761 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
3763 if(!This
->dom_document
) {
3764 FIXME("NULL dom_document not supported\n");
3768 nsAString_InitDepend(&nsstr
, v
);
3769 nsres
= nsIDOMDocument_GetElementsByClassName(This
->dom_document
, &nsstr
, &nslist
);
3770 nsAString_Finish(&nsstr
);
3772 ERR("GetElementByClassName failed: %08lx\n", nsres
);
3777 *pel
= create_collection_from_nodelist(nslist
, This
->document_mode
);
3778 nsIDOMNodeList_Release(nslist
);
3782 static HRESULT WINAPI
HTMLDocument7_createProcessingInstruction(IHTMLDocument7
*iface
, BSTR target
,
3783 BSTR data
, IDOMProcessingInstruction
**newProcessingInstruction
)
3785 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3786 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(target
), debugstr_w(data
), newProcessingInstruction
);
3790 static HRESULT WINAPI
HTMLDocument7_adoptNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
, IHTMLDOMNode3
**ppNodeDest
)
3792 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3793 FIXME("(%p)->(%p %p)\n", This
, pNodeSource
, ppNodeDest
);
3797 static HRESULT WINAPI
HTMLDocument7_put_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT v
)
3799 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3800 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3804 static HRESULT WINAPI
HTMLDocument7_get_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT
*p
)
3806 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3807 FIXME("(%p)->(%p)\n", This
, p
);
3811 static HRESULT WINAPI
HTMLDocument7_get_all(IHTMLDocument7
*iface
, IHTMLElementCollection
**p
)
3813 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3815 TRACE("(%p)->(%p)\n", This
, p
);
3817 return IHTMLDocument2_get_all(&This
->IHTMLDocument2_iface
, p
);
3820 static HRESULT WINAPI
HTMLDocument7_get_inputEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3822 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3823 FIXME("(%p)->(%p)\n", This
, p
);
3827 static HRESULT WINAPI
HTMLDocument7_get_xmlEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3829 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3830 FIXME("(%p)->(%p)\n", This
, p
);
3834 static HRESULT WINAPI
HTMLDocument7_put_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL v
)
3836 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3837 FIXME("(%p)->(%x)\n", This
, v
);
3841 static HRESULT WINAPI
HTMLDocument7_get_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL
*p
)
3843 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3844 FIXME("(%p)->(%p)\n", This
, p
);
3848 static HRESULT WINAPI
HTMLDocument7_put_xmlVersion(IHTMLDocument7
*iface
, BSTR v
)
3850 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3851 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
3855 static HRESULT WINAPI
HTMLDocument7_get_xmlVersion(IHTMLDocument7
*iface
, BSTR
*p
)
3857 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3858 FIXME("(%p)->(%p)\n", This
, p
);
3862 static HRESULT WINAPI
HTMLDocument7_hasAttributes(IHTMLDocument7
*iface
, VARIANT_BOOL
*pfHasAttributes
)
3864 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3865 FIXME("(%p)->(%p)\n", This
, pfHasAttributes
);
3869 static HRESULT WINAPI
HTMLDocument7_put_onabort(IHTMLDocument7
*iface
, VARIANT v
)
3871 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3873 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3875 return set_doc_event(This
, EVENTID_ABORT
, &v
);
3878 static HRESULT WINAPI
HTMLDocument7_get_onabort(IHTMLDocument7
*iface
, VARIANT
*p
)
3880 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3882 TRACE("(%p)->(%p)\n", This
, p
);
3884 return get_doc_event(This
, EVENTID_ABORT
, p
);
3887 static HRESULT WINAPI
HTMLDocument7_put_onblur(IHTMLDocument7
*iface
, VARIANT v
)
3889 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3891 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3893 return set_doc_event(This
, EVENTID_BLUR
, &v
);
3896 static HRESULT WINAPI
HTMLDocument7_get_onblur(IHTMLDocument7
*iface
, VARIANT
*p
)
3898 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3900 TRACE("(%p)->(%p)\n", This
, p
);
3902 return get_doc_event(This
, EVENTID_BLUR
, p
);
3905 static HRESULT WINAPI
HTMLDocument7_put_oncanplay(IHTMLDocument7
*iface
, VARIANT v
)
3907 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3908 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3912 static HRESULT WINAPI
HTMLDocument7_get_oncanplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3914 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3915 FIXME("(%p)->(%p)\n", This
, p
);
3919 static HRESULT WINAPI
HTMLDocument7_put_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT v
)
3921 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3922 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3926 static HRESULT WINAPI
HTMLDocument7_get_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT
*p
)
3928 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3929 FIXME("(%p)->(%p)\n", This
, p
);
3933 static HRESULT WINAPI
HTMLDocument7_put_onchange(IHTMLDocument7
*iface
, VARIANT v
)
3935 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3937 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3939 return set_doc_event(This
, EVENTID_CHANGE
, &v
);
3942 static HRESULT WINAPI
HTMLDocument7_get_onchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3944 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3946 TRACE("(%p)->(%p)\n", This
, p
);
3948 return get_doc_event(This
, EVENTID_CHANGE
, p
);
3951 static HRESULT WINAPI
HTMLDocument7_put_ondrag(IHTMLDocument7
*iface
, VARIANT v
)
3953 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3955 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3957 return set_doc_event(This
, EVENTID_DRAG
, &v
);
3960 static HRESULT WINAPI
HTMLDocument7_get_ondrag(IHTMLDocument7
*iface
, VARIANT
*p
)
3962 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3964 TRACE("(%p)->(%p)\n", This
, p
);
3966 return get_doc_event(This
, EVENTID_DRAG
, p
);
3969 static HRESULT WINAPI
HTMLDocument7_put_ondragend(IHTMLDocument7
*iface
, VARIANT v
)
3971 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3972 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3976 static HRESULT WINAPI
HTMLDocument7_get_ondragend(IHTMLDocument7
*iface
, VARIANT
*p
)
3978 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3979 FIXME("(%p)->(%p)\n", This
, p
);
3983 static HRESULT WINAPI
HTMLDocument7_put_ondragenter(IHTMLDocument7
*iface
, VARIANT v
)
3985 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3986 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3990 static HRESULT WINAPI
HTMLDocument7_get_ondragenter(IHTMLDocument7
*iface
, VARIANT
*p
)
3992 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3993 FIXME("(%p)->(%p)\n", This
, p
);
3997 static HRESULT WINAPI
HTMLDocument7_put_ondragleave(IHTMLDocument7
*iface
, VARIANT v
)
3999 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4000 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4004 static HRESULT WINAPI
HTMLDocument7_get_ondragleave(IHTMLDocument7
*iface
, VARIANT
*p
)
4006 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4007 FIXME("(%p)->(%p)\n", This
, p
);
4011 static HRESULT WINAPI
HTMLDocument7_put_ondragover(IHTMLDocument7
*iface
, VARIANT v
)
4013 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4014 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4018 static HRESULT WINAPI
HTMLDocument7_get_ondragover(IHTMLDocument7
*iface
, VARIANT
*p
)
4020 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4021 FIXME("(%p)->(%p)\n", This
, p
);
4025 static HRESULT WINAPI
HTMLDocument7_put_ondrop(IHTMLDocument7
*iface
, VARIANT v
)
4027 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4028 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4032 static HRESULT WINAPI
HTMLDocument7_get_ondrop(IHTMLDocument7
*iface
, VARIANT
*p
)
4034 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4035 FIXME("(%p)->(%p)\n", This
, p
);
4039 static HRESULT WINAPI
HTMLDocument7_put_ondurationchange(IHTMLDocument7
*iface
, VARIANT v
)
4041 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4042 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4046 static HRESULT WINAPI
HTMLDocument7_get_ondurationchange(IHTMLDocument7
*iface
, VARIANT
*p
)
4048 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4049 FIXME("(%p)->(%p)\n", This
, p
);
4053 static HRESULT WINAPI
HTMLDocument7_put_onemptied(IHTMLDocument7
*iface
, VARIANT v
)
4055 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4056 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4060 static HRESULT WINAPI
HTMLDocument7_get_onemptied(IHTMLDocument7
*iface
, VARIANT
*p
)
4062 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4063 FIXME("(%p)->(%p)\n", This
, p
);
4067 static HRESULT WINAPI
HTMLDocument7_put_onended(IHTMLDocument7
*iface
, VARIANT v
)
4069 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4070 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4074 static HRESULT WINAPI
HTMLDocument7_get_onended(IHTMLDocument7
*iface
, VARIANT
*p
)
4076 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4077 FIXME("(%p)->(%p)\n", This
, p
);
4081 static HRESULT WINAPI
HTMLDocument7_put_onerror(IHTMLDocument7
*iface
, VARIANT v
)
4083 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4085 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4087 return set_doc_event(This
, EVENTID_ERROR
, &v
);
4090 static HRESULT WINAPI
HTMLDocument7_get_onerror(IHTMLDocument7
*iface
, VARIANT
*p
)
4092 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4094 TRACE("(%p)->(%p)\n", This
, p
);
4096 return get_doc_event(This
, EVENTID_ERROR
, p
);
4099 static HRESULT WINAPI
HTMLDocument7_put_onfocus(IHTMLDocument7
*iface
, VARIANT v
)
4101 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4103 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4105 return set_doc_event(This
, EVENTID_FOCUS
, &v
);
4108 static HRESULT WINAPI
HTMLDocument7_get_onfocus(IHTMLDocument7
*iface
, VARIANT
*p
)
4110 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4112 TRACE("(%p)->(%p)\n", This
, p
);
4114 return get_doc_event(This
, EVENTID_FOCUS
, p
);
4117 static HRESULT WINAPI
HTMLDocument7_put_oninput(IHTMLDocument7
*iface
, VARIANT v
)
4119 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4121 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4123 return set_doc_event(This
, EVENTID_INPUT
, &v
);
4126 static HRESULT WINAPI
HTMLDocument7_get_oninput(IHTMLDocument7
*iface
, VARIANT
*p
)
4128 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4130 TRACE("(%p)->(%p)\n", This
, p
);
4132 return get_doc_event(This
, EVENTID_INPUT
, p
);
4135 static HRESULT WINAPI
HTMLDocument7_put_onload(IHTMLDocument7
*iface
, VARIANT v
)
4137 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4139 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4141 return set_doc_event(This
, EVENTID_LOAD
, &v
);
4144 static HRESULT WINAPI
HTMLDocument7_get_onload(IHTMLDocument7
*iface
, VARIANT
*p
)
4146 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4148 TRACE("(%p)->(%p)\n", This
, p
);
4150 return get_doc_event(This
, EVENTID_LOAD
, p
);
4153 static HRESULT WINAPI
HTMLDocument7_put_onloadeddata(IHTMLDocument7
*iface
, VARIANT v
)
4155 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4156 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4160 static HRESULT WINAPI
HTMLDocument7_get_onloadeddata(IHTMLDocument7
*iface
, VARIANT
*p
)
4162 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4163 FIXME("(%p)->(%p)\n", This
, p
);
4167 static HRESULT WINAPI
HTMLDocument7_put_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT v
)
4169 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4170 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4174 static HRESULT WINAPI
HTMLDocument7_get_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT
*p
)
4176 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4177 FIXME("(%p)->(%p)\n", This
, p
);
4181 static HRESULT WINAPI
HTMLDocument7_put_onloadstart(IHTMLDocument7
*iface
, VARIANT v
)
4183 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4184 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4188 static HRESULT WINAPI
HTMLDocument7_get_onloadstart(IHTMLDocument7
*iface
, VARIANT
*p
)
4190 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4191 FIXME("(%p)->(%p)\n", This
, p
);
4195 static HRESULT WINAPI
HTMLDocument7_put_onpause(IHTMLDocument7
*iface
, VARIANT v
)
4197 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4198 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4202 static HRESULT WINAPI
HTMLDocument7_get_onpause(IHTMLDocument7
*iface
, VARIANT
*p
)
4204 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4205 FIXME("(%p)->(%p)\n", This
, p
);
4209 static HRESULT WINAPI
HTMLDocument7_put_onplay(IHTMLDocument7
*iface
, VARIANT v
)
4211 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4212 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4216 static HRESULT WINAPI
HTMLDocument7_get_onplay(IHTMLDocument7
*iface
, VARIANT
*p
)
4218 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4219 FIXME("(%p)->(%p)\n", This
, p
);
4223 static HRESULT WINAPI
HTMLDocument7_put_onplaying(IHTMLDocument7
*iface
, VARIANT v
)
4225 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4226 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4230 static HRESULT WINAPI
HTMLDocument7_get_onplaying(IHTMLDocument7
*iface
, VARIANT
*p
)
4232 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4233 FIXME("(%p)->(%p)\n", This
, p
);
4237 static HRESULT WINAPI
HTMLDocument7_put_onprogress(IHTMLDocument7
*iface
, VARIANT v
)
4239 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4240 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4244 static HRESULT WINAPI
HTMLDocument7_get_onprogress(IHTMLDocument7
*iface
, VARIANT
*p
)
4246 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4247 FIXME("(%p)->(%p)\n", This
, p
);
4251 static HRESULT WINAPI
HTMLDocument7_put_onratechange(IHTMLDocument7
*iface
, VARIANT v
)
4253 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4254 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4258 static HRESULT WINAPI
HTMLDocument7_get_onratechange(IHTMLDocument7
*iface
, VARIANT
*p
)
4260 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4261 FIXME("(%p)->(%p)\n", This
, p
);
4265 static HRESULT WINAPI
HTMLDocument7_put_onreset(IHTMLDocument7
*iface
, VARIANT v
)
4267 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4268 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4272 static HRESULT WINAPI
HTMLDocument7_get_onreset(IHTMLDocument7
*iface
, VARIANT
*p
)
4274 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4275 FIXME("(%p)->(%p)\n", This
, p
);
4279 static HRESULT WINAPI
HTMLDocument7_put_onscroll(IHTMLDocument7
*iface
, VARIANT v
)
4281 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4283 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4285 return set_doc_event(This
, EVENTID_SCROLL
, &v
);
4288 static HRESULT WINAPI
HTMLDocument7_get_onscroll(IHTMLDocument7
*iface
, VARIANT
*p
)
4290 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4292 TRACE("(%p)->(%p)\n", This
, p
);
4294 return get_doc_event(This
, EVENTID_SCROLL
, p
);
4297 static HRESULT WINAPI
HTMLDocument7_put_onseekend(IHTMLDocument7
*iface
, VARIANT v
)
4299 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4300 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4304 static HRESULT WINAPI
HTMLDocument7_get_onseekend(IHTMLDocument7
*iface
, VARIANT
*p
)
4306 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4307 FIXME("(%p)->(%p)\n", This
, p
);
4311 static HRESULT WINAPI
HTMLDocument7_put_onseeking(IHTMLDocument7
*iface
, VARIANT v
)
4313 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4314 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4318 static HRESULT WINAPI
HTMLDocument7_get_onseeking(IHTMLDocument7
*iface
, VARIANT
*p
)
4320 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4321 FIXME("(%p)->(%p)\n", This
, p
);
4325 static HRESULT WINAPI
HTMLDocument7_put_onselect(IHTMLDocument7
*iface
, VARIANT v
)
4327 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4328 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4332 static HRESULT WINAPI
HTMLDocument7_get_onselect(IHTMLDocument7
*iface
, VARIANT
*p
)
4334 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4335 FIXME("(%p)->(%p)\n", This
, p
);
4339 static HRESULT WINAPI
HTMLDocument7_put_onstalled(IHTMLDocument7
*iface
, VARIANT v
)
4341 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4342 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4346 static HRESULT WINAPI
HTMLDocument7_get_onstalled(IHTMLDocument7
*iface
, VARIANT
*p
)
4348 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4349 FIXME("(%p)->(%p)\n", This
, p
);
4353 static HRESULT WINAPI
HTMLDocument7_put_onsubmit(IHTMLDocument7
*iface
, VARIANT v
)
4355 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4357 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4359 return set_doc_event(This
, EVENTID_SUBMIT
, &v
);
4362 static HRESULT WINAPI
HTMLDocument7_get_onsubmit(IHTMLDocument7
*iface
, VARIANT
*p
)
4364 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4366 TRACE("(%p)->(%p)\n", This
, p
);
4368 return get_doc_event(This
, EVENTID_SUBMIT
, p
);
4371 static HRESULT WINAPI
HTMLDocument7_put_onsuspend(IHTMLDocument7
*iface
, VARIANT v
)
4373 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4374 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4378 static HRESULT WINAPI
HTMLDocument7_get_onsuspend(IHTMLDocument7
*iface
, VARIANT
*p
)
4380 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4381 FIXME("(%p)->(%p)\n", This
, p
);
4385 static HRESULT WINAPI
HTMLDocument7_put_ontimeupdate(IHTMLDocument7
*iface
, VARIANT v
)
4387 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4388 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4392 static HRESULT WINAPI
HTMLDocument7_get_ontimeupdate(IHTMLDocument7
*iface
, VARIANT
*p
)
4394 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4395 FIXME("(%p)->(%p)\n", This
, p
);
4399 static HRESULT WINAPI
HTMLDocument7_put_onvolumechange(IHTMLDocument7
*iface
, VARIANT v
)
4401 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4402 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4406 static HRESULT WINAPI
HTMLDocument7_get_onvolumechange(IHTMLDocument7
*iface
, VARIANT
*p
)
4408 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4409 FIXME("(%p)->(%p)\n", This
, p
);
4413 static HRESULT WINAPI
HTMLDocument7_put_onwaiting(IHTMLDocument7
*iface
, VARIANT v
)
4415 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4416 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4420 static HRESULT WINAPI
HTMLDocument7_get_onwaiting(IHTMLDocument7
*iface
, VARIANT
*p
)
4422 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4423 FIXME("(%p)->(%p)\n", This
, p
);
4427 static HRESULT WINAPI
HTMLDocument7_normalize(IHTMLDocument7
*iface
)
4429 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4430 FIXME("(%p)\n", This
);
4434 static HRESULT WINAPI
HTMLDocument7_importNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
,
4435 VARIANT_BOOL fDeep
, IHTMLDOMNode3
**ppNodeDest
)
4437 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4438 nsIDOMNode
*nsnode
= NULL
;
4443 TRACE("(%p)->(%p %x %p)\n", This
, pNodeSource
, fDeep
, ppNodeDest
);
4445 if(!This
->dom_document
) {
4446 WARN("NULL dom_document\n");
4447 return E_UNEXPECTED
;
4450 if(!(node
= unsafe_impl_from_IHTMLDOMNode(pNodeSource
))) {
4451 ERR("not our node\n");
4455 nsres
= nsIDOMDocument_ImportNode(This
->dom_document
, node
->nsnode
, !!fDeep
, 1, &nsnode
);
4456 if(NS_FAILED(nsres
)) {
4457 ERR("ImportNode failed: %08lx\n", nsres
);
4458 return map_nsresult(nsres
);
4466 hres
= get_node(nsnode
, TRUE
, &node
);
4467 nsIDOMNode_Release(nsnode
);
4471 *ppNodeDest
= &node
->IHTMLDOMNode3_iface
;
4475 static HRESULT WINAPI
HTMLDocument7_get_parentWindow(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
4477 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4479 TRACE("(%p)->(%p)\n", This
, p
);
4481 return IHTMLDocument7_get_defaultView(&This
->IHTMLDocument7_iface
, p
);
4484 static HRESULT WINAPI
HTMLDocument7_put_body(IHTMLDocument7
*iface
, IHTMLElement
*v
)
4486 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4487 FIXME("(%p)->(%p)\n", This
, v
);
4491 static HRESULT WINAPI
HTMLDocument7_get_body(IHTMLDocument7
*iface
, IHTMLElement
**p
)
4493 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4495 TRACE("(%p)->(%p)\n", This
, p
);
4497 return IHTMLDocument2_get_body(&This
->IHTMLDocument2_iface
, p
);
4500 static HRESULT WINAPI
HTMLDocument7_get_head(IHTMLDocument7
*iface
, IHTMLElement
**p
)
4502 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4503 nsIDOMHTMLHeadElement
*nshead
;
4504 nsIDOMElement
*nselem
;
4509 TRACE("(%p)->(%p)\n", This
, p
);
4511 if(!This
->dom_document
) {
4512 FIXME("No document\n");
4516 if(!This
->html_document
) {
4517 FIXME("Not implemented for XML document\n");
4521 nsres
= nsIDOMHTMLDocument_GetHead(This
->html_document
, &nshead
);
4522 assert(nsres
== NS_OK
);
4529 nsres
= nsIDOMHTMLHeadElement_QueryInterface(nshead
, &IID_nsIDOMElement
, (void**)&nselem
);
4530 nsIDOMHTMLHeadElement_Release(nshead
);
4531 assert(nsres
== NS_OK
);
4533 hres
= get_element(nselem
, &elem
);
4534 nsIDOMElement_Release(nselem
);
4538 *p
= &elem
->IHTMLElement_iface
;
4542 static const IHTMLDocument7Vtbl HTMLDocument7Vtbl
= {
4543 HTMLDocument7_QueryInterface
,
4544 HTMLDocument7_AddRef
,
4545 HTMLDocument7_Release
,
4546 HTMLDocument7_GetTypeInfoCount
,
4547 HTMLDocument7_GetTypeInfo
,
4548 HTMLDocument7_GetIDsOfNames
,
4549 HTMLDocument7_Invoke
,
4550 HTMLDocument7_get_defaultView
,
4551 HTMLDocument7_createCDATASection
,
4552 HTMLDocument7_getSelection
,
4553 HTMLDocument7_getElementsByTagNameNS
,
4554 HTMLDocument7_createElementNS
,
4555 HTMLDocument7_createAttributeNS
,
4556 HTMLDocument7_put_onmsthumbnailclick
,
4557 HTMLDocument7_get_onmsthumbnailclick
,
4558 HTMLDocument7_get_characterSet
,
4559 HTMLDocument7_createElement
,
4560 HTMLDocument7_createAttribute
,
4561 HTMLDocument7_getElementsByClassName
,
4562 HTMLDocument7_createProcessingInstruction
,
4563 HTMLDocument7_adoptNode
,
4564 HTMLDocument7_put_onmssitemodejumplistitemremoved
,
4565 HTMLDocument7_get_onmssitemodejumplistitemremoved
,
4566 HTMLDocument7_get_all
,
4567 HTMLDocument7_get_inputEncoding
,
4568 HTMLDocument7_get_xmlEncoding
,
4569 HTMLDocument7_put_xmlStandalone
,
4570 HTMLDocument7_get_xmlStandalone
,
4571 HTMLDocument7_put_xmlVersion
,
4572 HTMLDocument7_get_xmlVersion
,
4573 HTMLDocument7_hasAttributes
,
4574 HTMLDocument7_put_onabort
,
4575 HTMLDocument7_get_onabort
,
4576 HTMLDocument7_put_onblur
,
4577 HTMLDocument7_get_onblur
,
4578 HTMLDocument7_put_oncanplay
,
4579 HTMLDocument7_get_oncanplay
,
4580 HTMLDocument7_put_oncanplaythrough
,
4581 HTMLDocument7_get_oncanplaythrough
,
4582 HTMLDocument7_put_onchange
,
4583 HTMLDocument7_get_onchange
,
4584 HTMLDocument7_put_ondrag
,
4585 HTMLDocument7_get_ondrag
,
4586 HTMLDocument7_put_ondragend
,
4587 HTMLDocument7_get_ondragend
,
4588 HTMLDocument7_put_ondragenter
,
4589 HTMLDocument7_get_ondragenter
,
4590 HTMLDocument7_put_ondragleave
,
4591 HTMLDocument7_get_ondragleave
,
4592 HTMLDocument7_put_ondragover
,
4593 HTMLDocument7_get_ondragover
,
4594 HTMLDocument7_put_ondrop
,
4595 HTMLDocument7_get_ondrop
,
4596 HTMLDocument7_put_ondurationchange
,
4597 HTMLDocument7_get_ondurationchange
,
4598 HTMLDocument7_put_onemptied
,
4599 HTMLDocument7_get_onemptied
,
4600 HTMLDocument7_put_onended
,
4601 HTMLDocument7_get_onended
,
4602 HTMLDocument7_put_onerror
,
4603 HTMLDocument7_get_onerror
,
4604 HTMLDocument7_put_onfocus
,
4605 HTMLDocument7_get_onfocus
,
4606 HTMLDocument7_put_oninput
,
4607 HTMLDocument7_get_oninput
,
4608 HTMLDocument7_put_onload
,
4609 HTMLDocument7_get_onload
,
4610 HTMLDocument7_put_onloadeddata
,
4611 HTMLDocument7_get_onloadeddata
,
4612 HTMLDocument7_put_onloadedmetadata
,
4613 HTMLDocument7_get_onloadedmetadata
,
4614 HTMLDocument7_put_onloadstart
,
4615 HTMLDocument7_get_onloadstart
,
4616 HTMLDocument7_put_onpause
,
4617 HTMLDocument7_get_onpause
,
4618 HTMLDocument7_put_onplay
,
4619 HTMLDocument7_get_onplay
,
4620 HTMLDocument7_put_onplaying
,
4621 HTMLDocument7_get_onplaying
,
4622 HTMLDocument7_put_onprogress
,
4623 HTMLDocument7_get_onprogress
,
4624 HTMLDocument7_put_onratechange
,
4625 HTMLDocument7_get_onratechange
,
4626 HTMLDocument7_put_onreset
,
4627 HTMLDocument7_get_onreset
,
4628 HTMLDocument7_put_onscroll
,
4629 HTMLDocument7_get_onscroll
,
4630 HTMLDocument7_put_onseekend
,
4631 HTMLDocument7_get_onseekend
,
4632 HTMLDocument7_put_onseeking
,
4633 HTMLDocument7_get_onseeking
,
4634 HTMLDocument7_put_onselect
,
4635 HTMLDocument7_get_onselect
,
4636 HTMLDocument7_put_onstalled
,
4637 HTMLDocument7_get_onstalled
,
4638 HTMLDocument7_put_onsubmit
,
4639 HTMLDocument7_get_onsubmit
,
4640 HTMLDocument7_put_onsuspend
,
4641 HTMLDocument7_get_onsuspend
,
4642 HTMLDocument7_put_ontimeupdate
,
4643 HTMLDocument7_get_ontimeupdate
,
4644 HTMLDocument7_put_onvolumechange
,
4645 HTMLDocument7_get_onvolumechange
,
4646 HTMLDocument7_put_onwaiting
,
4647 HTMLDocument7_get_onwaiting
,
4648 HTMLDocument7_normalize
,
4649 HTMLDocument7_importNode
,
4650 HTMLDocument7_get_parentWindow
,
4651 HTMLDocument7_put_body
,
4652 HTMLDocument7_get_body
,
4653 HTMLDocument7_get_head
4656 static inline HTMLDocumentNode
*impl_from_IDocumentSelector(IDocumentSelector
*iface
)
4658 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDocumentSelector_iface
);
4661 static HRESULT WINAPI
DocumentSelector_QueryInterface(IDocumentSelector
*iface
, REFIID riid
, void **ppv
)
4663 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4664 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
4667 static ULONG WINAPI
DocumentSelector_AddRef(IDocumentSelector
*iface
)
4669 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4670 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
4673 static ULONG WINAPI
DocumentSelector_Release(IDocumentSelector
*iface
)
4675 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4676 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
4679 static HRESULT WINAPI
DocumentSelector_GetTypeInfoCount(IDocumentSelector
*iface
, UINT
*pctinfo
)
4681 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4682 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
4685 static HRESULT WINAPI
DocumentSelector_GetTypeInfo(IDocumentSelector
*iface
, UINT iTInfo
,
4686 LCID lcid
, ITypeInfo
**ppTInfo
)
4688 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4689 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4692 static HRESULT WINAPI
DocumentSelector_GetIDsOfNames(IDocumentSelector
*iface
, REFIID riid
,
4693 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4695 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4696 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
4700 static HRESULT WINAPI
DocumentSelector_Invoke(IDocumentSelector
*iface
, DISPID dispIdMember
, REFIID riid
,
4701 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4703 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4704 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
4705 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4708 static HRESULT WINAPI
DocumentSelector_querySelector(IDocumentSelector
*iface
, BSTR v
, IHTMLElement
**pel
)
4710 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4711 nsIDOMElement
*nselem
;
4717 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4719 nsAString_InitDepend(&nsstr
, v
);
4720 if(This
->dom_document
)
4721 nsres
= nsIDOMDocument_QuerySelector(This
->dom_document
, &nsstr
, &nselem
);
4723 nsIDOMDocumentFragment
*frag
;
4724 nsres
= nsIDOMNode_QueryInterface(This
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&frag
);
4725 if(NS_SUCCEEDED(nsres
)) {
4726 nsres
= nsIDOMDocumentFragment_QuerySelector(frag
, &nsstr
, &nselem
);
4727 nsIDOMDocumentFragment_Release(frag
);
4730 nsAString_Finish(&nsstr
);
4732 if(NS_FAILED(nsres
)) {
4733 WARN("QuerySelector failed: %08lx\n", nsres
);
4734 return map_nsresult(nsres
);
4742 hres
= get_element(nselem
, &elem
);
4743 nsIDOMElement_Release(nselem
);
4747 *pel
= &elem
->IHTMLElement_iface
;
4751 static HRESULT WINAPI
DocumentSelector_querySelectorAll(IDocumentSelector
*iface
, BSTR v
, IHTMLDOMChildrenCollection
**pel
)
4753 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4754 nsIDOMNodeList
*node_list
;
4759 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4761 nsAString_InitDepend(&nsstr
, v
);
4762 if(This
->dom_document
)
4763 nsres
= nsIDOMDocument_QuerySelectorAll(This
->dom_document
, &nsstr
, &node_list
);
4765 nsIDOMDocumentFragment
*frag
;
4766 nsres
= nsIDOMNode_QueryInterface(This
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&frag
);
4767 if(NS_SUCCEEDED(nsres
)) {
4768 nsres
= nsIDOMDocumentFragment_QuerySelectorAll(frag
, &nsstr
, &node_list
);
4769 nsIDOMDocumentFragment_Release(frag
);
4772 nsAString_Finish(&nsstr
);
4774 if(NS_FAILED(nsres
)) {
4775 WARN("QuerySelectorAll failed: %08lx\n", nsres
);
4776 return map_nsresult(nsres
);
4779 hres
= create_child_collection(node_list
, dispex_compat_mode(&This
->node
.event_target
.dispex
), pel
);
4780 nsIDOMNodeList_Release(node_list
);
4784 static const IDocumentSelectorVtbl DocumentSelectorVtbl
= {
4785 DocumentSelector_QueryInterface
,
4786 DocumentSelector_AddRef
,
4787 DocumentSelector_Release
,
4788 DocumentSelector_GetTypeInfoCount
,
4789 DocumentSelector_GetTypeInfo
,
4790 DocumentSelector_GetIDsOfNames
,
4791 DocumentSelector_Invoke
,
4792 DocumentSelector_querySelector
,
4793 DocumentSelector_querySelectorAll
4796 static inline HTMLDocumentNode
*impl_from_IDocumentEvent(IDocumentEvent
*iface
)
4798 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDocumentEvent_iface
);
4801 static HRESULT WINAPI
DocumentEvent_QueryInterface(IDocumentEvent
*iface
, REFIID riid
, void **ppv
)
4803 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4804 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
4807 static ULONG WINAPI
DocumentEvent_AddRef(IDocumentEvent
*iface
)
4809 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4810 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
4813 static ULONG WINAPI
DocumentEvent_Release(IDocumentEvent
*iface
)
4815 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4816 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
4819 static HRESULT WINAPI
DocumentEvent_GetTypeInfoCount(IDocumentEvent
*iface
, UINT
*pctinfo
)
4821 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4822 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
4825 static HRESULT WINAPI
DocumentEvent_GetTypeInfo(IDocumentEvent
*iface
, UINT iTInfo
,
4826 LCID lcid
, ITypeInfo
**ppTInfo
)
4828 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4829 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4832 static HRESULT WINAPI
DocumentEvent_GetIDsOfNames(IDocumentEvent
*iface
, REFIID riid
,
4833 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4835 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4836 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
4840 static HRESULT WINAPI
DocumentEvent_Invoke(IDocumentEvent
*iface
, DISPID dispIdMember
, REFIID riid
,
4841 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4843 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4844 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
4845 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4848 static HRESULT WINAPI
DocumentEvent_createEvent(IDocumentEvent
*iface
, BSTR eventType
, IDOMEvent
**p
)
4850 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4852 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eventType
), p
);
4854 return create_document_event_str(This
, eventType
, p
);
4857 static const IDocumentEventVtbl DocumentEventVtbl
= {
4858 DocumentEvent_QueryInterface
,
4859 DocumentEvent_AddRef
,
4860 DocumentEvent_Release
,
4861 DocumentEvent_GetTypeInfoCount
,
4862 DocumentEvent_GetTypeInfo
,
4863 DocumentEvent_GetIDsOfNames
,
4864 DocumentEvent_Invoke
,
4865 DocumentEvent_createEvent
4868 static void HTMLDocumentNode_on_advise(IUnknown
*iface
, cp_static_data_t
*cp
)
4870 HTMLDocumentNode
*This
= CONTAINING_RECORD((IHTMLDocument2
*)iface
, HTMLDocumentNode
, IHTMLDocument2_iface
);
4872 if(This
->outer_window
)
4873 update_doc_cp_events(This
, cp
);
4876 static inline HTMLDocumentNode
*impl_from_ISupportErrorInfo(ISupportErrorInfo
*iface
)
4878 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, ISupportErrorInfo_iface
);
4881 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
4883 HTMLDocumentNode
*This
= impl_from_ISupportErrorInfo(iface
);
4884 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
4887 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
4889 HTMLDocumentNode
*This
= impl_from_ISupportErrorInfo(iface
);
4890 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
4893 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
4895 HTMLDocumentNode
*This
= impl_from_ISupportErrorInfo(iface
);
4896 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
4899 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
4901 FIXME("(%p)->(%s)\n", iface
, debugstr_mshtml_guid(riid
));
4905 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
4906 SupportErrorInfo_QueryInterface
,
4907 SupportErrorInfo_AddRef
,
4908 SupportErrorInfo_Release
,
4909 SupportErrorInfo_InterfaceSupportsErrorInfo
4912 static inline HTMLDocumentNode
*impl_from_IDispatchEx(IDispatchEx
*iface
)
4914 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDispatchEx_iface
);
4917 static HRESULT
has_elem_name(nsIDOMHTMLDocument
*html_document
, const WCHAR
*name
)
4919 static const WCHAR fmt
[] = L
":-moz-any(applet,embed,form,iframe,img,object)[name=\"%s\"]";
4920 WCHAR buf
[128], *selector
= buf
;
4921 nsAString selector_str
;
4922 nsIDOMElement
*nselem
;
4926 len
= wcslen(name
) + ARRAY_SIZE(fmt
) - 2 /* %s */;
4927 if(len
> ARRAY_SIZE(buf
) && !(selector
= malloc(len
* sizeof(WCHAR
))))
4928 return E_OUTOFMEMORY
;
4929 swprintf(selector
, len
, fmt
, name
);
4931 nsAString_InitDepend(&selector_str
, selector
);
4932 nsres
= nsIDOMHTMLDocument_QuerySelector(html_document
, &selector_str
, &nselem
);
4933 nsAString_Finish(&selector_str
);
4936 if(NS_FAILED(nsres
))
4937 return map_nsresult(nsres
);
4940 return DISP_E_UNKNOWNNAME
;
4941 nsIDOMElement_Release(nselem
);
4945 static HRESULT
get_elem_by_name_or_id(nsIDOMHTMLDocument
*html_document
, const WCHAR
*name
, nsIDOMElement
**ret
)
4947 static const WCHAR fmt
[] = L
":-moz-any(embed,form,iframe,img):-moz-any([name=\"%s\"],[id=\"%s\"][name]),"
4948 L
":-moz-any(applet,object):-moz-any([name=\"%s\"],[id=\"%s\"])";
4949 WCHAR buf
[384], *selector
= buf
;
4950 nsAString selector_str
;
4951 nsIDOMElement
*nselem
;
4955 len
= wcslen(name
) * 4 + ARRAY_SIZE(fmt
) - 8 /* %s */;
4956 if(len
> ARRAY_SIZE(buf
) && !(selector
= malloc(len
* sizeof(WCHAR
))))
4957 return E_OUTOFMEMORY
;
4958 swprintf(selector
, len
, fmt
, name
, name
, name
, name
);
4960 nsAString_InitDepend(&selector_str
, selector
);
4961 nsres
= nsIDOMHTMLDocument_QuerySelector(html_document
, &selector_str
, &nselem
);
4962 nsAString_Finish(&selector_str
);
4965 if(NS_FAILED(nsres
))
4966 return map_nsresult(nsres
);
4974 nsIDOMElement_Release(nselem
);
4977 return DISP_E_UNKNOWNNAME
;
4980 static HRESULT
dispid_from_elem_name(HTMLDocumentNode
*This
, const WCHAR
*name
, DISPID
*dispid
)
4984 for(i
=0; i
< This
->elem_vars_cnt
; i
++) {
4985 if(!wcscmp(name
, This
->elem_vars
[i
])) {
4986 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
4991 if(This
->elem_vars_cnt
== This
->elem_vars_size
) {
4994 if(This
->elem_vars_size
) {
4995 new_vars
= realloc(This
->elem_vars
, This
->elem_vars_size
* 2 * sizeof(WCHAR
*));
4997 return E_OUTOFMEMORY
;
4998 This
->elem_vars_size
*= 2;
5000 new_vars
= malloc(16 * sizeof(WCHAR
*));
5002 return E_OUTOFMEMORY
;
5003 This
->elem_vars_size
= 16;
5006 This
->elem_vars
= new_vars
;
5009 This
->elem_vars
[This
->elem_vars_cnt
] = wcsdup(name
);
5010 if(!This
->elem_vars
[This
->elem_vars_cnt
])
5011 return E_OUTOFMEMORY
;
5013 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+This
->elem_vars_cnt
++;
5017 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
5019 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5021 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
5024 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
5026 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5028 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5031 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
5033 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5035 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5038 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
5040 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5042 return IDispatchEx_GetTypeInfoCount(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
5045 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
5046 LCID lcid
, ITypeInfo
**ppTInfo
)
5048 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5050 return IDispatchEx_GetTypeInfo(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
5053 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
5054 LPOLESTR
*rgszNames
, UINT cNames
,
5055 LCID lcid
, DISPID
*rgDispId
)
5057 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5059 return IDispatchEx_GetIDsOfNames(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
5062 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
5063 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
5064 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
5066 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5068 TRACE("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
5069 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
5071 return IDispatchEx_InvokeEx(&This
->IDispatchEx_iface
, dispIdMember
, lcid
, wFlags
, pDispParams
,
5072 pVarResult
, pExcepInfo
, NULL
);
5075 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
5077 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5080 hres
= IDispatchEx_GetDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, bstrName
, grfdex
& ~fdexNameEnsure
, pid
);
5081 if(hres
!= DISP_E_UNKNOWNNAME
)
5084 if(This
->html_document
) {
5085 hres
= get_elem_by_name_or_id(This
->html_document
, bstrName
, NULL
);
5087 hres
= dispid_from_elem_name(This
, bstrName
, pid
);
5090 if(hres
== DISP_E_UNKNOWNNAME
&& (grfdex
& fdexNameEnsure
))
5091 hres
= dispex_get_dynid(&This
->node
.event_target
.dispex
, bstrName
, FALSE
, pid
);
5095 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
5096 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
5098 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5102 case DISPID_READYSTATE
:
5103 TRACE("DISPID_READYSTATE\n");
5105 if(!(wFlags
& DISPATCH_PROPERTYGET
))
5106 return E_INVALIDARG
;
5108 V_VT(pvarRes
) = VT_I4
;
5109 V_I4(pvarRes
) = This
->window
->base
.outer_window
->readystate
;
5116 return IDispatchEx_InvokeEx(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
5119 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
5121 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5123 return IDispatchEx_DeleteMemberByName(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, bstrName
, grfdex
);
5126 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
5128 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5130 return IDispatchEx_DeleteMemberByDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, id
);
5133 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
5135 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5137 return IDispatchEx_GetMemberProperties(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, id
, grfdexFetch
, pgrfdex
);
5140 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
5142 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5144 return IDispatchEx_GetMemberName(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, id
, pbstrName
);
5147 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
5149 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5151 return IDispatchEx_GetNextDispID(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, grfdex
, id
, pid
);
5154 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
5156 HTMLDocumentNode
*This
= impl_from_IDispatchEx(iface
);
5158 return IDispatchEx_GetNameSpaceParent(&This
->node
.event_target
.dispex
.IDispatchEx_iface
, ppunk
);
5161 static const IDispatchExVtbl DocDispatchExVtbl
= {
5162 DocDispatchEx_QueryInterface
,
5163 DocDispatchEx_AddRef
,
5164 DocDispatchEx_Release
,
5165 DocDispatchEx_GetTypeInfoCount
,
5166 DocDispatchEx_GetTypeInfo
,
5167 DocDispatchEx_GetIDsOfNames
,
5168 DocDispatchEx_Invoke
,
5169 DocDispatchEx_GetDispID
,
5170 DocDispatchEx_InvokeEx
,
5171 DocDispatchEx_DeleteMemberByName
,
5172 DocDispatchEx_DeleteMemberByDispID
,
5173 DocDispatchEx_GetMemberProperties
,
5174 DocDispatchEx_GetMemberName
,
5175 DocDispatchEx_GetNextDispID
,
5176 DocDispatchEx_GetNameSpaceParent
5179 static inline HTMLDocumentNode
*impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo
*iface
)
5181 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IProvideMultipleClassInfo_iface
);
5184 static HRESULT WINAPI
ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo
*iface
,
5185 REFIID riid
, void **ppv
)
5187 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5188 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
5191 static ULONG WINAPI
ProvideClassInfo_AddRef(IProvideMultipleClassInfo
*iface
)
5193 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5194 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5197 static ULONG WINAPI
ProvideClassInfo_Release(IProvideMultipleClassInfo
*iface
)
5199 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5200 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5203 static HRESULT WINAPI
ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo
*iface
, ITypeInfo
**ppTI
)
5205 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5206 TRACE("(%p)->(%p)\n", This
, ppTI
);
5207 return get_class_typeinfo(&CLSID_HTMLDocument
, ppTI
);
5210 static HRESULT WINAPI
ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo
*iface
, DWORD dwGuidKind
, GUID
*pGUID
)
5212 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5213 FIXME("(%p)->(%lu %p)\n", This
, dwGuidKind
, pGUID
);
5217 static HRESULT WINAPI
ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo
*iface
, ULONG
*pcti
)
5219 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5220 FIXME("(%p)->(%p)\n", This
, pcti
);
5225 static HRESULT WINAPI
ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo
*iface
, ULONG iti
,
5226 DWORD dwFlags
, ITypeInfo
**pptiCoClass
, DWORD
*pdwTIFlags
, ULONG
*pcdispidReserved
, IID
*piidPrimary
, IID
*piidSource
)
5228 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
5229 FIXME("(%p)->(%lu %lx %p %p %p %p %p)\n", This
, iti
, dwFlags
, pptiCoClass
, pdwTIFlags
, pcdispidReserved
, piidPrimary
, piidSource
);
5233 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl
= {
5234 ProvideClassInfo_QueryInterface
,
5235 ProvideClassInfo_AddRef
,
5236 ProvideClassInfo_Release
,
5237 ProvideClassInfo_GetClassInfo
,
5238 ProvideClassInfo2_GetGUID
,
5239 ProvideMultipleClassInfo_GetMultiTypeInfoCount
,
5240 ProvideMultipleClassInfo_GetInfoOfIndex
5243 /**********************************************************
5244 * IMarkupServices implementation
5246 static inline HTMLDocumentNode
*impl_from_IMarkupServices(IMarkupServices
*iface
)
5248 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IMarkupServices_iface
);
5251 static HRESULT WINAPI
MarkupServices_QueryInterface(IMarkupServices
*iface
, REFIID riid
, void **ppvObject
)
5253 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5254 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppvObject
);
5257 static ULONG WINAPI
MarkupServices_AddRef(IMarkupServices
*iface
)
5259 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5260 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5263 static ULONG WINAPI
MarkupServices_Release(IMarkupServices
*iface
)
5265 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5266 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5269 static HRESULT WINAPI
MarkupServices_CreateMarkupPointer(IMarkupServices
*iface
, IMarkupPointer
**ppPointer
)
5271 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5273 TRACE("(%p)->(%p)\n", This
, ppPointer
);
5275 return create_markup_pointer(ppPointer
);
5278 static HRESULT WINAPI
MarkupServices_CreateMarkupContainer(IMarkupServices
*iface
, IMarkupContainer
**ppMarkupContainer
)
5280 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5281 FIXME("(%p)->(%p)\n", This
, ppMarkupContainer
);
5285 static HRESULT WINAPI
MarkupServices_CreateElement(IMarkupServices
*iface
,
5286 ELEMENT_TAG_ID tagID
, OLECHAR
*pchAttributes
, IHTMLElement
**ppElement
)
5288 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5289 FIXME("(%p)->(%d,%s,%p)\n", This
, tagID
, debugstr_w(pchAttributes
), ppElement
);
5293 static HRESULT WINAPI
MarkupServices_CloneElement(IMarkupServices
*iface
,
5294 IHTMLElement
*pElemCloneThis
, IHTMLElement
**ppElementTheClone
)
5296 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5297 FIXME("(%p)->(%p,%p)\n", This
, pElemCloneThis
, ppElementTheClone
);
5301 static HRESULT WINAPI
MarkupServices_InsertElement(IMarkupServices
*iface
,
5302 IHTMLElement
*pElementInsert
, IMarkupPointer
*pPointerStart
,
5303 IMarkupPointer
*pPointerFinish
)
5305 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5306 FIXME("(%p)->(%p,%p,%p)\n", This
, pElementInsert
, pPointerStart
, pPointerFinish
);
5310 static HRESULT WINAPI
MarkupServices_RemoveElement(IMarkupServices
*iface
, IHTMLElement
*pElementRemove
)
5312 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5313 FIXME("(%p)->(%p)\n", This
, pElementRemove
);
5317 static HRESULT WINAPI
MarkupServices_Remove(IMarkupServices
*iface
,
5318 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
5320 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5321 FIXME("(%p)->(%p,%p)\n", This
, pPointerStart
, pPointerFinish
);
5325 static HRESULT WINAPI
MarkupServices_Copy(IMarkupServices
*iface
,
5326 IMarkupPointer
*pPointerSourceStart
, IMarkupPointer
*pPointerSourceFinish
,
5327 IMarkupPointer
*pPointerTarget
)
5329 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5330 FIXME("(%p)->(%p,%p,%p)\n", This
, pPointerSourceStart
, pPointerSourceFinish
, pPointerTarget
);
5334 static HRESULT WINAPI
MarkupServices_Move(IMarkupServices
*iface
,
5335 IMarkupPointer
*pPointerSourceStart
, IMarkupPointer
*pPointerSourceFinish
,
5336 IMarkupPointer
*pPointerTarget
)
5338 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5339 FIXME("(%p)->(%p,%p,%p)\n", This
, pPointerSourceStart
, pPointerSourceFinish
, pPointerTarget
);
5343 static HRESULT WINAPI
MarkupServices_InsertText(IMarkupServices
*iface
,
5344 OLECHAR
*pchText
, LONG cch
, IMarkupPointer
*pPointerTarget
)
5346 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5347 FIXME("(%p)->(%s,%lx,%p)\n", This
, debugstr_w(pchText
), cch
, pPointerTarget
);
5351 static HRESULT WINAPI
MarkupServices_ParseString(IMarkupServices
*iface
,
5352 OLECHAR
*pchHTML
, DWORD dwFlags
, IMarkupContainer
**ppContainerResult
,
5353 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
5355 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5356 FIXME("(%p)->(%s,%lx,%p,%p,%p)\n", This
, debugstr_w(pchHTML
), dwFlags
, ppContainerResult
, pPointerStart
, pPointerFinish
);
5360 static HRESULT WINAPI
MarkupServices_ParseGlobal(IMarkupServices
*iface
,
5361 HGLOBAL hglobalHTML
, DWORD dwFlags
, IMarkupContainer
**ppContainerResult
,
5362 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
5364 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5365 FIXME("(%p)->(%s,%lx,%p,%p,%p)\n", This
, debugstr_w(hglobalHTML
), dwFlags
, ppContainerResult
, pPointerStart
, pPointerFinish
);
5369 static HRESULT WINAPI
MarkupServices_IsScopedElement(IMarkupServices
*iface
,
5370 IHTMLElement
*pElement
, BOOL
*pfScoped
)
5372 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5373 FIXME("(%p)->(%p,%p)\n", This
, pElement
, pfScoped
);
5377 static HRESULT WINAPI
MarkupServices_GetElementTagId(IMarkupServices
*iface
,
5378 IHTMLElement
*pElement
, ELEMENT_TAG_ID
*ptagId
)
5380 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5381 FIXME("(%p)->(%p,%p)\n", This
, pElement
, ptagId
);
5385 static HRESULT WINAPI
MarkupServices_GetTagIDForName(IMarkupServices
*iface
,
5386 BSTR bstrName
, ELEMENT_TAG_ID
*ptagId
)
5388 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5389 FIXME("(%p)->(%s,%p)\n", This
, debugstr_w(bstrName
), ptagId
);
5393 static HRESULT WINAPI
MarkupServices_GetNameForTagID(IMarkupServices
*iface
,
5394 ELEMENT_TAG_ID tagId
, BSTR
*pbstrName
)
5396 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5397 FIXME("(%p)->(%d,%p)\n", This
, tagId
, pbstrName
);
5401 static HRESULT WINAPI
MarkupServices_MovePointersToRange(IMarkupServices
*iface
,
5402 IHTMLTxtRange
*pIRange
, IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
5404 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5405 FIXME("(%p)->(%p,%p,%p)\n", This
, pIRange
, pPointerStart
, pPointerFinish
);
5409 static HRESULT WINAPI
MarkupServices_MoveRangeToPointers(IMarkupServices
*iface
,
5410 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
, IHTMLTxtRange
*pIRange
)
5412 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5413 FIXME("(%p)->(%p,%p,%p)\n", This
, pPointerStart
, pPointerFinish
, pIRange
);
5417 static HRESULT WINAPI
MarkupServices_BeginUndoUnit(IMarkupServices
*iface
, OLECHAR
*pchTitle
)
5419 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5420 FIXME("(%p)->(%s)\n", This
, debugstr_w(pchTitle
));
5424 static HRESULT WINAPI
MarkupServices_EndUndoUnit(IMarkupServices
*iface
)
5426 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
5427 FIXME("(%p)\n", This
);
5431 static const IMarkupServicesVtbl MarkupServicesVtbl
= {
5432 MarkupServices_QueryInterface
,
5433 MarkupServices_AddRef
,
5434 MarkupServices_Release
,
5435 MarkupServices_CreateMarkupPointer
,
5436 MarkupServices_CreateMarkupContainer
,
5437 MarkupServices_CreateElement
,
5438 MarkupServices_CloneElement
,
5439 MarkupServices_InsertElement
,
5440 MarkupServices_RemoveElement
,
5441 MarkupServices_Remove
,
5442 MarkupServices_Copy
,
5443 MarkupServices_Move
,
5444 MarkupServices_InsertText
,
5445 MarkupServices_ParseString
,
5446 MarkupServices_ParseGlobal
,
5447 MarkupServices_IsScopedElement
,
5448 MarkupServices_GetElementTagId
,
5449 MarkupServices_GetTagIDForName
,
5450 MarkupServices_GetNameForTagID
,
5451 MarkupServices_MovePointersToRange
,
5452 MarkupServices_MoveRangeToPointers
,
5453 MarkupServices_BeginUndoUnit
,
5454 MarkupServices_EndUndoUnit
5457 /**********************************************************
5458 * IMarkupContainer implementation
5460 static inline HTMLDocumentNode
*impl_from_IMarkupContainer(IMarkupContainer
*iface
)
5462 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IMarkupContainer_iface
);
5465 static HRESULT WINAPI
MarkupContainer_QueryInterface(IMarkupContainer
*iface
, REFIID riid
, void **ppvObject
)
5467 HTMLDocumentNode
*This
= impl_from_IMarkupContainer(iface
);
5468 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppvObject
);
5471 static ULONG WINAPI
MarkupContainer_AddRef(IMarkupContainer
*iface
)
5473 HTMLDocumentNode
*This
= impl_from_IMarkupContainer(iface
);
5474 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5477 static ULONG WINAPI
MarkupContainer_Release(IMarkupContainer
*iface
)
5479 HTMLDocumentNode
*This
= impl_from_IMarkupContainer(iface
);
5480 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5483 static HRESULT WINAPI
MarkupContainer_OwningDoc(IMarkupContainer
*iface
, IHTMLDocument2
**ppDoc
)
5485 HTMLDocumentNode
*This
= impl_from_IMarkupContainer(iface
);
5486 FIXME("(%p)->(%p)\n", This
, ppDoc
);
5490 static const IMarkupContainerVtbl MarkupContainerVtbl
= {
5491 MarkupContainer_QueryInterface
,
5492 MarkupContainer_AddRef
,
5493 MarkupContainer_Release
,
5494 MarkupContainer_OwningDoc
5497 /**********************************************************
5498 * IDisplayServices implementation
5500 static inline HTMLDocumentNode
*impl_from_IDisplayServices(IDisplayServices
*iface
)
5502 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDisplayServices_iface
);
5505 static HRESULT WINAPI
DisplayServices_QueryInterface(IDisplayServices
*iface
, REFIID riid
, void **ppvObject
)
5507 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5508 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppvObject
);
5511 static ULONG WINAPI
DisplayServices_AddRef(IDisplayServices
*iface
)
5513 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5514 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5517 static ULONG WINAPI
DisplayServices_Release(IDisplayServices
*iface
)
5519 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5520 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5523 static HRESULT WINAPI
DisplayServices_CreateDisplayPointer(IDisplayServices
*iface
, IDisplayPointer
**ppDispPointer
)
5525 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5526 FIXME("(%p)->(%p)\n", This
, ppDispPointer
);
5530 static HRESULT WINAPI
DisplayServices_TransformRect(IDisplayServices
*iface
,
5531 RECT
*pRect
, COORD_SYSTEM eSource
, COORD_SYSTEM eDestination
, IHTMLElement
*pIElement
)
5533 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5534 FIXME("(%p)->(%s,%d,%d,%p)\n", This
, wine_dbgstr_rect(pRect
), eSource
, eDestination
, pIElement
);
5538 static HRESULT WINAPI
DisplayServices_TransformPoint(IDisplayServices
*iface
,
5539 POINT
*pPoint
, COORD_SYSTEM eSource
, COORD_SYSTEM eDestination
, IHTMLElement
*pIElement
)
5541 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5542 FIXME("(%p)->(%s,%d,%d,%p)\n", This
, wine_dbgstr_point(pPoint
), eSource
, eDestination
, pIElement
);
5546 static HRESULT WINAPI
DisplayServices_GetCaret(IDisplayServices
*iface
, IHTMLCaret
**ppCaret
)
5548 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5549 FIXME("(%p)->(%p)\n", This
, ppCaret
);
5553 static HRESULT WINAPI
DisplayServices_GetComputedStyle(IDisplayServices
*iface
,
5554 IMarkupPointer
*pPointer
, IHTMLComputedStyle
**ppComputedStyle
)
5556 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5557 FIXME("(%p)->(%p,%p)\n", This
, pPointer
, ppComputedStyle
);
5561 static HRESULT WINAPI
DisplayServices_ScrollRectIntoView(IDisplayServices
*iface
,
5562 IHTMLElement
*pIElement
, RECT rect
)
5564 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5565 FIXME("(%p)->(%p,%s)\n", This
, pIElement
, wine_dbgstr_rect(&rect
));
5569 static HRESULT WINAPI
DisplayServices_HasFlowLayout(IDisplayServices
*iface
,
5570 IHTMLElement
*pIElement
, BOOL
*pfHasFlowLayout
)
5572 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5573 FIXME("(%p)->(%p,%p)\n", This
, pIElement
, pfHasFlowLayout
);
5577 static const IDisplayServicesVtbl DisplayServicesVtbl
= {
5578 DisplayServices_QueryInterface
,
5579 DisplayServices_AddRef
,
5580 DisplayServices_Release
,
5581 DisplayServices_CreateDisplayPointer
,
5582 DisplayServices_TransformRect
,
5583 DisplayServices_TransformPoint
,
5584 DisplayServices_GetCaret
,
5585 DisplayServices_GetComputedStyle
,
5586 DisplayServices_ScrollRectIntoView
,
5587 DisplayServices_HasFlowLayout
5590 /**********************************************************
5591 * IDocumentRange implementation
5593 static inline HTMLDocumentNode
*impl_from_IDocumentRange(IDocumentRange
*iface
)
5595 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDocumentRange_iface
);
5598 static HRESULT WINAPI
DocumentRange_QueryInterface(IDocumentRange
*iface
, REFIID riid
, void **ppv
)
5600 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5602 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
5605 static ULONG WINAPI
DocumentRange_AddRef(IDocumentRange
*iface
)
5607 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5609 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5612 static ULONG WINAPI
DocumentRange_Release(IDocumentRange
*iface
)
5614 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5616 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5619 static HRESULT WINAPI
DocumentRange_GetTypeInfoCount(IDocumentRange
*iface
, UINT
*pctinfo
)
5621 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5623 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
5626 static HRESULT WINAPI
DocumentRange_GetTypeInfo(IDocumentRange
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
5628 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5630 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
5633 static HRESULT WINAPI
DocumentRange_GetIDsOfNames(IDocumentRange
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
5634 LCID lcid
, DISPID
*rgDispId
)
5636 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5638 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
5642 static HRESULT WINAPI
DocumentRange_Invoke(IDocumentRange
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
5643 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
5645 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5647 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
5648 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
5651 static HRESULT WINAPI
DocumentRange_createRange(IDocumentRange
*iface
, IHTMLDOMRange
**p
)
5653 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5654 nsIDOMRange
*nsrange
;
5657 TRACE("(%p)->(%p)\n", This
, p
);
5659 if(!This
->dom_document
) {
5660 WARN("NULL dom_document\n");
5661 return E_UNEXPECTED
;
5664 if(NS_FAILED(nsIDOMDocument_CreateRange(This
->dom_document
, &nsrange
)))
5667 hres
= create_dom_range(nsrange
, dispex_compat_mode(&This
->node
.event_target
.dispex
), p
);
5668 nsIDOMRange_Release(nsrange
);
5672 static const IDocumentRangeVtbl DocumentRangeVtbl
= {
5673 DocumentRange_QueryInterface
,
5674 DocumentRange_AddRef
,
5675 DocumentRange_Release
,
5676 DocumentRange_GetTypeInfoCount
,
5677 DocumentRange_GetTypeInfo
,
5678 DocumentRange_GetIDsOfNames
,
5679 DocumentRange_Invoke
,
5680 DocumentRange_createRange
5683 static cp_static_data_t HTMLDocumentNodeEvents_data
= { HTMLDocumentEvents_tid
, HTMLDocumentNode_on_advise
};
5684 static cp_static_data_t HTMLDocumentNodeEvents2_data
= { HTMLDocumentEvents2_tid
, HTMLDocumentNode_on_advise
, TRUE
};
5686 static const cpc_entry_t HTMLDocumentNode_cpc
[] = {
5687 {&IID_IDispatch
, &HTMLDocumentNodeEvents_data
},
5688 {&IID_IPropertyNotifySink
},
5689 {&DIID_HTMLDocumentEvents
, &HTMLDocumentNodeEvents_data
},
5690 {&DIID_HTMLDocumentEvents2
, &HTMLDocumentNodeEvents2_data
},
5694 static inline HTMLDocumentNode
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
5696 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
);
5699 void detach_document_node(HTMLDocumentNode
*doc
)
5703 while(!list_empty(&doc
->plugin_hosts
))
5704 detach_plugin_host(LIST_ENTRY(list_head(&doc
->plugin_hosts
), PluginHost
, entry
));
5706 if(doc
->dom_implementation
)
5707 detach_dom_implementation(doc
->dom_implementation
);
5709 unlink_ref(&doc
->dom_implementation
);
5710 unlink_ref(&doc
->namespaces
);
5712 detach_selection(doc
);
5715 for(i
=0; i
< doc
->elem_vars_cnt
; i
++)
5716 free(doc
->elem_vars
[i
]);
5717 free(doc
->elem_vars
);
5718 doc
->elem_vars_cnt
= doc
->elem_vars_size
= 0;
5719 doc
->elem_vars
= NULL
;
5721 unlink_ref(&doc
->catmgr
);
5723 list_remove(&doc
->browser_entry
);
5724 doc
->browser
= NULL
;
5728 static HRESULT
HTMLDocumentNode_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
5730 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
5731 FIXME("%p\n", This
);
5735 static const NodeImplVtbl HTMLDocumentNodeImplVtbl
= {
5736 .clsid
= &CLSID_HTMLDocument
,
5737 .cpc_entries
= HTMLDocumentNode_cpc
,
5738 .clone
= HTMLDocumentNode_clone
,
5741 static HRESULT
HTMLDocumentFragment_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
5743 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
5744 HTMLDocumentNode
*new_node
;
5747 hres
= create_document_fragment(nsnode
, This
->node
.doc
, &new_node
);
5751 *ret
= &new_node
->node
;
5755 static inline HTMLDocumentNode
*impl_from_DispatchEx(DispatchEx
*iface
)
5757 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
.event_target
.dispex
);
5760 static void *HTMLDocumentNode_query_interface(DispatchEx
*dispex
, REFIID riid
)
5762 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5764 if(IsEqualGUID(&IID_IDispatch
, riid
) || IsEqualGUID(&IID_IDispatchEx
, riid
))
5765 return &This
->IDispatchEx_iface
;
5766 if(IsEqualGUID(&IID_IHTMLDocument
, riid
) || IsEqualGUID(&IID_IHTMLDocument2
, riid
))
5767 return &This
->IHTMLDocument2_iface
;
5768 if(IsEqualGUID(&IID_IHTMLDocument3
, riid
))
5769 return &This
->IHTMLDocument3_iface
;
5770 if(IsEqualGUID(&IID_IHTMLDocument4
, riid
))
5771 return &This
->IHTMLDocument4_iface
;
5772 if(IsEqualGUID(&IID_IHTMLDocument5
, riid
))
5773 return &This
->IHTMLDocument5_iface
;
5774 if(IsEqualGUID(&IID_IHTMLDocument6
, riid
))
5775 return &This
->IHTMLDocument6_iface
;
5776 if(IsEqualGUID(&IID_IHTMLDocument7
, riid
))
5777 return &This
->IHTMLDocument7_iface
;
5778 if(IsEqualGUID(&IID_IDocumentSelector
, riid
))
5779 return &This
->IDocumentSelector_iface
;
5780 if(IsEqualGUID(&IID_IDocumentEvent
, riid
))
5781 return &This
->IDocumentEvent_iface
;
5782 if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
))
5783 return &This
->IHTMLDocument2_iface
;
5784 if(IsEqualGUID(&IID_ISupportErrorInfo
, riid
))
5785 return &This
->ISupportErrorInfo_iface
;
5786 if(IsEqualGUID(&IID_IProvideClassInfo
, riid
))
5787 return &This
->IProvideMultipleClassInfo_iface
;
5788 if(IsEqualGUID(&IID_IProvideClassInfo2
, riid
))
5789 return &This
->IProvideMultipleClassInfo_iface
;
5790 if(IsEqualGUID(&IID_IProvideMultipleClassInfo
, riid
))
5791 return &This
->IProvideMultipleClassInfo_iface
;
5792 if(IsEqualGUID(&IID_IMarkupServices
, riid
))
5793 return &This
->IMarkupServices_iface
;
5794 if(IsEqualGUID(&IID_IMarkupContainer
, riid
))
5795 return &This
->IMarkupContainer_iface
;
5796 if(IsEqualGUID(&IID_IDisplayServices
, riid
))
5797 return &This
->IDisplayServices_iface
;
5798 if(IsEqualGUID(&IID_IDocumentRange
, riid
))
5799 return &This
->IDocumentRange_iface
;
5800 if(IsEqualGUID(&IID_IPersist
, riid
))
5801 return &This
->IPersistFile_iface
;
5802 if(IsEqualGUID(&IID_IPersistMoniker
, riid
))
5803 return &This
->IPersistMoniker_iface
;
5804 if(IsEqualGUID(&IID_IPersistFile
, riid
))
5805 return &This
->IPersistFile_iface
;
5806 if(IsEqualGUID(&IID_IMonikerProp
, riid
))
5807 return &This
->IMonikerProp_iface
;
5808 if(IsEqualGUID(&IID_IPersistStreamInit
, riid
))
5809 return &This
->IPersistStreamInit_iface
;
5810 if(IsEqualGUID(&IID_IPersistHistory
, riid
))
5811 return &This
->IPersistHistory_iface
;
5812 if(IsEqualGUID(&IID_IHlinkTarget
, riid
))
5813 return &This
->IHlinkTarget_iface
;
5814 if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
5815 return &This
->IOleCommandTarget_iface
;
5816 if(IsEqualGUID(&IID_IOleObject
, riid
))
5817 return &This
->IOleObject_iface
;
5818 if(IsEqualGUID(&IID_IOleDocument
, riid
))
5819 return &This
->IOleDocument_iface
;
5820 if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
))
5821 return &This
->IOleInPlaceActiveObject_iface
;
5822 if(IsEqualGUID(&IID_IOleWindow
, riid
))
5823 return &This
->IOleInPlaceActiveObject_iface
;
5824 if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
))
5825 return &This
->IOleInPlaceObjectWindowless_iface
;
5826 if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
))
5827 return &This
->IOleInPlaceObjectWindowless_iface
;
5828 if(IsEqualGUID(&IID_IOleControl
, riid
))
5829 return &This
->IOleControl_iface
;
5830 if(IsEqualGUID(&IID_IObjectWithSite
, riid
))
5831 return &This
->IObjectWithSite_iface
;
5832 if(IsEqualGUID(&IID_IOleContainer
, riid
))
5833 return &This
->IOleContainer_iface
;
5834 if(IsEqualGUID(&IID_IObjectSafety
, riid
))
5835 return &This
->IObjectSafety_iface
;
5836 if(IsEqualGUID(&IID_IServiceProvider
, riid
))
5837 return &This
->IServiceProvider_iface
;
5838 if(IsEqualGUID(&IID_IInternetHostSecurityManager
, riid
))
5839 return &This
->IInternetHostSecurityManager_iface
;
5840 if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
))
5841 return &This
->cp_container
.IConnectionPointContainer_iface
;
5842 if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
5843 FIXME("(%p)->(CLSID_CMarkup)\n", This
);
5845 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
5847 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
5849 }else if(IsEqualGUID(&IID_IExternalConnection
, riid
)) {
5851 }else if(IsEqualGUID(&IID_IStdMarshalInfo
, riid
)) {
5855 return HTMLDOMNode_query_interface(&This
->node
.event_target
.dispex
, riid
);
5858 static void HTMLDocumentNode_unlink(DispatchEx
*dispex
)
5860 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5861 HTMLDOMNode_unlink(dispex
);
5863 if(This
->dom_document
) {
5864 release_document_mutation(This
);
5865 detach_document_node(This
);
5866 This
->dom_document
= NULL
;
5867 This
->html_document
= NULL
;
5868 This
->window
= NULL
;
5869 }else if(This
->window
) {
5870 detach_document_node(This
);
5872 /* document fragments own reference to inner window */
5873 IHTMLWindow2_Release(&This
->window
->base
.IHTMLWindow2_iface
);
5874 This
->window
= NULL
;
5878 static void HTMLDocumentNode_destructor(DispatchEx
*dispex
)
5880 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5882 free(This
->event_vector
);
5883 ConnectionPointContainer_Destroy(&This
->cp_container
);
5884 HTMLDOMNode_destructor(&This
->node
.event_target
.dispex
);
5887 static HRESULT
HTMLDocumentNode_get_name(DispatchEx
*dispex
, DISPID id
, BSTR
*name
)
5889 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5890 DWORD idx
= id
- MSHTML_DISPID_CUSTOM_MIN
;
5892 if(!This
->dom_document
|| idx
>= This
->elem_vars_cnt
)
5893 return DISP_E_MEMBERNOTFOUND
;
5895 return (*name
= SysAllocString(This
->elem_vars
[idx
])) ? S_OK
: E_OUTOFMEMORY
;
5898 static HRESULT
HTMLDocumentNode_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
5899 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
5901 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5902 nsIDOMElement
*nselem
;
5907 if(flags
!= DISPATCH_PROPERTYGET
&& flags
!= (DISPATCH_METHOD
|DISPATCH_PROPERTYGET
))
5908 return MSHTML_E_INVALID_PROPERTY
;
5910 i
= id
- MSHTML_DISPID_CUSTOM_MIN
;
5912 if(!This
->html_document
|| i
>= This
->elem_vars_cnt
)
5913 return DISP_E_MEMBERNOTFOUND
;
5915 hres
= get_elem_by_name_or_id(This
->html_document
, This
->elem_vars
[i
], &nselem
);
5919 return DISP_E_MEMBERNOTFOUND
;
5921 hres
= get_node((nsIDOMNode
*)nselem
, TRUE
, &node
);
5922 nsIDOMElement_Release(nselem
);
5926 V_VT(res
) = VT_DISPATCH
;
5927 V_DISPATCH(res
) = (IDispatch
*)&node
->IHTMLDOMNode_iface
;
5931 static HRESULT
HTMLDocumentNode_next_dispid(DispatchEx
*dispex
, DISPID id
, DISPID
*pid
)
5933 DWORD idx
= (id
== DISPID_STARTENUM
) ? 0 : id
- MSHTML_DISPID_CUSTOM_MIN
+ 1;
5934 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5935 nsIDOMNodeList
*node_list
;
5936 const PRUnichar
*name
;
5937 nsIDOMElement
*nselem
;
5944 if(!This
->html_document
)
5947 while(idx
< This
->elem_vars_cnt
) {
5948 hres
= has_elem_name(This
->html_document
, This
->elem_vars
[idx
]);
5949 if(SUCCEEDED(hres
)) {
5950 *pid
= idx
+ MSHTML_DISPID_CUSTOM_MIN
;
5953 if(hres
!= DISP_E_UNKNOWNNAME
)
5958 /* Populate possibly missing DISPIDs */
5959 nsAString_InitDepend(&nsstr
, L
":-moz-any(applet,embed,form,iframe,img,object)[name]");
5960 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->html_document
, &nsstr
, &node_list
);
5961 nsAString_Finish(&nsstr
);
5962 if(NS_FAILED(nsres
))
5963 return map_nsresult(nsres
);
5965 for(i
= 0, hres
= S_OK
; SUCCEEDED(hres
); i
++) {
5966 nsres
= nsIDOMNodeList_Item(node_list
, i
, &nsnode
);
5967 if(NS_FAILED(nsres
)) {
5968 hres
= map_nsresult(nsres
);
5974 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMElement
, (void**)&nselem
);
5975 nsIDOMNode_Release(nsnode
);
5979 nsres
= get_elem_attr_value(nselem
, L
"name", &nsstr
, &name
);
5980 nsIDOMElement_Release(nselem
);
5981 if(NS_FAILED(nsres
))
5982 hres
= map_nsresult(nsres
);
5984 hres
= dispid_from_elem_name(This
, name
, &id
);
5985 nsAString_Finish(&nsstr
);
5988 nsIDOMNodeList_Release(node_list
);
5992 if(idx
>= This
->elem_vars_cnt
)
5995 *pid
= idx
+ MSHTML_DISPID_CUSTOM_MIN
;
5999 static compat_mode_t
HTMLDocumentNode_get_compat_mode(DispatchEx
*dispex
)
6001 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6003 TRACE("(%p) returning %u\n", This
, This
->document_mode
);
6005 return lock_document_mode(This
);
6008 static nsISupports
*HTMLDocumentNode_get_gecko_target(DispatchEx
*dispex
)
6010 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6011 return (nsISupports
*)This
->node
.nsnode
;
6014 static void HTMLDocumentNode_bind_event(DispatchEx
*dispex
, eventid_t eid
)
6016 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6017 ensure_doc_nsevent_handler(This
, This
->node
.nsnode
, eid
);
6020 static EventTarget
*HTMLDocumentNode_get_parent_event_target(DispatchEx
*dispex
)
6022 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6025 IHTMLWindow2_AddRef(&This
->window
->base
.IHTMLWindow2_iface
);
6026 return &This
->window
->event_target
;
6029 static ConnectionPointContainer
*HTMLDocumentNode_get_cp_container(DispatchEx
*dispex
)
6031 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6032 ConnectionPointContainer
*container
= This
->doc_obj
6033 ? &This
->doc_obj
->cp_container
: &This
->cp_container
;
6034 IConnectionPointContainer_AddRef(&container
->IConnectionPointContainer_iface
);
6038 static IHTMLEventObj
*HTMLDocumentNode_set_current_event(DispatchEx
*dispex
, IHTMLEventObj
*event
)
6040 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6041 return default_set_current_event(This
->window
, event
);
6044 static HRESULT
HTMLDocumentNode_location_hook(DispatchEx
*dispex
, WORD flags
, DISPPARAMS
*dp
, VARIANT
*res
,
6045 EXCEPINFO
*ei
, IServiceProvider
*caller
)
6047 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
6049 if(!(flags
& DISPATCH_PROPERTYPUT
) || !This
->outer_window
)
6052 return IDispatchEx_InvokeEx(&This
->outer_window
->base
.IDispatchEx_iface
, DISPID_IHTMLWINDOW2_LOCATION
,
6053 0, flags
, dp
, res
, ei
, caller
);
6056 static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl
= {
6058 .query_interface
= HTMLDocumentNode_query_interface
,
6059 .destructor
= HTMLDocumentNode_destructor
,
6060 .traverse
= HTMLDOMNode_traverse
,
6061 .unlink
= HTMLDocumentNode_unlink
,
6062 .get_name
= HTMLDocumentNode_get_name
,
6063 .invoke
= HTMLDocumentNode_invoke
,
6064 .next_dispid
= HTMLDocumentNode_next_dispid
,
6065 .get_compat_mode
= HTMLDocumentNode_get_compat_mode
,
6067 .get_gecko_target
= HTMLDocumentNode_get_gecko_target
,
6068 .bind_event
= HTMLDocumentNode_bind_event
,
6069 .get_parent_event_target
= HTMLDocumentNode_get_parent_event_target
,
6070 .get_cp_container
= HTMLDocumentNode_get_cp_container
,
6071 .set_current_event
= HTMLDocumentNode_set_current_event
6074 static const NodeImplVtbl HTMLDocumentFragmentImplVtbl
= {
6075 .clsid
= &CLSID_HTMLDocument
,
6076 .cpc_entries
= HTMLDocumentNode_cpc
,
6077 .clone
= HTMLDocumentFragment_clone
,
6080 static const tid_t HTMLDocumentNode_iface_tids
[] = {
6085 IDocumentSelector_tid
,
6089 static void HTMLDocumentNode_init_dispex_info(dispex_data_t
*info
, compat_mode_t mode
)
6091 static const dispex_hook_t document2_hooks
[] = {
6092 {DISPID_IHTMLDOCUMENT2_URL
, NULL
, L
"URL"},
6093 {DISPID_IHTMLDOCUMENT2_LOCATION
, HTMLDocumentNode_location_hook
},
6096 static const dispex_hook_t document2_ie11_hooks
[] = {
6097 {DISPID_IHTMLDOCUMENT2_URL
, NULL
, L
"URL"},
6098 {DISPID_IHTMLDOCUMENT2_LOCATION
, HTMLDocumentNode_location_hook
},
6099 {DISPID_IHTMLDOCUMENT2_CREATESTYLESHEET
, NULL
},
6100 {DISPID_IHTMLDOCUMENT2_FILESIZE
, NULL
},
6101 {DISPID_IHTMLDOCUMENT2_SELECTION
, NULL
},
6104 static const dispex_hook_t document3_ie11_hooks
[] = {
6105 {DISPID_IHTMLDOCUMENT3_ATTACHEVENT
, NULL
},
6106 {DISPID_IHTMLDOCUMENT3_DETACHEVENT
, NULL
},
6109 static const dispex_hook_t document6_ie9_hooks
[] = {
6110 {DISPID_IHTMLDOCUMENT6_ONSTORAGE
},
6114 HTMLDOMNode_init_dispex_info(info
, mode
);
6116 if(mode
>= COMPAT_MODE_IE9
) {
6117 dispex_info_add_interface(info
, IHTMLDocument7_tid
, NULL
);
6118 dispex_info_add_interface(info
, IDocumentEvent_tid
, NULL
);
6121 /* Depending on compatibility version, we add interfaces in different order
6122 * so that the right getElementById implementation is used. */
6123 if(mode
< COMPAT_MODE_IE8
) {
6124 dispex_info_add_interface(info
, IHTMLDocument3_tid
, NULL
);
6125 dispex_info_add_interface(info
, IHTMLDocument6_tid
, NULL
);
6127 dispex_info_add_interface(info
, IHTMLDocument6_tid
, mode
>= COMPAT_MODE_IE9
? document6_ie9_hooks
: NULL
);
6128 dispex_info_add_interface(info
, IHTMLDocument3_tid
, mode
>= COMPAT_MODE_IE11
? document3_ie11_hooks
: NULL
);
6130 dispex_info_add_interface(info
, IHTMLDocument2_tid
, mode
>= COMPAT_MODE_IE11
? document2_ie11_hooks
: document2_hooks
);
6133 static dispex_static_data_t HTMLDocumentNode_dispex
= {
6135 &HTMLDocumentNode_event_target_vtbl
.dispex_vtbl
,
6136 DispHTMLDocument_tid
,
6137 HTMLDocumentNode_iface_tids
,
6138 HTMLDocumentNode_init_dispex_info
6141 static HTMLDocumentNode
*alloc_doc_node(HTMLDocumentObj
*doc_obj
, HTMLInnerWindow
*window
)
6143 HTMLDocumentNode
*doc
;
6145 doc
= calloc(1, sizeof(HTMLDocumentNode
));
6149 doc
->IDispatchEx_iface
.lpVtbl
= &DocDispatchExVtbl
;
6150 doc
->IHTMLDocument2_iface
.lpVtbl
= &HTMLDocumentVtbl
;
6151 doc
->IHTMLDocument3_iface
.lpVtbl
= &HTMLDocument3Vtbl
;
6152 doc
->IHTMLDocument4_iface
.lpVtbl
= &HTMLDocument4Vtbl
;
6153 doc
->IHTMLDocument5_iface
.lpVtbl
= &HTMLDocument5Vtbl
;
6154 doc
->IHTMLDocument6_iface
.lpVtbl
= &HTMLDocument6Vtbl
;
6155 doc
->IHTMLDocument7_iface
.lpVtbl
= &HTMLDocument7Vtbl
;
6156 doc
->IDocumentSelector_iface
.lpVtbl
= &DocumentSelectorVtbl
;
6157 doc
->IDocumentEvent_iface
.lpVtbl
= &DocumentEventVtbl
;
6158 doc
->ISupportErrorInfo_iface
.lpVtbl
= &SupportErrorInfoVtbl
;
6159 doc
->IProvideMultipleClassInfo_iface
.lpVtbl
= &ProvideMultipleClassInfoVtbl
;
6160 doc
->IMarkupServices_iface
.lpVtbl
= &MarkupServicesVtbl
;
6161 doc
->IMarkupContainer_iface
.lpVtbl
= &MarkupContainerVtbl
;
6162 doc
->IDisplayServices_iface
.lpVtbl
= &DisplayServicesVtbl
;
6163 doc
->IDocumentRange_iface
.lpVtbl
= &DocumentRangeVtbl
;
6165 doc
->doc_obj
= doc_obj
;
6166 doc
->outer_window
= window
? window
->base
.outer_window
: NULL
;
6167 doc
->window
= window
;
6169 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)&doc
->IHTMLDocument2_iface
, HTMLDocumentNode_cpc
);
6170 HTMLDocumentNode_Persist_Init(doc
);
6171 HTMLDocumentNode_Service_Init(doc
);
6172 HTMLDocumentNode_OleCmd_Init(doc
);
6173 HTMLDocumentNode_OleObj_Init(doc
);
6174 HTMLDocumentNode_SecMgr_Init(doc
);
6176 list_init(&doc
->selection_list
);
6177 list_init(&doc
->range_list
);
6178 list_init(&doc
->plugin_hosts
);
6183 HRESULT
create_document_node(nsIDOMDocument
*nsdoc
, GeckoBrowser
*browser
, HTMLInnerWindow
*window
,
6184 compat_mode_t parent_mode
, HTMLDocumentNode
**ret
)
6186 HTMLDocumentObj
*doc_obj
= browser
->doc
;
6187 HTMLDocumentNode
*doc
;
6189 doc
= alloc_doc_node(doc_obj
, window
);
6191 return E_OUTOFMEMORY
;
6193 if(parent_mode
>= COMPAT_MODE_IE9
) {
6194 TRACE("using parent mode %u\n", parent_mode
);
6195 doc
->document_mode
= parent_mode
;
6196 lock_document_mode(doc
);
6199 if(!doc_obj
->window
|| (window
&& is_main_content_window(window
->base
.outer_window
)))
6200 doc
->cp_container
.forward_container
= &doc_obj
->cp_container
;
6202 /* Share reference with HTMLDOMNode */
6203 if(NS_SUCCEEDED(nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMHTMLDocument
, (void**)&doc
->html_document
))) {
6204 doc
->dom_document
= (nsIDOMDocument
*)doc
->html_document
;
6205 nsIDOMHTMLDocument_Release(doc
->html_document
);
6207 doc
->dom_document
= nsdoc
;
6208 doc
->html_document
= NULL
;
6211 HTMLDOMNode_Init(doc
, &doc
->node
, (nsIDOMNode
*)doc
->dom_document
, &HTMLDocumentNode_dispex
);
6213 init_document_mutation(doc
);
6214 doc_init_events(doc
);
6216 doc
->node
.vtbl
= &HTMLDocumentNodeImplVtbl
;
6218 list_add_head(&browser
->document_nodes
, &doc
->browser_entry
);
6219 doc
->browser
= browser
;
6221 if(browser
->usermode
== EDITMODE
&& doc
->html_document
) {
6225 nsAString_InitDepend(&mode_str
, L
"on");
6226 nsres
= nsIDOMHTMLDocument_SetDesignMode(doc
->html_document
, &mode_str
);
6227 nsAString_Finish(&mode_str
);
6228 if(NS_FAILED(nsres
))
6229 ERR("SetDesignMode failed: %08lx\n", nsres
);
6236 static HRESULT
create_document_fragment(nsIDOMNode
*nsnode
, HTMLDocumentNode
*doc_node
, HTMLDocumentNode
**ret
)
6238 HTMLDocumentNode
*doc_frag
;
6240 doc_frag
= alloc_doc_node(doc_node
->doc_obj
, doc_node
->window
);
6242 return E_OUTOFMEMORY
;
6244 IHTMLWindow2_AddRef(&doc_frag
->window
->base
.IHTMLWindow2_iface
);
6246 HTMLDOMNode_Init(doc_node
, &doc_frag
->node
, nsnode
, &HTMLDocumentNode_dispex
);
6247 doc_frag
->node
.vtbl
= &HTMLDocumentFragmentImplVtbl
;
6248 doc_frag
->document_mode
= lock_document_mode(doc_node
);
6254 HRESULT
get_document_node(nsIDOMDocument
*dom_document
, HTMLDocumentNode
**ret
)
6259 hres
= get_node((nsIDOMNode
*)dom_document
, FALSE
, &node
);
6264 ERR("document not initialized\n");
6268 assert(node
->vtbl
== &HTMLDocumentNodeImplVtbl
);
6269 *ret
= impl_from_HTMLDOMNode(node
);