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_elem(doc
, 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(This
->doc_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
;
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_node(This
->doc_node
, (nsIDOMNode
*)nsbody
, TRUE
, &node
);
285 nsIDOMHTMLElement_Release(nsbody
);
289 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)p
);
294 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
296 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
297 nsIDOMElement
*nselem
;
302 TRACE("(%p)->(%p)\n", This
, p
);
304 if(!This
->doc_node
->nsdoc
) {
310 * NOTE: Gecko may return an active element even if the document is not visible.
311 * IE returns NULL in this case.
313 nsres
= nsIDOMHTMLDocument_GetActiveElement(This
->doc_node
->nsdoc
, &nselem
);
314 if(NS_FAILED(nsres
)) {
315 ERR("GetActiveElement failed: %08x\n", nsres
);
324 hres
= get_elem(This
->doc_node
, nselem
, &elem
);
325 nsIDOMElement_Release(nselem
);
329 *p
= &elem
->IHTMLElement_iface
;
333 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
335 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
336 nsIDOMHTMLCollection
*nscoll
= NULL
;
339 TRACE("(%p)->(%p)\n", This
, p
);
346 if(!This
->doc_node
->nsdoc
) {
347 WARN("NULL nsdoc\n");
351 nsres
= nsIDOMHTMLDocument_GetImages(This
->doc_node
->nsdoc
, &nscoll
);
352 if(NS_FAILED(nsres
)) {
353 ERR("GetImages failed: %08x\n", nsres
);
358 *p
= create_collection_from_htmlcol(This
->doc_node
, nscoll
);
359 nsIDOMHTMLCollection_Release(nscoll
);
365 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
367 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
368 nsIDOMHTMLCollection
*nscoll
= NULL
;
371 TRACE("(%p)->(%p)\n", This
, p
);
378 if(!This
->doc_node
->nsdoc
) {
379 WARN("NULL nsdoc\n");
383 nsres
= nsIDOMHTMLDocument_GetApplets(This
->doc_node
->nsdoc
, &nscoll
);
384 if(NS_FAILED(nsres
)) {
385 ERR("GetApplets failed: %08x\n", nsres
);
390 *p
= create_collection_from_htmlcol(This
->doc_node
, nscoll
);
391 nsIDOMHTMLCollection_Release(nscoll
);
397 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
399 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
400 nsIDOMHTMLCollection
*nscoll
= NULL
;
403 TRACE("(%p)->(%p)\n", This
, p
);
410 if(!This
->doc_node
->nsdoc
) {
411 WARN("NULL nsdoc\n");
415 nsres
= nsIDOMHTMLDocument_GetLinks(This
->doc_node
->nsdoc
, &nscoll
);
416 if(NS_FAILED(nsres
)) {
417 ERR("GetLinks failed: %08x\n", nsres
);
422 *p
= create_collection_from_htmlcol(This
->doc_node
, nscoll
);
423 nsIDOMHTMLCollection_Release(nscoll
);
429 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
431 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
432 nsIDOMHTMLCollection
*nscoll
= NULL
;
435 TRACE("(%p)->(%p)\n", This
, p
);
442 if(!This
->doc_node
->nsdoc
) {
443 WARN("NULL nsdoc\n");
447 nsres
= nsIDOMHTMLDocument_GetForms(This
->doc_node
->nsdoc
, &nscoll
);
448 if(NS_FAILED(nsres
)) {
449 ERR("GetForms failed: %08x\n", nsres
);
454 *p
= create_collection_from_htmlcol(This
->doc_node
, nscoll
);
455 nsIDOMHTMLCollection_Release(nscoll
);
461 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
463 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
464 nsIDOMHTMLCollection
*nscoll
= NULL
;
467 TRACE("(%p)->(%p)\n", This
, p
);
474 if(!This
->doc_node
->nsdoc
) {
475 WARN("NULL nsdoc\n");
479 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->doc_node
->nsdoc
, &nscoll
);
480 if(NS_FAILED(nsres
)) {
481 ERR("GetAnchors failed: %08x\n", nsres
);
486 *p
= create_collection_from_htmlcol(This
->doc_node
, nscoll
);
487 nsIDOMHTMLCollection_Release(nscoll
);
493 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
495 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
499 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
501 if(!This
->doc_node
->nsdoc
) {
502 WARN("NULL nsdoc\n");
506 nsAString_InitDepend(&nsstr
, v
);
507 nsres
= nsIDOMHTMLDocument_SetTitle(This
->doc_node
->nsdoc
, &nsstr
);
508 nsAString_Finish(&nsstr
);
510 ERR("SetTitle failed: %08x\n", nsres
);
515 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
517 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
518 const PRUnichar
*ret
;
522 TRACE("(%p)->(%p)\n", This
, p
);
524 if(!This
->doc_node
->nsdoc
) {
525 WARN("NULL nsdoc\n");
530 nsAString_Init(&nsstr
, NULL
);
531 nsres
= nsIDOMHTMLDocument_GetTitle(This
->doc_node
->nsdoc
, &nsstr
);
532 if (NS_SUCCEEDED(nsres
)) {
533 nsAString_GetData(&nsstr
, &ret
);
534 *p
= SysAllocString(ret
);
536 nsAString_Finish(&nsstr
);
538 if(NS_FAILED(nsres
)) {
539 ERR("GetTitle failed: %08x\n", nsres
);
546 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
548 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
549 nsIDOMHTMLCollection
*nscoll
= NULL
;
552 TRACE("(%p)->(%p)\n", This
, p
);
559 if(!This
->doc_node
->nsdoc
) {
560 WARN("NULL nsdoc\n");
564 nsres
= nsIDOMHTMLDocument_GetScripts(This
->doc_node
->nsdoc
, &nscoll
);
565 if(NS_FAILED(nsres
)) {
566 ERR("GetImages failed: %08x\n", nsres
);
571 *p
= create_collection_from_htmlcol(This
->doc_node
, nscoll
);
572 nsIDOMHTMLCollection_Release(nscoll
);
578 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
580 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
583 static const WCHAR onW
[] = {'o','n',0};
585 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
587 if(strcmpiW(v
, onW
)) {
588 FIXME("Unsupported arg %s\n", debugstr_w(v
));
592 hres
= setup_edit_mode(This
->doc_obj
);
596 call_property_onchanged(&This
->cp_container
, DISPID_IHTMLDOCUMENT2_DESIGNMODE
);
600 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
602 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
603 static const WCHAR szOff
[] = {'O','f','f',0};
604 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
609 *p
= SysAllocString(szOff
);
614 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
616 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
617 nsISelection
*nsselection
;
620 TRACE("(%p)->(%p)\n", This
, p
);
622 nsres
= nsIDOMWindow_GetSelection(This
->window
->nswindow
, &nsselection
);
623 if(NS_FAILED(nsres
)) {
624 ERR("GetSelection failed: %08x\n", nsres
);
628 return HTMLSelectionObject_Create(This
->doc_node
, nsselection
, p
);
631 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
633 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
636 TRACE("(%p)->(%p)\n", iface
, p
);
641 return get_readystate_string(This
->window
->readystate
, p
);
644 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
646 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
648 TRACE("(%p)->(%p)\n", This
, p
);
650 return IHTMLWindow2_get_frames(&This
->window
->base
.IHTMLWindow2_iface
, p
);
653 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
655 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
656 FIXME("(%p)->(%p)\n", This
, p
);
660 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
662 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
663 FIXME("(%p)->(%p)\n", This
, p
);
667 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
669 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
670 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
674 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
676 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
677 FIXME("(%p)->(%p)\n", This
, p
);
681 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
683 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
684 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
688 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
690 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
691 FIXME("(%p)->(%p)\n", This
, p
);
695 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
697 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
698 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
702 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
704 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
705 FIXME("(%p)->(%p)\n", This
, p
);
709 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
711 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
712 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
716 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
718 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
719 FIXME("(%p)->(%p)\n", This
, p
);
723 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
725 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
726 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
730 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
732 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
733 FIXME("(%p)->(%p)\n", This
, p
);
737 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
739 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
741 FIXME("(%p)->(%p)\n", This
, p
);
747 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
749 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
751 TRACE("(%p)->(%p)\n", This
, p
);
753 if(!This
->doc_node
->nsdoc
) {
754 WARN("NULL nsdoc\n");
758 return IHTMLWindow2_get_location(&This
->window
->base
.IHTMLWindow2_iface
, p
);
761 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
763 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
764 FIXME("(%p)->(%p)\n", This
, p
);
768 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
770 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
772 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
775 FIXME("No window available\n");
779 return navigate_url(This
->window
, v
, This
->window
->uri
, BINDING_NAVIGATED
);
782 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
784 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
786 static const WCHAR about_blank_url
[] =
787 {'a','b','o','u','t',':','b','l','a','n','k',0};
789 TRACE("(%p)->(%p)\n", iface
, p
);
791 *p
= SysAllocString(This
->window
->url
? This
->window
->url
: about_blank_url
);
792 return *p
? S_OK
: E_OUTOFMEMORY
;
795 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
797 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
801 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
803 nsAString_InitDepend(&nsstr
, v
);
804 nsres
= nsIDOMHTMLDocument_SetDomain(This
->doc_node
->nsdoc
, &nsstr
);
805 nsAString_Finish(&nsstr
);
806 if(NS_FAILED(nsres
)) {
807 ERR("SetDomain failed: %08x\n", nsres
);
814 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
816 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
820 TRACE("(%p)->(%p)\n", This
, p
);
822 nsAString_Init(&nsstr
, NULL
);
823 nsres
= nsIDOMHTMLDocument_GetDomain(This
->doc_node
->nsdoc
, &nsstr
);
824 if(NS_SUCCEEDED(nsres
) && This
->window
&& This
->window
->uri
) {
825 const PRUnichar
*str
;
828 nsAString_GetData(&nsstr
, &str
);
830 TRACE("Gecko returned empty string, fallback to loaded URL.\n");
831 nsAString_Finish(&nsstr
);
832 hres
= IUri_GetHost(This
->window
->uri
, p
);
833 return FAILED(hres
) ? hres
: S_OK
;
837 return return_nsstr(nsres
, &nsstr
, p
);
840 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
842 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
845 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
847 bret
= InternetSetCookieExW(This
->window
->url
, NULL
, v
, 0, 0);
849 FIXME("InternetSetCookieExW failed: %u\n", GetLastError());
850 return HRESULT_FROM_WIN32(GetLastError());
856 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
858 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
862 TRACE("(%p)->(%p)\n", This
, p
);
865 bret
= InternetGetCookieExW(This
->window
->url
, NULL
, NULL
, &size
, 0, NULL
);
867 switch(GetLastError()) {
868 case ERROR_INSUFFICIENT_BUFFER
:
870 case ERROR_NO_MORE_ITEMS
:
874 FIXME("InternetGetCookieExW failed: %u\n", GetLastError());
875 return HRESULT_FROM_WIN32(GetLastError());
884 *p
= SysAllocStringLen(NULL
, size
/sizeof(WCHAR
)-1);
886 return E_OUTOFMEMORY
;
888 bret
= InternetGetCookieExW(This
->window
->url
, NULL
, *p
, &size
, 0, NULL
);
890 ERR("InternetGetCookieExW failed: %u\n", GetLastError());
897 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
899 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
900 FIXME("(%p)->(%x)\n", This
, v
);
904 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
906 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
907 FIXME("(%p)->(%p)\n", This
, p
);
911 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
913 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
914 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
918 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
920 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
922 TRACE("(%p)->(%p)\n", This
, p
);
924 return IHTMLDocument7_get_characterSet(&This
->IHTMLDocument7_iface
, p
);
927 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
929 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
930 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
934 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
936 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
938 TRACE("(%p)->(%p)\n", This
, p
);
940 *p
= charset_string_from_cp(GetACP());
941 return *p
? S_OK
: E_OUTOFMEMORY
;
944 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
946 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
947 FIXME("(%p)->(%p)\n", This
, p
);
951 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
953 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
954 FIXME("(%p)->(%p)\n", This
, p
);
958 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
960 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
961 FIXME("(%p)->(%p)\n", This
, p
);
965 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
967 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
968 FIXME("(%p)->(%p)\n", This
, p
);
972 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
974 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
975 FIXME("(%p)->(%p)\n", This
, p
);
979 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
981 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
982 FIXME("(%p)->(%p)\n", This
, p
);
986 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
988 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
989 FIXME("(%p)->(%p)\n", This
, p
);
993 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
995 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
996 FIXME("(%p)->(%p)\n", This
, p
);
1000 static HRESULT
document_write(HTMLDocument
*This
, SAFEARRAY
*psarray
, BOOL ln
)
1009 if(!This
->doc_node
->nsdoc
) {
1010 WARN("NULL nsdoc\n");
1011 return E_UNEXPECTED
;
1017 if(psarray
->cDims
!= 1) {
1018 FIXME("cDims=%d\n", psarray
->cDims
);
1019 return E_INVALIDARG
;
1022 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
1024 WARN("SafeArrayAccessData failed: %08x\n", hres
);
1028 V_VT(&tmp
) = VT_EMPTY
;
1030 jsctx
= get_context_from_document(This
->doc_node
->nsdoc
);
1031 argc
= psarray
->rgsabound
[0].cElements
;
1032 for(i
=0; i
< argc
; i
++) {
1033 if(V_VT(var
+i
) == VT_BSTR
) {
1034 nsAString_InitDepend(&nsstr
, V_BSTR(var
+i
));
1036 hres
= VariantChangeTypeEx(&tmp
, var
+i
, MAKELCID(MAKELANGID(LANG_ENGLISH
,SUBLANG_ENGLISH_US
),SORT_DEFAULT
), 0, VT_BSTR
);
1038 WARN("Could not convert %s to string\n", debugstr_variant(var
+i
));
1041 nsAString_InitDepend(&nsstr
, V_BSTR(&tmp
));
1044 if(!ln
|| i
!= argc
-1)
1045 nsres
= nsIDOMHTMLDocument_Write(This
->doc_node
->nsdoc
, &nsstr
, jsctx
);
1047 nsres
= nsIDOMHTMLDocument_Writeln(This
->doc_node
->nsdoc
, &nsstr
, jsctx
);
1048 nsAString_Finish(&nsstr
);
1049 if(V_VT(var
+i
) != VT_BSTR
)
1051 if(NS_FAILED(nsres
)) {
1052 ERR("Write failed: %08x\n", nsres
);
1058 SafeArrayUnaccessData(psarray
);
1063 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
1065 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1067 TRACE("(%p)->(%p)\n", iface
, psarray
);
1069 return document_write(This
, psarray
, FALSE
);
1072 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
1074 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1076 TRACE("(%p)->(%p)\n", This
, psarray
);
1078 return document_write(This
, psarray
, TRUE
);
1081 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
1082 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
1084 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1088 static const WCHAR text_htmlW
[] = {'t','e','x','t','/','h','t','m','l',0};
1090 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
1091 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
1093 if(!This
->doc_node
->nsdoc
) {
1098 if(!url
|| strcmpW(url
, text_htmlW
) || V_VT(&name
) != VT_ERROR
1099 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
1100 FIXME("unsupported args\n");
1102 nsres
= nsIDOMHTMLDocument_Open(This
->doc_node
->nsdoc
, NULL
, NULL
, NULL
,
1103 get_context_from_document(This
->doc_node
->nsdoc
), 0, &tmp
);
1104 if(NS_FAILED(nsres
)) {
1105 ERR("Open failed: %08x\n", nsres
);
1110 nsISupports_Release(tmp
);
1112 *pomWindowResult
= (IDispatch
*)&This
->window
->base
.IHTMLWindow2_iface
;
1113 IHTMLWindow2_AddRef(&This
->window
->base
.IHTMLWindow2_iface
);
1117 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
1119 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1122 TRACE("(%p)\n", This
);
1124 if(!This
->doc_node
->nsdoc
) {
1129 nsres
= nsIDOMHTMLDocument_Close(This
->doc_node
->nsdoc
);
1130 if(NS_FAILED(nsres
)) {
1131 ERR("Close failed: %08x\n", nsres
);
1138 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
1140 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1143 TRACE("(%p)\n", This
);
1145 nsres
= nsIDOMHTMLDocument_Clear(This
->doc_node
->nsdoc
);
1146 if(NS_FAILED(nsres
)) {
1147 ERR("Clear failed: %08x\n", nsres
);
1154 static const WCHAR copyW
[] =
1155 {'c','o','p','y',0};
1156 static const WCHAR cutW
[] =
1158 static const WCHAR fontnameW
[] =
1159 {'f','o','n','t','n','a','m','e',0};
1160 static const WCHAR fontsizeW
[] =
1161 {'f','o','n','t','s','i','z','e',0};
1162 static const WCHAR indentW
[] =
1163 {'i','n','d','e','n','t',0};
1164 static const WCHAR insertorderedlistW
[] =
1165 {'i','n','s','e','r','t','o','r','d','e','r','e','d','l','i','s','t',0};
1166 static const WCHAR insertunorderedlistW
[] =
1167 {'i','n','s','e','r','t','u','n','o','r','d','e','r','e','d','l','i','s','t',0};
1168 static const WCHAR outdentW
[] =
1169 {'o','u','t','d','e','n','t',0};
1170 static const WCHAR pasteW
[] =
1171 {'p','a','s','t','e',0};
1172 static const WCHAR respectvisibilityindesignW
[] =
1173 {'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};
1175 static const struct {
1178 }command_names
[] = {
1181 {fontnameW
, IDM_FONTNAME
},
1182 {fontsizeW
, IDM_FONTSIZE
},
1183 {indentW
, IDM_INDENT
},
1184 {insertorderedlistW
, IDM_ORDERLIST
},
1185 {insertunorderedlistW
, IDM_UNORDERLIST
},
1186 {outdentW
, IDM_OUTDENT
},
1187 {pasteW
, IDM_PASTE
},
1188 {respectvisibilityindesignW
, IDM_RESPECTVISIBILITY_INDESIGN
}
1191 static BOOL
cmdid_from_string(const WCHAR
*str
, OLECMDID
*cmdid
)
1195 for(i
= 0; i
< sizeof(command_names
)/sizeof(*command_names
); i
++) {
1196 if(!strcmpiW(command_names
[i
].name
, str
)) {
1197 *cmdid
= command_names
[i
].id
;
1202 FIXME("Unknown command %s\n", debugstr_w(str
));
1206 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
1207 VARIANT_BOOL
*pfRet
)
1209 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1210 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1214 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
1215 VARIANT_BOOL
*pfRet
)
1217 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1218 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1222 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
1223 VARIANT_BOOL
*pfRet
)
1225 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1226 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1230 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
1231 VARIANT_BOOL
*pfRet
)
1233 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1234 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1238 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
1241 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1242 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1246 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
1249 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1250 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1254 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
1255 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
1257 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1262 TRACE("(%p)->(%s %x %s %p)\n", This
, debugstr_w(cmdID
), showUI
, debugstr_variant(&value
), pfRet
);
1264 if(!cmdid_from_string(cmdID
, &cmdid
))
1265 return OLECMDERR_E_NOTSUPPORTED
;
1267 V_VT(&ret
) = VT_EMPTY
;
1268 hres
= IOleCommandTarget_Exec(&This
->IOleCommandTarget_iface
, &CGID_MSHTML
, cmdid
,
1269 showUI
? 0 : OLECMDEXECOPT_DONTPROMPTUSER
, &value
, &ret
);
1273 if(V_VT(&ret
) != VT_EMPTY
) {
1274 FIXME("Handle ret %s\n", debugstr_variant(&ret
));
1278 *pfRet
= VARIANT_TRUE
;
1282 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
1283 VARIANT_BOOL
*pfRet
)
1285 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1286 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1290 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
1291 IHTMLElement
**newElem
)
1293 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1297 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1299 hres
= create_element(This
->doc_node
, eTag
, &elem
);
1303 *newElem
= &elem
->IHTMLElement_iface
;
1307 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1309 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1310 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1314 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1316 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1317 FIXME("(%p)->(%p)\n", This
, p
);
1321 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1323 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1325 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1327 return set_doc_event(This
, EVENTID_CLICK
, &v
);
1330 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1332 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1334 TRACE("(%p)->(%p)\n", This
, p
);
1336 return get_doc_event(This
, EVENTID_CLICK
, p
);
1339 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1341 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1343 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1345 return set_doc_event(This
, EVENTID_DBLCLICK
, &v
);
1348 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1350 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1352 TRACE("(%p)->(%p)\n", This
, p
);
1354 return get_doc_event(This
, EVENTID_DBLCLICK
, p
);
1357 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1359 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1361 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1363 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1366 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1368 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1370 TRACE("(%p)->(%p)\n", This
, p
);
1372 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1375 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1377 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1379 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1381 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1384 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1386 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1388 TRACE("(%p)->(%p)\n", This
, p
);
1390 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1393 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1395 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1397 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1399 return set_doc_event(This
, EVENTID_KEYPRESS
, &v
);
1402 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1404 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1406 TRACE("(%p)->(%p)\n", This
, p
);
1408 return get_doc_event(This
, EVENTID_KEYPRESS
, p
);
1411 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1413 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1415 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1417 return set_doc_event(This
, EVENTID_MOUSEUP
, &v
);
1420 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1422 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1424 TRACE("(%p)->(%p)\n", This
, p
);
1426 return get_doc_event(This
, EVENTID_MOUSEUP
, p
);
1429 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1431 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1433 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1435 return set_doc_event(This
, EVENTID_MOUSEDOWN
, &v
);
1438 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1440 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1442 TRACE("(%p)->(%p)\n", This
, p
);
1444 return get_doc_event(This
, EVENTID_MOUSEDOWN
, p
);
1447 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1449 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1451 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1453 return set_doc_event(This
, EVENTID_MOUSEMOVE
, &v
);
1456 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1458 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1460 TRACE("(%p)->(%p)\n", This
, p
);
1462 return get_doc_event(This
, EVENTID_MOUSEMOVE
, p
);
1465 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1467 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1469 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1471 return set_doc_event(This
, EVENTID_MOUSEOUT
, &v
);
1474 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1476 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1478 TRACE("(%p)->(%p)\n", This
, p
);
1480 return get_doc_event(This
, EVENTID_MOUSEOUT
, p
);
1483 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1485 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1487 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1489 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1492 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1494 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1496 TRACE("(%p)->(%p)\n", This
, p
);
1498 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1501 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1503 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1505 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1507 return set_doc_event(This
, EVENTID_READYSTATECHANGE
, &v
);
1510 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1512 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1514 TRACE("(%p)->(%p)\n", This
, p
);
1516 return get_doc_event(This
, EVENTID_READYSTATECHANGE
, p
);
1519 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1521 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1522 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1526 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1528 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1529 FIXME("(%p)->(%p)\n", This
, p
);
1533 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1535 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1536 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1540 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1542 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1543 FIXME("(%p)->(%p)\n", This
, p
);
1547 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1549 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1550 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1554 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1556 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1557 FIXME("(%p)->(%p)\n", This
, p
);
1561 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1563 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1565 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1567 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1570 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1572 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1574 TRACE("(%p)->(%p)\n", This
, p
);
1576 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1579 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1581 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1583 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1585 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1588 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1590 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1592 TRACE("(%p)->(%p)\n", This
, p
);
1594 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1597 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, LONG x
, LONG y
,
1598 IHTMLElement
**elementHit
)
1600 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1601 nsIDOMElement
*nselem
;
1606 TRACE("(%p)->(%d %d %p)\n", This
, x
, y
, elementHit
);
1608 nsres
= nsIDOMHTMLDocument_ElementFromPoint(This
->doc_node
->nsdoc
, x
, y
, &nselem
);
1609 if(NS_FAILED(nsres
)) {
1610 ERR("ElementFromPoint failed: %08x\n", nsres
);
1619 hres
= get_node(This
->doc_node
, (nsIDOMNode
*)nselem
, TRUE
, &node
);
1620 nsIDOMElement_Release(nselem
);
1624 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)elementHit
);
1629 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1631 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1633 TRACE("(%p)->(%p)\n", This
, p
);
1635 return IHTMLDocument7_get_defaultView(&This
->IHTMLDocument7_iface
, p
);
1638 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1639 IHTMLStyleSheetsCollection
**p
)
1641 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1642 nsIDOMStyleSheetList
*nsstylelist
;
1645 TRACE("(%p)->(%p)\n", This
, p
);
1649 if(!This
->doc_node
->nsdoc
) {
1650 WARN("NULL nsdoc\n");
1651 return E_UNEXPECTED
;
1654 nsres
= nsIDOMHTMLDocument_GetStyleSheets(This
->doc_node
->nsdoc
, &nsstylelist
);
1655 if(NS_FAILED(nsres
)) {
1656 ERR("GetStyleSheets failed: %08x\n", nsres
);
1660 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1661 nsIDOMStyleSheetList_Release(nsstylelist
);
1666 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1668 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1669 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1673 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1675 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1676 FIXME("(%p)->(%p)\n", This
, p
);
1680 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1682 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1683 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1687 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1689 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1690 FIXME("(%p)->(%p)\n", This
, p
);
1694 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1696 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1698 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
1700 TRACE("(%p)->(%p)\n", This
, String
);
1703 return E_INVALIDARG
;
1705 *String
= SysAllocString(objectW
);
1706 return *String
? S_OK
: E_OUTOFMEMORY
;
1710 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1711 LONG lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1713 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1714 nsIDOMHTMLHeadElement
*head_elem
;
1715 IHTMLStyleElement
*style_elem
;
1720 static const WCHAR styleW
[] = {'s','t','y','l','e',0};
1722 TRACE("(%p)->(%s %d %p)\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1724 if(!This
->doc_node
->nsdoc
) {
1725 FIXME("not a real doc object\n");
1730 FIXME("Unsupported lIndex %d\n", lIndex
);
1732 if(bstrHref
&& *bstrHref
) {
1733 FIXME("semi-stub for href %s\n", debugstr_w(bstrHref
));
1734 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1738 hres
= create_element(This
->doc_node
, styleW
, &elem
);
1742 nsres
= nsIDOMHTMLDocument_GetHead(This
->doc_node
->nsdoc
, &head_elem
);
1743 if(NS_SUCCEEDED(nsres
)) {
1744 nsIDOMNode
*head_node
, *tmp_node
;
1746 nsres
= nsIDOMHTMLHeadElement_QueryInterface(head_elem
, &IID_nsIDOMNode
, (void**)&head_node
);
1747 nsIDOMHTMLHeadElement_Release(head_elem
);
1748 assert(nsres
== NS_OK
);
1750 nsres
= nsIDOMNode_AppendChild(head_node
, elem
->node
.nsnode
, &tmp_node
);
1751 nsIDOMNode_Release(head_node
);
1752 if(NS_SUCCEEDED(nsres
) && tmp_node
)
1753 nsIDOMNode_Release(tmp_node
);
1755 if(NS_FAILED(nsres
)) {
1756 IHTMLElement_Release(&elem
->IHTMLElement_iface
);
1760 hres
= IHTMLElement_QueryInterface(&elem
->IHTMLElement_iface
, &IID_IHTMLStyleElement
, (void**)&style_elem
);
1761 assert(hres
== S_OK
);
1762 IHTMLElement_Release(&elem
->IHTMLElement_iface
);
1764 hres
= IHTMLStyleElement_get_styleSheet(style_elem
, ppnewStyleSheet
);
1765 IHTMLStyleElement_Release(style_elem
);
1769 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1770 HTMLDocument_QueryInterface
,
1771 HTMLDocument_AddRef
,
1772 HTMLDocument_Release
,
1773 HTMLDocument_GetTypeInfoCount
,
1774 HTMLDocument_GetTypeInfo
,
1775 HTMLDocument_GetIDsOfNames
,
1776 HTMLDocument_Invoke
,
1777 HTMLDocument_get_Script
,
1778 HTMLDocument_get_all
,
1779 HTMLDocument_get_body
,
1780 HTMLDocument_get_activeElement
,
1781 HTMLDocument_get_images
,
1782 HTMLDocument_get_applets
,
1783 HTMLDocument_get_links
,
1784 HTMLDocument_get_forms
,
1785 HTMLDocument_get_anchors
,
1786 HTMLDocument_put_title
,
1787 HTMLDocument_get_title
,
1788 HTMLDocument_get_scripts
,
1789 HTMLDocument_put_designMode
,
1790 HTMLDocument_get_designMode
,
1791 HTMLDocument_get_selection
,
1792 HTMLDocument_get_readyState
,
1793 HTMLDocument_get_frames
,
1794 HTMLDocument_get_embeds
,
1795 HTMLDocument_get_plugins
,
1796 HTMLDocument_put_alinkColor
,
1797 HTMLDocument_get_alinkColor
,
1798 HTMLDocument_put_bgColor
,
1799 HTMLDocument_get_bgColor
,
1800 HTMLDocument_put_fgColor
,
1801 HTMLDocument_get_fgColor
,
1802 HTMLDocument_put_linkColor
,
1803 HTMLDocument_get_linkColor
,
1804 HTMLDocument_put_vlinkColor
,
1805 HTMLDocument_get_vlinkColor
,
1806 HTMLDocument_get_referrer
,
1807 HTMLDocument_get_location
,
1808 HTMLDocument_get_lastModified
,
1809 HTMLDocument_put_URL
,
1810 HTMLDocument_get_URL
,
1811 HTMLDocument_put_domain
,
1812 HTMLDocument_get_domain
,
1813 HTMLDocument_put_cookie
,
1814 HTMLDocument_get_cookie
,
1815 HTMLDocument_put_expando
,
1816 HTMLDocument_get_expando
,
1817 HTMLDocument_put_charset
,
1818 HTMLDocument_get_charset
,
1819 HTMLDocument_put_defaultCharset
,
1820 HTMLDocument_get_defaultCharset
,
1821 HTMLDocument_get_mimeType
,
1822 HTMLDocument_get_fileSize
,
1823 HTMLDocument_get_fileCreatedDate
,
1824 HTMLDocument_get_fileModifiedDate
,
1825 HTMLDocument_get_fileUpdatedDate
,
1826 HTMLDocument_get_security
,
1827 HTMLDocument_get_protocol
,
1828 HTMLDocument_get_nameProp
,
1830 HTMLDocument_writeln
,
1834 HTMLDocument_queryCommandSupported
,
1835 HTMLDocument_queryCommandEnabled
,
1836 HTMLDocument_queryCommandState
,
1837 HTMLDocument_queryCommandIndeterm
,
1838 HTMLDocument_queryCommandText
,
1839 HTMLDocument_queryCommandValue
,
1840 HTMLDocument_execCommand
,
1841 HTMLDocument_execCommandShowHelp
,
1842 HTMLDocument_createElement
,
1843 HTMLDocument_put_onhelp
,
1844 HTMLDocument_get_onhelp
,
1845 HTMLDocument_put_onclick
,
1846 HTMLDocument_get_onclick
,
1847 HTMLDocument_put_ondblclick
,
1848 HTMLDocument_get_ondblclick
,
1849 HTMLDocument_put_onkeyup
,
1850 HTMLDocument_get_onkeyup
,
1851 HTMLDocument_put_onkeydown
,
1852 HTMLDocument_get_onkeydown
,
1853 HTMLDocument_put_onkeypress
,
1854 HTMLDocument_get_onkeypress
,
1855 HTMLDocument_put_onmouseup
,
1856 HTMLDocument_get_onmouseup
,
1857 HTMLDocument_put_onmousedown
,
1858 HTMLDocument_get_onmousedown
,
1859 HTMLDocument_put_onmousemove
,
1860 HTMLDocument_get_onmousemove
,
1861 HTMLDocument_put_onmouseout
,
1862 HTMLDocument_get_onmouseout
,
1863 HTMLDocument_put_onmouseover
,
1864 HTMLDocument_get_onmouseover
,
1865 HTMLDocument_put_onreadystatechange
,
1866 HTMLDocument_get_onreadystatechange
,
1867 HTMLDocument_put_onafterupdate
,
1868 HTMLDocument_get_onafterupdate
,
1869 HTMLDocument_put_onrowexit
,
1870 HTMLDocument_get_onrowexit
,
1871 HTMLDocument_put_onrowenter
,
1872 HTMLDocument_get_onrowenter
,
1873 HTMLDocument_put_ondragstart
,
1874 HTMLDocument_get_ondragstart
,
1875 HTMLDocument_put_onselectstart
,
1876 HTMLDocument_get_onselectstart
,
1877 HTMLDocument_elementFromPoint
,
1878 HTMLDocument_get_parentWindow
,
1879 HTMLDocument_get_styleSheets
,
1880 HTMLDocument_put_onbeforeupdate
,
1881 HTMLDocument_get_onbeforeupdate
,
1882 HTMLDocument_put_onerrorupdate
,
1883 HTMLDocument_get_onerrorupdate
,
1884 HTMLDocument_toString
,
1885 HTMLDocument_createStyleSheet
1888 static inline HTMLDocument
*impl_from_IHTMLDocument3(IHTMLDocument3
*iface
)
1890 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument3_iface
);
1893 static HRESULT WINAPI
HTMLDocument3_QueryInterface(IHTMLDocument3
*iface
,
1894 REFIID riid
, void **ppv
)
1896 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1897 return htmldoc_query_interface(This
, riid
, ppv
);
1900 static ULONG WINAPI
HTMLDocument3_AddRef(IHTMLDocument3
*iface
)
1902 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1903 return htmldoc_addref(This
);
1906 static ULONG WINAPI
HTMLDocument3_Release(IHTMLDocument3
*iface
)
1908 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1909 return htmldoc_release(This
);
1912 static HRESULT WINAPI
HTMLDocument3_GetTypeInfoCount(IHTMLDocument3
*iface
, UINT
*pctinfo
)
1914 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1915 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1918 static HRESULT WINAPI
HTMLDocument3_GetTypeInfo(IHTMLDocument3
*iface
, UINT iTInfo
,
1919 LCID lcid
, ITypeInfo
**ppTInfo
)
1921 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1922 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1925 static HRESULT WINAPI
HTMLDocument3_GetIDsOfNames(IHTMLDocument3
*iface
, REFIID riid
,
1926 LPOLESTR
*rgszNames
, UINT cNames
,
1927 LCID lcid
, DISPID
*rgDispId
)
1929 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1930 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1934 static HRESULT WINAPI
HTMLDocument3_Invoke(IHTMLDocument3
*iface
, DISPID dispIdMember
,
1935 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1936 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1938 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1939 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1940 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1943 static HRESULT WINAPI
HTMLDocument3_releaseCapture(IHTMLDocument3
*iface
)
1945 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1946 FIXME("(%p)\n", This
);
1950 static HRESULT WINAPI
HTMLDocument3_recalc(IHTMLDocument3
*iface
, VARIANT_BOOL fForce
)
1952 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1954 WARN("(%p)->(%x)\n", This
, fForce
);
1956 /* Doing nothing here should be fine for us. */
1960 static HRESULT WINAPI
HTMLDocument3_createTextNode(IHTMLDocument3
*iface
, BSTR text
,
1961 IHTMLDOMNode
**newTextNode
)
1963 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1970 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(text
), newTextNode
);
1972 if(!This
->doc_node
->nsdoc
) {
1973 WARN("NULL nsdoc\n");
1974 return E_UNEXPECTED
;
1977 nsAString_InitDepend(&text_str
, text
);
1978 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->doc_node
->nsdoc
, &text_str
, &nstext
);
1979 nsAString_Finish(&text_str
);
1980 if(NS_FAILED(nsres
)) {
1981 ERR("CreateTextNode failed: %08x\n", nsres
);
1985 hres
= HTMLDOMTextNode_Create(This
->doc_node
, (nsIDOMNode
*)nstext
, &node
);
1986 nsIDOMText_Release(nstext
);
1990 *newTextNode
= &node
->IHTMLDOMNode_iface
;
1994 static HRESULT WINAPI
HTMLDocument3_get_documentElement(IHTMLDocument3
*iface
, IHTMLElement
**p
)
1996 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1997 nsIDOMElement
*nselem
= NULL
;
2002 TRACE("(%p)->(%p)\n", This
, p
);
2004 if(This
->window
->readystate
== READYSTATE_UNINITIALIZED
) {
2009 if(!This
->doc_node
->nsdoc
) {
2010 WARN("NULL nsdoc\n");
2011 return E_UNEXPECTED
;
2014 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->doc_node
->nsdoc
, &nselem
);
2015 if(NS_FAILED(nsres
)) {
2016 ERR("GetDocumentElement failed: %08x\n", nsres
);
2025 hres
= get_node(This
->doc_node
, (nsIDOMNode
*)nselem
, TRUE
, &node
);
2026 nsIDOMElement_Release(nselem
);
2030 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)p
);
2035 static HRESULT WINAPI
HTMLDocument3_get_uniqueID(IHTMLDocument3
*iface
, BSTR
*p
)
2037 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2039 TRACE("(%p)->(%p)\n", This
, p
);
2041 return elem_unique_id(++This
->doc_node
->unique_id
, p
);
2044 static HRESULT WINAPI
HTMLDocument3_attachEvent(IHTMLDocument3
*iface
, BSTR event
,
2045 IDispatch
* pDisp
, VARIANT_BOOL
*pfResult
)
2047 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2049 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
2051 return attach_event(&This
->doc_node
->node
.event_target
, event
, pDisp
, pfResult
);
2054 static HRESULT WINAPI
HTMLDocument3_detachEvent(IHTMLDocument3
*iface
, BSTR event
,
2057 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2059 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(event
), pDisp
);
2061 return detach_event(&This
->doc_node
->node
.event_target
, event
, pDisp
);
2064 static HRESULT WINAPI
HTMLDocument3_put_onrowsdelete(IHTMLDocument3
*iface
, VARIANT v
)
2066 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2067 FIXME("(%p)->()\n", This
);
2071 static HRESULT WINAPI
HTMLDocument3_get_onrowsdelete(IHTMLDocument3
*iface
, VARIANT
*p
)
2073 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2074 FIXME("(%p)->(%p)\n", This
, p
);
2078 static HRESULT WINAPI
HTMLDocument3_put_onrowsinserted(IHTMLDocument3
*iface
, VARIANT v
)
2080 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2081 FIXME("(%p)->()\n", This
);
2085 static HRESULT WINAPI
HTMLDocument3_get_onrowsinserted(IHTMLDocument3
*iface
, VARIANT
*p
)
2087 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2088 FIXME("(%p)->(%p)\n", This
, p
);
2092 static HRESULT WINAPI
HTMLDocument3_put_oncellchange(IHTMLDocument3
*iface
, VARIANT v
)
2094 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2095 FIXME("(%p)->()\n", This
);
2099 static HRESULT WINAPI
HTMLDocument3_get_oncellchange(IHTMLDocument3
*iface
, VARIANT
*p
)
2101 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2102 FIXME("(%p)->(%p)\n", This
, p
);
2106 static HRESULT WINAPI
HTMLDocument3_put_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT v
)
2108 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2109 FIXME("(%p)->()\n", This
);
2113 static HRESULT WINAPI
HTMLDocument3_get_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT
*p
)
2115 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2116 FIXME("(%p)->(%p)\n", This
, p
);
2120 static HRESULT WINAPI
HTMLDocument3_put_ondataavailable(IHTMLDocument3
*iface
, VARIANT v
)
2122 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2123 FIXME("(%p)->()\n", This
);
2127 static HRESULT WINAPI
HTMLDocument3_get_ondataavailable(IHTMLDocument3
*iface
, VARIANT
*p
)
2129 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2130 FIXME("(%p)->(%p)\n", This
, p
);
2134 static HRESULT WINAPI
HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT v
)
2136 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2137 FIXME("(%p)->()\n", This
);
2141 static HRESULT WINAPI
HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT
*p
)
2143 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2144 FIXME("(%p)->(%p)\n", This
, p
);
2148 static HRESULT WINAPI
HTMLDocument3_put_onpropertychange(IHTMLDocument3
*iface
, VARIANT v
)
2150 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2151 FIXME("(%p)->()\n", This
);
2155 static HRESULT WINAPI
HTMLDocument3_get_onpropertychange(IHTMLDocument3
*iface
, VARIANT
*p
)
2157 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2158 FIXME("(%p)->(%p)\n", This
, p
);
2162 static HRESULT WINAPI
HTMLDocument3_put_dir(IHTMLDocument3
*iface
, BSTR v
)
2164 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2168 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2170 if(!This
->doc_node
->nsdoc
) {
2171 FIXME("NULL nsdoc\n");
2172 return E_UNEXPECTED
;
2175 nsAString_InitDepend(&dir_str
, v
);
2176 nsres
= nsIDOMHTMLDocument_SetDir(This
->doc_node
->nsdoc
, &dir_str
);
2177 nsAString_Finish(&dir_str
);
2178 if(NS_FAILED(nsres
)) {
2179 ERR("SetDir failed: %08x\n", nsres
);
2186 static HRESULT WINAPI
HTMLDocument3_get_dir(IHTMLDocument3
*iface
, BSTR
*p
)
2188 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2192 TRACE("(%p)->(%p)\n", This
, p
);
2194 if(!This
->doc_node
->nsdoc
) {
2195 FIXME("NULL nsdoc\n");
2196 return E_UNEXPECTED
;
2199 nsAString_Init(&dir_str
, NULL
);
2200 nsres
= nsIDOMHTMLDocument_GetDir(This
->doc_node
->nsdoc
, &dir_str
);
2201 return return_nsstr(nsres
, &dir_str
, p
);
2204 static HRESULT WINAPI
HTMLDocument3_put_oncontextmenu(IHTMLDocument3
*iface
, VARIANT v
)
2206 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2208 TRACE("(%p)->()\n", This
);
2210 return set_doc_event(This
, EVENTID_CONTEXTMENU
, &v
);
2213 static HRESULT WINAPI
HTMLDocument3_get_oncontextmenu(IHTMLDocument3
*iface
, VARIANT
*p
)
2215 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2217 TRACE("(%p)->(%p)\n", This
, p
);
2219 return get_doc_event(This
, EVENTID_CONTEXTMENU
, p
);
2222 static HRESULT WINAPI
HTMLDocument3_put_onstop(IHTMLDocument3
*iface
, VARIANT v
)
2224 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2225 FIXME("(%p)->()\n", This
);
2229 static HRESULT WINAPI
HTMLDocument3_get_onstop(IHTMLDocument3
*iface
, VARIANT
*p
)
2231 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2232 FIXME("(%p)->(%p)\n", This
, p
);
2236 static HRESULT WINAPI
HTMLDocument3_createDocumentFragment(IHTMLDocument3
*iface
,
2237 IHTMLDocument2
**ppNewDoc
)
2239 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2240 nsIDOMDocumentFragment
*doc_frag
;
2241 HTMLDocumentNode
*docnode
;
2245 TRACE("(%p)->(%p)\n", This
, ppNewDoc
);
2247 if(!This
->doc_node
->nsdoc
) {
2248 FIXME("NULL nsdoc\n");
2252 nsres
= nsIDOMHTMLDocument_CreateDocumentFragment(This
->doc_node
->nsdoc
, &doc_frag
);
2253 if(NS_FAILED(nsres
)) {
2254 ERR("CreateDocumentFragment failed: %08x\n", nsres
);
2258 hres
= create_document_fragment((nsIDOMNode
*)doc_frag
, This
->doc_node
, &docnode
);
2259 nsIDOMDocumentFragment_Release(doc_frag
);
2263 *ppNewDoc
= &docnode
->basedoc
.IHTMLDocument2_iface
;
2267 static HRESULT WINAPI
HTMLDocument3_get_parentDocument(IHTMLDocument3
*iface
,
2270 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2271 FIXME("(%p)->(%p)\n", This
, p
);
2275 static HRESULT WINAPI
HTMLDocument3_put_enableDownload(IHTMLDocument3
*iface
,
2278 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2279 FIXME("(%p)->(%x)\n", This
, v
);
2283 static HRESULT WINAPI
HTMLDocument3_get_enableDownload(IHTMLDocument3
*iface
,
2286 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2287 FIXME("(%p)->(%p)\n", This
, p
);
2291 static HRESULT WINAPI
HTMLDocument3_put_baseUrl(IHTMLDocument3
*iface
, BSTR v
)
2293 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2294 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2298 static HRESULT WINAPI
HTMLDocument3_get_baseUrl(IHTMLDocument3
*iface
, BSTR
*p
)
2300 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2301 FIXME("(%p)->(%p)\n", This
, p
);
2305 static HRESULT WINAPI
HTMLDocument3_get_childNodes(IHTMLDocument3
*iface
, IDispatch
**p
)
2307 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2309 TRACE("(%p)->(%p)\n", This
, p
);
2311 return IHTMLDOMNode_get_childNodes(&This
->doc_node
->node
.IHTMLDOMNode_iface
, p
);
2314 static HRESULT WINAPI
HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3
*iface
,
2317 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2318 FIXME("(%p)->()\n", This
);
2322 static HRESULT WINAPI
HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3
*iface
,
2325 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2326 FIXME("(%p)->(%p)\n", This
, p
);
2330 static HRESULT WINAPI
HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT v
)
2332 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2333 FIXME("(%p)->()\n", This
);
2337 static HRESULT WINAPI
HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT
*p
)
2339 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2340 FIXME("(%p)->(%p)\n", This
, p
);
2344 static HRESULT WINAPI
HTMLDocument3_getElementsByName(IHTMLDocument3
*iface
, BSTR v
,
2345 IHTMLElementCollection
**ppelColl
)
2347 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2348 nsIDOMNodeList
*node_list
;
2349 nsAString selector_str
;
2353 static const WCHAR formatW
[] = {'*','[','i','d','=','%','s',']',',','*','[','n','a','m','e','=','%','s',']',0};
2355 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppelColl
);
2357 if(!This
->doc_node
|| !This
->doc_node
->nsdoc
) {
2358 /* We should probably return an empty collection. */
2359 FIXME("No nsdoc\n");
2363 selector
= heap_alloc(2*SysStringLen(v
)*sizeof(WCHAR
) + sizeof(formatW
));
2365 return E_OUTOFMEMORY
;
2366 sprintfW(selector
, formatW
, v
, v
);
2369 * NOTE: IE getElementsByName implementation differs from Gecko. It searches both name and id attributes.
2370 * That's why we use CSS selector instead. We should also use name only when it applies to given element
2371 * types and search should be case insensitive. Those are currently not supported properly.
2373 nsAString_InitDepend(&selector_str
, selector
);
2374 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->doc_node
->nsdoc
, &selector_str
, &node_list
);
2375 nsAString_Finish(&selector_str
);
2376 heap_free(selector
);
2377 if(NS_FAILED(nsres
)) {
2378 ERR("QuerySelectorAll failed: %08x\n", nsres
);
2382 *ppelColl
= create_collection_from_nodelist(This
->doc_node
, node_list
);
2383 nsIDOMNodeList_Release(node_list
);
2388 static HRESULT WINAPI
HTMLDocument3_getElementById(IHTMLDocument3
*iface
, BSTR v
,
2391 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2395 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
2397 hres
= get_doc_elem_by_id(This
->doc_node
, v
, &elem
);
2398 if(FAILED(hres
) || !elem
) {
2403 *pel
= &elem
->IHTMLElement_iface
;
2408 static HRESULT WINAPI
HTMLDocument3_getElementsByTagName(IHTMLDocument3
*iface
, BSTR v
,
2409 IHTMLElementCollection
**pelColl
)
2411 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2412 nsIDOMNodeList
*nslist
;
2416 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
2418 if(This
->doc_node
->nsdoc
) {
2419 nsAString_InitDepend(&id_str
, v
);
2420 nsres
= nsIDOMHTMLDocument_GetElementsByTagName(This
->doc_node
->nsdoc
, &id_str
, &nslist
);
2421 nsAString_Finish(&id_str
);
2423 ERR("GetElementByName failed: %08x\n", nsres
);
2427 nsIDOMDocumentFragment
*docfrag
;
2432 for(ptr
=v
; *ptr
; ptr
++) {
2433 if(!isalnumW(*ptr
)) {
2434 FIXME("Unsupported invalid tag %s\n", debugstr_w(v
));
2440 nsres
= nsIDOMNode_QueryInterface(This
->doc_node
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&docfrag
);
2441 if(NS_FAILED(nsres
)) {
2442 ERR("Could not get nsIDOMDocumentFragment iface: %08x\n", nsres
);
2443 return E_UNEXPECTED
;
2446 nsAString_InitDepend(&nsstr
, v
);
2447 nsres
= nsIDOMDocumentFragment_QuerySelectorAll(docfrag
, &nsstr
, &nslist
);
2448 nsAString_Finish(&nsstr
);
2449 nsIDOMDocumentFragment_Release(docfrag
);
2450 if(NS_FAILED(nsres
)) {
2451 ERR("QuerySelectorAll failed: %08x\n", nsres
);
2457 *pelColl
= create_collection_from_nodelist(This
->doc_node
, nslist
);
2458 nsIDOMNodeList_Release(nslist
);
2463 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl
= {
2464 HTMLDocument3_QueryInterface
,
2465 HTMLDocument3_AddRef
,
2466 HTMLDocument3_Release
,
2467 HTMLDocument3_GetTypeInfoCount
,
2468 HTMLDocument3_GetTypeInfo
,
2469 HTMLDocument3_GetIDsOfNames
,
2470 HTMLDocument3_Invoke
,
2471 HTMLDocument3_releaseCapture
,
2472 HTMLDocument3_recalc
,
2473 HTMLDocument3_createTextNode
,
2474 HTMLDocument3_get_documentElement
,
2475 HTMLDocument3_get_uniqueID
,
2476 HTMLDocument3_attachEvent
,
2477 HTMLDocument3_detachEvent
,
2478 HTMLDocument3_put_onrowsdelete
,
2479 HTMLDocument3_get_onrowsdelete
,
2480 HTMLDocument3_put_onrowsinserted
,
2481 HTMLDocument3_get_onrowsinserted
,
2482 HTMLDocument3_put_oncellchange
,
2483 HTMLDocument3_get_oncellchange
,
2484 HTMLDocument3_put_ondatasetchanged
,
2485 HTMLDocument3_get_ondatasetchanged
,
2486 HTMLDocument3_put_ondataavailable
,
2487 HTMLDocument3_get_ondataavailable
,
2488 HTMLDocument3_put_ondatasetcomplete
,
2489 HTMLDocument3_get_ondatasetcomplete
,
2490 HTMLDocument3_put_onpropertychange
,
2491 HTMLDocument3_get_onpropertychange
,
2492 HTMLDocument3_put_dir
,
2493 HTMLDocument3_get_dir
,
2494 HTMLDocument3_put_oncontextmenu
,
2495 HTMLDocument3_get_oncontextmenu
,
2496 HTMLDocument3_put_onstop
,
2497 HTMLDocument3_get_onstop
,
2498 HTMLDocument3_createDocumentFragment
,
2499 HTMLDocument3_get_parentDocument
,
2500 HTMLDocument3_put_enableDownload
,
2501 HTMLDocument3_get_enableDownload
,
2502 HTMLDocument3_put_baseUrl
,
2503 HTMLDocument3_get_baseUrl
,
2504 HTMLDocument3_get_childNodes
,
2505 HTMLDocument3_put_inheritStyleSheets
,
2506 HTMLDocument3_get_inheritStyleSheets
,
2507 HTMLDocument3_put_onbeforeeditfocus
,
2508 HTMLDocument3_get_onbeforeeditfocus
,
2509 HTMLDocument3_getElementsByName
,
2510 HTMLDocument3_getElementById
,
2511 HTMLDocument3_getElementsByTagName
2514 static inline HTMLDocument
*impl_from_IHTMLDocument4(IHTMLDocument4
*iface
)
2516 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument4_iface
);
2519 static HRESULT WINAPI
HTMLDocument4_QueryInterface(IHTMLDocument4
*iface
,
2520 REFIID riid
, void **ppv
)
2522 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2523 return htmldoc_query_interface(This
, riid
, ppv
);
2526 static ULONG WINAPI
HTMLDocument4_AddRef(IHTMLDocument4
*iface
)
2528 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2529 return htmldoc_addref(This
);
2532 static ULONG WINAPI
HTMLDocument4_Release(IHTMLDocument4
*iface
)
2534 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2535 return htmldoc_release(This
);
2538 static HRESULT WINAPI
HTMLDocument4_GetTypeInfoCount(IHTMLDocument4
*iface
, UINT
*pctinfo
)
2540 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2541 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2544 static HRESULT WINAPI
HTMLDocument4_GetTypeInfo(IHTMLDocument4
*iface
, UINT iTInfo
,
2545 LCID lcid
, ITypeInfo
**ppTInfo
)
2547 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2548 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2551 static HRESULT WINAPI
HTMLDocument4_GetIDsOfNames(IHTMLDocument4
*iface
, REFIID riid
,
2552 LPOLESTR
*rgszNames
, UINT cNames
,
2553 LCID lcid
, DISPID
*rgDispId
)
2555 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2556 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
2560 static HRESULT WINAPI
HTMLDocument4_Invoke(IHTMLDocument4
*iface
, DISPID dispIdMember
,
2561 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2562 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2564 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2565 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2566 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2569 static HRESULT WINAPI
HTMLDocument4_focus(IHTMLDocument4
*iface
)
2571 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2572 nsIDOMHTMLElement
*nsbody
;
2575 TRACE("(%p)->()\n", This
);
2577 nsres
= nsIDOMHTMLDocument_GetBody(This
->doc_node
->nsdoc
, &nsbody
);
2578 if(NS_FAILED(nsres
) || !nsbody
) {
2579 ERR("GetBody failed: %08x\n", nsres
);
2583 nsres
= nsIDOMHTMLElement_Focus(nsbody
);
2584 nsIDOMHTMLElement_Release(nsbody
);
2585 if(NS_FAILED(nsres
)) {
2586 ERR("Focus failed: %08x\n", nsres
);
2593 static HRESULT WINAPI
HTMLDocument4_hasFocus(IHTMLDocument4
*iface
, VARIANT_BOOL
*pfFocus
)
2595 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2599 TRACE("(%p)->(%p)\n", This
, pfFocus
);
2601 if(!This
->doc_node
->nsdoc
) {
2602 FIXME("Unimplemented for fragments.\n");
2606 nsres
= nsIDOMHTMLDocument_HasFocus(This
->doc_node
->nsdoc
, &has_focus
);
2607 assert(nsres
== NS_OK
);
2609 *pfFocus
= variant_bool(has_focus
);
2613 static HRESULT WINAPI
HTMLDocument4_put_onselectionchange(IHTMLDocument4
*iface
, VARIANT v
)
2615 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2617 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2619 return set_doc_event(This
, EVENTID_SELECTIONCHANGE
, &v
);
2622 static HRESULT WINAPI
HTMLDocument4_get_onselectionchange(IHTMLDocument4
*iface
, VARIANT
*p
)
2624 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2626 TRACE("(%p)->(%p)\n", This
, p
);
2628 return get_doc_event(This
, EVENTID_SELECTIONCHANGE
, p
);
2631 static HRESULT WINAPI
HTMLDocument4_get_namespace(IHTMLDocument4
*iface
, IDispatch
**p
)
2633 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2634 FIXME("(%p)->(%p)\n", This
, p
);
2638 static HRESULT WINAPI
HTMLDocument4_createDocumentFromUrl(IHTMLDocument4
*iface
, BSTR bstrUrl
,
2639 BSTR bstrOptions
, IHTMLDocument2
**newDoc
)
2641 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2642 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrUrl
), debugstr_w(bstrOptions
), newDoc
);
2646 static HRESULT WINAPI
HTMLDocument4_put_media(IHTMLDocument4
*iface
, BSTR v
)
2648 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2649 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2653 static HRESULT WINAPI
HTMLDocument4_get_media(IHTMLDocument4
*iface
, BSTR
*p
)
2655 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2656 FIXME("(%p)->(%p)\n", This
, p
);
2660 static HRESULT WINAPI
HTMLDocument4_createEventObject(IHTMLDocument4
*iface
,
2661 VARIANT
*pvarEventObject
, IHTMLEventObj
**ppEventObj
)
2663 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2665 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(pvarEventObject
), ppEventObj
);
2667 if(pvarEventObject
&& V_VT(pvarEventObject
) != VT_ERROR
&& V_VT(pvarEventObject
) != VT_EMPTY
) {
2668 FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject
));
2672 return create_event_obj(ppEventObj
);
2675 static HRESULT WINAPI
HTMLDocument4_fireEvent(IHTMLDocument4
*iface
, BSTR bstrEventName
,
2676 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCanceled
)
2678 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2680 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrEventName
), pvarEventObject
, pfCanceled
);
2682 return fire_event(&This
->doc_node
->node
, bstrEventName
, pvarEventObject
, pfCanceled
);
2685 static HRESULT WINAPI
HTMLDocument4_createRenderStyle(IHTMLDocument4
*iface
, BSTR v
,
2686 IHTMLRenderStyle
**ppIHTMLRenderStyle
)
2688 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2689 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppIHTMLRenderStyle
);
2693 static HRESULT WINAPI
HTMLDocument4_put_oncontrolselect(IHTMLDocument4
*iface
, VARIANT v
)
2695 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2696 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2700 static HRESULT WINAPI
HTMLDocument4_get_oncontrolselect(IHTMLDocument4
*iface
, VARIANT
*p
)
2702 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2703 FIXME("(%p)->(%p)\n", This
, p
);
2707 static HRESULT WINAPI
HTMLDocument4_get_URLEncoded(IHTMLDocument4
*iface
, BSTR
*p
)
2709 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2710 FIXME("(%p)->(%p)\n", This
, p
);
2714 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl
= {
2715 HTMLDocument4_QueryInterface
,
2716 HTMLDocument4_AddRef
,
2717 HTMLDocument4_Release
,
2718 HTMLDocument4_GetTypeInfoCount
,
2719 HTMLDocument4_GetTypeInfo
,
2720 HTMLDocument4_GetIDsOfNames
,
2721 HTMLDocument4_Invoke
,
2722 HTMLDocument4_focus
,
2723 HTMLDocument4_hasFocus
,
2724 HTMLDocument4_put_onselectionchange
,
2725 HTMLDocument4_get_onselectionchange
,
2726 HTMLDocument4_get_namespace
,
2727 HTMLDocument4_createDocumentFromUrl
,
2728 HTMLDocument4_put_media
,
2729 HTMLDocument4_get_media
,
2730 HTMLDocument4_createEventObject
,
2731 HTMLDocument4_fireEvent
,
2732 HTMLDocument4_createRenderStyle
,
2733 HTMLDocument4_put_oncontrolselect
,
2734 HTMLDocument4_get_oncontrolselect
,
2735 HTMLDocument4_get_URLEncoded
2738 static inline HTMLDocument
*impl_from_IHTMLDocument5(IHTMLDocument5
*iface
)
2740 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument5_iface
);
2743 static HRESULT WINAPI
HTMLDocument5_QueryInterface(IHTMLDocument5
*iface
,
2744 REFIID riid
, void **ppv
)
2746 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2747 return htmldoc_query_interface(This
, riid
, ppv
);
2750 static ULONG WINAPI
HTMLDocument5_AddRef(IHTMLDocument5
*iface
)
2752 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2753 return htmldoc_addref(This
);
2756 static ULONG WINAPI
HTMLDocument5_Release(IHTMLDocument5
*iface
)
2758 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2759 return htmldoc_release(This
);
2762 static HRESULT WINAPI
HTMLDocument5_GetTypeInfoCount(IHTMLDocument5
*iface
, UINT
*pctinfo
)
2764 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2765 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2768 static HRESULT WINAPI
HTMLDocument5_GetTypeInfo(IHTMLDocument5
*iface
, UINT iTInfo
,
2769 LCID lcid
, ITypeInfo
**ppTInfo
)
2771 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2772 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2775 static HRESULT WINAPI
HTMLDocument5_GetIDsOfNames(IHTMLDocument5
*iface
, REFIID riid
,
2776 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2778 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2779 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
2783 static HRESULT WINAPI
HTMLDocument5_Invoke(IHTMLDocument5
*iface
, DISPID dispIdMember
,
2784 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2785 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2787 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2788 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2789 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2792 static HRESULT WINAPI
HTMLDocument5_put_onmousewheel(IHTMLDocument5
*iface
, VARIANT v
)
2794 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2796 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2798 return set_doc_event(This
, EVENTID_MOUSEWHEEL
, &v
);
2801 static HRESULT WINAPI
HTMLDocument5_get_onmousewheel(IHTMLDocument5
*iface
, VARIANT
*p
)
2803 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2805 TRACE("(%p)->(%p)\n", This
, p
);
2807 return get_doc_event(This
, EVENTID_MOUSEWHEEL
, p
);
2810 static HRESULT WINAPI
HTMLDocument5_get_doctype(IHTMLDocument5
*iface
, IHTMLDOMNode
**p
)
2812 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2813 FIXME("(%p)->(%p)\n", This
, p
);
2817 static HRESULT WINAPI
HTMLDocument5_get_implementation(IHTMLDocument5
*iface
, IHTMLDOMImplementation
**p
)
2819 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2820 HTMLDocumentNode
*doc_node
= This
->doc_node
;
2822 TRACE("(%p)->(%p)\n", This
, p
);
2824 if(!doc_node
->dom_implementation
) {
2827 hres
= create_dom_implementation(&doc_node
->dom_implementation
);
2832 IHTMLDOMImplementation_AddRef(doc_node
->dom_implementation
);
2833 *p
= doc_node
->dom_implementation
;
2837 static HRESULT WINAPI
HTMLDocument5_createAttribute(IHTMLDocument5
*iface
, BSTR bstrattrName
,
2838 IHTMLDOMAttribute
**ppattribute
)
2840 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2841 HTMLDOMAttribute
*attr
;
2844 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrattrName
), ppattribute
);
2846 hres
= HTMLDOMAttribute_Create(bstrattrName
, NULL
, 0, &attr
);
2850 *ppattribute
= &attr
->IHTMLDOMAttribute_iface
;
2854 static HRESULT WINAPI
HTMLDocument5_createComment(IHTMLDocument5
*iface
, BSTR bstrdata
,
2855 IHTMLDOMNode
**ppRetNode
)
2857 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2858 nsIDOMComment
*nscomment
;
2864 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrdata
), ppRetNode
);
2866 if(!This
->doc_node
->nsdoc
) {
2867 WARN("NULL nsdoc\n");
2868 return E_UNEXPECTED
;
2871 nsAString_InitDepend(&str
, bstrdata
);
2872 nsres
= nsIDOMHTMLDocument_CreateComment(This
->doc_node
->nsdoc
, &str
, &nscomment
);
2873 nsAString_Finish(&str
);
2874 if(NS_FAILED(nsres
)) {
2875 ERR("CreateTextNode failed: %08x\n", nsres
);
2879 hres
= HTMLCommentElement_Create(This
->doc_node
, (nsIDOMNode
*)nscomment
, &elem
);
2880 nsIDOMComment_Release(nscomment
);
2884 *ppRetNode
= &elem
->node
.IHTMLDOMNode_iface
;
2888 static HRESULT WINAPI
HTMLDocument5_put_onfocusin(IHTMLDocument5
*iface
, VARIANT v
)
2890 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2892 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2894 return set_doc_event(This
, EVENTID_FOCUSIN
, &v
);
2897 static HRESULT WINAPI
HTMLDocument5_get_onfocusin(IHTMLDocument5
*iface
, VARIANT
*p
)
2899 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2901 TRACE("(%p)->(%p)\n", This
, p
);
2903 return get_doc_event(This
, EVENTID_FOCUSIN
, p
);
2906 static HRESULT WINAPI
HTMLDocument5_put_onfocusout(IHTMLDocument5
*iface
, VARIANT v
)
2908 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2910 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2912 return set_doc_event(This
, EVENTID_FOCUSOUT
, &v
);
2915 static HRESULT WINAPI
HTMLDocument5_get_onfocusout(IHTMLDocument5
*iface
, VARIANT
*p
)
2917 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2919 TRACE("(%p)->(%p)\n", This
, p
);
2921 return get_doc_event(This
, EVENTID_FOCUSOUT
, p
);
2924 static HRESULT WINAPI
HTMLDocument5_put_onactivate(IHTMLDocument5
*iface
, VARIANT v
)
2926 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2927 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2931 static HRESULT WINAPI
HTMLDocument5_get_onactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2933 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2934 FIXME("(%p)->(%p)\n", This
, p
);
2938 static HRESULT WINAPI
HTMLDocument5_put_ondeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2940 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2941 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2945 static HRESULT WINAPI
HTMLDocument5_get_ondeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2947 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2948 FIXME("(%p)->(%p)\n", This
, p
);
2952 static HRESULT WINAPI
HTMLDocument5_put_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2954 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2955 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2959 static HRESULT WINAPI
HTMLDocument5_get_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2961 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2962 FIXME("(%p)->(%p)\n", This
, p
);
2966 static HRESULT WINAPI
HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2968 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2969 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2973 static HRESULT WINAPI
HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2975 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2976 FIXME("(%p)->(%p)\n", This
, p
);
2980 static HRESULT WINAPI
HTMLDocument5_get_compatMode(IHTMLDocument5
*iface
, BSTR
*p
)
2982 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2984 static const WCHAR BackCompatW
[] = {'B','a','c','k','C','o','m','p','a','t',0};
2985 static const WCHAR CSS1CompatW
[] = {'C','S','S','1','C','o','m','p','a','t',0};
2987 TRACE("(%p)->(%p)\n", This
, p
);
2989 *p
= SysAllocString(This
->doc_node
->document_mode
<= COMPAT_MODE_IE5
? BackCompatW
: CSS1CompatW
);
2990 return *p
? S_OK
: E_OUTOFMEMORY
;
2993 static const IHTMLDocument5Vtbl HTMLDocument5Vtbl
= {
2994 HTMLDocument5_QueryInterface
,
2995 HTMLDocument5_AddRef
,
2996 HTMLDocument5_Release
,
2997 HTMLDocument5_GetTypeInfoCount
,
2998 HTMLDocument5_GetTypeInfo
,
2999 HTMLDocument5_GetIDsOfNames
,
3000 HTMLDocument5_Invoke
,
3001 HTMLDocument5_put_onmousewheel
,
3002 HTMLDocument5_get_onmousewheel
,
3003 HTMLDocument5_get_doctype
,
3004 HTMLDocument5_get_implementation
,
3005 HTMLDocument5_createAttribute
,
3006 HTMLDocument5_createComment
,
3007 HTMLDocument5_put_onfocusin
,
3008 HTMLDocument5_get_onfocusin
,
3009 HTMLDocument5_put_onfocusout
,
3010 HTMLDocument5_get_onfocusout
,
3011 HTMLDocument5_put_onactivate
,
3012 HTMLDocument5_get_onactivate
,
3013 HTMLDocument5_put_ondeactivate
,
3014 HTMLDocument5_get_ondeactivate
,
3015 HTMLDocument5_put_onbeforeactivate
,
3016 HTMLDocument5_get_onbeforeactivate
,
3017 HTMLDocument5_put_onbeforedeactivate
,
3018 HTMLDocument5_get_onbeforedeactivate
,
3019 HTMLDocument5_get_compatMode
3022 static inline HTMLDocument
*impl_from_IHTMLDocument6(IHTMLDocument6
*iface
)
3024 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument6_iface
);
3027 static HRESULT WINAPI
HTMLDocument6_QueryInterface(IHTMLDocument6
*iface
,
3028 REFIID riid
, void **ppv
)
3030 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3031 return htmldoc_query_interface(This
, riid
, ppv
);
3034 static ULONG WINAPI
HTMLDocument6_AddRef(IHTMLDocument6
*iface
)
3036 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3037 return htmldoc_addref(This
);
3040 static ULONG WINAPI
HTMLDocument6_Release(IHTMLDocument6
*iface
)
3042 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3043 return htmldoc_release(This
);
3046 static HRESULT WINAPI
HTMLDocument6_GetTypeInfoCount(IHTMLDocument6
*iface
, UINT
*pctinfo
)
3048 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3049 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3052 static HRESULT WINAPI
HTMLDocument6_GetTypeInfo(IHTMLDocument6
*iface
, UINT iTInfo
,
3053 LCID lcid
, ITypeInfo
**ppTInfo
)
3055 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3056 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3059 static HRESULT WINAPI
HTMLDocument6_GetIDsOfNames(IHTMLDocument6
*iface
, REFIID riid
,
3060 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3062 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3063 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
3067 static HRESULT WINAPI
HTMLDocument6_Invoke(IHTMLDocument6
*iface
, DISPID dispIdMember
,
3068 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3069 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3071 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3072 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3073 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3076 static HRESULT WINAPI
HTMLDocument6_get_compatible(IHTMLDocument6
*iface
,
3077 IHTMLDocumentCompatibleInfoCollection
**p
)
3079 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3080 FIXME("(%p)->(%p)\n", This
, p
);
3084 static HRESULT WINAPI
HTMLDocument6_get_documentMode(IHTMLDocument6
*iface
, VARIANT
*p
)
3086 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3088 TRACE("(%p)->(%p)\n", This
, p
);
3090 if(!This
->doc_node
) {
3091 FIXME("NULL doc_node\n");
3092 return E_UNEXPECTED
;
3096 V_R4(p
) = compat_mode_info
[This
->doc_node
->document_mode
].document_mode
;
3100 static HRESULT WINAPI
HTMLDocument6_get_onstorage(IHTMLDocument6
*iface
,
3103 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3104 FIXME("(%p)->(%p)\n", This
, p
);
3108 static HRESULT WINAPI
HTMLDocument6_put_onstorage(IHTMLDocument6
*iface
, VARIANT v
)
3110 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3111 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3115 static HRESULT WINAPI
HTMLDocument6_get_onstoragecommit(IHTMLDocument6
*iface
,
3118 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3119 FIXME("(%p)->(%p)\n", This
, p
);
3123 static HRESULT WINAPI
HTMLDocument6_put_onstoragecommit(IHTMLDocument6
*iface
, VARIANT v
)
3125 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3126 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3130 static HRESULT WINAPI
HTMLDocument6_getElementById(IHTMLDocument6
*iface
,
3131 BSTR bstrId
, IHTMLElement2
**p
)
3133 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3134 nsIDOMElement
*nselem
;
3140 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrId
), p
);
3143 * Unlike IHTMLDocument3 implementation, this is standard compliant and does
3144 * not search for name attributes, so we may simply let Gecko do the right thing.
3147 if(!This
->doc_node
->nsdoc
) {
3148 FIXME("Not a document\n");
3152 nsAString_InitDepend(&nsstr
, bstrId
);
3153 nsres
= nsIDOMHTMLDocument_GetElementById(This
->doc_node
->nsdoc
, &nsstr
, &nselem
);
3154 nsAString_Finish(&nsstr
);
3155 if(NS_FAILED(nsres
)) {
3156 ERR("GetElementById failed: %08x\n", nsres
);
3165 hres
= get_elem(This
->doc_node
, nselem
, &elem
);
3166 nsIDOMElement_Release(nselem
);
3170 *p
= &elem
->IHTMLElement2_iface
;
3174 static HRESULT WINAPI
HTMLDocument6_updateSettings(IHTMLDocument6
*iface
)
3176 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3177 FIXME("(%p)->()\n", This
);
3181 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl
= {
3182 HTMLDocument6_QueryInterface
,
3183 HTMLDocument6_AddRef
,
3184 HTMLDocument6_Release
,
3185 HTMLDocument6_GetTypeInfoCount
,
3186 HTMLDocument6_GetTypeInfo
,
3187 HTMLDocument6_GetIDsOfNames
,
3188 HTMLDocument6_Invoke
,
3189 HTMLDocument6_get_compatible
,
3190 HTMLDocument6_get_documentMode
,
3191 HTMLDocument6_put_onstorage
,
3192 HTMLDocument6_get_onstorage
,
3193 HTMLDocument6_put_onstoragecommit
,
3194 HTMLDocument6_get_onstoragecommit
,
3195 HTMLDocument6_getElementById
,
3196 HTMLDocument6_updateSettings
3199 static inline HTMLDocument
*impl_from_IHTMLDocument7(IHTMLDocument7
*iface
)
3201 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument7_iface
);
3204 static HRESULT WINAPI
HTMLDocument7_QueryInterface(IHTMLDocument7
*iface
, REFIID riid
, void **ppv
)
3206 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3207 return htmldoc_query_interface(This
, riid
, ppv
);
3210 static ULONG WINAPI
HTMLDocument7_AddRef(IHTMLDocument7
*iface
)
3212 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3213 return htmldoc_addref(This
);
3216 static ULONG WINAPI
HTMLDocument7_Release(IHTMLDocument7
*iface
)
3218 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3219 return htmldoc_release(This
);
3222 static HRESULT WINAPI
HTMLDocument7_GetTypeInfoCount(IHTMLDocument7
*iface
, UINT
*pctinfo
)
3224 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3225 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3228 static HRESULT WINAPI
HTMLDocument7_GetTypeInfo(IHTMLDocument7
*iface
, UINT iTInfo
,
3229 LCID lcid
, ITypeInfo
**ppTInfo
)
3231 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3232 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3235 static HRESULT WINAPI
HTMLDocument7_GetIDsOfNames(IHTMLDocument7
*iface
, REFIID riid
,
3236 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3238 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3239 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
3243 static HRESULT WINAPI
HTMLDocument7_Invoke(IHTMLDocument7
*iface
, DISPID dispIdMember
,
3244 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3245 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3247 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3248 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3249 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3252 static HRESULT WINAPI
HTMLDocument7_get_defaultView(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
3254 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3256 TRACE("(%p)->(%p)\n", This
, p
);
3258 *p
= &This
->window
->base
.IHTMLWindow2_iface
;
3259 IHTMLWindow2_AddRef(*p
);
3263 static HRESULT WINAPI
HTMLDocument7_createCDATASection(IHTMLDocument7
*iface
, BSTR text
, IHTMLDOMNode
**newCDATASectionNode
)
3265 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3266 FIXME("(%p)->(%p)\n", This
, newCDATASectionNode
);
3270 static HRESULT WINAPI
HTMLDocument7_getSelection(IHTMLDocument7
*iface
, IHTMLSelection
**ppIHTMLSelection
)
3272 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3273 FIXME("(%p)->(%p)\n", This
, ppIHTMLSelection
);
3277 static HRESULT WINAPI
HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3278 BSTR bstrLocalName
, IHTMLElementCollection
**pelColl
)
3280 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3281 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrLocalName
), pelColl
);
3285 static HRESULT WINAPI
HTMLDocument7_createElementNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
, BSTR bstrTag
, IHTMLElement
**newElem
)
3287 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3288 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrTag
), newElem
);
3292 static HRESULT WINAPI
HTMLDocument7_createAttributeNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3293 BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3295 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3296 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrAttrName
), ppAttribute
);
3300 static HRESULT WINAPI
HTMLDocument7_put_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT v
)
3302 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3303 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3307 static HRESULT WINAPI
HTMLDocument7_get_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT
*p
)
3309 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3310 FIXME("(%p)->(%p)\n", This
, p
);
3314 static HRESULT WINAPI
HTMLDocument7_get_characterSet(IHTMLDocument7
*iface
, BSTR
*p
)
3316 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3317 nsAString charset_str
;
3320 TRACE("(%p)->(%p)\n", This
, p
);
3322 if(!This
->doc_node
->nsdoc
) {
3323 FIXME("NULL nsdoc\n");
3327 nsAString_Init(&charset_str
, NULL
);
3328 nsres
= nsIDOMHTMLDocument_GetCharacterSet(This
->doc_node
->nsdoc
, &charset_str
);
3329 return return_nsstr(nsres
, &charset_str
, p
);
3332 static HRESULT WINAPI
HTMLDocument7_createElement(IHTMLDocument7
*iface
, BSTR bstrTag
, IHTMLElement
**newElem
)
3334 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3336 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrTag
), newElem
);
3338 return IHTMLDocument2_createElement(&This
->IHTMLDocument2_iface
, bstrTag
, newElem
);
3341 static HRESULT WINAPI
HTMLDocument7_createAttribute(IHTMLDocument7
*iface
, BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3343 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3345 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrAttrName
), ppAttribute
);
3347 return IHTMLDocument5_createAttribute(&This
->IHTMLDocument5_iface
, bstrAttrName
, ppAttribute
);
3350 static HRESULT WINAPI
HTMLDocument7_getElementsByClassName(IHTMLDocument7
*iface
, BSTR v
, IHTMLElementCollection
**pel
)
3352 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3353 nsIDOMNodeList
*nslist
;
3357 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
3359 if(!This
->doc_node
->nsdoc
) {
3360 FIXME("NULL nsdoc not supported\n");
3364 nsAString_InitDepend(&nsstr
, v
);
3365 nsres
= nsIDOMHTMLDocument_GetElementsByClassName(This
->doc_node
->nsdoc
, &nsstr
, &nslist
);
3366 nsAString_Finish(&nsstr
);
3368 ERR("GetElementByClassName failed: %08x\n", nsres
);
3373 *pel
= create_collection_from_nodelist(This
->doc_node
, nslist
);
3374 nsIDOMNodeList_Release(nslist
);
3378 static HRESULT WINAPI
HTMLDocument7_createProcessingInstruction(IHTMLDocument7
*iface
, BSTR target
,
3379 BSTR data
, IDOMProcessingInstruction
**newProcessingInstruction
)
3381 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3382 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(target
), debugstr_w(data
), newProcessingInstruction
);
3386 static HRESULT WINAPI
HTMLDocument7_adoptNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
, IHTMLDOMNode3
**ppNodeDest
)
3388 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3389 FIXME("(%p)->(%p %p)\n", This
, pNodeSource
, ppNodeDest
);
3393 static HRESULT WINAPI
HTMLDocument7_put_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT v
)
3395 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3396 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3400 static HRESULT WINAPI
HTMLDocument7_get_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT
*p
)
3402 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3403 FIXME("(%p)->(%p)\n", This
, p
);
3407 static HRESULT WINAPI
HTMLDocument7_get_all(IHTMLDocument7
*iface
, IHTMLElementCollection
**p
)
3409 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3411 TRACE("(%p)->(%p)\n", This
, p
);
3413 return IHTMLDocument2_get_all(&This
->IHTMLDocument2_iface
, p
);
3416 static HRESULT WINAPI
HTMLDocument7_get_inputEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3418 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3419 FIXME("(%p)->(%p)\n", This
, p
);
3423 static HRESULT WINAPI
HTMLDocument7_get_xmlEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3425 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3426 FIXME("(%p)->(%p)\n", This
, p
);
3430 static HRESULT WINAPI
HTMLDocument7_put_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL v
)
3432 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3433 FIXME("(%p)->(%x)\n", This
, v
);
3437 static HRESULT WINAPI
HTMLDocument7_get_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL
*p
)
3439 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3440 FIXME("(%p)->(%p)\n", This
, p
);
3444 static HRESULT WINAPI
HTMLDocument7_put_xmlVersion(IHTMLDocument7
*iface
, BSTR v
)
3446 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3447 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
3451 static HRESULT WINAPI
HTMLDocument7_get_xmlVersion(IHTMLDocument7
*iface
, BSTR
*p
)
3453 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3454 FIXME("(%p)->(%p)\n", This
, p
);
3458 static HRESULT WINAPI
HTMLDocument7_hasAttributes(IHTMLDocument7
*iface
, VARIANT_BOOL
*pfHasAttributes
)
3460 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3461 FIXME("(%p)->(%p)\n", This
, pfHasAttributes
);
3465 static HRESULT WINAPI
HTMLDocument7_put_onabort(IHTMLDocument7
*iface
, VARIANT v
)
3467 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3469 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3471 return set_doc_event(This
, EVENTID_ABORT
, &v
);
3474 static HRESULT WINAPI
HTMLDocument7_get_onabort(IHTMLDocument7
*iface
, VARIANT
*p
)
3476 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3478 TRACE("(%p)->(%p)\n", This
, p
);
3480 return get_doc_event(This
, EVENTID_ABORT
, p
);
3483 static HRESULT WINAPI
HTMLDocument7_put_onblur(IHTMLDocument7
*iface
, VARIANT v
)
3485 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3487 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3489 return set_doc_event(This
, EVENTID_BLUR
, &v
);
3492 static HRESULT WINAPI
HTMLDocument7_get_onblur(IHTMLDocument7
*iface
, VARIANT
*p
)
3494 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3496 TRACE("(%p)->(%p)\n", This
, p
);
3498 return get_doc_event(This
, EVENTID_BLUR
, p
);
3501 static HRESULT WINAPI
HTMLDocument7_put_oncanplay(IHTMLDocument7
*iface
, VARIANT v
)
3503 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3504 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3508 static HRESULT WINAPI
HTMLDocument7_get_oncanplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3510 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3511 FIXME("(%p)->(%p)\n", This
, p
);
3515 static HRESULT WINAPI
HTMLDocument7_put_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT v
)
3517 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3518 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3522 static HRESULT WINAPI
HTMLDocument7_get_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT
*p
)
3524 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3525 FIXME("(%p)->(%p)\n", This
, p
);
3529 static HRESULT WINAPI
HTMLDocument7_put_onchange(IHTMLDocument7
*iface
, VARIANT v
)
3531 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3533 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3535 return set_doc_event(This
, EVENTID_CHANGE
, &v
);
3538 static HRESULT WINAPI
HTMLDocument7_get_onchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3540 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3542 TRACE("(%p)->(%p)\n", This
, p
);
3544 return get_doc_event(This
, EVENTID_CHANGE
, p
);
3547 static HRESULT WINAPI
HTMLDocument7_put_ondrag(IHTMLDocument7
*iface
, VARIANT v
)
3549 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3551 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3553 return set_doc_event(This
, EVENTID_DRAG
, &v
);
3556 static HRESULT WINAPI
HTMLDocument7_get_ondrag(IHTMLDocument7
*iface
, VARIANT
*p
)
3558 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3560 TRACE("(%p)->(%p)\n", This
, p
);
3562 return get_doc_event(This
, EVENTID_DRAG
, p
);
3565 static HRESULT WINAPI
HTMLDocument7_put_ondragend(IHTMLDocument7
*iface
, VARIANT v
)
3567 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3568 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3572 static HRESULT WINAPI
HTMLDocument7_get_ondragend(IHTMLDocument7
*iface
, VARIANT
*p
)
3574 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3575 FIXME("(%p)->(%p)\n", This
, p
);
3579 static HRESULT WINAPI
HTMLDocument7_put_ondragenter(IHTMLDocument7
*iface
, VARIANT v
)
3581 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3582 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3586 static HRESULT WINAPI
HTMLDocument7_get_ondragenter(IHTMLDocument7
*iface
, VARIANT
*p
)
3588 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3589 FIXME("(%p)->(%p)\n", This
, p
);
3593 static HRESULT WINAPI
HTMLDocument7_put_ondragleave(IHTMLDocument7
*iface
, VARIANT v
)
3595 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3596 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3600 static HRESULT WINAPI
HTMLDocument7_get_ondragleave(IHTMLDocument7
*iface
, VARIANT
*p
)
3602 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3603 FIXME("(%p)->(%p)\n", This
, p
);
3607 static HRESULT WINAPI
HTMLDocument7_put_ondragover(IHTMLDocument7
*iface
, VARIANT v
)
3609 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3610 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3614 static HRESULT WINAPI
HTMLDocument7_get_ondragover(IHTMLDocument7
*iface
, VARIANT
*p
)
3616 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3617 FIXME("(%p)->(%p)\n", This
, p
);
3621 static HRESULT WINAPI
HTMLDocument7_put_ondrop(IHTMLDocument7
*iface
, VARIANT v
)
3623 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3624 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3628 static HRESULT WINAPI
HTMLDocument7_get_ondrop(IHTMLDocument7
*iface
, VARIANT
*p
)
3630 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3631 FIXME("(%p)->(%p)\n", This
, p
);
3635 static HRESULT WINAPI
HTMLDocument7_put_ondurationchange(IHTMLDocument7
*iface
, VARIANT v
)
3637 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3638 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3642 static HRESULT WINAPI
HTMLDocument7_get_ondurationchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3644 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3645 FIXME("(%p)->(%p)\n", This
, p
);
3649 static HRESULT WINAPI
HTMLDocument7_put_onemptied(IHTMLDocument7
*iface
, VARIANT v
)
3651 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3652 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3656 static HRESULT WINAPI
HTMLDocument7_get_onemptied(IHTMLDocument7
*iface
, VARIANT
*p
)
3658 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3659 FIXME("(%p)->(%p)\n", This
, p
);
3663 static HRESULT WINAPI
HTMLDocument7_put_onended(IHTMLDocument7
*iface
, VARIANT v
)
3665 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3666 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3670 static HRESULT WINAPI
HTMLDocument7_get_onended(IHTMLDocument7
*iface
, VARIANT
*p
)
3672 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3673 FIXME("(%p)->(%p)\n", This
, p
);
3677 static HRESULT WINAPI
HTMLDocument7_put_onerror(IHTMLDocument7
*iface
, VARIANT v
)
3679 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3681 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3683 return set_doc_event(This
, EVENTID_ERROR
, &v
);
3686 static HRESULT WINAPI
HTMLDocument7_get_onerror(IHTMLDocument7
*iface
, VARIANT
*p
)
3688 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3690 TRACE("(%p)->(%p)\n", This
, p
);
3692 return get_doc_event(This
, EVENTID_ERROR
, p
);
3695 static HRESULT WINAPI
HTMLDocument7_put_onfocus(IHTMLDocument7
*iface
, VARIANT v
)
3697 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3699 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3701 return set_doc_event(This
, EVENTID_FOCUS
, &v
);
3704 static HRESULT WINAPI
HTMLDocument7_get_onfocus(IHTMLDocument7
*iface
, VARIANT
*p
)
3706 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3708 TRACE("(%p)->(%p)\n", This
, p
);
3710 return get_doc_event(This
, EVENTID_FOCUS
, p
);
3713 static HRESULT WINAPI
HTMLDocument7_put_oninput(IHTMLDocument7
*iface
, VARIANT v
)
3715 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3716 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3720 static HRESULT WINAPI
HTMLDocument7_get_oninput(IHTMLDocument7
*iface
, VARIANT
*p
)
3722 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3723 FIXME("(%p)->(%p)\n", This
, p
);
3727 static HRESULT WINAPI
HTMLDocument7_put_onload(IHTMLDocument7
*iface
, VARIANT v
)
3729 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3731 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3733 return set_doc_event(This
, EVENTID_LOAD
, &v
);
3736 static HRESULT WINAPI
HTMLDocument7_get_onload(IHTMLDocument7
*iface
, VARIANT
*p
)
3738 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3740 TRACE("(%p)->(%p)\n", This
, p
);
3742 return get_doc_event(This
, EVENTID_LOAD
, p
);
3745 static HRESULT WINAPI
HTMLDocument7_put_onloadeddata(IHTMLDocument7
*iface
, VARIANT v
)
3747 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3748 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3752 static HRESULT WINAPI
HTMLDocument7_get_onloadeddata(IHTMLDocument7
*iface
, VARIANT
*p
)
3754 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3755 FIXME("(%p)->(%p)\n", This
, p
);
3759 static HRESULT WINAPI
HTMLDocument7_put_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT v
)
3761 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3762 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3766 static HRESULT WINAPI
HTMLDocument7_get_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT
*p
)
3768 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3769 FIXME("(%p)->(%p)\n", This
, p
);
3773 static HRESULT WINAPI
HTMLDocument7_put_onloadstart(IHTMLDocument7
*iface
, VARIANT v
)
3775 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3776 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3780 static HRESULT WINAPI
HTMLDocument7_get_onloadstart(IHTMLDocument7
*iface
, VARIANT
*p
)
3782 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3783 FIXME("(%p)->(%p)\n", This
, p
);
3787 static HRESULT WINAPI
HTMLDocument7_put_onpause(IHTMLDocument7
*iface
, VARIANT v
)
3789 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3790 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3794 static HRESULT WINAPI
HTMLDocument7_get_onpause(IHTMLDocument7
*iface
, VARIANT
*p
)
3796 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3797 FIXME("(%p)->(%p)\n", This
, p
);
3801 static HRESULT WINAPI
HTMLDocument7_put_onplay(IHTMLDocument7
*iface
, VARIANT v
)
3803 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3804 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3808 static HRESULT WINAPI
HTMLDocument7_get_onplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3810 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3811 FIXME("(%p)->(%p)\n", This
, p
);
3815 static HRESULT WINAPI
HTMLDocument7_put_onplaying(IHTMLDocument7
*iface
, VARIANT v
)
3817 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3818 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3822 static HRESULT WINAPI
HTMLDocument7_get_onplaying(IHTMLDocument7
*iface
, VARIANT
*p
)
3824 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3825 FIXME("(%p)->(%p)\n", This
, p
);
3829 static HRESULT WINAPI
HTMLDocument7_put_onprogress(IHTMLDocument7
*iface
, VARIANT v
)
3831 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3832 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3836 static HRESULT WINAPI
HTMLDocument7_get_onprogress(IHTMLDocument7
*iface
, VARIANT
*p
)
3838 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3839 FIXME("(%p)->(%p)\n", This
, p
);
3843 static HRESULT WINAPI
HTMLDocument7_put_onratechange(IHTMLDocument7
*iface
, VARIANT v
)
3845 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3846 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3850 static HRESULT WINAPI
HTMLDocument7_get_onratechange(IHTMLDocument7
*iface
, VARIANT
*p
)
3852 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3853 FIXME("(%p)->(%p)\n", This
, p
);
3857 static HRESULT WINAPI
HTMLDocument7_put_onreset(IHTMLDocument7
*iface
, VARIANT v
)
3859 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3860 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3864 static HRESULT WINAPI
HTMLDocument7_get_onreset(IHTMLDocument7
*iface
, VARIANT
*p
)
3866 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3867 FIXME("(%p)->(%p)\n", This
, p
);
3871 static HRESULT WINAPI
HTMLDocument7_put_onscroll(IHTMLDocument7
*iface
, VARIANT v
)
3873 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3875 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3877 return set_doc_event(This
, EVENTID_SCROLL
, &v
);
3880 static HRESULT WINAPI
HTMLDocument7_get_onscroll(IHTMLDocument7
*iface
, VARIANT
*p
)
3882 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3884 TRACE("(%p)->(%p)\n", This
, p
);
3886 return get_doc_event(This
, EVENTID_SCROLL
, p
);
3889 static HRESULT WINAPI
HTMLDocument7_put_onseekend(IHTMLDocument7
*iface
, VARIANT v
)
3891 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3892 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3896 static HRESULT WINAPI
HTMLDocument7_get_onseekend(IHTMLDocument7
*iface
, VARIANT
*p
)
3898 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3899 FIXME("(%p)->(%p)\n", This
, p
);
3903 static HRESULT WINAPI
HTMLDocument7_put_onseeking(IHTMLDocument7
*iface
, VARIANT v
)
3905 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3906 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3910 static HRESULT WINAPI
HTMLDocument7_get_onseeking(IHTMLDocument7
*iface
, VARIANT
*p
)
3912 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3913 FIXME("(%p)->(%p)\n", This
, p
);
3917 static HRESULT WINAPI
HTMLDocument7_put_onselect(IHTMLDocument7
*iface
, VARIANT v
)
3919 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3920 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3924 static HRESULT WINAPI
HTMLDocument7_get_onselect(IHTMLDocument7
*iface
, VARIANT
*p
)
3926 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3927 FIXME("(%p)->(%p)\n", This
, p
);
3931 static HRESULT WINAPI
HTMLDocument7_put_onstalled(IHTMLDocument7
*iface
, VARIANT v
)
3933 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3934 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3938 static HRESULT WINAPI
HTMLDocument7_get_onstalled(IHTMLDocument7
*iface
, VARIANT
*p
)
3940 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3941 FIXME("(%p)->(%p)\n", This
, p
);
3945 static HRESULT WINAPI
HTMLDocument7_put_onsubmit(IHTMLDocument7
*iface
, VARIANT v
)
3947 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3949 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3951 return set_doc_event(This
, EVENTID_SUBMIT
, &v
);
3954 static HRESULT WINAPI
HTMLDocument7_get_onsubmit(IHTMLDocument7
*iface
, VARIANT
*p
)
3956 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3958 TRACE("(%p)->(%p)\n", This
, p
);
3960 return get_doc_event(This
, EVENTID_SUBMIT
, p
);
3963 static HRESULT WINAPI
HTMLDocument7_put_onsuspend(IHTMLDocument7
*iface
, VARIANT v
)
3965 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3966 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3970 static HRESULT WINAPI
HTMLDocument7_get_onsuspend(IHTMLDocument7
*iface
, VARIANT
*p
)
3972 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3973 FIXME("(%p)->(%p)\n", This
, p
);
3977 static HRESULT WINAPI
HTMLDocument7_put_ontimeupdate(IHTMLDocument7
*iface
, VARIANT v
)
3979 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3980 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3984 static HRESULT WINAPI
HTMLDocument7_get_ontimeupdate(IHTMLDocument7
*iface
, VARIANT
*p
)
3986 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3987 FIXME("(%p)->(%p)\n", This
, p
);
3991 static HRESULT WINAPI
HTMLDocument7_put_onvolumechange(IHTMLDocument7
*iface
, VARIANT v
)
3993 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3994 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3998 static HRESULT WINAPI
HTMLDocument7_get_onvolumechange(IHTMLDocument7
*iface
, VARIANT
*p
)
4000 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4001 FIXME("(%p)->(%p)\n", This
, p
);
4005 static HRESULT WINAPI
HTMLDocument7_put_onwaiting(IHTMLDocument7
*iface
, VARIANT v
)
4007 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4008 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4012 static HRESULT WINAPI
HTMLDocument7_get_onwaiting(IHTMLDocument7
*iface
, VARIANT
*p
)
4014 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4015 FIXME("(%p)->(%p)\n", This
, p
);
4019 static HRESULT WINAPI
HTMLDocument7_normalize(IHTMLDocument7
*iface
)
4021 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4022 FIXME("(%p)\n", This
);
4026 static HRESULT WINAPI
HTMLDocument7_importNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
,
4027 VARIANT_BOOL fDeep
, IHTMLDOMNode3
**ppNodeDest
)
4029 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4030 FIXME("(%p)->(%p %x %p)\n", This
, pNodeSource
, fDeep
, ppNodeDest
);
4034 static HRESULT WINAPI
HTMLDocument7_get_parentWindow(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
4036 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4038 TRACE("(%p)->(%p)\n", This
, p
);
4040 return IHTMLDocument7_get_defaultView(&This
->IHTMLDocument7_iface
, p
);
4043 static HRESULT WINAPI
HTMLDocument7_put_body(IHTMLDocument7
*iface
, IHTMLElement
*v
)
4045 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4046 FIXME("(%p)->(%p)\n", This
, v
);
4050 static HRESULT WINAPI
HTMLDocument7_get_body(IHTMLDocument7
*iface
, IHTMLElement
**p
)
4052 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4054 TRACE("(%p)->(%p)\n", This
, p
);
4056 return IHTMLDocument2_get_body(&This
->IHTMLDocument2_iface
, p
);
4059 static HRESULT WINAPI
HTMLDocument7_get_head(IHTMLDocument7
*iface
, IHTMLElement
**p
)
4061 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4062 nsIDOMHTMLHeadElement
*nshead
;
4063 nsIDOMElement
*nselem
;
4068 TRACE("(%p)->(%p)\n", This
, p
);
4070 if(!This
->doc_node
->nsdoc
) {
4071 FIXME("No document\n");
4075 nsres
= nsIDOMHTMLDocument_GetHead(This
->doc_node
->nsdoc
, &nshead
);
4076 assert(nsres
== NS_OK
);
4083 nsres
= nsIDOMHTMLHeadElement_QueryInterface(nshead
, &IID_nsIDOMElement
, (void**)&nselem
);
4084 nsIDOMHTMLHeadElement_Release(nshead
);
4085 assert(nsres
== NS_OK
);
4087 hres
= get_elem(This
->doc_node
, nselem
, &elem
);
4088 nsIDOMElement_Release(nselem
);
4092 *p
= &elem
->IHTMLElement_iface
;
4096 static const IHTMLDocument7Vtbl HTMLDocument7Vtbl
= {
4097 HTMLDocument7_QueryInterface
,
4098 HTMLDocument7_AddRef
,
4099 HTMLDocument7_Release
,
4100 HTMLDocument7_GetTypeInfoCount
,
4101 HTMLDocument7_GetTypeInfo
,
4102 HTMLDocument7_GetIDsOfNames
,
4103 HTMLDocument7_Invoke
,
4104 HTMLDocument7_get_defaultView
,
4105 HTMLDocument7_createCDATASection
,
4106 HTMLDocument7_getSelection
,
4107 HTMLDocument7_getElementsByTagNameNS
,
4108 HTMLDocument7_createElementNS
,
4109 HTMLDocument7_createAttributeNS
,
4110 HTMLDocument7_put_onmsthumbnailclick
,
4111 HTMLDocument7_get_onmsthumbnailclick
,
4112 HTMLDocument7_get_characterSet
,
4113 HTMLDocument7_createElement
,
4114 HTMLDocument7_createAttribute
,
4115 HTMLDocument7_getElementsByClassName
,
4116 HTMLDocument7_createProcessingInstruction
,
4117 HTMLDocument7_adoptNode
,
4118 HTMLDocument7_put_onmssitemodejumplistitemremoved
,
4119 HTMLDocument7_get_onmssitemodejumplistitemremoved
,
4120 HTMLDocument7_get_all
,
4121 HTMLDocument7_get_inputEncoding
,
4122 HTMLDocument7_get_xmlEncoding
,
4123 HTMLDocument7_put_xmlStandalone
,
4124 HTMLDocument7_get_xmlStandalone
,
4125 HTMLDocument7_put_xmlVersion
,
4126 HTMLDocument7_get_xmlVersion
,
4127 HTMLDocument7_hasAttributes
,
4128 HTMLDocument7_put_onabort
,
4129 HTMLDocument7_get_onabort
,
4130 HTMLDocument7_put_onblur
,
4131 HTMLDocument7_get_onblur
,
4132 HTMLDocument7_put_oncanplay
,
4133 HTMLDocument7_get_oncanplay
,
4134 HTMLDocument7_put_oncanplaythrough
,
4135 HTMLDocument7_get_oncanplaythrough
,
4136 HTMLDocument7_put_onchange
,
4137 HTMLDocument7_get_onchange
,
4138 HTMLDocument7_put_ondrag
,
4139 HTMLDocument7_get_ondrag
,
4140 HTMLDocument7_put_ondragend
,
4141 HTMLDocument7_get_ondragend
,
4142 HTMLDocument7_put_ondragenter
,
4143 HTMLDocument7_get_ondragenter
,
4144 HTMLDocument7_put_ondragleave
,
4145 HTMLDocument7_get_ondragleave
,
4146 HTMLDocument7_put_ondragover
,
4147 HTMLDocument7_get_ondragover
,
4148 HTMLDocument7_put_ondrop
,
4149 HTMLDocument7_get_ondrop
,
4150 HTMLDocument7_put_ondurationchange
,
4151 HTMLDocument7_get_ondurationchange
,
4152 HTMLDocument7_put_onemptied
,
4153 HTMLDocument7_get_onemptied
,
4154 HTMLDocument7_put_onended
,
4155 HTMLDocument7_get_onended
,
4156 HTMLDocument7_put_onerror
,
4157 HTMLDocument7_get_onerror
,
4158 HTMLDocument7_put_onfocus
,
4159 HTMLDocument7_get_onfocus
,
4160 HTMLDocument7_put_oninput
,
4161 HTMLDocument7_get_oninput
,
4162 HTMLDocument7_put_onload
,
4163 HTMLDocument7_get_onload
,
4164 HTMLDocument7_put_onloadeddata
,
4165 HTMLDocument7_get_onloadeddata
,
4166 HTMLDocument7_put_onloadedmetadata
,
4167 HTMLDocument7_get_onloadedmetadata
,
4168 HTMLDocument7_put_onloadstart
,
4169 HTMLDocument7_get_onloadstart
,
4170 HTMLDocument7_put_onpause
,
4171 HTMLDocument7_get_onpause
,
4172 HTMLDocument7_put_onplay
,
4173 HTMLDocument7_get_onplay
,
4174 HTMLDocument7_put_onplaying
,
4175 HTMLDocument7_get_onplaying
,
4176 HTMLDocument7_put_onprogress
,
4177 HTMLDocument7_get_onprogress
,
4178 HTMLDocument7_put_onratechange
,
4179 HTMLDocument7_get_onratechange
,
4180 HTMLDocument7_put_onreset
,
4181 HTMLDocument7_get_onreset
,
4182 HTMLDocument7_put_onscroll
,
4183 HTMLDocument7_get_onscroll
,
4184 HTMLDocument7_put_onseekend
,
4185 HTMLDocument7_get_onseekend
,
4186 HTMLDocument7_put_onseeking
,
4187 HTMLDocument7_get_onseeking
,
4188 HTMLDocument7_put_onselect
,
4189 HTMLDocument7_get_onselect
,
4190 HTMLDocument7_put_onstalled
,
4191 HTMLDocument7_get_onstalled
,
4192 HTMLDocument7_put_onsubmit
,
4193 HTMLDocument7_get_onsubmit
,
4194 HTMLDocument7_put_onsuspend
,
4195 HTMLDocument7_get_onsuspend
,
4196 HTMLDocument7_put_ontimeupdate
,
4197 HTMLDocument7_get_ontimeupdate
,
4198 HTMLDocument7_put_onvolumechange
,
4199 HTMLDocument7_get_onvolumechange
,
4200 HTMLDocument7_put_onwaiting
,
4201 HTMLDocument7_get_onwaiting
,
4202 HTMLDocument7_normalize
,
4203 HTMLDocument7_importNode
,
4204 HTMLDocument7_get_parentWindow
,
4205 HTMLDocument7_put_body
,
4206 HTMLDocument7_get_body
,
4207 HTMLDocument7_get_head
4210 static inline HTMLDocument
*impl_from_IDocumentSelector(IDocumentSelector
*iface
)
4212 return CONTAINING_RECORD(iface
, HTMLDocument
, IDocumentSelector_iface
);
4215 static HRESULT WINAPI
DocumentSelector_QueryInterface(IDocumentSelector
*iface
, REFIID riid
, void **ppv
)
4217 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4218 return htmldoc_query_interface(This
, riid
, ppv
);
4221 static ULONG WINAPI
DocumentSelector_AddRef(IDocumentSelector
*iface
)
4223 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4224 return htmldoc_addref(This
);
4227 static ULONG WINAPI
DocumentSelector_Release(IDocumentSelector
*iface
)
4229 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4230 return htmldoc_release(This
);
4233 static HRESULT WINAPI
DocumentSelector_GetTypeInfoCount(IDocumentSelector
*iface
, UINT
*pctinfo
)
4235 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4236 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
4239 static HRESULT WINAPI
DocumentSelector_GetTypeInfo(IDocumentSelector
*iface
, UINT iTInfo
,
4240 LCID lcid
, ITypeInfo
**ppTInfo
)
4242 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4243 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4246 static HRESULT WINAPI
DocumentSelector_GetIDsOfNames(IDocumentSelector
*iface
, REFIID riid
,
4247 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4249 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4250 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
4254 static HRESULT WINAPI
DocumentSelector_Invoke(IDocumentSelector
*iface
, DISPID dispIdMember
, REFIID riid
,
4255 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4257 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4258 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
4259 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4262 static HRESULT WINAPI
DocumentSelector_querySelector(IDocumentSelector
*iface
, BSTR v
, IHTMLElement
**pel
)
4264 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4265 nsIDOMElement
*nselem
;
4271 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4273 nsAString_InitDepend(&nsstr
, v
);
4274 nsres
= nsIDOMHTMLDocument_QuerySelector(This
->doc_node
->nsdoc
, &nsstr
, &nselem
);
4275 nsAString_Finish(&nsstr
);
4276 if(NS_FAILED(nsres
)) {
4277 ERR("QuerySelector failed: %08x\n", nsres
);
4286 hres
= get_elem(This
->doc_node
, nselem
, &elem
);
4287 nsIDOMElement_Release(nselem
);
4289 *pel
= &elem
->IHTMLElement_iface
;
4293 static HRESULT WINAPI
DocumentSelector_querySelectorAll(IDocumentSelector
*iface
, BSTR v
, IHTMLDOMChildrenCollection
**pel
)
4295 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4296 nsIDOMNodeList
*node_list
;
4300 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4302 nsAString_InitDepend(&nsstr
, v
);
4303 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->doc_node
->nsdoc
, &nsstr
, &node_list
);
4304 nsAString_Finish(&nsstr
);
4305 if(NS_FAILED(nsres
)) {
4306 ERR("QuerySelectorAll failed: %08x\n", nsres
);
4310 *pel
= create_child_collection(This
->doc_node
, node_list
);
4311 nsIDOMNodeList_Release(node_list
);
4312 return *pel
? S_OK
: E_OUTOFMEMORY
;
4315 static const IDocumentSelectorVtbl DocumentSelectorVtbl
= {
4316 DocumentSelector_QueryInterface
,
4317 DocumentSelector_AddRef
,
4318 DocumentSelector_Release
,
4319 DocumentSelector_GetTypeInfoCount
,
4320 DocumentSelector_GetTypeInfo
,
4321 DocumentSelector_GetIDsOfNames
,
4322 DocumentSelector_Invoke
,
4323 DocumentSelector_querySelector
,
4324 DocumentSelector_querySelectorAll
4327 static inline HTMLDocument
*impl_from_IDocumentEvent(IDocumentEvent
*iface
)
4329 return CONTAINING_RECORD(iface
, HTMLDocument
, IDocumentEvent_iface
);
4332 static HRESULT WINAPI
DocumentEvent_QueryInterface(IDocumentEvent
*iface
, REFIID riid
, void **ppv
)
4334 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4335 return htmldoc_query_interface(This
, riid
, ppv
);
4338 static ULONG WINAPI
DocumentEvent_AddRef(IDocumentEvent
*iface
)
4340 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4341 return htmldoc_addref(This
);
4344 static ULONG WINAPI
DocumentEvent_Release(IDocumentEvent
*iface
)
4346 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4347 return htmldoc_release(This
);
4350 static HRESULT WINAPI
DocumentEvent_GetTypeInfoCount(IDocumentEvent
*iface
, UINT
*pctinfo
)
4352 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4353 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
4356 static HRESULT WINAPI
DocumentEvent_GetTypeInfo(IDocumentEvent
*iface
, UINT iTInfo
,
4357 LCID lcid
, ITypeInfo
**ppTInfo
)
4359 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4360 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4363 static HRESULT WINAPI
DocumentEvent_GetIDsOfNames(IDocumentEvent
*iface
, REFIID riid
,
4364 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4366 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4367 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
4371 static HRESULT WINAPI
DocumentEvent_Invoke(IDocumentEvent
*iface
, DISPID dispIdMember
, REFIID riid
,
4372 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4374 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4375 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
4376 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4379 static HRESULT WINAPI
DocumentEvent_createEvent(IDocumentEvent
*iface
, BSTR eventType
, IDOMEvent
**p
)
4381 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4383 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eventType
), p
);
4385 return create_document_event_str(This
->doc_node
, eventType
, p
);
4388 static const IDocumentEventVtbl DocumentEventVtbl
= {
4389 DocumentEvent_QueryInterface
,
4390 DocumentEvent_AddRef
,
4391 DocumentEvent_Release
,
4392 DocumentEvent_GetTypeInfoCount
,
4393 DocumentEvent_GetTypeInfo
,
4394 DocumentEvent_GetIDsOfNames
,
4395 DocumentEvent_Invoke
,
4396 DocumentEvent_createEvent
4399 static void HTMLDocument_on_advise(IUnknown
*iface
, cp_static_data_t
*cp
)
4401 HTMLDocument
*This
= impl_from_IHTMLDocument2((IHTMLDocument2
*)iface
);
4404 update_doc_cp_events(This
->doc_node
, cp
);
4407 static inline HTMLDocument
*impl_from_ISupportErrorInfo(ISupportErrorInfo
*iface
)
4409 return CONTAINING_RECORD(iface
, HTMLDocument
, ISupportErrorInfo_iface
);
4412 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
4414 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4415 return htmldoc_query_interface(This
, riid
, ppv
);
4418 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
4420 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4421 return htmldoc_addref(This
);
4424 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
4426 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4427 return htmldoc_release(This
);
4430 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
4432 FIXME("(%p)->(%s)\n", iface
, debugstr_mshtml_guid(riid
));
4436 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
4437 SupportErrorInfo_QueryInterface
,
4438 SupportErrorInfo_AddRef
,
4439 SupportErrorInfo_Release
,
4440 SupportErrorInfo_InterfaceSupportsErrorInfo
4443 static inline HTMLDocument
*impl_from_IDispatchEx(IDispatchEx
*iface
)
4445 return CONTAINING_RECORD(iface
, HTMLDocument
, IDispatchEx_iface
);
4448 static HRESULT
dispid_from_elem_name(HTMLDocumentNode
*This
, BSTR name
, DISPID
*dispid
)
4450 nsIDOMNodeList
*node_list
;
4457 return DISP_E_UNKNOWNNAME
;
4459 nsAString_InitDepend(&name_str
, name
);
4460 nsres
= nsIDOMHTMLDocument_GetElementsByName(This
->nsdoc
, &name_str
, &node_list
);
4461 nsAString_Finish(&name_str
);
4462 if(NS_FAILED(nsres
))
4465 nsres
= nsIDOMNodeList_GetLength(node_list
, &len
);
4466 nsIDOMNodeList_Release(node_list
);
4467 if(NS_FAILED(nsres
))
4471 return DISP_E_UNKNOWNNAME
;
4473 for(i
=0; i
< This
->elem_vars_cnt
; i
++) {
4474 if(!strcmpW(name
, This
->elem_vars
[i
])) {
4475 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
4480 if(This
->elem_vars_cnt
== This
->elem_vars_size
) {
4483 if(This
->elem_vars_size
) {
4484 new_vars
= heap_realloc(This
->elem_vars
, This
->elem_vars_size
*2*sizeof(WCHAR
*));
4486 return E_OUTOFMEMORY
;
4487 This
->elem_vars_size
*= 2;
4489 new_vars
= heap_alloc(16*sizeof(WCHAR
*));
4491 return E_OUTOFMEMORY
;
4492 This
->elem_vars_size
= 16;
4495 This
->elem_vars
= new_vars
;
4498 This
->elem_vars
[This
->elem_vars_cnt
] = heap_strdupW(name
);
4499 if(!This
->elem_vars
[This
->elem_vars_cnt
])
4500 return E_OUTOFMEMORY
;
4502 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+This
->elem_vars_cnt
++;
4506 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
4508 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4510 return htmldoc_query_interface(This
, riid
, ppv
);
4513 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
4515 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4517 return htmldoc_addref(This
);
4520 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
4522 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4524 return htmldoc_release(This
);
4527 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
4529 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4531 return IDispatchEx_GetTypeInfoCount(This
->dispex
, pctinfo
);
4534 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
4535 LCID lcid
, ITypeInfo
**ppTInfo
)
4537 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4539 return IDispatchEx_GetTypeInfo(This
->dispex
, iTInfo
, lcid
, ppTInfo
);
4542 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
4543 LPOLESTR
*rgszNames
, UINT cNames
,
4544 LCID lcid
, DISPID
*rgDispId
)
4546 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4548 return IDispatchEx_GetIDsOfNames(This
->dispex
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
4551 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
4552 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4553 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4555 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4557 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
4558 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4560 switch(dispIdMember
) {
4561 case DISPID_READYSTATE
:
4562 TRACE("DISPID_READYSTATE\n");
4564 if(!(wFlags
& DISPATCH_PROPERTYGET
))
4565 return E_INVALIDARG
;
4567 V_VT(pVarResult
) = VT_I4
;
4568 V_I4(pVarResult
) = This
->window
->readystate
;
4572 return IDispatchEx_Invoke(This
->dispex
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
4573 pVarResult
, pExcepInfo
, puArgErr
);
4576 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
4578 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4581 hres
= IDispatchEx_GetDispID(This
->dispex
, bstrName
, grfdex
, pid
);
4582 if(hres
!= DISP_E_UNKNOWNNAME
)
4585 return dispid_from_elem_name(This
->doc_node
, bstrName
, pid
);
4588 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
4589 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
4591 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4593 if(This
->window
&& id
== DISPID_IHTMLDOCUMENT2_LOCATION
&& (wFlags
& DISPATCH_PROPERTYPUT
))
4594 return IDispatchEx_InvokeEx(&This
->window
->base
.IDispatchEx_iface
, DISPID_IHTMLWINDOW2_LOCATION
,
4595 lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
4598 return IDispatchEx_InvokeEx(This
->dispex
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
4601 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
4603 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4605 return IDispatchEx_DeleteMemberByName(This
->dispex
, bstrName
, grfdex
);
4608 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
4610 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4612 return IDispatchEx_DeleteMemberByDispID(This
->dispex
, id
);
4615 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
4617 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4619 return IDispatchEx_GetMemberProperties(This
->dispex
, id
, grfdexFetch
, pgrfdex
);
4622 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
4624 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4626 return IDispatchEx_GetMemberName(This
->dispex
, id
, pbstrName
);
4629 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
4631 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4633 return IDispatchEx_GetNextDispID(This
->dispex
, grfdex
, id
, pid
);
4636 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
4638 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4640 return IDispatchEx_GetNameSpaceParent(This
->dispex
, ppunk
);
4643 static const IDispatchExVtbl DocDispatchExVtbl
= {
4644 DocDispatchEx_QueryInterface
,
4645 DocDispatchEx_AddRef
,
4646 DocDispatchEx_Release
,
4647 DocDispatchEx_GetTypeInfoCount
,
4648 DocDispatchEx_GetTypeInfo
,
4649 DocDispatchEx_GetIDsOfNames
,
4650 DocDispatchEx_Invoke
,
4651 DocDispatchEx_GetDispID
,
4652 DocDispatchEx_InvokeEx
,
4653 DocDispatchEx_DeleteMemberByName
,
4654 DocDispatchEx_DeleteMemberByDispID
,
4655 DocDispatchEx_GetMemberProperties
,
4656 DocDispatchEx_GetMemberName
,
4657 DocDispatchEx_GetNextDispID
,
4658 DocDispatchEx_GetNameSpaceParent
4661 static inline HTMLDocument
*impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo
*iface
)
4663 return CONTAINING_RECORD(iface
, HTMLDocument
, IProvideMultipleClassInfo_iface
);
4666 static HRESULT WINAPI
ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo
*iface
,
4667 REFIID riid
, void **ppv
)
4669 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4670 return htmldoc_query_interface(This
, riid
, ppv
);
4673 static ULONG WINAPI
ProvideClassInfo_AddRef(IProvideMultipleClassInfo
*iface
)
4675 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4676 return htmldoc_addref(This
);
4679 static ULONG WINAPI
ProvideClassInfo_Release(IProvideMultipleClassInfo
*iface
)
4681 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4682 return htmldoc_release(This
);
4685 static HRESULT WINAPI
ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo
*iface
, ITypeInfo
**ppTI
)
4687 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4688 TRACE("(%p)->(%p)\n", This
, ppTI
);
4689 return get_class_typeinfo(&CLSID_HTMLDocument
, ppTI
);
4692 static HRESULT WINAPI
ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo
*iface
, DWORD dwGuidKind
, GUID
*pGUID
)
4694 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4695 FIXME("(%p)->(%u %p)\n", This
, dwGuidKind
, pGUID
);
4699 static HRESULT WINAPI
ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo
*iface
, ULONG
*pcti
)
4701 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4702 FIXME("(%p)->(%p)\n", This
, pcti
);
4707 static HRESULT WINAPI
ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo
*iface
, ULONG iti
,
4708 DWORD dwFlags
, ITypeInfo
**pptiCoClass
, DWORD
*pdwTIFlags
, ULONG
*pcdispidReserved
, IID
*piidPrimary
, IID
*piidSource
)
4710 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4711 FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This
, iti
, dwFlags
, pptiCoClass
, pdwTIFlags
, pcdispidReserved
, piidPrimary
, piidSource
);
4715 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl
= {
4716 ProvideClassInfo_QueryInterface
,
4717 ProvideClassInfo_AddRef
,
4718 ProvideClassInfo_Release
,
4719 ProvideClassInfo_GetClassInfo
,
4720 ProvideClassInfo2_GetGUID
,
4721 ProvideMultipleClassInfo_GetMultiTypeInfoCount
,
4722 ProvideMultipleClassInfo_GetInfoOfIndex
4725 static BOOL
htmldoc_qi(HTMLDocument
*This
, REFIID riid
, void **ppv
)
4729 if(IsEqualGUID(&IID_IUnknown
, riid
))
4730 *ppv
= &This
->IHTMLDocument2_iface
;
4731 else if(IsEqualGUID(&IID_IDispatch
, riid
))
4732 *ppv
= &This
->IDispatchEx_iface
;
4733 else if(IsEqualGUID(&IID_IDispatchEx
, riid
))
4734 *ppv
= &This
->IDispatchEx_iface
;
4735 else if(IsEqualGUID(&IID_IHTMLDocument
, riid
))
4736 *ppv
= &This
->IHTMLDocument2_iface
;
4737 else if(IsEqualGUID(&IID_IHTMLDocument2
, riid
))
4738 *ppv
= &This
->IHTMLDocument2_iface
;
4739 else if(IsEqualGUID(&IID_IHTMLDocument3
, riid
))
4740 *ppv
= &This
->IHTMLDocument3_iface
;
4741 else if(IsEqualGUID(&IID_IHTMLDocument4
, riid
))
4742 *ppv
= &This
->IHTMLDocument4_iface
;
4743 else if(IsEqualGUID(&IID_IHTMLDocument5
, riid
))
4744 *ppv
= &This
->IHTMLDocument5_iface
;
4745 else if(IsEqualGUID(&IID_IHTMLDocument6
, riid
))
4746 *ppv
= &This
->IHTMLDocument6_iface
;
4747 else if(IsEqualGUID(&IID_IHTMLDocument7
, riid
))
4748 *ppv
= &This
->IHTMLDocument7_iface
;
4749 else if(IsEqualGUID(&IID_IDocumentSelector
, riid
))
4750 *ppv
= &This
->IDocumentSelector_iface
;
4751 else if(IsEqualGUID(&IID_IDocumentEvent
, riid
))
4752 *ppv
= &This
->IDocumentEvent_iface
;
4753 else if(IsEqualGUID(&IID_IPersist
, riid
))
4754 *ppv
= &This
->IPersistFile_iface
;
4755 else if(IsEqualGUID(&IID_IPersistMoniker
, riid
))
4756 *ppv
= &This
->IPersistMoniker_iface
;
4757 else if(IsEqualGUID(&IID_IPersistFile
, riid
))
4758 *ppv
= &This
->IPersistFile_iface
;
4759 else if(IsEqualGUID(&IID_IMonikerProp
, riid
))
4760 *ppv
= &This
->IMonikerProp_iface
;
4761 else if(IsEqualGUID(&IID_IOleObject
, riid
))
4762 *ppv
= &This
->IOleObject_iface
;
4763 else if(IsEqualGUID(&IID_IOleDocument
, riid
))
4764 *ppv
= &This
->IOleDocument_iface
;
4765 else if(IsEqualGUID(&IID_IOleDocumentView
, riid
))
4766 *ppv
= &This
->IOleDocumentView_iface
;
4767 else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
))
4768 *ppv
= &This
->IOleInPlaceActiveObject_iface
;
4769 else if(IsEqualGUID(&IID_IViewObject
, riid
))
4770 *ppv
= &This
->IViewObjectEx_iface
;
4771 else if(IsEqualGUID(&IID_IViewObject2
, riid
))
4772 *ppv
= &This
->IViewObjectEx_iface
;
4773 else if(IsEqualGUID(&IID_IViewObjectEx
, riid
))
4774 *ppv
= &This
->IViewObjectEx_iface
;
4775 else if(IsEqualGUID(&IID_IOleWindow
, riid
))
4776 *ppv
= &This
->IOleInPlaceActiveObject_iface
;
4777 else if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
))
4778 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
4779 else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
))
4780 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
4781 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
4782 *ppv
= &This
->IServiceProvider_iface
;
4783 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
4784 *ppv
= &This
->IOleCommandTarget_iface
;
4785 else if(IsEqualGUID(&IID_IOleControl
, riid
))
4786 *ppv
= &This
->IOleControl_iface
;
4787 else if(IsEqualGUID(&IID_IHlinkTarget
, riid
))
4788 *ppv
= &This
->IHlinkTarget_iface
;
4789 else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
))
4790 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
4791 else if(IsEqualGUID(&IID_IPersistStreamInit
, riid
))
4792 *ppv
= &This
->IPersistStreamInit_iface
;
4793 else if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
))
4794 *ppv
= &This
->IHTMLDocument2_iface
;
4795 else if(IsEqualGUID(&IID_ISupportErrorInfo
, riid
))
4796 *ppv
= &This
->ISupportErrorInfo_iface
;
4797 else if(IsEqualGUID(&IID_IPersistHistory
, riid
))
4798 *ppv
= &This
->IPersistHistory_iface
;
4799 else if(IsEqualGUID(&IID_IObjectWithSite
, riid
))
4800 *ppv
= &This
->IObjectWithSite_iface
;
4801 else if(IsEqualGUID(&IID_IOleContainer
, riid
))
4802 *ppv
= &This
->IOleContainer_iface
;
4803 else if(IsEqualGUID(&IID_IObjectSafety
, riid
))
4804 *ppv
= &This
->IObjectSafety_iface
;
4805 else if(IsEqualGUID(&IID_IProvideClassInfo
, riid
))
4806 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
4807 else if(IsEqualGUID(&IID_IProvideClassInfo2
, riid
))
4808 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
4809 else if(IsEqualGUID(&IID_IProvideMultipleClassInfo
, riid
))
4810 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
4811 else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
4812 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppv
);
4814 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
4815 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppv
);
4817 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
4818 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppv
);
4820 }else if(IsEqualGUID(&IID_IExternalConnection
, riid
)) {
4821 TRACE("(%p)->(IID_IExternalConnection %p) returning NULL\n", This
, ppv
);
4823 }else if(IsEqualGUID(&IID_IStdMarshalInfo
, riid
)) {
4824 TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This
, ppv
);
4831 IUnknown_AddRef((IUnknown
*)*ppv
);
4835 static cp_static_data_t HTMLDocumentEvents_data
= { HTMLDocumentEvents_tid
, HTMLDocument_on_advise
};
4837 static const cpc_entry_t HTMLDocument_cpc
[] = {
4838 {&IID_IDispatch
, &HTMLDocumentEvents_data
},
4839 {&IID_IPropertyNotifySink
},
4840 {&DIID_HTMLDocumentEvents
, &HTMLDocumentEvents_data
},
4841 {&DIID_HTMLDocumentEvents2
},
4845 static void init_doc(HTMLDocument
*doc
, IUnknown
*outer
, IDispatchEx
*dispex
)
4847 doc
->IHTMLDocument2_iface
.lpVtbl
= &HTMLDocumentVtbl
;
4848 doc
->IHTMLDocument3_iface
.lpVtbl
= &HTMLDocument3Vtbl
;
4849 doc
->IHTMLDocument4_iface
.lpVtbl
= &HTMLDocument4Vtbl
;
4850 doc
->IHTMLDocument5_iface
.lpVtbl
= &HTMLDocument5Vtbl
;
4851 doc
->IHTMLDocument6_iface
.lpVtbl
= &HTMLDocument6Vtbl
;
4852 doc
->IHTMLDocument7_iface
.lpVtbl
= &HTMLDocument7Vtbl
;
4853 doc
->IDispatchEx_iface
.lpVtbl
= &DocDispatchExVtbl
;
4854 doc
->IDocumentSelector_iface
.lpVtbl
= &DocumentSelectorVtbl
;
4855 doc
->IDocumentEvent_iface
.lpVtbl
= &DocumentEventVtbl
;
4856 doc
->ISupportErrorInfo_iface
.lpVtbl
= &SupportErrorInfoVtbl
;
4857 doc
->IProvideMultipleClassInfo_iface
.lpVtbl
= &ProvideMultipleClassInfoVtbl
;
4859 doc
->outer_unk
= outer
;
4860 doc
->dispex
= dispex
;
4862 HTMLDocument_Persist_Init(doc
);
4863 HTMLDocument_OleCmd_Init(doc
);
4864 HTMLDocument_OleObj_Init(doc
);
4865 HTMLDocument_View_Init(doc
);
4866 HTMLDocument_Service_Init(doc
);
4868 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)&doc
->IHTMLDocument2_iface
, HTMLDocument_cpc
);
4871 static inline HTMLDocumentNode
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
4873 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
);
4876 static HRESULT
HTMLDocumentNode_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
4878 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4880 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4882 if(htmldoc_qi(&This
->basedoc
, riid
, ppv
))
4883 return *ppv
? S_OK
: E_NOINTERFACE
;
4885 if(IsEqualGUID(&IID_IInternetHostSecurityManager
, riid
))
4886 *ppv
= &This
->IInternetHostSecurityManager_iface
;
4888 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
4890 IUnknown_AddRef((IUnknown
*)*ppv
);
4894 static void HTMLDocumentNode_destructor(HTMLDOMNode
*iface
)
4896 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4899 for(i
=0; i
< This
->elem_vars_cnt
; i
++)
4900 heap_free(This
->elem_vars
[i
]);
4901 heap_free(This
->elem_vars
);
4903 detach_events(This
);
4905 ICatInformation_Release(This
->catmgr
);
4907 detach_selection(This
);
4908 detach_ranges(This
);
4910 while(!list_empty(&This
->plugin_hosts
))
4911 detach_plugin_host(LIST_ENTRY(list_head(&This
->plugin_hosts
), PluginHost
, entry
));
4913 if(!This
->nsdoc
&& This
->window
) {
4914 /* document fragments own reference to inner window */
4915 IHTMLWindow2_Release(&This
->window
->base
.IHTMLWindow2_iface
);
4916 This
->window
= NULL
;
4919 heap_free(This
->event_vector
);
4920 ConnectionPointContainer_Destroy(&This
->basedoc
.cp_container
);
4923 static HRESULT
HTMLDocumentNode_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
4925 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4926 FIXME("%p\n", This
);
4930 static void HTMLDocumentNode_traverse(HTMLDOMNode
*iface
, nsCycleCollectionTraversalCallback
*cb
)
4932 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4935 note_cc_edge((nsISupports
*)This
->nsdoc
, "This->nsdoc", cb
);
4938 static void HTMLDocumentNode_unlink(HTMLDOMNode
*iface
)
4940 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4943 nsIDOMHTMLDocument
*nsdoc
= This
->nsdoc
;
4945 release_document_mutation(This
);
4947 nsIDOMHTMLDocument_Release(nsdoc
);
4948 This
->window
= NULL
;
4952 static const NodeImplVtbl HTMLDocumentNodeImplVtbl
= {
4953 &CLSID_HTMLDocument
,
4954 HTMLDocumentNode_QI
,
4955 HTMLDocumentNode_destructor
,
4957 HTMLDocumentNode_clone
,
4968 HTMLDocumentNode_traverse
,
4969 HTMLDocumentNode_unlink
4972 static HRESULT
HTMLDocumentFragment_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
4974 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4975 HTMLDocumentNode
*new_node
;
4978 hres
= create_document_fragment(nsnode
, This
->node
.doc
, &new_node
);
4982 *ret
= &new_node
->node
;
4986 static inline HTMLDocumentNode
*impl_from_DispatchEx(DispatchEx
*iface
)
4988 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
.event_target
.dispex
);
4991 static HRESULT
HTMLDocumentNode_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
4992 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
4994 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
4995 nsIDOMNodeList
*node_list
;
5003 if(flags
!= DISPATCH_PROPERTYGET
&& flags
!= (DISPATCH_METHOD
|DISPATCH_PROPERTYGET
)) {
5004 FIXME("unsupported flags %x\n", flags
);
5008 i
= id
- MSHTML_DISPID_CUSTOM_MIN
;
5010 if(!This
->nsdoc
|| i
>= This
->elem_vars_cnt
)
5011 return DISP_E_UNKNOWNNAME
;
5013 nsAString_InitDepend(&name_str
, This
->elem_vars
[i
]);
5014 nsres
= nsIDOMHTMLDocument_GetElementsByName(This
->nsdoc
, &name_str
, &node_list
);
5015 nsAString_Finish(&name_str
);
5016 if(NS_FAILED(nsres
))
5019 nsres
= nsIDOMNodeList_Item(node_list
, 0, &nsnode
);
5020 nsIDOMNodeList_Release(node_list
);
5021 if(NS_FAILED(nsres
) || !nsnode
)
5022 return DISP_E_UNKNOWNNAME
;
5024 hres
= get_node(This
, nsnode
, TRUE
, &node
);
5028 V_VT(res
) = VT_DISPATCH
;
5029 V_DISPATCH(res
) = (IDispatch
*)&node
->IHTMLDOMNode_iface
;
5033 static compat_mode_t
HTMLDocumentNode_get_compat_mode(DispatchEx
*dispex
)
5035 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5037 TRACE("(%p) returning %u\n", This
, This
->document_mode
);
5039 This
->document_mode_locked
= TRUE
;
5040 return This
->document_mode
;
5043 static void HTMLDocumentNode_bind_event(DispatchEx
*dispex
, eventid_t eid
)
5045 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5046 ensure_doc_nsevent_handler(This
, eid
);
5049 static EventTarget
*HTMLDocumentNode_get_parent_event_target(DispatchEx
*dispex
)
5051 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5054 IHTMLWindow2_AddRef(&This
->window
->base
.IHTMLWindow2_iface
);
5055 return &This
->window
->event_target
;
5058 static ConnectionPointContainer
*HTMLDocumentNode_get_cp_container(DispatchEx
*dispex
)
5060 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5061 ConnectionPointContainer
*container
= This
->basedoc
.doc_obj
5062 ? &This
->basedoc
.doc_obj
->basedoc
.cp_container
: &This
->basedoc
.cp_container
;
5063 IConnectionPointContainer_AddRef(&container
->IConnectionPointContainer_iface
);
5067 static IHTMLEventObj
*HTMLDocumentNode_set_current_event(DispatchEx
*dispex
, IHTMLEventObj
*event
)
5069 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5070 return default_set_current_event(This
->window
, event
);
5073 static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl
= {
5077 HTMLDocumentNode_invoke
,
5078 HTMLDocumentNode_get_compat_mode
,
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_locked
= TRUE
;
5171 doc
->document_mode
= parent_mode
;
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
;
5209 static inline HTMLDocumentObj
*impl_from_IUnknown(IUnknown
*iface
)
5211 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IUnknown_outer
);
5214 static HRESULT WINAPI
HTMLDocumentObj_QueryInterface(IUnknown
*iface
, REFIID riid
, void **ppv
)
5216 HTMLDocumentObj
*This
= impl_from_IUnknown(iface
);
5218 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
5220 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
5221 *ppv
= &This
->IUnknown_outer
;
5222 }else if(htmldoc_qi(&This
->basedoc
, riid
, ppv
)) {
5223 return *ppv
? S_OK
: E_NOINTERFACE
;
5224 }else if(IsEqualGUID(&IID_ICustomDoc
, riid
)) {
5225 *ppv
= &This
->ICustomDoc_iface
;
5226 }else if(IsEqualGUID(&IID_ITargetContainer
, riid
)) {
5227 *ppv
= &This
->ITargetContainer_iface
;
5228 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
5229 return *ppv
? S_OK
: E_NOINTERFACE
;
5231 FIXME("Unimplemented interface %s\n", debugstr_mshtml_guid(riid
));
5233 return E_NOINTERFACE
;
5236 IUnknown_AddRef((IUnknown
*)*ppv
);
5240 static ULONG WINAPI
HTMLDocumentObj_AddRef(IUnknown
*iface
)
5242 HTMLDocumentObj
*This
= impl_from_IUnknown(iface
);
5243 ULONG ref
= InterlockedIncrement(&This
->ref
);
5245 TRACE("(%p) ref = %u\n", This
, ref
);
5250 static ULONG WINAPI
HTMLDocumentObj_Release(IUnknown
*iface
)
5252 HTMLDocumentObj
*This
= impl_from_IUnknown(iface
);
5253 ULONG ref
= InterlockedDecrement(&This
->ref
);
5255 TRACE("(%p) ref = %u\n", This
, ref
);
5258 nsIDOMWindowUtils
*window_utils
= NULL
;
5260 if(This
->basedoc
.window
&& This
->basedoc
.window
->nswindow
)
5261 get_nsinterface((nsISupports
*)This
->basedoc
.window
->nswindow
, &IID_nsIDOMWindowUtils
, (void**)&window_utils
);
5263 if(This
->basedoc
.doc_node
) {
5264 This
->basedoc
.doc_node
->basedoc
.doc_obj
= NULL
;
5265 htmldoc_release(&This
->basedoc
.doc_node
->basedoc
);
5267 if(This
->basedoc
.window
) {
5268 This
->basedoc
.window
->doc_obj
= NULL
;
5269 IHTMLWindow2_Release(&This
->basedoc
.window
->base
.IHTMLWindow2_iface
);
5271 if(This
->advise_holder
)
5272 IOleAdviseHolder_Release(This
->advise_holder
);
5275 IAdviseSink_Release(This
->view_sink
);
5277 IOleObject_SetClientSite(&This
->basedoc
.IOleObject_iface
, NULL
);
5279 ICustomDoc_SetUIHandler(&This
->ICustomDoc_iface
, NULL
);
5280 if(This
->in_place_active
)
5281 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->basedoc
.IOleInPlaceObjectWindowless_iface
);
5283 IOleDocumentView_SetInPlaceSite(&This
->basedoc
.IOleDocumentView_iface
, NULL
);
5285 IOleUndoManager_Release(This
->undomgr
);
5287 IHTMLEditServices_Release(This
->editsvcs
);
5288 if(This
->tooltips_hwnd
)
5289 DestroyWindow(This
->tooltips_hwnd
);
5292 DestroyWindow(This
->hwnd
);
5293 heap_free(This
->mime
);
5295 remove_target_tasks(This
->task_magic
);
5296 ConnectionPointContainer_Destroy(&This
->basedoc
.cp_container
);
5297 release_dispex(&This
->dispex
);
5299 if(This
->nscontainer
)
5300 NSContainer_Release(This
->nscontainer
);
5303 /* Force cycle collection */
5305 nsIDOMWindowUtils_CycleCollect(window_utils
, NULL
, 0);
5306 nsIDOMWindowUtils_Release(window_utils
);
5313 static const IUnknownVtbl HTMLDocumentObjVtbl
= {
5314 HTMLDocumentObj_QueryInterface
,
5315 HTMLDocumentObj_AddRef
,
5316 HTMLDocumentObj_Release
5319 /**********************************************************
5320 * ICustomDoc implementation
5323 static inline HTMLDocumentObj
*impl_from_ICustomDoc(ICustomDoc
*iface
)
5325 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, ICustomDoc_iface
);
5328 static HRESULT WINAPI
CustomDoc_QueryInterface(ICustomDoc
*iface
, REFIID riid
, void **ppv
)
5330 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5332 return htmldoc_query_interface(&This
->basedoc
, riid
, ppv
);
5335 static ULONG WINAPI
CustomDoc_AddRef(ICustomDoc
*iface
)
5337 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5339 return htmldoc_addref(&This
->basedoc
);
5342 static ULONG WINAPI
CustomDoc_Release(ICustomDoc
*iface
)
5344 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5346 return htmldoc_release(&This
->basedoc
);
5349 static HRESULT WINAPI
CustomDoc_SetUIHandler(ICustomDoc
*iface
, IDocHostUIHandler
*pUIHandler
)
5351 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5352 IOleCommandTarget
*cmdtrg
;
5355 TRACE("(%p)->(%p)\n", This
, pUIHandler
);
5357 if(This
->custom_hostui
&& This
->hostui
== pUIHandler
)
5360 This
->custom_hostui
= TRUE
;
5363 IDocHostUIHandler_Release(This
->hostui
);
5365 IDocHostUIHandler_AddRef(pUIHandler
);
5366 This
->hostui
= pUIHandler
;
5370 hres
= IDocHostUIHandler_QueryInterface(pUIHandler
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5371 if(SUCCEEDED(hres
)) {
5372 FIXME("custom UI handler supports IOleCommandTarget\n");
5373 IOleCommandTarget_Release(cmdtrg
);
5379 static const ICustomDocVtbl CustomDocVtbl
= {
5380 CustomDoc_QueryInterface
,
5383 CustomDoc_SetUIHandler
5386 static const tid_t HTMLDocumentObj_iface_tids
[] = {
5393 static dispex_static_data_t HTMLDocumentObj_dispex
= {
5395 DispHTMLDocument_tid
,
5396 HTMLDocumentObj_iface_tids
5399 static HRESULT
create_document_object(BOOL is_mhtml
, IUnknown
*outer
, REFIID riid
, void **ppv
)
5401 mozIDOMWindowProxy
*mozwindow
;
5402 HTMLDocumentObj
*doc
;
5403 nsIDOMWindow
*nswindow
= NULL
;
5407 if(outer
&& !IsEqualGUID(&IID_IUnknown
, riid
)) {
5409 return E_INVALIDARG
;
5412 doc
= heap_alloc_zero(sizeof(HTMLDocumentObj
));
5414 return E_OUTOFMEMORY
;
5417 doc
->IUnknown_outer
.lpVtbl
= &HTMLDocumentObjVtbl
;
5418 doc
->ICustomDoc_iface
.lpVtbl
= &CustomDocVtbl
;
5420 init_dispex(&doc
->dispex
, (IUnknown
*)&doc
->ICustomDoc_iface
, &HTMLDocumentObj_dispex
);
5421 init_doc(&doc
->basedoc
, outer
? outer
: &doc
->IUnknown_outer
, &doc
->dispex
.IDispatchEx_iface
);
5422 TargetContainer_Init(doc
);
5423 doc
->basedoc
.doc_obj
= doc
;
5424 doc
->is_mhtml
= is_mhtml
;
5426 doc
->usermode
= UNKNOWN_USERMODE
;
5427 doc
->task_magic
= get_task_target_magic();
5429 init_binding_ui(doc
);
5431 hres
= create_nscontainer(doc
, &doc
->nscontainer
);
5433 ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n");
5434 htmldoc_release(&doc
->basedoc
);
5438 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
5439 *ppv
= &doc
->IUnknown_outer
;
5441 hres
= htmldoc_query_interface(&doc
->basedoc
, riid
, ppv
);
5442 htmldoc_release(&doc
->basedoc
);
5447 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &mozwindow
);
5448 if(NS_FAILED(nsres
))
5449 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
5451 nsres
= mozIDOMWindowProxy_QueryInterface(mozwindow
, &IID_nsIDOMWindow
, (void**)&nswindow
);
5452 mozIDOMWindowProxy_Release(mozwindow
);
5453 assert(nsres
== NS_OK
);
5455 hres
= HTMLOuterWindow_Create(doc
, nswindow
, NULL
/* FIXME */, &doc
->basedoc
.window
);
5457 nsIDOMWindow_Release(nswindow
);
5459 htmldoc_release(&doc
->basedoc
);
5463 if(!doc
->basedoc
.doc_node
&& doc
->basedoc
.window
->base
.inner_window
->doc
) {
5464 doc
->basedoc
.doc_node
= doc
->basedoc
.window
->base
.inner_window
->doc
;
5465 htmldoc_addref(&doc
->basedoc
.doc_node
->basedoc
);
5473 HRESULT
HTMLDocument_Create(IUnknown
*outer
, REFIID riid
, void **ppv
)
5475 TRACE("(%p %s %p)\n", outer
, debugstr_mshtml_guid(riid
), ppv
);
5476 return create_document_object(FALSE
, outer
, riid
, ppv
);
5479 HRESULT
MHTMLDocument_Create(IUnknown
*outer
, REFIID riid
, void **ppv
)
5481 TRACE("(%p %s %p)\n", outer
, debugstr_mshtml_guid(riid
), ppv
);
5482 return create_document_object(TRUE
, outer
, riid
, ppv
);