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
36 #include "wine/debug.h"
38 #include "mshtml_private.h"
39 #include "htmlevent.h"
40 #include "pluginhost.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
45 static HRESULT
create_document_fragment(nsIDOMNode
*nsnode
, HTMLDocumentNode
*doc_node
, HTMLDocumentNode
**ret
);
47 HRESULT
get_doc_elem_by_id(HTMLDocumentNode
*doc
, const WCHAR
*id
, HTMLElement
**ret
)
49 nsIDOMNodeList
*nsnode_list
;
50 nsIDOMElement
*nselem
;
61 nsAString_InitDepend(&id_str
, id
);
62 /* get element by id attribute */
63 nsres
= nsIDOMHTMLDocument_GetElementById(doc
->nsdoc
, &id_str
, &nselem
);
65 ERR("GetElementById failed: %08x\n", nsres
);
66 nsAString_Finish(&id_str
);
70 /* get first element by name attribute */
71 nsres
= nsIDOMHTMLDocument_GetElementsByName(doc
->nsdoc
, &id_str
, &nsnode_list
);
72 nsAString_Finish(&id_str
);
74 ERR("getElementsByName failed: %08x\n", nsres
);
76 nsIDOMElement_Release(nselem
);
80 nsres
= nsIDOMNodeList_Item(nsnode_list
, 0, &nsnode
);
81 nsIDOMNodeList_Release(nsnode_list
);
82 assert(nsres
== NS_OK
);
84 if(nsnode
&& nselem
) {
87 nsres
= nsIDOMNode_CompareDocumentPosition(nsnode
, (nsIDOMNode
*)nselem
, &pos
);
88 if(NS_FAILED(nsres
)) {
89 FIXME("CompareDocumentPosition failed: 0x%08x\n", nsres
);
90 nsIDOMNode_Release(nsnode
);
91 nsIDOMElement_Release(nselem
);
95 TRACE("CompareDocumentPosition gave: 0x%x\n", pos
);
96 if(!(pos
& (DOCUMENT_POSITION_PRECEDING
| DOCUMENT_POSITION_CONTAINS
))) {
97 nsIDOMElement_Release(nselem
);
104 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMElement
, (void**)&nselem
);
105 assert(nsres
== NS_OK
);
107 nsIDOMNode_Release(nsnode
);
115 hres
= get_element(nselem
, ret
);
116 nsIDOMElement_Release(nselem
);
120 UINT
get_document_charset(HTMLDocumentNode
*doc
)
122 nsAString charset_str
;
129 nsAString_Init(&charset_str
, NULL
);
130 nsres
= nsIDOMHTMLDocument_GetCharacterSet(doc
->nsdoc
, &charset_str
);
131 if(NS_SUCCEEDED(nsres
)) {
132 const PRUnichar
*charset
;
134 nsAString_GetData(&charset_str
, &charset
);
137 BSTR str
= SysAllocString(charset
);
138 ret
= cp_from_charset_string(str
);
142 ERR("GetCharset failed: %08x\n", nsres
);
144 nsAString_Finish(&charset_str
);
149 return doc
->charset
= ret
;
152 static inline HTMLDocument
*impl_from_IHTMLDocument2(IHTMLDocument2
*iface
)
154 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument2_iface
);
157 static HRESULT WINAPI
HTMLDocument_QueryInterface(IHTMLDocument2
*iface
, REFIID riid
, void **ppv
)
159 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
161 return htmldoc_query_interface(This
, riid
, ppv
);
164 static ULONG WINAPI
HTMLDocument_AddRef(IHTMLDocument2
*iface
)
166 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
168 return htmldoc_addref(This
);
171 static ULONG WINAPI
HTMLDocument_Release(IHTMLDocument2
*iface
)
173 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
175 return htmldoc_release(This
);
178 static HRESULT WINAPI
HTMLDocument_GetTypeInfoCount(IHTMLDocument2
*iface
, UINT
*pctinfo
)
180 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
182 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
185 static HRESULT WINAPI
HTMLDocument_GetTypeInfo(IHTMLDocument2
*iface
, UINT iTInfo
,
186 LCID lcid
, ITypeInfo
**ppTInfo
)
188 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
190 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
193 static HRESULT WINAPI
HTMLDocument_GetIDsOfNames(IHTMLDocument2
*iface
, REFIID riid
,
194 LPOLESTR
*rgszNames
, UINT cNames
,
195 LCID lcid
, DISPID
*rgDispId
)
197 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
199 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
203 static HRESULT WINAPI
HTMLDocument_Invoke(IHTMLDocument2
*iface
, DISPID dispIdMember
,
204 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
205 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
207 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
209 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
210 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
213 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
215 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
217 TRACE("(%p)->(%p)\n", This
, p
);
219 *p
= (IDispatch
*)&This
->window
->base
.IHTMLWindow2_iface
;
220 IDispatch_AddRef(*p
);
224 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
226 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
227 nsIDOMElement
*nselem
= NULL
;
232 TRACE("(%p)->(%p)\n", This
, p
);
234 if(!This
->doc_node
->nsdoc
) {
235 WARN("NULL nsdoc\n");
239 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->doc_node
->nsdoc
, &nselem
);
240 if(NS_FAILED(nsres
)) {
241 ERR("GetDocumentElement failed: %08x\n", nsres
);
250 hres
= get_node((nsIDOMNode
*)nselem
, TRUE
, &node
);
251 nsIDOMElement_Release(nselem
);
255 *p
= create_all_collection(node
, TRUE
);
260 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
262 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
263 nsIDOMHTMLElement
*nsbody
= NULL
;
264 HTMLElement
*element
;
267 TRACE("(%p)->(%p)\n", This
, p
);
269 if(This
->doc_node
->nsdoc
) {
272 nsres
= nsIDOMHTMLDocument_GetBody(This
->doc_node
->nsdoc
, &nsbody
);
273 if(NS_FAILED(nsres
)) {
274 TRACE("Could not get body: %08x\n", nsres
);
284 hres
= get_element((nsIDOMElement
*)nsbody
, &element
);
285 nsIDOMHTMLElement_Release(nsbody
);
289 *p
= &element
->IHTMLElement_iface
;
293 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
295 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
296 nsIDOMElement
*nselem
;
301 TRACE("(%p)->(%p)\n", This
, p
);
303 if(!This
->doc_node
->nsdoc
) {
309 * NOTE: Gecko may return an active element even if the document is not visible.
310 * IE returns NULL in this case.
312 nsres
= nsIDOMHTMLDocument_GetActiveElement(This
->doc_node
->nsdoc
, &nselem
);
313 if(NS_FAILED(nsres
)) {
314 ERR("GetActiveElement failed: %08x\n", nsres
);
323 hres
= get_element(nselem
, &elem
);
324 nsIDOMElement_Release(nselem
);
328 *p
= &elem
->IHTMLElement_iface
;
332 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
334 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
335 nsIDOMHTMLCollection
*nscoll
= NULL
;
338 TRACE("(%p)->(%p)\n", This
, p
);
345 if(!This
->doc_node
->nsdoc
) {
346 WARN("NULL nsdoc\n");
350 nsres
= nsIDOMHTMLDocument_GetImages(This
->doc_node
->nsdoc
, &nscoll
);
351 if(NS_FAILED(nsres
)) {
352 ERR("GetImages failed: %08x\n", nsres
);
357 *p
= create_collection_from_htmlcol(nscoll
, This
->doc_node
->document_mode
);
358 nsIDOMHTMLCollection_Release(nscoll
);
364 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
366 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
367 nsIDOMHTMLCollection
*nscoll
= NULL
;
370 TRACE("(%p)->(%p)\n", This
, p
);
377 if(!This
->doc_node
->nsdoc
) {
378 WARN("NULL nsdoc\n");
382 nsres
= nsIDOMHTMLDocument_GetApplets(This
->doc_node
->nsdoc
, &nscoll
);
383 if(NS_FAILED(nsres
)) {
384 ERR("GetApplets failed: %08x\n", nsres
);
389 *p
= create_collection_from_htmlcol(nscoll
, This
->doc_node
->document_mode
);
390 nsIDOMHTMLCollection_Release(nscoll
);
396 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
398 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
399 nsIDOMHTMLCollection
*nscoll
= NULL
;
402 TRACE("(%p)->(%p)\n", This
, p
);
409 if(!This
->doc_node
->nsdoc
) {
410 WARN("NULL nsdoc\n");
414 nsres
= nsIDOMHTMLDocument_GetLinks(This
->doc_node
->nsdoc
, &nscoll
);
415 if(NS_FAILED(nsres
)) {
416 ERR("GetLinks failed: %08x\n", nsres
);
421 *p
= create_collection_from_htmlcol(nscoll
, This
->doc_node
->document_mode
);
422 nsIDOMHTMLCollection_Release(nscoll
);
428 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
430 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
431 nsIDOMHTMLCollection
*nscoll
= NULL
;
434 TRACE("(%p)->(%p)\n", This
, p
);
441 if(!This
->doc_node
->nsdoc
) {
442 WARN("NULL nsdoc\n");
446 nsres
= nsIDOMHTMLDocument_GetForms(This
->doc_node
->nsdoc
, &nscoll
);
447 if(NS_FAILED(nsres
)) {
448 ERR("GetForms failed: %08x\n", nsres
);
453 *p
= create_collection_from_htmlcol(nscoll
, This
->doc_node
->document_mode
);
454 nsIDOMHTMLCollection_Release(nscoll
);
460 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
462 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
463 nsIDOMHTMLCollection
*nscoll
= NULL
;
466 TRACE("(%p)->(%p)\n", This
, p
);
473 if(!This
->doc_node
->nsdoc
) {
474 WARN("NULL nsdoc\n");
478 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->doc_node
->nsdoc
, &nscoll
);
479 if(NS_FAILED(nsres
)) {
480 ERR("GetAnchors failed: %08x\n", nsres
);
485 *p
= create_collection_from_htmlcol(nscoll
, This
->doc_node
->document_mode
);
486 nsIDOMHTMLCollection_Release(nscoll
);
492 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
494 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
498 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
500 if(!This
->doc_node
->nsdoc
) {
501 WARN("NULL nsdoc\n");
505 nsAString_InitDepend(&nsstr
, v
);
506 nsres
= nsIDOMHTMLDocument_SetTitle(This
->doc_node
->nsdoc
, &nsstr
);
507 nsAString_Finish(&nsstr
);
509 ERR("SetTitle failed: %08x\n", nsres
);
514 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
516 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
517 const PRUnichar
*ret
;
521 TRACE("(%p)->(%p)\n", This
, p
);
523 if(!This
->doc_node
->nsdoc
) {
524 WARN("NULL nsdoc\n");
529 nsAString_Init(&nsstr
, NULL
);
530 nsres
= nsIDOMHTMLDocument_GetTitle(This
->doc_node
->nsdoc
, &nsstr
);
531 if (NS_SUCCEEDED(nsres
)) {
532 nsAString_GetData(&nsstr
, &ret
);
533 *p
= SysAllocString(ret
);
535 nsAString_Finish(&nsstr
);
537 if(NS_FAILED(nsres
)) {
538 ERR("GetTitle failed: %08x\n", nsres
);
545 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
547 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
548 nsIDOMHTMLCollection
*nscoll
= NULL
;
551 TRACE("(%p)->(%p)\n", This
, p
);
558 if(!This
->doc_node
->nsdoc
) {
559 WARN("NULL nsdoc\n");
563 nsres
= nsIDOMHTMLDocument_GetScripts(This
->doc_node
->nsdoc
, &nscoll
);
564 if(NS_FAILED(nsres
)) {
565 ERR("GetImages failed: %08x\n", nsres
);
570 *p
= create_collection_from_htmlcol(nscoll
, This
->doc_node
->document_mode
);
571 nsIDOMHTMLCollection_Release(nscoll
);
577 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
579 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
582 static const WCHAR onW
[] = {'o','n',0};
584 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
586 if(strcmpiW(v
, onW
)) {
587 FIXME("Unsupported arg %s\n", debugstr_w(v
));
591 hres
= setup_edit_mode(This
->doc_obj
);
595 call_property_onchanged(&This
->cp_container
, DISPID_IHTMLDOCUMENT2_DESIGNMODE
);
599 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
601 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
602 static const WCHAR szOff
[] = {'O','f','f',0};
603 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
608 *p
= SysAllocString(szOff
);
613 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
615 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
616 nsISelection
*nsselection
;
619 TRACE("(%p)->(%p)\n", This
, p
);
621 nsres
= nsIDOMWindow_GetSelection(This
->window
->nswindow
, &nsselection
);
622 if(NS_FAILED(nsres
)) {
623 ERR("GetSelection failed: %08x\n", nsres
);
627 return HTMLSelectionObject_Create(This
->doc_node
, nsselection
, p
);
630 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
632 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
635 TRACE("(%p)->(%p)\n", iface
, p
);
640 return get_readystate_string(This
->window
->readystate
, p
);
643 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
645 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
647 TRACE("(%p)->(%p)\n", This
, p
);
649 return IHTMLWindow2_get_frames(&This
->window
->base
.IHTMLWindow2_iface
, p
);
652 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
654 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
655 FIXME("(%p)->(%p)\n", This
, p
);
659 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
661 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
662 FIXME("(%p)->(%p)\n", This
, p
);
666 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
668 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
669 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
673 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
675 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
676 FIXME("(%p)->(%p)\n", This
, p
);
680 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
682 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
683 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
687 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
689 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
690 FIXME("(%p)->(%p)\n", This
, p
);
694 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
696 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
697 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
701 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
703 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
704 FIXME("(%p)->(%p)\n", This
, p
);
708 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
710 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
711 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
715 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
717 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
718 FIXME("(%p)->(%p)\n", This
, p
);
722 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
724 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
725 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
729 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
731 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
732 FIXME("(%p)->(%p)\n", This
, p
);
736 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
738 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
740 FIXME("(%p)->(%p)\n", This
, p
);
746 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
748 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
750 TRACE("(%p)->(%p)\n", This
, p
);
752 if(!This
->doc_node
->nsdoc
) {
753 WARN("NULL nsdoc\n");
757 return IHTMLWindow2_get_location(&This
->window
->base
.IHTMLWindow2_iface
, p
);
760 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
762 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
763 FIXME("(%p)->(%p)\n", This
, p
);
767 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
769 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
771 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
774 FIXME("No window available\n");
778 return navigate_url(This
->window
, v
, This
->window
->uri
, BINDING_NAVIGATED
);
781 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
783 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
785 static const WCHAR about_blank_url
[] =
786 {'a','b','o','u','t',':','b','l','a','n','k',0};
788 TRACE("(%p)->(%p)\n", iface
, p
);
790 *p
= SysAllocString(This
->window
->url
? This
->window
->url
: about_blank_url
);
791 return *p
? S_OK
: E_OUTOFMEMORY
;
794 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
796 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
800 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
802 nsAString_InitDepend(&nsstr
, v
);
803 nsres
= nsIDOMHTMLDocument_SetDomain(This
->doc_node
->nsdoc
, &nsstr
);
804 nsAString_Finish(&nsstr
);
805 if(NS_FAILED(nsres
)) {
806 ERR("SetDomain failed: %08x\n", nsres
);
813 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
815 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
819 TRACE("(%p)->(%p)\n", This
, p
);
821 nsAString_Init(&nsstr
, NULL
);
822 nsres
= nsIDOMHTMLDocument_GetDomain(This
->doc_node
->nsdoc
, &nsstr
);
823 if(NS_SUCCEEDED(nsres
) && This
->window
&& This
->window
->uri
) {
824 const PRUnichar
*str
;
827 nsAString_GetData(&nsstr
, &str
);
829 TRACE("Gecko returned empty string, fallback to loaded URL.\n");
830 nsAString_Finish(&nsstr
);
831 hres
= IUri_GetHost(This
->window
->uri
, p
);
832 return FAILED(hres
) ? hres
: S_OK
;
836 return return_nsstr(nsres
, &nsstr
, p
);
839 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
841 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
844 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
846 bret
= InternetSetCookieExW(This
->window
->url
, NULL
, v
, 0, 0);
848 FIXME("InternetSetCookieExW failed: %u\n", GetLastError());
849 return HRESULT_FROM_WIN32(GetLastError());
855 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
857 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
861 TRACE("(%p)->(%p)\n", This
, p
);
864 bret
= InternetGetCookieExW(This
->window
->url
, NULL
, NULL
, &size
, 0, NULL
);
866 switch(GetLastError()) {
867 case ERROR_INSUFFICIENT_BUFFER
:
869 case ERROR_NO_MORE_ITEMS
:
873 FIXME("InternetGetCookieExW failed: %u\n", GetLastError());
874 return HRESULT_FROM_WIN32(GetLastError());
883 *p
= SysAllocStringLen(NULL
, size
/sizeof(WCHAR
)-1);
885 return E_OUTOFMEMORY
;
887 bret
= InternetGetCookieExW(This
->window
->url
, NULL
, *p
, &size
, 0, NULL
);
889 ERR("InternetGetCookieExW failed: %u\n", GetLastError());
896 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
898 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
899 FIXME("(%p)->(%x)\n", This
, v
);
903 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
905 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
906 FIXME("(%p)->(%p)\n", This
, p
);
910 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
912 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
913 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
917 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
919 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
921 TRACE("(%p)->(%p)\n", This
, p
);
923 return IHTMLDocument7_get_characterSet(&This
->IHTMLDocument7_iface
, p
);
926 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
928 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
929 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
933 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
935 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
937 TRACE("(%p)->(%p)\n", This
, p
);
939 *p
= charset_string_from_cp(GetACP());
940 return *p
? S_OK
: E_OUTOFMEMORY
;
943 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
945 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
946 FIXME("(%p)->(%p)\n", This
, p
);
950 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
952 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
953 FIXME("(%p)->(%p)\n", This
, p
);
957 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
959 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
960 FIXME("(%p)->(%p)\n", This
, p
);
964 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
966 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
967 FIXME("(%p)->(%p)\n", This
, p
);
971 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
973 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
974 FIXME("(%p)->(%p)\n", This
, p
);
978 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
980 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
981 FIXME("(%p)->(%p)\n", This
, p
);
985 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
987 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
988 FIXME("(%p)->(%p)\n", This
, p
);
992 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
994 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
995 FIXME("(%p)->(%p)\n", This
, p
);
999 static HRESULT
document_write(HTMLDocument
*This
, SAFEARRAY
*psarray
, BOOL ln
)
1008 if(!This
->doc_node
->nsdoc
) {
1009 WARN("NULL nsdoc\n");
1010 return E_UNEXPECTED
;
1016 if(psarray
->cDims
!= 1) {
1017 FIXME("cDims=%d\n", psarray
->cDims
);
1018 return E_INVALIDARG
;
1021 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
1023 WARN("SafeArrayAccessData failed: %08x\n", hres
);
1027 V_VT(&tmp
) = VT_EMPTY
;
1029 jsctx
= get_context_from_document(This
->doc_node
->nsdoc
);
1030 argc
= psarray
->rgsabound
[0].cElements
;
1031 for(i
=0; i
< argc
; i
++) {
1032 if(V_VT(var
+i
) == VT_BSTR
) {
1033 nsAString_InitDepend(&nsstr
, V_BSTR(var
+i
));
1035 hres
= VariantChangeTypeEx(&tmp
, var
+i
, MAKELCID(MAKELANGID(LANG_ENGLISH
,SUBLANG_ENGLISH_US
),SORT_DEFAULT
), 0, VT_BSTR
);
1037 WARN("Could not convert %s to string\n", debugstr_variant(var
+i
));
1040 nsAString_InitDepend(&nsstr
, V_BSTR(&tmp
));
1043 if(!ln
|| i
!= argc
-1)
1044 nsres
= nsIDOMHTMLDocument_Write(This
->doc_node
->nsdoc
, &nsstr
, jsctx
);
1046 nsres
= nsIDOMHTMLDocument_Writeln(This
->doc_node
->nsdoc
, &nsstr
, jsctx
);
1047 nsAString_Finish(&nsstr
);
1048 if(V_VT(var
+i
) != VT_BSTR
)
1050 if(NS_FAILED(nsres
)) {
1051 ERR("Write failed: %08x\n", nsres
);
1057 SafeArrayUnaccessData(psarray
);
1062 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
1064 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1066 TRACE("(%p)->(%p)\n", iface
, psarray
);
1068 return document_write(This
, psarray
, FALSE
);
1071 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
1073 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1075 TRACE("(%p)->(%p)\n", This
, psarray
);
1077 return document_write(This
, psarray
, TRUE
);
1080 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
1081 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
1083 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1087 static const WCHAR text_htmlW
[] = {'t','e','x','t','/','h','t','m','l',0};
1089 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
1090 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
1092 if(!This
->doc_node
->nsdoc
) {
1097 if(!url
|| strcmpW(url
, text_htmlW
) || V_VT(&name
) != VT_ERROR
1098 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
1099 FIXME("unsupported args\n");
1101 nsres
= nsIDOMHTMLDocument_Open(This
->doc_node
->nsdoc
, NULL
, NULL
, NULL
,
1102 get_context_from_document(This
->doc_node
->nsdoc
), 0, &tmp
);
1103 if(NS_FAILED(nsres
)) {
1104 ERR("Open failed: %08x\n", nsres
);
1109 nsISupports_Release(tmp
);
1111 *pomWindowResult
= (IDispatch
*)&This
->window
->base
.IHTMLWindow2_iface
;
1112 IHTMLWindow2_AddRef(&This
->window
->base
.IHTMLWindow2_iface
);
1116 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
1118 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1121 TRACE("(%p)\n", This
);
1123 if(!This
->doc_node
->nsdoc
) {
1128 nsres
= nsIDOMHTMLDocument_Close(This
->doc_node
->nsdoc
);
1129 if(NS_FAILED(nsres
)) {
1130 ERR("Close failed: %08x\n", nsres
);
1137 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
1139 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1142 TRACE("(%p)\n", This
);
1144 nsres
= nsIDOMHTMLDocument_Clear(This
->doc_node
->nsdoc
);
1145 if(NS_FAILED(nsres
)) {
1146 ERR("Clear failed: %08x\n", nsres
);
1153 static const WCHAR copyW
[] =
1154 {'c','o','p','y',0};
1155 static const WCHAR cutW
[] =
1157 static const WCHAR fontnameW
[] =
1158 {'f','o','n','t','n','a','m','e',0};
1159 static const WCHAR fontsizeW
[] =
1160 {'f','o','n','t','s','i','z','e',0};
1161 static const WCHAR indentW
[] =
1162 {'i','n','d','e','n','t',0};
1163 static const WCHAR insertorderedlistW
[] =
1164 {'i','n','s','e','r','t','o','r','d','e','r','e','d','l','i','s','t',0};
1165 static const WCHAR insertunorderedlistW
[] =
1166 {'i','n','s','e','r','t','u','n','o','r','d','e','r','e','d','l','i','s','t',0};
1167 static const WCHAR outdentW
[] =
1168 {'o','u','t','d','e','n','t',0};
1169 static const WCHAR pasteW
[] =
1170 {'p','a','s','t','e',0};
1171 static const WCHAR respectvisibilityindesignW
[] =
1172 {'r','e','s','p','e','c','t','v','i','s','i','b','i','l','i','t','y','i','n','d','e','s','i','g','n',0};
1174 static const struct {
1177 }command_names
[] = {
1180 {fontnameW
, IDM_FONTNAME
},
1181 {fontsizeW
, IDM_FONTSIZE
},
1182 {indentW
, IDM_INDENT
},
1183 {insertorderedlistW
, IDM_ORDERLIST
},
1184 {insertunorderedlistW
, IDM_UNORDERLIST
},
1185 {outdentW
, IDM_OUTDENT
},
1186 {pasteW
, IDM_PASTE
},
1187 {respectvisibilityindesignW
, IDM_RESPECTVISIBILITY_INDESIGN
}
1190 static BOOL
cmdid_from_string(const WCHAR
*str
, OLECMDID
*cmdid
)
1194 for(i
= 0; i
< ARRAY_SIZE(command_names
); i
++) {
1195 if(!strcmpiW(command_names
[i
].name
, str
)) {
1196 *cmdid
= command_names
[i
].id
;
1201 FIXME("Unknown command %s\n", debugstr_w(str
));
1205 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
1206 VARIANT_BOOL
*pfRet
)
1208 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1209 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1213 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
1214 VARIANT_BOOL
*pfRet
)
1216 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1217 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1221 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
1222 VARIANT_BOOL
*pfRet
)
1224 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1225 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1229 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
1230 VARIANT_BOOL
*pfRet
)
1232 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1233 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1237 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
1240 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1241 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1245 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
1248 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1249 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1253 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
1254 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
1256 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1261 TRACE("(%p)->(%s %x %s %p)\n", This
, debugstr_w(cmdID
), showUI
, debugstr_variant(&value
), pfRet
);
1263 if(!cmdid_from_string(cmdID
, &cmdid
))
1264 return OLECMDERR_E_NOTSUPPORTED
;
1266 V_VT(&ret
) = VT_EMPTY
;
1267 hres
= IOleCommandTarget_Exec(&This
->IOleCommandTarget_iface
, &CGID_MSHTML
, cmdid
,
1268 showUI
? 0 : OLECMDEXECOPT_DONTPROMPTUSER
, &value
, &ret
);
1272 if(V_VT(&ret
) != VT_EMPTY
) {
1273 FIXME("Handle ret %s\n", debugstr_variant(&ret
));
1277 *pfRet
= VARIANT_TRUE
;
1281 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
1282 VARIANT_BOOL
*pfRet
)
1284 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1285 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1289 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
1290 IHTMLElement
**newElem
)
1292 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1296 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1298 hres
= create_element(This
->doc_node
, eTag
, &elem
);
1302 *newElem
= &elem
->IHTMLElement_iface
;
1306 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1308 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1309 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1313 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1315 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1316 FIXME("(%p)->(%p)\n", This
, p
);
1320 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1322 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1324 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1326 return set_doc_event(This
, EVENTID_CLICK
, &v
);
1329 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1331 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1333 TRACE("(%p)->(%p)\n", This
, p
);
1335 return get_doc_event(This
, EVENTID_CLICK
, p
);
1338 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1340 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1342 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1344 return set_doc_event(This
, EVENTID_DBLCLICK
, &v
);
1347 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1349 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1351 TRACE("(%p)->(%p)\n", This
, p
);
1353 return get_doc_event(This
, EVENTID_DBLCLICK
, p
);
1356 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1358 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1360 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1362 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1365 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1367 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1369 TRACE("(%p)->(%p)\n", This
, p
);
1371 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1374 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1376 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1378 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1380 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1383 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1385 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1387 TRACE("(%p)->(%p)\n", This
, p
);
1389 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1392 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1394 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1396 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1398 return set_doc_event(This
, EVENTID_KEYPRESS
, &v
);
1401 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1403 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1405 TRACE("(%p)->(%p)\n", This
, p
);
1407 return get_doc_event(This
, EVENTID_KEYPRESS
, p
);
1410 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1412 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1414 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1416 return set_doc_event(This
, EVENTID_MOUSEUP
, &v
);
1419 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1421 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1423 TRACE("(%p)->(%p)\n", This
, p
);
1425 return get_doc_event(This
, EVENTID_MOUSEUP
, p
);
1428 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1430 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1432 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1434 return set_doc_event(This
, EVENTID_MOUSEDOWN
, &v
);
1437 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1439 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1441 TRACE("(%p)->(%p)\n", This
, p
);
1443 return get_doc_event(This
, EVENTID_MOUSEDOWN
, p
);
1446 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1448 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1450 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1452 return set_doc_event(This
, EVENTID_MOUSEMOVE
, &v
);
1455 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1457 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1459 TRACE("(%p)->(%p)\n", This
, p
);
1461 return get_doc_event(This
, EVENTID_MOUSEMOVE
, p
);
1464 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1466 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1468 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1470 return set_doc_event(This
, EVENTID_MOUSEOUT
, &v
);
1473 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1475 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1477 TRACE("(%p)->(%p)\n", This
, p
);
1479 return get_doc_event(This
, EVENTID_MOUSEOUT
, p
);
1482 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1484 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1486 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1488 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1491 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1493 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1495 TRACE("(%p)->(%p)\n", This
, p
);
1497 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1500 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1502 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1504 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1506 return set_doc_event(This
, EVENTID_READYSTATECHANGE
, &v
);
1509 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1511 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1513 TRACE("(%p)->(%p)\n", This
, p
);
1515 return get_doc_event(This
, EVENTID_READYSTATECHANGE
, p
);
1518 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1520 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1521 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1525 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1527 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1528 FIXME("(%p)->(%p)\n", This
, p
);
1532 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1534 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1535 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1539 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1541 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1542 FIXME("(%p)->(%p)\n", This
, p
);
1546 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1548 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1549 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1553 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1555 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1556 FIXME("(%p)->(%p)\n", This
, p
);
1560 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1562 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1564 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1566 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1569 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1571 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1573 TRACE("(%p)->(%p)\n", This
, p
);
1575 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1578 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1580 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1582 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1584 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1587 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1589 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1591 TRACE("(%p)->(%p)\n", This
, p
);
1593 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1596 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, LONG x
, LONG y
,
1597 IHTMLElement
**elementHit
)
1599 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1600 nsIDOMElement
*nselem
;
1601 HTMLElement
*element
;
1605 TRACE("(%p)->(%d %d %p)\n", This
, x
, y
, elementHit
);
1607 nsres
= nsIDOMHTMLDocument_ElementFromPoint(This
->doc_node
->nsdoc
, x
, y
, &nselem
);
1608 if(NS_FAILED(nsres
)) {
1609 ERR("ElementFromPoint failed: %08x\n", nsres
);
1618 hres
= get_element(nselem
, &element
);
1619 nsIDOMElement_Release(nselem
);
1623 *elementHit
= &element
->IHTMLElement_iface
;
1627 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1629 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1631 TRACE("(%p)->(%p)\n", This
, p
);
1633 return IHTMLDocument7_get_defaultView(&This
->IHTMLDocument7_iface
, p
);
1636 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1637 IHTMLStyleSheetsCollection
**p
)
1639 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1640 nsIDOMStyleSheetList
*nsstylelist
;
1643 TRACE("(%p)->(%p)\n", This
, p
);
1647 if(!This
->doc_node
->nsdoc
) {
1648 WARN("NULL nsdoc\n");
1649 return E_UNEXPECTED
;
1652 nsres
= nsIDOMHTMLDocument_GetStyleSheets(This
->doc_node
->nsdoc
, &nsstylelist
);
1653 if(NS_FAILED(nsres
)) {
1654 ERR("GetStyleSheets failed: %08x\n", nsres
);
1658 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1659 nsIDOMStyleSheetList_Release(nsstylelist
);
1664 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1666 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1667 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1671 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1673 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1674 FIXME("(%p)->(%p)\n", This
, p
);
1678 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1680 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1681 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1685 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1687 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1688 FIXME("(%p)->(%p)\n", This
, p
);
1692 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1694 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1696 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
1698 TRACE("(%p)->(%p)\n", This
, String
);
1701 return E_INVALIDARG
;
1703 *String
= SysAllocString(objectW
);
1704 return *String
? S_OK
: E_OUTOFMEMORY
;
1708 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1709 LONG lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1711 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1712 nsIDOMHTMLHeadElement
*head_elem
;
1713 IHTMLStyleElement
*style_elem
;
1718 static const WCHAR styleW
[] = {'s','t','y','l','e',0};
1720 TRACE("(%p)->(%s %d %p)\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1722 if(!This
->doc_node
->nsdoc
) {
1723 FIXME("not a real doc object\n");
1728 FIXME("Unsupported lIndex %d\n", lIndex
);
1730 if(bstrHref
&& *bstrHref
) {
1731 FIXME("semi-stub for href %s\n", debugstr_w(bstrHref
));
1732 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1736 hres
= create_element(This
->doc_node
, styleW
, &elem
);
1740 nsres
= nsIDOMHTMLDocument_GetHead(This
->doc_node
->nsdoc
, &head_elem
);
1741 if(NS_SUCCEEDED(nsres
)) {
1742 nsIDOMNode
*head_node
, *tmp_node
;
1744 nsres
= nsIDOMHTMLHeadElement_QueryInterface(head_elem
, &IID_nsIDOMNode
, (void**)&head_node
);
1745 nsIDOMHTMLHeadElement_Release(head_elem
);
1746 assert(nsres
== NS_OK
);
1748 nsres
= nsIDOMNode_AppendChild(head_node
, elem
->node
.nsnode
, &tmp_node
);
1749 nsIDOMNode_Release(head_node
);
1750 if(NS_SUCCEEDED(nsres
) && tmp_node
)
1751 nsIDOMNode_Release(tmp_node
);
1753 if(NS_FAILED(nsres
)) {
1754 IHTMLElement_Release(&elem
->IHTMLElement_iface
);
1758 hres
= IHTMLElement_QueryInterface(&elem
->IHTMLElement_iface
, &IID_IHTMLStyleElement
, (void**)&style_elem
);
1759 assert(hres
== S_OK
);
1760 IHTMLElement_Release(&elem
->IHTMLElement_iface
);
1762 hres
= IHTMLStyleElement_get_styleSheet(style_elem
, ppnewStyleSheet
);
1763 IHTMLStyleElement_Release(style_elem
);
1767 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1768 HTMLDocument_QueryInterface
,
1769 HTMLDocument_AddRef
,
1770 HTMLDocument_Release
,
1771 HTMLDocument_GetTypeInfoCount
,
1772 HTMLDocument_GetTypeInfo
,
1773 HTMLDocument_GetIDsOfNames
,
1774 HTMLDocument_Invoke
,
1775 HTMLDocument_get_Script
,
1776 HTMLDocument_get_all
,
1777 HTMLDocument_get_body
,
1778 HTMLDocument_get_activeElement
,
1779 HTMLDocument_get_images
,
1780 HTMLDocument_get_applets
,
1781 HTMLDocument_get_links
,
1782 HTMLDocument_get_forms
,
1783 HTMLDocument_get_anchors
,
1784 HTMLDocument_put_title
,
1785 HTMLDocument_get_title
,
1786 HTMLDocument_get_scripts
,
1787 HTMLDocument_put_designMode
,
1788 HTMLDocument_get_designMode
,
1789 HTMLDocument_get_selection
,
1790 HTMLDocument_get_readyState
,
1791 HTMLDocument_get_frames
,
1792 HTMLDocument_get_embeds
,
1793 HTMLDocument_get_plugins
,
1794 HTMLDocument_put_alinkColor
,
1795 HTMLDocument_get_alinkColor
,
1796 HTMLDocument_put_bgColor
,
1797 HTMLDocument_get_bgColor
,
1798 HTMLDocument_put_fgColor
,
1799 HTMLDocument_get_fgColor
,
1800 HTMLDocument_put_linkColor
,
1801 HTMLDocument_get_linkColor
,
1802 HTMLDocument_put_vlinkColor
,
1803 HTMLDocument_get_vlinkColor
,
1804 HTMLDocument_get_referrer
,
1805 HTMLDocument_get_location
,
1806 HTMLDocument_get_lastModified
,
1807 HTMLDocument_put_URL
,
1808 HTMLDocument_get_URL
,
1809 HTMLDocument_put_domain
,
1810 HTMLDocument_get_domain
,
1811 HTMLDocument_put_cookie
,
1812 HTMLDocument_get_cookie
,
1813 HTMLDocument_put_expando
,
1814 HTMLDocument_get_expando
,
1815 HTMLDocument_put_charset
,
1816 HTMLDocument_get_charset
,
1817 HTMLDocument_put_defaultCharset
,
1818 HTMLDocument_get_defaultCharset
,
1819 HTMLDocument_get_mimeType
,
1820 HTMLDocument_get_fileSize
,
1821 HTMLDocument_get_fileCreatedDate
,
1822 HTMLDocument_get_fileModifiedDate
,
1823 HTMLDocument_get_fileUpdatedDate
,
1824 HTMLDocument_get_security
,
1825 HTMLDocument_get_protocol
,
1826 HTMLDocument_get_nameProp
,
1828 HTMLDocument_writeln
,
1832 HTMLDocument_queryCommandSupported
,
1833 HTMLDocument_queryCommandEnabled
,
1834 HTMLDocument_queryCommandState
,
1835 HTMLDocument_queryCommandIndeterm
,
1836 HTMLDocument_queryCommandText
,
1837 HTMLDocument_queryCommandValue
,
1838 HTMLDocument_execCommand
,
1839 HTMLDocument_execCommandShowHelp
,
1840 HTMLDocument_createElement
,
1841 HTMLDocument_put_onhelp
,
1842 HTMLDocument_get_onhelp
,
1843 HTMLDocument_put_onclick
,
1844 HTMLDocument_get_onclick
,
1845 HTMLDocument_put_ondblclick
,
1846 HTMLDocument_get_ondblclick
,
1847 HTMLDocument_put_onkeyup
,
1848 HTMLDocument_get_onkeyup
,
1849 HTMLDocument_put_onkeydown
,
1850 HTMLDocument_get_onkeydown
,
1851 HTMLDocument_put_onkeypress
,
1852 HTMLDocument_get_onkeypress
,
1853 HTMLDocument_put_onmouseup
,
1854 HTMLDocument_get_onmouseup
,
1855 HTMLDocument_put_onmousedown
,
1856 HTMLDocument_get_onmousedown
,
1857 HTMLDocument_put_onmousemove
,
1858 HTMLDocument_get_onmousemove
,
1859 HTMLDocument_put_onmouseout
,
1860 HTMLDocument_get_onmouseout
,
1861 HTMLDocument_put_onmouseover
,
1862 HTMLDocument_get_onmouseover
,
1863 HTMLDocument_put_onreadystatechange
,
1864 HTMLDocument_get_onreadystatechange
,
1865 HTMLDocument_put_onafterupdate
,
1866 HTMLDocument_get_onafterupdate
,
1867 HTMLDocument_put_onrowexit
,
1868 HTMLDocument_get_onrowexit
,
1869 HTMLDocument_put_onrowenter
,
1870 HTMLDocument_get_onrowenter
,
1871 HTMLDocument_put_ondragstart
,
1872 HTMLDocument_get_ondragstart
,
1873 HTMLDocument_put_onselectstart
,
1874 HTMLDocument_get_onselectstart
,
1875 HTMLDocument_elementFromPoint
,
1876 HTMLDocument_get_parentWindow
,
1877 HTMLDocument_get_styleSheets
,
1878 HTMLDocument_put_onbeforeupdate
,
1879 HTMLDocument_get_onbeforeupdate
,
1880 HTMLDocument_put_onerrorupdate
,
1881 HTMLDocument_get_onerrorupdate
,
1882 HTMLDocument_toString
,
1883 HTMLDocument_createStyleSheet
1886 static inline HTMLDocument
*impl_from_IHTMLDocument3(IHTMLDocument3
*iface
)
1888 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument3_iface
);
1891 static HRESULT WINAPI
HTMLDocument3_QueryInterface(IHTMLDocument3
*iface
,
1892 REFIID riid
, void **ppv
)
1894 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1895 return htmldoc_query_interface(This
, riid
, ppv
);
1898 static ULONG WINAPI
HTMLDocument3_AddRef(IHTMLDocument3
*iface
)
1900 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1901 return htmldoc_addref(This
);
1904 static ULONG WINAPI
HTMLDocument3_Release(IHTMLDocument3
*iface
)
1906 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1907 return htmldoc_release(This
);
1910 static HRESULT WINAPI
HTMLDocument3_GetTypeInfoCount(IHTMLDocument3
*iface
, UINT
*pctinfo
)
1912 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1913 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1916 static HRESULT WINAPI
HTMLDocument3_GetTypeInfo(IHTMLDocument3
*iface
, UINT iTInfo
,
1917 LCID lcid
, ITypeInfo
**ppTInfo
)
1919 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1920 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1923 static HRESULT WINAPI
HTMLDocument3_GetIDsOfNames(IHTMLDocument3
*iface
, REFIID riid
,
1924 LPOLESTR
*rgszNames
, UINT cNames
,
1925 LCID lcid
, DISPID
*rgDispId
)
1927 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1928 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1932 static HRESULT WINAPI
HTMLDocument3_Invoke(IHTMLDocument3
*iface
, DISPID dispIdMember
,
1933 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1934 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1936 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1937 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1938 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1941 static HRESULT WINAPI
HTMLDocument3_releaseCapture(IHTMLDocument3
*iface
)
1943 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1944 FIXME("(%p)\n", This
);
1948 static HRESULT WINAPI
HTMLDocument3_recalc(IHTMLDocument3
*iface
, VARIANT_BOOL fForce
)
1950 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1952 WARN("(%p)->(%x)\n", This
, fForce
);
1954 /* Doing nothing here should be fine for us. */
1958 static HRESULT WINAPI
HTMLDocument3_createTextNode(IHTMLDocument3
*iface
, BSTR text
,
1959 IHTMLDOMNode
**newTextNode
)
1961 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1968 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(text
), newTextNode
);
1970 if(!This
->doc_node
->nsdoc
) {
1971 WARN("NULL nsdoc\n");
1972 return E_UNEXPECTED
;
1975 nsAString_InitDepend(&text_str
, text
);
1976 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->doc_node
->nsdoc
, &text_str
, &nstext
);
1977 nsAString_Finish(&text_str
);
1978 if(NS_FAILED(nsres
)) {
1979 ERR("CreateTextNode failed: %08x\n", nsres
);
1983 hres
= HTMLDOMTextNode_Create(This
->doc_node
, (nsIDOMNode
*)nstext
, &node
);
1984 nsIDOMText_Release(nstext
);
1988 *newTextNode
= &node
->IHTMLDOMNode_iface
;
1992 static HRESULT WINAPI
HTMLDocument3_get_documentElement(IHTMLDocument3
*iface
, IHTMLElement
**p
)
1994 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1995 nsIDOMElement
*nselem
= NULL
;
1996 HTMLElement
*element
;
2000 TRACE("(%p)->(%p)\n", This
, p
);
2002 if(This
->window
->readystate
== READYSTATE_UNINITIALIZED
) {
2007 if(!This
->doc_node
->nsdoc
) {
2008 WARN("NULL nsdoc\n");
2009 return E_UNEXPECTED
;
2012 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->doc_node
->nsdoc
, &nselem
);
2013 if(NS_FAILED(nsres
)) {
2014 ERR("GetDocumentElement failed: %08x\n", nsres
);
2023 hres
= get_element(nselem
, &element
);
2024 nsIDOMElement_Release(nselem
);
2028 *p
= &element
->IHTMLElement_iface
;
2032 static HRESULT WINAPI
HTMLDocument3_get_uniqueID(IHTMLDocument3
*iface
, BSTR
*p
)
2034 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2036 TRACE("(%p)->(%p)\n", This
, p
);
2038 return elem_unique_id(++This
->doc_node
->unique_id
, p
);
2041 static HRESULT WINAPI
HTMLDocument3_attachEvent(IHTMLDocument3
*iface
, BSTR event
,
2042 IDispatch
* pDisp
, VARIANT_BOOL
*pfResult
)
2044 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2046 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
2048 return attach_event(&This
->doc_node
->node
.event_target
, event
, pDisp
, pfResult
);
2051 static HRESULT WINAPI
HTMLDocument3_detachEvent(IHTMLDocument3
*iface
, BSTR event
,
2054 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2056 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(event
), pDisp
);
2058 return detach_event(&This
->doc_node
->node
.event_target
, event
, pDisp
);
2061 static HRESULT WINAPI
HTMLDocument3_put_onrowsdelete(IHTMLDocument3
*iface
, VARIANT v
)
2063 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2064 FIXME("(%p)->()\n", This
);
2068 static HRESULT WINAPI
HTMLDocument3_get_onrowsdelete(IHTMLDocument3
*iface
, VARIANT
*p
)
2070 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2071 FIXME("(%p)->(%p)\n", This
, p
);
2075 static HRESULT WINAPI
HTMLDocument3_put_onrowsinserted(IHTMLDocument3
*iface
, VARIANT v
)
2077 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2078 FIXME("(%p)->()\n", This
);
2082 static HRESULT WINAPI
HTMLDocument3_get_onrowsinserted(IHTMLDocument3
*iface
, VARIANT
*p
)
2084 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2085 FIXME("(%p)->(%p)\n", This
, p
);
2089 static HRESULT WINAPI
HTMLDocument3_put_oncellchange(IHTMLDocument3
*iface
, VARIANT v
)
2091 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2092 FIXME("(%p)->()\n", This
);
2096 static HRESULT WINAPI
HTMLDocument3_get_oncellchange(IHTMLDocument3
*iface
, VARIANT
*p
)
2098 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2099 FIXME("(%p)->(%p)\n", This
, p
);
2103 static HRESULT WINAPI
HTMLDocument3_put_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT v
)
2105 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2106 FIXME("(%p)->()\n", This
);
2110 static HRESULT WINAPI
HTMLDocument3_get_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT
*p
)
2112 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2113 FIXME("(%p)->(%p)\n", This
, p
);
2117 static HRESULT WINAPI
HTMLDocument3_put_ondataavailable(IHTMLDocument3
*iface
, VARIANT v
)
2119 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2120 FIXME("(%p)->()\n", This
);
2124 static HRESULT WINAPI
HTMLDocument3_get_ondataavailable(IHTMLDocument3
*iface
, VARIANT
*p
)
2126 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2127 FIXME("(%p)->(%p)\n", This
, p
);
2131 static HRESULT WINAPI
HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT v
)
2133 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2134 FIXME("(%p)->()\n", This
);
2138 static HRESULT WINAPI
HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT
*p
)
2140 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2141 FIXME("(%p)->(%p)\n", This
, p
);
2145 static HRESULT WINAPI
HTMLDocument3_put_onpropertychange(IHTMLDocument3
*iface
, VARIANT v
)
2147 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2148 FIXME("(%p)->()\n", This
);
2152 static HRESULT WINAPI
HTMLDocument3_get_onpropertychange(IHTMLDocument3
*iface
, VARIANT
*p
)
2154 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2155 FIXME("(%p)->(%p)\n", This
, p
);
2159 static HRESULT WINAPI
HTMLDocument3_put_dir(IHTMLDocument3
*iface
, BSTR v
)
2161 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2165 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2167 if(!This
->doc_node
->nsdoc
) {
2168 FIXME("NULL nsdoc\n");
2169 return E_UNEXPECTED
;
2172 nsAString_InitDepend(&dir_str
, v
);
2173 nsres
= nsIDOMHTMLDocument_SetDir(This
->doc_node
->nsdoc
, &dir_str
);
2174 nsAString_Finish(&dir_str
);
2175 if(NS_FAILED(nsres
)) {
2176 ERR("SetDir failed: %08x\n", nsres
);
2183 static HRESULT WINAPI
HTMLDocument3_get_dir(IHTMLDocument3
*iface
, BSTR
*p
)
2185 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2189 TRACE("(%p)->(%p)\n", This
, p
);
2191 if(!This
->doc_node
->nsdoc
) {
2192 FIXME("NULL nsdoc\n");
2193 return E_UNEXPECTED
;
2196 nsAString_Init(&dir_str
, NULL
);
2197 nsres
= nsIDOMHTMLDocument_GetDir(This
->doc_node
->nsdoc
, &dir_str
);
2198 return return_nsstr(nsres
, &dir_str
, p
);
2201 static HRESULT WINAPI
HTMLDocument3_put_oncontextmenu(IHTMLDocument3
*iface
, VARIANT v
)
2203 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2205 TRACE("(%p)->()\n", This
);
2207 return set_doc_event(This
, EVENTID_CONTEXTMENU
, &v
);
2210 static HRESULT WINAPI
HTMLDocument3_get_oncontextmenu(IHTMLDocument3
*iface
, VARIANT
*p
)
2212 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2214 TRACE("(%p)->(%p)\n", This
, p
);
2216 return get_doc_event(This
, EVENTID_CONTEXTMENU
, p
);
2219 static HRESULT WINAPI
HTMLDocument3_put_onstop(IHTMLDocument3
*iface
, VARIANT v
)
2221 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2222 FIXME("(%p)->()\n", This
);
2226 static HRESULT WINAPI
HTMLDocument3_get_onstop(IHTMLDocument3
*iface
, VARIANT
*p
)
2228 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2229 FIXME("(%p)->(%p)\n", This
, p
);
2233 static HRESULT WINAPI
HTMLDocument3_createDocumentFragment(IHTMLDocument3
*iface
,
2234 IHTMLDocument2
**ppNewDoc
)
2236 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2237 nsIDOMDocumentFragment
*doc_frag
;
2238 HTMLDocumentNode
*docnode
;
2242 TRACE("(%p)->(%p)\n", This
, ppNewDoc
);
2244 if(!This
->doc_node
->nsdoc
) {
2245 FIXME("NULL nsdoc\n");
2249 nsres
= nsIDOMHTMLDocument_CreateDocumentFragment(This
->doc_node
->nsdoc
, &doc_frag
);
2250 if(NS_FAILED(nsres
)) {
2251 ERR("CreateDocumentFragment failed: %08x\n", nsres
);
2255 hres
= create_document_fragment((nsIDOMNode
*)doc_frag
, This
->doc_node
, &docnode
);
2256 nsIDOMDocumentFragment_Release(doc_frag
);
2260 *ppNewDoc
= &docnode
->basedoc
.IHTMLDocument2_iface
;
2264 static HRESULT WINAPI
HTMLDocument3_get_parentDocument(IHTMLDocument3
*iface
,
2267 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2268 FIXME("(%p)->(%p)\n", This
, p
);
2272 static HRESULT WINAPI
HTMLDocument3_put_enableDownload(IHTMLDocument3
*iface
,
2275 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2276 FIXME("(%p)->(%x)\n", This
, v
);
2280 static HRESULT WINAPI
HTMLDocument3_get_enableDownload(IHTMLDocument3
*iface
,
2283 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2284 FIXME("(%p)->(%p)\n", This
, p
);
2288 static HRESULT WINAPI
HTMLDocument3_put_baseUrl(IHTMLDocument3
*iface
, BSTR v
)
2290 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2291 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2295 static HRESULT WINAPI
HTMLDocument3_get_baseUrl(IHTMLDocument3
*iface
, BSTR
*p
)
2297 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2298 FIXME("(%p)->(%p)\n", This
, p
);
2302 static HRESULT WINAPI
HTMLDocument3_get_childNodes(IHTMLDocument3
*iface
, IDispatch
**p
)
2304 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2306 TRACE("(%p)->(%p)\n", This
, p
);
2308 return IHTMLDOMNode_get_childNodes(&This
->doc_node
->node
.IHTMLDOMNode_iface
, p
);
2311 static HRESULT WINAPI
HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3
*iface
,
2314 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2315 FIXME("(%p)->()\n", This
);
2319 static HRESULT WINAPI
HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3
*iface
,
2322 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2323 FIXME("(%p)->(%p)\n", This
, p
);
2327 static HRESULT WINAPI
HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT v
)
2329 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2330 FIXME("(%p)->()\n", This
);
2334 static HRESULT WINAPI
HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT
*p
)
2336 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2337 FIXME("(%p)->(%p)\n", This
, p
);
2341 static HRESULT WINAPI
HTMLDocument3_getElementsByName(IHTMLDocument3
*iface
, BSTR v
,
2342 IHTMLElementCollection
**ppelColl
)
2344 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2345 nsIDOMNodeList
*node_list
;
2346 nsAString selector_str
;
2350 static const WCHAR formatW
[] = {'*','[','i','d','=','%','s',']',',','*','[','n','a','m','e','=','%','s',']',0};
2352 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppelColl
);
2354 if(!This
->doc_node
|| !This
->doc_node
->nsdoc
) {
2355 /* We should probably return an empty collection. */
2356 FIXME("No nsdoc\n");
2360 selector
= heap_alloc(2*SysStringLen(v
)*sizeof(WCHAR
) + sizeof(formatW
));
2362 return E_OUTOFMEMORY
;
2363 sprintfW(selector
, formatW
, v
, v
);
2366 * NOTE: IE getElementsByName implementation differs from Gecko. It searches both name and id attributes.
2367 * That's why we use CSS selector instead. We should also use name only when it applies to given element
2368 * types and search should be case insensitive. Those are currently not supported properly.
2370 nsAString_InitDepend(&selector_str
, selector
);
2371 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->doc_node
->nsdoc
, &selector_str
, &node_list
);
2372 nsAString_Finish(&selector_str
);
2373 heap_free(selector
);
2374 if(NS_FAILED(nsres
)) {
2375 ERR("QuerySelectorAll failed: %08x\n", nsres
);
2379 *ppelColl
= create_collection_from_nodelist(node_list
, This
->doc_node
->document_mode
);
2380 nsIDOMNodeList_Release(node_list
);
2385 static HRESULT WINAPI
HTMLDocument3_getElementById(IHTMLDocument3
*iface
, BSTR v
,
2388 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2392 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
2394 hres
= get_doc_elem_by_id(This
->doc_node
, v
, &elem
);
2395 if(FAILED(hres
) || !elem
) {
2400 *pel
= &elem
->IHTMLElement_iface
;
2405 static HRESULT WINAPI
HTMLDocument3_getElementsByTagName(IHTMLDocument3
*iface
, BSTR v
,
2406 IHTMLElementCollection
**pelColl
)
2408 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2409 nsIDOMNodeList
*nslist
;
2413 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
2415 if(This
->doc_node
->nsdoc
) {
2416 nsAString_InitDepend(&id_str
, v
);
2417 nsres
= nsIDOMHTMLDocument_GetElementsByTagName(This
->doc_node
->nsdoc
, &id_str
, &nslist
);
2418 nsAString_Finish(&id_str
);
2420 ERR("GetElementByName failed: %08x\n", nsres
);
2424 nsIDOMDocumentFragment
*docfrag
;
2429 for(ptr
=v
; *ptr
; ptr
++) {
2430 if(!isalnumW(*ptr
)) {
2431 FIXME("Unsupported invalid tag %s\n", debugstr_w(v
));
2437 nsres
= nsIDOMNode_QueryInterface(This
->doc_node
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&docfrag
);
2438 if(NS_FAILED(nsres
)) {
2439 ERR("Could not get nsIDOMDocumentFragment iface: %08x\n", nsres
);
2440 return E_UNEXPECTED
;
2443 nsAString_InitDepend(&nsstr
, v
);
2444 nsres
= nsIDOMDocumentFragment_QuerySelectorAll(docfrag
, &nsstr
, &nslist
);
2445 nsAString_Finish(&nsstr
);
2446 nsIDOMDocumentFragment_Release(docfrag
);
2447 if(NS_FAILED(nsres
)) {
2448 ERR("QuerySelectorAll failed: %08x\n", nsres
);
2454 *pelColl
= create_collection_from_nodelist(nslist
, This
->doc_node
->document_mode
);
2455 nsIDOMNodeList_Release(nslist
);
2460 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl
= {
2461 HTMLDocument3_QueryInterface
,
2462 HTMLDocument3_AddRef
,
2463 HTMLDocument3_Release
,
2464 HTMLDocument3_GetTypeInfoCount
,
2465 HTMLDocument3_GetTypeInfo
,
2466 HTMLDocument3_GetIDsOfNames
,
2467 HTMLDocument3_Invoke
,
2468 HTMLDocument3_releaseCapture
,
2469 HTMLDocument3_recalc
,
2470 HTMLDocument3_createTextNode
,
2471 HTMLDocument3_get_documentElement
,
2472 HTMLDocument3_get_uniqueID
,
2473 HTMLDocument3_attachEvent
,
2474 HTMLDocument3_detachEvent
,
2475 HTMLDocument3_put_onrowsdelete
,
2476 HTMLDocument3_get_onrowsdelete
,
2477 HTMLDocument3_put_onrowsinserted
,
2478 HTMLDocument3_get_onrowsinserted
,
2479 HTMLDocument3_put_oncellchange
,
2480 HTMLDocument3_get_oncellchange
,
2481 HTMLDocument3_put_ondatasetchanged
,
2482 HTMLDocument3_get_ondatasetchanged
,
2483 HTMLDocument3_put_ondataavailable
,
2484 HTMLDocument3_get_ondataavailable
,
2485 HTMLDocument3_put_ondatasetcomplete
,
2486 HTMLDocument3_get_ondatasetcomplete
,
2487 HTMLDocument3_put_onpropertychange
,
2488 HTMLDocument3_get_onpropertychange
,
2489 HTMLDocument3_put_dir
,
2490 HTMLDocument3_get_dir
,
2491 HTMLDocument3_put_oncontextmenu
,
2492 HTMLDocument3_get_oncontextmenu
,
2493 HTMLDocument3_put_onstop
,
2494 HTMLDocument3_get_onstop
,
2495 HTMLDocument3_createDocumentFragment
,
2496 HTMLDocument3_get_parentDocument
,
2497 HTMLDocument3_put_enableDownload
,
2498 HTMLDocument3_get_enableDownload
,
2499 HTMLDocument3_put_baseUrl
,
2500 HTMLDocument3_get_baseUrl
,
2501 HTMLDocument3_get_childNodes
,
2502 HTMLDocument3_put_inheritStyleSheets
,
2503 HTMLDocument3_get_inheritStyleSheets
,
2504 HTMLDocument3_put_onbeforeeditfocus
,
2505 HTMLDocument3_get_onbeforeeditfocus
,
2506 HTMLDocument3_getElementsByName
,
2507 HTMLDocument3_getElementById
,
2508 HTMLDocument3_getElementsByTagName
2511 static inline HTMLDocument
*impl_from_IHTMLDocument4(IHTMLDocument4
*iface
)
2513 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument4_iface
);
2516 static HRESULT WINAPI
HTMLDocument4_QueryInterface(IHTMLDocument4
*iface
,
2517 REFIID riid
, void **ppv
)
2519 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2520 return htmldoc_query_interface(This
, riid
, ppv
);
2523 static ULONG WINAPI
HTMLDocument4_AddRef(IHTMLDocument4
*iface
)
2525 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2526 return htmldoc_addref(This
);
2529 static ULONG WINAPI
HTMLDocument4_Release(IHTMLDocument4
*iface
)
2531 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2532 return htmldoc_release(This
);
2535 static HRESULT WINAPI
HTMLDocument4_GetTypeInfoCount(IHTMLDocument4
*iface
, UINT
*pctinfo
)
2537 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2538 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2541 static HRESULT WINAPI
HTMLDocument4_GetTypeInfo(IHTMLDocument4
*iface
, UINT iTInfo
,
2542 LCID lcid
, ITypeInfo
**ppTInfo
)
2544 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2545 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2548 static HRESULT WINAPI
HTMLDocument4_GetIDsOfNames(IHTMLDocument4
*iface
, REFIID riid
,
2549 LPOLESTR
*rgszNames
, UINT cNames
,
2550 LCID lcid
, DISPID
*rgDispId
)
2552 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2553 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
2557 static HRESULT WINAPI
HTMLDocument4_Invoke(IHTMLDocument4
*iface
, DISPID dispIdMember
,
2558 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2559 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2561 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2562 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2563 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2566 static HRESULT WINAPI
HTMLDocument4_focus(IHTMLDocument4
*iface
)
2568 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2569 nsIDOMHTMLElement
*nsbody
;
2572 TRACE("(%p)->()\n", This
);
2574 nsres
= nsIDOMHTMLDocument_GetBody(This
->doc_node
->nsdoc
, &nsbody
);
2575 if(NS_FAILED(nsres
) || !nsbody
) {
2576 ERR("GetBody failed: %08x\n", nsres
);
2580 nsres
= nsIDOMHTMLElement_Focus(nsbody
);
2581 nsIDOMHTMLElement_Release(nsbody
);
2582 if(NS_FAILED(nsres
)) {
2583 ERR("Focus failed: %08x\n", nsres
);
2590 static HRESULT WINAPI
HTMLDocument4_hasFocus(IHTMLDocument4
*iface
, VARIANT_BOOL
*pfFocus
)
2592 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2596 TRACE("(%p)->(%p)\n", This
, pfFocus
);
2598 if(!This
->doc_node
->nsdoc
) {
2599 FIXME("Unimplemented for fragments.\n");
2603 nsres
= nsIDOMHTMLDocument_HasFocus(This
->doc_node
->nsdoc
, &has_focus
);
2604 assert(nsres
== NS_OK
);
2606 *pfFocus
= variant_bool(has_focus
);
2610 static HRESULT WINAPI
HTMLDocument4_put_onselectionchange(IHTMLDocument4
*iface
, VARIANT v
)
2612 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2614 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2616 return set_doc_event(This
, EVENTID_SELECTIONCHANGE
, &v
);
2619 static HRESULT WINAPI
HTMLDocument4_get_onselectionchange(IHTMLDocument4
*iface
, VARIANT
*p
)
2621 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2623 TRACE("(%p)->(%p)\n", This
, p
);
2625 return get_doc_event(This
, EVENTID_SELECTIONCHANGE
, p
);
2628 static HRESULT WINAPI
HTMLDocument4_get_namespace(IHTMLDocument4
*iface
, IDispatch
**p
)
2630 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2631 FIXME("(%p)->(%p)\n", This
, p
);
2635 static HRESULT WINAPI
HTMLDocument4_createDocumentFromUrl(IHTMLDocument4
*iface
, BSTR bstrUrl
,
2636 BSTR bstrOptions
, IHTMLDocument2
**newDoc
)
2638 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2639 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrUrl
), debugstr_w(bstrOptions
), newDoc
);
2643 static HRESULT WINAPI
HTMLDocument4_put_media(IHTMLDocument4
*iface
, BSTR v
)
2645 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2646 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2650 static HRESULT WINAPI
HTMLDocument4_get_media(IHTMLDocument4
*iface
, BSTR
*p
)
2652 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2653 FIXME("(%p)->(%p)\n", This
, p
);
2657 static HRESULT WINAPI
HTMLDocument4_createEventObject(IHTMLDocument4
*iface
,
2658 VARIANT
*pvarEventObject
, IHTMLEventObj
**ppEventObj
)
2660 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2662 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(pvarEventObject
), ppEventObj
);
2664 if(pvarEventObject
&& V_VT(pvarEventObject
) != VT_ERROR
&& V_VT(pvarEventObject
) != VT_EMPTY
) {
2665 FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject
));
2669 return create_event_obj(ppEventObj
);
2672 static HRESULT WINAPI
HTMLDocument4_fireEvent(IHTMLDocument4
*iface
, BSTR bstrEventName
,
2673 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCanceled
)
2675 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2677 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrEventName
), pvarEventObject
, pfCanceled
);
2679 return fire_event(&This
->doc_node
->node
, bstrEventName
, pvarEventObject
, pfCanceled
);
2682 static HRESULT WINAPI
HTMLDocument4_createRenderStyle(IHTMLDocument4
*iface
, BSTR v
,
2683 IHTMLRenderStyle
**ppIHTMLRenderStyle
)
2685 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2686 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppIHTMLRenderStyle
);
2690 static HRESULT WINAPI
HTMLDocument4_put_oncontrolselect(IHTMLDocument4
*iface
, VARIANT v
)
2692 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2693 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2697 static HRESULT WINAPI
HTMLDocument4_get_oncontrolselect(IHTMLDocument4
*iface
, VARIANT
*p
)
2699 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2700 FIXME("(%p)->(%p)\n", This
, p
);
2704 static HRESULT WINAPI
HTMLDocument4_get_URLEncoded(IHTMLDocument4
*iface
, BSTR
*p
)
2706 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2707 FIXME("(%p)->(%p)\n", This
, p
);
2711 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl
= {
2712 HTMLDocument4_QueryInterface
,
2713 HTMLDocument4_AddRef
,
2714 HTMLDocument4_Release
,
2715 HTMLDocument4_GetTypeInfoCount
,
2716 HTMLDocument4_GetTypeInfo
,
2717 HTMLDocument4_GetIDsOfNames
,
2718 HTMLDocument4_Invoke
,
2719 HTMLDocument4_focus
,
2720 HTMLDocument4_hasFocus
,
2721 HTMLDocument4_put_onselectionchange
,
2722 HTMLDocument4_get_onselectionchange
,
2723 HTMLDocument4_get_namespace
,
2724 HTMLDocument4_createDocumentFromUrl
,
2725 HTMLDocument4_put_media
,
2726 HTMLDocument4_get_media
,
2727 HTMLDocument4_createEventObject
,
2728 HTMLDocument4_fireEvent
,
2729 HTMLDocument4_createRenderStyle
,
2730 HTMLDocument4_put_oncontrolselect
,
2731 HTMLDocument4_get_oncontrolselect
,
2732 HTMLDocument4_get_URLEncoded
2735 static inline HTMLDocument
*impl_from_IHTMLDocument5(IHTMLDocument5
*iface
)
2737 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument5_iface
);
2740 static HRESULT WINAPI
HTMLDocument5_QueryInterface(IHTMLDocument5
*iface
,
2741 REFIID riid
, void **ppv
)
2743 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2744 return htmldoc_query_interface(This
, riid
, ppv
);
2747 static ULONG WINAPI
HTMLDocument5_AddRef(IHTMLDocument5
*iface
)
2749 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2750 return htmldoc_addref(This
);
2753 static ULONG WINAPI
HTMLDocument5_Release(IHTMLDocument5
*iface
)
2755 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2756 return htmldoc_release(This
);
2759 static HRESULT WINAPI
HTMLDocument5_GetTypeInfoCount(IHTMLDocument5
*iface
, UINT
*pctinfo
)
2761 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2762 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2765 static HRESULT WINAPI
HTMLDocument5_GetTypeInfo(IHTMLDocument5
*iface
, UINT iTInfo
,
2766 LCID lcid
, ITypeInfo
**ppTInfo
)
2768 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2769 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2772 static HRESULT WINAPI
HTMLDocument5_GetIDsOfNames(IHTMLDocument5
*iface
, REFIID riid
,
2773 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2775 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2776 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
2780 static HRESULT WINAPI
HTMLDocument5_Invoke(IHTMLDocument5
*iface
, DISPID dispIdMember
,
2781 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2782 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2784 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2785 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2786 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2789 static HRESULT WINAPI
HTMLDocument5_put_onmousewheel(IHTMLDocument5
*iface
, VARIANT v
)
2791 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2793 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2795 return set_doc_event(This
, EVENTID_MOUSEWHEEL
, &v
);
2798 static HRESULT WINAPI
HTMLDocument5_get_onmousewheel(IHTMLDocument5
*iface
, VARIANT
*p
)
2800 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2802 TRACE("(%p)->(%p)\n", This
, p
);
2804 return get_doc_event(This
, EVENTID_MOUSEWHEEL
, p
);
2807 static HRESULT WINAPI
HTMLDocument5_get_doctype(IHTMLDocument5
*iface
, IHTMLDOMNode
**p
)
2809 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2810 FIXME("(%p)->(%p)\n", This
, p
);
2814 static HRESULT WINAPI
HTMLDocument5_get_implementation(IHTMLDocument5
*iface
, IHTMLDOMImplementation
**p
)
2816 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2817 HTMLDocumentNode
*doc_node
= This
->doc_node
;
2819 TRACE("(%p)->(%p)\n", This
, p
);
2821 if(!doc_node
->dom_implementation
) {
2824 hres
= create_dom_implementation(&doc_node
->dom_implementation
);
2829 IHTMLDOMImplementation_AddRef(doc_node
->dom_implementation
);
2830 *p
= doc_node
->dom_implementation
;
2834 static HRESULT WINAPI
HTMLDocument5_createAttribute(IHTMLDocument5
*iface
, BSTR bstrattrName
,
2835 IHTMLDOMAttribute
**ppattribute
)
2837 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2838 HTMLDOMAttribute
*attr
;
2841 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrattrName
), ppattribute
);
2843 hres
= HTMLDOMAttribute_Create(bstrattrName
, NULL
, 0, &attr
);
2847 *ppattribute
= &attr
->IHTMLDOMAttribute_iface
;
2851 static HRESULT WINAPI
HTMLDocument5_createComment(IHTMLDocument5
*iface
, BSTR bstrdata
,
2852 IHTMLDOMNode
**ppRetNode
)
2854 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2855 nsIDOMComment
*nscomment
;
2861 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrdata
), ppRetNode
);
2863 if(!This
->doc_node
->nsdoc
) {
2864 WARN("NULL nsdoc\n");
2865 return E_UNEXPECTED
;
2868 nsAString_InitDepend(&str
, bstrdata
);
2869 nsres
= nsIDOMHTMLDocument_CreateComment(This
->doc_node
->nsdoc
, &str
, &nscomment
);
2870 nsAString_Finish(&str
);
2871 if(NS_FAILED(nsres
)) {
2872 ERR("CreateTextNode failed: %08x\n", nsres
);
2876 hres
= HTMLCommentElement_Create(This
->doc_node
, (nsIDOMNode
*)nscomment
, &elem
);
2877 nsIDOMComment_Release(nscomment
);
2881 *ppRetNode
= &elem
->node
.IHTMLDOMNode_iface
;
2885 static HRESULT WINAPI
HTMLDocument5_put_onfocusin(IHTMLDocument5
*iface
, VARIANT v
)
2887 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2889 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2891 return set_doc_event(This
, EVENTID_FOCUSIN
, &v
);
2894 static HRESULT WINAPI
HTMLDocument5_get_onfocusin(IHTMLDocument5
*iface
, VARIANT
*p
)
2896 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2898 TRACE("(%p)->(%p)\n", This
, p
);
2900 return get_doc_event(This
, EVENTID_FOCUSIN
, p
);
2903 static HRESULT WINAPI
HTMLDocument5_put_onfocusout(IHTMLDocument5
*iface
, VARIANT v
)
2905 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2907 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2909 return set_doc_event(This
, EVENTID_FOCUSOUT
, &v
);
2912 static HRESULT WINAPI
HTMLDocument5_get_onfocusout(IHTMLDocument5
*iface
, VARIANT
*p
)
2914 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2916 TRACE("(%p)->(%p)\n", This
, p
);
2918 return get_doc_event(This
, EVENTID_FOCUSOUT
, p
);
2921 static HRESULT WINAPI
HTMLDocument5_put_onactivate(IHTMLDocument5
*iface
, VARIANT v
)
2923 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2924 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2928 static HRESULT WINAPI
HTMLDocument5_get_onactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2930 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2931 FIXME("(%p)->(%p)\n", This
, p
);
2935 static HRESULT WINAPI
HTMLDocument5_put_ondeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2937 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2938 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2942 static HRESULT WINAPI
HTMLDocument5_get_ondeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2944 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2945 FIXME("(%p)->(%p)\n", This
, p
);
2949 static HRESULT WINAPI
HTMLDocument5_put_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2951 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2952 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2956 static HRESULT WINAPI
HTMLDocument5_get_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2958 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2959 FIXME("(%p)->(%p)\n", This
, p
);
2963 static HRESULT WINAPI
HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2965 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2966 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2970 static HRESULT WINAPI
HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2972 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2973 FIXME("(%p)->(%p)\n", This
, p
);
2977 static HRESULT WINAPI
HTMLDocument5_get_compatMode(IHTMLDocument5
*iface
, BSTR
*p
)
2979 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2981 static const WCHAR BackCompatW
[] = {'B','a','c','k','C','o','m','p','a','t',0};
2982 static const WCHAR CSS1CompatW
[] = {'C','S','S','1','C','o','m','p','a','t',0};
2984 TRACE("(%p)->(%p)\n", This
, p
);
2986 *p
= SysAllocString(This
->doc_node
->document_mode
<= COMPAT_MODE_IE5
? BackCompatW
: CSS1CompatW
);
2987 return *p
? S_OK
: E_OUTOFMEMORY
;
2990 static const IHTMLDocument5Vtbl HTMLDocument5Vtbl
= {
2991 HTMLDocument5_QueryInterface
,
2992 HTMLDocument5_AddRef
,
2993 HTMLDocument5_Release
,
2994 HTMLDocument5_GetTypeInfoCount
,
2995 HTMLDocument5_GetTypeInfo
,
2996 HTMLDocument5_GetIDsOfNames
,
2997 HTMLDocument5_Invoke
,
2998 HTMLDocument5_put_onmousewheel
,
2999 HTMLDocument5_get_onmousewheel
,
3000 HTMLDocument5_get_doctype
,
3001 HTMLDocument5_get_implementation
,
3002 HTMLDocument5_createAttribute
,
3003 HTMLDocument5_createComment
,
3004 HTMLDocument5_put_onfocusin
,
3005 HTMLDocument5_get_onfocusin
,
3006 HTMLDocument5_put_onfocusout
,
3007 HTMLDocument5_get_onfocusout
,
3008 HTMLDocument5_put_onactivate
,
3009 HTMLDocument5_get_onactivate
,
3010 HTMLDocument5_put_ondeactivate
,
3011 HTMLDocument5_get_ondeactivate
,
3012 HTMLDocument5_put_onbeforeactivate
,
3013 HTMLDocument5_get_onbeforeactivate
,
3014 HTMLDocument5_put_onbeforedeactivate
,
3015 HTMLDocument5_get_onbeforedeactivate
,
3016 HTMLDocument5_get_compatMode
3019 static inline HTMLDocument
*impl_from_IHTMLDocument6(IHTMLDocument6
*iface
)
3021 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument6_iface
);
3024 static HRESULT WINAPI
HTMLDocument6_QueryInterface(IHTMLDocument6
*iface
,
3025 REFIID riid
, void **ppv
)
3027 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3028 return htmldoc_query_interface(This
, riid
, ppv
);
3031 static ULONG WINAPI
HTMLDocument6_AddRef(IHTMLDocument6
*iface
)
3033 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3034 return htmldoc_addref(This
);
3037 static ULONG WINAPI
HTMLDocument6_Release(IHTMLDocument6
*iface
)
3039 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3040 return htmldoc_release(This
);
3043 static HRESULT WINAPI
HTMLDocument6_GetTypeInfoCount(IHTMLDocument6
*iface
, UINT
*pctinfo
)
3045 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3046 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3049 static HRESULT WINAPI
HTMLDocument6_GetTypeInfo(IHTMLDocument6
*iface
, UINT iTInfo
,
3050 LCID lcid
, ITypeInfo
**ppTInfo
)
3052 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3053 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3056 static HRESULT WINAPI
HTMLDocument6_GetIDsOfNames(IHTMLDocument6
*iface
, REFIID riid
,
3057 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3059 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3060 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
3064 static HRESULT WINAPI
HTMLDocument6_Invoke(IHTMLDocument6
*iface
, DISPID dispIdMember
,
3065 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3066 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3068 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3069 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3070 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3073 static HRESULT WINAPI
HTMLDocument6_get_compatible(IHTMLDocument6
*iface
,
3074 IHTMLDocumentCompatibleInfoCollection
**p
)
3076 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3077 FIXME("(%p)->(%p)\n", This
, p
);
3081 static HRESULT WINAPI
HTMLDocument6_get_documentMode(IHTMLDocument6
*iface
, VARIANT
*p
)
3083 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3085 TRACE("(%p)->(%p)\n", This
, p
);
3087 if(!This
->doc_node
) {
3088 FIXME("NULL doc_node\n");
3089 return E_UNEXPECTED
;
3093 V_R4(p
) = compat_mode_info
[This
->doc_node
->document_mode
].document_mode
;
3097 static HRESULT WINAPI
HTMLDocument6_get_onstorage(IHTMLDocument6
*iface
,
3100 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3101 FIXME("(%p)->(%p)\n", This
, p
);
3105 static HRESULT WINAPI
HTMLDocument6_put_onstorage(IHTMLDocument6
*iface
, VARIANT v
)
3107 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3108 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3112 static HRESULT WINAPI
HTMLDocument6_get_onstoragecommit(IHTMLDocument6
*iface
,
3115 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3116 FIXME("(%p)->(%p)\n", This
, p
);
3120 static HRESULT WINAPI
HTMLDocument6_put_onstoragecommit(IHTMLDocument6
*iface
, VARIANT v
)
3122 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3123 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3127 static HRESULT WINAPI
HTMLDocument6_getElementById(IHTMLDocument6
*iface
,
3128 BSTR bstrId
, IHTMLElement2
**p
)
3130 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3131 nsIDOMElement
*nselem
;
3137 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrId
), p
);
3140 * Unlike IHTMLDocument3 implementation, this is standard compliant and does
3141 * not search for name attributes, so we may simply let Gecko do the right thing.
3144 if(!This
->doc_node
->nsdoc
) {
3145 FIXME("Not a document\n");
3149 nsAString_InitDepend(&nsstr
, bstrId
);
3150 nsres
= nsIDOMHTMLDocument_GetElementById(This
->doc_node
->nsdoc
, &nsstr
, &nselem
);
3151 nsAString_Finish(&nsstr
);
3152 if(NS_FAILED(nsres
)) {
3153 ERR("GetElementById failed: %08x\n", nsres
);
3162 hres
= get_element(nselem
, &elem
);
3163 nsIDOMElement_Release(nselem
);
3167 *p
= &elem
->IHTMLElement2_iface
;
3171 static HRESULT WINAPI
HTMLDocument6_updateSettings(IHTMLDocument6
*iface
)
3173 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3174 FIXME("(%p)->()\n", This
);
3178 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl
= {
3179 HTMLDocument6_QueryInterface
,
3180 HTMLDocument6_AddRef
,
3181 HTMLDocument6_Release
,
3182 HTMLDocument6_GetTypeInfoCount
,
3183 HTMLDocument6_GetTypeInfo
,
3184 HTMLDocument6_GetIDsOfNames
,
3185 HTMLDocument6_Invoke
,
3186 HTMLDocument6_get_compatible
,
3187 HTMLDocument6_get_documentMode
,
3188 HTMLDocument6_put_onstorage
,
3189 HTMLDocument6_get_onstorage
,
3190 HTMLDocument6_put_onstoragecommit
,
3191 HTMLDocument6_get_onstoragecommit
,
3192 HTMLDocument6_getElementById
,
3193 HTMLDocument6_updateSettings
3196 static inline HTMLDocument
*impl_from_IHTMLDocument7(IHTMLDocument7
*iface
)
3198 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument7_iface
);
3201 static HRESULT WINAPI
HTMLDocument7_QueryInterface(IHTMLDocument7
*iface
, REFIID riid
, void **ppv
)
3203 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3204 return htmldoc_query_interface(This
, riid
, ppv
);
3207 static ULONG WINAPI
HTMLDocument7_AddRef(IHTMLDocument7
*iface
)
3209 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3210 return htmldoc_addref(This
);
3213 static ULONG WINAPI
HTMLDocument7_Release(IHTMLDocument7
*iface
)
3215 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3216 return htmldoc_release(This
);
3219 static HRESULT WINAPI
HTMLDocument7_GetTypeInfoCount(IHTMLDocument7
*iface
, UINT
*pctinfo
)
3221 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3222 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3225 static HRESULT WINAPI
HTMLDocument7_GetTypeInfo(IHTMLDocument7
*iface
, UINT iTInfo
,
3226 LCID lcid
, ITypeInfo
**ppTInfo
)
3228 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3229 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3232 static HRESULT WINAPI
HTMLDocument7_GetIDsOfNames(IHTMLDocument7
*iface
, REFIID riid
,
3233 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3235 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3236 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
3240 static HRESULT WINAPI
HTMLDocument7_Invoke(IHTMLDocument7
*iface
, DISPID dispIdMember
,
3241 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3242 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3244 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3245 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3246 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3249 static HRESULT WINAPI
HTMLDocument7_get_defaultView(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
3251 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3253 TRACE("(%p)->(%p)\n", This
, p
);
3255 *p
= &This
->window
->base
.IHTMLWindow2_iface
;
3256 IHTMLWindow2_AddRef(*p
);
3260 static HRESULT WINAPI
HTMLDocument7_createCDATASection(IHTMLDocument7
*iface
, BSTR text
, IHTMLDOMNode
**newCDATASectionNode
)
3262 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3263 FIXME("(%p)->(%p)\n", This
, newCDATASectionNode
);
3267 static HRESULT WINAPI
HTMLDocument7_getSelection(IHTMLDocument7
*iface
, IHTMLSelection
**ppIHTMLSelection
)
3269 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3270 FIXME("(%p)->(%p)\n", This
, ppIHTMLSelection
);
3274 static HRESULT WINAPI
HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3275 BSTR bstrLocalName
, IHTMLElementCollection
**pelColl
)
3277 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3278 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrLocalName
), pelColl
);
3282 static HRESULT WINAPI
HTMLDocument7_createElementNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
, BSTR bstrTag
, IHTMLElement
**newElem
)
3284 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3285 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrTag
), newElem
);
3289 static HRESULT WINAPI
HTMLDocument7_createAttributeNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3290 BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3292 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3293 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrAttrName
), ppAttribute
);
3297 static HRESULT WINAPI
HTMLDocument7_put_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT v
)
3299 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3300 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3304 static HRESULT WINAPI
HTMLDocument7_get_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT
*p
)
3306 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3307 FIXME("(%p)->(%p)\n", This
, p
);
3311 static HRESULT WINAPI
HTMLDocument7_get_characterSet(IHTMLDocument7
*iface
, BSTR
*p
)
3313 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3314 nsAString charset_str
;
3317 TRACE("(%p)->(%p)\n", This
, p
);
3319 if(!This
->doc_node
->nsdoc
) {
3320 FIXME("NULL nsdoc\n");
3324 nsAString_Init(&charset_str
, NULL
);
3325 nsres
= nsIDOMHTMLDocument_GetCharacterSet(This
->doc_node
->nsdoc
, &charset_str
);
3326 return return_nsstr(nsres
, &charset_str
, p
);
3329 static HRESULT WINAPI
HTMLDocument7_createElement(IHTMLDocument7
*iface
, BSTR bstrTag
, IHTMLElement
**newElem
)
3331 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3333 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrTag
), newElem
);
3335 return IHTMLDocument2_createElement(&This
->IHTMLDocument2_iface
, bstrTag
, newElem
);
3338 static HRESULT WINAPI
HTMLDocument7_createAttribute(IHTMLDocument7
*iface
, BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3340 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3342 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrAttrName
), ppAttribute
);
3344 return IHTMLDocument5_createAttribute(&This
->IHTMLDocument5_iface
, bstrAttrName
, ppAttribute
);
3347 static HRESULT WINAPI
HTMLDocument7_getElementsByClassName(IHTMLDocument7
*iface
, BSTR v
, IHTMLElementCollection
**pel
)
3349 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3350 nsIDOMNodeList
*nslist
;
3354 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
3356 if(!This
->doc_node
->nsdoc
) {
3357 FIXME("NULL nsdoc not supported\n");
3361 nsAString_InitDepend(&nsstr
, v
);
3362 nsres
= nsIDOMHTMLDocument_GetElementsByClassName(This
->doc_node
->nsdoc
, &nsstr
, &nslist
);
3363 nsAString_Finish(&nsstr
);
3365 ERR("GetElementByClassName failed: %08x\n", nsres
);
3370 *pel
= create_collection_from_nodelist(nslist
, This
->doc_node
->document_mode
);
3371 nsIDOMNodeList_Release(nslist
);
3375 static HRESULT WINAPI
HTMLDocument7_createProcessingInstruction(IHTMLDocument7
*iface
, BSTR target
,
3376 BSTR data
, IDOMProcessingInstruction
**newProcessingInstruction
)
3378 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3379 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(target
), debugstr_w(data
), newProcessingInstruction
);
3383 static HRESULT WINAPI
HTMLDocument7_adoptNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
, IHTMLDOMNode3
**ppNodeDest
)
3385 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3386 FIXME("(%p)->(%p %p)\n", This
, pNodeSource
, ppNodeDest
);
3390 static HRESULT WINAPI
HTMLDocument7_put_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT v
)
3392 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3393 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3397 static HRESULT WINAPI
HTMLDocument7_get_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT
*p
)
3399 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3400 FIXME("(%p)->(%p)\n", This
, p
);
3404 static HRESULT WINAPI
HTMLDocument7_get_all(IHTMLDocument7
*iface
, IHTMLElementCollection
**p
)
3406 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3408 TRACE("(%p)->(%p)\n", This
, p
);
3410 return IHTMLDocument2_get_all(&This
->IHTMLDocument2_iface
, p
);
3413 static HRESULT WINAPI
HTMLDocument7_get_inputEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3415 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3416 FIXME("(%p)->(%p)\n", This
, p
);
3420 static HRESULT WINAPI
HTMLDocument7_get_xmlEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3422 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3423 FIXME("(%p)->(%p)\n", This
, p
);
3427 static HRESULT WINAPI
HTMLDocument7_put_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL v
)
3429 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3430 FIXME("(%p)->(%x)\n", This
, v
);
3434 static HRESULT WINAPI
HTMLDocument7_get_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL
*p
)
3436 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3437 FIXME("(%p)->(%p)\n", This
, p
);
3441 static HRESULT WINAPI
HTMLDocument7_put_xmlVersion(IHTMLDocument7
*iface
, BSTR v
)
3443 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3444 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
3448 static HRESULT WINAPI
HTMLDocument7_get_xmlVersion(IHTMLDocument7
*iface
, BSTR
*p
)
3450 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3451 FIXME("(%p)->(%p)\n", This
, p
);
3455 static HRESULT WINAPI
HTMLDocument7_hasAttributes(IHTMLDocument7
*iface
, VARIANT_BOOL
*pfHasAttributes
)
3457 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3458 FIXME("(%p)->(%p)\n", This
, pfHasAttributes
);
3462 static HRESULT WINAPI
HTMLDocument7_put_onabort(IHTMLDocument7
*iface
, VARIANT v
)
3464 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3466 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3468 return set_doc_event(This
, EVENTID_ABORT
, &v
);
3471 static HRESULT WINAPI
HTMLDocument7_get_onabort(IHTMLDocument7
*iface
, VARIANT
*p
)
3473 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3475 TRACE("(%p)->(%p)\n", This
, p
);
3477 return get_doc_event(This
, EVENTID_ABORT
, p
);
3480 static HRESULT WINAPI
HTMLDocument7_put_onblur(IHTMLDocument7
*iface
, VARIANT v
)
3482 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3484 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3486 return set_doc_event(This
, EVENTID_BLUR
, &v
);
3489 static HRESULT WINAPI
HTMLDocument7_get_onblur(IHTMLDocument7
*iface
, VARIANT
*p
)
3491 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3493 TRACE("(%p)->(%p)\n", This
, p
);
3495 return get_doc_event(This
, EVENTID_BLUR
, p
);
3498 static HRESULT WINAPI
HTMLDocument7_put_oncanplay(IHTMLDocument7
*iface
, VARIANT v
)
3500 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3501 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3505 static HRESULT WINAPI
HTMLDocument7_get_oncanplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3507 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3508 FIXME("(%p)->(%p)\n", This
, p
);
3512 static HRESULT WINAPI
HTMLDocument7_put_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT v
)
3514 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3515 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3519 static HRESULT WINAPI
HTMLDocument7_get_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT
*p
)
3521 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3522 FIXME("(%p)->(%p)\n", This
, p
);
3526 static HRESULT WINAPI
HTMLDocument7_put_onchange(IHTMLDocument7
*iface
, VARIANT v
)
3528 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3530 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3532 return set_doc_event(This
, EVENTID_CHANGE
, &v
);
3535 static HRESULT WINAPI
HTMLDocument7_get_onchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3537 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3539 TRACE("(%p)->(%p)\n", This
, p
);
3541 return get_doc_event(This
, EVENTID_CHANGE
, p
);
3544 static HRESULT WINAPI
HTMLDocument7_put_ondrag(IHTMLDocument7
*iface
, VARIANT v
)
3546 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3548 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3550 return set_doc_event(This
, EVENTID_DRAG
, &v
);
3553 static HRESULT WINAPI
HTMLDocument7_get_ondrag(IHTMLDocument7
*iface
, VARIANT
*p
)
3555 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3557 TRACE("(%p)->(%p)\n", This
, p
);
3559 return get_doc_event(This
, EVENTID_DRAG
, p
);
3562 static HRESULT WINAPI
HTMLDocument7_put_ondragend(IHTMLDocument7
*iface
, VARIANT v
)
3564 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3565 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3569 static HRESULT WINAPI
HTMLDocument7_get_ondragend(IHTMLDocument7
*iface
, VARIANT
*p
)
3571 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3572 FIXME("(%p)->(%p)\n", This
, p
);
3576 static HRESULT WINAPI
HTMLDocument7_put_ondragenter(IHTMLDocument7
*iface
, VARIANT v
)
3578 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3579 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3583 static HRESULT WINAPI
HTMLDocument7_get_ondragenter(IHTMLDocument7
*iface
, VARIANT
*p
)
3585 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3586 FIXME("(%p)->(%p)\n", This
, p
);
3590 static HRESULT WINAPI
HTMLDocument7_put_ondragleave(IHTMLDocument7
*iface
, VARIANT v
)
3592 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3593 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3597 static HRESULT WINAPI
HTMLDocument7_get_ondragleave(IHTMLDocument7
*iface
, VARIANT
*p
)
3599 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3600 FIXME("(%p)->(%p)\n", This
, p
);
3604 static HRESULT WINAPI
HTMLDocument7_put_ondragover(IHTMLDocument7
*iface
, VARIANT v
)
3606 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3607 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3611 static HRESULT WINAPI
HTMLDocument7_get_ondragover(IHTMLDocument7
*iface
, VARIANT
*p
)
3613 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3614 FIXME("(%p)->(%p)\n", This
, p
);
3618 static HRESULT WINAPI
HTMLDocument7_put_ondrop(IHTMLDocument7
*iface
, VARIANT v
)
3620 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3621 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3625 static HRESULT WINAPI
HTMLDocument7_get_ondrop(IHTMLDocument7
*iface
, VARIANT
*p
)
3627 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3628 FIXME("(%p)->(%p)\n", This
, p
);
3632 static HRESULT WINAPI
HTMLDocument7_put_ondurationchange(IHTMLDocument7
*iface
, VARIANT v
)
3634 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3635 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3639 static HRESULT WINAPI
HTMLDocument7_get_ondurationchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3641 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3642 FIXME("(%p)->(%p)\n", This
, p
);
3646 static HRESULT WINAPI
HTMLDocument7_put_onemptied(IHTMLDocument7
*iface
, VARIANT v
)
3648 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3649 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3653 static HRESULT WINAPI
HTMLDocument7_get_onemptied(IHTMLDocument7
*iface
, VARIANT
*p
)
3655 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3656 FIXME("(%p)->(%p)\n", This
, p
);
3660 static HRESULT WINAPI
HTMLDocument7_put_onended(IHTMLDocument7
*iface
, VARIANT v
)
3662 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3663 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3667 static HRESULT WINAPI
HTMLDocument7_get_onended(IHTMLDocument7
*iface
, VARIANT
*p
)
3669 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3670 FIXME("(%p)->(%p)\n", This
, p
);
3674 static HRESULT WINAPI
HTMLDocument7_put_onerror(IHTMLDocument7
*iface
, VARIANT v
)
3676 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3678 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3680 return set_doc_event(This
, EVENTID_ERROR
, &v
);
3683 static HRESULT WINAPI
HTMLDocument7_get_onerror(IHTMLDocument7
*iface
, VARIANT
*p
)
3685 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3687 TRACE("(%p)->(%p)\n", This
, p
);
3689 return get_doc_event(This
, EVENTID_ERROR
, p
);
3692 static HRESULT WINAPI
HTMLDocument7_put_onfocus(IHTMLDocument7
*iface
, VARIANT v
)
3694 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3696 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3698 return set_doc_event(This
, EVENTID_FOCUS
, &v
);
3701 static HRESULT WINAPI
HTMLDocument7_get_onfocus(IHTMLDocument7
*iface
, VARIANT
*p
)
3703 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3705 TRACE("(%p)->(%p)\n", This
, p
);
3707 return get_doc_event(This
, EVENTID_FOCUS
, p
);
3710 static HRESULT WINAPI
HTMLDocument7_put_oninput(IHTMLDocument7
*iface
, VARIANT v
)
3712 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3714 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3716 return set_doc_event(This
, EVENTID_INPUT
, &v
);
3719 static HRESULT WINAPI
HTMLDocument7_get_oninput(IHTMLDocument7
*iface
, VARIANT
*p
)
3721 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3723 TRACE("(%p)->(%p)\n", This
, p
);
3725 return get_doc_event(This
, EVENTID_INPUT
, p
);
3728 static HRESULT WINAPI
HTMLDocument7_put_onload(IHTMLDocument7
*iface
, VARIANT v
)
3730 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3732 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3734 return set_doc_event(This
, EVENTID_LOAD
, &v
);
3737 static HRESULT WINAPI
HTMLDocument7_get_onload(IHTMLDocument7
*iface
, VARIANT
*p
)
3739 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3741 TRACE("(%p)->(%p)\n", This
, p
);
3743 return get_doc_event(This
, EVENTID_LOAD
, p
);
3746 static HRESULT WINAPI
HTMLDocument7_put_onloadeddata(IHTMLDocument7
*iface
, VARIANT v
)
3748 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3749 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3753 static HRESULT WINAPI
HTMLDocument7_get_onloadeddata(IHTMLDocument7
*iface
, VARIANT
*p
)
3755 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3756 FIXME("(%p)->(%p)\n", This
, p
);
3760 static HRESULT WINAPI
HTMLDocument7_put_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT v
)
3762 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3763 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3767 static HRESULT WINAPI
HTMLDocument7_get_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT
*p
)
3769 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3770 FIXME("(%p)->(%p)\n", This
, p
);
3774 static HRESULT WINAPI
HTMLDocument7_put_onloadstart(IHTMLDocument7
*iface
, VARIANT v
)
3776 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3777 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3781 static HRESULT WINAPI
HTMLDocument7_get_onloadstart(IHTMLDocument7
*iface
, VARIANT
*p
)
3783 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3784 FIXME("(%p)->(%p)\n", This
, p
);
3788 static HRESULT WINAPI
HTMLDocument7_put_onpause(IHTMLDocument7
*iface
, VARIANT v
)
3790 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3791 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3795 static HRESULT WINAPI
HTMLDocument7_get_onpause(IHTMLDocument7
*iface
, VARIANT
*p
)
3797 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3798 FIXME("(%p)->(%p)\n", This
, p
);
3802 static HRESULT WINAPI
HTMLDocument7_put_onplay(IHTMLDocument7
*iface
, VARIANT v
)
3804 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3805 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3809 static HRESULT WINAPI
HTMLDocument7_get_onplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3811 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3812 FIXME("(%p)->(%p)\n", This
, p
);
3816 static HRESULT WINAPI
HTMLDocument7_put_onplaying(IHTMLDocument7
*iface
, VARIANT v
)
3818 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3819 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3823 static HRESULT WINAPI
HTMLDocument7_get_onplaying(IHTMLDocument7
*iface
, VARIANT
*p
)
3825 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3826 FIXME("(%p)->(%p)\n", This
, p
);
3830 static HRESULT WINAPI
HTMLDocument7_put_onprogress(IHTMLDocument7
*iface
, VARIANT v
)
3832 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3833 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3837 static HRESULT WINAPI
HTMLDocument7_get_onprogress(IHTMLDocument7
*iface
, VARIANT
*p
)
3839 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3840 FIXME("(%p)->(%p)\n", This
, p
);
3844 static HRESULT WINAPI
HTMLDocument7_put_onratechange(IHTMLDocument7
*iface
, VARIANT v
)
3846 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3847 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3851 static HRESULT WINAPI
HTMLDocument7_get_onratechange(IHTMLDocument7
*iface
, VARIANT
*p
)
3853 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3854 FIXME("(%p)->(%p)\n", This
, p
);
3858 static HRESULT WINAPI
HTMLDocument7_put_onreset(IHTMLDocument7
*iface
, VARIANT v
)
3860 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3861 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3865 static HRESULT WINAPI
HTMLDocument7_get_onreset(IHTMLDocument7
*iface
, VARIANT
*p
)
3867 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3868 FIXME("(%p)->(%p)\n", This
, p
);
3872 static HRESULT WINAPI
HTMLDocument7_put_onscroll(IHTMLDocument7
*iface
, VARIANT v
)
3874 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3876 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3878 return set_doc_event(This
, EVENTID_SCROLL
, &v
);
3881 static HRESULT WINAPI
HTMLDocument7_get_onscroll(IHTMLDocument7
*iface
, VARIANT
*p
)
3883 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3885 TRACE("(%p)->(%p)\n", This
, p
);
3887 return get_doc_event(This
, EVENTID_SCROLL
, p
);
3890 static HRESULT WINAPI
HTMLDocument7_put_onseekend(IHTMLDocument7
*iface
, VARIANT v
)
3892 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3893 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3897 static HRESULT WINAPI
HTMLDocument7_get_onseekend(IHTMLDocument7
*iface
, VARIANT
*p
)
3899 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3900 FIXME("(%p)->(%p)\n", This
, p
);
3904 static HRESULT WINAPI
HTMLDocument7_put_onseeking(IHTMLDocument7
*iface
, VARIANT v
)
3906 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3907 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3911 static HRESULT WINAPI
HTMLDocument7_get_onseeking(IHTMLDocument7
*iface
, VARIANT
*p
)
3913 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3914 FIXME("(%p)->(%p)\n", This
, p
);
3918 static HRESULT WINAPI
HTMLDocument7_put_onselect(IHTMLDocument7
*iface
, VARIANT v
)
3920 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3921 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3925 static HRESULT WINAPI
HTMLDocument7_get_onselect(IHTMLDocument7
*iface
, VARIANT
*p
)
3927 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3928 FIXME("(%p)->(%p)\n", This
, p
);
3932 static HRESULT WINAPI
HTMLDocument7_put_onstalled(IHTMLDocument7
*iface
, VARIANT v
)
3934 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3935 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3939 static HRESULT WINAPI
HTMLDocument7_get_onstalled(IHTMLDocument7
*iface
, VARIANT
*p
)
3941 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3942 FIXME("(%p)->(%p)\n", This
, p
);
3946 static HRESULT WINAPI
HTMLDocument7_put_onsubmit(IHTMLDocument7
*iface
, VARIANT v
)
3948 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3950 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3952 return set_doc_event(This
, EVENTID_SUBMIT
, &v
);
3955 static HRESULT WINAPI
HTMLDocument7_get_onsubmit(IHTMLDocument7
*iface
, VARIANT
*p
)
3957 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3959 TRACE("(%p)->(%p)\n", This
, p
);
3961 return get_doc_event(This
, EVENTID_SUBMIT
, p
);
3964 static HRESULT WINAPI
HTMLDocument7_put_onsuspend(IHTMLDocument7
*iface
, VARIANT v
)
3966 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3967 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3971 static HRESULT WINAPI
HTMLDocument7_get_onsuspend(IHTMLDocument7
*iface
, VARIANT
*p
)
3973 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3974 FIXME("(%p)->(%p)\n", This
, p
);
3978 static HRESULT WINAPI
HTMLDocument7_put_ontimeupdate(IHTMLDocument7
*iface
, VARIANT v
)
3980 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3981 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3985 static HRESULT WINAPI
HTMLDocument7_get_ontimeupdate(IHTMLDocument7
*iface
, VARIANT
*p
)
3987 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3988 FIXME("(%p)->(%p)\n", This
, p
);
3992 static HRESULT WINAPI
HTMLDocument7_put_onvolumechange(IHTMLDocument7
*iface
, VARIANT v
)
3994 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3995 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3999 static HRESULT WINAPI
HTMLDocument7_get_onvolumechange(IHTMLDocument7
*iface
, VARIANT
*p
)
4001 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4002 FIXME("(%p)->(%p)\n", This
, p
);
4006 static HRESULT WINAPI
HTMLDocument7_put_onwaiting(IHTMLDocument7
*iface
, VARIANT v
)
4008 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4009 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4013 static HRESULT WINAPI
HTMLDocument7_get_onwaiting(IHTMLDocument7
*iface
, VARIANT
*p
)
4015 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4016 FIXME("(%p)->(%p)\n", This
, p
);
4020 static HRESULT WINAPI
HTMLDocument7_normalize(IHTMLDocument7
*iface
)
4022 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4023 FIXME("(%p)\n", This
);
4027 static HRESULT WINAPI
HTMLDocument7_importNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
,
4028 VARIANT_BOOL fDeep
, IHTMLDOMNode3
**ppNodeDest
)
4030 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4031 FIXME("(%p)->(%p %x %p)\n", This
, pNodeSource
, fDeep
, ppNodeDest
);
4035 static HRESULT WINAPI
HTMLDocument7_get_parentWindow(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
4037 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4039 TRACE("(%p)->(%p)\n", This
, p
);
4041 return IHTMLDocument7_get_defaultView(&This
->IHTMLDocument7_iface
, p
);
4044 static HRESULT WINAPI
HTMLDocument7_put_body(IHTMLDocument7
*iface
, IHTMLElement
*v
)
4046 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4047 FIXME("(%p)->(%p)\n", This
, v
);
4051 static HRESULT WINAPI
HTMLDocument7_get_body(IHTMLDocument7
*iface
, IHTMLElement
**p
)
4053 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4055 TRACE("(%p)->(%p)\n", This
, p
);
4057 return IHTMLDocument2_get_body(&This
->IHTMLDocument2_iface
, p
);
4060 static HRESULT WINAPI
HTMLDocument7_get_head(IHTMLDocument7
*iface
, IHTMLElement
**p
)
4062 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4063 nsIDOMHTMLHeadElement
*nshead
;
4064 nsIDOMElement
*nselem
;
4069 TRACE("(%p)->(%p)\n", This
, p
);
4071 if(!This
->doc_node
->nsdoc
) {
4072 FIXME("No document\n");
4076 nsres
= nsIDOMHTMLDocument_GetHead(This
->doc_node
->nsdoc
, &nshead
);
4077 assert(nsres
== NS_OK
);
4084 nsres
= nsIDOMHTMLHeadElement_QueryInterface(nshead
, &IID_nsIDOMElement
, (void**)&nselem
);
4085 nsIDOMHTMLHeadElement_Release(nshead
);
4086 assert(nsres
== NS_OK
);
4088 hres
= get_element(nselem
, &elem
);
4089 nsIDOMElement_Release(nselem
);
4093 *p
= &elem
->IHTMLElement_iface
;
4097 static const IHTMLDocument7Vtbl HTMLDocument7Vtbl
= {
4098 HTMLDocument7_QueryInterface
,
4099 HTMLDocument7_AddRef
,
4100 HTMLDocument7_Release
,
4101 HTMLDocument7_GetTypeInfoCount
,
4102 HTMLDocument7_GetTypeInfo
,
4103 HTMLDocument7_GetIDsOfNames
,
4104 HTMLDocument7_Invoke
,
4105 HTMLDocument7_get_defaultView
,
4106 HTMLDocument7_createCDATASection
,
4107 HTMLDocument7_getSelection
,
4108 HTMLDocument7_getElementsByTagNameNS
,
4109 HTMLDocument7_createElementNS
,
4110 HTMLDocument7_createAttributeNS
,
4111 HTMLDocument7_put_onmsthumbnailclick
,
4112 HTMLDocument7_get_onmsthumbnailclick
,
4113 HTMLDocument7_get_characterSet
,
4114 HTMLDocument7_createElement
,
4115 HTMLDocument7_createAttribute
,
4116 HTMLDocument7_getElementsByClassName
,
4117 HTMLDocument7_createProcessingInstruction
,
4118 HTMLDocument7_adoptNode
,
4119 HTMLDocument7_put_onmssitemodejumplistitemremoved
,
4120 HTMLDocument7_get_onmssitemodejumplistitemremoved
,
4121 HTMLDocument7_get_all
,
4122 HTMLDocument7_get_inputEncoding
,
4123 HTMLDocument7_get_xmlEncoding
,
4124 HTMLDocument7_put_xmlStandalone
,
4125 HTMLDocument7_get_xmlStandalone
,
4126 HTMLDocument7_put_xmlVersion
,
4127 HTMLDocument7_get_xmlVersion
,
4128 HTMLDocument7_hasAttributes
,
4129 HTMLDocument7_put_onabort
,
4130 HTMLDocument7_get_onabort
,
4131 HTMLDocument7_put_onblur
,
4132 HTMLDocument7_get_onblur
,
4133 HTMLDocument7_put_oncanplay
,
4134 HTMLDocument7_get_oncanplay
,
4135 HTMLDocument7_put_oncanplaythrough
,
4136 HTMLDocument7_get_oncanplaythrough
,
4137 HTMLDocument7_put_onchange
,
4138 HTMLDocument7_get_onchange
,
4139 HTMLDocument7_put_ondrag
,
4140 HTMLDocument7_get_ondrag
,
4141 HTMLDocument7_put_ondragend
,
4142 HTMLDocument7_get_ondragend
,
4143 HTMLDocument7_put_ondragenter
,
4144 HTMLDocument7_get_ondragenter
,
4145 HTMLDocument7_put_ondragleave
,
4146 HTMLDocument7_get_ondragleave
,
4147 HTMLDocument7_put_ondragover
,
4148 HTMLDocument7_get_ondragover
,
4149 HTMLDocument7_put_ondrop
,
4150 HTMLDocument7_get_ondrop
,
4151 HTMLDocument7_put_ondurationchange
,
4152 HTMLDocument7_get_ondurationchange
,
4153 HTMLDocument7_put_onemptied
,
4154 HTMLDocument7_get_onemptied
,
4155 HTMLDocument7_put_onended
,
4156 HTMLDocument7_get_onended
,
4157 HTMLDocument7_put_onerror
,
4158 HTMLDocument7_get_onerror
,
4159 HTMLDocument7_put_onfocus
,
4160 HTMLDocument7_get_onfocus
,
4161 HTMLDocument7_put_oninput
,
4162 HTMLDocument7_get_oninput
,
4163 HTMLDocument7_put_onload
,
4164 HTMLDocument7_get_onload
,
4165 HTMLDocument7_put_onloadeddata
,
4166 HTMLDocument7_get_onloadeddata
,
4167 HTMLDocument7_put_onloadedmetadata
,
4168 HTMLDocument7_get_onloadedmetadata
,
4169 HTMLDocument7_put_onloadstart
,
4170 HTMLDocument7_get_onloadstart
,
4171 HTMLDocument7_put_onpause
,
4172 HTMLDocument7_get_onpause
,
4173 HTMLDocument7_put_onplay
,
4174 HTMLDocument7_get_onplay
,
4175 HTMLDocument7_put_onplaying
,
4176 HTMLDocument7_get_onplaying
,
4177 HTMLDocument7_put_onprogress
,
4178 HTMLDocument7_get_onprogress
,
4179 HTMLDocument7_put_onratechange
,
4180 HTMLDocument7_get_onratechange
,
4181 HTMLDocument7_put_onreset
,
4182 HTMLDocument7_get_onreset
,
4183 HTMLDocument7_put_onscroll
,
4184 HTMLDocument7_get_onscroll
,
4185 HTMLDocument7_put_onseekend
,
4186 HTMLDocument7_get_onseekend
,
4187 HTMLDocument7_put_onseeking
,
4188 HTMLDocument7_get_onseeking
,
4189 HTMLDocument7_put_onselect
,
4190 HTMLDocument7_get_onselect
,
4191 HTMLDocument7_put_onstalled
,
4192 HTMLDocument7_get_onstalled
,
4193 HTMLDocument7_put_onsubmit
,
4194 HTMLDocument7_get_onsubmit
,
4195 HTMLDocument7_put_onsuspend
,
4196 HTMLDocument7_get_onsuspend
,
4197 HTMLDocument7_put_ontimeupdate
,
4198 HTMLDocument7_get_ontimeupdate
,
4199 HTMLDocument7_put_onvolumechange
,
4200 HTMLDocument7_get_onvolumechange
,
4201 HTMLDocument7_put_onwaiting
,
4202 HTMLDocument7_get_onwaiting
,
4203 HTMLDocument7_normalize
,
4204 HTMLDocument7_importNode
,
4205 HTMLDocument7_get_parentWindow
,
4206 HTMLDocument7_put_body
,
4207 HTMLDocument7_get_body
,
4208 HTMLDocument7_get_head
4211 static inline HTMLDocument
*impl_from_IDocumentSelector(IDocumentSelector
*iface
)
4213 return CONTAINING_RECORD(iface
, HTMLDocument
, IDocumentSelector_iface
);
4216 static HRESULT WINAPI
DocumentSelector_QueryInterface(IDocumentSelector
*iface
, REFIID riid
, void **ppv
)
4218 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4219 return htmldoc_query_interface(This
, riid
, ppv
);
4222 static ULONG WINAPI
DocumentSelector_AddRef(IDocumentSelector
*iface
)
4224 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4225 return htmldoc_addref(This
);
4228 static ULONG WINAPI
DocumentSelector_Release(IDocumentSelector
*iface
)
4230 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4231 return htmldoc_release(This
);
4234 static HRESULT WINAPI
DocumentSelector_GetTypeInfoCount(IDocumentSelector
*iface
, UINT
*pctinfo
)
4236 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4237 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
4240 static HRESULT WINAPI
DocumentSelector_GetTypeInfo(IDocumentSelector
*iface
, UINT iTInfo
,
4241 LCID lcid
, ITypeInfo
**ppTInfo
)
4243 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4244 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4247 static HRESULT WINAPI
DocumentSelector_GetIDsOfNames(IDocumentSelector
*iface
, REFIID riid
,
4248 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4250 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4251 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
4255 static HRESULT WINAPI
DocumentSelector_Invoke(IDocumentSelector
*iface
, DISPID dispIdMember
, REFIID riid
,
4256 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4258 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4259 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
4260 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4263 static HRESULT WINAPI
DocumentSelector_querySelector(IDocumentSelector
*iface
, BSTR v
, IHTMLElement
**pel
)
4265 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4266 nsIDOMElement
*nselem
;
4272 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4274 nsAString_InitDepend(&nsstr
, v
);
4275 nsres
= nsIDOMHTMLDocument_QuerySelector(This
->doc_node
->nsdoc
, &nsstr
, &nselem
);
4276 nsAString_Finish(&nsstr
);
4277 if(NS_FAILED(nsres
)) {
4278 ERR("QuerySelector failed: %08x\n", nsres
);
4287 hres
= get_element(nselem
, &elem
);
4288 nsIDOMElement_Release(nselem
);
4292 *pel
= &elem
->IHTMLElement_iface
;
4296 static HRESULT WINAPI
DocumentSelector_querySelectorAll(IDocumentSelector
*iface
, BSTR v
, IHTMLDOMChildrenCollection
**pel
)
4298 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4299 nsIDOMNodeList
*node_list
;
4303 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4305 nsAString_InitDepend(&nsstr
, v
);
4306 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->doc_node
->nsdoc
, &nsstr
, &node_list
);
4307 nsAString_Finish(&nsstr
);
4308 if(NS_FAILED(nsres
)) {
4309 ERR("QuerySelectorAll failed: %08x\n", nsres
);
4313 *pel
= create_child_collection(node_list
);
4314 nsIDOMNodeList_Release(node_list
);
4315 return *pel
? S_OK
: E_OUTOFMEMORY
;
4318 static const IDocumentSelectorVtbl DocumentSelectorVtbl
= {
4319 DocumentSelector_QueryInterface
,
4320 DocumentSelector_AddRef
,
4321 DocumentSelector_Release
,
4322 DocumentSelector_GetTypeInfoCount
,
4323 DocumentSelector_GetTypeInfo
,
4324 DocumentSelector_GetIDsOfNames
,
4325 DocumentSelector_Invoke
,
4326 DocumentSelector_querySelector
,
4327 DocumentSelector_querySelectorAll
4330 static inline HTMLDocument
*impl_from_IDocumentEvent(IDocumentEvent
*iface
)
4332 return CONTAINING_RECORD(iface
, HTMLDocument
, IDocumentEvent_iface
);
4335 static HRESULT WINAPI
DocumentEvent_QueryInterface(IDocumentEvent
*iface
, REFIID riid
, void **ppv
)
4337 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4338 return htmldoc_query_interface(This
, riid
, ppv
);
4341 static ULONG WINAPI
DocumentEvent_AddRef(IDocumentEvent
*iface
)
4343 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4344 return htmldoc_addref(This
);
4347 static ULONG WINAPI
DocumentEvent_Release(IDocumentEvent
*iface
)
4349 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4350 return htmldoc_release(This
);
4353 static HRESULT WINAPI
DocumentEvent_GetTypeInfoCount(IDocumentEvent
*iface
, UINT
*pctinfo
)
4355 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4356 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
4359 static HRESULT WINAPI
DocumentEvent_GetTypeInfo(IDocumentEvent
*iface
, UINT iTInfo
,
4360 LCID lcid
, ITypeInfo
**ppTInfo
)
4362 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4363 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4366 static HRESULT WINAPI
DocumentEvent_GetIDsOfNames(IDocumentEvent
*iface
, REFIID riid
,
4367 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4369 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4370 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
4374 static HRESULT WINAPI
DocumentEvent_Invoke(IDocumentEvent
*iface
, DISPID dispIdMember
, REFIID riid
,
4375 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4377 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4378 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
4379 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4382 static HRESULT WINAPI
DocumentEvent_createEvent(IDocumentEvent
*iface
, BSTR eventType
, IDOMEvent
**p
)
4384 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4386 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eventType
), p
);
4388 return create_document_event_str(This
->doc_node
, eventType
, p
);
4391 static const IDocumentEventVtbl DocumentEventVtbl
= {
4392 DocumentEvent_QueryInterface
,
4393 DocumentEvent_AddRef
,
4394 DocumentEvent_Release
,
4395 DocumentEvent_GetTypeInfoCount
,
4396 DocumentEvent_GetTypeInfo
,
4397 DocumentEvent_GetIDsOfNames
,
4398 DocumentEvent_Invoke
,
4399 DocumentEvent_createEvent
4402 static void HTMLDocument_on_advise(IUnknown
*iface
, cp_static_data_t
*cp
)
4404 HTMLDocument
*This
= impl_from_IHTMLDocument2((IHTMLDocument2
*)iface
);
4407 update_doc_cp_events(This
->doc_node
, cp
);
4410 static inline HTMLDocument
*impl_from_ISupportErrorInfo(ISupportErrorInfo
*iface
)
4412 return CONTAINING_RECORD(iface
, HTMLDocument
, ISupportErrorInfo_iface
);
4415 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
4417 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4418 return htmldoc_query_interface(This
, riid
, ppv
);
4421 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
4423 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4424 return htmldoc_addref(This
);
4427 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
4429 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4430 return htmldoc_release(This
);
4433 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
4435 FIXME("(%p)->(%s)\n", iface
, debugstr_mshtml_guid(riid
));
4439 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
4440 SupportErrorInfo_QueryInterface
,
4441 SupportErrorInfo_AddRef
,
4442 SupportErrorInfo_Release
,
4443 SupportErrorInfo_InterfaceSupportsErrorInfo
4446 static inline HTMLDocument
*impl_from_IDispatchEx(IDispatchEx
*iface
)
4448 return CONTAINING_RECORD(iface
, HTMLDocument
, IDispatchEx_iface
);
4451 static HRESULT
dispid_from_elem_name(HTMLDocumentNode
*This
, BSTR name
, DISPID
*dispid
)
4453 nsIDOMNodeList
*node_list
;
4460 return DISP_E_UNKNOWNNAME
;
4462 nsAString_InitDepend(&name_str
, name
);
4463 nsres
= nsIDOMHTMLDocument_GetElementsByName(This
->nsdoc
, &name_str
, &node_list
);
4464 nsAString_Finish(&name_str
);
4465 if(NS_FAILED(nsres
))
4468 nsres
= nsIDOMNodeList_GetLength(node_list
, &len
);
4469 nsIDOMNodeList_Release(node_list
);
4470 if(NS_FAILED(nsres
))
4474 return DISP_E_UNKNOWNNAME
;
4476 for(i
=0; i
< This
->elem_vars_cnt
; i
++) {
4477 if(!strcmpW(name
, This
->elem_vars
[i
])) {
4478 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
4483 if(This
->elem_vars_cnt
== This
->elem_vars_size
) {
4486 if(This
->elem_vars_size
) {
4487 new_vars
= heap_realloc(This
->elem_vars
, This
->elem_vars_size
*2*sizeof(WCHAR
*));
4489 return E_OUTOFMEMORY
;
4490 This
->elem_vars_size
*= 2;
4492 new_vars
= heap_alloc(16*sizeof(WCHAR
*));
4494 return E_OUTOFMEMORY
;
4495 This
->elem_vars_size
= 16;
4498 This
->elem_vars
= new_vars
;
4501 This
->elem_vars
[This
->elem_vars_cnt
] = heap_strdupW(name
);
4502 if(!This
->elem_vars
[This
->elem_vars_cnt
])
4503 return E_OUTOFMEMORY
;
4505 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+This
->elem_vars_cnt
++;
4509 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
4511 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4513 return htmldoc_query_interface(This
, riid
, ppv
);
4516 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
4518 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4520 return htmldoc_addref(This
);
4523 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
4525 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4527 return htmldoc_release(This
);
4530 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
4532 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4534 return IDispatchEx_GetTypeInfoCount(This
->dispex
, pctinfo
);
4537 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
4538 LCID lcid
, ITypeInfo
**ppTInfo
)
4540 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4542 return IDispatchEx_GetTypeInfo(This
->dispex
, iTInfo
, lcid
, ppTInfo
);
4545 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
4546 LPOLESTR
*rgszNames
, UINT cNames
,
4547 LCID lcid
, DISPID
*rgDispId
)
4549 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4551 return IDispatchEx_GetIDsOfNames(This
->dispex
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
4554 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
4555 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4556 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4558 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4560 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
4561 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4563 switch(dispIdMember
) {
4564 case DISPID_READYSTATE
:
4565 TRACE("DISPID_READYSTATE\n");
4567 if(!(wFlags
& DISPATCH_PROPERTYGET
))
4568 return E_INVALIDARG
;
4570 V_VT(pVarResult
) = VT_I4
;
4571 V_I4(pVarResult
) = This
->window
->readystate
;
4575 return IDispatchEx_Invoke(This
->dispex
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
4576 pVarResult
, pExcepInfo
, puArgErr
);
4579 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
4581 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4584 hres
= IDispatchEx_GetDispID(This
->dispex
, bstrName
, grfdex
, pid
);
4585 if(hres
!= DISP_E_UNKNOWNNAME
)
4588 return dispid_from_elem_name(This
->doc_node
, bstrName
, pid
);
4591 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
4592 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
4594 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4596 if(This
->window
&& id
== DISPID_IHTMLDOCUMENT2_LOCATION
&& (wFlags
& DISPATCH_PROPERTYPUT
))
4597 return IDispatchEx_InvokeEx(&This
->window
->base
.IDispatchEx_iface
, DISPID_IHTMLWINDOW2_LOCATION
,
4598 lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
4601 return IDispatchEx_InvokeEx(This
->dispex
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
4604 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
4606 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4608 return IDispatchEx_DeleteMemberByName(This
->dispex
, bstrName
, grfdex
);
4611 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
4613 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4615 return IDispatchEx_DeleteMemberByDispID(This
->dispex
, id
);
4618 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
4620 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4622 return IDispatchEx_GetMemberProperties(This
->dispex
, id
, grfdexFetch
, pgrfdex
);
4625 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
4627 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4629 return IDispatchEx_GetMemberName(This
->dispex
, id
, pbstrName
);
4632 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
4634 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4636 return IDispatchEx_GetNextDispID(This
->dispex
, grfdex
, id
, pid
);
4639 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
4641 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4643 return IDispatchEx_GetNameSpaceParent(This
->dispex
, ppunk
);
4646 static const IDispatchExVtbl DocDispatchExVtbl
= {
4647 DocDispatchEx_QueryInterface
,
4648 DocDispatchEx_AddRef
,
4649 DocDispatchEx_Release
,
4650 DocDispatchEx_GetTypeInfoCount
,
4651 DocDispatchEx_GetTypeInfo
,
4652 DocDispatchEx_GetIDsOfNames
,
4653 DocDispatchEx_Invoke
,
4654 DocDispatchEx_GetDispID
,
4655 DocDispatchEx_InvokeEx
,
4656 DocDispatchEx_DeleteMemberByName
,
4657 DocDispatchEx_DeleteMemberByDispID
,
4658 DocDispatchEx_GetMemberProperties
,
4659 DocDispatchEx_GetMemberName
,
4660 DocDispatchEx_GetNextDispID
,
4661 DocDispatchEx_GetNameSpaceParent
4664 static inline HTMLDocument
*impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo
*iface
)
4666 return CONTAINING_RECORD(iface
, HTMLDocument
, IProvideMultipleClassInfo_iface
);
4669 static HRESULT WINAPI
ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo
*iface
,
4670 REFIID riid
, void **ppv
)
4672 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4673 return htmldoc_query_interface(This
, riid
, ppv
);
4676 static ULONG WINAPI
ProvideClassInfo_AddRef(IProvideMultipleClassInfo
*iface
)
4678 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4679 return htmldoc_addref(This
);
4682 static ULONG WINAPI
ProvideClassInfo_Release(IProvideMultipleClassInfo
*iface
)
4684 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4685 return htmldoc_release(This
);
4688 static HRESULT WINAPI
ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo
*iface
, ITypeInfo
**ppTI
)
4690 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4691 TRACE("(%p)->(%p)\n", This
, ppTI
);
4692 return get_class_typeinfo(&CLSID_HTMLDocument
, ppTI
);
4695 static HRESULT WINAPI
ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo
*iface
, DWORD dwGuidKind
, GUID
*pGUID
)
4697 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4698 FIXME("(%p)->(%u %p)\n", This
, dwGuidKind
, pGUID
);
4702 static HRESULT WINAPI
ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo
*iface
, ULONG
*pcti
)
4704 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4705 FIXME("(%p)->(%p)\n", This
, pcti
);
4710 static HRESULT WINAPI
ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo
*iface
, ULONG iti
,
4711 DWORD dwFlags
, ITypeInfo
**pptiCoClass
, DWORD
*pdwTIFlags
, ULONG
*pcdispidReserved
, IID
*piidPrimary
, IID
*piidSource
)
4713 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4714 FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This
, iti
, dwFlags
, pptiCoClass
, pdwTIFlags
, pcdispidReserved
, piidPrimary
, piidSource
);
4718 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl
= {
4719 ProvideClassInfo_QueryInterface
,
4720 ProvideClassInfo_AddRef
,
4721 ProvideClassInfo_Release
,
4722 ProvideClassInfo_GetClassInfo
,
4723 ProvideClassInfo2_GetGUID
,
4724 ProvideMultipleClassInfo_GetMultiTypeInfoCount
,
4725 ProvideMultipleClassInfo_GetInfoOfIndex
4728 static BOOL
htmldoc_qi(HTMLDocument
*This
, REFIID riid
, void **ppv
)
4732 if(IsEqualGUID(&IID_IUnknown
, riid
))
4733 *ppv
= &This
->IHTMLDocument2_iface
;
4734 else if(IsEqualGUID(&IID_IDispatch
, riid
))
4735 *ppv
= &This
->IDispatchEx_iface
;
4736 else if(IsEqualGUID(&IID_IDispatchEx
, riid
))
4737 *ppv
= &This
->IDispatchEx_iface
;
4738 else if(IsEqualGUID(&IID_IHTMLDocument
, riid
))
4739 *ppv
= &This
->IHTMLDocument2_iface
;
4740 else if(IsEqualGUID(&IID_IHTMLDocument2
, riid
))
4741 *ppv
= &This
->IHTMLDocument2_iface
;
4742 else if(IsEqualGUID(&IID_IHTMLDocument3
, riid
))
4743 *ppv
= &This
->IHTMLDocument3_iface
;
4744 else if(IsEqualGUID(&IID_IHTMLDocument4
, riid
))
4745 *ppv
= &This
->IHTMLDocument4_iface
;
4746 else if(IsEqualGUID(&IID_IHTMLDocument5
, riid
))
4747 *ppv
= &This
->IHTMLDocument5_iface
;
4748 else if(IsEqualGUID(&IID_IHTMLDocument6
, riid
))
4749 *ppv
= &This
->IHTMLDocument6_iface
;
4750 else if(IsEqualGUID(&IID_IHTMLDocument7
, riid
))
4751 *ppv
= &This
->IHTMLDocument7_iface
;
4752 else if(IsEqualGUID(&IID_IDocumentSelector
, riid
))
4753 *ppv
= &This
->IDocumentSelector_iface
;
4754 else if(IsEqualGUID(&IID_IDocumentEvent
, riid
))
4755 *ppv
= &This
->IDocumentEvent_iface
;
4756 else if(IsEqualGUID(&IID_IPersist
, riid
))
4757 *ppv
= &This
->IPersistFile_iface
;
4758 else if(IsEqualGUID(&IID_IPersistMoniker
, riid
))
4759 *ppv
= &This
->IPersistMoniker_iface
;
4760 else if(IsEqualGUID(&IID_IPersistFile
, riid
))
4761 *ppv
= &This
->IPersistFile_iface
;
4762 else if(IsEqualGUID(&IID_IMonikerProp
, riid
))
4763 *ppv
= &This
->IMonikerProp_iface
;
4764 else if(IsEqualGUID(&IID_IOleObject
, riid
))
4765 *ppv
= &This
->IOleObject_iface
;
4766 else if(IsEqualGUID(&IID_IOleDocument
, riid
))
4767 *ppv
= &This
->IOleDocument_iface
;
4768 else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
))
4769 *ppv
= &This
->IOleInPlaceActiveObject_iface
;
4770 else if(IsEqualGUID(&IID_IOleWindow
, riid
))
4771 *ppv
= &This
->IOleInPlaceActiveObject_iface
;
4772 else if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
))
4773 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
4774 else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
))
4775 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
4776 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
4777 *ppv
= &This
->IServiceProvider_iface
;
4778 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
4779 *ppv
= &This
->IOleCommandTarget_iface
;
4780 else if(IsEqualGUID(&IID_IOleControl
, riid
))
4781 *ppv
= &This
->IOleControl_iface
;
4782 else if(IsEqualGUID(&IID_IHlinkTarget
, riid
))
4783 *ppv
= &This
->IHlinkTarget_iface
;
4784 else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
))
4785 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
4786 else if(IsEqualGUID(&IID_IPersistStreamInit
, riid
))
4787 *ppv
= &This
->IPersistStreamInit_iface
;
4788 else if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
))
4789 *ppv
= &This
->IHTMLDocument2_iface
;
4790 else if(IsEqualGUID(&IID_ISupportErrorInfo
, riid
))
4791 *ppv
= &This
->ISupportErrorInfo_iface
;
4792 else if(IsEqualGUID(&IID_IPersistHistory
, riid
))
4793 *ppv
= &This
->IPersistHistory_iface
;
4794 else if(IsEqualGUID(&IID_IObjectWithSite
, riid
))
4795 *ppv
= &This
->IObjectWithSite_iface
;
4796 else if(IsEqualGUID(&IID_IOleContainer
, riid
))
4797 *ppv
= &This
->IOleContainer_iface
;
4798 else if(IsEqualGUID(&IID_IObjectSafety
, riid
))
4799 *ppv
= &This
->IObjectSafety_iface
;
4800 else if(IsEqualGUID(&IID_IProvideClassInfo
, riid
))
4801 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
4802 else if(IsEqualGUID(&IID_IProvideClassInfo2
, riid
))
4803 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
4804 else if(IsEqualGUID(&IID_IProvideMultipleClassInfo
, riid
))
4805 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
4806 else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
4807 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppv
);
4809 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
4810 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppv
);
4812 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
4813 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppv
);
4815 }else if(IsEqualGUID(&IID_IExternalConnection
, riid
)) {
4816 TRACE("(%p)->(IID_IExternalConnection %p) returning NULL\n", This
, ppv
);
4818 }else if(IsEqualGUID(&IID_IStdMarshalInfo
, riid
)) {
4819 TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This
, ppv
);
4826 IUnknown_AddRef((IUnknown
*)*ppv
);
4830 static cp_static_data_t HTMLDocumentEvents_data
= { HTMLDocumentEvents_tid
, HTMLDocument_on_advise
};
4832 static const cpc_entry_t HTMLDocument_cpc
[] = {
4833 {&IID_IDispatch
, &HTMLDocumentEvents_data
},
4834 {&IID_IPropertyNotifySink
},
4835 {&DIID_HTMLDocumentEvents
, &HTMLDocumentEvents_data
},
4836 {&DIID_HTMLDocumentEvents2
},
4840 static void init_doc(HTMLDocument
*doc
, IUnknown
*outer
, IDispatchEx
*dispex
)
4842 doc
->IHTMLDocument2_iface
.lpVtbl
= &HTMLDocumentVtbl
;
4843 doc
->IHTMLDocument3_iface
.lpVtbl
= &HTMLDocument3Vtbl
;
4844 doc
->IHTMLDocument4_iface
.lpVtbl
= &HTMLDocument4Vtbl
;
4845 doc
->IHTMLDocument5_iface
.lpVtbl
= &HTMLDocument5Vtbl
;
4846 doc
->IHTMLDocument6_iface
.lpVtbl
= &HTMLDocument6Vtbl
;
4847 doc
->IHTMLDocument7_iface
.lpVtbl
= &HTMLDocument7Vtbl
;
4848 doc
->IDispatchEx_iface
.lpVtbl
= &DocDispatchExVtbl
;
4849 doc
->IDocumentSelector_iface
.lpVtbl
= &DocumentSelectorVtbl
;
4850 doc
->IDocumentEvent_iface
.lpVtbl
= &DocumentEventVtbl
;
4851 doc
->ISupportErrorInfo_iface
.lpVtbl
= &SupportErrorInfoVtbl
;
4852 doc
->IProvideMultipleClassInfo_iface
.lpVtbl
= &ProvideMultipleClassInfoVtbl
;
4854 doc
->outer_unk
= outer
;
4855 doc
->dispex
= dispex
;
4857 HTMLDocument_Persist_Init(doc
);
4858 HTMLDocument_OleCmd_Init(doc
);
4859 HTMLDocument_OleObj_Init(doc
);
4860 HTMLDocument_Service_Init(doc
);
4862 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)&doc
->IHTMLDocument2_iface
, HTMLDocument_cpc
);
4865 static inline HTMLDocumentNode
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
4867 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
);
4870 static HRESULT
HTMLDocumentNode_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
4872 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4874 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4876 if(htmldoc_qi(&This
->basedoc
, riid
, ppv
))
4877 return *ppv
? S_OK
: E_NOINTERFACE
;
4879 if(IsEqualGUID(&IID_IInternetHostSecurityManager
, riid
))
4880 *ppv
= &This
->IInternetHostSecurityManager_iface
;
4882 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
4884 IUnknown_AddRef((IUnknown
*)*ppv
);
4888 static void HTMLDocumentNode_destructor(HTMLDOMNode
*iface
)
4890 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4893 for(i
=0; i
< This
->elem_vars_cnt
; i
++)
4894 heap_free(This
->elem_vars
[i
]);
4895 heap_free(This
->elem_vars
);
4897 detach_events(This
);
4899 ICatInformation_Release(This
->catmgr
);
4901 detach_selection(This
);
4902 detach_ranges(This
);
4904 while(!list_empty(&This
->plugin_hosts
))
4905 detach_plugin_host(LIST_ENTRY(list_head(&This
->plugin_hosts
), PluginHost
, entry
));
4907 if(!This
->nsdoc
&& This
->window
) {
4908 /* document fragments own reference to inner window */
4909 IHTMLWindow2_Release(&This
->window
->base
.IHTMLWindow2_iface
);
4910 This
->window
= NULL
;
4913 heap_free(This
->event_vector
);
4914 ConnectionPointContainer_Destroy(&This
->basedoc
.cp_container
);
4917 static HRESULT
HTMLDocumentNode_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
4919 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4920 FIXME("%p\n", This
);
4924 static void HTMLDocumentNode_traverse(HTMLDOMNode
*iface
, nsCycleCollectionTraversalCallback
*cb
)
4926 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4929 note_cc_edge((nsISupports
*)This
->nsdoc
, "This->nsdoc", cb
);
4932 static void HTMLDocumentNode_unlink(HTMLDOMNode
*iface
)
4934 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4937 nsIDOMHTMLDocument
*nsdoc
= This
->nsdoc
;
4939 release_document_mutation(This
);
4941 nsIDOMHTMLDocument_Release(nsdoc
);
4942 This
->window
= NULL
;
4946 static const NodeImplVtbl HTMLDocumentNodeImplVtbl
= {
4947 &CLSID_HTMLDocument
,
4948 HTMLDocumentNode_QI
,
4949 HTMLDocumentNode_destructor
,
4951 HTMLDocumentNode_clone
,
4962 HTMLDocumentNode_traverse
,
4963 HTMLDocumentNode_unlink
4966 static HRESULT
HTMLDocumentFragment_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
4968 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4969 HTMLDocumentNode
*new_node
;
4972 hres
= create_document_fragment(nsnode
, This
->node
.doc
, &new_node
);
4976 *ret
= &new_node
->node
;
4980 static inline HTMLDocumentNode
*impl_from_DispatchEx(DispatchEx
*iface
)
4982 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
.event_target
.dispex
);
4985 static HRESULT
HTMLDocumentNode_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
4986 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
4988 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
4989 nsIDOMNodeList
*node_list
;
4997 if(flags
!= DISPATCH_PROPERTYGET
&& flags
!= (DISPATCH_METHOD
|DISPATCH_PROPERTYGET
)) {
4998 FIXME("unsupported flags %x\n", flags
);
5002 i
= id
- MSHTML_DISPID_CUSTOM_MIN
;
5004 if(!This
->nsdoc
|| i
>= This
->elem_vars_cnt
)
5005 return DISP_E_UNKNOWNNAME
;
5007 nsAString_InitDepend(&name_str
, This
->elem_vars
[i
]);
5008 nsres
= nsIDOMHTMLDocument_GetElementsByName(This
->nsdoc
, &name_str
, &node_list
);
5009 nsAString_Finish(&name_str
);
5010 if(NS_FAILED(nsres
))
5013 nsres
= nsIDOMNodeList_Item(node_list
, 0, &nsnode
);
5014 nsIDOMNodeList_Release(node_list
);
5015 if(NS_FAILED(nsres
) || !nsnode
)
5016 return DISP_E_UNKNOWNNAME
;
5018 hres
= get_node(nsnode
, TRUE
, &node
);
5022 V_VT(res
) = VT_DISPATCH
;
5023 V_DISPATCH(res
) = (IDispatch
*)&node
->IHTMLDOMNode_iface
;
5027 static compat_mode_t
HTMLDocumentNode_get_compat_mode(DispatchEx
*dispex
)
5029 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5031 TRACE("(%p) returning %u\n", This
, This
->document_mode
);
5033 return lock_document_mode(This
);
5036 static nsISupports
*HTMLDocumentNode_get_gecko_target(DispatchEx
*dispex
)
5038 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5039 return (nsISupports
*)This
->node
.nsnode
;
5042 static void HTMLDocumentNode_bind_event(DispatchEx
*dispex
, eventid_t eid
)
5044 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5045 ensure_doc_nsevent_handler(This
, This
->node
.nsnode
, eid
);
5048 static EventTarget
*HTMLDocumentNode_get_parent_event_target(DispatchEx
*dispex
)
5050 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5053 IHTMLWindow2_AddRef(&This
->window
->base
.IHTMLWindow2_iface
);
5054 return &This
->window
->event_target
;
5057 static ConnectionPointContainer
*HTMLDocumentNode_get_cp_container(DispatchEx
*dispex
)
5059 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5060 ConnectionPointContainer
*container
= This
->basedoc
.doc_obj
5061 ? &This
->basedoc
.doc_obj
->basedoc
.cp_container
: &This
->basedoc
.cp_container
;
5062 IConnectionPointContainer_AddRef(&container
->IConnectionPointContainer_iface
);
5066 static IHTMLEventObj
*HTMLDocumentNode_set_current_event(DispatchEx
*dispex
, IHTMLEventObj
*event
)
5068 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5069 return default_set_current_event(This
->window
, event
);
5072 static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl
= {
5076 HTMLDocumentNode_invoke
,
5077 HTMLDocumentNode_get_compat_mode
,
5080 HTMLDocumentNode_get_gecko_target
,
5081 HTMLDocumentNode_bind_event
,
5082 HTMLDocumentNode_get_parent_event_target
,
5084 HTMLDocumentNode_get_cp_container
,
5085 HTMLDocumentNode_set_current_event
5088 static const NodeImplVtbl HTMLDocumentFragmentImplVtbl
= {
5089 &CLSID_HTMLDocument
,
5090 HTMLDocumentNode_QI
,
5091 HTMLDocumentNode_destructor
,
5093 HTMLDocumentFragment_clone
5096 static const tid_t HTMLDocumentNode_iface_tids
[] = {
5102 IDocumentSelector_tid
,
5106 static void HTMLDocumentNode_init_dispex_info(dispex_data_t
*info
, compat_mode_t mode
)
5108 HTMLDOMNode_init_dispex_info(info
, mode
);
5110 if(mode
>= COMPAT_MODE_IE9
) {
5111 dispex_info_add_interface(info
, IHTMLDocument7_tid
, NULL
);
5112 dispex_info_add_interface(info
, IDocumentEvent_tid
, NULL
);
5115 /* Depending on compatibility version, we add interfaces in different order
5116 * so that the right getElementById implementation is used. */
5117 if(mode
< COMPAT_MODE_IE8
) {
5118 dispex_info_add_interface(info
, IHTMLDocument3_tid
, NULL
);
5119 dispex_info_add_interface(info
, IHTMLDocument6_tid
, NULL
);
5121 dispex_info_add_interface(info
, IHTMLDocument6_tid
, NULL
);
5122 dispex_info_add_interface(info
, IHTMLDocument3_tid
, NULL
);
5126 static dispex_static_data_t HTMLDocumentNode_dispex
= {
5127 &HTMLDocumentNode_event_target_vtbl
.dispex_vtbl
,
5128 DispHTMLDocument_tid
,
5129 HTMLDocumentNode_iface_tids
,
5130 HTMLDocumentNode_init_dispex_info
5133 static HTMLDocumentNode
*alloc_doc_node(HTMLDocumentObj
*doc_obj
, HTMLInnerWindow
*window
)
5135 HTMLDocumentNode
*doc
;
5137 doc
= heap_alloc_zero(sizeof(HTMLDocumentNode
));
5142 doc
->basedoc
.doc_node
= doc
;
5143 doc
->basedoc
.doc_obj
= doc_obj
;
5144 doc
->basedoc
.window
= window
->base
.outer_window
;
5145 doc
->window
= window
;
5147 init_doc(&doc
->basedoc
, (IUnknown
*)&doc
->node
.IHTMLDOMNode_iface
,
5148 &doc
->node
.event_target
.dispex
.IDispatchEx_iface
);
5149 HTMLDocumentNode_SecMgr_Init(doc
);
5151 list_init(&doc
->selection_list
);
5152 list_init(&doc
->range_list
);
5153 list_init(&doc
->plugin_hosts
);
5158 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*nsdoc
, HTMLDocumentObj
*doc_obj
, HTMLInnerWindow
*window
, HTMLDocumentNode
**ret
)
5160 HTMLDocumentNode
*doc
;
5162 doc
= alloc_doc_node(doc_obj
, window
);
5164 return E_OUTOFMEMORY
;
5166 if(window
->base
.outer_window
->parent
) {
5167 compat_mode_t parent_mode
= window
->base
.outer_window
->parent
->base
.inner_window
->doc
->document_mode
;
5168 TRACE("parent mode %u\n", parent_mode
);
5169 if(parent_mode
>= COMPAT_MODE_IE9
) {
5170 doc
->document_mode
= parent_mode
;
5171 lock_document_mode(doc
);
5175 if(!doc_obj
->basedoc
.window
|| window
->base
.outer_window
== doc_obj
->basedoc
.window
)
5176 doc
->basedoc
.cp_container
.forward_container
= &doc_obj
->basedoc
.cp_container
;
5178 HTMLDOMNode_Init(doc
, &doc
->node
, (nsIDOMNode
*)nsdoc
, &HTMLDocumentNode_dispex
);
5180 nsIDOMHTMLDocument_AddRef(nsdoc
);
5183 init_document_mutation(doc
);
5184 doc_init_events(doc
);
5186 doc
->node
.vtbl
= &HTMLDocumentNodeImplVtbl
;
5192 static HRESULT
create_document_fragment(nsIDOMNode
*nsnode
, HTMLDocumentNode
*doc_node
, HTMLDocumentNode
**ret
)
5194 HTMLDocumentNode
*doc_frag
;
5196 doc_frag
= alloc_doc_node(doc_node
->basedoc
.doc_obj
, doc_node
->window
);
5198 return E_OUTOFMEMORY
;
5200 IHTMLWindow2_AddRef(&doc_frag
->window
->base
.IHTMLWindow2_iface
);
5202 HTMLDOMNode_Init(doc_node
, &doc_frag
->node
, nsnode
, &HTMLDocumentNode_dispex
);
5203 doc_frag
->node
.vtbl
= &HTMLDocumentFragmentImplVtbl
;
5204 doc_frag
->document_mode
= lock_document_mode(doc_node
);
5210 HRESULT
get_document_node(nsIDOMDocument
*dom_document
, HTMLDocumentNode
**ret
)
5215 hres
= get_node((nsIDOMNode
*)dom_document
, FALSE
, &node
);
5220 ERR("document not initialized\n");
5224 assert(node
->vtbl
== &HTMLDocumentNodeImplVtbl
);
5225 *ret
= impl_from_HTMLDOMNode(node
);
5229 static inline HTMLDocumentObj
*impl_from_IUnknown(IUnknown
*iface
)
5231 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IUnknown_outer
);
5234 static HRESULT WINAPI
HTMLDocumentObj_QueryInterface(IUnknown
*iface
, REFIID riid
, void **ppv
)
5236 HTMLDocumentObj
*This
= impl_from_IUnknown(iface
);
5238 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
5240 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
5241 *ppv
= &This
->IUnknown_outer
;
5242 }else if(htmldoc_qi(&This
->basedoc
, riid
, ppv
)) {
5243 return *ppv
? S_OK
: E_NOINTERFACE
;
5244 }else if(IsEqualGUID(&IID_ICustomDoc
, riid
)) {
5245 *ppv
= &This
->ICustomDoc_iface
;
5246 }else if(IsEqualGUID(&IID_IOleDocumentView
, riid
)) {
5247 *ppv
= &This
->IOleDocumentView_iface
;
5248 }else if(IsEqualGUID(&IID_IViewObject
, riid
)) {
5249 *ppv
= &This
->IViewObjectEx_iface
;
5250 }else if(IsEqualGUID(&IID_IViewObject2
, riid
)) {
5251 *ppv
= &This
->IViewObjectEx_iface
;
5252 }else if(IsEqualGUID(&IID_IViewObjectEx
, riid
)) {
5253 *ppv
= &This
->IViewObjectEx_iface
;
5254 }else if(IsEqualGUID(&IID_ITargetContainer
, riid
)) {
5255 *ppv
= &This
->ITargetContainer_iface
;
5256 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
5257 return *ppv
? S_OK
: E_NOINTERFACE
;
5259 FIXME("Unimplemented interface %s\n", debugstr_mshtml_guid(riid
));
5261 return E_NOINTERFACE
;
5264 IUnknown_AddRef((IUnknown
*)*ppv
);
5268 static ULONG WINAPI
HTMLDocumentObj_AddRef(IUnknown
*iface
)
5270 HTMLDocumentObj
*This
= impl_from_IUnknown(iface
);
5271 ULONG ref
= InterlockedIncrement(&This
->ref
);
5273 TRACE("(%p) ref = %u\n", This
, ref
);
5278 static ULONG WINAPI
HTMLDocumentObj_Release(IUnknown
*iface
)
5280 HTMLDocumentObj
*This
= impl_from_IUnknown(iface
);
5281 ULONG ref
= InterlockedDecrement(&This
->ref
);
5283 TRACE("(%p) ref = %u\n", This
, ref
);
5286 nsIDOMWindowUtils
*window_utils
= NULL
;
5288 if(This
->basedoc
.window
&& This
->basedoc
.window
->nswindow
)
5289 get_nsinterface((nsISupports
*)This
->basedoc
.window
->nswindow
, &IID_nsIDOMWindowUtils
, (void**)&window_utils
);
5291 if(This
->basedoc
.doc_node
) {
5292 This
->basedoc
.doc_node
->basedoc
.doc_obj
= NULL
;
5293 htmldoc_release(&This
->basedoc
.doc_node
->basedoc
);
5295 if(This
->basedoc
.window
) {
5296 This
->basedoc
.window
->doc_obj
= NULL
;
5297 IHTMLWindow2_Release(&This
->basedoc
.window
->base
.IHTMLWindow2_iface
);
5299 if(This
->advise_holder
)
5300 IOleAdviseHolder_Release(This
->advise_holder
);
5303 IAdviseSink_Release(This
->view_sink
);
5305 IOleObject_SetClientSite(&This
->basedoc
.IOleObject_iface
, NULL
);
5307 ICustomDoc_SetUIHandler(&This
->ICustomDoc_iface
, NULL
);
5308 if(This
->in_place_active
)
5309 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->basedoc
.IOleInPlaceObjectWindowless_iface
);
5311 IOleDocumentView_SetInPlaceSite(&This
->IOleDocumentView_iface
, NULL
);
5313 IOleUndoManager_Release(This
->undomgr
);
5315 IHTMLEditServices_Release(This
->editsvcs
);
5316 if(This
->tooltips_hwnd
)
5317 DestroyWindow(This
->tooltips_hwnd
);
5320 DestroyWindow(This
->hwnd
);
5321 heap_free(This
->mime
);
5323 remove_target_tasks(This
->task_magic
);
5324 ConnectionPointContainer_Destroy(&This
->basedoc
.cp_container
);
5325 release_dispex(&This
->dispex
);
5327 if(This
->nscontainer
)
5328 NSContainer_Release(This
->nscontainer
);
5331 /* Force cycle collection */
5333 nsIDOMWindowUtils_CycleCollect(window_utils
, NULL
, 0);
5334 nsIDOMWindowUtils_Release(window_utils
);
5341 static const IUnknownVtbl HTMLDocumentObjVtbl
= {
5342 HTMLDocumentObj_QueryInterface
,
5343 HTMLDocumentObj_AddRef
,
5344 HTMLDocumentObj_Release
5347 /**********************************************************
5348 * ICustomDoc implementation
5351 static inline HTMLDocumentObj
*impl_from_ICustomDoc(ICustomDoc
*iface
)
5353 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, ICustomDoc_iface
);
5356 static HRESULT WINAPI
CustomDoc_QueryInterface(ICustomDoc
*iface
, REFIID riid
, void **ppv
)
5358 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5360 return htmldoc_query_interface(&This
->basedoc
, riid
, ppv
);
5363 static ULONG WINAPI
CustomDoc_AddRef(ICustomDoc
*iface
)
5365 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5367 return htmldoc_addref(&This
->basedoc
);
5370 static ULONG WINAPI
CustomDoc_Release(ICustomDoc
*iface
)
5372 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5374 return htmldoc_release(&This
->basedoc
);
5377 static HRESULT WINAPI
CustomDoc_SetUIHandler(ICustomDoc
*iface
, IDocHostUIHandler
*pUIHandler
)
5379 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5380 IOleCommandTarget
*cmdtrg
;
5383 TRACE("(%p)->(%p)\n", This
, pUIHandler
);
5385 if(This
->custom_hostui
&& This
->hostui
== pUIHandler
)
5388 This
->custom_hostui
= TRUE
;
5391 IDocHostUIHandler_Release(This
->hostui
);
5393 IDocHostUIHandler_AddRef(pUIHandler
);
5394 This
->hostui
= pUIHandler
;
5398 hres
= IDocHostUIHandler_QueryInterface(pUIHandler
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5399 if(SUCCEEDED(hres
)) {
5400 FIXME("custom UI handler supports IOleCommandTarget\n");
5401 IOleCommandTarget_Release(cmdtrg
);
5407 static const ICustomDocVtbl CustomDocVtbl
= {
5408 CustomDoc_QueryInterface
,
5411 CustomDoc_SetUIHandler
5414 static const tid_t HTMLDocumentObj_iface_tids
[] = {
5421 static dispex_static_data_t HTMLDocumentObj_dispex
= {
5423 DispHTMLDocument_tid
,
5424 HTMLDocumentObj_iface_tids
5427 static HRESULT
create_document_object(BOOL is_mhtml
, IUnknown
*outer
, REFIID riid
, void **ppv
)
5429 mozIDOMWindowProxy
*mozwindow
;
5430 HTMLDocumentObj
*doc
;
5431 nsIDOMWindow
*nswindow
= NULL
;
5435 if(outer
&& !IsEqualGUID(&IID_IUnknown
, riid
)) {
5437 return E_INVALIDARG
;
5440 doc
= heap_alloc_zero(sizeof(HTMLDocumentObj
));
5442 return E_OUTOFMEMORY
;
5445 doc
->IUnknown_outer
.lpVtbl
= &HTMLDocumentObjVtbl
;
5446 doc
->ICustomDoc_iface
.lpVtbl
= &CustomDocVtbl
;
5448 init_dispex(&doc
->dispex
, (IUnknown
*)&doc
->ICustomDoc_iface
, &HTMLDocumentObj_dispex
);
5449 init_doc(&doc
->basedoc
, outer
? outer
: &doc
->IUnknown_outer
, &doc
->dispex
.IDispatchEx_iface
);
5450 TargetContainer_Init(doc
);
5451 doc
->basedoc
.doc_obj
= doc
;
5452 doc
->is_mhtml
= is_mhtml
;
5454 doc
->usermode
= UNKNOWN_USERMODE
;
5455 doc
->task_magic
= get_task_target_magic();
5457 HTMLDocument_View_Init(doc
);
5459 hres
= create_nscontainer(doc
, &doc
->nscontainer
);
5461 ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n");
5462 htmldoc_release(&doc
->basedoc
);
5466 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
5467 *ppv
= &doc
->IUnknown_outer
;
5469 hres
= htmldoc_query_interface(&doc
->basedoc
, riid
, ppv
);
5470 htmldoc_release(&doc
->basedoc
);
5475 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &mozwindow
);
5476 if(NS_FAILED(nsres
))
5477 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
5479 nsres
= mozIDOMWindowProxy_QueryInterface(mozwindow
, &IID_nsIDOMWindow
, (void**)&nswindow
);
5480 mozIDOMWindowProxy_Release(mozwindow
);
5481 assert(nsres
== NS_OK
);
5483 hres
= HTMLOuterWindow_Create(doc
, nswindow
, NULL
/* FIXME */, &doc
->basedoc
.window
);
5485 nsIDOMWindow_Release(nswindow
);
5487 htmldoc_release(&doc
->basedoc
);
5491 if(!doc
->basedoc
.doc_node
&& doc
->basedoc
.window
->base
.inner_window
->doc
) {
5492 doc
->basedoc
.doc_node
= doc
->basedoc
.window
->base
.inner_window
->doc
;
5493 htmldoc_addref(&doc
->basedoc
.doc_node
->basedoc
);
5501 HRESULT
HTMLDocument_Create(IUnknown
*outer
, REFIID riid
, void **ppv
)
5503 TRACE("(%p %s %p)\n", outer
, debugstr_mshtml_guid(riid
), ppv
);
5504 return create_document_object(FALSE
, outer
, riid
, ppv
);
5507 HRESULT
MHTMLDocument_Create(IUnknown
*outer
, REFIID riid
, void **ppv
)
5509 TRACE("(%p %s %p)\n", outer
, debugstr_mshtml_guid(riid
), ppv
);
5510 return create_document_object(TRUE
, outer
, riid
, ppv
);