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 DISPEX_IDISPATCH_IMPL(DocumentType
, IDOMDocumentType
,
162 impl_from_IDOMDocumentType(iface
)->node
.event_target
.dispex
)
164 static HRESULT WINAPI
DocumentType_get_name(IDOMDocumentType
*iface
, BSTR
*p
)
166 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
170 TRACE("(%p)->(%p)\n", This
, p
);
172 nsAString_Init(&nsstr
, NULL
);
173 nsres
= nsIDOMDocumentType_GetName((nsIDOMDocumentType
*)This
->node
.nsnode
, &nsstr
);
174 return return_nsstr(nsres
, &nsstr
, p
);
177 static HRESULT WINAPI
DocumentType_get_entities(IDOMDocumentType
*iface
, IDispatch
**p
)
179 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
181 FIXME("(%p)->(%p)\n", This
, p
);
186 static HRESULT WINAPI
DocumentType_get_notations(IDOMDocumentType
*iface
, IDispatch
**p
)
188 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
190 FIXME("(%p)->(%p)\n", This
, p
);
195 static HRESULT WINAPI
DocumentType_get_publicId(IDOMDocumentType
*iface
, VARIANT
*p
)
197 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
199 FIXME("(%p)->(%p)\n", This
, p
);
204 static HRESULT WINAPI
DocumentType_get_systemId(IDOMDocumentType
*iface
, VARIANT
*p
)
206 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
208 FIXME("(%p)->(%p)\n", This
, p
);
213 static HRESULT WINAPI
DocumentType_get_internalSubset(IDOMDocumentType
*iface
, VARIANT
*p
)
215 DocumentType
*This
= impl_from_IDOMDocumentType(iface
);
217 FIXME("(%p)->(%p)\n", This
, p
);
222 static const IDOMDocumentTypeVtbl DocumentTypeVtbl
= {
223 DocumentType_QueryInterface
,
225 DocumentType_Release
,
226 DocumentType_GetTypeInfoCount
,
227 DocumentType_GetTypeInfo
,
228 DocumentType_GetIDsOfNames
,
230 DocumentType_get_name
,
231 DocumentType_get_entities
,
232 DocumentType_get_notations
,
233 DocumentType_get_publicId
,
234 DocumentType_get_systemId
,
235 DocumentType_get_internalSubset
238 static inline DocumentType
*DocumentType_from_HTMLDOMNode(HTMLDOMNode
*iface
)
240 return CONTAINING_RECORD(iface
, DocumentType
, node
);
243 static inline DocumentType
*DocumentType_from_DispatchEx(DispatchEx
*iface
)
245 return CONTAINING_RECORD(iface
, DocumentType
, node
.event_target
.dispex
);
248 static HRESULT
DocumentType_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
250 DocumentType
*This
= DocumentType_from_HTMLDOMNode(iface
);
252 return create_doctype_node(This
->node
.doc
, nsnode
, ret
);
255 static const cpc_entry_t DocumentType_cpc
[] = {{NULL
}};
257 static const NodeImplVtbl DocumentTypeImplVtbl
= {
258 .cpc_entries
= DocumentType_cpc
,
259 .clone
= DocumentType_clone
262 static void *DocumentType_query_interface(DispatchEx
*dispex
, REFIID riid
)
264 DocumentType
*This
= DocumentType_from_DispatchEx(dispex
);
266 if(IsEqualGUID(&IID_IDOMDocumentType
, riid
))
267 return &This
->IDOMDocumentType_iface
;
269 return HTMLDOMNode_query_interface(&This
->node
.event_target
.dispex
, riid
);
272 static nsISupports
*DocumentType_get_gecko_target(DispatchEx
*dispex
)
274 DocumentType
*This
= DocumentType_from_DispatchEx(dispex
);
275 return (nsISupports
*)This
->node
.nsnode
;
278 static EventTarget
*DocumentType_get_parent_event_target(DispatchEx
*dispex
)
280 DocumentType
*This
= DocumentType_from_DispatchEx(dispex
);
286 nsres
= nsIDOMNode_GetParentNode(This
->node
.nsnode
, &nsnode
);
287 assert(nsres
== NS_OK
);
291 hres
= get_node(nsnode
, TRUE
, &node
);
292 nsIDOMNode_Release(nsnode
);
296 return &node
->event_target
;
299 static IHTMLEventObj
*DocumentType_set_current_event(DispatchEx
*dispex
, IHTMLEventObj
*event
)
301 DocumentType
*This
= DocumentType_from_DispatchEx(dispex
);
302 return default_set_current_event(This
->node
.doc
->window
, event
);
305 static const event_target_vtbl_t DocumentType_event_target_vtbl
= {
307 .query_interface
= DocumentType_query_interface
,
308 .destructor
= HTMLDOMNode_destructor
,
309 .traverse
= HTMLDOMNode_traverse
,
310 .unlink
= HTMLDOMNode_unlink
312 .get_gecko_target
= DocumentType_get_gecko_target
,
313 .get_parent_event_target
= DocumentType_get_parent_event_target
,
314 .set_current_event
= DocumentType_set_current_event
317 static const tid_t DocumentType_iface_tids
[] = {
318 IDOMDocumentType_tid
,
325 static dispex_static_data_t DocumentType_dispex
= {
327 &DocumentType_event_target_vtbl
.dispex_vtbl
,
328 DispDOMDocumentType_tid
,
329 DocumentType_iface_tids
332 HRESULT
create_doctype_node(HTMLDocumentNode
*doc
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
334 nsIDOMDocumentType
*nsdoctype
;
335 DocumentType
*doctype
;
338 if(!(doctype
= calloc(1, sizeof(*doctype
))))
339 return E_OUTOFMEMORY
;
341 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMDocumentType
, (void**)&nsdoctype
);
342 assert(nsres
== NS_OK
);
344 doctype
->node
.vtbl
= &DocumentTypeImplVtbl
;
345 doctype
->IDOMDocumentType_iface
.lpVtbl
= &DocumentTypeVtbl
;
346 HTMLDOMNode_Init(doc
, &doctype
->node
, (nsIDOMNode
*)nsdoctype
, &DocumentType_dispex
);
347 nsIDOMDocumentType_Release(nsdoctype
);
349 *ret
= &doctype
->node
;
353 static inline HTMLDocumentNode
*impl_from_IHTMLDocument2(IHTMLDocument2
*iface
)
355 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument2_iface
);
358 DISPEX_IDISPATCH_IMPL(HTMLDocument
, IHTMLDocument2
,
359 impl_from_IHTMLDocument2(iface
)->node
.event_target
.dispex
)
361 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
363 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
366 TRACE("(%p)->(%p)\n", This
, p
);
368 hres
= IHTMLDocument7_get_parentWindow(&This
->IHTMLDocument7_iface
, (IHTMLWindow2
**)p
);
369 return hres
== S_OK
&& !*p
? E_PENDING
: hres
;
372 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
374 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
376 TRACE("(%p)->(%p)\n", This
, p
);
377 *p
= create_all_collection(&This
->node
, FALSE
);
382 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
384 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
385 nsIDOMElement
*nsbody
= NULL
;
386 HTMLElement
*element
;
390 TRACE("(%p)->(%p)\n", This
, p
);
392 if(This
->html_document
) {
393 nsres
= nsIDOMHTMLDocument_GetBody(This
->html_document
, (nsIDOMHTMLElement
**)&nsbody
);
394 if(NS_FAILED(nsres
)) {
395 TRACE("Could not get body: %08lx\n", nsres
);
399 nsAString nsnode_name
;
400 nsIDOMDocumentFragment
*frag
;
402 nsres
= nsIDOMNode_QueryInterface(This
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&frag
);
403 if(!NS_FAILED(nsres
)) {
404 nsAString_InitDepend(&nsnode_name
, L
"BODY");
405 nsIDOMDocumentFragment_QuerySelector(frag
, &nsnode_name
, &nsbody
);
406 nsAString_Finish(&nsnode_name
);
407 nsIDOMDocumentFragment_Release(frag
);
416 hres
= get_element(nsbody
, &element
);
417 nsIDOMElement_Release(nsbody
);
421 *p
= &element
->IHTMLElement_iface
;
425 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
427 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
428 nsIDOMElement
*nselem
;
433 TRACE("(%p)->(%p)\n", This
, p
);
435 if(!This
->dom_document
) {
441 * NOTE: Gecko may return an active element even if the document is not visible.
442 * IE returns NULL in this case.
444 nsres
= nsIDOMDocument_GetActiveElement(This
->dom_document
, &nselem
);
445 if(NS_FAILED(nsres
)) {
446 ERR("GetActiveElement failed: %08lx\n", nsres
);
455 hres
= get_element(nselem
, &elem
);
456 nsIDOMElement_Release(nselem
);
460 *p
= &elem
->IHTMLElement_iface
;
464 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
466 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
467 nsIDOMHTMLCollection
*nscoll
= NULL
;
470 TRACE("(%p)->(%p)\n", This
, p
);
477 if(!This
->dom_document
) {
478 WARN("NULL dom_document\n");
482 if(!This
->html_document
) {
483 FIXME("Not implemented for XML document\n");
487 nsres
= nsIDOMHTMLDocument_GetImages(This
->html_document
, &nscoll
);
488 if(NS_FAILED(nsres
)) {
489 ERR("GetImages failed: %08lx\n", nsres
);
494 *p
= create_collection_from_htmlcol(nscoll
, This
->document_mode
);
495 nsIDOMHTMLCollection_Release(nscoll
);
501 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
503 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
504 nsIDOMHTMLCollection
*nscoll
= NULL
;
507 TRACE("(%p)->(%p)\n", This
, p
);
514 if(!This
->dom_document
) {
515 WARN("NULL dom_document\n");
519 if(!This
->html_document
) {
520 FIXME("Not implemented for XML document\n");
524 nsres
= nsIDOMHTMLDocument_GetApplets(This
->html_document
, &nscoll
);
525 if(NS_FAILED(nsres
)) {
526 ERR("GetApplets failed: %08lx\n", nsres
);
531 *p
= create_collection_from_htmlcol(nscoll
, This
->document_mode
);
532 nsIDOMHTMLCollection_Release(nscoll
);
538 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
540 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
541 nsIDOMHTMLCollection
*nscoll
= NULL
;
544 TRACE("(%p)->(%p)\n", This
, p
);
551 if(!This
->dom_document
) {
552 WARN("NULL dom_document\n");
556 if(!This
->html_document
) {
557 FIXME("Not implemented for XML document\n");
561 nsres
= nsIDOMHTMLDocument_GetLinks(This
->html_document
, &nscoll
);
562 if(NS_FAILED(nsres
)) {
563 ERR("GetLinks failed: %08lx\n", nsres
);
568 *p
= create_collection_from_htmlcol(nscoll
, This
->document_mode
);
569 nsIDOMHTMLCollection_Release(nscoll
);
575 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
577 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
578 nsIDOMHTMLCollection
*nscoll
= NULL
;
581 TRACE("(%p)->(%p)\n", This
, p
);
588 if(!This
->dom_document
) {
589 WARN("NULL dom_document\n");
593 if(!This
->html_document
) {
594 FIXME("Not implemented for XML document\n");
598 nsres
= nsIDOMHTMLDocument_GetForms(This
->html_document
, &nscoll
);
599 if(NS_FAILED(nsres
)) {
600 ERR("GetForms failed: %08lx\n", nsres
);
605 *p
= create_collection_from_htmlcol(nscoll
, This
->document_mode
);
606 nsIDOMHTMLCollection_Release(nscoll
);
612 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
614 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
615 nsIDOMHTMLCollection
*nscoll
= NULL
;
618 TRACE("(%p)->(%p)\n", This
, p
);
625 if(!This
->dom_document
) {
626 WARN("NULL dom_document\n");
630 if(!This
->html_document
) {
631 FIXME("Not implemented for XML document\n");
635 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->html_document
, &nscoll
);
636 if(NS_FAILED(nsres
)) {
637 ERR("GetAnchors failed: %08lx\n", nsres
);
642 *p
= create_collection_from_htmlcol(nscoll
, This
->document_mode
);
643 nsIDOMHTMLCollection_Release(nscoll
);
649 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
651 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
655 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
657 if(!This
->dom_document
) {
658 WARN("NULL dom_document\n");
662 nsAString_InitDepend(&nsstr
, v
);
663 nsres
= nsIDOMDocument_SetTitle(This
->dom_document
, &nsstr
);
664 nsAString_Finish(&nsstr
);
666 ERR("SetTitle failed: %08lx\n", nsres
);
671 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
673 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
674 const PRUnichar
*ret
;
678 TRACE("(%p)->(%p)\n", This
, p
);
680 if(!This
->dom_document
) {
681 WARN("NULL dom_document\n");
686 nsAString_Init(&nsstr
, NULL
);
687 nsres
= nsIDOMDocument_GetTitle(This
->dom_document
, &nsstr
);
688 if (NS_SUCCEEDED(nsres
)) {
689 nsAString_GetData(&nsstr
, &ret
);
690 *p
= SysAllocString(ret
);
692 nsAString_Finish(&nsstr
);
694 if(NS_FAILED(nsres
)) {
695 ERR("GetTitle failed: %08lx\n", nsres
);
702 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
704 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
705 nsIDOMHTMLCollection
*nscoll
= NULL
;
708 TRACE("(%p)->(%p)\n", This
, p
);
715 if(!This
->dom_document
) {
716 WARN("NULL dom_document\n");
720 if(!This
->html_document
) {
721 FIXME("Not implemented for XML document\n");
725 nsres
= nsIDOMHTMLDocument_GetScripts(This
->html_document
, &nscoll
);
726 if(NS_FAILED(nsres
)) {
727 ERR("GetImages failed: %08lx\n", nsres
);
732 *p
= create_collection_from_htmlcol(nscoll
, This
->document_mode
);
733 nsIDOMHTMLCollection_Release(nscoll
);
739 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
741 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
742 HTMLDocumentObj
*doc_obj
;
745 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
747 if(wcsicmp(v
, L
"on")) {
748 FIXME("Unsupported arg %s\n", debugstr_w(v
));
752 doc_obj
= This
->doc_obj
;
753 IUnknown_AddRef(doc_obj
->outer_unk
);
754 hres
= setup_edit_mode(doc_obj
);
755 IUnknown_Release(doc_obj
->outer_unk
);
759 call_property_onchanged(&This
->cp_container
, DISPID_IHTMLDOCUMENT2_DESIGNMODE
);
763 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
765 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
766 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
771 *p
= SysAllocString(L
"Off");
776 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
778 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
779 nsISelection
*nsselection
;
782 TRACE("(%p)->(%p)\n", This
, p
);
784 if(!This
->html_document
) {
785 FIXME("Not implemented for XML document\n");
789 nsres
= nsIDOMHTMLDocument_GetSelection(This
->html_document
, &nsselection
);
790 if(NS_FAILED(nsres
)) {
791 ERR("GetSelection failed: %08lx\n", nsres
);
795 return HTMLSelectionObject_Create(This
, nsselection
, p
);
798 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
800 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
802 TRACE("(%p)->(%p)\n", iface
, p
);
807 return get_readystate_string(This
->window
&& This
->window
->base
.outer_window
? This
->window
->base
.outer_window
->readystate
: 0, p
);
810 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
812 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
814 TRACE("(%p)->(%p)\n", This
, p
);
817 /* Not implemented by IE */
820 if(!This
->window
->base
.outer_window
)
822 return IHTMLWindow2_get_frames(&This
->window
->base
.outer_window
->base
.IHTMLWindow2_iface
, p
);
825 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
827 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
828 FIXME("(%p)->(%p)\n", This
, p
);
832 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
834 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
835 FIXME("(%p)->(%p)\n", This
, p
);
839 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
841 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
842 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
846 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
848 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
849 FIXME("(%p)->(%p)\n", This
, p
);
853 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
855 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
856 IHTMLElement
*element
= NULL
;
857 IHTMLBodyElement
*body
;
860 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
862 hr
= IHTMLDocument2_get_body(iface
, &element
);
865 ERR("Failed to get body (0x%08lx)\n", hr
);
871 FIXME("Empty body element.\n");
875 hr
= IHTMLElement_QueryInterface(element
, &IID_IHTMLBodyElement
, (void**)&body
);
878 hr
= IHTMLBodyElement_put_bgColor(body
, v
);
879 IHTMLBodyElement_Release(body
);
881 IHTMLElement_Release(element
);
886 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
888 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
893 TRACE("(%p)->(%p)\n", This
, p
);
895 if(!This
->dom_document
) {
896 WARN("NULL dom_document\n");
900 if(!This
->html_document
) {
901 FIXME("Not implemented for XML document\n");
905 nsAString_Init(&nsstr
, NULL
);
906 nsres
= nsIDOMHTMLDocument_GetBgColor(This
->html_document
, &nsstr
);
907 hres
= return_nsstr_variant(nsres
, &nsstr
, NSSTR_COLOR
, p
);
908 if(hres
== S_OK
&& V_VT(p
) == VT_BSTR
&& !V_BSTR(p
)) {
909 TRACE("default #ffffff\n");
910 if(!(V_BSTR(p
) = SysAllocString(L
"#ffffff")))
911 hres
= E_OUTOFMEMORY
;
916 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
918 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
919 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
923 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
925 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
926 FIXME("(%p)->(%p)\n", This
, p
);
930 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
932 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
933 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
937 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
939 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
940 FIXME("(%p)->(%p)\n", This
, p
);
944 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
946 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
947 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
951 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
953 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
954 FIXME("(%p)->(%p)\n", This
, p
);
958 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
960 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
964 TRACE("(%p)->(%p)\n", This
, p
);
966 nsAString_InitDepend(&nsstr
, NULL
);
967 nsres
= nsIDOMDocument_GetReferrer(This
->dom_document
, &nsstr
);
968 return return_nsstr(nsres
, &nsstr
, p
);
971 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
973 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
975 TRACE("(%p)->(%p)\n", This
, p
);
977 if(!This
->dom_document
|| !This
->window
) {
978 WARN("NULL window\n");
982 return IHTMLWindow2_get_location(&This
->window
->base
.IHTMLWindow2_iface
, p
);
985 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
987 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
991 TRACE("(%p)->(%p)\n", This
, p
);
993 nsAString_Init(&nsstr
, NULL
);
994 nsres
= nsIDOMDocument_GetLastModified(This
->dom_document
, &nsstr
);
995 return return_nsstr(nsres
, &nsstr
, p
);
998 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
1000 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1002 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1004 if(!This
->window
|| !This
->window
->base
.outer_window
) {
1005 FIXME("No window available\n");
1009 return navigate_url(This
->window
->base
.outer_window
, v
,
1010 This
->window
->base
.outer_window
->uri
, BINDING_NAVIGATED
);
1013 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
1015 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1017 TRACE("(%p)->(%p)\n", iface
, p
);
1019 if(This
->window
&& !This
->window
->base
.outer_window
) {
1020 WARN("detached document\n");
1024 if(This
->window
&& This
->window
->base
.outer_window
->url
)
1025 *p
= SysAllocString(This
->window
->base
.outer_window
->url
);
1027 *p
= SysAllocString(L
"about:blank");
1028 return *p
? S_OK
: E_OUTOFMEMORY
;
1031 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
1033 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1037 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1039 if(!This
->html_document
) {
1040 FIXME("Not implemented for XML document\n");
1044 nsAString_InitDepend(&nsstr
, v
);
1045 nsres
= nsIDOMHTMLDocument_SetDomain(This
->html_document
, &nsstr
);
1046 nsAString_Finish(&nsstr
);
1047 if(NS_FAILED(nsres
)) {
1048 ERR("SetDomain failed: %08lx\n", nsres
);
1049 return E_INVALIDARG
;
1055 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
1057 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1061 TRACE("(%p)->(%p)\n", This
, p
);
1063 if(!This
->html_document
) {
1064 FIXME("Not implemented for XML document\n");
1068 if(This
->window
&& (!This
->window
->base
.outer_window
|| !This
->window
->base
.outer_window
->uri
))
1071 nsAString_Init(&nsstr
, NULL
);
1072 nsres
= nsIDOMHTMLDocument_GetDomain(This
->html_document
, &nsstr
);
1073 if(NS_SUCCEEDED(nsres
) && This
->window
) {
1074 const PRUnichar
*str
;
1077 nsAString_GetData(&nsstr
, &str
);
1079 TRACE("Gecko returned empty string, fallback to loaded URL.\n");
1080 nsAString_Finish(&nsstr
);
1081 hres
= IUri_GetHost(This
->window
->base
.outer_window
->uri
, p
);
1082 return FAILED(hres
) ? hres
: S_OK
;
1086 return return_nsstr(nsres
, &nsstr
, p
);
1089 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
1091 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1094 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
1098 if(!This
->window
->base
.outer_window
)
1101 bret
= InternetSetCookieExW(This
->window
->base
.outer_window
->url
, NULL
, v
, 0, 0);
1103 FIXME("InternetSetCookieExW failed: %lu\n", GetLastError());
1104 return HRESULT_FROM_WIN32(GetLastError());
1110 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
1112 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1116 TRACE("(%p)->(%p)\n", This
, p
);
1122 if(!This
->window
->base
.outer_window
)
1126 bret
= InternetGetCookieExW(This
->window
->base
.outer_window
->url
, NULL
, NULL
, &size
, 0, NULL
);
1127 if(!bret
&& GetLastError() != ERROR_INSUFFICIENT_BUFFER
) {
1128 WARN("InternetGetCookieExW failed: %lu\n", GetLastError());
1138 *p
= SysAllocStringLen(NULL
, size
/sizeof(WCHAR
)-1);
1140 return E_OUTOFMEMORY
;
1142 bret
= InternetGetCookieExW(This
->window
->base
.outer_window
->url
, NULL
, *p
, &size
, 0, NULL
);
1144 ERR("InternetGetCookieExW failed: %lu\n", GetLastError());
1151 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
1153 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1154 FIXME("(%p)->(%x)\n", This
, v
);
1158 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
1160 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1161 FIXME("(%p)->(%p)\n", This
, p
);
1165 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
1167 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1168 FIXME("(%p)->(%s) returning S_OK\n", This
, debugstr_w(v
));
1172 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
1174 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1176 TRACE("(%p)->(%p)\n", This
, p
);
1178 return IHTMLDocument7_get_characterSet(&This
->IHTMLDocument7_iface
, p
);
1181 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
1183 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1184 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
1188 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
1190 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1192 TRACE("(%p)->(%p)\n", This
, p
);
1194 *p
= charset_string_from_cp(GetACP());
1195 return *p
? S_OK
: E_OUTOFMEMORY
;
1198 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
1200 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1201 const PRUnichar
*content_type
;
1206 TRACE("(%p)->(%p)\n", This
, p
);
1210 if(This
->window
&& !This
->window
->navigation_start_time
)
1211 return (*p
= SysAllocString(L
"")) ? S_OK
: E_FAIL
;
1213 nsAString_InitDepend(&nsstr
, NULL
);
1214 nsres
= nsIDOMDocument_GetContentType(This
->dom_document
, &nsstr
);
1215 if(NS_FAILED(nsres
))
1216 return map_nsresult(nsres
);
1218 nsAString_GetData(&nsstr
, &content_type
);
1219 hres
= get_mime_type_display_name(content_type
, p
);
1220 nsAString_Finish(&nsstr
);
1224 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
1226 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1227 FIXME("(%p)->(%p)\n", This
, p
);
1231 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
1233 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1234 FIXME("(%p)->(%p)\n", This
, p
);
1238 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
1240 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1241 FIXME("(%p)->(%p)\n", This
, p
);
1245 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
1247 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1248 FIXME("(%p)->(%p)\n", This
, p
);
1252 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
1254 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1255 FIXME("(%p)->(%p)\n", This
, p
);
1259 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
1261 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1262 FIXME("(%p)->(%p)\n", This
, p
);
1266 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
1268 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1269 FIXME("(%p)->(%p)\n", This
, p
);
1273 static HRESULT
document_write(HTMLDocumentNode
*This
, SAFEARRAY
*psarray
, BOOL ln
)
1282 if(!This
->dom_document
) {
1283 WARN("NULL dom_document\n");
1284 return E_UNEXPECTED
;
1287 if(!This
->html_document
) {
1288 FIXME("Not implemented for XML document\n");
1295 if(psarray
->cDims
!= 1) {
1296 FIXME("cDims=%d\n", psarray
->cDims
);
1297 return E_INVALIDARG
;
1300 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
1302 WARN("SafeArrayAccessData failed: %08lx\n", hres
);
1306 V_VT(&tmp
) = VT_EMPTY
;
1308 jsctx
= get_context_from_document(This
->dom_document
);
1309 argc
= psarray
->rgsabound
[0].cElements
;
1310 for(i
=0; i
< argc
; i
++) {
1311 if(V_VT(var
+i
) == VT_BSTR
) {
1312 nsAString_InitDepend(&nsstr
, V_BSTR(var
+i
));
1314 hres
= VariantChangeTypeEx(&tmp
, var
+i
, MAKELCID(MAKELANGID(LANG_ENGLISH
,SUBLANG_ENGLISH_US
),SORT_DEFAULT
), 0, VT_BSTR
);
1316 WARN("Could not convert %s to string\n", debugstr_variant(var
+i
));
1319 nsAString_InitDepend(&nsstr
, V_BSTR(&tmp
));
1322 if(!ln
|| i
!= argc
-1)
1323 nsres
= nsIDOMHTMLDocument_Write(This
->html_document
, &nsstr
, jsctx
);
1325 nsres
= nsIDOMHTMLDocument_Writeln(This
->html_document
, &nsstr
, jsctx
);
1326 nsAString_Finish(&nsstr
);
1327 if(V_VT(var
+i
) != VT_BSTR
)
1329 if(NS_FAILED(nsres
)) {
1330 ERR("Write failed: %08lx\n", nsres
);
1336 SafeArrayUnaccessData(psarray
);
1341 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
1343 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1345 TRACE("(%p)->(%p)\n", iface
, psarray
);
1347 return document_write(This
, psarray
, FALSE
);
1350 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
1352 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1354 TRACE("(%p)->(%p)\n", This
, psarray
);
1356 return document_write(This
, psarray
, TRUE
);
1359 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
1360 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
1362 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1366 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
1367 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
1369 *pomWindowResult
= NULL
;
1371 if(!This
->window
|| !This
->window
->base
.outer_window
)
1374 if(!This
->dom_document
) {
1375 ERR("!dom_document\n");
1379 if(!This
->html_document
) {
1380 FIXME("Not implemented for XML document\n");
1384 if(!url
|| wcscmp(url
, L
"text/html") || V_VT(&name
) != VT_ERROR
1385 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
1386 FIXME("unsupported args\n");
1388 nsres
= nsIDOMHTMLDocument_Open(This
->html_document
, NULL
, NULL
, NULL
,
1389 get_context_from_document(This
->dom_document
), 0, &tmp
);
1390 if(NS_FAILED(nsres
)) {
1391 ERR("Open failed: %08lx\n", nsres
);
1396 nsISupports_Release(tmp
);
1398 *pomWindowResult
= (IDispatch
*)&This
->window
->base
.outer_window
->base
.IHTMLWindow2_iface
;
1399 IHTMLWindow2_AddRef(&This
->window
->base
.outer_window
->base
.IHTMLWindow2_iface
);
1403 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
1405 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1408 TRACE("(%p)\n", This
);
1410 if(!This
->dom_document
) {
1411 ERR("!dom_document\n");
1415 if(!This
->html_document
) {
1416 FIXME("Not implemented for XML document\n");
1420 nsres
= nsIDOMHTMLDocument_Close(This
->html_document
);
1421 if(NS_FAILED(nsres
)) {
1422 ERR("Close failed: %08lx\n", nsres
);
1429 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
1431 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1434 TRACE("(%p)\n", This
);
1436 if(!This
->html_document
) {
1437 FIXME("Not implemented for XML document\n");
1441 nsres
= nsIDOMHTMLDocument_Clear(This
->html_document
);
1442 if(NS_FAILED(nsres
)) {
1443 ERR("Clear failed: %08lx\n", nsres
);
1450 static const struct {
1453 }command_names
[] = {
1454 {L
"copy", IDM_COPY
},
1456 {L
"fontname", IDM_FONTNAME
},
1457 {L
"fontsize", IDM_FONTSIZE
},
1458 {L
"indent", IDM_INDENT
},
1459 {L
"insertorderedlist", IDM_ORDERLIST
},
1460 {L
"insertunorderedlist", IDM_UNORDERLIST
},
1461 {L
"outdent", IDM_OUTDENT
},
1462 {L
"paste", IDM_PASTE
},
1463 {L
"respectvisibilityindesign", IDM_RESPECTVISIBILITY_INDESIGN
}
1466 static BOOL
cmdid_from_string(const WCHAR
*str
, OLECMDID
*cmdid
)
1470 for(i
= 0; i
< ARRAY_SIZE(command_names
); i
++) {
1471 if(!wcsicmp(command_names
[i
].name
, str
)) {
1472 *cmdid
= command_names
[i
].id
;
1477 FIXME("Unknown command %s\n", debugstr_w(str
));
1481 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
1482 VARIANT_BOOL
*pfRet
)
1484 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1485 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1489 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
1490 VARIANT_BOOL
*pfRet
)
1492 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1493 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1497 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
1498 VARIANT_BOOL
*pfRet
)
1500 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1501 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1505 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
1506 VARIANT_BOOL
*pfRet
)
1508 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1509 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1513 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
1516 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1517 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1521 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
1524 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1525 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1529 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
1530 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
1532 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1537 TRACE("(%p)->(%s %x %s %p)\n", This
, debugstr_w(cmdID
), showUI
, debugstr_variant(&value
), pfRet
);
1539 if(!cmdid_from_string(cmdID
, &cmdid
))
1540 return OLECMDERR_E_NOTSUPPORTED
;
1542 V_VT(&ret
) = VT_EMPTY
;
1543 hres
= IOleCommandTarget_Exec(&This
->IOleCommandTarget_iface
, &CGID_MSHTML
, cmdid
,
1544 showUI
? 0 : OLECMDEXECOPT_DONTPROMPTUSER
, &value
, &ret
);
1548 if(V_VT(&ret
) != VT_EMPTY
) {
1549 FIXME("Handle ret %s\n", debugstr_variant(&ret
));
1553 *pfRet
= VARIANT_TRUE
;
1557 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
1558 VARIANT_BOOL
*pfRet
)
1560 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1561 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1565 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
1566 IHTMLElement
**newElem
)
1568 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1572 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1574 hres
= create_element(This
, eTag
, &elem
);
1578 *newElem
= &elem
->IHTMLElement_iface
;
1582 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1584 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1585 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1589 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1591 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1592 FIXME("(%p)->(%p)\n", This
, p
);
1596 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1598 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1600 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1602 return set_doc_event(This
, EVENTID_CLICK
, &v
);
1605 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1607 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1609 TRACE("(%p)->(%p)\n", This
, p
);
1611 return get_doc_event(This
, EVENTID_CLICK
, p
);
1614 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1616 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1618 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1620 return set_doc_event(This
, EVENTID_DBLCLICK
, &v
);
1623 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1625 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1627 TRACE("(%p)->(%p)\n", This
, p
);
1629 return get_doc_event(This
, EVENTID_DBLCLICK
, p
);
1632 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1634 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1636 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1638 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1641 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1643 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1645 TRACE("(%p)->(%p)\n", This
, p
);
1647 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1650 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1652 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1654 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1656 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1659 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1661 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1663 TRACE("(%p)->(%p)\n", This
, p
);
1665 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1668 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1670 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1672 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1674 return set_doc_event(This
, EVENTID_KEYPRESS
, &v
);
1677 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1679 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1681 TRACE("(%p)->(%p)\n", This
, p
);
1683 return get_doc_event(This
, EVENTID_KEYPRESS
, p
);
1686 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1688 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1690 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1692 return set_doc_event(This
, EVENTID_MOUSEUP
, &v
);
1695 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1697 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1699 TRACE("(%p)->(%p)\n", This
, p
);
1701 return get_doc_event(This
, EVENTID_MOUSEUP
, p
);
1704 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1706 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1708 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1710 return set_doc_event(This
, EVENTID_MOUSEDOWN
, &v
);
1713 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1715 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1717 TRACE("(%p)->(%p)\n", This
, p
);
1719 return get_doc_event(This
, EVENTID_MOUSEDOWN
, p
);
1722 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1724 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1726 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1728 return set_doc_event(This
, EVENTID_MOUSEMOVE
, &v
);
1731 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1733 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1735 TRACE("(%p)->(%p)\n", This
, p
);
1737 return get_doc_event(This
, EVENTID_MOUSEMOVE
, p
);
1740 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1742 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1744 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1746 return set_doc_event(This
, EVENTID_MOUSEOUT
, &v
);
1749 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1751 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1753 TRACE("(%p)->(%p)\n", This
, p
);
1755 return get_doc_event(This
, EVENTID_MOUSEOUT
, p
);
1758 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1760 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1762 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1764 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1767 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1769 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1771 TRACE("(%p)->(%p)\n", This
, p
);
1773 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1776 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1778 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1780 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1782 return set_doc_event(This
, EVENTID_READYSTATECHANGE
, &v
);
1785 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1787 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1789 TRACE("(%p)->(%p)\n", This
, p
);
1791 return get_doc_event(This
, EVENTID_READYSTATECHANGE
, p
);
1794 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1796 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1797 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1801 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1803 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1804 FIXME("(%p)->(%p)\n", This
, p
);
1808 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1810 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1811 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1815 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1817 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1818 FIXME("(%p)->(%p)\n", This
, p
);
1822 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1824 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1825 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1829 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1831 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1832 FIXME("(%p)->(%p)\n", This
, p
);
1836 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1838 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1840 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1842 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1845 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1847 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1849 TRACE("(%p)->(%p)\n", This
, p
);
1851 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1854 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1856 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1858 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1860 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1863 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1865 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1867 TRACE("(%p)->(%p)\n", This
, p
);
1869 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1872 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, LONG x
, LONG y
,
1873 IHTMLElement
**elementHit
)
1875 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1876 nsIDOMElement
*nselem
;
1877 HTMLElement
*element
;
1881 TRACE("(%p)->(%ld %ld %p)\n", This
, x
, y
, elementHit
);
1883 nsres
= nsIDOMDocument_ElementFromPoint(This
->dom_document
, x
, y
, &nselem
);
1884 if(NS_FAILED(nsres
)) {
1885 ERR("ElementFromPoint failed: %08lx\n", nsres
);
1894 hres
= get_element(nselem
, &element
);
1895 nsIDOMElement_Release(nselem
);
1899 *elementHit
= &element
->IHTMLElement_iface
;
1903 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1905 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1908 TRACE("(%p)->(%p)\n", This
, p
);
1910 hres
= IHTMLDocument7_get_defaultView(&This
->IHTMLDocument7_iface
, p
);
1911 return hres
== S_OK
&& !*p
? E_FAIL
: hres
;
1914 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1915 IHTMLStyleSheetsCollection
**p
)
1917 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1918 nsIDOMStyleSheetList
*nsstylelist
;
1922 TRACE("(%p)->(%p)\n", This
, p
);
1926 if(!This
->dom_document
) {
1927 WARN("NULL dom_document\n");
1928 return E_UNEXPECTED
;
1931 nsres
= nsIDOMDocument_GetStyleSheets(This
->dom_document
, &nsstylelist
);
1932 if(NS_FAILED(nsres
)) {
1933 ERR("GetStyleSheets failed: %08lx\n", nsres
);
1934 return map_nsresult(nsres
);
1937 hres
= create_style_sheet_collection(nsstylelist
,
1938 dispex_compat_mode(&This
->node
.event_target
.dispex
), p
);
1939 nsIDOMStyleSheetList_Release(nsstylelist
);
1943 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1945 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1946 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1950 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1952 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1953 FIXME("(%p)->(%p)\n", This
, p
);
1957 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1959 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1960 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1964 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1966 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1967 FIXME("(%p)->(%p)\n", This
, p
);
1971 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1973 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1975 TRACE("(%p)->(%p)\n", This
, String
);
1977 return dispex_to_string(&This
->node
.event_target
.dispex
, String
);
1980 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1981 LONG lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1983 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
);
1984 nsIDOMHTMLHeadElement
*head_elem
;
1985 IHTMLStyleElement
*style_elem
;
1990 TRACE("(%p)->(%s %ld %p)\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1992 if(!This
->dom_document
) {
1993 FIXME("not a real doc object\n");
1997 if(!This
->html_document
) {
1998 FIXME("Not implemented for XML document\n");
2003 FIXME("Unsupported lIndex %ld\n", lIndex
);
2005 if(bstrHref
&& *bstrHref
) {
2006 FIXME("semi-stub for href %s\n", debugstr_w(bstrHref
));
2007 return create_style_sheet(NULL
, dispex_compat_mode(&This
->node
.event_target
.dispex
),
2011 hres
= create_element(This
, L
"style", &elem
);
2015 nsres
= nsIDOMHTMLDocument_GetHead(This
->html_document
, &head_elem
);
2016 if(NS_SUCCEEDED(nsres
)) {
2017 nsIDOMNode
*head_node
, *tmp_node
;
2019 nsres
= nsIDOMHTMLHeadElement_QueryInterface(head_elem
, &IID_nsIDOMNode
, (void**)&head_node
);
2020 nsIDOMHTMLHeadElement_Release(head_elem
);
2021 assert(nsres
== NS_OK
);
2023 nsres
= nsIDOMNode_AppendChild(head_node
, elem
->node
.nsnode
, &tmp_node
);
2024 nsIDOMNode_Release(head_node
);
2025 if(NS_SUCCEEDED(nsres
) && tmp_node
)
2026 nsIDOMNode_Release(tmp_node
);
2028 if(NS_FAILED(nsres
)) {
2029 IHTMLElement_Release(&elem
->IHTMLElement_iface
);
2033 hres
= IHTMLElement_QueryInterface(&elem
->IHTMLElement_iface
, &IID_IHTMLStyleElement
, (void**)&style_elem
);
2034 assert(hres
== S_OK
);
2035 IHTMLElement_Release(&elem
->IHTMLElement_iface
);
2037 hres
= IHTMLStyleElement_get_styleSheet(style_elem
, ppnewStyleSheet
);
2038 IHTMLStyleElement_Release(style_elem
);
2042 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
2043 HTMLDocument_QueryInterface
,
2044 HTMLDocument_AddRef
,
2045 HTMLDocument_Release
,
2046 HTMLDocument_GetTypeInfoCount
,
2047 HTMLDocument_GetTypeInfo
,
2048 HTMLDocument_GetIDsOfNames
,
2049 HTMLDocument_Invoke
,
2050 HTMLDocument_get_Script
,
2051 HTMLDocument_get_all
,
2052 HTMLDocument_get_body
,
2053 HTMLDocument_get_activeElement
,
2054 HTMLDocument_get_images
,
2055 HTMLDocument_get_applets
,
2056 HTMLDocument_get_links
,
2057 HTMLDocument_get_forms
,
2058 HTMLDocument_get_anchors
,
2059 HTMLDocument_put_title
,
2060 HTMLDocument_get_title
,
2061 HTMLDocument_get_scripts
,
2062 HTMLDocument_put_designMode
,
2063 HTMLDocument_get_designMode
,
2064 HTMLDocument_get_selection
,
2065 HTMLDocument_get_readyState
,
2066 HTMLDocument_get_frames
,
2067 HTMLDocument_get_embeds
,
2068 HTMLDocument_get_plugins
,
2069 HTMLDocument_put_alinkColor
,
2070 HTMLDocument_get_alinkColor
,
2071 HTMLDocument_put_bgColor
,
2072 HTMLDocument_get_bgColor
,
2073 HTMLDocument_put_fgColor
,
2074 HTMLDocument_get_fgColor
,
2075 HTMLDocument_put_linkColor
,
2076 HTMLDocument_get_linkColor
,
2077 HTMLDocument_put_vlinkColor
,
2078 HTMLDocument_get_vlinkColor
,
2079 HTMLDocument_get_referrer
,
2080 HTMLDocument_get_location
,
2081 HTMLDocument_get_lastModified
,
2082 HTMLDocument_put_URL
,
2083 HTMLDocument_get_URL
,
2084 HTMLDocument_put_domain
,
2085 HTMLDocument_get_domain
,
2086 HTMLDocument_put_cookie
,
2087 HTMLDocument_get_cookie
,
2088 HTMLDocument_put_expando
,
2089 HTMLDocument_get_expando
,
2090 HTMLDocument_put_charset
,
2091 HTMLDocument_get_charset
,
2092 HTMLDocument_put_defaultCharset
,
2093 HTMLDocument_get_defaultCharset
,
2094 HTMLDocument_get_mimeType
,
2095 HTMLDocument_get_fileSize
,
2096 HTMLDocument_get_fileCreatedDate
,
2097 HTMLDocument_get_fileModifiedDate
,
2098 HTMLDocument_get_fileUpdatedDate
,
2099 HTMLDocument_get_security
,
2100 HTMLDocument_get_protocol
,
2101 HTMLDocument_get_nameProp
,
2103 HTMLDocument_writeln
,
2107 HTMLDocument_queryCommandSupported
,
2108 HTMLDocument_queryCommandEnabled
,
2109 HTMLDocument_queryCommandState
,
2110 HTMLDocument_queryCommandIndeterm
,
2111 HTMLDocument_queryCommandText
,
2112 HTMLDocument_queryCommandValue
,
2113 HTMLDocument_execCommand
,
2114 HTMLDocument_execCommandShowHelp
,
2115 HTMLDocument_createElement
,
2116 HTMLDocument_put_onhelp
,
2117 HTMLDocument_get_onhelp
,
2118 HTMLDocument_put_onclick
,
2119 HTMLDocument_get_onclick
,
2120 HTMLDocument_put_ondblclick
,
2121 HTMLDocument_get_ondblclick
,
2122 HTMLDocument_put_onkeyup
,
2123 HTMLDocument_get_onkeyup
,
2124 HTMLDocument_put_onkeydown
,
2125 HTMLDocument_get_onkeydown
,
2126 HTMLDocument_put_onkeypress
,
2127 HTMLDocument_get_onkeypress
,
2128 HTMLDocument_put_onmouseup
,
2129 HTMLDocument_get_onmouseup
,
2130 HTMLDocument_put_onmousedown
,
2131 HTMLDocument_get_onmousedown
,
2132 HTMLDocument_put_onmousemove
,
2133 HTMLDocument_get_onmousemove
,
2134 HTMLDocument_put_onmouseout
,
2135 HTMLDocument_get_onmouseout
,
2136 HTMLDocument_put_onmouseover
,
2137 HTMLDocument_get_onmouseover
,
2138 HTMLDocument_put_onreadystatechange
,
2139 HTMLDocument_get_onreadystatechange
,
2140 HTMLDocument_put_onafterupdate
,
2141 HTMLDocument_get_onafterupdate
,
2142 HTMLDocument_put_onrowexit
,
2143 HTMLDocument_get_onrowexit
,
2144 HTMLDocument_put_onrowenter
,
2145 HTMLDocument_get_onrowenter
,
2146 HTMLDocument_put_ondragstart
,
2147 HTMLDocument_get_ondragstart
,
2148 HTMLDocument_put_onselectstart
,
2149 HTMLDocument_get_onselectstart
,
2150 HTMLDocument_elementFromPoint
,
2151 HTMLDocument_get_parentWindow
,
2152 HTMLDocument_get_styleSheets
,
2153 HTMLDocument_put_onbeforeupdate
,
2154 HTMLDocument_get_onbeforeupdate
,
2155 HTMLDocument_put_onerrorupdate
,
2156 HTMLDocument_get_onerrorupdate
,
2157 HTMLDocument_toString
,
2158 HTMLDocument_createStyleSheet
2161 static inline HTMLDocumentNode
*impl_from_IHTMLDocument3(IHTMLDocument3
*iface
)
2163 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument3_iface
);
2166 DISPEX_IDISPATCH_IMPL(HTMLDocument3
, IHTMLDocument3
,
2167 impl_from_IHTMLDocument3(iface
)->node
.event_target
.dispex
)
2169 static HRESULT WINAPI
HTMLDocument3_releaseCapture(IHTMLDocument3
*iface
)
2171 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2172 FIXME("(%p)\n", This
);
2176 static HRESULT WINAPI
HTMLDocument3_recalc(IHTMLDocument3
*iface
, VARIANT_BOOL fForce
)
2178 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2180 WARN("(%p)->(%x)\n", This
, fForce
);
2182 /* Doing nothing here should be fine for us. */
2186 static HRESULT WINAPI
HTMLDocument3_createTextNode(IHTMLDocument3
*iface
, BSTR text
, IHTMLDOMNode
**newTextNode
)
2188 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2195 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(text
), newTextNode
);
2197 if(!This
->dom_document
) {
2198 WARN("NULL dom_document\n");
2199 return E_UNEXPECTED
;
2202 nsAString_InitDepend(&text_str
, text
);
2203 nsres
= nsIDOMDocument_CreateTextNode(This
->dom_document
, &text_str
, &nstext
);
2204 nsAString_Finish(&text_str
);
2205 if(NS_FAILED(nsres
)) {
2206 ERR("CreateTextNode failed: %08lx\n", nsres
);
2210 hres
= HTMLDOMTextNode_Create(This
, (nsIDOMNode
*)nstext
, &node
);
2211 nsIDOMText_Release(nstext
);
2215 *newTextNode
= &node
->IHTMLDOMNode_iface
;
2219 static HRESULT WINAPI
HTMLDocument3_get_documentElement(IHTMLDocument3
*iface
, IHTMLElement
**p
)
2221 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2222 nsIDOMElement
*nselem
= NULL
;
2223 HTMLElement
*element
;
2227 TRACE("(%p)->(%p)\n", This
, p
);
2230 if(!This
->window
->base
.outer_window
)
2232 if(This
->window
->base
.outer_window
->readystate
== READYSTATE_UNINITIALIZED
) {
2238 if(!This
->dom_document
) {
2239 WARN("NULL dom_document\n");
2240 return E_UNEXPECTED
;
2243 nsres
= nsIDOMDocument_GetDocumentElement(This
->dom_document
, &nselem
);
2244 if(NS_FAILED(nsres
)) {
2245 ERR("GetDocumentElement failed: %08lx\n", nsres
);
2254 hres
= get_element(nselem
, &element
);
2255 nsIDOMElement_Release(nselem
);
2259 *p
= &element
->IHTMLElement_iface
;
2263 static HRESULT WINAPI
HTMLDocument3_get_uniqueID(IHTMLDocument3
*iface
, BSTR
*p
)
2265 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2267 TRACE("(%p)->(%p)\n", This
, p
);
2269 return elem_unique_id(++This
->unique_id
, p
);
2272 static HRESULT WINAPI
HTMLDocument3_attachEvent(IHTMLDocument3
*iface
, BSTR event
, IDispatch
* pDisp
,
2273 VARIANT_BOOL
*pfResult
)
2275 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2277 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
2279 return attach_event(&This
->node
.event_target
, event
, pDisp
, pfResult
);
2282 static HRESULT WINAPI
HTMLDocument3_detachEvent(IHTMLDocument3
*iface
, BSTR event
, IDispatch
*pDisp
)
2284 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2286 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(event
), pDisp
);
2288 return detach_event(&This
->node
.event_target
, event
, pDisp
);
2291 static HRESULT WINAPI
HTMLDocument3_put_onrowsdelete(IHTMLDocument3
*iface
, VARIANT v
)
2293 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2294 FIXME("(%p)->()\n", This
);
2298 static HRESULT WINAPI
HTMLDocument3_get_onrowsdelete(IHTMLDocument3
*iface
, VARIANT
*p
)
2300 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2301 FIXME("(%p)->(%p)\n", This
, p
);
2305 static HRESULT WINAPI
HTMLDocument3_put_onrowsinserted(IHTMLDocument3
*iface
, VARIANT v
)
2307 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2308 FIXME("(%p)->()\n", This
);
2312 static HRESULT WINAPI
HTMLDocument3_get_onrowsinserted(IHTMLDocument3
*iface
, VARIANT
*p
)
2314 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2315 FIXME("(%p)->(%p)\n", This
, p
);
2319 static HRESULT WINAPI
HTMLDocument3_put_oncellchange(IHTMLDocument3
*iface
, VARIANT v
)
2321 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2322 FIXME("(%p)->()\n", This
);
2326 static HRESULT WINAPI
HTMLDocument3_get_oncellchange(IHTMLDocument3
*iface
, VARIANT
*p
)
2328 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2329 FIXME("(%p)->(%p)\n", This
, p
);
2333 static HRESULT WINAPI
HTMLDocument3_put_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT v
)
2335 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2336 FIXME("(%p)->()\n", This
);
2340 static HRESULT WINAPI
HTMLDocument3_get_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT
*p
)
2342 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2343 FIXME("(%p)->(%p)\n", This
, p
);
2347 static HRESULT WINAPI
HTMLDocument3_put_ondataavailable(IHTMLDocument3
*iface
, VARIANT v
)
2349 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2350 FIXME("(%p)->()\n", This
);
2354 static HRESULT WINAPI
HTMLDocument3_get_ondataavailable(IHTMLDocument3
*iface
, VARIANT
*p
)
2356 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2357 FIXME("(%p)->(%p)\n", This
, p
);
2361 static HRESULT WINAPI
HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT v
)
2363 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2364 FIXME("(%p)->()\n", This
);
2368 static HRESULT WINAPI
HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT
*p
)
2370 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2371 FIXME("(%p)->(%p)\n", This
, p
);
2375 static HRESULT WINAPI
HTMLDocument3_put_onpropertychange(IHTMLDocument3
*iface
, VARIANT v
)
2377 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2378 FIXME("(%p)->()\n", This
);
2382 static HRESULT WINAPI
HTMLDocument3_get_onpropertychange(IHTMLDocument3
*iface
, VARIANT
*p
)
2384 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2385 FIXME("(%p)->(%p)\n", This
, p
);
2389 static HRESULT WINAPI
HTMLDocument3_put_dir(IHTMLDocument3
*iface
, BSTR v
)
2391 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2395 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2397 if(!This
->dom_document
) {
2398 FIXME("NULL dom_document\n");
2399 return E_UNEXPECTED
;
2402 nsAString_InitDepend(&dir_str
, v
);
2403 nsres
= nsIDOMDocument_SetDir(This
->dom_document
, &dir_str
);
2404 nsAString_Finish(&dir_str
);
2405 if(NS_FAILED(nsres
)) {
2406 ERR("SetDir failed: %08lx\n", nsres
);
2413 static HRESULT WINAPI
HTMLDocument3_get_dir(IHTMLDocument3
*iface
, BSTR
*p
)
2415 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2419 TRACE("(%p)->(%p)\n", This
, p
);
2421 if(!This
->dom_document
) {
2422 FIXME("NULL dom_document\n");
2423 return E_UNEXPECTED
;
2426 nsAString_Init(&dir_str
, NULL
);
2427 nsres
= nsIDOMDocument_GetDir(This
->dom_document
, &dir_str
);
2428 return return_nsstr(nsres
, &dir_str
, p
);
2431 static HRESULT WINAPI
HTMLDocument3_put_oncontextmenu(IHTMLDocument3
*iface
, VARIANT v
)
2433 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2435 TRACE("(%p)->()\n", This
);
2437 return set_doc_event(This
, EVENTID_CONTEXTMENU
, &v
);
2440 static HRESULT WINAPI
HTMLDocument3_get_oncontextmenu(IHTMLDocument3
*iface
, VARIANT
*p
)
2442 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2444 TRACE("(%p)->(%p)\n", This
, p
);
2446 return get_doc_event(This
, EVENTID_CONTEXTMENU
, p
);
2449 static HRESULT WINAPI
HTMLDocument3_put_onstop(IHTMLDocument3
*iface
, VARIANT v
)
2451 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2452 FIXME("(%p)->()\n", This
);
2456 static HRESULT WINAPI
HTMLDocument3_get_onstop(IHTMLDocument3
*iface
, VARIANT
*p
)
2458 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2459 FIXME("(%p)->(%p)\n", This
, p
);
2463 static HRESULT WINAPI
HTMLDocument3_createDocumentFragment(IHTMLDocument3
*iface
, IHTMLDocument2
**ppNewDoc
)
2465 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2466 nsIDOMDocumentFragment
*doc_frag
;
2467 HTMLDocumentNode
*docnode
;
2471 TRACE("(%p)->(%p)\n", This
, ppNewDoc
);
2473 if(!This
->dom_document
) {
2474 FIXME("NULL dom_document\n");
2478 nsres
= nsIDOMDocument_CreateDocumentFragment(This
->dom_document
, &doc_frag
);
2479 if(NS_FAILED(nsres
)) {
2480 ERR("CreateDocumentFragment failed: %08lx\n", nsres
);
2484 hres
= create_document_fragment((nsIDOMNode
*)doc_frag
, This
, &docnode
);
2485 nsIDOMDocumentFragment_Release(doc_frag
);
2489 *ppNewDoc
= &docnode
->IHTMLDocument2_iface
;
2493 static HRESULT WINAPI
HTMLDocument3_get_parentDocument(IHTMLDocument3
*iface
, IHTMLDocument2
**p
)
2495 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2496 FIXME("(%p)->(%p)\n", This
, p
);
2500 static HRESULT WINAPI
HTMLDocument3_put_enableDownload(IHTMLDocument3
*iface
, VARIANT_BOOL v
)
2502 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2503 FIXME("(%p)->(%x)\n", This
, v
);
2507 static HRESULT WINAPI
HTMLDocument3_get_enableDownload(IHTMLDocument3
*iface
, VARIANT_BOOL
*p
)
2509 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2510 FIXME("(%p)->(%p)\n", This
, p
);
2514 static HRESULT WINAPI
HTMLDocument3_put_baseUrl(IHTMLDocument3
*iface
, BSTR v
)
2516 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2517 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2521 static HRESULT WINAPI
HTMLDocument3_get_baseUrl(IHTMLDocument3
*iface
, BSTR
*p
)
2523 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2524 FIXME("(%p)->(%p)\n", This
, p
);
2528 static HRESULT WINAPI
HTMLDocument3_get_childNodes(IHTMLDocument3
*iface
, IDispatch
**p
)
2530 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2532 TRACE("(%p)->(%p)\n", This
, p
);
2534 return IHTMLDOMNode_get_childNodes(&This
->node
.IHTMLDOMNode_iface
, p
);
2537 static HRESULT WINAPI
HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3
*iface
, VARIANT_BOOL v
)
2539 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2540 FIXME("(%p)->()\n", This
);
2544 static HRESULT WINAPI
HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3
*iface
, VARIANT_BOOL
*p
)
2546 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2547 FIXME("(%p)->(%p)\n", This
, p
);
2551 static HRESULT WINAPI
HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT v
)
2553 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2554 FIXME("(%p)->()\n", This
);
2558 static HRESULT WINAPI
HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT
*p
)
2560 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2561 FIXME("(%p)->(%p)\n", This
, p
);
2565 static HRESULT WINAPI
HTMLDocument3_getElementsByName(IHTMLDocument3
*iface
, BSTR v
,
2566 IHTMLElementCollection
**ppelColl
)
2568 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2569 nsIDOMNodeList
*node_list
= NULL
;
2570 nsAString selector_str
;
2573 static const WCHAR formatW
[] = L
"*[id=%s],*[name=%s]";
2575 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppelColl
);
2577 if(!This
->dom_document
) {
2578 /* We should probably return an empty collection. */
2579 FIXME("No dom_document\n");
2583 selector
= malloc(2 * SysStringLen(v
) * sizeof(WCHAR
) + sizeof(formatW
));
2585 return E_OUTOFMEMORY
;
2586 swprintf(selector
, 2*SysStringLen(v
) + ARRAY_SIZE(formatW
), formatW
, v
, v
);
2589 * NOTE: IE getElementsByName implementation differs from Gecko. It searches both name and id attributes.
2590 * That's why we use CSS selector instead. We should also use name only when it applies to given element
2591 * types and search should be case insensitive. Those are currently not supported properly.
2593 nsAString_InitDepend(&selector_str
, selector
);
2594 nsres
= nsIDOMDocument_QuerySelectorAll(This
->dom_document
, &selector_str
, &node_list
);
2595 nsAString_Finish(&selector_str
);
2597 if(NS_FAILED(nsres
)) {
2598 ERR("QuerySelectorAll failed: %08lx\n", nsres
);
2600 nsIDOMNodeList_Release(node_list
);
2604 *ppelColl
= create_collection_from_nodelist(node_list
, This
->document_mode
);
2605 nsIDOMNodeList_Release(node_list
);
2610 static HRESULT WINAPI
HTMLDocument3_getElementById(IHTMLDocument3
*iface
, BSTR v
, IHTMLElement
**pel
)
2612 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2616 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
2618 hres
= get_doc_elem_by_id(This
, v
, &elem
);
2619 if(FAILED(hres
) || !elem
) {
2624 *pel
= &elem
->IHTMLElement_iface
;
2629 static HRESULT WINAPI
HTMLDocument3_getElementsByTagName(IHTMLDocument3
*iface
, BSTR v
,
2630 IHTMLElementCollection
**pelColl
)
2632 HTMLDocumentNode
*This
= impl_from_IHTMLDocument3(iface
);
2633 nsIDOMNodeList
*nslist
;
2637 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
2639 if(This
->dom_document
) {
2640 nsAString_InitDepend(&id_str
, v
);
2641 nsres
= nsIDOMDocument_GetElementsByTagName(This
->dom_document
, &id_str
, &nslist
);
2642 nsAString_Finish(&id_str
);
2644 ERR("GetElementByName failed: %08lx\n", nsres
);
2648 nsIDOMDocumentFragment
*docfrag
;
2653 for(ptr
=v
; *ptr
; ptr
++) {
2654 if(!iswalnum(*ptr
)) {
2655 FIXME("Unsupported invalid tag %s\n", debugstr_w(v
));
2661 nsres
= nsIDOMNode_QueryInterface(This
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&docfrag
);
2662 if(NS_FAILED(nsres
)) {
2663 ERR("Could not get nsIDOMDocumentFragment iface: %08lx\n", nsres
);
2664 return E_UNEXPECTED
;
2668 nsAString_InitDepend(&nsstr
, v
);
2669 nsres
= nsIDOMDocumentFragment_QuerySelectorAll(docfrag
, &nsstr
, &nslist
);
2670 nsAString_Finish(&nsstr
);
2671 nsIDOMDocumentFragment_Release(docfrag
);
2672 if(NS_FAILED(nsres
)) {
2673 ERR("QuerySelectorAll failed: %08lx\n", nsres
);
2675 nsIDOMNodeList_Release(nslist
);
2681 *pelColl
= create_collection_from_nodelist(nslist
, This
->document_mode
);
2682 nsIDOMNodeList_Release(nslist
);
2687 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl
= {
2688 HTMLDocument3_QueryInterface
,
2689 HTMLDocument3_AddRef
,
2690 HTMLDocument3_Release
,
2691 HTMLDocument3_GetTypeInfoCount
,
2692 HTMLDocument3_GetTypeInfo
,
2693 HTMLDocument3_GetIDsOfNames
,
2694 HTMLDocument3_Invoke
,
2695 HTMLDocument3_releaseCapture
,
2696 HTMLDocument3_recalc
,
2697 HTMLDocument3_createTextNode
,
2698 HTMLDocument3_get_documentElement
,
2699 HTMLDocument3_get_uniqueID
,
2700 HTMLDocument3_attachEvent
,
2701 HTMLDocument3_detachEvent
,
2702 HTMLDocument3_put_onrowsdelete
,
2703 HTMLDocument3_get_onrowsdelete
,
2704 HTMLDocument3_put_onrowsinserted
,
2705 HTMLDocument3_get_onrowsinserted
,
2706 HTMLDocument3_put_oncellchange
,
2707 HTMLDocument3_get_oncellchange
,
2708 HTMLDocument3_put_ondatasetchanged
,
2709 HTMLDocument3_get_ondatasetchanged
,
2710 HTMLDocument3_put_ondataavailable
,
2711 HTMLDocument3_get_ondataavailable
,
2712 HTMLDocument3_put_ondatasetcomplete
,
2713 HTMLDocument3_get_ondatasetcomplete
,
2714 HTMLDocument3_put_onpropertychange
,
2715 HTMLDocument3_get_onpropertychange
,
2716 HTMLDocument3_put_dir
,
2717 HTMLDocument3_get_dir
,
2718 HTMLDocument3_put_oncontextmenu
,
2719 HTMLDocument3_get_oncontextmenu
,
2720 HTMLDocument3_put_onstop
,
2721 HTMLDocument3_get_onstop
,
2722 HTMLDocument3_createDocumentFragment
,
2723 HTMLDocument3_get_parentDocument
,
2724 HTMLDocument3_put_enableDownload
,
2725 HTMLDocument3_get_enableDownload
,
2726 HTMLDocument3_put_baseUrl
,
2727 HTMLDocument3_get_baseUrl
,
2728 HTMLDocument3_get_childNodes
,
2729 HTMLDocument3_put_inheritStyleSheets
,
2730 HTMLDocument3_get_inheritStyleSheets
,
2731 HTMLDocument3_put_onbeforeeditfocus
,
2732 HTMLDocument3_get_onbeforeeditfocus
,
2733 HTMLDocument3_getElementsByName
,
2734 HTMLDocument3_getElementById
,
2735 HTMLDocument3_getElementsByTagName
2738 static inline HTMLDocumentNode
*impl_from_IHTMLDocument4(IHTMLDocument4
*iface
)
2740 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument4_iface
);
2743 DISPEX_IDISPATCH_IMPL(HTMLDocument4
, IHTMLDocument4
,
2744 impl_from_IHTMLDocument4(iface
)->node
.event_target
.dispex
)
2746 static HRESULT WINAPI
HTMLDocument4_focus(IHTMLDocument4
*iface
)
2748 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2749 nsIDOMHTMLElement
*nsbody
;
2752 TRACE("(%p)->()\n", This
);
2754 if(!This
->html_document
) {
2755 FIXME("Not implemented for XML document\n");
2759 nsres
= nsIDOMHTMLDocument_GetBody(This
->html_document
, &nsbody
);
2760 if(NS_FAILED(nsres
) || !nsbody
) {
2761 ERR("GetBody failed: %08lx\n", nsres
);
2765 nsres
= nsIDOMHTMLElement_Focus(nsbody
);
2766 nsIDOMHTMLElement_Release(nsbody
);
2767 if(NS_FAILED(nsres
)) {
2768 ERR("Focus failed: %08lx\n", nsres
);
2775 static HRESULT WINAPI
HTMLDocument4_hasFocus(IHTMLDocument4
*iface
, VARIANT_BOOL
*pfFocus
)
2777 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2781 TRACE("(%p)->(%p)\n", This
, pfFocus
);
2783 if(!This
->dom_document
) {
2784 FIXME("Unimplemented for fragments.\n");
2788 nsres
= nsIDOMDocument_HasFocus(This
->dom_document
, &has_focus
);
2789 assert(nsres
== NS_OK
);
2791 *pfFocus
= variant_bool(has_focus
);
2795 static HRESULT WINAPI
HTMLDocument4_put_onselectionchange(IHTMLDocument4
*iface
, VARIANT v
)
2797 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2799 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2801 return set_doc_event(This
, EVENTID_SELECTIONCHANGE
, &v
);
2804 static HRESULT WINAPI
HTMLDocument4_get_onselectionchange(IHTMLDocument4
*iface
, VARIANT
*p
)
2806 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2808 TRACE("(%p)->(%p)\n", This
, p
);
2810 return get_doc_event(This
, EVENTID_SELECTIONCHANGE
, p
);
2813 static HRESULT WINAPI
HTMLDocument4_get_namespaces(IHTMLDocument4
*iface
, IDispatch
**p
)
2815 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2817 TRACE("(%p)->(%p)\n", This
, p
);
2819 if(!This
->namespaces
) {
2822 hres
= create_namespace_collection(This
, &This
->namespaces
);
2827 IHTMLNamespaceCollection_AddRef(This
->namespaces
);
2828 *p
= (IDispatch
*)This
->namespaces
;
2832 static HRESULT WINAPI
HTMLDocument4_createDocumentFromUrl(IHTMLDocument4
*iface
, BSTR bstrUrl
,
2833 BSTR bstrOptions
, IHTMLDocument2
**newDoc
)
2835 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2836 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrUrl
), debugstr_w(bstrOptions
), newDoc
);
2840 static HRESULT WINAPI
HTMLDocument4_put_media(IHTMLDocument4
*iface
, BSTR v
)
2842 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2843 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2847 static HRESULT WINAPI
HTMLDocument4_get_media(IHTMLDocument4
*iface
, BSTR
*p
)
2849 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2850 FIXME("(%p)->(%p)\n", This
, p
);
2854 static HRESULT WINAPI
HTMLDocument4_createEventObject(IHTMLDocument4
*iface
,
2855 VARIANT
*pvarEventObject
, IHTMLEventObj
**ppEventObj
)
2857 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2859 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(pvarEventObject
), ppEventObj
);
2861 if(pvarEventObject
&& V_VT(pvarEventObject
) != VT_ERROR
&& V_VT(pvarEventObject
) != VT_EMPTY
) {
2862 FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject
));
2866 return create_event_obj(NULL
, This
, ppEventObj
);
2869 static HRESULT WINAPI
HTMLDocument4_fireEvent(IHTMLDocument4
*iface
, BSTR bstrEventName
,
2870 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCanceled
)
2872 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2874 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrEventName
), pvarEventObject
, pfCanceled
);
2876 return fire_event(&This
->node
, bstrEventName
, pvarEventObject
, pfCanceled
);
2879 static HRESULT WINAPI
HTMLDocument4_createRenderStyle(IHTMLDocument4
*iface
, BSTR v
,
2880 IHTMLRenderStyle
**ppIHTMLRenderStyle
)
2882 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2883 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppIHTMLRenderStyle
);
2887 static HRESULT WINAPI
HTMLDocument4_put_oncontrolselect(IHTMLDocument4
*iface
, VARIANT v
)
2889 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2890 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2894 static HRESULT WINAPI
HTMLDocument4_get_oncontrolselect(IHTMLDocument4
*iface
, VARIANT
*p
)
2896 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2897 FIXME("(%p)->(%p)\n", This
, p
);
2901 static HRESULT WINAPI
HTMLDocument4_get_URLUnencoded(IHTMLDocument4
*iface
, BSTR
*p
)
2903 HTMLDocumentNode
*This
= impl_from_IHTMLDocument4(iface
);
2904 FIXME("(%p)->(%p)\n", This
, p
);
2908 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl
= {
2909 HTMLDocument4_QueryInterface
,
2910 HTMLDocument4_AddRef
,
2911 HTMLDocument4_Release
,
2912 HTMLDocument4_GetTypeInfoCount
,
2913 HTMLDocument4_GetTypeInfo
,
2914 HTMLDocument4_GetIDsOfNames
,
2915 HTMLDocument4_Invoke
,
2916 HTMLDocument4_focus
,
2917 HTMLDocument4_hasFocus
,
2918 HTMLDocument4_put_onselectionchange
,
2919 HTMLDocument4_get_onselectionchange
,
2920 HTMLDocument4_get_namespaces
,
2921 HTMLDocument4_createDocumentFromUrl
,
2922 HTMLDocument4_put_media
,
2923 HTMLDocument4_get_media
,
2924 HTMLDocument4_createEventObject
,
2925 HTMLDocument4_fireEvent
,
2926 HTMLDocument4_createRenderStyle
,
2927 HTMLDocument4_put_oncontrolselect
,
2928 HTMLDocument4_get_oncontrolselect
,
2929 HTMLDocument4_get_URLUnencoded
2932 static inline HTMLDocumentNode
*impl_from_IHTMLDocument5(IHTMLDocument5
*iface
)
2934 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument5_iface
);
2937 DISPEX_IDISPATCH_IMPL(HTMLDocument5
, IHTMLDocument5
,
2938 impl_from_IHTMLDocument5(iface
)->node
.event_target
.dispex
)
2940 static HRESULT WINAPI
HTMLDocument5_put_onmousewheel(IHTMLDocument5
*iface
, VARIANT v
)
2942 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
2944 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2946 return set_doc_event(This
, EVENTID_MOUSEWHEEL
, &v
);
2949 static HRESULT WINAPI
HTMLDocument5_get_onmousewheel(IHTMLDocument5
*iface
, VARIANT
*p
)
2951 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
2953 TRACE("(%p)->(%p)\n", This
, p
);
2955 return get_doc_event(This
, EVENTID_MOUSEWHEEL
, p
);
2958 static HRESULT WINAPI
HTMLDocument5_get_doctype(IHTMLDocument5
*iface
, IHTMLDOMNode
**p
)
2960 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
2961 nsIDOMDocumentType
*nsdoctype
;
2962 HTMLDOMNode
*doctype_node
;
2966 TRACE("(%p)->(%p)\n", This
, p
);
2968 if(dispex_compat_mode(&This
->node
.event_target
.dispex
) < COMPAT_MODE_IE9
) {
2973 nsres
= nsIDOMDocument_GetDoctype(This
->dom_document
, &nsdoctype
);
2974 if(NS_FAILED(nsres
))
2975 return map_nsresult(nsres
);
2981 hres
= get_node((nsIDOMNode
*)nsdoctype
, TRUE
, &doctype_node
);
2982 nsIDOMDocumentType_Release(nsdoctype
);
2985 *p
= &doctype_node
->IHTMLDOMNode_iface
;
2989 static HRESULT WINAPI
HTMLDocument5_get_implementation(IHTMLDocument5
*iface
, IHTMLDOMImplementation
**p
)
2991 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
2993 TRACE("(%p)->(%p)\n", This
, p
);
2995 if(!This
->dom_implementation
) {
2998 hres
= create_dom_implementation(This
, &This
->dom_implementation
);
3003 IHTMLDOMImplementation_AddRef(This
->dom_implementation
);
3004 *p
= This
->dom_implementation
;
3008 static HRESULT WINAPI
HTMLDocument5_createAttribute(IHTMLDocument5
*iface
, BSTR bstrattrName
,
3009 IHTMLDOMAttribute
**ppattribute
)
3011 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3012 HTMLDOMAttribute
*attr
;
3015 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrattrName
), ppattribute
);
3017 hres
= HTMLDOMAttribute_Create(bstrattrName
, NULL
, 0, This
, &attr
);
3021 *ppattribute
= &attr
->IHTMLDOMAttribute_iface
;
3025 static HRESULT WINAPI
HTMLDocument5_createComment(IHTMLDocument5
*iface
, BSTR bstrdata
,
3026 IHTMLDOMNode
**ppRetNode
)
3028 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3029 nsIDOMComment
*nscomment
;
3035 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrdata
), ppRetNode
);
3037 if(!This
->dom_document
) {
3038 WARN("NULL dom_document\n");
3039 return E_UNEXPECTED
;
3042 nsAString_InitDepend(&str
, bstrdata
);
3043 nsres
= nsIDOMDocument_CreateComment(This
->dom_document
, &str
, &nscomment
);
3044 nsAString_Finish(&str
);
3045 if(NS_FAILED(nsres
)) {
3046 ERR("CreateTextNode failed: %08lx\n", nsres
);
3050 hres
= HTMLCommentElement_Create(This
, (nsIDOMNode
*)nscomment
, &elem
);
3051 nsIDOMComment_Release(nscomment
);
3055 *ppRetNode
= &elem
->node
.IHTMLDOMNode_iface
;
3059 static HRESULT WINAPI
HTMLDocument5_put_onfocusin(IHTMLDocument5
*iface
, VARIANT v
)
3061 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3063 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3065 return set_doc_event(This
, EVENTID_FOCUSIN
, &v
);
3068 static HRESULT WINAPI
HTMLDocument5_get_onfocusin(IHTMLDocument5
*iface
, VARIANT
*p
)
3070 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3072 TRACE("(%p)->(%p)\n", This
, p
);
3074 return get_doc_event(This
, EVENTID_FOCUSIN
, p
);
3077 static HRESULT WINAPI
HTMLDocument5_put_onfocusout(IHTMLDocument5
*iface
, VARIANT v
)
3079 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3081 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3083 return set_doc_event(This
, EVENTID_FOCUSOUT
, &v
);
3086 static HRESULT WINAPI
HTMLDocument5_get_onfocusout(IHTMLDocument5
*iface
, VARIANT
*p
)
3088 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3090 TRACE("(%p)->(%p)\n", This
, p
);
3092 return get_doc_event(This
, EVENTID_FOCUSOUT
, p
);
3095 static HRESULT WINAPI
HTMLDocument5_put_onactivate(IHTMLDocument5
*iface
, VARIANT v
)
3097 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3098 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3102 static HRESULT WINAPI
HTMLDocument5_get_onactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3104 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3105 FIXME("(%p)->(%p)\n", This
, p
);
3109 static HRESULT WINAPI
HTMLDocument5_put_ondeactivate(IHTMLDocument5
*iface
, VARIANT v
)
3111 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3112 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3116 static HRESULT WINAPI
HTMLDocument5_get_ondeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3118 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3119 FIXME("(%p)->(%p)\n", This
, p
);
3123 static HRESULT WINAPI
HTMLDocument5_put_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT v
)
3125 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3126 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3130 static HRESULT WINAPI
HTMLDocument5_get_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3132 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3133 FIXME("(%p)->(%p)\n", This
, p
);
3137 static HRESULT WINAPI
HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT v
)
3139 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3140 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3144 static HRESULT WINAPI
HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3146 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3147 FIXME("(%p)->(%p)\n", This
, p
);
3151 static HRESULT WINAPI
HTMLDocument5_get_compatMode(IHTMLDocument5
*iface
, BSTR
*p
)
3153 HTMLDocumentNode
*This
= impl_from_IHTMLDocument5(iface
);
3155 TRACE("(%p)->(%p)\n", This
, p
);
3157 *p
= SysAllocString(This
->document_mode
<= COMPAT_MODE_IE5
? L
"BackCompat" : L
"CSS1Compat");
3158 return *p
? S_OK
: E_OUTOFMEMORY
;
3161 static const IHTMLDocument5Vtbl HTMLDocument5Vtbl
= {
3162 HTMLDocument5_QueryInterface
,
3163 HTMLDocument5_AddRef
,
3164 HTMLDocument5_Release
,
3165 HTMLDocument5_GetTypeInfoCount
,
3166 HTMLDocument5_GetTypeInfo
,
3167 HTMLDocument5_GetIDsOfNames
,
3168 HTMLDocument5_Invoke
,
3169 HTMLDocument5_put_onmousewheel
,
3170 HTMLDocument5_get_onmousewheel
,
3171 HTMLDocument5_get_doctype
,
3172 HTMLDocument5_get_implementation
,
3173 HTMLDocument5_createAttribute
,
3174 HTMLDocument5_createComment
,
3175 HTMLDocument5_put_onfocusin
,
3176 HTMLDocument5_get_onfocusin
,
3177 HTMLDocument5_put_onfocusout
,
3178 HTMLDocument5_get_onfocusout
,
3179 HTMLDocument5_put_onactivate
,
3180 HTMLDocument5_get_onactivate
,
3181 HTMLDocument5_put_ondeactivate
,
3182 HTMLDocument5_get_ondeactivate
,
3183 HTMLDocument5_put_onbeforeactivate
,
3184 HTMLDocument5_get_onbeforeactivate
,
3185 HTMLDocument5_put_onbeforedeactivate
,
3186 HTMLDocument5_get_onbeforedeactivate
,
3187 HTMLDocument5_get_compatMode
3190 static inline HTMLDocumentNode
*impl_from_IHTMLDocument6(IHTMLDocument6
*iface
)
3192 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument6_iface
);
3195 DISPEX_IDISPATCH_IMPL(HTMLDocument6
, IHTMLDocument6
,
3196 impl_from_IHTMLDocument6(iface
)->node
.event_target
.dispex
)
3198 static HRESULT WINAPI
HTMLDocument6_get_compatible(IHTMLDocument6
*iface
,
3199 IHTMLDocumentCompatibleInfoCollection
**p
)
3201 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3202 FIXME("(%p)->(%p)\n", This
, p
);
3206 static HRESULT WINAPI
HTMLDocument6_get_documentMode(IHTMLDocument6
*iface
, VARIANT
*p
)
3208 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3210 TRACE("(%p)->(%p)\n", This
, p
);
3213 V_R4(p
) = compat_mode_info
[This
->document_mode
].document_mode
;
3217 static HRESULT WINAPI
HTMLDocument6_get_onstorage(IHTMLDocument6
*iface
,
3220 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3222 TRACE("(%p)->(%p)\n", This
, p
);
3224 return get_doc_event(This
, EVENTID_STORAGE
, p
);
3227 static HRESULT WINAPI
HTMLDocument6_put_onstorage(IHTMLDocument6
*iface
, VARIANT v
)
3229 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3231 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3233 return set_doc_event(This
, EVENTID_STORAGE
, &v
);
3236 static HRESULT WINAPI
HTMLDocument6_get_onstoragecommit(IHTMLDocument6
*iface
,
3239 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3241 TRACE("(%p)->(%p)\n", This
, p
);
3243 return get_doc_event(This
, EVENTID_STORAGECOMMIT
, p
);
3246 static HRESULT WINAPI
HTMLDocument6_put_onstoragecommit(IHTMLDocument6
*iface
, VARIANT v
)
3248 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3250 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3252 return set_doc_event(This
, EVENTID_STORAGECOMMIT
, &v
);
3255 static HRESULT WINAPI
HTMLDocument6_getElementById(IHTMLDocument6
*iface
,
3256 BSTR bstrId
, IHTMLElement2
**p
)
3258 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3259 nsIDOMElement
*nselem
;
3265 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrId
), p
);
3268 * Unlike IHTMLDocument3 implementation, this is standard compliant and does
3269 * not search for name attributes, so we may simply let Gecko do the right thing.
3272 if(!This
->dom_document
) {
3273 FIXME("Not a document\n");
3277 nsAString_InitDepend(&nsstr
, bstrId
);
3278 nsres
= nsIDOMDocument_GetElementById(This
->dom_document
, &nsstr
, &nselem
);
3279 nsAString_Finish(&nsstr
);
3280 if(NS_FAILED(nsres
)) {
3281 ERR("GetElementById failed: %08lx\n", nsres
);
3290 hres
= get_element(nselem
, &elem
);
3291 nsIDOMElement_Release(nselem
);
3295 *p
= &elem
->IHTMLElement2_iface
;
3299 static HRESULT WINAPI
HTMLDocument6_updateSettings(IHTMLDocument6
*iface
)
3301 HTMLDocumentNode
*This
= impl_from_IHTMLDocument6(iface
);
3302 FIXME("(%p)->()\n", This
);
3306 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl
= {
3307 HTMLDocument6_QueryInterface
,
3308 HTMLDocument6_AddRef
,
3309 HTMLDocument6_Release
,
3310 HTMLDocument6_GetTypeInfoCount
,
3311 HTMLDocument6_GetTypeInfo
,
3312 HTMLDocument6_GetIDsOfNames
,
3313 HTMLDocument6_Invoke
,
3314 HTMLDocument6_get_compatible
,
3315 HTMLDocument6_get_documentMode
,
3316 HTMLDocument6_put_onstorage
,
3317 HTMLDocument6_get_onstorage
,
3318 HTMLDocument6_put_onstoragecommit
,
3319 HTMLDocument6_get_onstoragecommit
,
3320 HTMLDocument6_getElementById
,
3321 HTMLDocument6_updateSettings
3324 static inline HTMLDocumentNode
*impl_from_IHTMLDocument7(IHTMLDocument7
*iface
)
3326 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IHTMLDocument7_iface
);
3329 DISPEX_IDISPATCH_IMPL(HTMLDocument7
, IHTMLDocument7
,
3330 impl_from_IHTMLDocument7(iface
)->node
.event_target
.dispex
)
3332 static HRESULT WINAPI
HTMLDocument7_get_defaultView(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
3334 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3336 TRACE("(%p)->(%p)\n", This
, p
);
3338 if(This
->window
&& This
->window
->base
.outer_window
) {
3339 *p
= &This
->window
->base
.outer_window
->base
.IHTMLWindow2_iface
;
3340 IHTMLWindow2_AddRef(*p
);
3347 static HRESULT WINAPI
HTMLDocument7_createCDATASection(IHTMLDocument7
*iface
, BSTR text
, IHTMLDOMNode
**newCDATASectionNode
)
3349 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3350 FIXME("(%p)->(%p)\n", This
, newCDATASectionNode
);
3354 static HRESULT WINAPI
HTMLDocument7_getSelection(IHTMLDocument7
*iface
, IHTMLSelection
**ppIHTMLSelection
)
3356 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3357 FIXME("(%p)->(%p)\n", This
, ppIHTMLSelection
);
3361 static HRESULT WINAPI
HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3362 BSTR bstrLocalName
, IHTMLElementCollection
**pelColl
)
3364 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3365 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrLocalName
), pelColl
);
3369 static HRESULT WINAPI
HTMLDocument7_createElementNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
, BSTR bstrTag
, IHTMLElement
**newElem
)
3371 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3372 nsIDOMElement
*dom_element
;
3373 HTMLElement
*element
;
3378 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrTag
), newElem
);
3380 if(!This
->dom_document
) {
3381 FIXME("NULL dom_document\n");
3385 if(pvarNS
&& V_VT(pvarNS
) != VT_NULL
&& V_VT(pvarNS
) != VT_BSTR
)
3386 FIXME("Unsupported namespace %s\n", debugstr_variant(pvarNS
));
3388 nsAString_InitDepend(&ns
, pvarNS
&& V_VT(pvarNS
) == VT_BSTR
? V_BSTR(pvarNS
) : NULL
);
3389 nsAString_InitDepend(&tag
, bstrTag
);
3390 nsres
= nsIDOMDocument_CreateElementNS(This
->dom_document
, &ns
, &tag
, &dom_element
);
3391 nsAString_Finish(&ns
);
3392 nsAString_Finish(&tag
);
3393 if(NS_FAILED(nsres
)) {
3394 WARN("CreateElementNS failed: %08lx\n", nsres
);
3395 return map_nsresult(nsres
);
3398 hres
= HTMLElement_Create(This
, (nsIDOMNode
*)dom_element
, FALSE
, &element
);
3399 nsIDOMElement_Release(dom_element
);
3403 *newElem
= &element
->IHTMLElement_iface
;
3407 static HRESULT WINAPI
HTMLDocument7_createAttributeNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3408 BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3410 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3411 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrAttrName
), ppAttribute
);
3415 static HRESULT WINAPI
HTMLDocument7_put_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT v
)
3417 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3418 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3422 static HRESULT WINAPI
HTMLDocument7_get_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT
*p
)
3424 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3426 TRACE("(%p)->(%p)\n", This
, p
);
3428 return get_doc_event(This
, EVENTID_MSTHUMBNAILCLICK
, p
);
3431 static HRESULT WINAPI
HTMLDocument7_get_characterSet(IHTMLDocument7
*iface
, BSTR
*p
)
3433 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3434 nsAString charset_str
;
3437 TRACE("(%p)->(%p)\n", This
, p
);
3439 if(!This
->dom_document
) {
3440 FIXME("NULL dom_document\n");
3444 nsAString_Init(&charset_str
, NULL
);
3445 nsres
= nsIDOMDocument_GetCharacterSet(This
->dom_document
, &charset_str
);
3446 return return_nsstr(nsres
, &charset_str
, p
);
3449 static HRESULT WINAPI
HTMLDocument7_createElement(IHTMLDocument7
*iface
, BSTR bstrTag
, IHTMLElement
**newElem
)
3451 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3453 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrTag
), newElem
);
3455 return IHTMLDocument2_createElement(&This
->IHTMLDocument2_iface
, bstrTag
, newElem
);
3458 static HRESULT WINAPI
HTMLDocument7_createAttribute(IHTMLDocument7
*iface
, BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3460 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3462 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrAttrName
), ppAttribute
);
3464 return IHTMLDocument5_createAttribute(&This
->IHTMLDocument5_iface
, bstrAttrName
, ppAttribute
);
3467 static HRESULT WINAPI
HTMLDocument7_getElementsByClassName(IHTMLDocument7
*iface
, BSTR v
, IHTMLElementCollection
**pel
)
3469 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3470 nsIDOMNodeList
*nslist
;
3474 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
3476 if(!This
->dom_document
) {
3477 FIXME("NULL dom_document not supported\n");
3481 nsAString_InitDepend(&nsstr
, v
);
3482 nsres
= nsIDOMDocument_GetElementsByClassName(This
->dom_document
, &nsstr
, &nslist
);
3483 nsAString_Finish(&nsstr
);
3485 ERR("GetElementByClassName failed: %08lx\n", nsres
);
3490 *pel
= create_collection_from_nodelist(nslist
, This
->document_mode
);
3491 nsIDOMNodeList_Release(nslist
);
3495 static HRESULT WINAPI
HTMLDocument7_createProcessingInstruction(IHTMLDocument7
*iface
, BSTR target
,
3496 BSTR data
, IDOMProcessingInstruction
**newProcessingInstruction
)
3498 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3499 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(target
), debugstr_w(data
), newProcessingInstruction
);
3503 static HRESULT WINAPI
HTMLDocument7_adoptNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
, IHTMLDOMNode3
**ppNodeDest
)
3505 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3506 FIXME("(%p)->(%p %p)\n", This
, pNodeSource
, ppNodeDest
);
3510 static HRESULT WINAPI
HTMLDocument7_put_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT v
)
3512 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3513 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3517 static HRESULT WINAPI
HTMLDocument7_get_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT
*p
)
3519 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3520 FIXME("(%p)->(%p)\n", This
, p
);
3524 static HRESULT WINAPI
HTMLDocument7_get_all(IHTMLDocument7
*iface
, IHTMLElementCollection
**p
)
3526 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3528 TRACE("(%p)->(%p)\n", This
, p
);
3530 return IHTMLDocument2_get_all(&This
->IHTMLDocument2_iface
, p
);
3533 static HRESULT WINAPI
HTMLDocument7_get_inputEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3535 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3536 FIXME("(%p)->(%p)\n", This
, p
);
3540 static HRESULT WINAPI
HTMLDocument7_get_xmlEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3542 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3543 FIXME("(%p)->(%p)\n", This
, p
);
3547 static HRESULT WINAPI
HTMLDocument7_put_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL v
)
3549 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3550 FIXME("(%p)->(%x)\n", This
, v
);
3554 static HRESULT WINAPI
HTMLDocument7_get_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL
*p
)
3556 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3557 FIXME("(%p)->(%p)\n", This
, p
);
3561 static HRESULT WINAPI
HTMLDocument7_put_xmlVersion(IHTMLDocument7
*iface
, BSTR v
)
3563 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3564 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
3568 static HRESULT WINAPI
HTMLDocument7_get_xmlVersion(IHTMLDocument7
*iface
, BSTR
*p
)
3570 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3571 FIXME("(%p)->(%p)\n", This
, p
);
3575 static HRESULT WINAPI
HTMLDocument7_hasAttributes(IHTMLDocument7
*iface
, VARIANT_BOOL
*pfHasAttributes
)
3577 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3578 FIXME("(%p)->(%p)\n", This
, pfHasAttributes
);
3582 static HRESULT WINAPI
HTMLDocument7_put_onabort(IHTMLDocument7
*iface
, VARIANT v
)
3584 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3586 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3588 return set_doc_event(This
, EVENTID_ABORT
, &v
);
3591 static HRESULT WINAPI
HTMLDocument7_get_onabort(IHTMLDocument7
*iface
, VARIANT
*p
)
3593 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3595 TRACE("(%p)->(%p)\n", This
, p
);
3597 return get_doc_event(This
, EVENTID_ABORT
, p
);
3600 static HRESULT WINAPI
HTMLDocument7_put_onblur(IHTMLDocument7
*iface
, VARIANT v
)
3602 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3604 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3606 return set_doc_event(This
, EVENTID_BLUR
, &v
);
3609 static HRESULT WINAPI
HTMLDocument7_get_onblur(IHTMLDocument7
*iface
, VARIANT
*p
)
3611 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3613 TRACE("(%p)->(%p)\n", This
, p
);
3615 return get_doc_event(This
, EVENTID_BLUR
, p
);
3618 static HRESULT WINAPI
HTMLDocument7_put_oncanplay(IHTMLDocument7
*iface
, VARIANT v
)
3620 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3621 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3625 static HRESULT WINAPI
HTMLDocument7_get_oncanplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3627 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3628 FIXME("(%p)->(%p)\n", This
, p
);
3632 static HRESULT WINAPI
HTMLDocument7_put_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT v
)
3634 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3635 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3639 static HRESULT WINAPI
HTMLDocument7_get_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT
*p
)
3641 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3642 FIXME("(%p)->(%p)\n", This
, p
);
3646 static HRESULT WINAPI
HTMLDocument7_put_onchange(IHTMLDocument7
*iface
, VARIANT v
)
3648 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3650 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3652 return set_doc_event(This
, EVENTID_CHANGE
, &v
);
3655 static HRESULT WINAPI
HTMLDocument7_get_onchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3657 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3659 TRACE("(%p)->(%p)\n", This
, p
);
3661 return get_doc_event(This
, EVENTID_CHANGE
, p
);
3664 static HRESULT WINAPI
HTMLDocument7_put_ondrag(IHTMLDocument7
*iface
, VARIANT v
)
3666 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3668 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3670 return set_doc_event(This
, EVENTID_DRAG
, &v
);
3673 static HRESULT WINAPI
HTMLDocument7_get_ondrag(IHTMLDocument7
*iface
, VARIANT
*p
)
3675 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3677 TRACE("(%p)->(%p)\n", This
, p
);
3679 return get_doc_event(This
, EVENTID_DRAG
, p
);
3682 static HRESULT WINAPI
HTMLDocument7_put_ondragend(IHTMLDocument7
*iface
, VARIANT v
)
3684 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3685 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3689 static HRESULT WINAPI
HTMLDocument7_get_ondragend(IHTMLDocument7
*iface
, VARIANT
*p
)
3691 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3692 FIXME("(%p)->(%p)\n", This
, p
);
3696 static HRESULT WINAPI
HTMLDocument7_put_ondragenter(IHTMLDocument7
*iface
, VARIANT v
)
3698 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3699 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3703 static HRESULT WINAPI
HTMLDocument7_get_ondragenter(IHTMLDocument7
*iface
, VARIANT
*p
)
3705 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3706 FIXME("(%p)->(%p)\n", This
, p
);
3710 static HRESULT WINAPI
HTMLDocument7_put_ondragleave(IHTMLDocument7
*iface
, VARIANT v
)
3712 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3713 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3717 static HRESULT WINAPI
HTMLDocument7_get_ondragleave(IHTMLDocument7
*iface
, VARIANT
*p
)
3719 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3720 FIXME("(%p)->(%p)\n", This
, p
);
3724 static HRESULT WINAPI
HTMLDocument7_put_ondragover(IHTMLDocument7
*iface
, VARIANT v
)
3726 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3727 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3731 static HRESULT WINAPI
HTMLDocument7_get_ondragover(IHTMLDocument7
*iface
, VARIANT
*p
)
3733 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3734 FIXME("(%p)->(%p)\n", This
, p
);
3738 static HRESULT WINAPI
HTMLDocument7_put_ondrop(IHTMLDocument7
*iface
, VARIANT v
)
3740 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3741 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3745 static HRESULT WINAPI
HTMLDocument7_get_ondrop(IHTMLDocument7
*iface
, VARIANT
*p
)
3747 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3748 FIXME("(%p)->(%p)\n", This
, p
);
3752 static HRESULT WINAPI
HTMLDocument7_put_ondurationchange(IHTMLDocument7
*iface
, VARIANT v
)
3754 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3755 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3759 static HRESULT WINAPI
HTMLDocument7_get_ondurationchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3761 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3762 FIXME("(%p)->(%p)\n", This
, p
);
3766 static HRESULT WINAPI
HTMLDocument7_put_onemptied(IHTMLDocument7
*iface
, VARIANT v
)
3768 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3769 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3773 static HRESULT WINAPI
HTMLDocument7_get_onemptied(IHTMLDocument7
*iface
, VARIANT
*p
)
3775 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3776 FIXME("(%p)->(%p)\n", This
, p
);
3780 static HRESULT WINAPI
HTMLDocument7_put_onended(IHTMLDocument7
*iface
, VARIANT v
)
3782 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3783 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3787 static HRESULT WINAPI
HTMLDocument7_get_onended(IHTMLDocument7
*iface
, VARIANT
*p
)
3789 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3790 FIXME("(%p)->(%p)\n", This
, p
);
3794 static HRESULT WINAPI
HTMLDocument7_put_onerror(IHTMLDocument7
*iface
, VARIANT v
)
3796 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3798 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3800 return set_doc_event(This
, EVENTID_ERROR
, &v
);
3803 static HRESULT WINAPI
HTMLDocument7_get_onerror(IHTMLDocument7
*iface
, VARIANT
*p
)
3805 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3807 TRACE("(%p)->(%p)\n", This
, p
);
3809 return get_doc_event(This
, EVENTID_ERROR
, p
);
3812 static HRESULT WINAPI
HTMLDocument7_put_onfocus(IHTMLDocument7
*iface
, VARIANT v
)
3814 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3816 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3818 return set_doc_event(This
, EVENTID_FOCUS
, &v
);
3821 static HRESULT WINAPI
HTMLDocument7_get_onfocus(IHTMLDocument7
*iface
, VARIANT
*p
)
3823 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3825 TRACE("(%p)->(%p)\n", This
, p
);
3827 return get_doc_event(This
, EVENTID_FOCUS
, p
);
3830 static HRESULT WINAPI
HTMLDocument7_put_oninput(IHTMLDocument7
*iface
, VARIANT v
)
3832 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3834 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3836 return set_doc_event(This
, EVENTID_INPUT
, &v
);
3839 static HRESULT WINAPI
HTMLDocument7_get_oninput(IHTMLDocument7
*iface
, VARIANT
*p
)
3841 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3843 TRACE("(%p)->(%p)\n", This
, p
);
3845 return get_doc_event(This
, EVENTID_INPUT
, p
);
3848 static HRESULT WINAPI
HTMLDocument7_put_onload(IHTMLDocument7
*iface
, VARIANT v
)
3850 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3852 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3854 return set_doc_event(This
, EVENTID_LOAD
, &v
);
3857 static HRESULT WINAPI
HTMLDocument7_get_onload(IHTMLDocument7
*iface
, VARIANT
*p
)
3859 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3861 TRACE("(%p)->(%p)\n", This
, p
);
3863 return get_doc_event(This
, EVENTID_LOAD
, p
);
3866 static HRESULT WINAPI
HTMLDocument7_put_onloadeddata(IHTMLDocument7
*iface
, VARIANT v
)
3868 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3869 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3873 static HRESULT WINAPI
HTMLDocument7_get_onloadeddata(IHTMLDocument7
*iface
, VARIANT
*p
)
3875 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3876 FIXME("(%p)->(%p)\n", This
, p
);
3880 static HRESULT WINAPI
HTMLDocument7_put_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT v
)
3882 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3883 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3887 static HRESULT WINAPI
HTMLDocument7_get_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT
*p
)
3889 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3890 FIXME("(%p)->(%p)\n", This
, p
);
3894 static HRESULT WINAPI
HTMLDocument7_put_onloadstart(IHTMLDocument7
*iface
, VARIANT v
)
3896 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3897 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3901 static HRESULT WINAPI
HTMLDocument7_get_onloadstart(IHTMLDocument7
*iface
, VARIANT
*p
)
3903 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3904 FIXME("(%p)->(%p)\n", This
, p
);
3908 static HRESULT WINAPI
HTMLDocument7_put_onpause(IHTMLDocument7
*iface
, VARIANT v
)
3910 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3911 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3915 static HRESULT WINAPI
HTMLDocument7_get_onpause(IHTMLDocument7
*iface
, VARIANT
*p
)
3917 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3918 FIXME("(%p)->(%p)\n", This
, p
);
3922 static HRESULT WINAPI
HTMLDocument7_put_onplay(IHTMLDocument7
*iface
, VARIANT v
)
3924 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3925 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3929 static HRESULT WINAPI
HTMLDocument7_get_onplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3931 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3932 FIXME("(%p)->(%p)\n", This
, p
);
3936 static HRESULT WINAPI
HTMLDocument7_put_onplaying(IHTMLDocument7
*iface
, VARIANT v
)
3938 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3939 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3943 static HRESULT WINAPI
HTMLDocument7_get_onplaying(IHTMLDocument7
*iface
, VARIANT
*p
)
3945 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3946 FIXME("(%p)->(%p)\n", This
, p
);
3950 static HRESULT WINAPI
HTMLDocument7_put_onprogress(IHTMLDocument7
*iface
, VARIANT v
)
3952 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3953 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3957 static HRESULT WINAPI
HTMLDocument7_get_onprogress(IHTMLDocument7
*iface
, VARIANT
*p
)
3959 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3960 FIXME("(%p)->(%p)\n", This
, p
);
3964 static HRESULT WINAPI
HTMLDocument7_put_onratechange(IHTMLDocument7
*iface
, VARIANT v
)
3966 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3967 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3971 static HRESULT WINAPI
HTMLDocument7_get_onratechange(IHTMLDocument7
*iface
, VARIANT
*p
)
3973 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3974 FIXME("(%p)->(%p)\n", This
, p
);
3978 static HRESULT WINAPI
HTMLDocument7_put_onreset(IHTMLDocument7
*iface
, VARIANT v
)
3980 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3981 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3985 static HRESULT WINAPI
HTMLDocument7_get_onreset(IHTMLDocument7
*iface
, VARIANT
*p
)
3987 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3988 FIXME("(%p)->(%p)\n", This
, p
);
3992 static HRESULT WINAPI
HTMLDocument7_put_onscroll(IHTMLDocument7
*iface
, VARIANT v
)
3994 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
3996 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3998 return set_doc_event(This
, EVENTID_SCROLL
, &v
);
4001 static HRESULT WINAPI
HTMLDocument7_get_onscroll(IHTMLDocument7
*iface
, VARIANT
*p
)
4003 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4005 TRACE("(%p)->(%p)\n", This
, p
);
4007 return get_doc_event(This
, EVENTID_SCROLL
, p
);
4010 static HRESULT WINAPI
HTMLDocument7_put_onseekend(IHTMLDocument7
*iface
, VARIANT v
)
4012 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4013 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4017 static HRESULT WINAPI
HTMLDocument7_get_onseekend(IHTMLDocument7
*iface
, VARIANT
*p
)
4019 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4020 FIXME("(%p)->(%p)\n", This
, p
);
4024 static HRESULT WINAPI
HTMLDocument7_put_onseeking(IHTMLDocument7
*iface
, VARIANT v
)
4026 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4027 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4031 static HRESULT WINAPI
HTMLDocument7_get_onseeking(IHTMLDocument7
*iface
, VARIANT
*p
)
4033 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4034 FIXME("(%p)->(%p)\n", This
, p
);
4038 static HRESULT WINAPI
HTMLDocument7_put_onselect(IHTMLDocument7
*iface
, VARIANT v
)
4040 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4041 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4045 static HRESULT WINAPI
HTMLDocument7_get_onselect(IHTMLDocument7
*iface
, VARIANT
*p
)
4047 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4048 FIXME("(%p)->(%p)\n", This
, p
);
4052 static HRESULT WINAPI
HTMLDocument7_put_onstalled(IHTMLDocument7
*iface
, VARIANT v
)
4054 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4055 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4059 static HRESULT WINAPI
HTMLDocument7_get_onstalled(IHTMLDocument7
*iface
, VARIANT
*p
)
4061 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4062 FIXME("(%p)->(%p)\n", This
, p
);
4066 static HRESULT WINAPI
HTMLDocument7_put_onsubmit(IHTMLDocument7
*iface
, VARIANT v
)
4068 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4070 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4072 return set_doc_event(This
, EVENTID_SUBMIT
, &v
);
4075 static HRESULT WINAPI
HTMLDocument7_get_onsubmit(IHTMLDocument7
*iface
, VARIANT
*p
)
4077 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4079 TRACE("(%p)->(%p)\n", This
, p
);
4081 return get_doc_event(This
, EVENTID_SUBMIT
, p
);
4084 static HRESULT WINAPI
HTMLDocument7_put_onsuspend(IHTMLDocument7
*iface
, VARIANT v
)
4086 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4087 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4091 static HRESULT WINAPI
HTMLDocument7_get_onsuspend(IHTMLDocument7
*iface
, VARIANT
*p
)
4093 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4094 FIXME("(%p)->(%p)\n", This
, p
);
4098 static HRESULT WINAPI
HTMLDocument7_put_ontimeupdate(IHTMLDocument7
*iface
, VARIANT v
)
4100 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4101 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4105 static HRESULT WINAPI
HTMLDocument7_get_ontimeupdate(IHTMLDocument7
*iface
, VARIANT
*p
)
4107 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4108 FIXME("(%p)->(%p)\n", This
, p
);
4112 static HRESULT WINAPI
HTMLDocument7_put_onvolumechange(IHTMLDocument7
*iface
, VARIANT v
)
4114 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4115 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4119 static HRESULT WINAPI
HTMLDocument7_get_onvolumechange(IHTMLDocument7
*iface
, VARIANT
*p
)
4121 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4122 FIXME("(%p)->(%p)\n", This
, p
);
4126 static HRESULT WINAPI
HTMLDocument7_put_onwaiting(IHTMLDocument7
*iface
, VARIANT v
)
4128 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4129 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4133 static HRESULT WINAPI
HTMLDocument7_get_onwaiting(IHTMLDocument7
*iface
, VARIANT
*p
)
4135 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4136 FIXME("(%p)->(%p)\n", This
, p
);
4140 static HRESULT WINAPI
HTMLDocument7_normalize(IHTMLDocument7
*iface
)
4142 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4143 FIXME("(%p)\n", This
);
4147 static HRESULT WINAPI
HTMLDocument7_importNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
,
4148 VARIANT_BOOL fDeep
, IHTMLDOMNode3
**ppNodeDest
)
4150 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4151 nsIDOMNode
*nsnode
= NULL
;
4156 TRACE("(%p)->(%p %x %p)\n", This
, pNodeSource
, fDeep
, ppNodeDest
);
4158 if(!This
->dom_document
) {
4159 WARN("NULL dom_document\n");
4160 return E_UNEXPECTED
;
4163 if(!(node
= unsafe_impl_from_IHTMLDOMNode(pNodeSource
))) {
4164 ERR("not our node\n");
4168 nsres
= nsIDOMDocument_ImportNode(This
->dom_document
, node
->nsnode
, !!fDeep
, 1, &nsnode
);
4169 if(NS_FAILED(nsres
)) {
4170 ERR("ImportNode failed: %08lx\n", nsres
);
4171 return map_nsresult(nsres
);
4179 hres
= get_node(nsnode
, TRUE
, &node
);
4180 nsIDOMNode_Release(nsnode
);
4184 *ppNodeDest
= &node
->IHTMLDOMNode3_iface
;
4188 static HRESULT WINAPI
HTMLDocument7_get_parentWindow(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
4190 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4192 TRACE("(%p)->(%p)\n", This
, p
);
4194 return IHTMLDocument7_get_defaultView(&This
->IHTMLDocument7_iface
, p
);
4197 static HRESULT WINAPI
HTMLDocument7_put_body(IHTMLDocument7
*iface
, IHTMLElement
*v
)
4199 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4200 FIXME("(%p)->(%p)\n", This
, v
);
4204 static HRESULT WINAPI
HTMLDocument7_get_body(IHTMLDocument7
*iface
, IHTMLElement
**p
)
4206 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4208 TRACE("(%p)->(%p)\n", This
, p
);
4210 return IHTMLDocument2_get_body(&This
->IHTMLDocument2_iface
, p
);
4213 static HRESULT WINAPI
HTMLDocument7_get_head(IHTMLDocument7
*iface
, IHTMLElement
**p
)
4215 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
);
4216 nsIDOMHTMLHeadElement
*nshead
;
4217 nsIDOMElement
*nselem
;
4222 TRACE("(%p)->(%p)\n", This
, p
);
4224 if(!This
->dom_document
) {
4225 FIXME("No document\n");
4229 if(!This
->html_document
) {
4230 FIXME("Not implemented for XML document\n");
4234 nsres
= nsIDOMHTMLDocument_GetHead(This
->html_document
, &nshead
);
4235 assert(nsres
== NS_OK
);
4242 nsres
= nsIDOMHTMLHeadElement_QueryInterface(nshead
, &IID_nsIDOMElement
, (void**)&nselem
);
4243 nsIDOMHTMLHeadElement_Release(nshead
);
4244 assert(nsres
== NS_OK
);
4246 hres
= get_element(nselem
, &elem
);
4247 nsIDOMElement_Release(nselem
);
4251 *p
= &elem
->IHTMLElement_iface
;
4255 static const IHTMLDocument7Vtbl HTMLDocument7Vtbl
= {
4256 HTMLDocument7_QueryInterface
,
4257 HTMLDocument7_AddRef
,
4258 HTMLDocument7_Release
,
4259 HTMLDocument7_GetTypeInfoCount
,
4260 HTMLDocument7_GetTypeInfo
,
4261 HTMLDocument7_GetIDsOfNames
,
4262 HTMLDocument7_Invoke
,
4263 HTMLDocument7_get_defaultView
,
4264 HTMLDocument7_createCDATASection
,
4265 HTMLDocument7_getSelection
,
4266 HTMLDocument7_getElementsByTagNameNS
,
4267 HTMLDocument7_createElementNS
,
4268 HTMLDocument7_createAttributeNS
,
4269 HTMLDocument7_put_onmsthumbnailclick
,
4270 HTMLDocument7_get_onmsthumbnailclick
,
4271 HTMLDocument7_get_characterSet
,
4272 HTMLDocument7_createElement
,
4273 HTMLDocument7_createAttribute
,
4274 HTMLDocument7_getElementsByClassName
,
4275 HTMLDocument7_createProcessingInstruction
,
4276 HTMLDocument7_adoptNode
,
4277 HTMLDocument7_put_onmssitemodejumplistitemremoved
,
4278 HTMLDocument7_get_onmssitemodejumplistitemremoved
,
4279 HTMLDocument7_get_all
,
4280 HTMLDocument7_get_inputEncoding
,
4281 HTMLDocument7_get_xmlEncoding
,
4282 HTMLDocument7_put_xmlStandalone
,
4283 HTMLDocument7_get_xmlStandalone
,
4284 HTMLDocument7_put_xmlVersion
,
4285 HTMLDocument7_get_xmlVersion
,
4286 HTMLDocument7_hasAttributes
,
4287 HTMLDocument7_put_onabort
,
4288 HTMLDocument7_get_onabort
,
4289 HTMLDocument7_put_onblur
,
4290 HTMLDocument7_get_onblur
,
4291 HTMLDocument7_put_oncanplay
,
4292 HTMLDocument7_get_oncanplay
,
4293 HTMLDocument7_put_oncanplaythrough
,
4294 HTMLDocument7_get_oncanplaythrough
,
4295 HTMLDocument7_put_onchange
,
4296 HTMLDocument7_get_onchange
,
4297 HTMLDocument7_put_ondrag
,
4298 HTMLDocument7_get_ondrag
,
4299 HTMLDocument7_put_ondragend
,
4300 HTMLDocument7_get_ondragend
,
4301 HTMLDocument7_put_ondragenter
,
4302 HTMLDocument7_get_ondragenter
,
4303 HTMLDocument7_put_ondragleave
,
4304 HTMLDocument7_get_ondragleave
,
4305 HTMLDocument7_put_ondragover
,
4306 HTMLDocument7_get_ondragover
,
4307 HTMLDocument7_put_ondrop
,
4308 HTMLDocument7_get_ondrop
,
4309 HTMLDocument7_put_ondurationchange
,
4310 HTMLDocument7_get_ondurationchange
,
4311 HTMLDocument7_put_onemptied
,
4312 HTMLDocument7_get_onemptied
,
4313 HTMLDocument7_put_onended
,
4314 HTMLDocument7_get_onended
,
4315 HTMLDocument7_put_onerror
,
4316 HTMLDocument7_get_onerror
,
4317 HTMLDocument7_put_onfocus
,
4318 HTMLDocument7_get_onfocus
,
4319 HTMLDocument7_put_oninput
,
4320 HTMLDocument7_get_oninput
,
4321 HTMLDocument7_put_onload
,
4322 HTMLDocument7_get_onload
,
4323 HTMLDocument7_put_onloadeddata
,
4324 HTMLDocument7_get_onloadeddata
,
4325 HTMLDocument7_put_onloadedmetadata
,
4326 HTMLDocument7_get_onloadedmetadata
,
4327 HTMLDocument7_put_onloadstart
,
4328 HTMLDocument7_get_onloadstart
,
4329 HTMLDocument7_put_onpause
,
4330 HTMLDocument7_get_onpause
,
4331 HTMLDocument7_put_onplay
,
4332 HTMLDocument7_get_onplay
,
4333 HTMLDocument7_put_onplaying
,
4334 HTMLDocument7_get_onplaying
,
4335 HTMLDocument7_put_onprogress
,
4336 HTMLDocument7_get_onprogress
,
4337 HTMLDocument7_put_onratechange
,
4338 HTMLDocument7_get_onratechange
,
4339 HTMLDocument7_put_onreset
,
4340 HTMLDocument7_get_onreset
,
4341 HTMLDocument7_put_onscroll
,
4342 HTMLDocument7_get_onscroll
,
4343 HTMLDocument7_put_onseekend
,
4344 HTMLDocument7_get_onseekend
,
4345 HTMLDocument7_put_onseeking
,
4346 HTMLDocument7_get_onseeking
,
4347 HTMLDocument7_put_onselect
,
4348 HTMLDocument7_get_onselect
,
4349 HTMLDocument7_put_onstalled
,
4350 HTMLDocument7_get_onstalled
,
4351 HTMLDocument7_put_onsubmit
,
4352 HTMLDocument7_get_onsubmit
,
4353 HTMLDocument7_put_onsuspend
,
4354 HTMLDocument7_get_onsuspend
,
4355 HTMLDocument7_put_ontimeupdate
,
4356 HTMLDocument7_get_ontimeupdate
,
4357 HTMLDocument7_put_onvolumechange
,
4358 HTMLDocument7_get_onvolumechange
,
4359 HTMLDocument7_put_onwaiting
,
4360 HTMLDocument7_get_onwaiting
,
4361 HTMLDocument7_normalize
,
4362 HTMLDocument7_importNode
,
4363 HTMLDocument7_get_parentWindow
,
4364 HTMLDocument7_put_body
,
4365 HTMLDocument7_get_body
,
4366 HTMLDocument7_get_head
4369 static inline HTMLDocumentNode
*impl_from_IDocumentSelector(IDocumentSelector
*iface
)
4371 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDocumentSelector_iface
);
4374 DISPEX_IDISPATCH_IMPL(DocumentSelector
, IDocumentSelector
,
4375 impl_from_IDocumentSelector(iface
)->node
.event_target
.dispex
)
4377 static HRESULT WINAPI
DocumentSelector_querySelector(IDocumentSelector
*iface
, BSTR v
, IHTMLElement
**pel
)
4379 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4380 nsIDOMElement
*nselem
;
4386 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4388 nsAString_InitDepend(&nsstr
, v
);
4389 if(This
->dom_document
)
4390 nsres
= nsIDOMDocument_QuerySelector(This
->dom_document
, &nsstr
, &nselem
);
4392 nsIDOMDocumentFragment
*frag
;
4393 nsres
= nsIDOMNode_QueryInterface(This
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&frag
);
4394 if(NS_SUCCEEDED(nsres
)) {
4395 nsres
= nsIDOMDocumentFragment_QuerySelector(frag
, &nsstr
, &nselem
);
4396 nsIDOMDocumentFragment_Release(frag
);
4399 nsAString_Finish(&nsstr
);
4401 if(NS_FAILED(nsres
)) {
4402 WARN("QuerySelector failed: %08lx\n", nsres
);
4403 return map_nsresult(nsres
);
4411 hres
= get_element(nselem
, &elem
);
4412 nsIDOMElement_Release(nselem
);
4416 *pel
= &elem
->IHTMLElement_iface
;
4420 static HRESULT WINAPI
DocumentSelector_querySelectorAll(IDocumentSelector
*iface
, BSTR v
, IHTMLDOMChildrenCollection
**pel
)
4422 HTMLDocumentNode
*This
= impl_from_IDocumentSelector(iface
);
4423 nsIDOMNodeList
*node_list
= NULL
;
4428 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4430 nsAString_InitDepend(&nsstr
, v
);
4431 if(This
->dom_document
)
4432 nsres
= nsIDOMDocument_QuerySelectorAll(This
->dom_document
, &nsstr
, &node_list
);
4434 nsIDOMDocumentFragment
*frag
;
4435 nsres
= nsIDOMNode_QueryInterface(This
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&frag
);
4436 if(NS_SUCCEEDED(nsres
)) {
4437 nsres
= nsIDOMDocumentFragment_QuerySelectorAll(frag
, &nsstr
, &node_list
);
4438 nsIDOMDocumentFragment_Release(frag
);
4441 nsAString_Finish(&nsstr
);
4443 if(NS_FAILED(nsres
)) {
4444 WARN("QuerySelectorAll failed: %08lx\n", nsres
);
4446 nsIDOMNodeList_Release(node_list
);
4447 return map_nsresult(nsres
);
4450 hres
= create_child_collection(node_list
, dispex_compat_mode(&This
->node
.event_target
.dispex
), pel
);
4451 nsIDOMNodeList_Release(node_list
);
4455 static const IDocumentSelectorVtbl DocumentSelectorVtbl
= {
4456 DocumentSelector_QueryInterface
,
4457 DocumentSelector_AddRef
,
4458 DocumentSelector_Release
,
4459 DocumentSelector_GetTypeInfoCount
,
4460 DocumentSelector_GetTypeInfo
,
4461 DocumentSelector_GetIDsOfNames
,
4462 DocumentSelector_Invoke
,
4463 DocumentSelector_querySelector
,
4464 DocumentSelector_querySelectorAll
4467 static inline HTMLDocumentNode
*impl_from_IDocumentEvent(IDocumentEvent
*iface
)
4469 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDocumentEvent_iface
);
4472 DISPEX_IDISPATCH_IMPL(DocumentEvent
, IDocumentEvent
,
4473 impl_from_IDocumentEvent(iface
)->node
.event_target
.dispex
)
4475 static HRESULT WINAPI
DocumentEvent_createEvent(IDocumentEvent
*iface
, BSTR eventType
, IDOMEvent
**p
)
4477 HTMLDocumentNode
*This
= impl_from_IDocumentEvent(iface
);
4479 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eventType
), p
);
4481 return create_document_event_str(This
, eventType
, p
);
4484 static const IDocumentEventVtbl DocumentEventVtbl
= {
4485 DocumentEvent_QueryInterface
,
4486 DocumentEvent_AddRef
,
4487 DocumentEvent_Release
,
4488 DocumentEvent_GetTypeInfoCount
,
4489 DocumentEvent_GetTypeInfo
,
4490 DocumentEvent_GetIDsOfNames
,
4491 DocumentEvent_Invoke
,
4492 DocumentEvent_createEvent
4495 static void HTMLDocumentNode_on_advise(IUnknown
*iface
, cp_static_data_t
*cp
)
4497 HTMLDocumentNode
*This
= CONTAINING_RECORD((IHTMLDocument2
*)iface
, HTMLDocumentNode
, IHTMLDocument2_iface
);
4499 if(This
->window
&& This
->window
->base
.outer_window
)
4500 update_doc_cp_events(This
, cp
);
4503 static inline HTMLDocumentNode
*impl_from_ISupportErrorInfo(ISupportErrorInfo
*iface
)
4505 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, ISupportErrorInfo_iface
);
4508 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
4510 HTMLDocumentNode
*This
= impl_from_ISupportErrorInfo(iface
);
4511 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
4514 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
4516 HTMLDocumentNode
*This
= impl_from_ISupportErrorInfo(iface
);
4517 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
4520 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
4522 HTMLDocumentNode
*This
= impl_from_ISupportErrorInfo(iface
);
4523 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
4526 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
4528 FIXME("(%p)->(%s)\n", iface
, debugstr_mshtml_guid(riid
));
4532 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
4533 SupportErrorInfo_QueryInterface
,
4534 SupportErrorInfo_AddRef
,
4535 SupportErrorInfo_Release
,
4536 SupportErrorInfo_InterfaceSupportsErrorInfo
4539 static HRESULT
has_elem_name(nsIDOMHTMLDocument
*html_document
, const WCHAR
*name
)
4541 static const WCHAR fmt
[] = L
":-moz-any(applet,embed,form,iframe,img,object)[name=\"%s\"]";
4542 WCHAR buf
[128], *selector
= buf
;
4543 nsAString selector_str
;
4544 nsIDOMElement
*nselem
;
4548 len
= wcslen(name
) + ARRAY_SIZE(fmt
) - 2 /* %s */;
4549 if(len
> ARRAY_SIZE(buf
) && !(selector
= malloc(len
* sizeof(WCHAR
))))
4550 return E_OUTOFMEMORY
;
4551 swprintf(selector
, len
, fmt
, name
);
4553 nsAString_InitDepend(&selector_str
, selector
);
4554 nsres
= nsIDOMHTMLDocument_QuerySelector(html_document
, &selector_str
, &nselem
);
4555 nsAString_Finish(&selector_str
);
4558 if(NS_FAILED(nsres
))
4559 return map_nsresult(nsres
);
4562 return DISP_E_UNKNOWNNAME
;
4563 nsIDOMElement_Release(nselem
);
4567 static HRESULT
get_elem_by_name_or_id(nsIDOMHTMLDocument
*html_document
, const WCHAR
*name
, nsIDOMElement
**ret
)
4569 static const WCHAR fmt
[] = L
":-moz-any(embed,form,iframe,img):-moz-any([name=\"%s\"],[id=\"%s\"][name]),"
4570 L
":-moz-any(applet,object):-moz-any([name=\"%s\"],[id=\"%s\"])";
4571 WCHAR buf
[384], *selector
= buf
;
4572 nsAString selector_str
;
4573 nsIDOMElement
*nselem
;
4577 len
= wcslen(name
) * 4 + ARRAY_SIZE(fmt
) - 8 /* %s */;
4578 if(len
> ARRAY_SIZE(buf
) && !(selector
= malloc(len
* sizeof(WCHAR
))))
4579 return E_OUTOFMEMORY
;
4580 swprintf(selector
, len
, fmt
, name
, name
, name
, name
);
4582 nsAString_InitDepend(&selector_str
, selector
);
4583 nsres
= nsIDOMHTMLDocument_QuerySelector(html_document
, &selector_str
, &nselem
);
4584 nsAString_Finish(&selector_str
);
4587 if(NS_FAILED(nsres
))
4588 return map_nsresult(nsres
);
4596 nsIDOMElement_Release(nselem
);
4599 return DISP_E_UNKNOWNNAME
;
4602 static HRESULT
dispid_from_elem_name(HTMLDocumentNode
*This
, const WCHAR
*name
, DISPID
*dispid
)
4606 for(i
=0; i
< This
->elem_vars_cnt
; i
++) {
4607 if(!wcscmp(name
, This
->elem_vars
[i
])) {
4608 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
4613 if(This
->elem_vars_cnt
== This
->elem_vars_size
) {
4616 if(This
->elem_vars_size
) {
4617 new_vars
= realloc(This
->elem_vars
, This
->elem_vars_size
* 2 * sizeof(WCHAR
*));
4619 return E_OUTOFMEMORY
;
4620 This
->elem_vars_size
*= 2;
4622 new_vars
= malloc(16 * sizeof(WCHAR
*));
4624 return E_OUTOFMEMORY
;
4625 This
->elem_vars_size
= 16;
4628 This
->elem_vars
= new_vars
;
4631 This
->elem_vars
[This
->elem_vars_cnt
] = wcsdup(name
);
4632 if(!This
->elem_vars
[This
->elem_vars_cnt
])
4633 return E_OUTOFMEMORY
;
4635 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+This
->elem_vars_cnt
++;
4639 static inline HTMLDocumentNode
*impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo
*iface
)
4641 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IProvideMultipleClassInfo_iface
);
4644 static HRESULT WINAPI
ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo
*iface
,
4645 REFIID riid
, void **ppv
)
4647 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4648 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppv
);
4651 static ULONG WINAPI
ProvideClassInfo_AddRef(IProvideMultipleClassInfo
*iface
)
4653 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4654 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
4657 static ULONG WINAPI
ProvideClassInfo_Release(IProvideMultipleClassInfo
*iface
)
4659 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4660 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
4663 static HRESULT WINAPI
ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo
*iface
, ITypeInfo
**ppTI
)
4665 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4666 TRACE("(%p)->(%p)\n", This
, ppTI
);
4667 return get_class_typeinfo(&CLSID_HTMLDocument
, ppTI
);
4670 static HRESULT WINAPI
ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo
*iface
, DWORD dwGuidKind
, GUID
*pGUID
)
4672 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4673 FIXME("(%p)->(%lu %p)\n", This
, dwGuidKind
, pGUID
);
4677 static HRESULT WINAPI
ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo
*iface
, ULONG
*pcti
)
4679 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4680 FIXME("(%p)->(%p)\n", This
, pcti
);
4685 static HRESULT WINAPI
ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo
*iface
, ULONG iti
,
4686 DWORD dwFlags
, ITypeInfo
**pptiCoClass
, DWORD
*pdwTIFlags
, ULONG
*pcdispidReserved
, IID
*piidPrimary
, IID
*piidSource
)
4688 HTMLDocumentNode
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4689 FIXME("(%p)->(%lu %lx %p %p %p %p %p)\n", This
, iti
, dwFlags
, pptiCoClass
, pdwTIFlags
, pcdispidReserved
, piidPrimary
, piidSource
);
4693 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl
= {
4694 ProvideClassInfo_QueryInterface
,
4695 ProvideClassInfo_AddRef
,
4696 ProvideClassInfo_Release
,
4697 ProvideClassInfo_GetClassInfo
,
4698 ProvideClassInfo2_GetGUID
,
4699 ProvideMultipleClassInfo_GetMultiTypeInfoCount
,
4700 ProvideMultipleClassInfo_GetInfoOfIndex
4703 /**********************************************************
4704 * IMarkupServices implementation
4706 static inline HTMLDocumentNode
*impl_from_IMarkupServices(IMarkupServices
*iface
)
4708 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IMarkupServices_iface
);
4711 static HRESULT WINAPI
MarkupServices_QueryInterface(IMarkupServices
*iface
, REFIID riid
, void **ppvObject
)
4713 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4714 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppvObject
);
4717 static ULONG WINAPI
MarkupServices_AddRef(IMarkupServices
*iface
)
4719 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4720 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
4723 static ULONG WINAPI
MarkupServices_Release(IMarkupServices
*iface
)
4725 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4726 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
4729 static HRESULT WINAPI
MarkupServices_CreateMarkupPointer(IMarkupServices
*iface
, IMarkupPointer
**ppPointer
)
4731 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4733 TRACE("(%p)->(%p)\n", This
, ppPointer
);
4735 return create_markup_pointer(ppPointer
);
4738 static HRESULT WINAPI
MarkupServices_CreateMarkupContainer(IMarkupServices
*iface
, IMarkupContainer
**ppMarkupContainer
)
4740 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4741 IHTMLDocument2
*frag
;
4743 TRACE("(%p)->(%p)\n", This
, ppMarkupContainer
);
4745 hres
= IHTMLDocument3_createDocumentFragment(&This
->IHTMLDocument3_iface
, &frag
);
4749 IHTMLDocument2_QueryInterface(frag
, &IID_IMarkupContainer
, (void**)ppMarkupContainer
);
4750 IHTMLDocument2_Release(frag
);
4755 static HRESULT WINAPI
MarkupServices_CreateElement(IMarkupServices
*iface
,
4756 ELEMENT_TAG_ID tagID
, OLECHAR
*pchAttributes
, IHTMLElement
**ppElement
)
4758 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4759 FIXME("(%p)->(%d,%s,%p)\n", This
, tagID
, debugstr_w(pchAttributes
), ppElement
);
4763 static HRESULT WINAPI
MarkupServices_CloneElement(IMarkupServices
*iface
,
4764 IHTMLElement
*pElemCloneThis
, IHTMLElement
**ppElementTheClone
)
4766 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4767 FIXME("(%p)->(%p,%p)\n", This
, pElemCloneThis
, ppElementTheClone
);
4771 static HRESULT WINAPI
MarkupServices_InsertElement(IMarkupServices
*iface
,
4772 IHTMLElement
*pElementInsert
, IMarkupPointer
*pPointerStart
,
4773 IMarkupPointer
*pPointerFinish
)
4775 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4776 FIXME("(%p)->(%p,%p,%p)\n", This
, pElementInsert
, pPointerStart
, pPointerFinish
);
4780 static HRESULT WINAPI
MarkupServices_RemoveElement(IMarkupServices
*iface
, IHTMLElement
*pElementRemove
)
4782 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4783 FIXME("(%p)->(%p)\n", This
, pElementRemove
);
4787 static HRESULT WINAPI
MarkupServices_Remove(IMarkupServices
*iface
,
4788 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
4790 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4791 FIXME("(%p)->(%p,%p)\n", This
, pPointerStart
, pPointerFinish
);
4795 static HRESULT WINAPI
MarkupServices_Copy(IMarkupServices
*iface
,
4796 IMarkupPointer
*pPointerSourceStart
, IMarkupPointer
*pPointerSourceFinish
,
4797 IMarkupPointer
*pPointerTarget
)
4799 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4800 FIXME("(%p)->(%p,%p,%p)\n", This
, pPointerSourceStart
, pPointerSourceFinish
, pPointerTarget
);
4804 static HRESULT WINAPI
MarkupServices_Move(IMarkupServices
*iface
,
4805 IMarkupPointer
*pPointerSourceStart
, IMarkupPointer
*pPointerSourceFinish
,
4806 IMarkupPointer
*pPointerTarget
)
4808 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4809 FIXME("(%p)->(%p,%p,%p)\n", This
, pPointerSourceStart
, pPointerSourceFinish
, pPointerTarget
);
4813 static HRESULT WINAPI
MarkupServices_InsertText(IMarkupServices
*iface
,
4814 OLECHAR
*pchText
, LONG cch
, IMarkupPointer
*pPointerTarget
)
4816 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4817 FIXME("(%p)->(%s,%lx,%p)\n", This
, debugstr_w(pchText
), cch
, pPointerTarget
);
4821 static HRESULT WINAPI
MarkupServices_ParseString(IMarkupServices
*iface
,
4822 OLECHAR
*pchHTML
, DWORD dwFlags
, IMarkupContainer
**ppContainerResult
,
4823 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
4826 IMarkupContainer
*container
;
4827 IHTMLDocument2
*doc
;
4828 IHTMLDOMNode
*node
, *html_node
, *new_html_node
= NULL
;
4829 IHTMLElement
*html
, *body
;
4830 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4831 TRACE("(%p)->(%s,%lx,%p,%p,%p)\n", This
, debugstr_w(pchHTML
), dwFlags
, ppContainerResult
, pPointerStart
, pPointerFinish
);
4834 FIXME("flags %lx not implemented.\n", dwFlags
);
4835 if(pPointerStart
|| pPointerFinish
) {
4836 FIXME("Pointers not implemented.\n");
4840 hres
= IMarkupServices_CreateMarkupContainer(iface
, &container
);
4844 IMarkupContainer_QueryInterface(container
, &IID_IHTMLDocument2
, (void**)&doc
);
4845 IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDOMNode
, (void**)&node
);
4846 IHTMLDocument2_createElement(&This
->IHTMLDocument2_iface
, (BSTR
)L
"html", &html
);
4848 IHTMLElement_put_innerHTML(html
, (BSTR
)L
"<head><title></title></head><body></body>");
4849 IHTMLElement_QueryInterface(html
, &IID_IHTMLDOMNode
, (void**)&html_node
);
4850 IHTMLElement_Release(html
);
4852 IHTMLDOMNode_appendChild(node
, html_node
, &new_html_node
);
4853 IHTMLDOMNode_Release(node
);
4854 IHTMLDOMNode_Release(html_node
);
4855 IHTMLDOMNode_Release(new_html_node
);
4857 IHTMLDocument2_get_body(doc
, &body
);
4858 hres
= IHTMLElement_put_innerHTML(body
, pchHTML
);
4861 ERR("Failed put_innerHTML hr %#lx\n", hres
);
4862 IMarkupContainer_Release(container
);
4866 IHTMLDocument2_Release(doc
);
4867 IHTMLElement_Release(body
);
4869 *ppContainerResult
= container
;
4874 static HRESULT WINAPI
MarkupServices_ParseGlobal(IMarkupServices
*iface
,
4875 HGLOBAL hglobalHTML
, DWORD dwFlags
, IMarkupContainer
**ppContainerResult
,
4876 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
4878 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4879 FIXME("(%p)->(%s,%lx,%p,%p,%p)\n", This
, debugstr_w(hglobalHTML
), dwFlags
, ppContainerResult
, pPointerStart
, pPointerFinish
);
4883 static HRESULT WINAPI
MarkupServices_IsScopedElement(IMarkupServices
*iface
,
4884 IHTMLElement
*pElement
, BOOL
*pfScoped
)
4886 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4887 FIXME("(%p)->(%p,%p)\n", This
, pElement
, pfScoped
);
4891 static HRESULT WINAPI
MarkupServices_GetElementTagId(IMarkupServices
*iface
,
4892 IHTMLElement
*pElement
, ELEMENT_TAG_ID
*ptagId
)
4894 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4895 FIXME("(%p)->(%p,%p)\n", This
, pElement
, ptagId
);
4899 static HRESULT WINAPI
MarkupServices_GetTagIDForName(IMarkupServices
*iface
,
4900 BSTR bstrName
, ELEMENT_TAG_ID
*ptagId
)
4902 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4903 FIXME("(%p)->(%s,%p)\n", This
, debugstr_w(bstrName
), ptagId
);
4907 static HRESULT WINAPI
MarkupServices_GetNameForTagID(IMarkupServices
*iface
,
4908 ELEMENT_TAG_ID tagId
, BSTR
*pbstrName
)
4910 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4911 FIXME("(%p)->(%d,%p)\n", This
, tagId
, pbstrName
);
4915 static HRESULT WINAPI
MarkupServices_MovePointersToRange(IMarkupServices
*iface
,
4916 IHTMLTxtRange
*pIRange
, IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
4918 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4919 FIXME("(%p)->(%p,%p,%p)\n", This
, pIRange
, pPointerStart
, pPointerFinish
);
4923 static HRESULT WINAPI
MarkupServices_MoveRangeToPointers(IMarkupServices
*iface
,
4924 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
, IHTMLTxtRange
*pIRange
)
4926 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4927 FIXME("(%p)->(%p,%p,%p)\n", This
, pPointerStart
, pPointerFinish
, pIRange
);
4931 static HRESULT WINAPI
MarkupServices_BeginUndoUnit(IMarkupServices
*iface
, OLECHAR
*pchTitle
)
4933 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4934 FIXME("(%p)->(%s)\n", This
, debugstr_w(pchTitle
));
4938 static HRESULT WINAPI
MarkupServices_EndUndoUnit(IMarkupServices
*iface
)
4940 HTMLDocumentNode
*This
= impl_from_IMarkupServices(iface
);
4941 FIXME("(%p)\n", This
);
4945 static const IMarkupServicesVtbl MarkupServicesVtbl
= {
4946 MarkupServices_QueryInterface
,
4947 MarkupServices_AddRef
,
4948 MarkupServices_Release
,
4949 MarkupServices_CreateMarkupPointer
,
4950 MarkupServices_CreateMarkupContainer
,
4951 MarkupServices_CreateElement
,
4952 MarkupServices_CloneElement
,
4953 MarkupServices_InsertElement
,
4954 MarkupServices_RemoveElement
,
4955 MarkupServices_Remove
,
4956 MarkupServices_Copy
,
4957 MarkupServices_Move
,
4958 MarkupServices_InsertText
,
4959 MarkupServices_ParseString
,
4960 MarkupServices_ParseGlobal
,
4961 MarkupServices_IsScopedElement
,
4962 MarkupServices_GetElementTagId
,
4963 MarkupServices_GetTagIDForName
,
4964 MarkupServices_GetNameForTagID
,
4965 MarkupServices_MovePointersToRange
,
4966 MarkupServices_MoveRangeToPointers
,
4967 MarkupServices_BeginUndoUnit
,
4968 MarkupServices_EndUndoUnit
4971 /**********************************************************
4972 * IMarkupContainer implementation
4974 static inline HTMLDocumentNode
*impl_from_IMarkupContainer(IMarkupContainer
*iface
)
4976 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IMarkupContainer_iface
);
4979 static HRESULT WINAPI
MarkupContainer_QueryInterface(IMarkupContainer
*iface
, REFIID riid
, void **ppvObject
)
4981 HTMLDocumentNode
*This
= impl_from_IMarkupContainer(iface
);
4982 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppvObject
);
4985 static ULONG WINAPI
MarkupContainer_AddRef(IMarkupContainer
*iface
)
4987 HTMLDocumentNode
*This
= impl_from_IMarkupContainer(iface
);
4988 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
4991 static ULONG WINAPI
MarkupContainer_Release(IMarkupContainer
*iface
)
4993 HTMLDocumentNode
*This
= impl_from_IMarkupContainer(iface
);
4994 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
4997 static HRESULT WINAPI
MarkupContainer_OwningDoc(IMarkupContainer
*iface
, IHTMLDocument2
**ppDoc
)
4999 HTMLDocumentNode
*This
= impl_from_IMarkupContainer(iface
);
5000 FIXME("(%p)->(%p)\n", This
, ppDoc
);
5004 static const IMarkupContainerVtbl MarkupContainerVtbl
= {
5005 MarkupContainer_QueryInterface
,
5006 MarkupContainer_AddRef
,
5007 MarkupContainer_Release
,
5008 MarkupContainer_OwningDoc
5011 /**********************************************************
5012 * IDisplayServices implementation
5014 static inline HTMLDocumentNode
*impl_from_IDisplayServices(IDisplayServices
*iface
)
5016 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDisplayServices_iface
);
5019 static HRESULT WINAPI
DisplayServices_QueryInterface(IDisplayServices
*iface
, REFIID riid
, void **ppvObject
)
5021 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5022 return IHTMLDOMNode_QueryInterface(&This
->node
.IHTMLDOMNode_iface
, riid
, ppvObject
);
5025 static ULONG WINAPI
DisplayServices_AddRef(IDisplayServices
*iface
)
5027 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5028 return IHTMLDOMNode_AddRef(&This
->node
.IHTMLDOMNode_iface
);
5031 static ULONG WINAPI
DisplayServices_Release(IDisplayServices
*iface
)
5033 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5034 return IHTMLDOMNode_Release(&This
->node
.IHTMLDOMNode_iface
);
5037 static HRESULT WINAPI
DisplayServices_CreateDisplayPointer(IDisplayServices
*iface
, IDisplayPointer
**ppDispPointer
)
5039 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5040 FIXME("(%p)->(%p)\n", This
, ppDispPointer
);
5044 static HRESULT WINAPI
DisplayServices_TransformRect(IDisplayServices
*iface
,
5045 RECT
*pRect
, COORD_SYSTEM eSource
, COORD_SYSTEM eDestination
, IHTMLElement
*pIElement
)
5047 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5048 FIXME("(%p)->(%s,%d,%d,%p)\n", This
, wine_dbgstr_rect(pRect
), eSource
, eDestination
, pIElement
);
5052 static HRESULT WINAPI
DisplayServices_TransformPoint(IDisplayServices
*iface
,
5053 POINT
*pPoint
, COORD_SYSTEM eSource
, COORD_SYSTEM eDestination
, IHTMLElement
*pIElement
)
5055 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5056 FIXME("(%p)->(%s,%d,%d,%p)\n", This
, wine_dbgstr_point(pPoint
), eSource
, eDestination
, pIElement
);
5060 static HRESULT WINAPI
DisplayServices_GetCaret(IDisplayServices
*iface
, IHTMLCaret
**ppCaret
)
5062 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5063 FIXME("(%p)->(%p)\n", This
, ppCaret
);
5067 static HRESULT WINAPI
DisplayServices_GetComputedStyle(IDisplayServices
*iface
,
5068 IMarkupPointer
*pPointer
, IHTMLComputedStyle
**ppComputedStyle
)
5070 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5071 FIXME("(%p)->(%p,%p)\n", This
, pPointer
, ppComputedStyle
);
5075 static HRESULT WINAPI
DisplayServices_ScrollRectIntoView(IDisplayServices
*iface
,
5076 IHTMLElement
*pIElement
, RECT rect
)
5078 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5079 FIXME("(%p)->(%p,%s)\n", This
, pIElement
, wine_dbgstr_rect(&rect
));
5083 static HRESULT WINAPI
DisplayServices_HasFlowLayout(IDisplayServices
*iface
,
5084 IHTMLElement
*pIElement
, BOOL
*pfHasFlowLayout
)
5086 HTMLDocumentNode
*This
= impl_from_IDisplayServices(iface
);
5087 FIXME("(%p)->(%p,%p)\n", This
, pIElement
, pfHasFlowLayout
);
5091 static const IDisplayServicesVtbl DisplayServicesVtbl
= {
5092 DisplayServices_QueryInterface
,
5093 DisplayServices_AddRef
,
5094 DisplayServices_Release
,
5095 DisplayServices_CreateDisplayPointer
,
5096 DisplayServices_TransformRect
,
5097 DisplayServices_TransformPoint
,
5098 DisplayServices_GetCaret
,
5099 DisplayServices_GetComputedStyle
,
5100 DisplayServices_ScrollRectIntoView
,
5101 DisplayServices_HasFlowLayout
5104 /**********************************************************
5105 * IDocumentRange implementation
5107 static inline HTMLDocumentNode
*impl_from_IDocumentRange(IDocumentRange
*iface
)
5109 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, IDocumentRange_iface
);
5112 DISPEX_IDISPATCH_IMPL(DocumentRange
, IDocumentRange
,
5113 impl_from_IDocumentRange(iface
)->node
.event_target
.dispex
)
5115 static HRESULT WINAPI
DocumentRange_createRange(IDocumentRange
*iface
, IHTMLDOMRange
**p
)
5117 HTMLDocumentNode
*This
= impl_from_IDocumentRange(iface
);
5118 nsIDOMRange
*nsrange
;
5121 TRACE("(%p)->(%p)\n", This
, p
);
5123 if(!This
->dom_document
) {
5124 WARN("NULL dom_document\n");
5125 return E_UNEXPECTED
;
5128 if(NS_FAILED(nsIDOMDocument_CreateRange(This
->dom_document
, &nsrange
)))
5131 hres
= create_dom_range(nsrange
, This
, p
);
5132 nsIDOMRange_Release(nsrange
);
5136 static const IDocumentRangeVtbl DocumentRangeVtbl
= {
5137 DocumentRange_QueryInterface
,
5138 DocumentRange_AddRef
,
5139 DocumentRange_Release
,
5140 DocumentRange_GetTypeInfoCount
,
5141 DocumentRange_GetTypeInfo
,
5142 DocumentRange_GetIDsOfNames
,
5143 DocumentRange_Invoke
,
5144 DocumentRange_createRange
5147 static cp_static_data_t HTMLDocumentNodeEvents_data
= { HTMLDocumentEvents_tid
, HTMLDocumentNode_on_advise
};
5148 static cp_static_data_t HTMLDocumentNodeEvents2_data
= { HTMLDocumentEvents2_tid
, HTMLDocumentNode_on_advise
, TRUE
};
5150 static const cpc_entry_t HTMLDocumentNode_cpc
[] = {
5151 {&IID_IDispatch
, &HTMLDocumentNodeEvents_data
},
5152 {&IID_IPropertyNotifySink
},
5153 {&DIID_HTMLDocumentEvents
, &HTMLDocumentNodeEvents_data
},
5154 {&DIID_HTMLDocumentEvents2
, &HTMLDocumentNodeEvents2_data
},
5158 static inline HTMLDocumentNode
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
5160 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
);
5163 void detach_document_node(HTMLDocumentNode
*doc
)
5167 while(!list_empty(&doc
->plugin_hosts
))
5168 detach_plugin_host(LIST_ENTRY(list_head(&doc
->plugin_hosts
), PluginHost
, entry
));
5170 if(doc
->dom_implementation
)
5171 detach_dom_implementation(doc
->dom_implementation
);
5173 unlink_ref(&doc
->dom_implementation
);
5174 unlink_ref(&doc
->namespaces
);
5176 detach_selection(doc
);
5179 for(i
=0; i
< doc
->elem_vars_cnt
; i
++)
5180 free(doc
->elem_vars
[i
]);
5181 free(doc
->elem_vars
);
5182 doc
->elem_vars_cnt
= doc
->elem_vars_size
= 0;
5183 doc
->elem_vars
= NULL
;
5185 unlink_ref(&doc
->catmgr
);
5187 list_remove(&doc
->browser_entry
);
5188 doc
->browser
= NULL
;
5192 static HRESULT
HTMLDocumentNode_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
5194 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
5195 FIXME("%p\n", This
);
5199 static const NodeImplVtbl HTMLDocumentNodeImplVtbl
= {
5200 .clsid
= &CLSID_HTMLDocument
,
5201 .cpc_entries
= HTMLDocumentNode_cpc
,
5202 .clone
= HTMLDocumentNode_clone
,
5205 static HRESULT
HTMLDocumentFragment_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
5207 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
5208 HTMLDocumentNode
*new_node
;
5211 hres
= create_document_fragment(nsnode
, This
->node
.doc
, &new_node
);
5215 *ret
= &new_node
->node
;
5219 static inline HTMLDocumentNode
*impl_from_DispatchEx(DispatchEx
*iface
)
5221 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
.event_target
.dispex
);
5224 static void *HTMLDocumentNode_query_interface(DispatchEx
*dispex
, REFIID riid
)
5226 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5228 if(IsEqualGUID(&IID_IHTMLDocument
, riid
) || IsEqualGUID(&IID_IHTMLDocument2
, riid
))
5229 return &This
->IHTMLDocument2_iface
;
5230 if(IsEqualGUID(&IID_IHTMLDocument3
, riid
))
5231 return &This
->IHTMLDocument3_iface
;
5232 if(IsEqualGUID(&IID_IHTMLDocument4
, riid
))
5233 return &This
->IHTMLDocument4_iface
;
5234 if(IsEqualGUID(&IID_IHTMLDocument5
, riid
))
5235 return &This
->IHTMLDocument5_iface
;
5236 if(IsEqualGUID(&IID_IHTMLDocument6
, riid
))
5237 return &This
->IHTMLDocument6_iface
;
5238 if(IsEqualGUID(&IID_IHTMLDocument7
, riid
))
5239 return &This
->IHTMLDocument7_iface
;
5240 if(IsEqualGUID(&IID_IDocumentSelector
, riid
))
5241 return &This
->IDocumentSelector_iface
;
5242 if(IsEqualGUID(&IID_IDocumentEvent
, riid
))
5243 return &This
->IDocumentEvent_iface
;
5244 if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
))
5245 return &This
->IHTMLDocument2_iface
;
5246 if(IsEqualGUID(&IID_ISupportErrorInfo
, riid
))
5247 return &This
->ISupportErrorInfo_iface
;
5248 if(IsEqualGUID(&IID_IProvideClassInfo
, riid
))
5249 return &This
->IProvideMultipleClassInfo_iface
;
5250 if(IsEqualGUID(&IID_IProvideClassInfo2
, riid
))
5251 return &This
->IProvideMultipleClassInfo_iface
;
5252 if(IsEqualGUID(&IID_IProvideMultipleClassInfo
, riid
))
5253 return &This
->IProvideMultipleClassInfo_iface
;
5254 if(IsEqualGUID(&IID_IMarkupServices
, riid
))
5255 return &This
->IMarkupServices_iface
;
5256 if(IsEqualGUID(&IID_IMarkupContainer
, riid
))
5257 return &This
->IMarkupContainer_iface
;
5258 if(IsEqualGUID(&IID_IDisplayServices
, riid
))
5259 return &This
->IDisplayServices_iface
;
5260 if(IsEqualGUID(&IID_IDocumentRange
, riid
))
5261 return &This
->IDocumentRange_iface
;
5262 if(IsEqualGUID(&IID_IPersist
, riid
))
5263 return &This
->IPersistFile_iface
;
5264 if(IsEqualGUID(&IID_IPersistMoniker
, riid
))
5265 return &This
->IPersistMoniker_iface
;
5266 if(IsEqualGUID(&IID_IPersistFile
, riid
))
5267 return &This
->IPersistFile_iface
;
5268 if(IsEqualGUID(&IID_IMonikerProp
, riid
))
5269 return &This
->IMonikerProp_iface
;
5270 if(IsEqualGUID(&IID_IPersistStreamInit
, riid
))
5271 return &This
->IPersistStreamInit_iface
;
5272 if(IsEqualGUID(&IID_IPersistHistory
, riid
))
5273 return &This
->IPersistHistory_iface
;
5274 if(IsEqualGUID(&IID_IHlinkTarget
, riid
))
5275 return &This
->IHlinkTarget_iface
;
5276 if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
5277 return &This
->IOleCommandTarget_iface
;
5278 if(IsEqualGUID(&IID_IOleObject
, riid
))
5279 return &This
->IOleObject_iface
;
5280 if(IsEqualGUID(&IID_IOleDocument
, riid
))
5281 return &This
->IOleDocument_iface
;
5282 if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
))
5283 return &This
->IOleInPlaceActiveObject_iface
;
5284 if(IsEqualGUID(&IID_IOleWindow
, riid
))
5285 return &This
->IOleInPlaceActiveObject_iface
;
5286 if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
))
5287 return &This
->IOleInPlaceObjectWindowless_iface
;
5288 if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
))
5289 return &This
->IOleInPlaceObjectWindowless_iface
;
5290 if(IsEqualGUID(&IID_IOleControl
, riid
))
5291 return &This
->IOleControl_iface
;
5292 if(IsEqualGUID(&IID_IObjectWithSite
, riid
))
5293 return &This
->IObjectWithSite_iface
;
5294 if(IsEqualGUID(&IID_IOleContainer
, riid
))
5295 return &This
->IOleContainer_iface
;
5296 if(IsEqualGUID(&IID_IObjectSafety
, riid
))
5297 return &This
->IObjectSafety_iface
;
5298 if(IsEqualGUID(&IID_IServiceProvider
, riid
))
5299 return &This
->IServiceProvider_iface
;
5300 if(IsEqualGUID(&IID_IInternetHostSecurityManager
, riid
))
5301 return &This
->IInternetHostSecurityManager_iface
;
5302 if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
))
5303 return &This
->cp_container
.IConnectionPointContainer_iface
;
5304 if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
5305 FIXME("(%p)->(CLSID_CMarkup)\n", This
);
5307 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
5309 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
5311 }else if(IsEqualGUID(&IID_IExternalConnection
, riid
)) {
5313 }else if(IsEqualGUID(&IID_IStdMarshalInfo
, riid
)) {
5317 return HTMLDOMNode_query_interface(&This
->node
.event_target
.dispex
, riid
);
5320 static void HTMLDocumentNode_traverse(DispatchEx
*dispex
, nsCycleCollectionTraversalCallback
*cb
)
5322 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5323 HTMLDOMNode_traverse(dispex
, cb
);
5326 note_cc_edge((nsISupports
*)&This
->window
->base
.IHTMLWindow2_iface
, "window", cb
);
5327 if(This
->dom_implementation
)
5328 note_cc_edge((nsISupports
*)This
->dom_implementation
, "dom_implementation", cb
);
5329 if(This
->namespaces
)
5330 note_cc_edge((nsISupports
*)This
->namespaces
, "namespaces", cb
);
5333 static void HTMLDocumentNode_unlink(DispatchEx
*dispex
)
5335 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5336 HTMLInnerWindow
*window
= This
->window
;
5337 HTMLDOMNode_unlink(dispex
);
5339 if(This
->script_global
) {
5340 list_remove(&This
->script_global_entry
);
5341 This
->script_global
= NULL
;
5344 This
->window
= NULL
;
5345 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
5348 if(This
->dom_document
) {
5349 release_document_mutation(This
);
5350 detach_document_node(This
);
5351 This
->dom_document
= NULL
;
5352 This
->html_document
= NULL
;
5354 detach_document_node(This
);
5358 static void HTMLDocumentNode_destructor(DispatchEx
*dispex
)
5360 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5362 free(This
->event_vector
);
5363 ConnectionPointContainer_Destroy(&This
->cp_container
);
5364 HTMLDOMNode_destructor(&This
->node
.event_target
.dispex
);
5367 static HRESULT
HTMLDocumentNode_get_name(DispatchEx
*dispex
, DISPID id
, BSTR
*name
)
5369 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5370 DWORD idx
= id
- MSHTML_DISPID_CUSTOM_MIN
;
5372 if(!This
->dom_document
|| idx
>= This
->elem_vars_cnt
)
5373 return DISP_E_MEMBERNOTFOUND
;
5375 return (*name
= SysAllocString(This
->elem_vars
[idx
])) ? S_OK
: E_OUTOFMEMORY
;
5378 static HRESULT
HTMLDocumentNode_get_dispid(DispatchEx
*dispex
, const WCHAR
*name
, DWORD grfdex
, DISPID
*dispid
)
5380 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5381 HRESULT hres
= DISP_E_UNKNOWNNAME
;
5383 if(This
->html_document
&& dispex_compat_mode(&This
->node
.event_target
.dispex
) < COMPAT_MODE_IE9
) {
5384 hres
= get_elem_by_name_or_id(This
->html_document
, name
, NULL
);
5386 hres
= dispid_from_elem_name(This
, name
, dispid
);
5392 static HRESULT
HTMLDocumentNode_find_dispid(DispatchEx
*dispex
, const WCHAR
*name
, DWORD grfdex
, DISPID
*dispid
)
5394 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5395 HRESULT hres
= DISP_E_UNKNOWNNAME
;
5397 if(This
->html_document
&& dispex_compat_mode(&This
->node
.event_target
.dispex
) >= COMPAT_MODE_IE9
) {
5398 hres
= get_elem_by_name_or_id(This
->html_document
, name
, NULL
);
5400 hres
= dispid_from_elem_name(This
, name
, dispid
);
5406 static HRESULT
HTMLDocumentNode_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
5407 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
5409 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5410 nsIDOMElement
*nselem
;
5415 if(flags
!= DISPATCH_PROPERTYGET
&& flags
!= (DISPATCH_METHOD
|DISPATCH_PROPERTYGET
))
5416 return MSHTML_E_INVALID_PROPERTY
;
5418 i
= id
- MSHTML_DISPID_CUSTOM_MIN
;
5420 if(!This
->html_document
|| i
>= This
->elem_vars_cnt
)
5421 return DISP_E_MEMBERNOTFOUND
;
5423 hres
= get_elem_by_name_or_id(This
->html_document
, This
->elem_vars
[i
], &nselem
);
5427 return DISP_E_MEMBERNOTFOUND
;
5429 hres
= get_node((nsIDOMNode
*)nselem
, TRUE
, &node
);
5430 nsIDOMElement_Release(nselem
);
5434 V_VT(res
) = VT_DISPATCH
;
5435 V_DISPATCH(res
) = (IDispatch
*)&node
->IHTMLDOMNode_iface
;
5439 static HRESULT
HTMLDocumentNode_disp_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
5440 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
5442 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5446 case DISPID_READYSTATE
:
5447 TRACE("DISPID_READYSTATE\n");
5449 if(!(flags
& DISPATCH_PROPERTYGET
))
5450 return E_INVALIDARG
;
5453 V_I4(res
) = This
->window
->base
.outer_window
->readystate
;
5463 static HRESULT
HTMLDocumentNode_next_dispid(DispatchEx
*dispex
, DISPID id
, DISPID
*pid
)
5465 DWORD idx
= (id
== DISPID_STARTENUM
) ? 0 : id
- MSHTML_DISPID_CUSTOM_MIN
+ 1;
5466 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5467 nsIDOMNodeList
*node_list
= NULL
;
5468 const PRUnichar
*name
;
5469 nsIDOMElement
*nselem
;
5476 if(!This
->html_document
)
5479 while(idx
< This
->elem_vars_cnt
) {
5480 hres
= has_elem_name(This
->html_document
, This
->elem_vars
[idx
]);
5481 if(SUCCEEDED(hres
)) {
5482 *pid
= idx
+ MSHTML_DISPID_CUSTOM_MIN
;
5485 if(hres
!= DISP_E_UNKNOWNNAME
)
5490 /* Populate possibly missing DISPIDs */
5491 nsAString_InitDepend(&nsstr
, L
":-moz-any(applet,embed,form,iframe,img,object)[name]");
5492 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->html_document
, &nsstr
, &node_list
);
5493 nsAString_Finish(&nsstr
);
5494 if(NS_FAILED(nsres
)) {
5496 nsIDOMNodeList_Release(node_list
);
5497 return map_nsresult(nsres
);
5500 for(i
= 0, hres
= S_OK
; SUCCEEDED(hres
); i
++) {
5501 nsres
= nsIDOMNodeList_Item(node_list
, i
, &nsnode
);
5502 if(NS_FAILED(nsres
)) {
5503 hres
= map_nsresult(nsres
);
5509 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMElement
, (void**)&nselem
);
5510 nsIDOMNode_Release(nsnode
);
5514 nsres
= get_elem_attr_value(nselem
, L
"name", &nsstr
, &name
);
5515 nsIDOMElement_Release(nselem
);
5516 if(NS_FAILED(nsres
))
5517 hres
= map_nsresult(nsres
);
5519 hres
= dispid_from_elem_name(This
, name
, &id
);
5520 nsAString_Finish(&nsstr
);
5523 nsIDOMNodeList_Release(node_list
);
5527 if(idx
>= This
->elem_vars_cnt
)
5530 *pid
= idx
+ MSHTML_DISPID_CUSTOM_MIN
;
5534 static compat_mode_t
HTMLDocumentNode_get_compat_mode(DispatchEx
*dispex
)
5536 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5538 TRACE("(%p) returning %u\n", This
, This
->document_mode
);
5540 return lock_document_mode(This
);
5543 static nsISupports
*HTMLDocumentNode_get_gecko_target(DispatchEx
*dispex
)
5545 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5546 return (nsISupports
*)This
->node
.nsnode
;
5549 static void HTMLDocumentNode_bind_event(DispatchEx
*dispex
, eventid_t eid
)
5551 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5552 ensure_doc_nsevent_handler(This
, This
->node
.nsnode
, eid
);
5555 static EventTarget
*HTMLDocumentNode_get_parent_event_target(DispatchEx
*dispex
)
5557 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5560 IHTMLWindow2_AddRef(&This
->window
->base
.IHTMLWindow2_iface
);
5561 return &This
->window
->event_target
;
5564 static ConnectionPointContainer
*HTMLDocumentNode_get_cp_container(DispatchEx
*dispex
)
5566 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5567 ConnectionPointContainer
*container
= This
->doc_obj
5568 ? &This
->doc_obj
->cp_container
: &This
->cp_container
;
5569 IConnectionPointContainer_AddRef(&container
->IConnectionPointContainer_iface
);
5573 static IHTMLEventObj
*HTMLDocumentNode_set_current_event(DispatchEx
*dispex
, IHTMLEventObj
*event
)
5575 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5576 return default_set_current_event(This
->window
, event
);
5579 static HRESULT
HTMLDocumentNode_location_hook(DispatchEx
*dispex
, WORD flags
, DISPPARAMS
*dp
, VARIANT
*res
,
5580 EXCEPINFO
*ei
, IServiceProvider
*caller
)
5582 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5584 if(!(flags
& DISPATCH_PROPERTYPUT
) || !This
->window
)
5586 if(!This
->window
->base
.outer_window
)
5589 return IWineJSDispatchHost_InvokeEx(&This
->window
->event_target
.dispex
.IWineJSDispatchHost_iface
,
5590 DISPID_IHTMLWINDOW2_LOCATION
, 0, flags
, dp
, res
, ei
, caller
);
5593 static HRESULT
HTMLDocumentNode_pre_handle_event(DispatchEx
* dispex
, DOMEvent
*event
)
5595 HTMLDocumentNode
*doc
= impl_from_DispatchEx(dispex
);
5596 switch(event
->event_id
) {
5597 case EVENTID_DOMCONTENTLOADED
: {
5598 if(event
->trusted
&& doc
->window
)
5599 doc
->window
->dom_content_loaded_event_start_time
= get_time_stamp();
5609 static HRESULT
HTMLDocumentNode_handle_event(DispatchEx
* dispex
, DOMEvent
*event
, BOOL
*prevent_default
)
5611 HTMLDocumentNode
*doc
= impl_from_DispatchEx(dispex
);
5612 switch(event
->event_id
) {
5613 case EVENTID_DOMCONTENTLOADED
: {
5614 if(event
->trusted
&& doc
->window
)
5615 doc
->window
->dom_content_loaded_event_end_time
= get_time_stamp();
5625 static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl
= {
5627 .query_interface
= HTMLDocumentNode_query_interface
,
5628 .destructor
= HTMLDocumentNode_destructor
,
5629 .traverse
= HTMLDocumentNode_traverse
,
5630 .unlink
= HTMLDocumentNode_unlink
,
5631 .get_name
= HTMLDocumentNode_get_name
,
5632 .get_dispid
= HTMLDocumentNode_get_dispid
,
5633 .find_dispid
= HTMLDocumentNode_find_dispid
,
5634 .invoke
= HTMLDocumentNode_invoke
,
5635 .disp_invoke
= HTMLDocumentNode_disp_invoke
,
5636 .next_dispid
= HTMLDocumentNode_next_dispid
,
5637 .get_compat_mode
= HTMLDocumentNode_get_compat_mode
,
5639 .get_gecko_target
= HTMLDocumentNode_get_gecko_target
,
5640 .bind_event
= HTMLDocumentNode_bind_event
,
5641 .get_parent_event_target
= HTMLDocumentNode_get_parent_event_target
,
5642 .pre_handle_event
= HTMLDocumentNode_pre_handle_event
,
5643 .handle_event
= HTMLDocumentNode_handle_event
,
5644 .get_cp_container
= HTMLDocumentNode_get_cp_container
,
5645 .set_current_event
= HTMLDocumentNode_set_current_event
,
5648 static const NodeImplVtbl HTMLDocumentFragmentImplVtbl
= {
5649 .clsid
= &CLSID_HTMLDocument
,
5650 .cpc_entries
= HTMLDocumentNode_cpc
,
5651 .clone
= HTMLDocumentFragment_clone
,
5654 static const tid_t HTMLDocumentNode_iface_tids
[] = {
5659 IDocumentSelector_tid
,
5663 static void HTMLDocumentNode_init_dispex_info(dispex_data_t
*info
, compat_mode_t mode
)
5665 static const dispex_hook_t document2_hooks
[] = {
5666 {DISPID_IHTMLDOCUMENT2_URL
, NULL
, L
"URL"},
5667 {DISPID_IHTMLDOCUMENT2_LOCATION
, HTMLDocumentNode_location_hook
},
5670 static const dispex_hook_t document2_ie11_hooks
[] = {
5671 {DISPID_IHTMLDOCUMENT2_URL
, NULL
, L
"URL"},
5672 {DISPID_IHTMLDOCUMENT2_LOCATION
, HTMLDocumentNode_location_hook
},
5673 {DISPID_IHTMLDOCUMENT2_CREATESTYLESHEET
, NULL
},
5674 {DISPID_IHTMLDOCUMENT2_FILESIZE
, NULL
},
5675 {DISPID_IHTMLDOCUMENT2_SELECTION
, NULL
},
5678 static const dispex_hook_t document3_ie11_hooks
[] = {
5679 {DISPID_IHTMLDOCUMENT3_ATTACHEVENT
, NULL
},
5680 {DISPID_IHTMLDOCUMENT3_DETACHEVENT
, NULL
},
5683 static const dispex_hook_t document6_ie9_hooks
[] = {
5684 {DISPID_IHTMLDOCUMENT6_ONSTORAGE
},
5688 HTMLDOMNode_init_dispex_info(info
, mode
);
5690 if(mode
>= COMPAT_MODE_IE9
) {
5691 dispex_info_add_interface(info
, IHTMLDocument7_tid
, NULL
);
5692 dispex_info_add_interface(info
, IDocumentEvent_tid
, NULL
);
5695 /* Depending on compatibility version, we add interfaces in different order
5696 * so that the right getElementById implementation is used. */
5697 if(mode
< COMPAT_MODE_IE8
) {
5698 dispex_info_add_interface(info
, IHTMLDocument3_tid
, NULL
);
5699 dispex_info_add_interface(info
, IHTMLDocument6_tid
, NULL
);
5701 dispex_info_add_interface(info
, IHTMLDocument6_tid
, mode
>= COMPAT_MODE_IE9
? document6_ie9_hooks
: NULL
);
5702 dispex_info_add_interface(info
, IHTMLDocument3_tid
, mode
>= COMPAT_MODE_IE11
? document3_ie11_hooks
: NULL
);
5704 dispex_info_add_interface(info
, IHTMLDocument2_tid
, mode
>= COMPAT_MODE_IE11
? document2_ie11_hooks
: document2_hooks
);
5707 static dispex_static_data_t HTMLDocumentNode_dispex
= {
5709 &HTMLDocumentNode_event_target_vtbl
.dispex_vtbl
,
5710 DispHTMLDocument_tid
,
5711 HTMLDocumentNode_iface_tids
,
5712 HTMLDocumentNode_init_dispex_info
5715 static HTMLDocumentNode
*alloc_doc_node(HTMLDocumentObj
*doc_obj
, HTMLInnerWindow
*window
, HTMLInnerWindow
*script_global
)
5717 HTMLDocumentNode
*doc
;
5719 doc
= calloc(1, sizeof(HTMLDocumentNode
));
5723 doc
->IHTMLDocument2_iface
.lpVtbl
= &HTMLDocumentVtbl
;
5724 doc
->IHTMLDocument3_iface
.lpVtbl
= &HTMLDocument3Vtbl
;
5725 doc
->IHTMLDocument4_iface
.lpVtbl
= &HTMLDocument4Vtbl
;
5726 doc
->IHTMLDocument5_iface
.lpVtbl
= &HTMLDocument5Vtbl
;
5727 doc
->IHTMLDocument6_iface
.lpVtbl
= &HTMLDocument6Vtbl
;
5728 doc
->IHTMLDocument7_iface
.lpVtbl
= &HTMLDocument7Vtbl
;
5729 doc
->IDocumentSelector_iface
.lpVtbl
= &DocumentSelectorVtbl
;
5730 doc
->IDocumentEvent_iface
.lpVtbl
= &DocumentEventVtbl
;
5731 doc
->ISupportErrorInfo_iface
.lpVtbl
= &SupportErrorInfoVtbl
;
5732 doc
->IProvideMultipleClassInfo_iface
.lpVtbl
= &ProvideMultipleClassInfoVtbl
;
5733 doc
->IMarkupServices_iface
.lpVtbl
= &MarkupServicesVtbl
;
5734 doc
->IMarkupContainer_iface
.lpVtbl
= &MarkupContainerVtbl
;
5735 doc
->IDisplayServices_iface
.lpVtbl
= &DisplayServicesVtbl
;
5736 doc
->IDocumentRange_iface
.lpVtbl
= &DocumentRangeVtbl
;
5738 doc
->doc_obj
= doc_obj
;
5739 doc
->window
= window
;
5742 IHTMLWindow2_AddRef(&window
->base
.IHTMLWindow2_iface
);
5745 doc
->script_global
= script_global
;
5746 list_add_tail(&script_global
->documents
, &doc
->script_global_entry
);
5749 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)&doc
->IHTMLDocument2_iface
, HTMLDocumentNode_cpc
);
5750 HTMLDocumentNode_Persist_Init(doc
);
5751 HTMLDocumentNode_Service_Init(doc
);
5752 HTMLDocumentNode_OleCmd_Init(doc
);
5753 HTMLDocumentNode_OleObj_Init(doc
);
5754 HTMLDocumentNode_SecMgr_Init(doc
);
5756 list_init(&doc
->selection_list
);
5757 list_init(&doc
->range_list
);
5758 list_init(&doc
->plugin_hosts
);
5763 HRESULT
create_document_node(nsIDOMDocument
*nsdoc
, GeckoBrowser
*browser
, HTMLInnerWindow
*window
,
5764 HTMLInnerWindow
*script_global
, compat_mode_t parent_mode
, HTMLDocumentNode
**ret
)
5766 HTMLDocumentObj
*doc_obj
= browser
->doc
;
5767 HTMLDocumentNode
*doc
;
5769 doc
= alloc_doc_node(doc_obj
, window
, script_global
);
5771 return E_OUTOFMEMORY
;
5773 if(parent_mode
>= COMPAT_MODE_IE9
) {
5774 TRACE("using parent mode %u\n", parent_mode
);
5775 doc
->document_mode
= parent_mode
;
5776 lock_document_mode(doc
);
5779 if(doc_obj
&& (!doc_obj
->window
|| (window
&& is_main_content_window(window
->base
.outer_window
))))
5780 doc
->cp_container
.forward_container
= &doc_obj
->cp_container
;
5782 /* Share reference with HTMLDOMNode */
5783 if(NS_SUCCEEDED(nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMHTMLDocument
, (void**)&doc
->html_document
))) {
5784 doc
->dom_document
= (nsIDOMDocument
*)doc
->html_document
;
5785 nsIDOMHTMLDocument_Release(doc
->html_document
);
5787 doc
->dom_document
= nsdoc
;
5788 doc
->html_document
= NULL
;
5791 HTMLDOMNode_Init(doc
, &doc
->node
, (nsIDOMNode
*)doc
->dom_document
, &HTMLDocumentNode_dispex
);
5793 init_document_mutation(doc
);
5794 doc_init_events(doc
);
5796 doc
->node
.vtbl
= &HTMLDocumentNodeImplVtbl
;
5798 list_add_head(&browser
->document_nodes
, &doc
->browser_entry
);
5799 doc
->browser
= browser
;
5801 if(browser
->usermode
== EDITMODE
&& doc
->html_document
) {
5805 nsAString_InitDepend(&mode_str
, L
"on");
5806 nsres
= nsIDOMHTMLDocument_SetDesignMode(doc
->html_document
, &mode_str
);
5807 nsAString_Finish(&mode_str
);
5808 if(NS_FAILED(nsres
))
5809 ERR("SetDesignMode failed: %08lx\n", nsres
);
5816 static HRESULT
create_document_fragment(nsIDOMNode
*nsnode
, HTMLDocumentNode
*doc_node
, HTMLDocumentNode
**ret
)
5818 HTMLDocumentNode
*doc_frag
;
5820 doc_frag
= alloc_doc_node(doc_node
->doc_obj
, doc_node
->window
, doc_node
->script_global
);
5822 return E_OUTOFMEMORY
;
5824 HTMLDOMNode_Init(doc_node
, &doc_frag
->node
, nsnode
, &HTMLDocumentNode_dispex
);
5825 doc_frag
->node
.vtbl
= &HTMLDocumentFragmentImplVtbl
;
5826 doc_frag
->document_mode
= lock_document_mode(doc_node
);
5832 HRESULT
get_document_node(nsIDOMDocument
*dom_document
, HTMLDocumentNode
**ret
)
5837 hres
= get_node((nsIDOMNode
*)dom_document
, FALSE
, &node
);
5842 ERR("document not initialized\n");
5846 assert(node
->vtbl
== &HTMLDocumentNodeImplVtbl
);
5847 *ret
= impl_from_HTMLDOMNode(node
);