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
);
2176 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2180 static HRESULT WINAPI
HTMLDocument3_get_dir(IHTMLDocument3
*iface
, BSTR
*p
)
2182 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2183 FIXME("(%p)->(%p)\n", This
, p
);
2187 static HRESULT WINAPI
HTMLDocument3_put_oncontextmenu(IHTMLDocument3
*iface
, VARIANT v
)
2189 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2191 TRACE("(%p)->()\n", This
);
2193 return set_doc_event(This
, EVENTID_CONTEXTMENU
, &v
);
2196 static HRESULT WINAPI
HTMLDocument3_get_oncontextmenu(IHTMLDocument3
*iface
, VARIANT
*p
)
2198 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2200 TRACE("(%p)->(%p)\n", This
, p
);
2202 return get_doc_event(This
, EVENTID_CONTEXTMENU
, p
);
2205 static HRESULT WINAPI
HTMLDocument3_put_onstop(IHTMLDocument3
*iface
, VARIANT v
)
2207 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2208 FIXME("(%p)->()\n", This
);
2212 static HRESULT WINAPI
HTMLDocument3_get_onstop(IHTMLDocument3
*iface
, VARIANT
*p
)
2214 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2215 FIXME("(%p)->(%p)\n", This
, p
);
2219 static HRESULT WINAPI
HTMLDocument3_createDocumentFragment(IHTMLDocument3
*iface
,
2220 IHTMLDocument2
**ppNewDoc
)
2222 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2223 nsIDOMDocumentFragment
*doc_frag
;
2224 HTMLDocumentNode
*docnode
;
2228 TRACE("(%p)->(%p)\n", This
, ppNewDoc
);
2230 if(!This
->doc_node
->nsdoc
) {
2231 FIXME("NULL nsdoc\n");
2235 nsres
= nsIDOMHTMLDocument_CreateDocumentFragment(This
->doc_node
->nsdoc
, &doc_frag
);
2236 if(NS_FAILED(nsres
)) {
2237 ERR("CreateDocumentFragment failed: %08x\n", nsres
);
2241 hres
= create_document_fragment((nsIDOMNode
*)doc_frag
, This
->doc_node
, &docnode
);
2242 nsIDOMDocumentFragment_Release(doc_frag
);
2246 *ppNewDoc
= &docnode
->basedoc
.IHTMLDocument2_iface
;
2250 static HRESULT WINAPI
HTMLDocument3_get_parentDocument(IHTMLDocument3
*iface
,
2253 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2254 FIXME("(%p)->(%p)\n", This
, p
);
2258 static HRESULT WINAPI
HTMLDocument3_put_enableDownload(IHTMLDocument3
*iface
,
2261 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2262 FIXME("(%p)->(%x)\n", This
, v
);
2266 static HRESULT WINAPI
HTMLDocument3_get_enableDownload(IHTMLDocument3
*iface
,
2269 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2270 FIXME("(%p)->(%p)\n", This
, p
);
2274 static HRESULT WINAPI
HTMLDocument3_put_baseUrl(IHTMLDocument3
*iface
, BSTR v
)
2276 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2277 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2281 static HRESULT WINAPI
HTMLDocument3_get_baseUrl(IHTMLDocument3
*iface
, BSTR
*p
)
2283 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2284 FIXME("(%p)->(%p)\n", This
, p
);
2288 static HRESULT WINAPI
HTMLDocument3_get_childNodes(IHTMLDocument3
*iface
, IDispatch
**p
)
2290 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2292 TRACE("(%p)->(%p)\n", This
, p
);
2294 return IHTMLDOMNode_get_childNodes(&This
->doc_node
->node
.IHTMLDOMNode_iface
, p
);
2297 static HRESULT WINAPI
HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3
*iface
,
2300 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2301 FIXME("(%p)->()\n", This
);
2305 static HRESULT WINAPI
HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3
*iface
,
2308 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2309 FIXME("(%p)->(%p)\n", This
, p
);
2313 static HRESULT WINAPI
HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT v
)
2315 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2316 FIXME("(%p)->()\n", This
);
2320 static HRESULT WINAPI
HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT
*p
)
2322 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2323 FIXME("(%p)->(%p)\n", This
, p
);
2327 static HRESULT WINAPI
HTMLDocument3_getElementsByName(IHTMLDocument3
*iface
, BSTR v
,
2328 IHTMLElementCollection
**ppelColl
)
2330 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2331 nsIDOMNodeList
*node_list
;
2332 nsAString selector_str
;
2336 static const WCHAR formatW
[] = {'*','[','i','d','=','%','s',']',',','*','[','n','a','m','e','=','%','s',']',0};
2338 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppelColl
);
2340 if(!This
->doc_node
|| !This
->doc_node
->nsdoc
) {
2341 /* We should probably return an empty collection. */
2342 FIXME("No nsdoc\n");
2346 selector
= heap_alloc(2*SysStringLen(v
)*sizeof(WCHAR
) + sizeof(formatW
));
2348 return E_OUTOFMEMORY
;
2349 sprintfW(selector
, formatW
, v
, v
);
2352 * NOTE: IE getElementsByName implementation differs from Gecko. It searches both name and id attributes.
2353 * That's why we use CSS selector instead. We should also use name only when it applies to given element
2354 * types and search should be case insensitive. Those are currently not supported properly.
2356 nsAString_InitDepend(&selector_str
, selector
);
2357 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->doc_node
->nsdoc
, &selector_str
, &node_list
);
2358 nsAString_Finish(&selector_str
);
2359 heap_free(selector
);
2360 if(NS_FAILED(nsres
)) {
2361 ERR("QuerySelectorAll failed: %08x\n", nsres
);
2365 *ppelColl
= create_collection_from_nodelist(This
->doc_node
, node_list
);
2366 nsIDOMNodeList_Release(node_list
);
2371 static HRESULT WINAPI
HTMLDocument3_getElementById(IHTMLDocument3
*iface
, BSTR v
,
2374 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2378 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
2380 hres
= get_doc_elem_by_id(This
->doc_node
, v
, &elem
);
2381 if(FAILED(hres
) || !elem
) {
2386 *pel
= &elem
->IHTMLElement_iface
;
2391 static HRESULT WINAPI
HTMLDocument3_getElementsByTagName(IHTMLDocument3
*iface
, BSTR v
,
2392 IHTMLElementCollection
**pelColl
)
2394 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2395 nsIDOMNodeList
*nslist
;
2399 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
2401 if(This
->doc_node
->nsdoc
) {
2402 nsAString_InitDepend(&id_str
, v
);
2403 nsres
= nsIDOMHTMLDocument_GetElementsByTagName(This
->doc_node
->nsdoc
, &id_str
, &nslist
);
2404 nsAString_Finish(&id_str
);
2406 ERR("GetElementByName failed: %08x\n", nsres
);
2410 nsIDOMDocumentFragment
*docfrag
;
2415 for(ptr
=v
; *ptr
; ptr
++) {
2416 if(!isalnumW(*ptr
)) {
2417 FIXME("Unsupported invalid tag %s\n", debugstr_w(v
));
2423 nsres
= nsIDOMNode_QueryInterface(This
->doc_node
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&docfrag
);
2424 if(NS_FAILED(nsres
)) {
2425 ERR("Could not get nsIDOMDocumentFragment iface: %08x\n", nsres
);
2426 return E_UNEXPECTED
;
2429 nsAString_InitDepend(&nsstr
, v
);
2430 nsres
= nsIDOMDocumentFragment_QuerySelectorAll(docfrag
, &nsstr
, &nslist
);
2431 nsAString_Finish(&nsstr
);
2432 nsIDOMDocumentFragment_Release(docfrag
);
2433 if(NS_FAILED(nsres
)) {
2434 ERR("QuerySelectorAll failed: %08x\n", nsres
);
2440 *pelColl
= create_collection_from_nodelist(This
->doc_node
, nslist
);
2441 nsIDOMNodeList_Release(nslist
);
2446 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl
= {
2447 HTMLDocument3_QueryInterface
,
2448 HTMLDocument3_AddRef
,
2449 HTMLDocument3_Release
,
2450 HTMLDocument3_GetTypeInfoCount
,
2451 HTMLDocument3_GetTypeInfo
,
2452 HTMLDocument3_GetIDsOfNames
,
2453 HTMLDocument3_Invoke
,
2454 HTMLDocument3_releaseCapture
,
2455 HTMLDocument3_recalc
,
2456 HTMLDocument3_createTextNode
,
2457 HTMLDocument3_get_documentElement
,
2458 HTMLDocument3_get_uniqueID
,
2459 HTMLDocument3_attachEvent
,
2460 HTMLDocument3_detachEvent
,
2461 HTMLDocument3_put_onrowsdelete
,
2462 HTMLDocument3_get_onrowsdelete
,
2463 HTMLDocument3_put_onrowsinserted
,
2464 HTMLDocument3_get_onrowsinserted
,
2465 HTMLDocument3_put_oncellchange
,
2466 HTMLDocument3_get_oncellchange
,
2467 HTMLDocument3_put_ondatasetchanged
,
2468 HTMLDocument3_get_ondatasetchanged
,
2469 HTMLDocument3_put_ondataavailable
,
2470 HTMLDocument3_get_ondataavailable
,
2471 HTMLDocument3_put_ondatasetcomplete
,
2472 HTMLDocument3_get_ondatasetcomplete
,
2473 HTMLDocument3_put_onpropertychange
,
2474 HTMLDocument3_get_onpropertychange
,
2475 HTMLDocument3_put_dir
,
2476 HTMLDocument3_get_dir
,
2477 HTMLDocument3_put_oncontextmenu
,
2478 HTMLDocument3_get_oncontextmenu
,
2479 HTMLDocument3_put_onstop
,
2480 HTMLDocument3_get_onstop
,
2481 HTMLDocument3_createDocumentFragment
,
2482 HTMLDocument3_get_parentDocument
,
2483 HTMLDocument3_put_enableDownload
,
2484 HTMLDocument3_get_enableDownload
,
2485 HTMLDocument3_put_baseUrl
,
2486 HTMLDocument3_get_baseUrl
,
2487 HTMLDocument3_get_childNodes
,
2488 HTMLDocument3_put_inheritStyleSheets
,
2489 HTMLDocument3_get_inheritStyleSheets
,
2490 HTMLDocument3_put_onbeforeeditfocus
,
2491 HTMLDocument3_get_onbeforeeditfocus
,
2492 HTMLDocument3_getElementsByName
,
2493 HTMLDocument3_getElementById
,
2494 HTMLDocument3_getElementsByTagName
2497 static inline HTMLDocument
*impl_from_IHTMLDocument4(IHTMLDocument4
*iface
)
2499 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument4_iface
);
2502 static HRESULT WINAPI
HTMLDocument4_QueryInterface(IHTMLDocument4
*iface
,
2503 REFIID riid
, void **ppv
)
2505 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2506 return htmldoc_query_interface(This
, riid
, ppv
);
2509 static ULONG WINAPI
HTMLDocument4_AddRef(IHTMLDocument4
*iface
)
2511 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2512 return htmldoc_addref(This
);
2515 static ULONG WINAPI
HTMLDocument4_Release(IHTMLDocument4
*iface
)
2517 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2518 return htmldoc_release(This
);
2521 static HRESULT WINAPI
HTMLDocument4_GetTypeInfoCount(IHTMLDocument4
*iface
, UINT
*pctinfo
)
2523 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2524 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2527 static HRESULT WINAPI
HTMLDocument4_GetTypeInfo(IHTMLDocument4
*iface
, UINT iTInfo
,
2528 LCID lcid
, ITypeInfo
**ppTInfo
)
2530 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2531 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2534 static HRESULT WINAPI
HTMLDocument4_GetIDsOfNames(IHTMLDocument4
*iface
, REFIID riid
,
2535 LPOLESTR
*rgszNames
, UINT cNames
,
2536 LCID lcid
, DISPID
*rgDispId
)
2538 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2539 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
2543 static HRESULT WINAPI
HTMLDocument4_Invoke(IHTMLDocument4
*iface
, DISPID dispIdMember
,
2544 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2545 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2547 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2548 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2549 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2552 static HRESULT WINAPI
HTMLDocument4_focus(IHTMLDocument4
*iface
)
2554 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2555 nsIDOMHTMLElement
*nsbody
;
2558 TRACE("(%p)->()\n", This
);
2560 nsres
= nsIDOMHTMLDocument_GetBody(This
->doc_node
->nsdoc
, &nsbody
);
2561 if(NS_FAILED(nsres
) || !nsbody
) {
2562 ERR("GetBody failed: %08x\n", nsres
);
2566 nsres
= nsIDOMHTMLElement_Focus(nsbody
);
2567 nsIDOMHTMLElement_Release(nsbody
);
2568 if(NS_FAILED(nsres
)) {
2569 ERR("Focus failed: %08x\n", nsres
);
2576 static HRESULT WINAPI
HTMLDocument4_hasFocus(IHTMLDocument4
*iface
, VARIANT_BOOL
*pfFocus
)
2578 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2582 TRACE("(%p)->(%p)\n", This
, pfFocus
);
2584 if(!This
->doc_node
->nsdoc
) {
2585 FIXME("Unimplemented for fragments.\n");
2589 nsres
= nsIDOMHTMLDocument_HasFocus(This
->doc_node
->nsdoc
, &has_focus
);
2590 assert(nsres
== NS_OK
);
2592 *pfFocus
= has_focus
? VARIANT_TRUE
: VARIANT_FALSE
;
2596 static HRESULT WINAPI
HTMLDocument4_put_onselectionchange(IHTMLDocument4
*iface
, VARIANT v
)
2598 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2599 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2603 static HRESULT WINAPI
HTMLDocument4_get_onselectionchange(IHTMLDocument4
*iface
, VARIANT
*p
)
2605 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2606 FIXME("(%p)->(%p)\n", This
, p
);
2610 static HRESULT WINAPI
HTMLDocument4_get_namespace(IHTMLDocument4
*iface
, IDispatch
**p
)
2612 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2613 FIXME("(%p)->(%p)\n", This
, p
);
2617 static HRESULT WINAPI
HTMLDocument4_createDocumentFromUrl(IHTMLDocument4
*iface
, BSTR bstrUrl
,
2618 BSTR bstrOptions
, IHTMLDocument2
**newDoc
)
2620 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2621 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrUrl
), debugstr_w(bstrOptions
), newDoc
);
2625 static HRESULT WINAPI
HTMLDocument4_put_media(IHTMLDocument4
*iface
, BSTR v
)
2627 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2628 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2632 static HRESULT WINAPI
HTMLDocument4_get_media(IHTMLDocument4
*iface
, BSTR
*p
)
2634 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2635 FIXME("(%p)->(%p)\n", This
, p
);
2639 static HRESULT WINAPI
HTMLDocument4_createEventObject(IHTMLDocument4
*iface
,
2640 VARIANT
*pvarEventObject
, IHTMLEventObj
**ppEventObj
)
2642 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2644 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(pvarEventObject
), ppEventObj
);
2646 if(pvarEventObject
&& V_VT(pvarEventObject
) != VT_ERROR
&& V_VT(pvarEventObject
) != VT_EMPTY
) {
2647 FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject
));
2651 return create_event_obj(ppEventObj
);
2654 static HRESULT WINAPI
HTMLDocument4_fireEvent(IHTMLDocument4
*iface
, BSTR bstrEventName
,
2655 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCanceled
)
2657 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2659 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrEventName
), pvarEventObject
, pfCanceled
);
2661 return dispatch_event(&This
->doc_node
->node
, bstrEventName
, pvarEventObject
, pfCanceled
);
2664 static HRESULT WINAPI
HTMLDocument4_createRenderStyle(IHTMLDocument4
*iface
, BSTR v
,
2665 IHTMLRenderStyle
**ppIHTMLRenderStyle
)
2667 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2668 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppIHTMLRenderStyle
);
2672 static HRESULT WINAPI
HTMLDocument4_put_oncontrolselect(IHTMLDocument4
*iface
, VARIANT v
)
2674 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2675 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2679 static HRESULT WINAPI
HTMLDocument4_get_oncontrolselect(IHTMLDocument4
*iface
, VARIANT
*p
)
2681 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2682 FIXME("(%p)->(%p)\n", This
, p
);
2686 static HRESULT WINAPI
HTMLDocument4_get_URLEncoded(IHTMLDocument4
*iface
, BSTR
*p
)
2688 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2689 FIXME("(%p)->(%p)\n", This
, p
);
2693 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl
= {
2694 HTMLDocument4_QueryInterface
,
2695 HTMLDocument4_AddRef
,
2696 HTMLDocument4_Release
,
2697 HTMLDocument4_GetTypeInfoCount
,
2698 HTMLDocument4_GetTypeInfo
,
2699 HTMLDocument4_GetIDsOfNames
,
2700 HTMLDocument4_Invoke
,
2701 HTMLDocument4_focus
,
2702 HTMLDocument4_hasFocus
,
2703 HTMLDocument4_put_onselectionchange
,
2704 HTMLDocument4_get_onselectionchange
,
2705 HTMLDocument4_get_namespace
,
2706 HTMLDocument4_createDocumentFromUrl
,
2707 HTMLDocument4_put_media
,
2708 HTMLDocument4_get_media
,
2709 HTMLDocument4_createEventObject
,
2710 HTMLDocument4_fireEvent
,
2711 HTMLDocument4_createRenderStyle
,
2712 HTMLDocument4_put_oncontrolselect
,
2713 HTMLDocument4_get_oncontrolselect
,
2714 HTMLDocument4_get_URLEncoded
2717 static inline HTMLDocument
*impl_from_IHTMLDocument5(IHTMLDocument5
*iface
)
2719 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument5_iface
);
2722 static HRESULT WINAPI
HTMLDocument5_QueryInterface(IHTMLDocument5
*iface
,
2723 REFIID riid
, void **ppv
)
2725 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2726 return htmldoc_query_interface(This
, riid
, ppv
);
2729 static ULONG WINAPI
HTMLDocument5_AddRef(IHTMLDocument5
*iface
)
2731 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2732 return htmldoc_addref(This
);
2735 static ULONG WINAPI
HTMLDocument5_Release(IHTMLDocument5
*iface
)
2737 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2738 return htmldoc_release(This
);
2741 static HRESULT WINAPI
HTMLDocument5_GetTypeInfoCount(IHTMLDocument5
*iface
, UINT
*pctinfo
)
2743 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2744 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2747 static HRESULT WINAPI
HTMLDocument5_GetTypeInfo(IHTMLDocument5
*iface
, UINT iTInfo
,
2748 LCID lcid
, ITypeInfo
**ppTInfo
)
2750 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2751 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2754 static HRESULT WINAPI
HTMLDocument5_GetIDsOfNames(IHTMLDocument5
*iface
, REFIID riid
,
2755 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2757 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2758 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
2762 static HRESULT WINAPI
HTMLDocument5_Invoke(IHTMLDocument5
*iface
, DISPID dispIdMember
,
2763 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2764 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2766 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2767 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2768 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2771 static HRESULT WINAPI
HTMLDocument5_put_onmousewheel(IHTMLDocument5
*iface
, VARIANT v
)
2773 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2774 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2778 static HRESULT WINAPI
HTMLDocument5_get_onmousewheel(IHTMLDocument5
*iface
, VARIANT
*p
)
2780 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2781 FIXME("(%p)->(%p)\n", This
, p
);
2785 static HRESULT WINAPI
HTMLDocument5_get_doctype(IHTMLDocument5
*iface
, IHTMLDOMNode
**p
)
2787 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2788 FIXME("(%p)->(%p)\n", This
, p
);
2792 static HRESULT WINAPI
HTMLDocument5_get_implementation(IHTMLDocument5
*iface
, IHTMLDOMImplementation
**p
)
2794 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2795 HTMLDocumentNode
*doc_node
= This
->doc_node
;
2797 TRACE("(%p)->(%p)\n", This
, p
);
2799 if(!doc_node
->dom_implementation
) {
2802 hres
= create_dom_implementation(&doc_node
->dom_implementation
);
2807 IHTMLDOMImplementation_AddRef(doc_node
->dom_implementation
);
2808 *p
= doc_node
->dom_implementation
;
2812 static HRESULT WINAPI
HTMLDocument5_createAttribute(IHTMLDocument5
*iface
, BSTR bstrattrName
,
2813 IHTMLDOMAttribute
**ppattribute
)
2815 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2816 HTMLDOMAttribute
*attr
;
2819 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrattrName
), ppattribute
);
2821 hres
= HTMLDOMAttribute_Create(bstrattrName
, NULL
, 0, &attr
);
2825 *ppattribute
= &attr
->IHTMLDOMAttribute_iface
;
2829 static HRESULT WINAPI
HTMLDocument5_createComment(IHTMLDocument5
*iface
, BSTR bstrdata
,
2830 IHTMLDOMNode
**ppRetNode
)
2832 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2833 nsIDOMComment
*nscomment
;
2839 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrdata
), ppRetNode
);
2841 if(!This
->doc_node
->nsdoc
) {
2842 WARN("NULL nsdoc\n");
2843 return E_UNEXPECTED
;
2846 nsAString_InitDepend(&str
, bstrdata
);
2847 nsres
= nsIDOMHTMLDocument_CreateComment(This
->doc_node
->nsdoc
, &str
, &nscomment
);
2848 nsAString_Finish(&str
);
2849 if(NS_FAILED(nsres
)) {
2850 ERR("CreateTextNode failed: %08x\n", nsres
);
2854 hres
= HTMLCommentElement_Create(This
->doc_node
, (nsIDOMNode
*)nscomment
, &elem
);
2855 nsIDOMComment_Release(nscomment
);
2859 *ppRetNode
= &elem
->node
.IHTMLDOMNode_iface
;
2863 static HRESULT WINAPI
HTMLDocument5_put_onfocusin(IHTMLDocument5
*iface
, VARIANT v
)
2865 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2866 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2870 static HRESULT WINAPI
HTMLDocument5_get_onfocusin(IHTMLDocument5
*iface
, VARIANT
*p
)
2872 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2873 FIXME("(%p)->(%p)\n", This
, p
);
2877 static HRESULT WINAPI
HTMLDocument5_put_onfocusout(IHTMLDocument5
*iface
, VARIANT v
)
2879 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2880 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2884 static HRESULT WINAPI
HTMLDocument5_get_onfocusout(IHTMLDocument5
*iface
, VARIANT
*p
)
2886 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2887 FIXME("(%p)->(%p)\n", This
, p
);
2891 static HRESULT WINAPI
HTMLDocument5_put_onactivate(IHTMLDocument5
*iface
, VARIANT v
)
2893 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2894 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2898 static HRESULT WINAPI
HTMLDocument5_get_onactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2900 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2901 FIXME("(%p)->(%p)\n", This
, p
);
2905 static HRESULT WINAPI
HTMLDocument5_put_ondeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2907 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2908 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2912 static HRESULT WINAPI
HTMLDocument5_get_ondeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2914 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2915 FIXME("(%p)->(%p)\n", This
, p
);
2919 static HRESULT WINAPI
HTMLDocument5_put_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2921 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2922 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2926 static HRESULT WINAPI
HTMLDocument5_get_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2928 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2929 FIXME("(%p)->(%p)\n", This
, p
);
2933 static HRESULT WINAPI
HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2935 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2936 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2940 static HRESULT WINAPI
HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2942 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2943 FIXME("(%p)->(%p)\n", This
, p
);
2947 static HRESULT WINAPI
HTMLDocument5_get_compatMode(IHTMLDocument5
*iface
, BSTR
*p
)
2949 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2951 static const WCHAR BackCompatW
[] = {'B','a','c','k','C','o','m','p','a','t',0};
2952 static const WCHAR CSS1CompatW
[] = {'C','S','S','1','C','o','m','p','a','t',0};
2954 TRACE("(%p)->(%p)\n", This
, p
);
2956 *p
= SysAllocString(This
->doc_node
->document_mode
== COMPAT_MODE_QUIRKS
? BackCompatW
: CSS1CompatW
);
2957 return *p
? S_OK
: E_OUTOFMEMORY
;
2960 static const IHTMLDocument5Vtbl HTMLDocument5Vtbl
= {
2961 HTMLDocument5_QueryInterface
,
2962 HTMLDocument5_AddRef
,
2963 HTMLDocument5_Release
,
2964 HTMLDocument5_GetTypeInfoCount
,
2965 HTMLDocument5_GetTypeInfo
,
2966 HTMLDocument5_GetIDsOfNames
,
2967 HTMLDocument5_Invoke
,
2968 HTMLDocument5_put_onmousewheel
,
2969 HTMLDocument5_get_onmousewheel
,
2970 HTMLDocument5_get_doctype
,
2971 HTMLDocument5_get_implementation
,
2972 HTMLDocument5_createAttribute
,
2973 HTMLDocument5_createComment
,
2974 HTMLDocument5_put_onfocusin
,
2975 HTMLDocument5_get_onfocusin
,
2976 HTMLDocument5_put_onfocusout
,
2977 HTMLDocument5_get_onfocusout
,
2978 HTMLDocument5_put_onactivate
,
2979 HTMLDocument5_get_onactivate
,
2980 HTMLDocument5_put_ondeactivate
,
2981 HTMLDocument5_get_ondeactivate
,
2982 HTMLDocument5_put_onbeforeactivate
,
2983 HTMLDocument5_get_onbeforeactivate
,
2984 HTMLDocument5_put_onbeforedeactivate
,
2985 HTMLDocument5_get_onbeforedeactivate
,
2986 HTMLDocument5_get_compatMode
2989 static inline HTMLDocument
*impl_from_IHTMLDocument6(IHTMLDocument6
*iface
)
2991 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument6_iface
);
2994 static HRESULT WINAPI
HTMLDocument6_QueryInterface(IHTMLDocument6
*iface
,
2995 REFIID riid
, void **ppv
)
2997 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
2998 return htmldoc_query_interface(This
, riid
, ppv
);
3001 static ULONG WINAPI
HTMLDocument6_AddRef(IHTMLDocument6
*iface
)
3003 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3004 return htmldoc_addref(This
);
3007 static ULONG WINAPI
HTMLDocument6_Release(IHTMLDocument6
*iface
)
3009 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3010 return htmldoc_release(This
);
3013 static HRESULT WINAPI
HTMLDocument6_GetTypeInfoCount(IHTMLDocument6
*iface
, UINT
*pctinfo
)
3015 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3016 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3019 static HRESULT WINAPI
HTMLDocument6_GetTypeInfo(IHTMLDocument6
*iface
, UINT iTInfo
,
3020 LCID lcid
, ITypeInfo
**ppTInfo
)
3022 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3023 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3026 static HRESULT WINAPI
HTMLDocument6_GetIDsOfNames(IHTMLDocument6
*iface
, REFIID riid
,
3027 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3029 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3030 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
3034 static HRESULT WINAPI
HTMLDocument6_Invoke(IHTMLDocument6
*iface
, DISPID dispIdMember
,
3035 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3036 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3038 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3039 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3040 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3043 static HRESULT WINAPI
HTMLDocument6_get_compatible(IHTMLDocument6
*iface
,
3044 IHTMLDocumentCompatibleInfoCollection
**p
)
3046 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3047 FIXME("(%p)->(%p)\n", This
, p
);
3051 static HRESULT WINAPI
HTMLDocument6_get_documentMode(IHTMLDocument6
*iface
, VARIANT
*p
)
3053 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3055 static const int docmode_values
[] = {
3056 5, /* DOCMODE_QUIRKS */
3057 7, /* DOCMODE_IE7 */
3058 8, /* DOCMODE_IE8 */
3059 9, /* DOCMODE_IE8 */
3060 10, /* DOCMODE_IE10 */
3061 11 /* DOCMODE_IE11 */
3064 TRACE("(%p)->(%p)\n", This
, p
);
3066 if(!This
->doc_node
) {
3067 FIXME("NULL doc_node\n");
3068 return E_UNEXPECTED
;
3071 assert(This
->doc_node
->document_mode
< sizeof(docmode_values
)/sizeof(*docmode_values
));
3074 V_I4(p
) = docmode_values
[This
->doc_node
->document_mode
];
3078 static HRESULT WINAPI
HTMLDocument6_get_onstorage(IHTMLDocument6
*iface
,
3081 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3082 FIXME("(%p)->(%p)\n", This
, p
);
3086 static HRESULT WINAPI
HTMLDocument6_put_onstorage(IHTMLDocument6
*iface
, VARIANT v
)
3088 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3089 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3093 static HRESULT WINAPI
HTMLDocument6_get_onstoragecommit(IHTMLDocument6
*iface
,
3096 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3097 FIXME("(%p)->(%p)\n", This
, p
);
3101 static HRESULT WINAPI
HTMLDocument6_put_onstoragecommit(IHTMLDocument6
*iface
, VARIANT v
)
3103 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3104 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3108 static HRESULT WINAPI
HTMLDocument6_getElementById(IHTMLDocument6
*iface
,
3109 BSTR bstrId
, IHTMLElement2
**p
)
3111 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3112 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrId
), p
);
3116 static HRESULT WINAPI
HTMLDocument6_updateSettings(IHTMLDocument6
*iface
)
3118 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3119 FIXME("(%p)->()\n", This
);
3123 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl
= {
3124 HTMLDocument6_QueryInterface
,
3125 HTMLDocument6_AddRef
,
3126 HTMLDocument6_Release
,
3127 HTMLDocument6_GetTypeInfoCount
,
3128 HTMLDocument6_GetTypeInfo
,
3129 HTMLDocument6_GetIDsOfNames
,
3130 HTMLDocument6_Invoke
,
3131 HTMLDocument6_get_compatible
,
3132 HTMLDocument6_get_documentMode
,
3133 HTMLDocument6_put_onstorage
,
3134 HTMLDocument6_get_onstorage
,
3135 HTMLDocument6_put_onstoragecommit
,
3136 HTMLDocument6_get_onstoragecommit
,
3137 HTMLDocument6_getElementById
,
3138 HTMLDocument6_updateSettings
3141 static inline HTMLDocument
*impl_from_IHTMLDocument7(IHTMLDocument7
*iface
)
3143 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument7_iface
);
3146 static HRESULT WINAPI
HTMLDocument7_QueryInterface(IHTMLDocument7
*iface
, REFIID riid
, void **ppv
)
3148 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3149 return htmldoc_query_interface(This
, riid
, ppv
);
3152 static ULONG WINAPI
HTMLDocument7_AddRef(IHTMLDocument7
*iface
)
3154 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3155 return htmldoc_addref(This
);
3158 static ULONG WINAPI
HTMLDocument7_Release(IHTMLDocument7
*iface
)
3160 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3161 return htmldoc_release(This
);
3164 static HRESULT WINAPI
HTMLDocument7_GetTypeInfoCount(IHTMLDocument7
*iface
, UINT
*pctinfo
)
3166 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3167 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3170 static HRESULT WINAPI
HTMLDocument7_GetTypeInfo(IHTMLDocument7
*iface
, UINT iTInfo
,
3171 LCID lcid
, ITypeInfo
**ppTInfo
)
3173 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3174 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3177 static HRESULT WINAPI
HTMLDocument7_GetIDsOfNames(IHTMLDocument7
*iface
, REFIID riid
,
3178 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3180 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3181 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
3185 static HRESULT WINAPI
HTMLDocument7_Invoke(IHTMLDocument7
*iface
, DISPID dispIdMember
,
3186 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3187 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3189 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3190 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3191 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3194 static HRESULT WINAPI
HTMLDocument7_get_defaultView(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
3196 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3197 FIXME("(%p)->(%p)\n", This
, p
);
3201 static HRESULT WINAPI
HTMLDocument7_createCDATASection(IHTMLDocument7
*iface
, BSTR text
, IHTMLDOMNode
**newCDATASectionNode
)
3203 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3204 FIXME("(%p)->(%p)\n", This
, newCDATASectionNode
);
3208 static HRESULT WINAPI
HTMLDocument7_getSelection(IHTMLDocument7
*iface
, IHTMLSelection
**ppIHTMLSelection
)
3210 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3211 FIXME("(%p)->(%p)\n", This
, ppIHTMLSelection
);
3215 static HRESULT WINAPI
HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3216 BSTR bstrLocalName
, IHTMLElementCollection
**pelColl
)
3218 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3219 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrLocalName
), pelColl
);
3223 static HRESULT WINAPI
HTMLDocument7_createElementNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
, BSTR bstrTag
, IHTMLElement
**newElem
)
3225 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3226 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrTag
), newElem
);
3230 static HRESULT WINAPI
HTMLDocument7_createAttributeNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3231 BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3233 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3234 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrAttrName
), ppAttribute
);
3238 static HRESULT WINAPI
HTMLDocument7_put_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT v
)
3240 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3241 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3245 static HRESULT WINAPI
HTMLDocument7_get_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT
*p
)
3247 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3248 FIXME("(%p)->(%p)\n", This
, p
);
3252 static HRESULT WINAPI
HTMLDocument7_get_characterSet(IHTMLDocument7
*iface
, BSTR
*p
)
3254 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3255 FIXME("(%p)->(%p)\n", This
, p
);
3259 static HRESULT WINAPI
HTMLDocument7_createElement(IHTMLDocument7
*iface
, BSTR bstrTag
, IHTMLElement
**newElem
)
3261 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3262 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrTag
), newElem
);
3266 static HRESULT WINAPI
HTMLDocument7_createAttribute(IHTMLDocument7
*iface
, BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3268 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3269 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrAttrName
), ppAttribute
);
3273 static HRESULT WINAPI
HTMLDocument7_getElementByClassName(IHTMLDocument7
*iface
, BSTR v
, IHTMLElementCollection
**pel
)
3275 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3276 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
3280 static HRESULT WINAPI
HTMLDocument7_createProcessingInstruction(IHTMLDocument7
*iface
, BSTR target
,
3281 BSTR data
, IDOMProcessingInstruction
**newProcessingInstruction
)
3283 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3284 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(target
), debugstr_w(data
), newProcessingInstruction
);
3288 static HRESULT WINAPI
HTMLDocument7_adoptNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
, IHTMLDOMNode3
**ppNodeDest
)
3290 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3291 FIXME("(%p)->(%p %p)\n", This
, pNodeSource
, ppNodeDest
);
3295 static HRESULT WINAPI
HTMLDocument7_put_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT v
)
3297 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3298 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3302 static HRESULT WINAPI
HTMLDocument7_get_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT
*p
)
3304 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3305 FIXME("(%p)->(%p)\n", This
, p
);
3309 static HRESULT WINAPI
HTMLDocument7_get_all(IHTMLDocument7
*iface
, IHTMLElementCollection
**p
)
3311 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3312 FIXME("(%p)->(%p)\n", This
, p
);
3316 static HRESULT WINAPI
HTMLDocument7_get_inputEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3318 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3319 FIXME("(%p)->(%p)\n", This
, p
);
3323 static HRESULT WINAPI
HTMLDocument7_get_xmlEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3325 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3326 FIXME("(%p)->(%p)\n", This
, p
);
3330 static HRESULT WINAPI
HTMLDocument7_put_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL v
)
3332 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3333 FIXME("(%p)->(%x)\n", This
, v
);
3337 static HRESULT WINAPI
HTMLDocument7_get_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL
*p
)
3339 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3340 FIXME("(%p)->(%p)\n", This
, p
);
3344 static HRESULT WINAPI
HTMLDocument7_put_xmlVersion(IHTMLDocument7
*iface
, BSTR v
)
3346 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3347 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
3351 static HRESULT WINAPI
HTMLDocument7_get_xmlVersion(IHTMLDocument7
*iface
, BSTR
*p
)
3353 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3354 FIXME("(%p)->(%p)\n", This
, p
);
3358 static HRESULT WINAPI
HTMLDocument7_hasAttributes(IHTMLDocument7
*iface
, VARIANT_BOOL
*pfHasAttributes
)
3360 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3361 FIXME("(%p)->(%p)\n", This
, pfHasAttributes
);
3365 static HRESULT WINAPI
HTMLDocument7_put_onabort(IHTMLDocument7
*iface
, VARIANT v
)
3367 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3368 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3372 static HRESULT WINAPI
HTMLDocument7_get_onabort(IHTMLDocument7
*iface
, VARIANT
*p
)
3374 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3375 FIXME("(%p)->(%p)\n", This
, p
);
3379 static HRESULT WINAPI
HTMLDocument7_put_onblur(IHTMLDocument7
*iface
, VARIANT v
)
3381 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3382 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3386 static HRESULT WINAPI
HTMLDocument7_get_onblur(IHTMLDocument7
*iface
, VARIANT
*p
)
3388 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3389 FIXME("(%p)->(%p)\n", This
, p
);
3393 static HRESULT WINAPI
HTMLDocument7_put_oncanplay(IHTMLDocument7
*iface
, VARIANT v
)
3395 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3396 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3400 static HRESULT WINAPI
HTMLDocument7_get_oncanplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3402 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3403 FIXME("(%p)->(%p)\n", This
, p
);
3407 static HRESULT WINAPI
HTMLDocument7_put_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT v
)
3409 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3410 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3414 static HRESULT WINAPI
HTMLDocument7_get_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT
*p
)
3416 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3417 FIXME("(%p)->(%p)\n", This
, p
);
3421 static HRESULT WINAPI
HTMLDocument7_put_onchange(IHTMLDocument7
*iface
, VARIANT v
)
3423 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3424 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3428 static HRESULT WINAPI
HTMLDocument7_get_onchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3430 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3431 FIXME("(%p)->(%p)\n", This
, p
);
3435 static HRESULT WINAPI
HTMLDocument7_put_ondrag(IHTMLDocument7
*iface
, VARIANT v
)
3437 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3438 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3442 static HRESULT WINAPI
HTMLDocument7_get_ondrag(IHTMLDocument7
*iface
, VARIANT
*p
)
3444 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3445 FIXME("(%p)->(%p)\n", This
, p
);
3449 static HRESULT WINAPI
HTMLDocument7_put_ondragend(IHTMLDocument7
*iface
, VARIANT v
)
3451 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3452 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3456 static HRESULT WINAPI
HTMLDocument7_get_ondragend(IHTMLDocument7
*iface
, VARIANT
*p
)
3458 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3459 FIXME("(%p)->(%p)\n", This
, p
);
3463 static HRESULT WINAPI
HTMLDocument7_put_ondragenter(IHTMLDocument7
*iface
, VARIANT v
)
3465 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3466 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3470 static HRESULT WINAPI
HTMLDocument7_get_ondragenter(IHTMLDocument7
*iface
, VARIANT
*p
)
3472 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3473 FIXME("(%p)->(%p)\n", This
, p
);
3477 static HRESULT WINAPI
HTMLDocument7_put_ondragleave(IHTMLDocument7
*iface
, VARIANT v
)
3479 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3480 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3484 static HRESULT WINAPI
HTMLDocument7_get_ondragleave(IHTMLDocument7
*iface
, VARIANT
*p
)
3486 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3487 FIXME("(%p)->(%p)\n", This
, p
);
3491 static HRESULT WINAPI
HTMLDocument7_put_ondragover(IHTMLDocument7
*iface
, VARIANT v
)
3493 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3494 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3498 static HRESULT WINAPI
HTMLDocument7_get_ondragover(IHTMLDocument7
*iface
, VARIANT
*p
)
3500 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3501 FIXME("(%p)->(%p)\n", This
, p
);
3505 static HRESULT WINAPI
HTMLDocument7_put_ondrop(IHTMLDocument7
*iface
, VARIANT v
)
3507 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3508 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3512 static HRESULT WINAPI
HTMLDocument7_get_ondrop(IHTMLDocument7
*iface
, VARIANT
*p
)
3514 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3515 FIXME("(%p)->(%p)\n", This
, p
);
3519 static HRESULT WINAPI
HTMLDocument7_put_ondurationchange(IHTMLDocument7
*iface
, VARIANT v
)
3521 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3522 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3526 static HRESULT WINAPI
HTMLDocument7_get_ondurationchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3528 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3529 FIXME("(%p)->(%p)\n", This
, p
);
3533 static HRESULT WINAPI
HTMLDocument7_put_onemptied(IHTMLDocument7
*iface
, VARIANT v
)
3535 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3536 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3540 static HRESULT WINAPI
HTMLDocument7_get_onemptied(IHTMLDocument7
*iface
, VARIANT
*p
)
3542 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3543 FIXME("(%p)->(%p)\n", This
, p
);
3547 static HRESULT WINAPI
HTMLDocument7_put_onended(IHTMLDocument7
*iface
, VARIANT v
)
3549 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3550 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3554 static HRESULT WINAPI
HTMLDocument7_get_onended(IHTMLDocument7
*iface
, VARIANT
*p
)
3556 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3557 FIXME("(%p)->(%p)\n", This
, p
);
3561 static HRESULT WINAPI
HTMLDocument7_put_onerror(IHTMLDocument7
*iface
, VARIANT v
)
3563 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3564 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3568 static HRESULT WINAPI
HTMLDocument7_get_onerror(IHTMLDocument7
*iface
, VARIANT
*p
)
3570 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3571 FIXME("(%p)->(%p)\n", This
, p
);
3575 static HRESULT WINAPI
HTMLDocument7_put_onfocus(IHTMLDocument7
*iface
, VARIANT v
)
3577 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3578 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3582 static HRESULT WINAPI
HTMLDocument7_get_onfocus(IHTMLDocument7
*iface
, VARIANT
*p
)
3584 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3585 FIXME("(%p)->(%p)\n", This
, p
);
3589 static HRESULT WINAPI
HTMLDocument7_put_oninput(IHTMLDocument7
*iface
, VARIANT v
)
3591 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3592 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3596 static HRESULT WINAPI
HTMLDocument7_get_oninput(IHTMLDocument7
*iface
, VARIANT
*p
)
3598 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3599 FIXME("(%p)->(%p)\n", This
, p
);
3603 static HRESULT WINAPI
HTMLDocument7_put_onload(IHTMLDocument7
*iface
, VARIANT v
)
3605 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3606 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3610 static HRESULT WINAPI
HTMLDocument7_get_onload(IHTMLDocument7
*iface
, VARIANT
*p
)
3612 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3613 FIXME("(%p)->(%p)\n", This
, p
);
3617 static HRESULT WINAPI
HTMLDocument7_put_onloadeddata(IHTMLDocument7
*iface
, VARIANT v
)
3619 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3620 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3624 static HRESULT WINAPI
HTMLDocument7_get_onloadeddata(IHTMLDocument7
*iface
, VARIANT
*p
)
3626 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3627 FIXME("(%p)->(%p)\n", This
, p
);
3631 static HRESULT WINAPI
HTMLDocument7_put_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT v
)
3633 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3634 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3638 static HRESULT WINAPI
HTMLDocument7_get_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT
*p
)
3640 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3641 FIXME("(%p)->(%p)\n", This
, p
);
3645 static HRESULT WINAPI
HTMLDocument7_put_onloadstart(IHTMLDocument7
*iface
, VARIANT v
)
3647 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3648 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3652 static HRESULT WINAPI
HTMLDocument7_get_onloadstart(IHTMLDocument7
*iface
, VARIANT
*p
)
3654 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3655 FIXME("(%p)->(%p)\n", This
, p
);
3659 static HRESULT WINAPI
HTMLDocument7_put_onpause(IHTMLDocument7
*iface
, VARIANT v
)
3661 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3662 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3666 static HRESULT WINAPI
HTMLDocument7_get_onpause(IHTMLDocument7
*iface
, VARIANT
*p
)
3668 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3669 FIXME("(%p)->(%p)\n", This
, p
);
3673 static HRESULT WINAPI
HTMLDocument7_put_onplay(IHTMLDocument7
*iface
, VARIANT v
)
3675 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3676 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3680 static HRESULT WINAPI
HTMLDocument7_get_onplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3682 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3683 FIXME("(%p)->(%p)\n", This
, p
);
3687 static HRESULT WINAPI
HTMLDocument7_put_onplaying(IHTMLDocument7
*iface
, VARIANT v
)
3689 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3690 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3694 static HRESULT WINAPI
HTMLDocument7_get_onplaying(IHTMLDocument7
*iface
, VARIANT
*p
)
3696 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3697 FIXME("(%p)->(%p)\n", This
, p
);
3701 static HRESULT WINAPI
HTMLDocument7_put_onprogress(IHTMLDocument7
*iface
, VARIANT v
)
3703 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3704 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3708 static HRESULT WINAPI
HTMLDocument7_get_onprogress(IHTMLDocument7
*iface
, VARIANT
*p
)
3710 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3711 FIXME("(%p)->(%p)\n", This
, p
);
3715 static HRESULT WINAPI
HTMLDocument7_put_onratechange(IHTMLDocument7
*iface
, VARIANT v
)
3717 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3718 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3722 static HRESULT WINAPI
HTMLDocument7_get_onratechange(IHTMLDocument7
*iface
, VARIANT
*p
)
3724 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3725 FIXME("(%p)->(%p)\n", This
, p
);
3729 static HRESULT WINAPI
HTMLDocument7_put_onreset(IHTMLDocument7
*iface
, VARIANT v
)
3731 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3732 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3736 static HRESULT WINAPI
HTMLDocument7_get_onreset(IHTMLDocument7
*iface
, VARIANT
*p
)
3738 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3739 FIXME("(%p)->(%p)\n", This
, p
);
3743 static HRESULT WINAPI
HTMLDocument7_put_onscroll(IHTMLDocument7
*iface
, VARIANT v
)
3745 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3746 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3750 static HRESULT WINAPI
HTMLDocument7_get_onscroll(IHTMLDocument7
*iface
, VARIANT
*p
)
3752 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3753 FIXME("(%p)->(%p)\n", This
, p
);
3757 static HRESULT WINAPI
HTMLDocument7_put_onseekend(IHTMLDocument7
*iface
, VARIANT v
)
3759 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3760 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3764 static HRESULT WINAPI
HTMLDocument7_get_onseekend(IHTMLDocument7
*iface
, VARIANT
*p
)
3766 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3767 FIXME("(%p)->(%p)\n", This
, p
);
3771 static HRESULT WINAPI
HTMLDocument7_put_onseeking(IHTMLDocument7
*iface
, VARIANT v
)
3773 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3774 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3778 static HRESULT WINAPI
HTMLDocument7_get_onseeking(IHTMLDocument7
*iface
, VARIANT
*p
)
3780 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3781 FIXME("(%p)->(%p)\n", This
, p
);
3785 static HRESULT WINAPI
HTMLDocument7_put_onselect(IHTMLDocument7
*iface
, VARIANT v
)
3787 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3788 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3792 static HRESULT WINAPI
HTMLDocument7_get_onselect(IHTMLDocument7
*iface
, VARIANT
*p
)
3794 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3795 FIXME("(%p)->(%p)\n", This
, p
);
3799 static HRESULT WINAPI
HTMLDocument7_put_onstalled(IHTMLDocument7
*iface
, VARIANT v
)
3801 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3802 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3806 static HRESULT WINAPI
HTMLDocument7_get_onstalled(IHTMLDocument7
*iface
, VARIANT
*p
)
3808 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3809 FIXME("(%p)->(%p)\n", This
, p
);
3813 static HRESULT WINAPI
HTMLDocument7_put_onsubmit(IHTMLDocument7
*iface
, VARIANT v
)
3815 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3816 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3820 static HRESULT WINAPI
HTMLDocument7_get_onsubmit(IHTMLDocument7
*iface
, VARIANT
*p
)
3822 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3823 FIXME("(%p)->(%p)\n", This
, p
);
3827 static HRESULT WINAPI
HTMLDocument7_put_onsuspend(IHTMLDocument7
*iface
, VARIANT v
)
3829 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3830 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3834 static HRESULT WINAPI
HTMLDocument7_get_onsuspend(IHTMLDocument7
*iface
, VARIANT
*p
)
3836 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3837 FIXME("(%p)->(%p)\n", This
, p
);
3841 static HRESULT WINAPI
HTMLDocument7_put_ontimeupdate(IHTMLDocument7
*iface
, VARIANT v
)
3843 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3844 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3848 static HRESULT WINAPI
HTMLDocument7_get_ontimeupdate(IHTMLDocument7
*iface
, VARIANT
*p
)
3850 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3851 FIXME("(%p)->(%p)\n", This
, p
);
3855 static HRESULT WINAPI
HTMLDocument7_put_onvolumechange(IHTMLDocument7
*iface
, VARIANT v
)
3857 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3858 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3862 static HRESULT WINAPI
HTMLDocument7_get_onvolumechange(IHTMLDocument7
*iface
, VARIANT
*p
)
3864 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3865 FIXME("(%p)->(%p)\n", This
, p
);
3869 static HRESULT WINAPI
HTMLDocument7_put_onwaiting(IHTMLDocument7
*iface
, VARIANT v
)
3871 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3872 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3876 static HRESULT WINAPI
HTMLDocument7_get_onwaiting(IHTMLDocument7
*iface
, VARIANT
*p
)
3878 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3879 FIXME("(%p)->(%p)\n", This
, p
);
3883 static HRESULT WINAPI
HTMLDocument7_normalize(IHTMLDocument7
*iface
)
3885 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3886 FIXME("(%p)\n", This
);
3890 static HRESULT WINAPI
HTMLDocument7_importNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
,
3891 VARIANT_BOOL fDeep
, IHTMLDOMNode3
**ppNodeDest
)
3893 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3894 FIXME("(%p)->(%p %x %p)\n", This
, pNodeSource
, fDeep
, ppNodeDest
);
3898 static HRESULT WINAPI
HTMLDocument7_get_parentWindow(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
3900 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3901 FIXME("(%p)->(%p)\n", This
, p
);
3905 static HRESULT WINAPI
HTMLDocument7_put_body(IHTMLDocument7
*iface
, IHTMLElement
*v
)
3907 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3908 FIXME("(%p)->(%p)\n", This
, v
);
3912 static HRESULT WINAPI
HTMLDocument7_get_body(IHTMLDocument7
*iface
, IHTMLElement
**p
)
3914 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3915 FIXME("(%p)->(%p)\n", This
, p
);
3919 static HRESULT WINAPI
HTMLDocument7_get_head(IHTMLDocument7
*iface
, IHTMLElement
**p
)
3921 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3922 FIXME("(%p)->(%p)\n", This
, p
);
3926 static const IHTMLDocument7Vtbl HTMLDocument7Vtbl
= {
3927 HTMLDocument7_QueryInterface
,
3928 HTMLDocument7_AddRef
,
3929 HTMLDocument7_Release
,
3930 HTMLDocument7_GetTypeInfoCount
,
3931 HTMLDocument7_GetTypeInfo
,
3932 HTMLDocument7_GetIDsOfNames
,
3933 HTMLDocument7_Invoke
,
3934 HTMLDocument7_get_defaultView
,
3935 HTMLDocument7_createCDATASection
,
3936 HTMLDocument7_getSelection
,
3937 HTMLDocument7_getElementsByTagNameNS
,
3938 HTMLDocument7_createElementNS
,
3939 HTMLDocument7_createAttributeNS
,
3940 HTMLDocument7_put_onmsthumbnailclick
,
3941 HTMLDocument7_get_onmsthumbnailclick
,
3942 HTMLDocument7_get_characterSet
,
3943 HTMLDocument7_createElement
,
3944 HTMLDocument7_createAttribute
,
3945 HTMLDocument7_getElementByClassName
,
3946 HTMLDocument7_createProcessingInstruction
,
3947 HTMLDocument7_adoptNode
,
3948 HTMLDocument7_put_onmssitemodejumplistitemremoved
,
3949 HTMLDocument7_get_onmssitemodejumplistitemremoved
,
3950 HTMLDocument7_get_all
,
3951 HTMLDocument7_get_inputEncoding
,
3952 HTMLDocument7_get_xmlEncoding
,
3953 HTMLDocument7_put_xmlStandalone
,
3954 HTMLDocument7_get_xmlStandalone
,
3955 HTMLDocument7_put_xmlVersion
,
3956 HTMLDocument7_get_xmlVersion
,
3957 HTMLDocument7_hasAttributes
,
3958 HTMLDocument7_put_onabort
,
3959 HTMLDocument7_get_onabort
,
3960 HTMLDocument7_put_onblur
,
3961 HTMLDocument7_get_onblur
,
3962 HTMLDocument7_put_oncanplay
,
3963 HTMLDocument7_get_oncanplay
,
3964 HTMLDocument7_put_oncanplaythrough
,
3965 HTMLDocument7_get_oncanplaythrough
,
3966 HTMLDocument7_put_onchange
,
3967 HTMLDocument7_get_onchange
,
3968 HTMLDocument7_put_ondrag
,
3969 HTMLDocument7_get_ondrag
,
3970 HTMLDocument7_put_ondragend
,
3971 HTMLDocument7_get_ondragend
,
3972 HTMLDocument7_put_ondragenter
,
3973 HTMLDocument7_get_ondragenter
,
3974 HTMLDocument7_put_ondragleave
,
3975 HTMLDocument7_get_ondragleave
,
3976 HTMLDocument7_put_ondragover
,
3977 HTMLDocument7_get_ondragover
,
3978 HTMLDocument7_put_ondrop
,
3979 HTMLDocument7_get_ondrop
,
3980 HTMLDocument7_put_ondurationchange
,
3981 HTMLDocument7_get_ondurationchange
,
3982 HTMLDocument7_put_onemptied
,
3983 HTMLDocument7_get_onemptied
,
3984 HTMLDocument7_put_onended
,
3985 HTMLDocument7_get_onended
,
3986 HTMLDocument7_put_onerror
,
3987 HTMLDocument7_get_onerror
,
3988 HTMLDocument7_put_onfocus
,
3989 HTMLDocument7_get_onfocus
,
3990 HTMLDocument7_put_oninput
,
3991 HTMLDocument7_get_oninput
,
3992 HTMLDocument7_put_onload
,
3993 HTMLDocument7_get_onload
,
3994 HTMLDocument7_put_onloadeddata
,
3995 HTMLDocument7_get_onloadeddata
,
3996 HTMLDocument7_put_onloadedmetadata
,
3997 HTMLDocument7_get_onloadedmetadata
,
3998 HTMLDocument7_put_onloadstart
,
3999 HTMLDocument7_get_onloadstart
,
4000 HTMLDocument7_put_onpause
,
4001 HTMLDocument7_get_onpause
,
4002 HTMLDocument7_put_onplay
,
4003 HTMLDocument7_get_onplay
,
4004 HTMLDocument7_put_onplaying
,
4005 HTMLDocument7_get_onplaying
,
4006 HTMLDocument7_put_onprogress
,
4007 HTMLDocument7_get_onprogress
,
4008 HTMLDocument7_put_onratechange
,
4009 HTMLDocument7_get_onratechange
,
4010 HTMLDocument7_put_onreset
,
4011 HTMLDocument7_get_onreset
,
4012 HTMLDocument7_put_onscroll
,
4013 HTMLDocument7_get_onscroll
,
4014 HTMLDocument7_put_onseekend
,
4015 HTMLDocument7_get_onseekend
,
4016 HTMLDocument7_put_onseeking
,
4017 HTMLDocument7_get_onseeking
,
4018 HTMLDocument7_put_onselect
,
4019 HTMLDocument7_get_onselect
,
4020 HTMLDocument7_put_onstalled
,
4021 HTMLDocument7_get_onstalled
,
4022 HTMLDocument7_put_onsubmit
,
4023 HTMLDocument7_get_onsubmit
,
4024 HTMLDocument7_put_onsuspend
,
4025 HTMLDocument7_get_onsuspend
,
4026 HTMLDocument7_put_ontimeupdate
,
4027 HTMLDocument7_get_ontimeupdate
,
4028 HTMLDocument7_put_onvolumechange
,
4029 HTMLDocument7_get_onvolumechange
,
4030 HTMLDocument7_put_onwaiting
,
4031 HTMLDocument7_get_onwaiting
,
4032 HTMLDocument7_normalize
,
4033 HTMLDocument7_importNode
,
4034 HTMLDocument7_get_parentWindow
,
4035 HTMLDocument7_put_body
,
4036 HTMLDocument7_get_body
,
4037 HTMLDocument7_get_head
4040 static inline HTMLDocument
*impl_from_IDocumentSelector(IDocumentSelector
*iface
)
4042 return CONTAINING_RECORD(iface
, HTMLDocument
, IDocumentSelector_iface
);
4045 static HRESULT WINAPI
DocumentSelector_QueryInterface(IDocumentSelector
*iface
, REFIID riid
, void **ppv
)
4047 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4048 return htmldoc_query_interface(This
, riid
, ppv
);
4051 static ULONG WINAPI
DocumentSelector_AddRef(IDocumentSelector
*iface
)
4053 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4054 return htmldoc_addref(This
);
4057 static ULONG WINAPI
DocumentSelector_Release(IDocumentSelector
*iface
)
4059 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4060 return htmldoc_release(This
);
4063 static HRESULT WINAPI
DocumentSelector_GetTypeInfoCount(IDocumentSelector
*iface
, UINT
*pctinfo
)
4065 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4066 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
4069 static HRESULT WINAPI
DocumentSelector_GetTypeInfo(IDocumentSelector
*iface
, UINT iTInfo
,
4070 LCID lcid
, ITypeInfo
**ppTInfo
)
4072 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4073 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4076 static HRESULT WINAPI
DocumentSelector_GetIDsOfNames(IDocumentSelector
*iface
, REFIID riid
,
4077 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4079 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4080 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
4084 static HRESULT WINAPI
DocumentSelector_Invoke(IDocumentSelector
*iface
, DISPID dispIdMember
, REFIID riid
,
4085 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4087 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4088 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
4089 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4092 static HRESULT WINAPI
DocumentSelector_querySelector(IDocumentSelector
*iface
, BSTR v
, IHTMLElement
**pel
)
4094 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4095 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4099 static HRESULT WINAPI
DocumentSelector_querySelectorAll(IDocumentSelector
*iface
, BSTR v
, IHTMLDOMChildrenCollection
**pel
)
4101 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4102 nsIDOMNodeList
*node_list
;
4106 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4108 nsAString_InitDepend(&nsstr
, v
);
4109 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->doc_node
->nsdoc
, &nsstr
, &node_list
);
4110 nsAString_Finish(&nsstr
);
4111 if(NS_FAILED(nsres
)) {
4112 ERR("QuerySelectorAll failed: %08x\n", nsres
);
4116 *pel
= create_child_collection(This
->doc_node
, node_list
);
4117 nsIDOMNodeList_Release(node_list
);
4118 return *pel
? S_OK
: E_OUTOFMEMORY
;
4121 static const IDocumentSelectorVtbl DocumentSelectorVtbl
= {
4122 DocumentSelector_QueryInterface
,
4123 DocumentSelector_AddRef
,
4124 DocumentSelector_Release
,
4125 DocumentSelector_GetTypeInfoCount
,
4126 DocumentSelector_GetTypeInfo
,
4127 DocumentSelector_GetIDsOfNames
,
4128 DocumentSelector_Invoke
,
4129 DocumentSelector_querySelector
,
4130 DocumentSelector_querySelectorAll
4133 static void HTMLDocument_on_advise(IUnknown
*iface
, cp_static_data_t
*cp
)
4135 HTMLDocument
*This
= impl_from_IHTMLDocument2((IHTMLDocument2
*)iface
);
4138 update_doc_cp_events(This
->doc_node
, cp
);
4141 static inline HTMLDocument
*impl_from_ISupportErrorInfo(ISupportErrorInfo
*iface
)
4143 return CONTAINING_RECORD(iface
, HTMLDocument
, ISupportErrorInfo_iface
);
4146 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
4148 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4149 return htmldoc_query_interface(This
, riid
, ppv
);
4152 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
4154 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4155 return htmldoc_addref(This
);
4158 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
4160 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4161 return htmldoc_release(This
);
4164 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
4166 FIXME("(%p)->(%s)\n", iface
, debugstr_mshtml_guid(riid
));
4170 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
4171 SupportErrorInfo_QueryInterface
,
4172 SupportErrorInfo_AddRef
,
4173 SupportErrorInfo_Release
,
4174 SupportErrorInfo_InterfaceSupportsErrorInfo
4177 static inline HTMLDocument
*impl_from_IDispatchEx(IDispatchEx
*iface
)
4179 return CONTAINING_RECORD(iface
, HTMLDocument
, IDispatchEx_iface
);
4182 static HRESULT
dispid_from_elem_name(HTMLDocumentNode
*This
, BSTR name
, DISPID
*dispid
)
4184 nsIDOMNodeList
*node_list
;
4191 return DISP_E_UNKNOWNNAME
;
4193 nsAString_InitDepend(&name_str
, name
);
4194 nsres
= nsIDOMHTMLDocument_GetElementsByName(This
->nsdoc
, &name_str
, &node_list
);
4195 nsAString_Finish(&name_str
);
4196 if(NS_FAILED(nsres
))
4199 nsres
= nsIDOMNodeList_GetLength(node_list
, &len
);
4200 nsIDOMNodeList_Release(node_list
);
4201 if(NS_FAILED(nsres
))
4205 return DISP_E_UNKNOWNNAME
;
4207 for(i
=0; i
< This
->elem_vars_cnt
; i
++) {
4208 if(!strcmpW(name
, This
->elem_vars
[i
])) {
4209 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
4214 if(This
->elem_vars_cnt
== This
->elem_vars_size
) {
4217 if(This
->elem_vars_size
) {
4218 new_vars
= heap_realloc(This
->elem_vars
, This
->elem_vars_size
*2*sizeof(WCHAR
*));
4220 return E_OUTOFMEMORY
;
4221 This
->elem_vars_size
*= 2;
4223 new_vars
= heap_alloc(16*sizeof(WCHAR
*));
4225 return E_OUTOFMEMORY
;
4226 This
->elem_vars_size
= 16;
4229 This
->elem_vars
= new_vars
;
4232 This
->elem_vars
[This
->elem_vars_cnt
] = heap_strdupW(name
);
4233 if(!This
->elem_vars
[This
->elem_vars_cnt
])
4234 return E_OUTOFMEMORY
;
4236 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+This
->elem_vars_cnt
++;
4240 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
4242 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4244 return htmldoc_query_interface(This
, riid
, ppv
);
4247 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
4249 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4251 return htmldoc_addref(This
);
4254 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
4256 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4258 return htmldoc_release(This
);
4261 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
4263 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4265 return IDispatchEx_GetTypeInfoCount(This
->dispex
, pctinfo
);
4268 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
4269 LCID lcid
, ITypeInfo
**ppTInfo
)
4271 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4273 return IDispatchEx_GetTypeInfo(This
->dispex
, iTInfo
, lcid
, ppTInfo
);
4276 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
4277 LPOLESTR
*rgszNames
, UINT cNames
,
4278 LCID lcid
, DISPID
*rgDispId
)
4280 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4282 return IDispatchEx_GetIDsOfNames(This
->dispex
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
4285 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
4286 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4287 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4289 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4291 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
4292 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4294 switch(dispIdMember
) {
4295 case DISPID_READYSTATE
:
4296 TRACE("DISPID_READYSTATE\n");
4298 if(!(wFlags
& DISPATCH_PROPERTYGET
))
4299 return E_INVALIDARG
;
4301 V_VT(pVarResult
) = VT_I4
;
4302 V_I4(pVarResult
) = This
->window
->readystate
;
4306 return IDispatchEx_Invoke(This
->dispex
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
4307 pVarResult
, pExcepInfo
, puArgErr
);
4310 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
4312 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4315 hres
= IDispatchEx_GetDispID(This
->dispex
, bstrName
, grfdex
, pid
);
4316 if(hres
!= DISP_E_UNKNOWNNAME
)
4319 return dispid_from_elem_name(This
->doc_node
, bstrName
, pid
);
4322 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
4323 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
4325 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4327 if(This
->window
&& id
== DISPID_IHTMLDOCUMENT2_LOCATION
&& (wFlags
& DISPATCH_PROPERTYPUT
))
4328 return IDispatchEx_InvokeEx(&This
->window
->base
.IDispatchEx_iface
, DISPID_IHTMLWINDOW2_LOCATION
,
4329 lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
4332 return IDispatchEx_InvokeEx(This
->dispex
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
4335 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
4337 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4339 return IDispatchEx_DeleteMemberByName(This
->dispex
, bstrName
, grfdex
);
4342 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
4344 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4346 return IDispatchEx_DeleteMemberByDispID(This
->dispex
, id
);
4349 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
4351 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4353 return IDispatchEx_GetMemberProperties(This
->dispex
, id
, grfdexFetch
, pgrfdex
);
4356 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
4358 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4360 return IDispatchEx_GetMemberName(This
->dispex
, id
, pbstrName
);
4363 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
4365 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4367 return IDispatchEx_GetNextDispID(This
->dispex
, grfdex
, id
, pid
);
4370 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
4372 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4374 return IDispatchEx_GetNameSpaceParent(This
->dispex
, ppunk
);
4377 static const IDispatchExVtbl DocDispatchExVtbl
= {
4378 DocDispatchEx_QueryInterface
,
4379 DocDispatchEx_AddRef
,
4380 DocDispatchEx_Release
,
4381 DocDispatchEx_GetTypeInfoCount
,
4382 DocDispatchEx_GetTypeInfo
,
4383 DocDispatchEx_GetIDsOfNames
,
4384 DocDispatchEx_Invoke
,
4385 DocDispatchEx_GetDispID
,
4386 DocDispatchEx_InvokeEx
,
4387 DocDispatchEx_DeleteMemberByName
,
4388 DocDispatchEx_DeleteMemberByDispID
,
4389 DocDispatchEx_GetMemberProperties
,
4390 DocDispatchEx_GetMemberName
,
4391 DocDispatchEx_GetNextDispID
,
4392 DocDispatchEx_GetNameSpaceParent
4395 static inline HTMLDocument
*impl_from_IProvideClassInfo(IProvideClassInfo
*iface
)
4397 return CONTAINING_RECORD(iface
, HTMLDocument
, IProvideClassInfo_iface
);
4400 static HRESULT WINAPI
ProvideClassInfo_QueryInterface(IProvideClassInfo
*iface
,
4401 REFIID riid
, void **ppv
)
4403 HTMLDocument
*This
= impl_from_IProvideClassInfo(iface
);
4404 return htmldoc_query_interface(This
, riid
, ppv
);
4407 static ULONG WINAPI
ProvideClassInfo_AddRef(IProvideClassInfo
*iface
)
4409 HTMLDocument
*This
= impl_from_IProvideClassInfo(iface
);
4410 return htmldoc_addref(This
);
4413 static ULONG WINAPI
ProvideClassInfo_Release(IProvideClassInfo
*iface
)
4415 HTMLDocument
*This
= impl_from_IProvideClassInfo(iface
);
4416 return htmldoc_release(This
);
4419 static HRESULT WINAPI
ProvideClassInfo_GetClassInfo(IProvideClassInfo
* iface
,
4422 HTMLDocument
*This
= impl_from_IProvideClassInfo(iface
);
4423 TRACE("(%p)->(%p)\n", This
, ppTI
);
4424 return get_htmldoc_classinfo(ppTI
);
4427 static const IProvideClassInfoVtbl ProvideClassInfoVtbl
= {
4428 ProvideClassInfo_QueryInterface
,
4429 ProvideClassInfo_AddRef
,
4430 ProvideClassInfo_Release
,
4431 ProvideClassInfo_GetClassInfo
4434 static BOOL
htmldoc_qi(HTMLDocument
*This
, REFIID riid
, void **ppv
)
4438 if(IsEqualGUID(&IID_IUnknown
, riid
))
4439 *ppv
= &This
->IHTMLDocument2_iface
;
4440 else if(IsEqualGUID(&IID_IDispatch
, riid
))
4441 *ppv
= &This
->IDispatchEx_iface
;
4442 else if(IsEqualGUID(&IID_IDispatchEx
, riid
))
4443 *ppv
= &This
->IDispatchEx_iface
;
4444 else if(IsEqualGUID(&IID_IHTMLDocument
, riid
))
4445 *ppv
= &This
->IHTMLDocument2_iface
;
4446 else if(IsEqualGUID(&IID_IHTMLDocument2
, riid
))
4447 *ppv
= &This
->IHTMLDocument2_iface
;
4448 else if(IsEqualGUID(&IID_IHTMLDocument3
, riid
))
4449 *ppv
= &This
->IHTMLDocument3_iface
;
4450 else if(IsEqualGUID(&IID_IHTMLDocument4
, riid
))
4451 *ppv
= &This
->IHTMLDocument4_iface
;
4452 else if(IsEqualGUID(&IID_IHTMLDocument5
, riid
))
4453 *ppv
= &This
->IHTMLDocument5_iface
;
4454 else if(IsEqualGUID(&IID_IHTMLDocument6
, riid
))
4455 *ppv
= &This
->IHTMLDocument6_iface
;
4456 else if(IsEqualGUID(&IID_IHTMLDocument7
, riid
))
4457 *ppv
= &This
->IHTMLDocument7_iface
;
4458 else if(IsEqualGUID(&IID_IDocumentSelector
, riid
))
4459 *ppv
= &This
->IDocumentSelector_iface
;
4460 else if(IsEqualGUID(&IID_IPersist
, riid
))
4461 *ppv
= &This
->IPersistFile_iface
;
4462 else if(IsEqualGUID(&IID_IPersistMoniker
, riid
))
4463 *ppv
= &This
->IPersistMoniker_iface
;
4464 else if(IsEqualGUID(&IID_IPersistFile
, riid
))
4465 *ppv
= &This
->IPersistFile_iface
;
4466 else if(IsEqualGUID(&IID_IMonikerProp
, riid
))
4467 *ppv
= &This
->IMonikerProp_iface
;
4468 else if(IsEqualGUID(&IID_IOleObject
, riid
))
4469 *ppv
= &This
->IOleObject_iface
;
4470 else if(IsEqualGUID(&IID_IOleDocument
, riid
))
4471 *ppv
= &This
->IOleDocument_iface
;
4472 else if(IsEqualGUID(&IID_IOleDocumentView
, riid
))
4473 *ppv
= &This
->IOleDocumentView_iface
;
4474 else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
))
4475 *ppv
= &This
->IOleInPlaceActiveObject_iface
;
4476 else if(IsEqualGUID(&IID_IViewObject
, riid
))
4477 *ppv
= &This
->IViewObjectEx_iface
;
4478 else if(IsEqualGUID(&IID_IViewObject2
, riid
))
4479 *ppv
= &This
->IViewObjectEx_iface
;
4480 else if(IsEqualGUID(&IID_IViewObjectEx
, riid
))
4481 *ppv
= &This
->IViewObjectEx_iface
;
4482 else if(IsEqualGUID(&IID_IOleWindow
, riid
))
4483 *ppv
= &This
->IOleInPlaceActiveObject_iface
;
4484 else if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
))
4485 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
4486 else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
))
4487 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
4488 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
4489 *ppv
= &This
->IServiceProvider_iface
;
4490 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
4491 *ppv
= &This
->IOleCommandTarget_iface
;
4492 else if(IsEqualGUID(&IID_IOleControl
, riid
))
4493 *ppv
= &This
->IOleControl_iface
;
4494 else if(IsEqualGUID(&IID_IHlinkTarget
, riid
))
4495 *ppv
= &This
->IHlinkTarget_iface
;
4496 else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
))
4497 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
4498 else if(IsEqualGUID(&IID_IPersistStreamInit
, riid
))
4499 *ppv
= &This
->IPersistStreamInit_iface
;
4500 else if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
))
4501 *ppv
= &This
->IHTMLDocument2_iface
;
4502 else if(IsEqualGUID(&IID_ISupportErrorInfo
, riid
))
4503 *ppv
= &This
->ISupportErrorInfo_iface
;
4504 else if(IsEqualGUID(&IID_IPersistHistory
, riid
))
4505 *ppv
= &This
->IPersistHistory_iface
;
4506 else if(IsEqualGUID(&IID_IObjectWithSite
, riid
))
4507 *ppv
= &This
->IObjectWithSite_iface
;
4508 else if(IsEqualGUID(&IID_IOleContainer
, riid
))
4509 *ppv
= &This
->IOleContainer_iface
;
4510 else if(IsEqualGUID(&IID_IObjectSafety
, riid
))
4511 *ppv
= &This
->IObjectSafety_iface
;
4512 else if(IsEqualGUID(&IID_IProvideClassInfo
, riid
))
4513 *ppv
= &This
->IProvideClassInfo_iface
;
4514 else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
4515 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppv
);
4517 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
4518 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppv
);
4520 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
4521 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppv
);
4523 }else if(IsEqualGUID(&IID_IMarshal
, riid
)) {
4524 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This
, ppv
);
4526 }else if(IsEqualGUID(&IID_IExternalConnection
, riid
)) {
4527 TRACE("(%p)->(IID_IExternalConnection %p) returning NULL\n", This
, ppv
);
4529 }else if(IsEqualGUID(&IID_IStdMarshalInfo
, riid
)) {
4530 TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This
, ppv
);
4537 IUnknown_AddRef((IUnknown
*)*ppv
);
4541 static cp_static_data_t HTMLDocumentEvents_data
= { HTMLDocumentEvents_tid
, HTMLDocument_on_advise
};
4543 static const cpc_entry_t HTMLDocument_cpc
[] = {
4544 {&IID_IDispatch
, &HTMLDocumentEvents_data
},
4545 {&IID_IPropertyNotifySink
},
4546 {&DIID_HTMLDocumentEvents
, &HTMLDocumentEvents_data
},
4547 {&DIID_HTMLDocumentEvents2
},
4551 static void init_doc(HTMLDocument
*doc
, IUnknown
*unk_impl
, IDispatchEx
*dispex
)
4553 doc
->IHTMLDocument2_iface
.lpVtbl
= &HTMLDocumentVtbl
;
4554 doc
->IHTMLDocument3_iface
.lpVtbl
= &HTMLDocument3Vtbl
;
4555 doc
->IHTMLDocument4_iface
.lpVtbl
= &HTMLDocument4Vtbl
;
4556 doc
->IHTMLDocument5_iface
.lpVtbl
= &HTMLDocument5Vtbl
;
4557 doc
->IHTMLDocument6_iface
.lpVtbl
= &HTMLDocument6Vtbl
;
4558 doc
->IHTMLDocument7_iface
.lpVtbl
= &HTMLDocument7Vtbl
;
4559 doc
->IDispatchEx_iface
.lpVtbl
= &DocDispatchExVtbl
;
4560 doc
->IDocumentSelector_iface
.lpVtbl
= &DocumentSelectorVtbl
;
4561 doc
->ISupportErrorInfo_iface
.lpVtbl
= &SupportErrorInfoVtbl
;
4562 doc
->IProvideClassInfo_iface
.lpVtbl
= &ProvideClassInfoVtbl
;
4564 doc
->unk_impl
= unk_impl
;
4565 doc
->dispex
= dispex
;
4566 doc
->task_magic
= get_task_target_magic();
4568 HTMLDocument_Persist_Init(doc
);
4569 HTMLDocument_OleCmd_Init(doc
);
4570 HTMLDocument_OleObj_Init(doc
);
4571 HTMLDocument_View_Init(doc
);
4572 HTMLDocument_Window_Init(doc
);
4573 HTMLDocument_Service_Init(doc
);
4574 HTMLDocument_Hlink_Init(doc
);
4576 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)&doc
->IHTMLDocument2_iface
, HTMLDocument_cpc
);
4579 static void destroy_htmldoc(HTMLDocument
*This
)
4581 remove_target_tasks(This
->task_magic
);
4583 ConnectionPointContainer_Destroy(&This
->cp_container
);
4586 static inline HTMLDocumentNode
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
4588 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
);
4591 static HRESULT
HTMLDocumentNode_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
4593 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4595 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4597 if(htmldoc_qi(&This
->basedoc
, riid
, ppv
))
4598 return *ppv
? S_OK
: E_NOINTERFACE
;
4600 if(IsEqualGUID(&IID_IInternetHostSecurityManager
, riid
))
4601 *ppv
= &This
->IInternetHostSecurityManager_iface
;
4603 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
4605 IUnknown_AddRef((IUnknown
*)*ppv
);
4609 static void HTMLDocumentNode_destructor(HTMLDOMNode
*iface
)
4611 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4614 for(i
=0; i
< This
->elem_vars_cnt
; i
++)
4615 heap_free(This
->elem_vars
[i
]);
4616 heap_free(This
->elem_vars
);
4618 detach_events(This
);
4619 if(This
->body_event_target
)
4620 release_event_target(This
->body_event_target
);
4622 ICatInformation_Release(This
->catmgr
);
4624 detach_selection(This
);
4625 detach_ranges(This
);
4627 while(!list_empty(&This
->plugin_hosts
))
4628 detach_plugin_host(LIST_ENTRY(list_head(&This
->plugin_hosts
), PluginHost
, entry
));
4630 if(!This
->nsdoc
&& This
->window
) {
4631 /* document fragments own reference to inner window */
4632 IHTMLWindow2_Release(&This
->window
->base
.IHTMLWindow2_iface
);
4633 This
->window
= NULL
;
4636 heap_free(This
->event_vector
);
4637 destroy_htmldoc(&This
->basedoc
);
4640 static HRESULT
HTMLDocumentNode_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
4642 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4643 FIXME("%p\n", This
);
4647 static void HTMLDocumentNode_traverse(HTMLDOMNode
*iface
, nsCycleCollectionTraversalCallback
*cb
)
4649 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4652 note_cc_edge((nsISupports
*)This
->nsdoc
, "This->nsdoc", cb
);
4655 static void HTMLDocumentNode_unlink(HTMLDOMNode
*iface
)
4657 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4660 nsIDOMHTMLDocument
*nsdoc
= This
->nsdoc
;
4662 release_document_mutation(This
);
4664 nsIDOMHTMLDocument_Release(nsdoc
);
4665 This
->window
= NULL
;
4669 static const NodeImplVtbl HTMLDocumentNodeImplVtbl
= {
4670 HTMLDocumentNode_QI
,
4671 HTMLDocumentNode_destructor
,
4673 HTMLDocumentNode_clone
,
4685 HTMLDocumentNode_traverse
,
4686 HTMLDocumentNode_unlink
4689 static HRESULT
HTMLDocumentFragment_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
4691 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
4692 HTMLDocumentNode
*new_node
;
4695 hres
= create_document_fragment(nsnode
, This
->node
.doc
, &new_node
);
4699 *ret
= &new_node
->node
;
4703 static inline HTMLDocumentNode
*impl_from_DispatchEx(DispatchEx
*iface
)
4705 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
.event_target
.dispex
);
4708 static HRESULT
HTMLDocumentNode_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
4709 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
4711 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
4712 nsIDOMNodeList
*node_list
;
4720 if(flags
!= DISPATCH_PROPERTYGET
&& flags
!= (DISPATCH_METHOD
|DISPATCH_PROPERTYGET
)) {
4721 FIXME("unsupported flags %x\n", flags
);
4725 i
= id
- MSHTML_DISPID_CUSTOM_MIN
;
4727 if(!This
->nsdoc
|| i
>= This
->elem_vars_cnt
)
4728 return DISP_E_UNKNOWNNAME
;
4730 nsAString_InitDepend(&name_str
, This
->elem_vars
[i
]);
4731 nsres
= nsIDOMHTMLDocument_GetElementsByName(This
->nsdoc
, &name_str
, &node_list
);
4732 nsAString_Finish(&name_str
);
4733 if(NS_FAILED(nsres
))
4736 nsres
= nsIDOMNodeList_Item(node_list
, 0, &nsnode
);
4737 nsIDOMNodeList_Release(node_list
);
4738 if(NS_FAILED(nsres
) || !nsnode
)
4739 return DISP_E_UNKNOWNNAME
;
4741 hres
= get_node(This
, nsnode
, TRUE
, &node
);
4745 V_VT(res
) = VT_DISPATCH
;
4746 V_DISPATCH(res
) = (IDispatch
*)&node
->IHTMLDOMNode_iface
;
4750 static void HTMLDocumentNode_bind_event(DispatchEx
*dispex
, int eid
)
4752 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
4753 ensure_doc_nsevent_handler(This
, eid
);
4756 static const dispex_static_data_vtbl_t HTMLDocumentNode_dispex_vtbl
= {
4759 HTMLDocumentNode_invoke
,
4762 HTMLDocumentNode_bind_event
4765 static const NodeImplVtbl HTMLDocumentFragmentImplVtbl
= {
4766 HTMLDocumentNode_QI
,
4767 HTMLDocumentNode_destructor
,
4769 HTMLDocumentFragment_clone
4772 static const tid_t HTMLDocumentNode_iface_tids
[] = {
4780 IDocumentSelector_tid
,
4784 static dispex_static_data_t HTMLDocumentNode_dispex
= {
4785 &HTMLDocumentNode_dispex_vtbl
,
4786 DispHTMLDocument_tid
,
4787 HTMLDocumentNode_iface_tids
4790 static HTMLDocumentNode
*alloc_doc_node(HTMLDocumentObj
*doc_obj
, HTMLInnerWindow
*window
)
4792 HTMLDocumentNode
*doc
;
4794 doc
= heap_alloc_zero(sizeof(HTMLDocumentNode
));
4799 doc
->basedoc
.doc_node
= doc
;
4800 doc
->basedoc
.doc_obj
= doc_obj
;
4801 doc
->basedoc
.window
= window
->base
.outer_window
;
4802 doc
->window
= window
;
4804 init_dispex(&doc
->node
.event_target
.dispex
, (IUnknown
*)&doc
->node
.IHTMLDOMNode_iface
,
4805 &HTMLDocumentNode_dispex
);
4806 init_doc(&doc
->basedoc
, (IUnknown
*)&doc
->node
.IHTMLDOMNode_iface
,
4807 &doc
->node
.event_target
.dispex
.IDispatchEx_iface
);
4808 HTMLDocumentNode_SecMgr_Init(doc
);
4810 list_init(&doc
->selection_list
);
4811 list_init(&doc
->range_list
);
4812 list_init(&doc
->plugin_hosts
);
4817 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*nsdoc
, HTMLDocumentObj
*doc_obj
, HTMLInnerWindow
*window
, HTMLDocumentNode
**ret
)
4819 HTMLDocumentNode
*doc
;
4821 doc
= alloc_doc_node(doc_obj
, window
);
4823 return E_OUTOFMEMORY
;
4825 if(!doc_obj
->basedoc
.window
|| window
->base
.outer_window
== doc_obj
->basedoc
.window
)
4826 doc
->basedoc
.cp_container
.forward_container
= &doc_obj
->basedoc
.cp_container
;
4828 HTMLDOMNode_Init(doc
, &doc
->node
, (nsIDOMNode
*)nsdoc
);
4830 nsIDOMHTMLDocument_AddRef(nsdoc
);
4833 init_document_mutation(doc
);
4834 doc_init_events(doc
);
4836 doc
->node
.vtbl
= &HTMLDocumentNodeImplVtbl
;
4837 doc
->node
.cp_container
= &doc
->basedoc
.cp_container
;
4843 static HRESULT
create_document_fragment(nsIDOMNode
*nsnode
, HTMLDocumentNode
*doc_node
, HTMLDocumentNode
**ret
)
4845 HTMLDocumentNode
*doc_frag
;
4847 doc_frag
= alloc_doc_node(doc_node
->basedoc
.doc_obj
, doc_node
->window
);
4849 return E_OUTOFMEMORY
;
4851 IHTMLWindow2_AddRef(&doc_frag
->window
->base
.IHTMLWindow2_iface
);
4853 HTMLDOMNode_Init(doc_node
, &doc_frag
->node
, nsnode
);
4854 doc_frag
->node
.vtbl
= &HTMLDocumentFragmentImplVtbl
;
4855 doc_frag
->node
.cp_container
= &doc_frag
->basedoc
.cp_container
;
4861 /**********************************************************
4862 * ICustomDoc implementation
4865 static inline HTMLDocumentObj
*impl_from_ICustomDoc(ICustomDoc
*iface
)
4867 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, ICustomDoc_iface
);
4870 static HRESULT WINAPI
CustomDoc_QueryInterface(ICustomDoc
*iface
, REFIID riid
, void **ppv
)
4872 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
4874 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
4876 if(htmldoc_qi(&This
->basedoc
, riid
, ppv
))
4877 return *ppv
? S_OK
: E_NOINTERFACE
;
4879 if(IsEqualGUID(&IID_ICustomDoc
, riid
)) {
4880 *ppv
= &This
->ICustomDoc_iface
;
4881 }else if(IsEqualGUID(&IID_ITargetContainer
, riid
)) {
4882 *ppv
= &This
->ITargetContainer_iface
;
4883 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
4884 return *ppv
? S_OK
: E_NOINTERFACE
;
4886 FIXME("Unimplemented interface %s\n", debugstr_mshtml_guid(riid
));
4888 return E_NOINTERFACE
;
4891 IUnknown_AddRef((IUnknown
*)*ppv
);
4895 static ULONG WINAPI
CustomDoc_AddRef(ICustomDoc
*iface
)
4897 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
4898 ULONG ref
= InterlockedIncrement(&This
->ref
);
4900 TRACE("(%p) ref = %u\n", This
, ref
);
4905 static ULONG WINAPI
CustomDoc_Release(ICustomDoc
*iface
)
4907 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
4908 ULONG ref
= InterlockedDecrement(&This
->ref
);
4910 TRACE("(%p) ref = %u\n", This
, ref
);
4913 nsIDOMWindowUtils
*window_utils
= NULL
;
4915 if(This
->basedoc
.window
&& This
->basedoc
.window
->nswindow
)
4916 get_nsinterface((nsISupports
*)This
->basedoc
.window
->nswindow
, &IID_nsIDOMWindowUtils
, (void**)&window_utils
);
4918 if(This
->basedoc
.doc_node
) {
4919 This
->basedoc
.doc_node
->basedoc
.doc_obj
= NULL
;
4920 htmldoc_release(&This
->basedoc
.doc_node
->basedoc
);
4922 if(This
->basedoc
.window
) {
4923 This
->basedoc
.window
->doc_obj
= NULL
;
4924 IHTMLWindow2_Release(&This
->basedoc
.window
->base
.IHTMLWindow2_iface
);
4926 if(This
->basedoc
.advise_holder
)
4927 IOleAdviseHolder_Release(This
->basedoc
.advise_holder
);
4930 IAdviseSink_Release(This
->view_sink
);
4932 IOleObject_SetClientSite(&This
->basedoc
.IOleObject_iface
, NULL
);
4934 ICustomDoc_SetUIHandler(&This
->ICustomDoc_iface
, NULL
);
4935 if(This
->in_place_active
)
4936 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->basedoc
.IOleInPlaceObjectWindowless_iface
);
4938 IOleDocumentView_SetInPlaceSite(&This
->basedoc
.IOleDocumentView_iface
, NULL
);
4940 IOleUndoManager_Release(This
->undomgr
);
4942 IHTMLEditServices_Release(This
->editsvcs
);
4943 if(This
->tooltips_hwnd
)
4944 DestroyWindow(This
->tooltips_hwnd
);
4947 DestroyWindow(This
->hwnd
);
4948 heap_free(This
->mime
);
4950 destroy_htmldoc(&This
->basedoc
);
4951 release_dispex(&This
->dispex
);
4953 if(This
->nscontainer
)
4954 NSContainer_Release(This
->nscontainer
);
4957 /* Force cycle collection */
4959 nsIDOMWindowUtils_CycleCollect(window_utils
, NULL
, 0);
4960 nsIDOMWindowUtils_Release(window_utils
);
4967 static HRESULT WINAPI
CustomDoc_SetUIHandler(ICustomDoc
*iface
, IDocHostUIHandler
*pUIHandler
)
4969 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
4970 IOleCommandTarget
*cmdtrg
;
4973 TRACE("(%p)->(%p)\n", This
, pUIHandler
);
4975 if(This
->custom_hostui
&& This
->hostui
== pUIHandler
)
4978 This
->custom_hostui
= TRUE
;
4981 IDocHostUIHandler_Release(This
->hostui
);
4983 IDocHostUIHandler_AddRef(pUIHandler
);
4984 This
->hostui
= pUIHandler
;
4988 hres
= IDocHostUIHandler_QueryInterface(pUIHandler
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
4989 if(SUCCEEDED(hres
)) {
4990 FIXME("custom UI handler supports IOleCommandTarget\n");
4991 IOleCommandTarget_Release(cmdtrg
);
4997 static const ICustomDocVtbl CustomDocVtbl
= {
4998 CustomDoc_QueryInterface
,
5001 CustomDoc_SetUIHandler
5004 static const tid_t HTMLDocumentObj_iface_tids
[] = {
5011 static dispex_static_data_t HTMLDocumentObj_dispex
= {
5013 DispHTMLDocument_tid
,
5014 HTMLDocumentObj_iface_tids
5017 HRESULT
HTMLDocument_Create(IUnknown
*pUnkOuter
, REFIID riid
, void** ppvObject
)
5019 mozIDOMWindowProxy
*mozwindow
;
5020 HTMLDocumentObj
*doc
;
5021 nsIDOMWindow
*nswindow
= NULL
;
5025 TRACE("(%p %s %p)\n", pUnkOuter
, debugstr_mshtml_guid(riid
), ppvObject
);
5027 doc
= heap_alloc_zero(sizeof(HTMLDocumentObj
));
5029 return E_OUTOFMEMORY
;
5031 init_dispex(&doc
->dispex
, (IUnknown
*)&doc
->ICustomDoc_iface
, &HTMLDocumentObj_dispex
);
5032 init_doc(&doc
->basedoc
, (IUnknown
*)&doc
->ICustomDoc_iface
, &doc
->dispex
.IDispatchEx_iface
);
5033 TargetContainer_Init(doc
);
5035 doc
->ICustomDoc_iface
.lpVtbl
= &CustomDocVtbl
;
5037 doc
->basedoc
.doc_obj
= doc
;
5039 doc
->usermode
= UNKNOWN_USERMODE
;
5041 init_binding_ui(doc
);
5043 hres
= create_nscontainer(doc
, &doc
->nscontainer
);
5045 ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n");
5046 htmldoc_release(&doc
->basedoc
);
5050 hres
= htmldoc_query_interface(&doc
->basedoc
, riid
, ppvObject
);
5051 htmldoc_release(&doc
->basedoc
);
5055 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &mozwindow
);
5056 if(NS_FAILED(nsres
))
5057 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
5059 nsres
= mozIDOMWindowProxy_QueryInterface(mozwindow
, &IID_nsIDOMWindow
, (void**)&nswindow
);
5060 mozIDOMWindowProxy_Release(mozwindow
);
5061 assert(nsres
== NS_OK
);
5063 hres
= HTMLOuterWindow_Create(doc
, nswindow
, NULL
/* FIXME */, &doc
->basedoc
.window
);
5065 nsIDOMWindow_Release(nswindow
);
5067 htmldoc_release(&doc
->basedoc
);
5071 if(!doc
->basedoc
.doc_node
&& doc
->basedoc
.window
->base
.inner_window
->doc
) {
5072 doc
->basedoc
.doc_node
= doc
->basedoc
.window
->base
.inner_window
->doc
;
5073 htmldoc_addref(&doc
->basedoc
.doc_node
->basedoc
);