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
);
921 nsAString charset_str
;
924 TRACE("(%p)->(%p)\n", This
, p
);
926 if(!This
->doc_node
->nsdoc
) {
927 FIXME("NULL nsdoc\n");
931 nsAString_Init(&charset_str
, NULL
);
932 nsres
= nsIDOMHTMLDocument_GetCharacterSet(This
->doc_node
->nsdoc
, &charset_str
);
933 return return_nsstr(nsres
, &charset_str
, p
);
936 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
938 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
939 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
943 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
945 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
947 TRACE("(%p)->(%p)\n", This
, p
);
949 *p
= charset_string_from_cp(GetACP());
950 return *p
? S_OK
: E_OUTOFMEMORY
;
953 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
955 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
956 FIXME("(%p)->(%p)\n", This
, p
);
960 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
962 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
963 FIXME("(%p)->(%p)\n", This
, p
);
967 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
969 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
970 FIXME("(%p)->(%p)\n", This
, p
);
974 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
976 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
977 FIXME("(%p)->(%p)\n", This
, p
);
981 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
983 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
984 FIXME("(%p)->(%p)\n", This
, p
);
988 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
990 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
991 FIXME("(%p)->(%p)\n", This
, p
);
995 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
997 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
998 FIXME("(%p)->(%p)\n", This
, p
);
1002 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
1004 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1005 FIXME("(%p)->(%p)\n", This
, p
);
1009 static HRESULT
document_write(HTMLDocument
*This
, SAFEARRAY
*psarray
, BOOL ln
)
1018 if(!This
->doc_node
->nsdoc
) {
1019 WARN("NULL nsdoc\n");
1020 return E_UNEXPECTED
;
1026 if(psarray
->cDims
!= 1) {
1027 FIXME("cDims=%d\n", psarray
->cDims
);
1028 return E_INVALIDARG
;
1031 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
1033 WARN("SafeArrayAccessData failed: %08x\n", hres
);
1037 V_VT(&tmp
) = VT_EMPTY
;
1039 jsctx
= get_context_from_document(This
->doc_node
->nsdoc
);
1040 argc
= psarray
->rgsabound
[0].cElements
;
1041 for(i
=0; i
< argc
; i
++) {
1042 if(V_VT(var
+i
) == VT_BSTR
) {
1043 nsAString_InitDepend(&nsstr
, V_BSTR(var
+i
));
1045 hres
= VariantChangeTypeEx(&tmp
, var
+i
, MAKELCID(MAKELANGID(LANG_ENGLISH
,SUBLANG_ENGLISH_US
),SORT_DEFAULT
), 0, VT_BSTR
);
1047 WARN("Could not convert %s to string\n", debugstr_variant(var
+i
));
1050 nsAString_InitDepend(&nsstr
, V_BSTR(&tmp
));
1053 if(!ln
|| i
!= argc
-1)
1054 nsres
= nsIDOMHTMLDocument_Write(This
->doc_node
->nsdoc
, &nsstr
, jsctx
);
1056 nsres
= nsIDOMHTMLDocument_Writeln(This
->doc_node
->nsdoc
, &nsstr
, jsctx
);
1057 nsAString_Finish(&nsstr
);
1058 if(V_VT(var
+i
) != VT_BSTR
)
1060 if(NS_FAILED(nsres
)) {
1061 ERR("Write failed: %08x\n", nsres
);
1067 SafeArrayUnaccessData(psarray
);
1072 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
1074 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1076 TRACE("(%p)->(%p)\n", iface
, psarray
);
1078 return document_write(This
, psarray
, FALSE
);
1081 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
1083 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1085 TRACE("(%p)->(%p)\n", This
, psarray
);
1087 return document_write(This
, psarray
, TRUE
);
1090 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
1091 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
1093 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1097 static const WCHAR text_htmlW
[] = {'t','e','x','t','/','h','t','m','l',0};
1099 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
1100 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
1102 if(!This
->doc_node
->nsdoc
) {
1107 if(!url
|| strcmpW(url
, text_htmlW
) || V_VT(&name
) != VT_ERROR
1108 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
1109 FIXME("unsupported args\n");
1111 nsres
= nsIDOMHTMLDocument_Open(This
->doc_node
->nsdoc
, NULL
, NULL
, NULL
,
1112 get_context_from_document(This
->doc_node
->nsdoc
), 0, &tmp
);
1113 if(NS_FAILED(nsres
)) {
1114 ERR("Open failed: %08x\n", nsres
);
1119 nsISupports_Release(tmp
);
1121 *pomWindowResult
= (IDispatch
*)&This
->window
->base
.IHTMLWindow2_iface
;
1122 IHTMLWindow2_AddRef(&This
->window
->base
.IHTMLWindow2_iface
);
1126 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
1128 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1131 TRACE("(%p)\n", This
);
1133 if(!This
->doc_node
->nsdoc
) {
1138 nsres
= nsIDOMHTMLDocument_Close(This
->doc_node
->nsdoc
);
1139 if(NS_FAILED(nsres
)) {
1140 ERR("Close failed: %08x\n", nsres
);
1147 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
1149 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1152 TRACE("(%p)\n", This
);
1154 nsres
= nsIDOMHTMLDocument_Clear(This
->doc_node
->nsdoc
);
1155 if(NS_FAILED(nsres
)) {
1156 ERR("Clear failed: %08x\n", nsres
);
1163 static const WCHAR copyW
[] =
1164 {'c','o','p','y',0};
1165 static const WCHAR cutW
[] =
1167 static const WCHAR fontnameW
[] =
1168 {'f','o','n','t','n','a','m','e',0};
1169 static const WCHAR fontsizeW
[] =
1170 {'f','o','n','t','s','i','z','e',0};
1171 static const WCHAR indentW
[] =
1172 {'i','n','d','e','n','t',0};
1173 static const WCHAR insertorderedlistW
[] =
1174 {'i','n','s','e','r','t','o','r','d','e','r','e','d','l','i','s','t',0};
1175 static const WCHAR insertunorderedlistW
[] =
1176 {'i','n','s','e','r','t','u','n','o','r','d','e','r','e','d','l','i','s','t',0};
1177 static const WCHAR outdentW
[] =
1178 {'o','u','t','d','e','n','t',0};
1179 static const WCHAR pasteW
[] =
1180 {'p','a','s','t','e',0};
1181 static const WCHAR respectvisibilityindesignW
[] =
1182 {'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};
1184 static const struct {
1187 }command_names
[] = {
1190 {fontnameW
, IDM_FONTNAME
},
1191 {fontsizeW
, IDM_FONTSIZE
},
1192 {indentW
, IDM_INDENT
},
1193 {insertorderedlistW
, IDM_ORDERLIST
},
1194 {insertunorderedlistW
, IDM_UNORDERLIST
},
1195 {outdentW
, IDM_OUTDENT
},
1196 {pasteW
, IDM_PASTE
},
1197 {respectvisibilityindesignW
, IDM_RESPECTVISIBILITY_INDESIGN
}
1200 static BOOL
cmdid_from_string(const WCHAR
*str
, OLECMDID
*cmdid
)
1204 for(i
= 0; i
< sizeof(command_names
)/sizeof(*command_names
); i
++) {
1205 if(!strcmpiW(command_names
[i
].name
, str
)) {
1206 *cmdid
= command_names
[i
].id
;
1211 FIXME("Unknown command %s\n", debugstr_w(str
));
1215 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
1216 VARIANT_BOOL
*pfRet
)
1218 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1219 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1223 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
1224 VARIANT_BOOL
*pfRet
)
1226 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1227 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1231 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
1232 VARIANT_BOOL
*pfRet
)
1234 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1235 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1239 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
1240 VARIANT_BOOL
*pfRet
)
1242 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1243 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1247 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
1250 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1251 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1255 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
1258 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1259 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1263 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
1264 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
1266 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1271 TRACE("(%p)->(%s %x %s %p)\n", This
, debugstr_w(cmdID
), showUI
, debugstr_variant(&value
), pfRet
);
1273 if(!cmdid_from_string(cmdID
, &cmdid
))
1274 return OLECMDERR_E_NOTSUPPORTED
;
1276 V_VT(&ret
) = VT_EMPTY
;
1277 hres
= IOleCommandTarget_Exec(&This
->IOleCommandTarget_iface
, &CGID_MSHTML
, cmdid
,
1278 showUI
? 0 : OLECMDEXECOPT_DONTPROMPTUSER
, &value
, &ret
);
1282 if(V_VT(&ret
) != VT_EMPTY
) {
1283 FIXME("Handle ret %s\n", debugstr_variant(&ret
));
1287 *pfRet
= VARIANT_TRUE
;
1291 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
1292 VARIANT_BOOL
*pfRet
)
1294 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1295 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1299 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
1300 IHTMLElement
**newElem
)
1302 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1306 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1308 hres
= create_element(This
->doc_node
, eTag
, &elem
);
1312 *newElem
= &elem
->IHTMLElement_iface
;
1316 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1318 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1319 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1323 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1325 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1326 FIXME("(%p)->(%p)\n", This
, p
);
1330 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1332 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1334 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1336 return set_doc_event(This
, EVENTID_CLICK
, &v
);
1339 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1341 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1343 TRACE("(%p)->(%p)\n", This
, p
);
1345 return get_doc_event(This
, EVENTID_CLICK
, p
);
1348 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1350 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1352 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1354 return set_doc_event(This
, EVENTID_DBLCLICK
, &v
);
1357 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1359 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1361 TRACE("(%p)->(%p)\n", This
, p
);
1363 return get_doc_event(This
, EVENTID_DBLCLICK
, p
);
1366 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1368 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1370 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1372 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1375 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1377 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1379 TRACE("(%p)->(%p)\n", This
, p
);
1381 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1384 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1386 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1388 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1390 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1393 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1395 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1397 TRACE("(%p)->(%p)\n", This
, p
);
1399 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1402 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1404 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1406 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1408 return set_doc_event(This
, EVENTID_KEYPRESS
, &v
);
1411 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1413 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1415 TRACE("(%p)->(%p)\n", This
, p
);
1417 return get_doc_event(This
, EVENTID_KEYPRESS
, p
);
1420 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1422 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1424 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1426 return set_doc_event(This
, EVENTID_MOUSEUP
, &v
);
1429 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1431 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1433 TRACE("(%p)->(%p)\n", This
, p
);
1435 return get_doc_event(This
, EVENTID_MOUSEUP
, p
);
1438 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1440 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1442 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1444 return set_doc_event(This
, EVENTID_MOUSEDOWN
, &v
);
1447 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1449 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1451 TRACE("(%p)->(%p)\n", This
, p
);
1453 return get_doc_event(This
, EVENTID_MOUSEDOWN
, p
);
1456 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1458 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1460 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1462 return set_doc_event(This
, EVENTID_MOUSEMOVE
, &v
);
1465 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1467 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1469 TRACE("(%p)->(%p)\n", This
, p
);
1471 return get_doc_event(This
, EVENTID_MOUSEMOVE
, p
);
1474 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1476 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1478 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1480 return set_doc_event(This
, EVENTID_MOUSEOUT
, &v
);
1483 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1485 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1487 TRACE("(%p)->(%p)\n", This
, p
);
1489 return get_doc_event(This
, EVENTID_MOUSEOUT
, p
);
1492 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1494 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1496 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1498 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1501 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1503 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1505 TRACE("(%p)->(%p)\n", This
, p
);
1507 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1510 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1512 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1514 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1516 return set_doc_event(This
, EVENTID_READYSTATECHANGE
, &v
);
1519 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1521 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1523 TRACE("(%p)->(%p)\n", This
, p
);
1525 return get_doc_event(This
, EVENTID_READYSTATECHANGE
, p
);
1528 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1530 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1531 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1535 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1537 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1538 FIXME("(%p)->(%p)\n", This
, p
);
1542 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1544 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1545 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1549 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1551 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1552 FIXME("(%p)->(%p)\n", This
, p
);
1556 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1558 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1559 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1563 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1565 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1566 FIXME("(%p)->(%p)\n", This
, p
);
1570 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1572 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1574 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1576 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1579 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1581 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1583 TRACE("(%p)->(%p)\n", This
, p
);
1585 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1588 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1590 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1592 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1594 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1597 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1599 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1601 TRACE("(%p)->(%p)\n", This
, p
);
1603 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1606 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, LONG x
, LONG y
,
1607 IHTMLElement
**elementHit
)
1609 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1610 nsIDOMElement
*nselem
;
1615 TRACE("(%p)->(%d %d %p)\n", This
, x
, y
, elementHit
);
1617 nsres
= nsIDOMHTMLDocument_ElementFromPoint(This
->doc_node
->nsdoc
, x
, y
, &nselem
);
1618 if(NS_FAILED(nsres
)) {
1619 ERR("ElementFromPoint failed: %08x\n", nsres
);
1628 hres
= get_node(This
->doc_node
, (nsIDOMNode
*)nselem
, TRUE
, &node
);
1629 nsIDOMElement_Release(nselem
);
1633 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)elementHit
);
1638 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1640 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1642 TRACE("(%p)->(%p)\n", This
, p
);
1644 *p
= &This
->window
->base
.IHTMLWindow2_iface
;
1645 IHTMLWindow2_AddRef(*p
);
1649 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1650 IHTMLStyleSheetsCollection
**p
)
1652 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1653 nsIDOMStyleSheetList
*nsstylelist
;
1656 TRACE("(%p)->(%p)\n", This
, p
);
1660 if(!This
->doc_node
->nsdoc
) {
1661 WARN("NULL nsdoc\n");
1662 return E_UNEXPECTED
;
1665 nsres
= nsIDOMHTMLDocument_GetStyleSheets(This
->doc_node
->nsdoc
, &nsstylelist
);
1666 if(NS_FAILED(nsres
)) {
1667 ERR("GetStyleSheets failed: %08x\n", nsres
);
1671 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1672 nsIDOMStyleSheetList_Release(nsstylelist
);
1677 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1679 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1680 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1684 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1686 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1687 FIXME("(%p)->(%p)\n", This
, p
);
1691 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1693 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1694 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1698 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1700 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1701 FIXME("(%p)->(%p)\n", This
, p
);
1705 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1707 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1709 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
1711 TRACE("(%p)->(%p)\n", This
, String
);
1714 return E_INVALIDARG
;
1716 *String
= SysAllocString(objectW
);
1717 return *String
? S_OK
: E_OUTOFMEMORY
;
1721 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1722 LONG lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1724 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1725 nsIDOMHTMLHeadElement
*head_elem
;
1726 IHTMLStyleElement
*style_elem
;
1731 static const WCHAR styleW
[] = {'s','t','y','l','e',0};
1733 TRACE("(%p)->(%s %d %p)\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1735 if(!This
->doc_node
->nsdoc
) {
1736 FIXME("not a real doc object\n");
1741 FIXME("Unsupported lIndex %d\n", lIndex
);
1743 if(bstrHref
&& *bstrHref
) {
1744 FIXME("semi-stub for href %s\n", debugstr_w(bstrHref
));
1745 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1749 hres
= create_element(This
->doc_node
, styleW
, &elem
);
1753 nsres
= nsIDOMHTMLDocument_GetHead(This
->doc_node
->nsdoc
, &head_elem
);
1754 if(NS_SUCCEEDED(nsres
)) {
1755 nsIDOMNode
*head_node
, *tmp_node
;
1757 nsres
= nsIDOMHTMLHeadElement_QueryInterface(head_elem
, &IID_nsIDOMNode
, (void**)&head_node
);
1758 nsIDOMHTMLHeadElement_Release(head_elem
);
1759 assert(nsres
== NS_OK
);
1761 nsres
= nsIDOMNode_AppendChild(head_node
, elem
->node
.nsnode
, &tmp_node
);
1762 nsIDOMNode_Release(head_node
);
1763 if(NS_SUCCEEDED(nsres
) && tmp_node
)
1764 nsIDOMNode_Release(tmp_node
);
1766 if(NS_FAILED(nsres
)) {
1767 IHTMLElement_Release(&elem
->IHTMLElement_iface
);
1771 hres
= IHTMLElement_QueryInterface(&elem
->IHTMLElement_iface
, &IID_IHTMLStyleElement
, (void**)&style_elem
);
1772 assert(hres
== S_OK
);
1773 IHTMLElement_Release(&elem
->IHTMLElement_iface
);
1775 hres
= IHTMLStyleElement_get_styleSheet(style_elem
, ppnewStyleSheet
);
1776 IHTMLStyleElement_Release(style_elem
);
1780 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1781 HTMLDocument_QueryInterface
,
1782 HTMLDocument_AddRef
,
1783 HTMLDocument_Release
,
1784 HTMLDocument_GetTypeInfoCount
,
1785 HTMLDocument_GetTypeInfo
,
1786 HTMLDocument_GetIDsOfNames
,
1787 HTMLDocument_Invoke
,
1788 HTMLDocument_get_Script
,
1789 HTMLDocument_get_all
,
1790 HTMLDocument_get_body
,
1791 HTMLDocument_get_activeElement
,
1792 HTMLDocument_get_images
,
1793 HTMLDocument_get_applets
,
1794 HTMLDocument_get_links
,
1795 HTMLDocument_get_forms
,
1796 HTMLDocument_get_anchors
,
1797 HTMLDocument_put_title
,
1798 HTMLDocument_get_title
,
1799 HTMLDocument_get_scripts
,
1800 HTMLDocument_put_designMode
,
1801 HTMLDocument_get_designMode
,
1802 HTMLDocument_get_selection
,
1803 HTMLDocument_get_readyState
,
1804 HTMLDocument_get_frames
,
1805 HTMLDocument_get_embeds
,
1806 HTMLDocument_get_plugins
,
1807 HTMLDocument_put_alinkColor
,
1808 HTMLDocument_get_alinkColor
,
1809 HTMLDocument_put_bgColor
,
1810 HTMLDocument_get_bgColor
,
1811 HTMLDocument_put_fgColor
,
1812 HTMLDocument_get_fgColor
,
1813 HTMLDocument_put_linkColor
,
1814 HTMLDocument_get_linkColor
,
1815 HTMLDocument_put_vlinkColor
,
1816 HTMLDocument_get_vlinkColor
,
1817 HTMLDocument_get_referrer
,
1818 HTMLDocument_get_location
,
1819 HTMLDocument_get_lastModified
,
1820 HTMLDocument_put_URL
,
1821 HTMLDocument_get_URL
,
1822 HTMLDocument_put_domain
,
1823 HTMLDocument_get_domain
,
1824 HTMLDocument_put_cookie
,
1825 HTMLDocument_get_cookie
,
1826 HTMLDocument_put_expando
,
1827 HTMLDocument_get_expando
,
1828 HTMLDocument_put_charset
,
1829 HTMLDocument_get_charset
,
1830 HTMLDocument_put_defaultCharset
,
1831 HTMLDocument_get_defaultCharset
,
1832 HTMLDocument_get_mimeType
,
1833 HTMLDocument_get_fileSize
,
1834 HTMLDocument_get_fileCreatedDate
,
1835 HTMLDocument_get_fileModifiedDate
,
1836 HTMLDocument_get_fileUpdatedDate
,
1837 HTMLDocument_get_security
,
1838 HTMLDocument_get_protocol
,
1839 HTMLDocument_get_nameProp
,
1841 HTMLDocument_writeln
,
1845 HTMLDocument_queryCommandSupported
,
1846 HTMLDocument_queryCommandEnabled
,
1847 HTMLDocument_queryCommandState
,
1848 HTMLDocument_queryCommandIndeterm
,
1849 HTMLDocument_queryCommandText
,
1850 HTMLDocument_queryCommandValue
,
1851 HTMLDocument_execCommand
,
1852 HTMLDocument_execCommandShowHelp
,
1853 HTMLDocument_createElement
,
1854 HTMLDocument_put_onhelp
,
1855 HTMLDocument_get_onhelp
,
1856 HTMLDocument_put_onclick
,
1857 HTMLDocument_get_onclick
,
1858 HTMLDocument_put_ondblclick
,
1859 HTMLDocument_get_ondblclick
,
1860 HTMLDocument_put_onkeyup
,
1861 HTMLDocument_get_onkeyup
,
1862 HTMLDocument_put_onkeydown
,
1863 HTMLDocument_get_onkeydown
,
1864 HTMLDocument_put_onkeypress
,
1865 HTMLDocument_get_onkeypress
,
1866 HTMLDocument_put_onmouseup
,
1867 HTMLDocument_get_onmouseup
,
1868 HTMLDocument_put_onmousedown
,
1869 HTMLDocument_get_onmousedown
,
1870 HTMLDocument_put_onmousemove
,
1871 HTMLDocument_get_onmousemove
,
1872 HTMLDocument_put_onmouseout
,
1873 HTMLDocument_get_onmouseout
,
1874 HTMLDocument_put_onmouseover
,
1875 HTMLDocument_get_onmouseover
,
1876 HTMLDocument_put_onreadystatechange
,
1877 HTMLDocument_get_onreadystatechange
,
1878 HTMLDocument_put_onafterupdate
,
1879 HTMLDocument_get_onafterupdate
,
1880 HTMLDocument_put_onrowexit
,
1881 HTMLDocument_get_onrowexit
,
1882 HTMLDocument_put_onrowenter
,
1883 HTMLDocument_get_onrowenter
,
1884 HTMLDocument_put_ondragstart
,
1885 HTMLDocument_get_ondragstart
,
1886 HTMLDocument_put_onselectstart
,
1887 HTMLDocument_get_onselectstart
,
1888 HTMLDocument_elementFromPoint
,
1889 HTMLDocument_get_parentWindow
,
1890 HTMLDocument_get_styleSheets
,
1891 HTMLDocument_put_onbeforeupdate
,
1892 HTMLDocument_get_onbeforeupdate
,
1893 HTMLDocument_put_onerrorupdate
,
1894 HTMLDocument_get_onerrorupdate
,
1895 HTMLDocument_toString
,
1896 HTMLDocument_createStyleSheet
1899 static inline HTMLDocument
*impl_from_IHTMLDocument3(IHTMLDocument3
*iface
)
1901 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument3_iface
);
1904 static HRESULT WINAPI
HTMLDocument3_QueryInterface(IHTMLDocument3
*iface
,
1905 REFIID riid
, void **ppv
)
1907 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1908 return htmldoc_query_interface(This
, riid
, ppv
);
1911 static ULONG WINAPI
HTMLDocument3_AddRef(IHTMLDocument3
*iface
)
1913 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1914 return htmldoc_addref(This
);
1917 static ULONG WINAPI
HTMLDocument3_Release(IHTMLDocument3
*iface
)
1919 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1920 return htmldoc_release(This
);
1923 static HRESULT WINAPI
HTMLDocument3_GetTypeInfoCount(IHTMLDocument3
*iface
, UINT
*pctinfo
)
1925 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1926 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1929 static HRESULT WINAPI
HTMLDocument3_GetTypeInfo(IHTMLDocument3
*iface
, UINT iTInfo
,
1930 LCID lcid
, ITypeInfo
**ppTInfo
)
1932 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1933 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1936 static HRESULT WINAPI
HTMLDocument3_GetIDsOfNames(IHTMLDocument3
*iface
, REFIID riid
,
1937 LPOLESTR
*rgszNames
, UINT cNames
,
1938 LCID lcid
, DISPID
*rgDispId
)
1940 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1941 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1945 static HRESULT WINAPI
HTMLDocument3_Invoke(IHTMLDocument3
*iface
, DISPID dispIdMember
,
1946 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1947 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1949 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1950 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1951 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1954 static HRESULT WINAPI
HTMLDocument3_releaseCapture(IHTMLDocument3
*iface
)
1956 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1957 FIXME("(%p)\n", This
);
1961 static HRESULT WINAPI
HTMLDocument3_recalc(IHTMLDocument3
*iface
, VARIANT_BOOL fForce
)
1963 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1965 WARN("(%p)->(%x)\n", This
, fForce
);
1967 /* Doing nothing here should be fine for us. */
1971 static HRESULT WINAPI
HTMLDocument3_createTextNode(IHTMLDocument3
*iface
, BSTR text
,
1972 IHTMLDOMNode
**newTextNode
)
1974 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1981 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(text
), newTextNode
);
1983 if(!This
->doc_node
->nsdoc
) {
1984 WARN("NULL nsdoc\n");
1985 return E_UNEXPECTED
;
1988 nsAString_InitDepend(&text_str
, text
);
1989 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->doc_node
->nsdoc
, &text_str
, &nstext
);
1990 nsAString_Finish(&text_str
);
1991 if(NS_FAILED(nsres
)) {
1992 ERR("CreateTextNode failed: %08x\n", nsres
);
1996 hres
= HTMLDOMTextNode_Create(This
->doc_node
, (nsIDOMNode
*)nstext
, &node
);
1997 nsIDOMText_Release(nstext
);
2001 *newTextNode
= &node
->IHTMLDOMNode_iface
;
2005 static HRESULT WINAPI
HTMLDocument3_get_documentElement(IHTMLDocument3
*iface
, IHTMLElement
**p
)
2007 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2008 nsIDOMElement
*nselem
= NULL
;
2013 TRACE("(%p)->(%p)\n", This
, p
);
2015 if(This
->window
->readystate
== READYSTATE_UNINITIALIZED
) {
2020 if(!This
->doc_node
->nsdoc
) {
2021 WARN("NULL nsdoc\n");
2022 return E_UNEXPECTED
;
2025 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->doc_node
->nsdoc
, &nselem
);
2026 if(NS_FAILED(nsres
)) {
2027 ERR("GetDocumentElement failed: %08x\n", nsres
);
2036 hres
= get_node(This
->doc_node
, (nsIDOMNode
*)nselem
, TRUE
, &node
);
2037 nsIDOMElement_Release(nselem
);
2041 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)p
);
2046 static HRESULT WINAPI
HTMLDocument3_get_uniqueID(IHTMLDocument3
*iface
, BSTR
*p
)
2048 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2050 TRACE("(%p)->(%p)\n", This
, p
);
2052 return elem_unique_id(++This
->doc_node
->unique_id
, p
);
2055 static HRESULT WINAPI
HTMLDocument3_attachEvent(IHTMLDocument3
*iface
, BSTR event
,
2056 IDispatch
* pDisp
, VARIANT_BOOL
*pfResult
)
2058 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2060 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
2062 return attach_event(&This
->doc_node
->node
.event_target
, event
, pDisp
, pfResult
);
2065 static HRESULT WINAPI
HTMLDocument3_detachEvent(IHTMLDocument3
*iface
, BSTR event
,
2068 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2070 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(event
), pDisp
);
2072 return detach_event(&This
->doc_node
->node
.event_target
, event
, pDisp
);
2075 static HRESULT WINAPI
HTMLDocument3_put_onrowsdelete(IHTMLDocument3
*iface
, VARIANT v
)
2077 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2078 FIXME("(%p)->()\n", This
);
2082 static HRESULT WINAPI
HTMLDocument3_get_onrowsdelete(IHTMLDocument3
*iface
, VARIANT
*p
)
2084 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2085 FIXME("(%p)->(%p)\n", This
, p
);
2089 static HRESULT WINAPI
HTMLDocument3_put_onrowsinserted(IHTMLDocument3
*iface
, VARIANT v
)
2091 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2092 FIXME("(%p)->()\n", This
);
2096 static HRESULT WINAPI
HTMLDocument3_get_onrowsinserted(IHTMLDocument3
*iface
, VARIANT
*p
)
2098 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2099 FIXME("(%p)->(%p)\n", This
, p
);
2103 static HRESULT WINAPI
HTMLDocument3_put_oncellchange(IHTMLDocument3
*iface
, VARIANT v
)
2105 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2106 FIXME("(%p)->()\n", This
);
2110 static HRESULT WINAPI
HTMLDocument3_get_oncellchange(IHTMLDocument3
*iface
, VARIANT
*p
)
2112 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2113 FIXME("(%p)->(%p)\n", This
, p
);
2117 static HRESULT WINAPI
HTMLDocument3_put_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT v
)
2119 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2120 FIXME("(%p)->()\n", This
);
2124 static HRESULT WINAPI
HTMLDocument3_get_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT
*p
)
2126 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2127 FIXME("(%p)->(%p)\n", This
, p
);
2131 static HRESULT WINAPI
HTMLDocument3_put_ondataavailable(IHTMLDocument3
*iface
, VARIANT v
)
2133 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2134 FIXME("(%p)->()\n", This
);
2138 static HRESULT WINAPI
HTMLDocument3_get_ondataavailable(IHTMLDocument3
*iface
, VARIANT
*p
)
2140 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2141 FIXME("(%p)->(%p)\n", This
, p
);
2145 static HRESULT WINAPI
HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT v
)
2147 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2148 FIXME("(%p)->()\n", This
);
2152 static HRESULT WINAPI
HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT
*p
)
2154 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2155 FIXME("(%p)->(%p)\n", This
, p
);
2159 static HRESULT WINAPI
HTMLDocument3_put_onpropertychange(IHTMLDocument3
*iface
, VARIANT v
)
2161 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2162 FIXME("(%p)->()\n", This
);
2166 static HRESULT WINAPI
HTMLDocument3_get_onpropertychange(IHTMLDocument3
*iface
, VARIANT
*p
)
2168 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2169 FIXME("(%p)->(%p)\n", This
, p
);
2173 static HRESULT WINAPI
HTMLDocument3_put_dir(IHTMLDocument3
*iface
, BSTR v
)
2175 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2179 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2181 if(!This
->doc_node
->nsdoc
) {
2182 FIXME("NULL nsdoc\n");
2183 return E_UNEXPECTED
;
2186 nsAString_InitDepend(&dir_str
, v
);
2187 nsres
= nsIDOMHTMLDocument_SetDir(This
->doc_node
->nsdoc
, &dir_str
);
2188 nsAString_Finish(&dir_str
);
2189 if(NS_FAILED(nsres
)) {
2190 ERR("SetDir failed: %08x\n", nsres
);
2197 static HRESULT WINAPI
HTMLDocument3_get_dir(IHTMLDocument3
*iface
, BSTR
*p
)
2199 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2203 TRACE("(%p)->(%p)\n", This
, p
);
2205 if(!This
->doc_node
->nsdoc
) {
2206 FIXME("NULL nsdoc\n");
2207 return E_UNEXPECTED
;
2210 nsAString_Init(&dir_str
, NULL
);
2211 nsres
= nsIDOMHTMLDocument_GetDir(This
->doc_node
->nsdoc
, &dir_str
);
2212 return return_nsstr(nsres
, &dir_str
, p
);
2215 static HRESULT WINAPI
HTMLDocument3_put_oncontextmenu(IHTMLDocument3
*iface
, VARIANT v
)
2217 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2219 TRACE("(%p)->()\n", This
);
2221 return set_doc_event(This
, EVENTID_CONTEXTMENU
, &v
);
2224 static HRESULT WINAPI
HTMLDocument3_get_oncontextmenu(IHTMLDocument3
*iface
, VARIANT
*p
)
2226 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2228 TRACE("(%p)->(%p)\n", This
, p
);
2230 return get_doc_event(This
, EVENTID_CONTEXTMENU
, p
);
2233 static HRESULT WINAPI
HTMLDocument3_put_onstop(IHTMLDocument3
*iface
, VARIANT v
)
2235 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2236 FIXME("(%p)->()\n", This
);
2240 static HRESULT WINAPI
HTMLDocument3_get_onstop(IHTMLDocument3
*iface
, VARIANT
*p
)
2242 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2243 FIXME("(%p)->(%p)\n", This
, p
);
2247 static HRESULT WINAPI
HTMLDocument3_createDocumentFragment(IHTMLDocument3
*iface
,
2248 IHTMLDocument2
**ppNewDoc
)
2250 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2251 nsIDOMDocumentFragment
*doc_frag
;
2252 HTMLDocumentNode
*docnode
;
2256 TRACE("(%p)->(%p)\n", This
, ppNewDoc
);
2258 if(!This
->doc_node
->nsdoc
) {
2259 FIXME("NULL nsdoc\n");
2263 nsres
= nsIDOMHTMLDocument_CreateDocumentFragment(This
->doc_node
->nsdoc
, &doc_frag
);
2264 if(NS_FAILED(nsres
)) {
2265 ERR("CreateDocumentFragment failed: %08x\n", nsres
);
2269 hres
= create_document_fragment((nsIDOMNode
*)doc_frag
, This
->doc_node
, &docnode
);
2270 nsIDOMDocumentFragment_Release(doc_frag
);
2274 *ppNewDoc
= &docnode
->basedoc
.IHTMLDocument2_iface
;
2278 static HRESULT WINAPI
HTMLDocument3_get_parentDocument(IHTMLDocument3
*iface
,
2281 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2282 FIXME("(%p)->(%p)\n", This
, p
);
2286 static HRESULT WINAPI
HTMLDocument3_put_enableDownload(IHTMLDocument3
*iface
,
2289 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2290 FIXME("(%p)->(%x)\n", This
, v
);
2294 static HRESULT WINAPI
HTMLDocument3_get_enableDownload(IHTMLDocument3
*iface
,
2297 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2298 FIXME("(%p)->(%p)\n", This
, p
);
2302 static HRESULT WINAPI
HTMLDocument3_put_baseUrl(IHTMLDocument3
*iface
, BSTR v
)
2304 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2305 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2309 static HRESULT WINAPI
HTMLDocument3_get_baseUrl(IHTMLDocument3
*iface
, BSTR
*p
)
2311 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2312 FIXME("(%p)->(%p)\n", This
, p
);
2316 static HRESULT WINAPI
HTMLDocument3_get_childNodes(IHTMLDocument3
*iface
, IDispatch
**p
)
2318 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2320 TRACE("(%p)->(%p)\n", This
, p
);
2322 return IHTMLDOMNode_get_childNodes(&This
->doc_node
->node
.IHTMLDOMNode_iface
, p
);
2325 static HRESULT WINAPI
HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3
*iface
,
2328 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2329 FIXME("(%p)->()\n", This
);
2333 static HRESULT WINAPI
HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3
*iface
,
2336 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2337 FIXME("(%p)->(%p)\n", This
, p
);
2341 static HRESULT WINAPI
HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT v
)
2343 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2344 FIXME("(%p)->()\n", This
);
2348 static HRESULT WINAPI
HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT
*p
)
2350 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2351 FIXME("(%p)->(%p)\n", This
, p
);
2355 static HRESULT WINAPI
HTMLDocument3_getElementsByName(IHTMLDocument3
*iface
, BSTR v
,
2356 IHTMLElementCollection
**ppelColl
)
2358 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2359 nsIDOMNodeList
*node_list
;
2360 nsAString selector_str
;
2364 static const WCHAR formatW
[] = {'*','[','i','d','=','%','s',']',',','*','[','n','a','m','e','=','%','s',']',0};
2366 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppelColl
);
2368 if(!This
->doc_node
|| !This
->doc_node
->nsdoc
) {
2369 /* We should probably return an empty collection. */
2370 FIXME("No nsdoc\n");
2374 selector
= heap_alloc(2*SysStringLen(v
)*sizeof(WCHAR
) + sizeof(formatW
));
2376 return E_OUTOFMEMORY
;
2377 sprintfW(selector
, formatW
, v
, v
);
2380 * NOTE: IE getElementsByName implementation differs from Gecko. It searches both name and id attributes.
2381 * That's why we use CSS selector instead. We should also use name only when it applies to given element
2382 * types and search should be case insensitive. Those are currently not supported properly.
2384 nsAString_InitDepend(&selector_str
, selector
);
2385 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->doc_node
->nsdoc
, &selector_str
, &node_list
);
2386 nsAString_Finish(&selector_str
);
2387 heap_free(selector
);
2388 if(NS_FAILED(nsres
)) {
2389 ERR("QuerySelectorAll failed: %08x\n", nsres
);
2393 *ppelColl
= create_collection_from_nodelist(This
->doc_node
, node_list
);
2394 nsIDOMNodeList_Release(node_list
);
2399 static HRESULT WINAPI
HTMLDocument3_getElementById(IHTMLDocument3
*iface
, BSTR v
,
2402 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2406 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
2408 hres
= get_doc_elem_by_id(This
->doc_node
, v
, &elem
);
2409 if(FAILED(hres
) || !elem
) {
2414 *pel
= &elem
->IHTMLElement_iface
;
2419 static HRESULT WINAPI
HTMLDocument3_getElementsByTagName(IHTMLDocument3
*iface
, BSTR v
,
2420 IHTMLElementCollection
**pelColl
)
2422 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2423 nsIDOMNodeList
*nslist
;
2427 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
2429 if(This
->doc_node
->nsdoc
) {
2430 nsAString_InitDepend(&id_str
, v
);
2431 nsres
= nsIDOMHTMLDocument_GetElementsByTagName(This
->doc_node
->nsdoc
, &id_str
, &nslist
);
2432 nsAString_Finish(&id_str
);
2434 ERR("GetElementByName failed: %08x\n", nsres
);
2438 nsIDOMDocumentFragment
*docfrag
;
2443 for(ptr
=v
; *ptr
; ptr
++) {
2444 if(!isalnumW(*ptr
)) {
2445 FIXME("Unsupported invalid tag %s\n", debugstr_w(v
));
2451 nsres
= nsIDOMNode_QueryInterface(This
->doc_node
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&docfrag
);
2452 if(NS_FAILED(nsres
)) {
2453 ERR("Could not get nsIDOMDocumentFragment iface: %08x\n", nsres
);
2454 return E_UNEXPECTED
;
2457 nsAString_InitDepend(&nsstr
, v
);
2458 nsres
= nsIDOMDocumentFragment_QuerySelectorAll(docfrag
, &nsstr
, &nslist
);
2459 nsAString_Finish(&nsstr
);
2460 nsIDOMDocumentFragment_Release(docfrag
);
2461 if(NS_FAILED(nsres
)) {
2462 ERR("QuerySelectorAll failed: %08x\n", nsres
);
2468 *pelColl
= create_collection_from_nodelist(This
->doc_node
, nslist
);
2469 nsIDOMNodeList_Release(nslist
);
2474 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl
= {
2475 HTMLDocument3_QueryInterface
,
2476 HTMLDocument3_AddRef
,
2477 HTMLDocument3_Release
,
2478 HTMLDocument3_GetTypeInfoCount
,
2479 HTMLDocument3_GetTypeInfo
,
2480 HTMLDocument3_GetIDsOfNames
,
2481 HTMLDocument3_Invoke
,
2482 HTMLDocument3_releaseCapture
,
2483 HTMLDocument3_recalc
,
2484 HTMLDocument3_createTextNode
,
2485 HTMLDocument3_get_documentElement
,
2486 HTMLDocument3_get_uniqueID
,
2487 HTMLDocument3_attachEvent
,
2488 HTMLDocument3_detachEvent
,
2489 HTMLDocument3_put_onrowsdelete
,
2490 HTMLDocument3_get_onrowsdelete
,
2491 HTMLDocument3_put_onrowsinserted
,
2492 HTMLDocument3_get_onrowsinserted
,
2493 HTMLDocument3_put_oncellchange
,
2494 HTMLDocument3_get_oncellchange
,
2495 HTMLDocument3_put_ondatasetchanged
,
2496 HTMLDocument3_get_ondatasetchanged
,
2497 HTMLDocument3_put_ondataavailable
,
2498 HTMLDocument3_get_ondataavailable
,
2499 HTMLDocument3_put_ondatasetcomplete
,
2500 HTMLDocument3_get_ondatasetcomplete
,
2501 HTMLDocument3_put_onpropertychange
,
2502 HTMLDocument3_get_onpropertychange
,
2503 HTMLDocument3_put_dir
,
2504 HTMLDocument3_get_dir
,
2505 HTMLDocument3_put_oncontextmenu
,
2506 HTMLDocument3_get_oncontextmenu
,
2507 HTMLDocument3_put_onstop
,
2508 HTMLDocument3_get_onstop
,
2509 HTMLDocument3_createDocumentFragment
,
2510 HTMLDocument3_get_parentDocument
,
2511 HTMLDocument3_put_enableDownload
,
2512 HTMLDocument3_get_enableDownload
,
2513 HTMLDocument3_put_baseUrl
,
2514 HTMLDocument3_get_baseUrl
,
2515 HTMLDocument3_get_childNodes
,
2516 HTMLDocument3_put_inheritStyleSheets
,
2517 HTMLDocument3_get_inheritStyleSheets
,
2518 HTMLDocument3_put_onbeforeeditfocus
,
2519 HTMLDocument3_get_onbeforeeditfocus
,
2520 HTMLDocument3_getElementsByName
,
2521 HTMLDocument3_getElementById
,
2522 HTMLDocument3_getElementsByTagName
2525 static inline HTMLDocument
*impl_from_IHTMLDocument4(IHTMLDocument4
*iface
)
2527 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument4_iface
);
2530 static HRESULT WINAPI
HTMLDocument4_QueryInterface(IHTMLDocument4
*iface
,
2531 REFIID riid
, void **ppv
)
2533 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2534 return htmldoc_query_interface(This
, riid
, ppv
);
2537 static ULONG WINAPI
HTMLDocument4_AddRef(IHTMLDocument4
*iface
)
2539 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2540 return htmldoc_addref(This
);
2543 static ULONG WINAPI
HTMLDocument4_Release(IHTMLDocument4
*iface
)
2545 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2546 return htmldoc_release(This
);
2549 static HRESULT WINAPI
HTMLDocument4_GetTypeInfoCount(IHTMLDocument4
*iface
, UINT
*pctinfo
)
2551 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2552 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2555 static HRESULT WINAPI
HTMLDocument4_GetTypeInfo(IHTMLDocument4
*iface
, UINT iTInfo
,
2556 LCID lcid
, ITypeInfo
**ppTInfo
)
2558 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2559 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2562 static HRESULT WINAPI
HTMLDocument4_GetIDsOfNames(IHTMLDocument4
*iface
, REFIID riid
,
2563 LPOLESTR
*rgszNames
, UINT cNames
,
2564 LCID lcid
, DISPID
*rgDispId
)
2566 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2567 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
2571 static HRESULT WINAPI
HTMLDocument4_Invoke(IHTMLDocument4
*iface
, DISPID dispIdMember
,
2572 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2573 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2575 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2576 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2577 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2580 static HRESULT WINAPI
HTMLDocument4_focus(IHTMLDocument4
*iface
)
2582 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2583 nsIDOMHTMLElement
*nsbody
;
2586 TRACE("(%p)->()\n", This
);
2588 nsres
= nsIDOMHTMLDocument_GetBody(This
->doc_node
->nsdoc
, &nsbody
);
2589 if(NS_FAILED(nsres
) || !nsbody
) {
2590 ERR("GetBody failed: %08x\n", nsres
);
2594 nsres
= nsIDOMHTMLElement_Focus(nsbody
);
2595 nsIDOMHTMLElement_Release(nsbody
);
2596 if(NS_FAILED(nsres
)) {
2597 ERR("Focus failed: %08x\n", nsres
);
2604 static HRESULT WINAPI
HTMLDocument4_hasFocus(IHTMLDocument4
*iface
, VARIANT_BOOL
*pfFocus
)
2606 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2610 TRACE("(%p)->(%p)\n", This
, pfFocus
);
2612 if(!This
->doc_node
->nsdoc
) {
2613 FIXME("Unimplemented for fragments.\n");
2617 nsres
= nsIDOMHTMLDocument_HasFocus(This
->doc_node
->nsdoc
, &has_focus
);
2618 assert(nsres
== NS_OK
);
2620 *pfFocus
= has_focus
? VARIANT_TRUE
: VARIANT_FALSE
;
2624 static HRESULT WINAPI
HTMLDocument4_put_onselectionchange(IHTMLDocument4
*iface
, VARIANT v
)
2626 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2628 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2630 return set_doc_event(This
, EVENTID_SELECTIONCHANGE
, &v
);
2633 static HRESULT WINAPI
HTMLDocument4_get_onselectionchange(IHTMLDocument4
*iface
, VARIANT
*p
)
2635 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2637 TRACE("(%p)->(%p)\n", This
, p
);
2639 return get_doc_event(This
, EVENTID_SELECTIONCHANGE
, p
);
2642 static HRESULT WINAPI
HTMLDocument4_get_namespace(IHTMLDocument4
*iface
, IDispatch
**p
)
2644 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2645 FIXME("(%p)->(%p)\n", This
, p
);
2649 static HRESULT WINAPI
HTMLDocument4_createDocumentFromUrl(IHTMLDocument4
*iface
, BSTR bstrUrl
,
2650 BSTR bstrOptions
, IHTMLDocument2
**newDoc
)
2652 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2653 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrUrl
), debugstr_w(bstrOptions
), newDoc
);
2657 static HRESULT WINAPI
HTMLDocument4_put_media(IHTMLDocument4
*iface
, BSTR v
)
2659 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2660 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2664 static HRESULT WINAPI
HTMLDocument4_get_media(IHTMLDocument4
*iface
, BSTR
*p
)
2666 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2667 FIXME("(%p)->(%p)\n", This
, p
);
2671 static HRESULT WINAPI
HTMLDocument4_createEventObject(IHTMLDocument4
*iface
,
2672 VARIANT
*pvarEventObject
, IHTMLEventObj
**ppEventObj
)
2674 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2676 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(pvarEventObject
), ppEventObj
);
2678 if(pvarEventObject
&& V_VT(pvarEventObject
) != VT_ERROR
&& V_VT(pvarEventObject
) != VT_EMPTY
) {
2679 FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject
));
2683 return create_event_obj(ppEventObj
);
2686 static HRESULT WINAPI
HTMLDocument4_fireEvent(IHTMLDocument4
*iface
, BSTR bstrEventName
,
2687 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCanceled
)
2689 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2691 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrEventName
), pvarEventObject
, pfCanceled
);
2693 return dispatch_event(&This
->doc_node
->node
, bstrEventName
, pvarEventObject
, pfCanceled
);
2696 static HRESULT WINAPI
HTMLDocument4_createRenderStyle(IHTMLDocument4
*iface
, BSTR v
,
2697 IHTMLRenderStyle
**ppIHTMLRenderStyle
)
2699 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2700 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppIHTMLRenderStyle
);
2704 static HRESULT WINAPI
HTMLDocument4_put_oncontrolselect(IHTMLDocument4
*iface
, VARIANT v
)
2706 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2707 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2711 static HRESULT WINAPI
HTMLDocument4_get_oncontrolselect(IHTMLDocument4
*iface
, VARIANT
*p
)
2713 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2714 FIXME("(%p)->(%p)\n", This
, p
);
2718 static HRESULT WINAPI
HTMLDocument4_get_URLEncoded(IHTMLDocument4
*iface
, BSTR
*p
)
2720 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2721 FIXME("(%p)->(%p)\n", This
, p
);
2725 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl
= {
2726 HTMLDocument4_QueryInterface
,
2727 HTMLDocument4_AddRef
,
2728 HTMLDocument4_Release
,
2729 HTMLDocument4_GetTypeInfoCount
,
2730 HTMLDocument4_GetTypeInfo
,
2731 HTMLDocument4_GetIDsOfNames
,
2732 HTMLDocument4_Invoke
,
2733 HTMLDocument4_focus
,
2734 HTMLDocument4_hasFocus
,
2735 HTMLDocument4_put_onselectionchange
,
2736 HTMLDocument4_get_onselectionchange
,
2737 HTMLDocument4_get_namespace
,
2738 HTMLDocument4_createDocumentFromUrl
,
2739 HTMLDocument4_put_media
,
2740 HTMLDocument4_get_media
,
2741 HTMLDocument4_createEventObject
,
2742 HTMLDocument4_fireEvent
,
2743 HTMLDocument4_createRenderStyle
,
2744 HTMLDocument4_put_oncontrolselect
,
2745 HTMLDocument4_get_oncontrolselect
,
2746 HTMLDocument4_get_URLEncoded
2749 static inline HTMLDocument
*impl_from_IHTMLDocument5(IHTMLDocument5
*iface
)
2751 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument5_iface
);
2754 static HRESULT WINAPI
HTMLDocument5_QueryInterface(IHTMLDocument5
*iface
,
2755 REFIID riid
, void **ppv
)
2757 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2758 return htmldoc_query_interface(This
, riid
, ppv
);
2761 static ULONG WINAPI
HTMLDocument5_AddRef(IHTMLDocument5
*iface
)
2763 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2764 return htmldoc_addref(This
);
2767 static ULONG WINAPI
HTMLDocument5_Release(IHTMLDocument5
*iface
)
2769 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2770 return htmldoc_release(This
);
2773 static HRESULT WINAPI
HTMLDocument5_GetTypeInfoCount(IHTMLDocument5
*iface
, UINT
*pctinfo
)
2775 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2776 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2779 static HRESULT WINAPI
HTMLDocument5_GetTypeInfo(IHTMLDocument5
*iface
, UINT iTInfo
,
2780 LCID lcid
, ITypeInfo
**ppTInfo
)
2782 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2783 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2786 static HRESULT WINAPI
HTMLDocument5_GetIDsOfNames(IHTMLDocument5
*iface
, REFIID riid
,
2787 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2789 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2790 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
2794 static HRESULT WINAPI
HTMLDocument5_Invoke(IHTMLDocument5
*iface
, DISPID dispIdMember
,
2795 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2796 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2798 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2799 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2800 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2803 static HRESULT WINAPI
HTMLDocument5_put_onmousewheel(IHTMLDocument5
*iface
, VARIANT v
)
2805 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2806 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2810 static HRESULT WINAPI
HTMLDocument5_get_onmousewheel(IHTMLDocument5
*iface
, VARIANT
*p
)
2812 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2813 FIXME("(%p)->(%p)\n", This
, p
);
2817 static HRESULT WINAPI
HTMLDocument5_get_doctype(IHTMLDocument5
*iface
, IHTMLDOMNode
**p
)
2819 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2820 FIXME("(%p)->(%p)\n", This
, p
);
2824 static HRESULT WINAPI
HTMLDocument5_get_implementation(IHTMLDocument5
*iface
, IHTMLDOMImplementation
**p
)
2826 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2827 HTMLDocumentNode
*doc_node
= This
->doc_node
;
2829 TRACE("(%p)->(%p)\n", This
, p
);
2831 if(!doc_node
->dom_implementation
) {
2834 hres
= create_dom_implementation(&doc_node
->dom_implementation
);
2839 IHTMLDOMImplementation_AddRef(doc_node
->dom_implementation
);
2840 *p
= doc_node
->dom_implementation
;
2844 static HRESULT WINAPI
HTMLDocument5_createAttribute(IHTMLDocument5
*iface
, BSTR bstrattrName
,
2845 IHTMLDOMAttribute
**ppattribute
)
2847 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2848 HTMLDOMAttribute
*attr
;
2851 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrattrName
), ppattribute
);
2853 hres
= HTMLDOMAttribute_Create(bstrattrName
, NULL
, 0, &attr
);
2857 *ppattribute
= &attr
->IHTMLDOMAttribute_iface
;
2861 static HRESULT WINAPI
HTMLDocument5_createComment(IHTMLDocument5
*iface
, BSTR bstrdata
,
2862 IHTMLDOMNode
**ppRetNode
)
2864 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2865 nsIDOMComment
*nscomment
;
2871 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrdata
), ppRetNode
);
2873 if(!This
->doc_node
->nsdoc
) {
2874 WARN("NULL nsdoc\n");
2875 return E_UNEXPECTED
;
2878 nsAString_InitDepend(&str
, bstrdata
);
2879 nsres
= nsIDOMHTMLDocument_CreateComment(This
->doc_node
->nsdoc
, &str
, &nscomment
);
2880 nsAString_Finish(&str
);
2881 if(NS_FAILED(nsres
)) {
2882 ERR("CreateTextNode failed: %08x\n", nsres
);
2886 hres
= HTMLCommentElement_Create(This
->doc_node
, (nsIDOMNode
*)nscomment
, &elem
);
2887 nsIDOMComment_Release(nscomment
);
2891 *ppRetNode
= &elem
->node
.IHTMLDOMNode_iface
;
2895 static HRESULT WINAPI
HTMLDocument5_put_onfocusin(IHTMLDocument5
*iface
, VARIANT v
)
2897 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2899 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2901 return set_doc_event(This
, EVENTID_FOCUSIN
, &v
);
2904 static HRESULT WINAPI
HTMLDocument5_get_onfocusin(IHTMLDocument5
*iface
, VARIANT
*p
)
2906 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2908 TRACE("(%p)->(%p)\n", This
, p
);
2910 return get_doc_event(This
, EVENTID_FOCUSIN
, p
);
2913 static HRESULT WINAPI
HTMLDocument5_put_onfocusout(IHTMLDocument5
*iface
, VARIANT v
)
2915 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2917 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2919 return set_doc_event(This
, EVENTID_FOCUSOUT
, &v
);
2922 static HRESULT WINAPI
HTMLDocument5_get_onfocusout(IHTMLDocument5
*iface
, VARIANT
*p
)
2924 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2926 TRACE("(%p)->(%p)\n", This
, p
);
2928 return get_doc_event(This
, EVENTID_FOCUSOUT
, p
);
2931 static HRESULT WINAPI
HTMLDocument5_put_onactivate(IHTMLDocument5
*iface
, VARIANT v
)
2933 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2934 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2938 static HRESULT WINAPI
HTMLDocument5_get_onactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2940 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2941 FIXME("(%p)->(%p)\n", This
, p
);
2945 static HRESULT WINAPI
HTMLDocument5_put_ondeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2947 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2948 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2952 static HRESULT WINAPI
HTMLDocument5_get_ondeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2954 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2955 FIXME("(%p)->(%p)\n", This
, p
);
2959 static HRESULT WINAPI
HTMLDocument5_put_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2961 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2962 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2966 static HRESULT WINAPI
HTMLDocument5_get_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2968 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2969 FIXME("(%p)->(%p)\n", This
, p
);
2973 static HRESULT WINAPI
HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2975 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2976 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2980 static HRESULT WINAPI
HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2982 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2983 FIXME("(%p)->(%p)\n", This
, p
);
2987 static HRESULT WINAPI
HTMLDocument5_get_compatMode(IHTMLDocument5
*iface
, BSTR
*p
)
2989 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2991 static const WCHAR BackCompatW
[] = {'B','a','c','k','C','o','m','p','a','t',0};
2992 static const WCHAR CSS1CompatW
[] = {'C','S','S','1','C','o','m','p','a','t',0};
2994 TRACE("(%p)->(%p)\n", This
, p
);
2996 *p
= SysAllocString(This
->doc_node
->document_mode
== COMPAT_MODE_QUIRKS
? BackCompatW
: CSS1CompatW
);
2997 return *p
? S_OK
: E_OUTOFMEMORY
;
3000 static const IHTMLDocument5Vtbl HTMLDocument5Vtbl
= {
3001 HTMLDocument5_QueryInterface
,
3002 HTMLDocument5_AddRef
,
3003 HTMLDocument5_Release
,
3004 HTMLDocument5_GetTypeInfoCount
,
3005 HTMLDocument5_GetTypeInfo
,
3006 HTMLDocument5_GetIDsOfNames
,
3007 HTMLDocument5_Invoke
,
3008 HTMLDocument5_put_onmousewheel
,
3009 HTMLDocument5_get_onmousewheel
,
3010 HTMLDocument5_get_doctype
,
3011 HTMLDocument5_get_implementation
,
3012 HTMLDocument5_createAttribute
,
3013 HTMLDocument5_createComment
,
3014 HTMLDocument5_put_onfocusin
,
3015 HTMLDocument5_get_onfocusin
,
3016 HTMLDocument5_put_onfocusout
,
3017 HTMLDocument5_get_onfocusout
,
3018 HTMLDocument5_put_onactivate
,
3019 HTMLDocument5_get_onactivate
,
3020 HTMLDocument5_put_ondeactivate
,
3021 HTMLDocument5_get_ondeactivate
,
3022 HTMLDocument5_put_onbeforeactivate
,
3023 HTMLDocument5_get_onbeforeactivate
,
3024 HTMLDocument5_put_onbeforedeactivate
,
3025 HTMLDocument5_get_onbeforedeactivate
,
3026 HTMLDocument5_get_compatMode
3029 static inline HTMLDocument
*impl_from_IHTMLDocument6(IHTMLDocument6
*iface
)
3031 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument6_iface
);
3034 static HRESULT WINAPI
HTMLDocument6_QueryInterface(IHTMLDocument6
*iface
,
3035 REFIID riid
, void **ppv
)
3037 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3038 return htmldoc_query_interface(This
, riid
, ppv
);
3041 static ULONG WINAPI
HTMLDocument6_AddRef(IHTMLDocument6
*iface
)
3043 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3044 return htmldoc_addref(This
);
3047 static ULONG WINAPI
HTMLDocument6_Release(IHTMLDocument6
*iface
)
3049 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3050 return htmldoc_release(This
);
3053 static HRESULT WINAPI
HTMLDocument6_GetTypeInfoCount(IHTMLDocument6
*iface
, UINT
*pctinfo
)
3055 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3056 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3059 static HRESULT WINAPI
HTMLDocument6_GetTypeInfo(IHTMLDocument6
*iface
, UINT iTInfo
,
3060 LCID lcid
, ITypeInfo
**ppTInfo
)
3062 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3063 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3066 static HRESULT WINAPI
HTMLDocument6_GetIDsOfNames(IHTMLDocument6
*iface
, REFIID riid
,
3067 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3069 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3070 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
3074 static HRESULT WINAPI
HTMLDocument6_Invoke(IHTMLDocument6
*iface
, DISPID dispIdMember
,
3075 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3076 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3078 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3079 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3080 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3083 static HRESULT WINAPI
HTMLDocument6_get_compatible(IHTMLDocument6
*iface
,
3084 IHTMLDocumentCompatibleInfoCollection
**p
)
3086 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3087 FIXME("(%p)->(%p)\n", This
, p
);
3091 static HRESULT WINAPI
HTMLDocument6_get_documentMode(IHTMLDocument6
*iface
, VARIANT
*p
)
3093 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3095 static const int docmode_values
[] = {
3096 5, /* DOCMODE_QUIRKS */
3097 7, /* DOCMODE_IE7 */
3098 8, /* DOCMODE_IE8 */
3099 9, /* DOCMODE_IE8 */
3100 10, /* DOCMODE_IE10 */
3101 11 /* DOCMODE_IE11 */
3104 TRACE("(%p)->(%p)\n", This
, p
);
3106 if(!This
->doc_node
) {
3107 FIXME("NULL doc_node\n");
3108 return E_UNEXPECTED
;
3111 assert(This
->doc_node
->document_mode
< sizeof(docmode_values
)/sizeof(*docmode_values
));
3114 V_I4(p
) = docmode_values
[This
->doc_node
->document_mode
];
3118 static HRESULT WINAPI
HTMLDocument6_get_onstorage(IHTMLDocument6
*iface
,
3121 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3122 FIXME("(%p)->(%p)\n", This
, p
);
3126 static HRESULT WINAPI
HTMLDocument6_put_onstorage(IHTMLDocument6
*iface
, VARIANT v
)
3128 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3129 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3133 static HRESULT WINAPI
HTMLDocument6_get_onstoragecommit(IHTMLDocument6
*iface
,
3136 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3137 FIXME("(%p)->(%p)\n", This
, p
);
3141 static HRESULT WINAPI
HTMLDocument6_put_onstoragecommit(IHTMLDocument6
*iface
, VARIANT v
)
3143 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3144 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3148 static HRESULT WINAPI
HTMLDocument6_getElementById(IHTMLDocument6
*iface
,
3149 BSTR bstrId
, IHTMLElement2
**p
)
3151 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3152 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrId
), p
);
3156 static HRESULT WINAPI
HTMLDocument6_updateSettings(IHTMLDocument6
*iface
)
3158 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3159 FIXME("(%p)->()\n", This
);
3163 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl
= {
3164 HTMLDocument6_QueryInterface
,
3165 HTMLDocument6_AddRef
,
3166 HTMLDocument6_Release
,
3167 HTMLDocument6_GetTypeInfoCount
,
3168 HTMLDocument6_GetTypeInfo
,
3169 HTMLDocument6_GetIDsOfNames
,
3170 HTMLDocument6_Invoke
,
3171 HTMLDocument6_get_compatible
,
3172 HTMLDocument6_get_documentMode
,
3173 HTMLDocument6_put_onstorage
,
3174 HTMLDocument6_get_onstorage
,
3175 HTMLDocument6_put_onstoragecommit
,
3176 HTMLDocument6_get_onstoragecommit
,
3177 HTMLDocument6_getElementById
,
3178 HTMLDocument6_updateSettings
3181 static inline HTMLDocument
*impl_from_IHTMLDocument7(IHTMLDocument7
*iface
)
3183 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument7_iface
);
3186 static HRESULT WINAPI
HTMLDocument7_QueryInterface(IHTMLDocument7
*iface
, REFIID riid
, void **ppv
)
3188 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3189 return htmldoc_query_interface(This
, riid
, ppv
);
3192 static ULONG WINAPI
HTMLDocument7_AddRef(IHTMLDocument7
*iface
)
3194 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3195 return htmldoc_addref(This
);
3198 static ULONG WINAPI
HTMLDocument7_Release(IHTMLDocument7
*iface
)
3200 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3201 return htmldoc_release(This
);
3204 static HRESULT WINAPI
HTMLDocument7_GetTypeInfoCount(IHTMLDocument7
*iface
, UINT
*pctinfo
)
3206 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3207 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3210 static HRESULT WINAPI
HTMLDocument7_GetTypeInfo(IHTMLDocument7
*iface
, UINT iTInfo
,
3211 LCID lcid
, ITypeInfo
**ppTInfo
)
3213 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3214 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3217 static HRESULT WINAPI
HTMLDocument7_GetIDsOfNames(IHTMLDocument7
*iface
, REFIID riid
,
3218 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3220 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3221 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
3225 static HRESULT WINAPI
HTMLDocument7_Invoke(IHTMLDocument7
*iface
, DISPID dispIdMember
,
3226 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3227 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3229 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3230 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3231 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3234 static HRESULT WINAPI
HTMLDocument7_get_defaultView(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
3236 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3237 FIXME("(%p)->(%p)\n", This
, p
);
3241 static HRESULT WINAPI
HTMLDocument7_createCDATASection(IHTMLDocument7
*iface
, BSTR text
, IHTMLDOMNode
**newCDATASectionNode
)
3243 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3244 FIXME("(%p)->(%p)\n", This
, newCDATASectionNode
);
3248 static HRESULT WINAPI
HTMLDocument7_getSelection(IHTMLDocument7
*iface
, IHTMLSelection
**ppIHTMLSelection
)
3250 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3251 FIXME("(%p)->(%p)\n", This
, ppIHTMLSelection
);
3255 static HRESULT WINAPI
HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3256 BSTR bstrLocalName
, IHTMLElementCollection
**pelColl
)
3258 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3259 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrLocalName
), pelColl
);
3263 static HRESULT WINAPI
HTMLDocument7_createElementNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
, BSTR bstrTag
, IHTMLElement
**newElem
)
3265 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3266 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrTag
), newElem
);
3270 static HRESULT WINAPI
HTMLDocument7_createAttributeNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3271 BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3273 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3274 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrAttrName
), ppAttribute
);
3278 static HRESULT WINAPI
HTMLDocument7_put_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT v
)
3280 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3281 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3285 static HRESULT WINAPI
HTMLDocument7_get_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT
*p
)
3287 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3288 FIXME("(%p)->(%p)\n", This
, p
);
3292 static HRESULT WINAPI
HTMLDocument7_get_characterSet(IHTMLDocument7
*iface
, BSTR
*p
)
3294 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3295 FIXME("(%p)->(%p)\n", This
, p
);
3299 static HRESULT WINAPI
HTMLDocument7_createElement(IHTMLDocument7
*iface
, BSTR bstrTag
, IHTMLElement
**newElem
)
3301 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3302 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrTag
), newElem
);
3306 static HRESULT WINAPI
HTMLDocument7_createAttribute(IHTMLDocument7
*iface
, BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3308 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3309 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrAttrName
), ppAttribute
);
3313 static HRESULT WINAPI
HTMLDocument7_getElementByClassName(IHTMLDocument7
*iface
, BSTR v
, IHTMLElementCollection
**pel
)
3315 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3316 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
3320 static HRESULT WINAPI
HTMLDocument7_createProcessingInstruction(IHTMLDocument7
*iface
, BSTR target
,
3321 BSTR data
, IDOMProcessingInstruction
**newProcessingInstruction
)
3323 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3324 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(target
), debugstr_w(data
), newProcessingInstruction
);
3328 static HRESULT WINAPI
HTMLDocument7_adoptNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
, IHTMLDOMNode3
**ppNodeDest
)
3330 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3331 FIXME("(%p)->(%p %p)\n", This
, pNodeSource
, ppNodeDest
);
3335 static HRESULT WINAPI
HTMLDocument7_put_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT v
)
3337 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3338 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3342 static HRESULT WINAPI
HTMLDocument7_get_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT
*p
)
3344 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3345 FIXME("(%p)->(%p)\n", This
, p
);
3349 static HRESULT WINAPI
HTMLDocument7_get_all(IHTMLDocument7
*iface
, IHTMLElementCollection
**p
)
3351 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3352 FIXME("(%p)->(%p)\n", This
, p
);
3356 static HRESULT WINAPI
HTMLDocument7_get_inputEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3358 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3359 FIXME("(%p)->(%p)\n", This
, p
);
3363 static HRESULT WINAPI
HTMLDocument7_get_xmlEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3365 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3366 FIXME("(%p)->(%p)\n", This
, p
);
3370 static HRESULT WINAPI
HTMLDocument7_put_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL v
)
3372 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3373 FIXME("(%p)->(%x)\n", This
, v
);
3377 static HRESULT WINAPI
HTMLDocument7_get_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL
*p
)
3379 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3380 FIXME("(%p)->(%p)\n", This
, p
);
3384 static HRESULT WINAPI
HTMLDocument7_put_xmlVersion(IHTMLDocument7
*iface
, BSTR v
)
3386 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3387 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
3391 static HRESULT WINAPI
HTMLDocument7_get_xmlVersion(IHTMLDocument7
*iface
, BSTR
*p
)
3393 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3394 FIXME("(%p)->(%p)\n", This
, p
);
3398 static HRESULT WINAPI
HTMLDocument7_hasAttributes(IHTMLDocument7
*iface
, VARIANT_BOOL
*pfHasAttributes
)
3400 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3401 FIXME("(%p)->(%p)\n", This
, pfHasAttributes
);
3405 static HRESULT WINAPI
HTMLDocument7_put_onabort(IHTMLDocument7
*iface
, VARIANT v
)
3407 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3408 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3412 static HRESULT WINAPI
HTMLDocument7_get_onabort(IHTMLDocument7
*iface
, VARIANT
*p
)
3414 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3415 FIXME("(%p)->(%p)\n", This
, p
);
3419 static HRESULT WINAPI
HTMLDocument7_put_onblur(IHTMLDocument7
*iface
, VARIANT v
)
3421 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3422 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3426 static HRESULT WINAPI
HTMLDocument7_get_onblur(IHTMLDocument7
*iface
, VARIANT
*p
)
3428 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3429 FIXME("(%p)->(%p)\n", This
, p
);
3433 static HRESULT WINAPI
HTMLDocument7_put_oncanplay(IHTMLDocument7
*iface
, VARIANT v
)
3435 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3436 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3440 static HRESULT WINAPI
HTMLDocument7_get_oncanplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3442 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3443 FIXME("(%p)->(%p)\n", This
, p
);
3447 static HRESULT WINAPI
HTMLDocument7_put_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT v
)
3449 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3450 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3454 static HRESULT WINAPI
HTMLDocument7_get_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT
*p
)
3456 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3457 FIXME("(%p)->(%p)\n", This
, p
);
3461 static HRESULT WINAPI
HTMLDocument7_put_onchange(IHTMLDocument7
*iface
, VARIANT v
)
3463 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3464 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3468 static HRESULT WINAPI
HTMLDocument7_get_onchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3470 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3471 FIXME("(%p)->(%p)\n", This
, p
);
3475 static HRESULT WINAPI
HTMLDocument7_put_ondrag(IHTMLDocument7
*iface
, VARIANT v
)
3477 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3478 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3482 static HRESULT WINAPI
HTMLDocument7_get_ondrag(IHTMLDocument7
*iface
, VARIANT
*p
)
3484 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3485 FIXME("(%p)->(%p)\n", This
, p
);
3489 static HRESULT WINAPI
HTMLDocument7_put_ondragend(IHTMLDocument7
*iface
, VARIANT v
)
3491 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3492 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3496 static HRESULT WINAPI
HTMLDocument7_get_ondragend(IHTMLDocument7
*iface
, VARIANT
*p
)
3498 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3499 FIXME("(%p)->(%p)\n", This
, p
);
3503 static HRESULT WINAPI
HTMLDocument7_put_ondragenter(IHTMLDocument7
*iface
, VARIANT v
)
3505 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3506 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3510 static HRESULT WINAPI
HTMLDocument7_get_ondragenter(IHTMLDocument7
*iface
, VARIANT
*p
)
3512 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3513 FIXME("(%p)->(%p)\n", This
, p
);
3517 static HRESULT WINAPI
HTMLDocument7_put_ondragleave(IHTMLDocument7
*iface
, VARIANT v
)
3519 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3520 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3524 static HRESULT WINAPI
HTMLDocument7_get_ondragleave(IHTMLDocument7
*iface
, VARIANT
*p
)
3526 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3527 FIXME("(%p)->(%p)\n", This
, p
);
3531 static HRESULT WINAPI
HTMLDocument7_put_ondragover(IHTMLDocument7
*iface
, VARIANT v
)
3533 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3534 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3538 static HRESULT WINAPI
HTMLDocument7_get_ondragover(IHTMLDocument7
*iface
, VARIANT
*p
)
3540 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3541 FIXME("(%p)->(%p)\n", This
, p
);
3545 static HRESULT WINAPI
HTMLDocument7_put_ondrop(IHTMLDocument7
*iface
, VARIANT v
)
3547 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3548 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3552 static HRESULT WINAPI
HTMLDocument7_get_ondrop(IHTMLDocument7
*iface
, VARIANT
*p
)
3554 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3555 FIXME("(%p)->(%p)\n", This
, p
);
3559 static HRESULT WINAPI
HTMLDocument7_put_ondurationchange(IHTMLDocument7
*iface
, VARIANT v
)
3561 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3562 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3566 static HRESULT WINAPI
HTMLDocument7_get_ondurationchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3568 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3569 FIXME("(%p)->(%p)\n", This
, p
);
3573 static HRESULT WINAPI
HTMLDocument7_put_onemptied(IHTMLDocument7
*iface
, VARIANT v
)
3575 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3576 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3580 static HRESULT WINAPI
HTMLDocument7_get_onemptied(IHTMLDocument7
*iface
, VARIANT
*p
)
3582 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3583 FIXME("(%p)->(%p)\n", This
, p
);
3587 static HRESULT WINAPI
HTMLDocument7_put_onended(IHTMLDocument7
*iface
, VARIANT v
)
3589 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3590 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3594 static HRESULT WINAPI
HTMLDocument7_get_onended(IHTMLDocument7
*iface
, VARIANT
*p
)
3596 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3597 FIXME("(%p)->(%p)\n", This
, p
);
3601 static HRESULT WINAPI
HTMLDocument7_put_onerror(IHTMLDocument7
*iface
, VARIANT v
)
3603 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3604 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3608 static HRESULT WINAPI
HTMLDocument7_get_onerror(IHTMLDocument7
*iface
, VARIANT
*p
)
3610 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3611 FIXME("(%p)->(%p)\n", This
, p
);
3615 static HRESULT WINAPI
HTMLDocument7_put_onfocus(IHTMLDocument7
*iface
, VARIANT v
)
3617 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3618 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3622 static HRESULT WINAPI
HTMLDocument7_get_onfocus(IHTMLDocument7
*iface
, VARIANT
*p
)
3624 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3625 FIXME("(%p)->(%p)\n", This
, p
);
3629 static HRESULT WINAPI
HTMLDocument7_put_oninput(IHTMLDocument7
*iface
, VARIANT v
)
3631 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3632 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3636 static HRESULT WINAPI
HTMLDocument7_get_oninput(IHTMLDocument7
*iface
, VARIANT
*p
)
3638 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3639 FIXME("(%p)->(%p)\n", This
, p
);
3643 static HRESULT WINAPI
HTMLDocument7_put_onload(IHTMLDocument7
*iface
, VARIANT v
)
3645 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3646 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3650 static HRESULT WINAPI
HTMLDocument7_get_onload(IHTMLDocument7
*iface
, VARIANT
*p
)
3652 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3653 FIXME("(%p)->(%p)\n", This
, p
);
3657 static HRESULT WINAPI
HTMLDocument7_put_onloadeddata(IHTMLDocument7
*iface
, VARIANT v
)
3659 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3660 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3664 static HRESULT WINAPI
HTMLDocument7_get_onloadeddata(IHTMLDocument7
*iface
, VARIANT
*p
)
3666 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3667 FIXME("(%p)->(%p)\n", This
, p
);
3671 static HRESULT WINAPI
HTMLDocument7_put_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT v
)
3673 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3674 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3678 static HRESULT WINAPI
HTMLDocument7_get_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT
*p
)
3680 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3681 FIXME("(%p)->(%p)\n", This
, p
);
3685 static HRESULT WINAPI
HTMLDocument7_put_onloadstart(IHTMLDocument7
*iface
, VARIANT v
)
3687 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3688 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3692 static HRESULT WINAPI
HTMLDocument7_get_onloadstart(IHTMLDocument7
*iface
, VARIANT
*p
)
3694 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3695 FIXME("(%p)->(%p)\n", This
, p
);
3699 static HRESULT WINAPI
HTMLDocument7_put_onpause(IHTMLDocument7
*iface
, VARIANT v
)
3701 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3702 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3706 static HRESULT WINAPI
HTMLDocument7_get_onpause(IHTMLDocument7
*iface
, VARIANT
*p
)
3708 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3709 FIXME("(%p)->(%p)\n", This
, p
);
3713 static HRESULT WINAPI
HTMLDocument7_put_onplay(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_onplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3722 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3723 FIXME("(%p)->(%p)\n", This
, p
);
3727 static HRESULT WINAPI
HTMLDocument7_put_onplaying(IHTMLDocument7
*iface
, VARIANT v
)
3729 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3730 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3734 static HRESULT WINAPI
HTMLDocument7_get_onplaying(IHTMLDocument7
*iface
, VARIANT
*p
)
3736 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3737 FIXME("(%p)->(%p)\n", This
, p
);
3741 static HRESULT WINAPI
HTMLDocument7_put_onprogress(IHTMLDocument7
*iface
, VARIANT v
)
3743 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3744 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3748 static HRESULT WINAPI
HTMLDocument7_get_onprogress(IHTMLDocument7
*iface
, VARIANT
*p
)
3750 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3751 FIXME("(%p)->(%p)\n", This
, p
);
3755 static HRESULT WINAPI
HTMLDocument7_put_onratechange(IHTMLDocument7
*iface
, VARIANT v
)
3757 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3758 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3762 static HRESULT WINAPI
HTMLDocument7_get_onratechange(IHTMLDocument7
*iface
, VARIANT
*p
)
3764 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3765 FIXME("(%p)->(%p)\n", This
, p
);
3769 static HRESULT WINAPI
HTMLDocument7_put_onreset(IHTMLDocument7
*iface
, VARIANT v
)
3771 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3772 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3776 static HRESULT WINAPI
HTMLDocument7_get_onreset(IHTMLDocument7
*iface
, VARIANT
*p
)
3778 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3779 FIXME("(%p)->(%p)\n", This
, p
);
3783 static HRESULT WINAPI
HTMLDocument7_put_onscroll(IHTMLDocument7
*iface
, VARIANT v
)
3785 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3787 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3789 return set_doc_event(This
, EVENTID_SCROLL
, &v
);
3792 static HRESULT WINAPI
HTMLDocument7_get_onscroll(IHTMLDocument7
*iface
, VARIANT
*p
)
3794 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3796 TRACE("(%p)->(%p)\n", This
, p
);
3798 return get_doc_event(This
, EVENTID_SCROLL
, p
);
3801 static HRESULT WINAPI
HTMLDocument7_put_onseekend(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_onseekend(IHTMLDocument7
*iface
, VARIANT
*p
)
3810 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3811 FIXME("(%p)->(%p)\n", This
, p
);
3815 static HRESULT WINAPI
HTMLDocument7_put_onseeking(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_onseeking(IHTMLDocument7
*iface
, VARIANT
*p
)
3824 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3825 FIXME("(%p)->(%p)\n", This
, p
);
3829 static HRESULT WINAPI
HTMLDocument7_put_onselect(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_onselect(IHTMLDocument7
*iface
, VARIANT
*p
)
3838 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3839 FIXME("(%p)->(%p)\n", This
, p
);
3843 static HRESULT WINAPI
HTMLDocument7_put_onstalled(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_onstalled(IHTMLDocument7
*iface
, VARIANT
*p
)
3852 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3853 FIXME("(%p)->(%p)\n", This
, p
);
3857 static HRESULT WINAPI
HTMLDocument7_put_onsubmit(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_onsubmit(IHTMLDocument7
*iface
, VARIANT
*p
)
3866 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3867 FIXME("(%p)->(%p)\n", This
, p
);
3871 static HRESULT WINAPI
HTMLDocument7_put_onsuspend(IHTMLDocument7
*iface
, VARIANT v
)
3873 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3874 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3878 static HRESULT WINAPI
HTMLDocument7_get_onsuspend(IHTMLDocument7
*iface
, VARIANT
*p
)
3880 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3881 FIXME("(%p)->(%p)\n", This
, p
);
3885 static HRESULT WINAPI
HTMLDocument7_put_ontimeupdate(IHTMLDocument7
*iface
, VARIANT v
)
3887 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3888 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3892 static HRESULT WINAPI
HTMLDocument7_get_ontimeupdate(IHTMLDocument7
*iface
, VARIANT
*p
)
3894 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3895 FIXME("(%p)->(%p)\n", This
, p
);
3899 static HRESULT WINAPI
HTMLDocument7_put_onvolumechange(IHTMLDocument7
*iface
, VARIANT v
)
3901 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3902 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3906 static HRESULT WINAPI
HTMLDocument7_get_onvolumechange(IHTMLDocument7
*iface
, VARIANT
*p
)
3908 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3909 FIXME("(%p)->(%p)\n", This
, p
);
3913 static HRESULT WINAPI
HTMLDocument7_put_onwaiting(IHTMLDocument7
*iface
, VARIANT v
)
3915 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3916 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3920 static HRESULT WINAPI
HTMLDocument7_get_onwaiting(IHTMLDocument7
*iface
, VARIANT
*p
)
3922 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3923 FIXME("(%p)->(%p)\n", This
, p
);
3927 static HRESULT WINAPI
HTMLDocument7_normalize(IHTMLDocument7
*iface
)
3929 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3930 FIXME("(%p)\n", This
);
3934 static HRESULT WINAPI
HTMLDocument7_importNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
,
3935 VARIANT_BOOL fDeep
, IHTMLDOMNode3
**ppNodeDest
)
3937 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3938 FIXME("(%p)->(%p %x %p)\n", This
, pNodeSource
, fDeep
, ppNodeDest
);
3942 static HRESULT WINAPI
HTMLDocument7_get_parentWindow(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
3944 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3945 FIXME("(%p)->(%p)\n", This
, p
);
3949 static HRESULT WINAPI
HTMLDocument7_put_body(IHTMLDocument7
*iface
, IHTMLElement
*v
)
3951 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3952 FIXME("(%p)->(%p)\n", This
, v
);
3956 static HRESULT WINAPI
HTMLDocument7_get_body(IHTMLDocument7
*iface
, IHTMLElement
**p
)
3958 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3959 FIXME("(%p)->(%p)\n", This
, p
);
3963 static HRESULT WINAPI
HTMLDocument7_get_head(IHTMLDocument7
*iface
, IHTMLElement
**p
)
3965 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3966 FIXME("(%p)->(%p)\n", This
, p
);
3970 static const IHTMLDocument7Vtbl HTMLDocument7Vtbl
= {
3971 HTMLDocument7_QueryInterface
,
3972 HTMLDocument7_AddRef
,
3973 HTMLDocument7_Release
,
3974 HTMLDocument7_GetTypeInfoCount
,
3975 HTMLDocument7_GetTypeInfo
,
3976 HTMLDocument7_GetIDsOfNames
,
3977 HTMLDocument7_Invoke
,
3978 HTMLDocument7_get_defaultView
,
3979 HTMLDocument7_createCDATASection
,
3980 HTMLDocument7_getSelection
,
3981 HTMLDocument7_getElementsByTagNameNS
,
3982 HTMLDocument7_createElementNS
,
3983 HTMLDocument7_createAttributeNS
,
3984 HTMLDocument7_put_onmsthumbnailclick
,
3985 HTMLDocument7_get_onmsthumbnailclick
,
3986 HTMLDocument7_get_characterSet
,
3987 HTMLDocument7_createElement
,
3988 HTMLDocument7_createAttribute
,
3989 HTMLDocument7_getElementByClassName
,
3990 HTMLDocument7_createProcessingInstruction
,
3991 HTMLDocument7_adoptNode
,
3992 HTMLDocument7_put_onmssitemodejumplistitemremoved
,
3993 HTMLDocument7_get_onmssitemodejumplistitemremoved
,
3994 HTMLDocument7_get_all
,
3995 HTMLDocument7_get_inputEncoding
,
3996 HTMLDocument7_get_xmlEncoding
,
3997 HTMLDocument7_put_xmlStandalone
,
3998 HTMLDocument7_get_xmlStandalone
,
3999 HTMLDocument7_put_xmlVersion
,
4000 HTMLDocument7_get_xmlVersion
,
4001 HTMLDocument7_hasAttributes
,
4002 HTMLDocument7_put_onabort
,
4003 HTMLDocument7_get_onabort
,
4004 HTMLDocument7_put_onblur
,
4005 HTMLDocument7_get_onblur
,
4006 HTMLDocument7_put_oncanplay
,
4007 HTMLDocument7_get_oncanplay
,
4008 HTMLDocument7_put_oncanplaythrough
,
4009 HTMLDocument7_get_oncanplaythrough
,
4010 HTMLDocument7_put_onchange
,
4011 HTMLDocument7_get_onchange
,
4012 HTMLDocument7_put_ondrag
,
4013 HTMLDocument7_get_ondrag
,
4014 HTMLDocument7_put_ondragend
,
4015 HTMLDocument7_get_ondragend
,
4016 HTMLDocument7_put_ondragenter
,
4017 HTMLDocument7_get_ondragenter
,
4018 HTMLDocument7_put_ondragleave
,
4019 HTMLDocument7_get_ondragleave
,
4020 HTMLDocument7_put_ondragover
,
4021 HTMLDocument7_get_ondragover
,
4022 HTMLDocument7_put_ondrop
,
4023 HTMLDocument7_get_ondrop
,
4024 HTMLDocument7_put_ondurationchange
,
4025 HTMLDocument7_get_ondurationchange
,
4026 HTMLDocument7_put_onemptied
,
4027 HTMLDocument7_get_onemptied
,
4028 HTMLDocument7_put_onended
,
4029 HTMLDocument7_get_onended
,
4030 HTMLDocument7_put_onerror
,
4031 HTMLDocument7_get_onerror
,
4032 HTMLDocument7_put_onfocus
,
4033 HTMLDocument7_get_onfocus
,
4034 HTMLDocument7_put_oninput
,
4035 HTMLDocument7_get_oninput
,
4036 HTMLDocument7_put_onload
,
4037 HTMLDocument7_get_onload
,
4038 HTMLDocument7_put_onloadeddata
,
4039 HTMLDocument7_get_onloadeddata
,
4040 HTMLDocument7_put_onloadedmetadata
,
4041 HTMLDocument7_get_onloadedmetadata
,
4042 HTMLDocument7_put_onloadstart
,
4043 HTMLDocument7_get_onloadstart
,
4044 HTMLDocument7_put_onpause
,
4045 HTMLDocument7_get_onpause
,
4046 HTMLDocument7_put_onplay
,
4047 HTMLDocument7_get_onplay
,
4048 HTMLDocument7_put_onplaying
,
4049 HTMLDocument7_get_onplaying
,
4050 HTMLDocument7_put_onprogress
,
4051 HTMLDocument7_get_onprogress
,
4052 HTMLDocument7_put_onratechange
,
4053 HTMLDocument7_get_onratechange
,
4054 HTMLDocument7_put_onreset
,
4055 HTMLDocument7_get_onreset
,
4056 HTMLDocument7_put_onscroll
,
4057 HTMLDocument7_get_onscroll
,
4058 HTMLDocument7_put_onseekend
,
4059 HTMLDocument7_get_onseekend
,
4060 HTMLDocument7_put_onseeking
,
4061 HTMLDocument7_get_onseeking
,
4062 HTMLDocument7_put_onselect
,
4063 HTMLDocument7_get_onselect
,
4064 HTMLDocument7_put_onstalled
,
4065 HTMLDocument7_get_onstalled
,
4066 HTMLDocument7_put_onsubmit
,
4067 HTMLDocument7_get_onsubmit
,
4068 HTMLDocument7_put_onsuspend
,
4069 HTMLDocument7_get_onsuspend
,
4070 HTMLDocument7_put_ontimeupdate
,
4071 HTMLDocument7_get_ontimeupdate
,
4072 HTMLDocument7_put_onvolumechange
,
4073 HTMLDocument7_get_onvolumechange
,
4074 HTMLDocument7_put_onwaiting
,
4075 HTMLDocument7_get_onwaiting
,
4076 HTMLDocument7_normalize
,
4077 HTMLDocument7_importNode
,
4078 HTMLDocument7_get_parentWindow
,
4079 HTMLDocument7_put_body
,
4080 HTMLDocument7_get_body
,
4081 HTMLDocument7_get_head
4084 static inline HTMLDocument
*impl_from_IDocumentSelector(IDocumentSelector
*iface
)
4086 return CONTAINING_RECORD(iface
, HTMLDocument
, IDocumentSelector_iface
);
4089 static HRESULT WINAPI
DocumentSelector_QueryInterface(IDocumentSelector
*iface
, REFIID riid
, void **ppv
)
4091 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4092 return htmldoc_query_interface(This
, riid
, ppv
);
4095 static ULONG WINAPI
DocumentSelector_AddRef(IDocumentSelector
*iface
)
4097 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4098 return htmldoc_addref(This
);
4101 static ULONG WINAPI
DocumentSelector_Release(IDocumentSelector
*iface
)
4103 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4104 return htmldoc_release(This
);
4107 static HRESULT WINAPI
DocumentSelector_GetTypeInfoCount(IDocumentSelector
*iface
, UINT
*pctinfo
)
4109 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4110 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
4113 static HRESULT WINAPI
DocumentSelector_GetTypeInfo(IDocumentSelector
*iface
, UINT iTInfo
,
4114 LCID lcid
, ITypeInfo
**ppTInfo
)
4116 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4117 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4120 static HRESULT WINAPI
DocumentSelector_GetIDsOfNames(IDocumentSelector
*iface
, REFIID riid
,
4121 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4123 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4124 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
4128 static HRESULT WINAPI
DocumentSelector_Invoke(IDocumentSelector
*iface
, DISPID dispIdMember
, REFIID riid
,
4129 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4131 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4132 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
4133 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4136 static HRESULT WINAPI
DocumentSelector_querySelector(IDocumentSelector
*iface
, BSTR v
, IHTMLElement
**pel
)
4138 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4139 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4143 static HRESULT WINAPI
DocumentSelector_querySelectorAll(IDocumentSelector
*iface
, BSTR v
, IHTMLDOMChildrenCollection
**pel
)
4145 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4146 nsIDOMNodeList
*node_list
;
4150 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4152 nsAString_InitDepend(&nsstr
, v
);
4153 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->doc_node
->nsdoc
, &nsstr
, &node_list
);
4154 nsAString_Finish(&nsstr
);
4155 if(NS_FAILED(nsres
)) {
4156 ERR("QuerySelectorAll failed: %08x\n", nsres
);
4160 *pel
= create_child_collection(This
->doc_node
, node_list
);
4161 nsIDOMNodeList_Release(node_list
);
4162 return *pel
? S_OK
: E_OUTOFMEMORY
;
4165 static const IDocumentSelectorVtbl DocumentSelectorVtbl
= {
4166 DocumentSelector_QueryInterface
,
4167 DocumentSelector_AddRef
,
4168 DocumentSelector_Release
,
4169 DocumentSelector_GetTypeInfoCount
,
4170 DocumentSelector_GetTypeInfo
,
4171 DocumentSelector_GetIDsOfNames
,
4172 DocumentSelector_Invoke
,
4173 DocumentSelector_querySelector
,
4174 DocumentSelector_querySelectorAll
4177 static void HTMLDocument_on_advise(IUnknown
*iface
, cp_static_data_t
*cp
)
4179 HTMLDocument
*This
= impl_from_IHTMLDocument2((IHTMLDocument2
*)iface
);
4182 update_doc_cp_events(This
->doc_node
, cp
);
4185 static inline HTMLDocument
*impl_from_ISupportErrorInfo(ISupportErrorInfo
*iface
)
4187 return CONTAINING_RECORD(iface
, HTMLDocument
, ISupportErrorInfo_iface
);
4190 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
4192 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4193 return htmldoc_query_interface(This
, riid
, ppv
);
4196 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
4198 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4199 return htmldoc_addref(This
);
4202 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
4204 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4205 return htmldoc_release(This
);
4208 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
4210 FIXME("(%p)->(%s)\n", iface
, debugstr_mshtml_guid(riid
));
4214 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
4215 SupportErrorInfo_QueryInterface
,
4216 SupportErrorInfo_AddRef
,
4217 SupportErrorInfo_Release
,
4218 SupportErrorInfo_InterfaceSupportsErrorInfo
4221 static inline HTMLDocument
*impl_from_IDispatchEx(IDispatchEx
*iface
)
4223 return CONTAINING_RECORD(iface
, HTMLDocument
, IDispatchEx_iface
);
4226 static HRESULT
dispid_from_elem_name(HTMLDocumentNode
*This
, BSTR name
, DISPID
*dispid
)
4228 nsIDOMNodeList
*node_list
;
4235 return DISP_E_UNKNOWNNAME
;
4237 nsAString_InitDepend(&name_str
, name
);
4238 nsres
= nsIDOMHTMLDocument_GetElementsByName(This
->nsdoc
, &name_str
, &node_list
);
4239 nsAString_Finish(&name_str
);
4240 if(NS_FAILED(nsres
))
4243 nsres
= nsIDOMNodeList_GetLength(node_list
, &len
);
4244 nsIDOMNodeList_Release(node_list
);
4245 if(NS_FAILED(nsres
))
4249 return DISP_E_UNKNOWNNAME
;
4251 for(i
=0; i
< This
->elem_vars_cnt
; i
++) {
4252 if(!strcmpW(name
, This
->elem_vars
[i
])) {
4253 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
4258 if(This
->elem_vars_cnt
== This
->elem_vars_size
) {
4261 if(This
->elem_vars_size
) {
4262 new_vars
= heap_realloc(This
->elem_vars
, This
->elem_vars_size
*2*sizeof(WCHAR
*));
4264 return E_OUTOFMEMORY
;
4265 This
->elem_vars_size
*= 2;
4267 new_vars
= heap_alloc(16*sizeof(WCHAR
*));
4269 return E_OUTOFMEMORY
;
4270 This
->elem_vars_size
= 16;
4273 This
->elem_vars
= new_vars
;
4276 This
->elem_vars
[This
->elem_vars_cnt
] = heap_strdupW(name
);
4277 if(!This
->elem_vars
[This
->elem_vars_cnt
])
4278 return E_OUTOFMEMORY
;
4280 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+This
->elem_vars_cnt
++;
4284 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
4286 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4288 return htmldoc_query_interface(This
, riid
, ppv
);
4291 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
4293 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4295 return htmldoc_addref(This
);
4298 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
4300 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4302 return htmldoc_release(This
);
4305 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
4307 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4309 return IDispatchEx_GetTypeInfoCount(This
->dispex
, pctinfo
);
4312 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
4313 LCID lcid
, ITypeInfo
**ppTInfo
)
4315 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4317 return IDispatchEx_GetTypeInfo(This
->dispex
, iTInfo
, lcid
, ppTInfo
);
4320 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
4321 LPOLESTR
*rgszNames
, UINT cNames
,
4322 LCID lcid
, DISPID
*rgDispId
)
4324 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4326 return IDispatchEx_GetIDsOfNames(This
->dispex
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
4329 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
4330 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4331 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4333 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4335 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
4336 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4338 switch(dispIdMember
) {
4339 case DISPID_READYSTATE
:
4340 TRACE("DISPID_READYSTATE\n");
4342 if(!(wFlags
& DISPATCH_PROPERTYGET
))
4343 return E_INVALIDARG
;
4345 V_VT(pVarResult
) = VT_I4
;
4346 V_I4(pVarResult
) = This
->window
->readystate
;
4350 return IDispatchEx_Invoke(This
->dispex
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
4351 pVarResult
, pExcepInfo
, puArgErr
);
4354 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
4356 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4359 hres
= IDispatchEx_GetDispID(This
->dispex
, bstrName
, grfdex
, pid
);
4360 if(hres
!= DISP_E_UNKNOWNNAME
)
4363 return dispid_from_elem_name(This
->doc_node
, bstrName
, pid
);
4366 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
4367 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
4369 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4371 if(This
->window
&& id
== DISPID_IHTMLDOCUMENT2_LOCATION
&& (wFlags
& DISPATCH_PROPERTYPUT
))
4372 return IDispatchEx_InvokeEx(&This
->window
->base
.IDispatchEx_iface
, DISPID_IHTMLWINDOW2_LOCATION
,
4373 lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
4376 return IDispatchEx_InvokeEx(This
->dispex
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
4379 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
4381 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4383 return IDispatchEx_DeleteMemberByName(This
->dispex
, bstrName
, grfdex
);
4386 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
4388 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4390 return IDispatchEx_DeleteMemberByDispID(This
->dispex
, id
);
4393 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
4395 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4397 return IDispatchEx_GetMemberProperties(This
->dispex
, id
, grfdexFetch
, pgrfdex
);
4400 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
4402 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4404 return IDispatchEx_GetMemberName(This
->dispex
, id
, pbstrName
);
4407 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
4409 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4411 return IDispatchEx_GetNextDispID(This
->dispex
, grfdex
, id
, pid
);
4414 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
4416 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4418 return IDispatchEx_GetNameSpaceParent(This
->dispex
, ppunk
);
4421 static const IDispatchExVtbl DocDispatchExVtbl
= {
4422 DocDispatchEx_QueryInterface
,
4423 DocDispatchEx_AddRef
,
4424 DocDispatchEx_Release
,
4425 DocDispatchEx_GetTypeInfoCount
,
4426 DocDispatchEx_GetTypeInfo
,
4427 DocDispatchEx_GetIDsOfNames
,
4428 DocDispatchEx_Invoke
,
4429 DocDispatchEx_GetDispID
,
4430 DocDispatchEx_InvokeEx
,
4431 DocDispatchEx_DeleteMemberByName
,
4432 DocDispatchEx_DeleteMemberByDispID
,
4433 DocDispatchEx_GetMemberProperties
,
4434 DocDispatchEx_GetMemberName
,
4435 DocDispatchEx_GetNextDispID
,
4436 DocDispatchEx_GetNameSpaceParent
4439 static inline HTMLDocument
*impl_from_IProvideClassInfo(IProvideClassInfo
*iface
)
4441 return CONTAINING_RECORD(iface
, HTMLDocument
, IProvideClassInfo_iface
);
4444 static HRESULT WINAPI
ProvideClassInfo_QueryInterface(IProvideClassInfo
*iface
,
4445 REFIID riid
, void **ppv
)
4447 HTMLDocument
*This
= impl_from_IProvideClassInfo(iface
);
4448 return htmldoc_query_interface(This
, riid
, ppv
);
4451 static ULONG WINAPI
ProvideClassInfo_AddRef(IProvideClassInfo
*iface
)
4453 HTMLDocument
*This
= impl_from_IProvideClassInfo(iface
);
4454 return htmldoc_addref(This
);
4457 static ULONG WINAPI
ProvideClassInfo_Release(IProvideClassInfo
*iface
)
4459 HTMLDocument
*This
= impl_from_IProvideClassInfo(iface
);
4460 return htmldoc_release(This
);
4463 static HRESULT WINAPI
ProvideClassInfo_GetClassInfo(IProvideClassInfo
* iface
,
4466 HTMLDocument
*This
= impl_from_IProvideClassInfo(iface
);
4467 TRACE("(%p)->(%p)\n", This
, ppTI
);
4468 return get_htmldoc_classinfo(ppTI
);
4471 static const IProvideClassInfoVtbl ProvideClassInfoVtbl
= {
4472 ProvideClassInfo_QueryInterface
,
4473 ProvideClassInfo_AddRef
,
4474 ProvideClassInfo_Release
,
4475 ProvideClassInfo_GetClassInfo
4478 static BOOL
htmldoc_qi(HTMLDocument
*This
, REFIID riid
, void **ppv
)
4482 if(IsEqualGUID(&IID_IUnknown
, riid
))
4483 *ppv
= &This
->IHTMLDocument2_iface
;
4484 else if(IsEqualGUID(&IID_IDispatch
, riid
))
4485 *ppv
= &This
->IDispatchEx_iface
;
4486 else if(IsEqualGUID(&IID_IDispatchEx
, riid
))
4487 *ppv
= &This
->IDispatchEx_iface
;
4488 else if(IsEqualGUID(&IID_IHTMLDocument
, riid
))
4489 *ppv
= &This
->IHTMLDocument2_iface
;
4490 else if(IsEqualGUID(&IID_IHTMLDocument2
, riid
))
4491 *ppv
= &This
->IHTMLDocument2_iface
;
4492 else if(IsEqualGUID(&IID_IHTMLDocument3
, riid
))
4493 *ppv
= &This
->IHTMLDocument3_iface
;
4494 else if(IsEqualGUID(&IID_IHTMLDocument4
, riid
))
4495 *ppv
= &This
->IHTMLDocument4_iface
;
4496 else if(IsEqualGUID(&IID_IHTMLDocument5
, riid
))
4497 *ppv
= &This
->IHTMLDocument5_iface
;
4498 else if(IsEqualGUID(&IID_IHTMLDocument6
, riid
))
4499 *ppv
= &This
->IHTMLDocument6_iface
;
4500 else if(IsEqualGUID(&IID_IHTMLDocument7
, riid
))
4501 *ppv
= &This
->IHTMLDocument7_iface
;
4502 else if(IsEqualGUID(&IID_IDocumentSelector
, riid
))
4503 *ppv
= &This
->IDocumentSelector_iface
;
4504 else if(IsEqualGUID(&IID_IPersist
, riid
))
4505 *ppv
= &This
->IPersistFile_iface
;
4506 else if(IsEqualGUID(&IID_IPersistMoniker
, riid
))
4507 *ppv
= &This
->IPersistMoniker_iface
;
4508 else if(IsEqualGUID(&IID_IPersistFile
, riid
))
4509 *ppv
= &This
->IPersistFile_iface
;
4510 else if(IsEqualGUID(&IID_IMonikerProp
, riid
))
4511 *ppv
= &This
->IMonikerProp_iface
;
4512 else if(IsEqualGUID(&IID_IOleObject
, riid
))
4513 *ppv
= &This
->IOleObject_iface
;
4514 else if(IsEqualGUID(&IID_IOleDocument
, riid
))
4515 *ppv
= &This
->IOleDocument_iface
;
4516 else if(IsEqualGUID(&IID_IOleDocumentView
, riid
))
4517 *ppv
= &This
->IOleDocumentView_iface
;
4518 else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
))
4519 *ppv
= &This
->IOleInPlaceActiveObject_iface
;
4520 else if(IsEqualGUID(&IID_IViewObject
, riid
))
4521 *ppv
= &This
->IViewObjectEx_iface
;
4522 else if(IsEqualGUID(&IID_IViewObject2
, riid
))
4523 *ppv
= &This
->IViewObjectEx_iface
;
4524 else if(IsEqualGUID(&IID_IViewObjectEx
, riid
))
4525 *ppv
= &This
->IViewObjectEx_iface
;
4526 else if(IsEqualGUID(&IID_IOleWindow
, riid
))
4527 *ppv
= &This
->IOleInPlaceActiveObject_iface
;
4528 else if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
))
4529 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
4530 else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
))
4531 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
4532 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
4533 *ppv
= &This
->IServiceProvider_iface
;
4534 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
4535 *ppv
= &This
->IOleCommandTarget_iface
;
4536 else if(IsEqualGUID(&IID_IOleControl
, riid
))
4537 *ppv
= &This
->IOleControl_iface
;
4538 else if(IsEqualGUID(&IID_IHlinkTarget
, riid
))
4539 *ppv
= &This
->IHlinkTarget_iface
;
4540 else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
))
4541 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
4542 else if(IsEqualGUID(&IID_IPersistStreamInit
, riid
))
4543 *ppv
= &This
->IPersistStreamInit_iface
;
4544 else if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
))
4545 *ppv
= &This
->IHTMLDocument2_iface
;
4546 else if(IsEqualGUID(&IID_ISupportErrorInfo
, riid
))
4547 *ppv
= &This
->ISupportErrorInfo_iface
;
4548 else if(IsEqualGUID(&IID_IPersistHistory
, riid
))
4549 *ppv
= &This
->IPersistHistory_iface
;
4550 else if(IsEqualGUID(&IID_IObjectWithSite
, riid
))
4551 *ppv
= &This
->IObjectWithSite_iface
;
4552 else if(IsEqualGUID(&IID_IOleContainer
, riid
))
4553 *ppv
= &This
->IOleContainer_iface
;
4554 else if(IsEqualGUID(&IID_IObjectSafety
, riid
))
4555 *ppv
= &This
->IObjectSafety_iface
;
4556 else if(IsEqualGUID(&IID_IProvideClassInfo
, riid
))
4557 *ppv
= &This
->IProvideClassInfo_iface
;
4558 else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
4559 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppv
);
4561 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
4562 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppv
);
4564 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
4565 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppv
);
4567 }else if(IsEqualGUID(&IID_IMarshal
, riid
)) {
4568 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This
, ppv
);
4570 }else if(IsEqualGUID(&IID_IExternalConnection
, riid
)) {
4571 TRACE("(%p)->(IID_IExternalConnection %p) returning NULL\n", This
, ppv
);
4573 }else if(IsEqualGUID(&IID_IStdMarshalInfo
, riid
)) {
4574 TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This
, ppv
);
4581 IUnknown_AddRef((IUnknown
*)*ppv
);
4585 static cp_static_data_t HTMLDocumentEvents_data
= { HTMLDocumentEvents_tid
, HTMLDocument_on_advise
};
4587 static const cpc_entry_t HTMLDocument_cpc
[] = {
4588 {&IID_IDispatch
, &HTMLDocumentEvents_data
},
4589 {&IID_IPropertyNotifySink
},
4590 {&DIID_HTMLDocumentEvents
, &HTMLDocumentEvents_data
},
4591 {&DIID_HTMLDocumentEvents2
},
4595 static void init_doc(HTMLDocument
*doc
, IUnknown
*outer
, IDispatchEx
*dispex
)
4597 doc
->IHTMLDocument2_iface
.lpVtbl
= &HTMLDocumentVtbl
;
4598 doc
->IHTMLDocument3_iface
.lpVtbl
= &HTMLDocument3Vtbl
;
4599 doc
->IHTMLDocument4_iface
.lpVtbl
= &HTMLDocument4Vtbl
;
4600 doc
->IHTMLDocument5_iface
.lpVtbl
= &HTMLDocument5Vtbl
;
4601 doc
->IHTMLDocument6_iface
.lpVtbl
= &HTMLDocument6Vtbl
;
4602 doc
->IHTMLDocument7_iface
.lpVtbl
= &HTMLDocument7Vtbl
;
4603 doc
->IDispatchEx_iface
.lpVtbl
= &DocDispatchExVtbl
;
4604 doc
->IDocumentSelector_iface
.lpVtbl
= &DocumentSelectorVtbl
;
4605 doc
->ISupportErrorInfo_iface
.lpVtbl
= &SupportErrorInfoVtbl
;
4606 doc
->IProvideClassInfo_iface
.lpVtbl
= &ProvideClassInfoVtbl
;
4608 doc
->outer_unk
= outer
;
4609 doc
->dispex
= dispex
;
4610 doc
->task_magic
= get_task_target_magic();
4612 HTMLDocument_Persist_Init(doc
);
4613 HTMLDocument_OleCmd_Init(doc
);
4614 HTMLDocument_OleObj_Init(doc
);
4615 HTMLDocument_View_Init(doc
);
4616 HTMLDocument_Window_Init(doc
);
4617 HTMLDocument_Service_Init(doc
);
4618 HTMLDocument_Hlink_Init(doc
);
4620 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)&doc
->IHTMLDocument2_iface
, HTMLDocument_cpc
);
4623 static void destroy_htmldoc(HTMLDocument
*This
)
4625 remove_target_tasks(This
->task_magic
);
4627 ConnectionPointContainer_Destroy(&This
->cp_container
);
4630 static inline HTMLDocumentNode
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
4632 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
);
4635 static HRESULT
HTMLDocumentNode_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
4637 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4639 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4641 if(htmldoc_qi(&This
->basedoc
, riid
, ppv
))
4642 return *ppv
? S_OK
: E_NOINTERFACE
;
4644 if(IsEqualGUID(&IID_IInternetHostSecurityManager
, riid
))
4645 *ppv
= &This
->IInternetHostSecurityManager_iface
;
4647 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
4649 IUnknown_AddRef((IUnknown
*)*ppv
);
4653 static void HTMLDocumentNode_destructor(HTMLDOMNode
*iface
)
4655 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4658 for(i
=0; i
< This
->elem_vars_cnt
; i
++)
4659 heap_free(This
->elem_vars
[i
]);
4660 heap_free(This
->elem_vars
);
4662 detach_events(This
);
4664 ICatInformation_Release(This
->catmgr
);
4666 detach_selection(This
);
4667 detach_ranges(This
);
4669 while(!list_empty(&This
->plugin_hosts
))
4670 detach_plugin_host(LIST_ENTRY(list_head(&This
->plugin_hosts
), PluginHost
, entry
));
4672 if(!This
->nsdoc
&& This
->window
) {
4673 /* document fragments own reference to inner window */
4674 IHTMLWindow2_Release(&This
->window
->base
.IHTMLWindow2_iface
);
4675 This
->window
= NULL
;
4678 heap_free(This
->event_vector
);
4679 destroy_htmldoc(&This
->basedoc
);
4682 static HRESULT
HTMLDocumentNode_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
4684 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4685 FIXME("%p\n", This
);
4689 static void HTMLDocumentNode_traverse(HTMLDOMNode
*iface
, nsCycleCollectionTraversalCallback
*cb
)
4691 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4694 note_cc_edge((nsISupports
*)This
->nsdoc
, "This->nsdoc", cb
);
4697 static void HTMLDocumentNode_unlink(HTMLDOMNode
*iface
)
4699 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4702 nsIDOMHTMLDocument
*nsdoc
= This
->nsdoc
;
4704 release_document_mutation(This
);
4706 nsIDOMHTMLDocument_Release(nsdoc
);
4707 This
->window
= NULL
;
4711 static const NodeImplVtbl HTMLDocumentNodeImplVtbl
= {
4712 HTMLDocumentNode_QI
,
4713 HTMLDocumentNode_destructor
,
4715 HTMLDocumentNode_clone
,
4727 HTMLDocumentNode_traverse
,
4728 HTMLDocumentNode_unlink
4731 static HRESULT
HTMLDocumentFragment_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
4733 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4734 HTMLDocumentNode
*new_node
;
4737 hres
= create_document_fragment(nsnode
, This
->node
.doc
, &new_node
);
4741 *ret
= &new_node
->node
;
4745 static inline HTMLDocumentNode
*impl_from_DispatchEx(DispatchEx
*iface
)
4747 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
.event_target
.dispex
);
4750 static HRESULT
HTMLDocumentNode_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
4751 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
4753 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
4754 nsIDOMNodeList
*node_list
;
4762 if(flags
!= DISPATCH_PROPERTYGET
&& flags
!= (DISPATCH_METHOD
|DISPATCH_PROPERTYGET
)) {
4763 FIXME("unsupported flags %x\n", flags
);
4767 i
= id
- MSHTML_DISPID_CUSTOM_MIN
;
4769 if(!This
->nsdoc
|| i
>= This
->elem_vars_cnt
)
4770 return DISP_E_UNKNOWNNAME
;
4772 nsAString_InitDepend(&name_str
, This
->elem_vars
[i
]);
4773 nsres
= nsIDOMHTMLDocument_GetElementsByName(This
->nsdoc
, &name_str
, &node_list
);
4774 nsAString_Finish(&name_str
);
4775 if(NS_FAILED(nsres
))
4778 nsres
= nsIDOMNodeList_Item(node_list
, 0, &nsnode
);
4779 nsIDOMNodeList_Release(node_list
);
4780 if(NS_FAILED(nsres
) || !nsnode
)
4781 return DISP_E_UNKNOWNNAME
;
4783 hres
= get_node(This
, nsnode
, TRUE
, &node
);
4787 V_VT(res
) = VT_DISPATCH
;
4788 V_DISPATCH(res
) = (IDispatch
*)&node
->IHTMLDOMNode_iface
;
4792 static void HTMLDocumentNode_bind_event(DispatchEx
*dispex
, int eid
)
4794 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
4795 ensure_doc_nsevent_handler(This
, eid
);
4798 static const dispex_static_data_vtbl_t HTMLDocumentNode_dispex_vtbl
= {
4801 HTMLDocumentNode_invoke
,
4804 HTMLDocumentNode_bind_event
4807 static const NodeImplVtbl HTMLDocumentFragmentImplVtbl
= {
4808 HTMLDocumentNode_QI
,
4809 HTMLDocumentNode_destructor
,
4811 HTMLDocumentFragment_clone
4814 static const tid_t HTMLDocumentNode_iface_tids
[] = {
4822 IDocumentSelector_tid
,
4826 static dispex_static_data_t HTMLDocumentNode_dispex
= {
4827 &HTMLDocumentNode_dispex_vtbl
,
4828 DispHTMLDocument_tid
,
4829 HTMLDocumentNode_iface_tids
4832 static HTMLDocumentNode
*alloc_doc_node(HTMLDocumentObj
*doc_obj
, HTMLInnerWindow
*window
)
4834 HTMLDocumentNode
*doc
;
4836 doc
= heap_alloc_zero(sizeof(HTMLDocumentNode
));
4841 doc
->basedoc
.doc_node
= doc
;
4842 doc
->basedoc
.doc_obj
= doc_obj
;
4843 doc
->basedoc
.window
= window
->base
.outer_window
;
4844 doc
->window
= window
;
4846 init_dispex(&doc
->node
.event_target
.dispex
, (IUnknown
*)&doc
->node
.IHTMLDOMNode_iface
,
4847 &HTMLDocumentNode_dispex
);
4848 init_doc(&doc
->basedoc
, (IUnknown
*)&doc
->node
.IHTMLDOMNode_iface
,
4849 &doc
->node
.event_target
.dispex
.IDispatchEx_iface
);
4850 HTMLDocumentNode_SecMgr_Init(doc
);
4852 list_init(&doc
->selection_list
);
4853 list_init(&doc
->range_list
);
4854 list_init(&doc
->plugin_hosts
);
4859 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*nsdoc
, HTMLDocumentObj
*doc_obj
, HTMLInnerWindow
*window
, HTMLDocumentNode
**ret
)
4861 HTMLDocumentNode
*doc
;
4863 doc
= alloc_doc_node(doc_obj
, window
);
4865 return E_OUTOFMEMORY
;
4867 if(!doc_obj
->basedoc
.window
|| window
->base
.outer_window
== doc_obj
->basedoc
.window
)
4868 doc
->basedoc
.cp_container
.forward_container
= &doc_obj
->basedoc
.cp_container
;
4870 HTMLDOMNode_Init(doc
, &doc
->node
, (nsIDOMNode
*)nsdoc
);
4872 nsIDOMHTMLDocument_AddRef(nsdoc
);
4875 init_document_mutation(doc
);
4876 doc_init_events(doc
);
4878 doc
->node
.vtbl
= &HTMLDocumentNodeImplVtbl
;
4879 doc
->node
.cp_container
= &doc
->basedoc
.cp_container
;
4885 static HRESULT
create_document_fragment(nsIDOMNode
*nsnode
, HTMLDocumentNode
*doc_node
, HTMLDocumentNode
**ret
)
4887 HTMLDocumentNode
*doc_frag
;
4889 doc_frag
= alloc_doc_node(doc_node
->basedoc
.doc_obj
, doc_node
->window
);
4891 return E_OUTOFMEMORY
;
4893 IHTMLWindow2_AddRef(&doc_frag
->window
->base
.IHTMLWindow2_iface
);
4895 HTMLDOMNode_Init(doc_node
, &doc_frag
->node
, nsnode
);
4896 doc_frag
->node
.vtbl
= &HTMLDocumentFragmentImplVtbl
;
4897 doc_frag
->node
.cp_container
= &doc_frag
->basedoc
.cp_container
;
4903 static inline HTMLDocumentObj
*impl_from_IUnknown(IUnknown
*iface
)
4905 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IUnknown_outer
);
4908 static HRESULT WINAPI
HTMLDocumentObj_QueryInterface(IUnknown
*iface
, REFIID riid
, void **ppv
)
4910 HTMLDocumentObj
*This
= impl_from_IUnknown(iface
);
4912 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4914 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
4915 *ppv
= &This
->IUnknown_outer
;
4916 }else if(htmldoc_qi(&This
->basedoc
, riid
, ppv
)) {
4917 return *ppv
? S_OK
: E_NOINTERFACE
;
4918 }else if(IsEqualGUID(&IID_ICustomDoc
, riid
)) {
4919 *ppv
= &This
->ICustomDoc_iface
;
4920 }else if(IsEqualGUID(&IID_ITargetContainer
, riid
)) {
4921 *ppv
= &This
->ITargetContainer_iface
;
4922 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
4923 return *ppv
? S_OK
: E_NOINTERFACE
;
4925 FIXME("Unimplemented interface %s\n", debugstr_mshtml_guid(riid
));
4927 return E_NOINTERFACE
;
4930 IUnknown_AddRef((IUnknown
*)*ppv
);
4934 static ULONG WINAPI
HTMLDocumentObj_AddRef(IUnknown
*iface
)
4936 HTMLDocumentObj
*This
= impl_from_IUnknown(iface
);
4937 ULONG ref
= InterlockedIncrement(&This
->ref
);
4939 TRACE("(%p) ref = %u\n", This
, ref
);
4944 static ULONG WINAPI
HTMLDocumentObj_Release(IUnknown
*iface
)
4946 HTMLDocumentObj
*This
= impl_from_IUnknown(iface
);
4947 ULONG ref
= InterlockedDecrement(&This
->ref
);
4949 TRACE("(%p) ref = %u\n", This
, ref
);
4952 nsIDOMWindowUtils
*window_utils
= NULL
;
4954 if(This
->basedoc
.window
&& This
->basedoc
.window
->nswindow
)
4955 get_nsinterface((nsISupports
*)This
->basedoc
.window
->nswindow
, &IID_nsIDOMWindowUtils
, (void**)&window_utils
);
4957 if(This
->basedoc
.doc_node
) {
4958 This
->basedoc
.doc_node
->basedoc
.doc_obj
= NULL
;
4959 htmldoc_release(&This
->basedoc
.doc_node
->basedoc
);
4961 if(This
->basedoc
.window
) {
4962 This
->basedoc
.window
->doc_obj
= NULL
;
4963 IHTMLWindow2_Release(&This
->basedoc
.window
->base
.IHTMLWindow2_iface
);
4965 if(This
->basedoc
.advise_holder
)
4966 IOleAdviseHolder_Release(This
->basedoc
.advise_holder
);
4969 IAdviseSink_Release(This
->view_sink
);
4971 IOleObject_SetClientSite(&This
->basedoc
.IOleObject_iface
, NULL
);
4973 ICustomDoc_SetUIHandler(&This
->ICustomDoc_iface
, NULL
);
4974 if(This
->in_place_active
)
4975 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->basedoc
.IOleInPlaceObjectWindowless_iface
);
4977 IOleDocumentView_SetInPlaceSite(&This
->basedoc
.IOleDocumentView_iface
, NULL
);
4979 IOleUndoManager_Release(This
->undomgr
);
4981 IHTMLEditServices_Release(This
->editsvcs
);
4982 if(This
->tooltips_hwnd
)
4983 DestroyWindow(This
->tooltips_hwnd
);
4986 DestroyWindow(This
->hwnd
);
4987 heap_free(This
->mime
);
4989 destroy_htmldoc(&This
->basedoc
);
4990 release_dispex(&This
->dispex
);
4992 if(This
->nscontainer
)
4993 NSContainer_Release(This
->nscontainer
);
4996 /* Force cycle collection */
4998 nsIDOMWindowUtils_CycleCollect(window_utils
, NULL
, 0);
4999 nsIDOMWindowUtils_Release(window_utils
);
5006 static const IUnknownVtbl HTMLDocumentObjVtbl
= {
5007 HTMLDocumentObj_QueryInterface
,
5008 HTMLDocumentObj_AddRef
,
5009 HTMLDocumentObj_Release
5012 /**********************************************************
5013 * ICustomDoc implementation
5016 static inline HTMLDocumentObj
*impl_from_ICustomDoc(ICustomDoc
*iface
)
5018 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, ICustomDoc_iface
);
5021 static HRESULT WINAPI
CustomDoc_QueryInterface(ICustomDoc
*iface
, REFIID riid
, void **ppv
)
5023 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5025 return htmldoc_query_interface(&This
->basedoc
, riid
, ppv
);
5028 static ULONG WINAPI
CustomDoc_AddRef(ICustomDoc
*iface
)
5030 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5032 return htmldoc_addref(&This
->basedoc
);
5035 static ULONG WINAPI
CustomDoc_Release(ICustomDoc
*iface
)
5037 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5039 return htmldoc_release(&This
->basedoc
);
5042 static HRESULT WINAPI
CustomDoc_SetUIHandler(ICustomDoc
*iface
, IDocHostUIHandler
*pUIHandler
)
5044 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5045 IOleCommandTarget
*cmdtrg
;
5048 TRACE("(%p)->(%p)\n", This
, pUIHandler
);
5050 if(This
->custom_hostui
&& This
->hostui
== pUIHandler
)
5053 This
->custom_hostui
= TRUE
;
5056 IDocHostUIHandler_Release(This
->hostui
);
5058 IDocHostUIHandler_AddRef(pUIHandler
);
5059 This
->hostui
= pUIHandler
;
5063 hres
= IDocHostUIHandler_QueryInterface(pUIHandler
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5064 if(SUCCEEDED(hres
)) {
5065 FIXME("custom UI handler supports IOleCommandTarget\n");
5066 IOleCommandTarget_Release(cmdtrg
);
5072 static const ICustomDocVtbl CustomDocVtbl
= {
5073 CustomDoc_QueryInterface
,
5076 CustomDoc_SetUIHandler
5079 static const tid_t HTMLDocumentObj_iface_tids
[] = {
5086 static dispex_static_data_t HTMLDocumentObj_dispex
= {
5088 DispHTMLDocument_tid
,
5089 HTMLDocumentObj_iface_tids
5092 static HRESULT
create_document_object(BOOL is_mhtml
, IUnknown
*outer
, REFIID riid
, void **ppv
)
5094 mozIDOMWindowProxy
*mozwindow
;
5095 HTMLDocumentObj
*doc
;
5096 nsIDOMWindow
*nswindow
= NULL
;
5100 if(outer
&& !IsEqualGUID(&IID_IUnknown
, riid
)) {
5102 return E_INVALIDARG
;
5105 doc
= heap_alloc_zero(sizeof(HTMLDocumentObj
));
5107 return E_OUTOFMEMORY
;
5110 doc
->IUnknown_outer
.lpVtbl
= &HTMLDocumentObjVtbl
;
5111 doc
->ICustomDoc_iface
.lpVtbl
= &CustomDocVtbl
;
5113 init_dispex(&doc
->dispex
, (IUnknown
*)&doc
->ICustomDoc_iface
, &HTMLDocumentObj_dispex
);
5114 init_doc(&doc
->basedoc
, outer
? outer
: &doc
->IUnknown_outer
, &doc
->dispex
.IDispatchEx_iface
);
5115 TargetContainer_Init(doc
);
5116 doc
->basedoc
.doc_obj
= doc
;
5117 doc
->is_mhtml
= is_mhtml
;
5119 doc
->usermode
= UNKNOWN_USERMODE
;
5121 init_binding_ui(doc
);
5123 hres
= create_nscontainer(doc
, &doc
->nscontainer
);
5125 ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n");
5126 htmldoc_release(&doc
->basedoc
);
5130 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
5131 *ppv
= &doc
->IUnknown_outer
;
5133 hres
= htmldoc_query_interface(&doc
->basedoc
, riid
, ppv
);
5134 htmldoc_release(&doc
->basedoc
);
5139 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &mozwindow
);
5140 if(NS_FAILED(nsres
))
5141 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
5143 nsres
= mozIDOMWindowProxy_QueryInterface(mozwindow
, &IID_nsIDOMWindow
, (void**)&nswindow
);
5144 mozIDOMWindowProxy_Release(mozwindow
);
5145 assert(nsres
== NS_OK
);
5147 hres
= HTMLOuterWindow_Create(doc
, nswindow
, NULL
/* FIXME */, &doc
->basedoc
.window
);
5149 nsIDOMWindow_Release(nswindow
);
5151 htmldoc_release(&doc
->basedoc
);
5155 if(!doc
->basedoc
.doc_node
&& doc
->basedoc
.window
->base
.inner_window
->doc
) {
5156 doc
->basedoc
.doc_node
= doc
->basedoc
.window
->base
.inner_window
->doc
;
5157 htmldoc_addref(&doc
->basedoc
.doc_node
->basedoc
);
5165 HRESULT
HTMLDocument_Create(IUnknown
*outer
, REFIID riid
, void **ppv
)
5167 TRACE("(%p %s %p)\n", outer
, debugstr_mshtml_guid(riid
), ppv
);
5168 return create_document_object(FALSE
, outer
, riid
, ppv
);
5171 HRESULT
MHTMLDocument_Create(IUnknown
*outer
, REFIID riid
, void **ppv
)
5173 TRACE("(%p %s %p)\n", outer
, debugstr_mshtml_guid(riid
), ppv
);
5174 return create_document_object(TRUE
, outer
, riid
, ppv
);