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
34 #include "wine/debug.h"
36 #include "mshtml_private.h"
37 #include "htmlevent.h"
38 #include "pluginhost.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
43 static HRESULT
create_document_fragment(nsIDOMNode
*nsnode
, HTMLDocumentNode
*doc_node
, HTMLDocumentNode
**ret
);
45 HRESULT
get_doc_elem_by_id(HTMLDocumentNode
*doc
, const WCHAR
*id
, HTMLElement
**ret
)
47 nsIDOMNodeList
*nsnode_list
;
48 nsIDOMElement
*nselem
;
59 nsAString_InitDepend(&id_str
, id
);
60 /* get element by id attribute */
61 nsres
= nsIDOMHTMLDocument_GetElementById(doc
->nsdoc
, &id_str
, &nselem
);
63 ERR("GetElementById failed: %08x\n", nsres
);
64 nsAString_Finish(&id_str
);
68 /* get first element by name attribute */
69 nsres
= nsIDOMHTMLDocument_GetElementsByName(doc
->nsdoc
, &id_str
, &nsnode_list
);
70 nsAString_Finish(&id_str
);
72 ERR("getElementsByName failed: %08x\n", nsres
);
74 nsIDOMElement_Release(nselem
);
78 nsres
= nsIDOMNodeList_Item(nsnode_list
, 0, &nsnode
);
79 nsIDOMNodeList_Release(nsnode_list
);
80 assert(nsres
== NS_OK
);
82 if(nsnode
&& nselem
) {
85 nsres
= nsIDOMNode_CompareDocumentPosition(nsnode
, (nsIDOMNode
*)nselem
, &pos
);
86 if(NS_FAILED(nsres
)) {
87 FIXME("CompareDocumentPosition failed: 0x%08x\n", nsres
);
88 nsIDOMNode_Release(nsnode
);
89 nsIDOMElement_Release(nselem
);
93 TRACE("CompareDocumentPosition gave: 0x%x\n", pos
);
94 if(!(pos
& (DOCUMENT_POSITION_PRECEDING
| DOCUMENT_POSITION_CONTAINS
))) {
95 nsIDOMElement_Release(nselem
);
102 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMElement
, (void**)&nselem
);
103 assert(nsres
== NS_OK
);
105 nsIDOMNode_Release(nsnode
);
113 hres
= get_element(nselem
, ret
);
114 nsIDOMElement_Release(nselem
);
118 UINT
get_document_charset(HTMLDocumentNode
*doc
)
120 nsAString charset_str
;
127 nsAString_Init(&charset_str
, NULL
);
128 nsres
= nsIDOMHTMLDocument_GetCharacterSet(doc
->nsdoc
, &charset_str
);
129 if(NS_SUCCEEDED(nsres
)) {
130 const PRUnichar
*charset
;
132 nsAString_GetData(&charset_str
, &charset
);
135 BSTR str
= SysAllocString(charset
);
136 ret
= cp_from_charset_string(str
);
140 ERR("GetCharset failed: %08x\n", nsres
);
142 nsAString_Finish(&charset_str
);
147 return doc
->charset
= ret
;
150 static inline HTMLDocument
*impl_from_IHTMLDocument2(IHTMLDocument2
*iface
)
152 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument2_iface
);
155 static HRESULT WINAPI
HTMLDocument_QueryInterface(IHTMLDocument2
*iface
, REFIID riid
, void **ppv
)
157 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
159 return htmldoc_query_interface(This
, riid
, ppv
);
162 static ULONG WINAPI
HTMLDocument_AddRef(IHTMLDocument2
*iface
)
164 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
166 return htmldoc_addref(This
);
169 static ULONG WINAPI
HTMLDocument_Release(IHTMLDocument2
*iface
)
171 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
173 return htmldoc_release(This
);
176 static HRESULT WINAPI
HTMLDocument_GetTypeInfoCount(IHTMLDocument2
*iface
, UINT
*pctinfo
)
178 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
180 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
183 static HRESULT WINAPI
HTMLDocument_GetTypeInfo(IHTMLDocument2
*iface
, UINT iTInfo
,
184 LCID lcid
, ITypeInfo
**ppTInfo
)
186 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
188 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
191 static HRESULT WINAPI
HTMLDocument_GetIDsOfNames(IHTMLDocument2
*iface
, REFIID riid
,
192 LPOLESTR
*rgszNames
, UINT cNames
,
193 LCID lcid
, DISPID
*rgDispId
)
195 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
197 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
201 static HRESULT WINAPI
HTMLDocument_Invoke(IHTMLDocument2
*iface
, DISPID dispIdMember
,
202 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
203 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
205 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
207 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
208 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
211 static HRESULT WINAPI
HTMLDocument_get_Script(IHTMLDocument2
*iface
, IDispatch
**p
)
213 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
216 TRACE("(%p)->(%p)\n", This
, p
);
218 hres
= IHTMLDocument7_get_parentWindow(&This
->IHTMLDocument7_iface
, (IHTMLWindow2
**)p
);
219 return hres
== S_OK
&& !*p
? E_PENDING
: hres
;
222 static HRESULT WINAPI
HTMLDocument_get_all(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
224 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
225 nsIDOMElement
*nselem
= NULL
;
230 TRACE("(%p)->(%p)\n", This
, p
);
232 if(!This
->doc_node
->nsdoc
) {
233 WARN("NULL nsdoc\n");
237 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->doc_node
->nsdoc
, &nselem
);
238 if(NS_FAILED(nsres
)) {
239 ERR("GetDocumentElement failed: %08x\n", nsres
);
248 hres
= get_node((nsIDOMNode
*)nselem
, TRUE
, &node
);
249 nsIDOMElement_Release(nselem
);
253 *p
= create_all_collection(node
, TRUE
);
258 static HRESULT WINAPI
HTMLDocument_get_body(IHTMLDocument2
*iface
, IHTMLElement
**p
)
260 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
261 nsIDOMHTMLElement
*nsbody
= NULL
;
262 HTMLElement
*element
;
265 TRACE("(%p)->(%p)\n", This
, p
);
267 if(This
->doc_node
->nsdoc
) {
270 nsres
= nsIDOMHTMLDocument_GetBody(This
->doc_node
->nsdoc
, &nsbody
);
271 if(NS_FAILED(nsres
)) {
272 TRACE("Could not get body: %08x\n", nsres
);
282 hres
= get_element((nsIDOMElement
*)nsbody
, &element
);
283 nsIDOMHTMLElement_Release(nsbody
);
287 *p
= &element
->IHTMLElement_iface
;
291 static HRESULT WINAPI
HTMLDocument_get_activeElement(IHTMLDocument2
*iface
, IHTMLElement
**p
)
293 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
294 nsIDOMElement
*nselem
;
299 TRACE("(%p)->(%p)\n", This
, p
);
301 if(!This
->doc_node
->nsdoc
) {
307 * NOTE: Gecko may return an active element even if the document is not visible.
308 * IE returns NULL in this case.
310 nsres
= nsIDOMHTMLDocument_GetActiveElement(This
->doc_node
->nsdoc
, &nselem
);
311 if(NS_FAILED(nsres
)) {
312 ERR("GetActiveElement failed: %08x\n", nsres
);
321 hres
= get_element(nselem
, &elem
);
322 nsIDOMElement_Release(nselem
);
326 *p
= &elem
->IHTMLElement_iface
;
330 static HRESULT WINAPI
HTMLDocument_get_images(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
332 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
333 nsIDOMHTMLCollection
*nscoll
= NULL
;
336 TRACE("(%p)->(%p)\n", This
, p
);
343 if(!This
->doc_node
->nsdoc
) {
344 WARN("NULL nsdoc\n");
348 nsres
= nsIDOMHTMLDocument_GetImages(This
->doc_node
->nsdoc
, &nscoll
);
349 if(NS_FAILED(nsres
)) {
350 ERR("GetImages failed: %08x\n", nsres
);
355 *p
= create_collection_from_htmlcol(nscoll
, This
->doc_node
->document_mode
);
356 nsIDOMHTMLCollection_Release(nscoll
);
362 static HRESULT WINAPI
HTMLDocument_get_applets(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
364 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
365 nsIDOMHTMLCollection
*nscoll
= NULL
;
368 TRACE("(%p)->(%p)\n", This
, p
);
375 if(!This
->doc_node
->nsdoc
) {
376 WARN("NULL nsdoc\n");
380 nsres
= nsIDOMHTMLDocument_GetApplets(This
->doc_node
->nsdoc
, &nscoll
);
381 if(NS_FAILED(nsres
)) {
382 ERR("GetApplets failed: %08x\n", nsres
);
387 *p
= create_collection_from_htmlcol(nscoll
, This
->doc_node
->document_mode
);
388 nsIDOMHTMLCollection_Release(nscoll
);
394 static HRESULT WINAPI
HTMLDocument_get_links(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
396 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
397 nsIDOMHTMLCollection
*nscoll
= NULL
;
400 TRACE("(%p)->(%p)\n", This
, p
);
407 if(!This
->doc_node
->nsdoc
) {
408 WARN("NULL nsdoc\n");
412 nsres
= nsIDOMHTMLDocument_GetLinks(This
->doc_node
->nsdoc
, &nscoll
);
413 if(NS_FAILED(nsres
)) {
414 ERR("GetLinks failed: %08x\n", nsres
);
419 *p
= create_collection_from_htmlcol(nscoll
, This
->doc_node
->document_mode
);
420 nsIDOMHTMLCollection_Release(nscoll
);
426 static HRESULT WINAPI
HTMLDocument_get_forms(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
428 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
429 nsIDOMHTMLCollection
*nscoll
= NULL
;
432 TRACE("(%p)->(%p)\n", This
, p
);
439 if(!This
->doc_node
->nsdoc
) {
440 WARN("NULL nsdoc\n");
444 nsres
= nsIDOMHTMLDocument_GetForms(This
->doc_node
->nsdoc
, &nscoll
);
445 if(NS_FAILED(nsres
)) {
446 ERR("GetForms failed: %08x\n", nsres
);
451 *p
= create_collection_from_htmlcol(nscoll
, This
->doc_node
->document_mode
);
452 nsIDOMHTMLCollection_Release(nscoll
);
458 static HRESULT WINAPI
HTMLDocument_get_anchors(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
460 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
461 nsIDOMHTMLCollection
*nscoll
= NULL
;
464 TRACE("(%p)->(%p)\n", This
, p
);
471 if(!This
->doc_node
->nsdoc
) {
472 WARN("NULL nsdoc\n");
476 nsres
= nsIDOMHTMLDocument_GetAnchors(This
->doc_node
->nsdoc
, &nscoll
);
477 if(NS_FAILED(nsres
)) {
478 ERR("GetAnchors failed: %08x\n", nsres
);
483 *p
= create_collection_from_htmlcol(nscoll
, This
->doc_node
->document_mode
);
484 nsIDOMHTMLCollection_Release(nscoll
);
490 static HRESULT WINAPI
HTMLDocument_put_title(IHTMLDocument2
*iface
, BSTR v
)
492 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
496 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
498 if(!This
->doc_node
->nsdoc
) {
499 WARN("NULL nsdoc\n");
503 nsAString_InitDepend(&nsstr
, v
);
504 nsres
= nsIDOMHTMLDocument_SetTitle(This
->doc_node
->nsdoc
, &nsstr
);
505 nsAString_Finish(&nsstr
);
507 ERR("SetTitle failed: %08x\n", nsres
);
512 static HRESULT WINAPI
HTMLDocument_get_title(IHTMLDocument2
*iface
, BSTR
*p
)
514 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
515 const PRUnichar
*ret
;
519 TRACE("(%p)->(%p)\n", This
, p
);
521 if(!This
->doc_node
->nsdoc
) {
522 WARN("NULL nsdoc\n");
527 nsAString_Init(&nsstr
, NULL
);
528 nsres
= nsIDOMHTMLDocument_GetTitle(This
->doc_node
->nsdoc
, &nsstr
);
529 if (NS_SUCCEEDED(nsres
)) {
530 nsAString_GetData(&nsstr
, &ret
);
531 *p
= SysAllocString(ret
);
533 nsAString_Finish(&nsstr
);
535 if(NS_FAILED(nsres
)) {
536 ERR("GetTitle failed: %08x\n", nsres
);
543 static HRESULT WINAPI
HTMLDocument_get_scripts(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
545 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
546 nsIDOMHTMLCollection
*nscoll
= NULL
;
549 TRACE("(%p)->(%p)\n", This
, p
);
556 if(!This
->doc_node
->nsdoc
) {
557 WARN("NULL nsdoc\n");
561 nsres
= nsIDOMHTMLDocument_GetScripts(This
->doc_node
->nsdoc
, &nscoll
);
562 if(NS_FAILED(nsres
)) {
563 ERR("GetImages failed: %08x\n", nsres
);
568 *p
= create_collection_from_htmlcol(nscoll
, This
->doc_node
->document_mode
);
569 nsIDOMHTMLCollection_Release(nscoll
);
575 static HRESULT WINAPI
HTMLDocument_put_designMode(IHTMLDocument2
*iface
, BSTR v
)
577 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
580 static const WCHAR onW
[] = {'o','n',0};
582 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
584 if(wcsicmp(v
, onW
)) {
585 FIXME("Unsupported arg %s\n", debugstr_w(v
));
589 hres
= setup_edit_mode(This
->doc_obj
);
593 call_property_onchanged(&This
->cp_container
, DISPID_IHTMLDOCUMENT2_DESIGNMODE
);
597 static HRESULT WINAPI
HTMLDocument_get_designMode(IHTMLDocument2
*iface
, BSTR
*p
)
599 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
600 static const WCHAR szOff
[] = {'O','f','f',0};
601 FIXME("(%p)->(%p) always returning Off\n", This
, p
);
606 *p
= SysAllocString(szOff
);
611 static HRESULT WINAPI
HTMLDocument_get_selection(IHTMLDocument2
*iface
, IHTMLSelectionObject
**p
)
613 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
614 nsISelection
*nsselection
;
617 TRACE("(%p)->(%p)\n", This
, p
);
619 nsres
= nsIDOMWindow_GetSelection(This
->window
->nswindow
, &nsselection
);
620 if(NS_FAILED(nsres
)) {
621 ERR("GetSelection failed: %08x\n", nsres
);
625 return HTMLSelectionObject_Create(This
->doc_node
, nsselection
, p
);
628 static HRESULT WINAPI
HTMLDocument_get_readyState(IHTMLDocument2
*iface
, BSTR
*p
)
630 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
633 TRACE("(%p)->(%p)\n", iface
, p
);
638 return get_readystate_string(This
->window
->readystate
, p
);
641 static HRESULT WINAPI
HTMLDocument_get_frames(IHTMLDocument2
*iface
, IHTMLFramesCollection2
**p
)
643 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
645 TRACE("(%p)->(%p)\n", This
, p
);
647 return IHTMLWindow2_get_frames(&This
->window
->base
.IHTMLWindow2_iface
, p
);
650 static HRESULT WINAPI
HTMLDocument_get_embeds(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
652 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
653 FIXME("(%p)->(%p)\n", This
, p
);
657 static HRESULT WINAPI
HTMLDocument_get_plugins(IHTMLDocument2
*iface
, IHTMLElementCollection
**p
)
659 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
660 FIXME("(%p)->(%p)\n", This
, p
);
664 static HRESULT WINAPI
HTMLDocument_put_alinkColor(IHTMLDocument2
*iface
, VARIANT v
)
666 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
667 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
671 static HRESULT WINAPI
HTMLDocument_get_alinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
673 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
674 FIXME("(%p)->(%p)\n", This
, p
);
678 static HRESULT WINAPI
HTMLDocument_put_bgColor(IHTMLDocument2
*iface
, VARIANT v
)
680 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
681 IHTMLElement
*element
= NULL
;
682 IHTMLBodyElement
*body
;
685 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
687 hr
= IHTMLDocument2_get_body(iface
, &element
);
690 ERR("Failed to get body (0x%08x)\n", hr
);
696 FIXME("Empty body element.\n");
700 hr
= IHTMLElement_QueryInterface(element
, &IID_IHTMLBodyElement
, (void**)&body
);
703 hr
= IHTMLBodyElement_put_bgColor(body
, v
);
704 IHTMLBodyElement_Release(body
);
706 IHTMLElement_Release(element
);
711 static HRESULT WINAPI
HTMLDocument_get_bgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
713 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
718 TRACE("(%p)->(%p)\n", This
, p
);
720 if(!This
->doc_node
->nsdoc
) {
721 WARN("NULL nsdoc\n");
725 nsAString_Init(&nsstr
, NULL
);
726 nsres
= nsIDOMHTMLDocument_GetBgColor(This
->doc_node
->nsdoc
, &nsstr
);
727 hres
= return_nsstr_variant(nsres
, &nsstr
, NSSTR_COLOR
, p
);
728 if(hres
== S_OK
&& V_VT(p
) == VT_BSTR
&& !V_BSTR(p
)) {
729 TRACE("default #ffffff\n");
730 if(!(V_BSTR(p
) = SysAllocString(L
"#ffffff")))
731 hres
= E_OUTOFMEMORY
;
736 static HRESULT WINAPI
HTMLDocument_put_fgColor(IHTMLDocument2
*iface
, VARIANT v
)
738 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
739 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
743 static HRESULT WINAPI
HTMLDocument_get_fgColor(IHTMLDocument2
*iface
, VARIANT
*p
)
745 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
746 FIXME("(%p)->(%p)\n", This
, p
);
750 static HRESULT WINAPI
HTMLDocument_put_linkColor(IHTMLDocument2
*iface
, VARIANT v
)
752 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
753 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
757 static HRESULT WINAPI
HTMLDocument_get_linkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
759 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
760 FIXME("(%p)->(%p)\n", This
, p
);
764 static HRESULT WINAPI
HTMLDocument_put_vlinkColor(IHTMLDocument2
*iface
, VARIANT v
)
766 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
767 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
771 static HRESULT WINAPI
HTMLDocument_get_vlinkColor(IHTMLDocument2
*iface
, VARIANT
*p
)
773 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
774 FIXME("(%p)->(%p)\n", This
, p
);
778 static HRESULT WINAPI
HTMLDocument_get_referrer(IHTMLDocument2
*iface
, BSTR
*p
)
780 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
782 FIXME("(%p)->(%p)\n", This
, p
);
788 static HRESULT WINAPI
HTMLDocument_get_location(IHTMLDocument2
*iface
, IHTMLLocation
**p
)
790 HTMLDocumentNode
*This
= impl_from_IHTMLDocument2(iface
)->doc_node
;
792 TRACE("(%p)->(%p)\n", This
, p
);
794 if(!This
->nsdoc
|| !This
->window
) {
795 WARN("NULL window\n");
799 return IHTMLWindow2_get_location(&This
->window
->base
.IHTMLWindow2_iface
, p
);
802 static HRESULT WINAPI
HTMLDocument_get_lastModified(IHTMLDocument2
*iface
, BSTR
*p
)
804 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
805 FIXME("(%p)->(%p)\n", This
, p
);
809 static HRESULT WINAPI
HTMLDocument_put_URL(IHTMLDocument2
*iface
, BSTR v
)
811 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
813 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
816 FIXME("No window available\n");
820 return navigate_url(This
->window
, v
, This
->window
->uri
, BINDING_NAVIGATED
);
823 static HRESULT WINAPI
HTMLDocument_get_URL(IHTMLDocument2
*iface
, BSTR
*p
)
825 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
827 static const WCHAR about_blank_url
[] =
828 {'a','b','o','u','t',':','b','l','a','n','k',0};
830 TRACE("(%p)->(%p)\n", iface
, p
);
832 *p
= SysAllocString(This
->window
->url
? This
->window
->url
: about_blank_url
);
833 return *p
? S_OK
: E_OUTOFMEMORY
;
836 static HRESULT WINAPI
HTMLDocument_put_domain(IHTMLDocument2
*iface
, BSTR v
)
838 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
842 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
844 nsAString_InitDepend(&nsstr
, v
);
845 nsres
= nsIDOMHTMLDocument_SetDomain(This
->doc_node
->nsdoc
, &nsstr
);
846 nsAString_Finish(&nsstr
);
847 if(NS_FAILED(nsres
)) {
848 ERR("SetDomain failed: %08x\n", nsres
);
855 static HRESULT WINAPI
HTMLDocument_get_domain(IHTMLDocument2
*iface
, BSTR
*p
)
857 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
861 TRACE("(%p)->(%p)\n", This
, p
);
863 nsAString_Init(&nsstr
, NULL
);
864 nsres
= nsIDOMHTMLDocument_GetDomain(This
->doc_node
->nsdoc
, &nsstr
);
865 if(NS_SUCCEEDED(nsres
) && This
->window
&& This
->window
->uri
) {
866 const PRUnichar
*str
;
869 nsAString_GetData(&nsstr
, &str
);
871 TRACE("Gecko returned empty string, fallback to loaded URL.\n");
872 nsAString_Finish(&nsstr
);
873 hres
= IUri_GetHost(This
->window
->uri
, p
);
874 return FAILED(hres
) ? hres
: S_OK
;
878 return return_nsstr(nsres
, &nsstr
, p
);
881 static HRESULT WINAPI
HTMLDocument_put_cookie(IHTMLDocument2
*iface
, BSTR v
)
883 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
886 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
888 bret
= InternetSetCookieExW(This
->window
->url
, NULL
, v
, 0, 0);
890 FIXME("InternetSetCookieExW failed: %u\n", GetLastError());
891 return HRESULT_FROM_WIN32(GetLastError());
897 static HRESULT WINAPI
HTMLDocument_get_cookie(IHTMLDocument2
*iface
, BSTR
*p
)
899 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
903 TRACE("(%p)->(%p)\n", This
, p
);
906 bret
= InternetGetCookieExW(This
->window
->url
, NULL
, NULL
, &size
, 0, NULL
);
907 if(!bret
&& GetLastError() != ERROR_INSUFFICIENT_BUFFER
) {
908 WARN("InternetGetCookieExW failed: %u\n", GetLastError());
918 *p
= SysAllocStringLen(NULL
, size
/sizeof(WCHAR
)-1);
920 return E_OUTOFMEMORY
;
922 bret
= InternetGetCookieExW(This
->window
->url
, NULL
, *p
, &size
, 0, NULL
);
924 ERR("InternetGetCookieExW failed: %u\n", GetLastError());
931 static HRESULT WINAPI
HTMLDocument_put_expando(IHTMLDocument2
*iface
, VARIANT_BOOL v
)
933 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
934 FIXME("(%p)->(%x)\n", This
, v
);
938 static HRESULT WINAPI
HTMLDocument_get_expando(IHTMLDocument2
*iface
, VARIANT_BOOL
*p
)
940 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
941 FIXME("(%p)->(%p)\n", This
, p
);
945 static HRESULT WINAPI
HTMLDocument_put_charset(IHTMLDocument2
*iface
, BSTR v
)
947 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
948 FIXME("(%p)->(%s) returning S_OK\n", This
, debugstr_w(v
));
952 static HRESULT WINAPI
HTMLDocument_get_charset(IHTMLDocument2
*iface
, BSTR
*p
)
954 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
956 TRACE("(%p)->(%p)\n", This
, p
);
958 return IHTMLDocument7_get_characterSet(&This
->IHTMLDocument7_iface
, p
);
961 static HRESULT WINAPI
HTMLDocument_put_defaultCharset(IHTMLDocument2
*iface
, BSTR v
)
963 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
964 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
968 static HRESULT WINAPI
HTMLDocument_get_defaultCharset(IHTMLDocument2
*iface
, BSTR
*p
)
970 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
972 TRACE("(%p)->(%p)\n", This
, p
);
974 *p
= charset_string_from_cp(GetACP());
975 return *p
? S_OK
: E_OUTOFMEMORY
;
978 static HRESULT WINAPI
HTMLDocument_get_mimeType(IHTMLDocument2
*iface
, BSTR
*p
)
980 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
981 FIXME("(%p)->(%p)\n", This
, p
);
985 static HRESULT WINAPI
HTMLDocument_get_fileSize(IHTMLDocument2
*iface
, BSTR
*p
)
987 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
988 FIXME("(%p)->(%p)\n", This
, p
);
992 static HRESULT WINAPI
HTMLDocument_get_fileCreatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
994 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
995 FIXME("(%p)->(%p)\n", This
, p
);
999 static HRESULT WINAPI
HTMLDocument_get_fileModifiedDate(IHTMLDocument2
*iface
, BSTR
*p
)
1001 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1002 FIXME("(%p)->(%p)\n", This
, p
);
1006 static HRESULT WINAPI
HTMLDocument_get_fileUpdatedDate(IHTMLDocument2
*iface
, BSTR
*p
)
1008 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1009 FIXME("(%p)->(%p)\n", This
, p
);
1013 static HRESULT WINAPI
HTMLDocument_get_security(IHTMLDocument2
*iface
, BSTR
*p
)
1015 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1016 FIXME("(%p)->(%p)\n", This
, p
);
1020 static HRESULT WINAPI
HTMLDocument_get_protocol(IHTMLDocument2
*iface
, BSTR
*p
)
1022 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1023 FIXME("(%p)->(%p)\n", This
, p
);
1027 static HRESULT WINAPI
HTMLDocument_get_nameProp(IHTMLDocument2
*iface
, BSTR
*p
)
1029 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1030 FIXME("(%p)->(%p)\n", This
, p
);
1034 static HRESULT
document_write(HTMLDocument
*This
, SAFEARRAY
*psarray
, BOOL ln
)
1043 if(!This
->doc_node
->nsdoc
) {
1044 WARN("NULL nsdoc\n");
1045 return E_UNEXPECTED
;
1051 if(psarray
->cDims
!= 1) {
1052 FIXME("cDims=%d\n", psarray
->cDims
);
1053 return E_INVALIDARG
;
1056 hres
= SafeArrayAccessData(psarray
, (void**)&var
);
1058 WARN("SafeArrayAccessData failed: %08x\n", hres
);
1062 V_VT(&tmp
) = VT_EMPTY
;
1064 jsctx
= get_context_from_document(This
->doc_node
->nsdoc
);
1065 argc
= psarray
->rgsabound
[0].cElements
;
1066 for(i
=0; i
< argc
; i
++) {
1067 if(V_VT(var
+i
) == VT_BSTR
) {
1068 nsAString_InitDepend(&nsstr
, V_BSTR(var
+i
));
1070 hres
= VariantChangeTypeEx(&tmp
, var
+i
, MAKELCID(MAKELANGID(LANG_ENGLISH
,SUBLANG_ENGLISH_US
),SORT_DEFAULT
), 0, VT_BSTR
);
1072 WARN("Could not convert %s to string\n", debugstr_variant(var
+i
));
1075 nsAString_InitDepend(&nsstr
, V_BSTR(&tmp
));
1078 if(!ln
|| i
!= argc
-1)
1079 nsres
= nsIDOMHTMLDocument_Write(This
->doc_node
->nsdoc
, &nsstr
, jsctx
);
1081 nsres
= nsIDOMHTMLDocument_Writeln(This
->doc_node
->nsdoc
, &nsstr
, jsctx
);
1082 nsAString_Finish(&nsstr
);
1083 if(V_VT(var
+i
) != VT_BSTR
)
1085 if(NS_FAILED(nsres
)) {
1086 ERR("Write failed: %08x\n", nsres
);
1092 SafeArrayUnaccessData(psarray
);
1097 static HRESULT WINAPI
HTMLDocument_write(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
1099 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1101 TRACE("(%p)->(%p)\n", iface
, psarray
);
1103 return document_write(This
, psarray
, FALSE
);
1106 static HRESULT WINAPI
HTMLDocument_writeln(IHTMLDocument2
*iface
, SAFEARRAY
*psarray
)
1108 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1110 TRACE("(%p)->(%p)\n", This
, psarray
);
1112 return document_write(This
, psarray
, TRUE
);
1115 static HRESULT WINAPI
HTMLDocument_open(IHTMLDocument2
*iface
, BSTR url
, VARIANT name
,
1116 VARIANT features
, VARIANT replace
, IDispatch
**pomWindowResult
)
1118 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1122 static const WCHAR text_htmlW
[] = {'t','e','x','t','/','h','t','m','l',0};
1124 TRACE("(%p)->(%s %s %s %s %p)\n", This
, debugstr_w(url
), debugstr_variant(&name
),
1125 debugstr_variant(&features
), debugstr_variant(&replace
), pomWindowResult
);
1127 if(!This
->doc_node
->nsdoc
) {
1132 if(!url
|| wcscmp(url
, text_htmlW
) || V_VT(&name
) != VT_ERROR
1133 || V_VT(&features
) != VT_ERROR
|| V_VT(&replace
) != VT_ERROR
)
1134 FIXME("unsupported args\n");
1136 nsres
= nsIDOMHTMLDocument_Open(This
->doc_node
->nsdoc
, NULL
, NULL
, NULL
,
1137 get_context_from_document(This
->doc_node
->nsdoc
), 0, &tmp
);
1138 if(NS_FAILED(nsres
)) {
1139 ERR("Open failed: %08x\n", nsres
);
1144 nsISupports_Release(tmp
);
1146 *pomWindowResult
= (IDispatch
*)&This
->window
->base
.IHTMLWindow2_iface
;
1147 IHTMLWindow2_AddRef(&This
->window
->base
.IHTMLWindow2_iface
);
1151 static HRESULT WINAPI
HTMLDocument_close(IHTMLDocument2
*iface
)
1153 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1156 TRACE("(%p)\n", This
);
1158 if(!This
->doc_node
->nsdoc
) {
1163 nsres
= nsIDOMHTMLDocument_Close(This
->doc_node
->nsdoc
);
1164 if(NS_FAILED(nsres
)) {
1165 ERR("Close failed: %08x\n", nsres
);
1172 static HRESULT WINAPI
HTMLDocument_clear(IHTMLDocument2
*iface
)
1174 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1177 TRACE("(%p)\n", This
);
1179 nsres
= nsIDOMHTMLDocument_Clear(This
->doc_node
->nsdoc
);
1180 if(NS_FAILED(nsres
)) {
1181 ERR("Clear failed: %08x\n", nsres
);
1188 static const WCHAR copyW
[] =
1189 {'c','o','p','y',0};
1190 static const WCHAR cutW
[] =
1192 static const WCHAR fontnameW
[] =
1193 {'f','o','n','t','n','a','m','e',0};
1194 static const WCHAR fontsizeW
[] =
1195 {'f','o','n','t','s','i','z','e',0};
1196 static const WCHAR indentW
[] =
1197 {'i','n','d','e','n','t',0};
1198 static const WCHAR insertorderedlistW
[] =
1199 {'i','n','s','e','r','t','o','r','d','e','r','e','d','l','i','s','t',0};
1200 static const WCHAR insertunorderedlistW
[] =
1201 {'i','n','s','e','r','t','u','n','o','r','d','e','r','e','d','l','i','s','t',0};
1202 static const WCHAR outdentW
[] =
1203 {'o','u','t','d','e','n','t',0};
1204 static const WCHAR pasteW
[] =
1205 {'p','a','s','t','e',0};
1206 static const WCHAR respectvisibilityindesignW
[] =
1207 {'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};
1209 static const struct {
1212 }command_names
[] = {
1215 {fontnameW
, IDM_FONTNAME
},
1216 {fontsizeW
, IDM_FONTSIZE
},
1217 {indentW
, IDM_INDENT
},
1218 {insertorderedlistW
, IDM_ORDERLIST
},
1219 {insertunorderedlistW
, IDM_UNORDERLIST
},
1220 {outdentW
, IDM_OUTDENT
},
1221 {pasteW
, IDM_PASTE
},
1222 {respectvisibilityindesignW
, IDM_RESPECTVISIBILITY_INDESIGN
}
1225 static BOOL
cmdid_from_string(const WCHAR
*str
, OLECMDID
*cmdid
)
1229 for(i
= 0; i
< ARRAY_SIZE(command_names
); i
++) {
1230 if(!wcsicmp(command_names
[i
].name
, str
)) {
1231 *cmdid
= command_names
[i
].id
;
1236 FIXME("Unknown command %s\n", debugstr_w(str
));
1240 static HRESULT WINAPI
HTMLDocument_queryCommandSupported(IHTMLDocument2
*iface
, BSTR cmdID
,
1241 VARIANT_BOOL
*pfRet
)
1243 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1244 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1248 static HRESULT WINAPI
HTMLDocument_queryCommandEnabled(IHTMLDocument2
*iface
, BSTR cmdID
,
1249 VARIANT_BOOL
*pfRet
)
1251 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1252 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1256 static HRESULT WINAPI
HTMLDocument_queryCommandState(IHTMLDocument2
*iface
, BSTR cmdID
,
1257 VARIANT_BOOL
*pfRet
)
1259 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1260 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1264 static HRESULT WINAPI
HTMLDocument_queryCommandIndeterm(IHTMLDocument2
*iface
, BSTR cmdID
,
1265 VARIANT_BOOL
*pfRet
)
1267 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1268 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1272 static HRESULT WINAPI
HTMLDocument_queryCommandText(IHTMLDocument2
*iface
, BSTR cmdID
,
1275 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1276 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1280 static HRESULT WINAPI
HTMLDocument_queryCommandValue(IHTMLDocument2
*iface
, BSTR cmdID
,
1283 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1284 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1288 static HRESULT WINAPI
HTMLDocument_execCommand(IHTMLDocument2
*iface
, BSTR cmdID
,
1289 VARIANT_BOOL showUI
, VARIANT value
, VARIANT_BOOL
*pfRet
)
1291 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1296 TRACE("(%p)->(%s %x %s %p)\n", This
, debugstr_w(cmdID
), showUI
, debugstr_variant(&value
), pfRet
);
1298 if(!cmdid_from_string(cmdID
, &cmdid
))
1299 return OLECMDERR_E_NOTSUPPORTED
;
1301 V_VT(&ret
) = VT_EMPTY
;
1302 hres
= IOleCommandTarget_Exec(&This
->IOleCommandTarget_iface
, &CGID_MSHTML
, cmdid
,
1303 showUI
? 0 : OLECMDEXECOPT_DONTPROMPTUSER
, &value
, &ret
);
1307 if(V_VT(&ret
) != VT_EMPTY
) {
1308 FIXME("Handle ret %s\n", debugstr_variant(&ret
));
1312 *pfRet
= VARIANT_TRUE
;
1316 static HRESULT WINAPI
HTMLDocument_execCommandShowHelp(IHTMLDocument2
*iface
, BSTR cmdID
,
1317 VARIANT_BOOL
*pfRet
)
1319 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1320 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(cmdID
), pfRet
);
1324 static HRESULT WINAPI
HTMLDocument_createElement(IHTMLDocument2
*iface
, BSTR eTag
,
1325 IHTMLElement
**newElem
)
1327 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1331 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eTag
), newElem
);
1333 hres
= create_element(This
->doc_node
, eTag
, &elem
);
1337 *newElem
= &elem
->IHTMLElement_iface
;
1341 static HRESULT WINAPI
HTMLDocument_put_onhelp(IHTMLDocument2
*iface
, VARIANT v
)
1343 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1344 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1348 static HRESULT WINAPI
HTMLDocument_get_onhelp(IHTMLDocument2
*iface
, VARIANT
*p
)
1350 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1351 FIXME("(%p)->(%p)\n", This
, p
);
1355 static HRESULT WINAPI
HTMLDocument_put_onclick(IHTMLDocument2
*iface
, VARIANT v
)
1357 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1359 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1361 return set_doc_event(This
, EVENTID_CLICK
, &v
);
1364 static HRESULT WINAPI
HTMLDocument_get_onclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1366 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1368 TRACE("(%p)->(%p)\n", This
, p
);
1370 return get_doc_event(This
, EVENTID_CLICK
, p
);
1373 static HRESULT WINAPI
HTMLDocument_put_ondblclick(IHTMLDocument2
*iface
, VARIANT v
)
1375 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1377 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1379 return set_doc_event(This
, EVENTID_DBLCLICK
, &v
);
1382 static HRESULT WINAPI
HTMLDocument_get_ondblclick(IHTMLDocument2
*iface
, VARIANT
*p
)
1384 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1386 TRACE("(%p)->(%p)\n", This
, p
);
1388 return get_doc_event(This
, EVENTID_DBLCLICK
, p
);
1391 static HRESULT WINAPI
HTMLDocument_put_onkeyup(IHTMLDocument2
*iface
, VARIANT v
)
1393 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1395 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1397 return set_doc_event(This
, EVENTID_KEYUP
, &v
);
1400 static HRESULT WINAPI
HTMLDocument_get_onkeyup(IHTMLDocument2
*iface
, VARIANT
*p
)
1402 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1404 TRACE("(%p)->(%p)\n", This
, p
);
1406 return get_doc_event(This
, EVENTID_KEYUP
, p
);
1409 static HRESULT WINAPI
HTMLDocument_put_onkeydown(IHTMLDocument2
*iface
, VARIANT v
)
1411 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1413 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1415 return set_doc_event(This
, EVENTID_KEYDOWN
, &v
);
1418 static HRESULT WINAPI
HTMLDocument_get_onkeydown(IHTMLDocument2
*iface
, VARIANT
*p
)
1420 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1422 TRACE("(%p)->(%p)\n", This
, p
);
1424 return get_doc_event(This
, EVENTID_KEYDOWN
, p
);
1427 static HRESULT WINAPI
HTMLDocument_put_onkeypress(IHTMLDocument2
*iface
, VARIANT v
)
1429 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1431 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1433 return set_doc_event(This
, EVENTID_KEYPRESS
, &v
);
1436 static HRESULT WINAPI
HTMLDocument_get_onkeypress(IHTMLDocument2
*iface
, VARIANT
*p
)
1438 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1440 TRACE("(%p)->(%p)\n", This
, p
);
1442 return get_doc_event(This
, EVENTID_KEYPRESS
, p
);
1445 static HRESULT WINAPI
HTMLDocument_put_onmouseup(IHTMLDocument2
*iface
, VARIANT v
)
1447 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1449 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1451 return set_doc_event(This
, EVENTID_MOUSEUP
, &v
);
1454 static HRESULT WINAPI
HTMLDocument_get_onmouseup(IHTMLDocument2
*iface
, VARIANT
*p
)
1456 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1458 TRACE("(%p)->(%p)\n", This
, p
);
1460 return get_doc_event(This
, EVENTID_MOUSEUP
, p
);
1463 static HRESULT WINAPI
HTMLDocument_put_onmousedown(IHTMLDocument2
*iface
, VARIANT v
)
1465 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1467 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1469 return set_doc_event(This
, EVENTID_MOUSEDOWN
, &v
);
1472 static HRESULT WINAPI
HTMLDocument_get_onmousedown(IHTMLDocument2
*iface
, VARIANT
*p
)
1474 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1476 TRACE("(%p)->(%p)\n", This
, p
);
1478 return get_doc_event(This
, EVENTID_MOUSEDOWN
, p
);
1481 static HRESULT WINAPI
HTMLDocument_put_onmousemove(IHTMLDocument2
*iface
, VARIANT v
)
1483 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1485 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1487 return set_doc_event(This
, EVENTID_MOUSEMOVE
, &v
);
1490 static HRESULT WINAPI
HTMLDocument_get_onmousemove(IHTMLDocument2
*iface
, VARIANT
*p
)
1492 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1494 TRACE("(%p)->(%p)\n", This
, p
);
1496 return get_doc_event(This
, EVENTID_MOUSEMOVE
, p
);
1499 static HRESULT WINAPI
HTMLDocument_put_onmouseout(IHTMLDocument2
*iface
, VARIANT v
)
1501 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1503 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1505 return set_doc_event(This
, EVENTID_MOUSEOUT
, &v
);
1508 static HRESULT WINAPI
HTMLDocument_get_onmouseout(IHTMLDocument2
*iface
, VARIANT
*p
)
1510 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1512 TRACE("(%p)->(%p)\n", This
, p
);
1514 return get_doc_event(This
, EVENTID_MOUSEOUT
, p
);
1517 static HRESULT WINAPI
HTMLDocument_put_onmouseover(IHTMLDocument2
*iface
, VARIANT v
)
1519 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1521 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1523 return set_doc_event(This
, EVENTID_MOUSEOVER
, &v
);
1526 static HRESULT WINAPI
HTMLDocument_get_onmouseover(IHTMLDocument2
*iface
, VARIANT
*p
)
1528 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1530 TRACE("(%p)->(%p)\n", This
, p
);
1532 return get_doc_event(This
, EVENTID_MOUSEOVER
, p
);
1535 static HRESULT WINAPI
HTMLDocument_put_onreadystatechange(IHTMLDocument2
*iface
, VARIANT v
)
1537 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1539 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1541 return set_doc_event(This
, EVENTID_READYSTATECHANGE
, &v
);
1544 static HRESULT WINAPI
HTMLDocument_get_onreadystatechange(IHTMLDocument2
*iface
, VARIANT
*p
)
1546 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1548 TRACE("(%p)->(%p)\n", This
, p
);
1550 return get_doc_event(This
, EVENTID_READYSTATECHANGE
, p
);
1553 static HRESULT WINAPI
HTMLDocument_put_onafterupdate(IHTMLDocument2
*iface
, VARIANT v
)
1555 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1556 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1560 static HRESULT WINAPI
HTMLDocument_get_onafterupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1562 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1563 FIXME("(%p)->(%p)\n", This
, p
);
1567 static HRESULT WINAPI
HTMLDocument_put_onrowexit(IHTMLDocument2
*iface
, VARIANT v
)
1569 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1570 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1574 static HRESULT WINAPI
HTMLDocument_get_onrowexit(IHTMLDocument2
*iface
, VARIANT
*p
)
1576 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1577 FIXME("(%p)->(%p)\n", This
, p
);
1581 static HRESULT WINAPI
HTMLDocument_put_onrowenter(IHTMLDocument2
*iface
, VARIANT v
)
1583 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1584 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1588 static HRESULT WINAPI
HTMLDocument_get_onrowenter(IHTMLDocument2
*iface
, VARIANT
*p
)
1590 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1591 FIXME("(%p)->(%p)\n", This
, p
);
1595 static HRESULT WINAPI
HTMLDocument_put_ondragstart(IHTMLDocument2
*iface
, VARIANT v
)
1597 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1599 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1601 return set_doc_event(This
, EVENTID_DRAGSTART
, &v
);
1604 static HRESULT WINAPI
HTMLDocument_get_ondragstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1606 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1608 TRACE("(%p)->(%p)\n", This
, p
);
1610 return get_doc_event(This
, EVENTID_DRAGSTART
, p
);
1613 static HRESULT WINAPI
HTMLDocument_put_onselectstart(IHTMLDocument2
*iface
, VARIANT v
)
1615 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1617 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1619 return set_doc_event(This
, EVENTID_SELECTSTART
, &v
);
1622 static HRESULT WINAPI
HTMLDocument_get_onselectstart(IHTMLDocument2
*iface
, VARIANT
*p
)
1624 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1626 TRACE("(%p)->(%p)\n", This
, p
);
1628 return get_doc_event(This
, EVENTID_SELECTSTART
, p
);
1631 static HRESULT WINAPI
HTMLDocument_elementFromPoint(IHTMLDocument2
*iface
, LONG x
, LONG y
,
1632 IHTMLElement
**elementHit
)
1634 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1635 nsIDOMElement
*nselem
;
1636 HTMLElement
*element
;
1640 TRACE("(%p)->(%d %d %p)\n", This
, x
, y
, elementHit
);
1642 nsres
= nsIDOMHTMLDocument_ElementFromPoint(This
->doc_node
->nsdoc
, x
, y
, &nselem
);
1643 if(NS_FAILED(nsres
)) {
1644 ERR("ElementFromPoint failed: %08x\n", nsres
);
1653 hres
= get_element(nselem
, &element
);
1654 nsIDOMElement_Release(nselem
);
1658 *elementHit
= &element
->IHTMLElement_iface
;
1662 static HRESULT WINAPI
HTMLDocument_get_parentWindow(IHTMLDocument2
*iface
, IHTMLWindow2
**p
)
1664 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1667 TRACE("(%p)->(%p)\n", This
, p
);
1669 hres
= IHTMLDocument7_get_defaultView(&This
->IHTMLDocument7_iface
, p
);
1670 return hres
== S_OK
&& !*p
? E_FAIL
: hres
;
1673 static HRESULT WINAPI
HTMLDocument_get_styleSheets(IHTMLDocument2
*iface
,
1674 IHTMLStyleSheetsCollection
**p
)
1676 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1677 nsIDOMStyleSheetList
*nsstylelist
;
1680 TRACE("(%p)->(%p)\n", This
, p
);
1684 if(!This
->doc_node
->nsdoc
) {
1685 WARN("NULL nsdoc\n");
1686 return E_UNEXPECTED
;
1689 nsres
= nsIDOMHTMLDocument_GetStyleSheets(This
->doc_node
->nsdoc
, &nsstylelist
);
1690 if(NS_FAILED(nsres
)) {
1691 ERR("GetStyleSheets failed: %08x\n", nsres
);
1695 *p
= HTMLStyleSheetsCollection_Create(nsstylelist
);
1696 nsIDOMStyleSheetList_Release(nsstylelist
);
1701 static HRESULT WINAPI
HTMLDocument_put_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT v
)
1703 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1704 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1708 static HRESULT WINAPI
HTMLDocument_get_onbeforeupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1710 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1711 FIXME("(%p)->(%p)\n", This
, p
);
1715 static HRESULT WINAPI
HTMLDocument_put_onerrorupdate(IHTMLDocument2
*iface
, VARIANT v
)
1717 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1718 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1722 static HRESULT WINAPI
HTMLDocument_get_onerrorupdate(IHTMLDocument2
*iface
, VARIANT
*p
)
1724 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1725 FIXME("(%p)->(%p)\n", This
, p
);
1729 static HRESULT WINAPI
HTMLDocument_toString(IHTMLDocument2
*iface
, BSTR
*String
)
1731 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1733 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
1735 TRACE("(%p)->(%p)\n", This
, String
);
1738 return E_INVALIDARG
;
1740 *String
= SysAllocString(objectW
);
1741 return *String
? S_OK
: E_OUTOFMEMORY
;
1745 static HRESULT WINAPI
HTMLDocument_createStyleSheet(IHTMLDocument2
*iface
, BSTR bstrHref
,
1746 LONG lIndex
, IHTMLStyleSheet
**ppnewStyleSheet
)
1748 HTMLDocument
*This
= impl_from_IHTMLDocument2(iface
);
1749 nsIDOMHTMLHeadElement
*head_elem
;
1750 IHTMLStyleElement
*style_elem
;
1755 static const WCHAR styleW
[] = {'s','t','y','l','e',0};
1757 TRACE("(%p)->(%s %d %p)\n", This
, debugstr_w(bstrHref
), lIndex
, ppnewStyleSheet
);
1759 if(!This
->doc_node
->nsdoc
) {
1760 FIXME("not a real doc object\n");
1765 FIXME("Unsupported lIndex %d\n", lIndex
);
1767 if(bstrHref
&& *bstrHref
) {
1768 FIXME("semi-stub for href %s\n", debugstr_w(bstrHref
));
1769 *ppnewStyleSheet
= HTMLStyleSheet_Create(NULL
);
1773 hres
= create_element(This
->doc_node
, styleW
, &elem
);
1777 nsres
= nsIDOMHTMLDocument_GetHead(This
->doc_node
->nsdoc
, &head_elem
);
1778 if(NS_SUCCEEDED(nsres
)) {
1779 nsIDOMNode
*head_node
, *tmp_node
;
1781 nsres
= nsIDOMHTMLHeadElement_QueryInterface(head_elem
, &IID_nsIDOMNode
, (void**)&head_node
);
1782 nsIDOMHTMLHeadElement_Release(head_elem
);
1783 assert(nsres
== NS_OK
);
1785 nsres
= nsIDOMNode_AppendChild(head_node
, elem
->node
.nsnode
, &tmp_node
);
1786 nsIDOMNode_Release(head_node
);
1787 if(NS_SUCCEEDED(nsres
) && tmp_node
)
1788 nsIDOMNode_Release(tmp_node
);
1790 if(NS_FAILED(nsres
)) {
1791 IHTMLElement_Release(&elem
->IHTMLElement_iface
);
1795 hres
= IHTMLElement_QueryInterface(&elem
->IHTMLElement_iface
, &IID_IHTMLStyleElement
, (void**)&style_elem
);
1796 assert(hres
== S_OK
);
1797 IHTMLElement_Release(&elem
->IHTMLElement_iface
);
1799 hres
= IHTMLStyleElement_get_styleSheet(style_elem
, ppnewStyleSheet
);
1800 IHTMLStyleElement_Release(style_elem
);
1804 static const IHTMLDocument2Vtbl HTMLDocumentVtbl
= {
1805 HTMLDocument_QueryInterface
,
1806 HTMLDocument_AddRef
,
1807 HTMLDocument_Release
,
1808 HTMLDocument_GetTypeInfoCount
,
1809 HTMLDocument_GetTypeInfo
,
1810 HTMLDocument_GetIDsOfNames
,
1811 HTMLDocument_Invoke
,
1812 HTMLDocument_get_Script
,
1813 HTMLDocument_get_all
,
1814 HTMLDocument_get_body
,
1815 HTMLDocument_get_activeElement
,
1816 HTMLDocument_get_images
,
1817 HTMLDocument_get_applets
,
1818 HTMLDocument_get_links
,
1819 HTMLDocument_get_forms
,
1820 HTMLDocument_get_anchors
,
1821 HTMLDocument_put_title
,
1822 HTMLDocument_get_title
,
1823 HTMLDocument_get_scripts
,
1824 HTMLDocument_put_designMode
,
1825 HTMLDocument_get_designMode
,
1826 HTMLDocument_get_selection
,
1827 HTMLDocument_get_readyState
,
1828 HTMLDocument_get_frames
,
1829 HTMLDocument_get_embeds
,
1830 HTMLDocument_get_plugins
,
1831 HTMLDocument_put_alinkColor
,
1832 HTMLDocument_get_alinkColor
,
1833 HTMLDocument_put_bgColor
,
1834 HTMLDocument_get_bgColor
,
1835 HTMLDocument_put_fgColor
,
1836 HTMLDocument_get_fgColor
,
1837 HTMLDocument_put_linkColor
,
1838 HTMLDocument_get_linkColor
,
1839 HTMLDocument_put_vlinkColor
,
1840 HTMLDocument_get_vlinkColor
,
1841 HTMLDocument_get_referrer
,
1842 HTMLDocument_get_location
,
1843 HTMLDocument_get_lastModified
,
1844 HTMLDocument_put_URL
,
1845 HTMLDocument_get_URL
,
1846 HTMLDocument_put_domain
,
1847 HTMLDocument_get_domain
,
1848 HTMLDocument_put_cookie
,
1849 HTMLDocument_get_cookie
,
1850 HTMLDocument_put_expando
,
1851 HTMLDocument_get_expando
,
1852 HTMLDocument_put_charset
,
1853 HTMLDocument_get_charset
,
1854 HTMLDocument_put_defaultCharset
,
1855 HTMLDocument_get_defaultCharset
,
1856 HTMLDocument_get_mimeType
,
1857 HTMLDocument_get_fileSize
,
1858 HTMLDocument_get_fileCreatedDate
,
1859 HTMLDocument_get_fileModifiedDate
,
1860 HTMLDocument_get_fileUpdatedDate
,
1861 HTMLDocument_get_security
,
1862 HTMLDocument_get_protocol
,
1863 HTMLDocument_get_nameProp
,
1865 HTMLDocument_writeln
,
1869 HTMLDocument_queryCommandSupported
,
1870 HTMLDocument_queryCommandEnabled
,
1871 HTMLDocument_queryCommandState
,
1872 HTMLDocument_queryCommandIndeterm
,
1873 HTMLDocument_queryCommandText
,
1874 HTMLDocument_queryCommandValue
,
1875 HTMLDocument_execCommand
,
1876 HTMLDocument_execCommandShowHelp
,
1877 HTMLDocument_createElement
,
1878 HTMLDocument_put_onhelp
,
1879 HTMLDocument_get_onhelp
,
1880 HTMLDocument_put_onclick
,
1881 HTMLDocument_get_onclick
,
1882 HTMLDocument_put_ondblclick
,
1883 HTMLDocument_get_ondblclick
,
1884 HTMLDocument_put_onkeyup
,
1885 HTMLDocument_get_onkeyup
,
1886 HTMLDocument_put_onkeydown
,
1887 HTMLDocument_get_onkeydown
,
1888 HTMLDocument_put_onkeypress
,
1889 HTMLDocument_get_onkeypress
,
1890 HTMLDocument_put_onmouseup
,
1891 HTMLDocument_get_onmouseup
,
1892 HTMLDocument_put_onmousedown
,
1893 HTMLDocument_get_onmousedown
,
1894 HTMLDocument_put_onmousemove
,
1895 HTMLDocument_get_onmousemove
,
1896 HTMLDocument_put_onmouseout
,
1897 HTMLDocument_get_onmouseout
,
1898 HTMLDocument_put_onmouseover
,
1899 HTMLDocument_get_onmouseover
,
1900 HTMLDocument_put_onreadystatechange
,
1901 HTMLDocument_get_onreadystatechange
,
1902 HTMLDocument_put_onafterupdate
,
1903 HTMLDocument_get_onafterupdate
,
1904 HTMLDocument_put_onrowexit
,
1905 HTMLDocument_get_onrowexit
,
1906 HTMLDocument_put_onrowenter
,
1907 HTMLDocument_get_onrowenter
,
1908 HTMLDocument_put_ondragstart
,
1909 HTMLDocument_get_ondragstart
,
1910 HTMLDocument_put_onselectstart
,
1911 HTMLDocument_get_onselectstart
,
1912 HTMLDocument_elementFromPoint
,
1913 HTMLDocument_get_parentWindow
,
1914 HTMLDocument_get_styleSheets
,
1915 HTMLDocument_put_onbeforeupdate
,
1916 HTMLDocument_get_onbeforeupdate
,
1917 HTMLDocument_put_onerrorupdate
,
1918 HTMLDocument_get_onerrorupdate
,
1919 HTMLDocument_toString
,
1920 HTMLDocument_createStyleSheet
1923 static inline HTMLDocument
*impl_from_IHTMLDocument3(IHTMLDocument3
*iface
)
1925 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument3_iface
);
1928 static HRESULT WINAPI
HTMLDocument3_QueryInterface(IHTMLDocument3
*iface
,
1929 REFIID riid
, void **ppv
)
1931 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1932 return htmldoc_query_interface(This
, riid
, ppv
);
1935 static ULONG WINAPI
HTMLDocument3_AddRef(IHTMLDocument3
*iface
)
1937 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1938 return htmldoc_addref(This
);
1941 static ULONG WINAPI
HTMLDocument3_Release(IHTMLDocument3
*iface
)
1943 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1944 return htmldoc_release(This
);
1947 static HRESULT WINAPI
HTMLDocument3_GetTypeInfoCount(IHTMLDocument3
*iface
, UINT
*pctinfo
)
1949 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1950 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1953 static HRESULT WINAPI
HTMLDocument3_GetTypeInfo(IHTMLDocument3
*iface
, UINT iTInfo
,
1954 LCID lcid
, ITypeInfo
**ppTInfo
)
1956 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1957 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1960 static HRESULT WINAPI
HTMLDocument3_GetIDsOfNames(IHTMLDocument3
*iface
, REFIID riid
,
1961 LPOLESTR
*rgszNames
, UINT cNames
,
1962 LCID lcid
, DISPID
*rgDispId
)
1964 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1965 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1969 static HRESULT WINAPI
HTMLDocument3_Invoke(IHTMLDocument3
*iface
, DISPID dispIdMember
,
1970 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1971 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1973 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1974 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1975 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1978 static HRESULT WINAPI
HTMLDocument3_releaseCapture(IHTMLDocument3
*iface
)
1980 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1981 FIXME("(%p)\n", This
);
1985 static HRESULT WINAPI
HTMLDocument3_recalc(IHTMLDocument3
*iface
, VARIANT_BOOL fForce
)
1987 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
1989 WARN("(%p)->(%x)\n", This
, fForce
);
1991 /* Doing nothing here should be fine for us. */
1995 static HRESULT WINAPI
HTMLDocument3_createTextNode(IHTMLDocument3
*iface
, BSTR text
,
1996 IHTMLDOMNode
**newTextNode
)
1998 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2005 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(text
), newTextNode
);
2007 if(!This
->doc_node
->nsdoc
) {
2008 WARN("NULL nsdoc\n");
2009 return E_UNEXPECTED
;
2012 nsAString_InitDepend(&text_str
, text
);
2013 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->doc_node
->nsdoc
, &text_str
, &nstext
);
2014 nsAString_Finish(&text_str
);
2015 if(NS_FAILED(nsres
)) {
2016 ERR("CreateTextNode failed: %08x\n", nsres
);
2020 hres
= HTMLDOMTextNode_Create(This
->doc_node
, (nsIDOMNode
*)nstext
, &node
);
2021 nsIDOMText_Release(nstext
);
2025 *newTextNode
= &node
->IHTMLDOMNode_iface
;
2029 static HRESULT WINAPI
HTMLDocument3_get_documentElement(IHTMLDocument3
*iface
, IHTMLElement
**p
)
2031 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2032 nsIDOMElement
*nselem
= NULL
;
2033 HTMLElement
*element
;
2037 TRACE("(%p)->(%p)\n", This
, p
);
2039 if(This
->window
->readystate
== READYSTATE_UNINITIALIZED
) {
2044 if(!This
->doc_node
->nsdoc
) {
2045 WARN("NULL nsdoc\n");
2046 return E_UNEXPECTED
;
2049 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->doc_node
->nsdoc
, &nselem
);
2050 if(NS_FAILED(nsres
)) {
2051 ERR("GetDocumentElement failed: %08x\n", nsres
);
2060 hres
= get_element(nselem
, &element
);
2061 nsIDOMElement_Release(nselem
);
2065 *p
= &element
->IHTMLElement_iface
;
2069 static HRESULT WINAPI
HTMLDocument3_get_uniqueID(IHTMLDocument3
*iface
, BSTR
*p
)
2071 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2073 TRACE("(%p)->(%p)\n", This
, p
);
2075 return elem_unique_id(++This
->doc_node
->unique_id
, p
);
2078 static HRESULT WINAPI
HTMLDocument3_attachEvent(IHTMLDocument3
*iface
, BSTR event
,
2079 IDispatch
* pDisp
, VARIANT_BOOL
*pfResult
)
2081 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2083 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
2085 return attach_event(&This
->doc_node
->node
.event_target
, event
, pDisp
, pfResult
);
2088 static HRESULT WINAPI
HTMLDocument3_detachEvent(IHTMLDocument3
*iface
, BSTR event
,
2091 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2093 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(event
), pDisp
);
2095 return detach_event(&This
->doc_node
->node
.event_target
, event
, pDisp
);
2098 static HRESULT WINAPI
HTMLDocument3_put_onrowsdelete(IHTMLDocument3
*iface
, VARIANT v
)
2100 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2101 FIXME("(%p)->()\n", This
);
2105 static HRESULT WINAPI
HTMLDocument3_get_onrowsdelete(IHTMLDocument3
*iface
, VARIANT
*p
)
2107 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2108 FIXME("(%p)->(%p)\n", This
, p
);
2112 static HRESULT WINAPI
HTMLDocument3_put_onrowsinserted(IHTMLDocument3
*iface
, VARIANT v
)
2114 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2115 FIXME("(%p)->()\n", This
);
2119 static HRESULT WINAPI
HTMLDocument3_get_onrowsinserted(IHTMLDocument3
*iface
, VARIANT
*p
)
2121 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2122 FIXME("(%p)->(%p)\n", This
, p
);
2126 static HRESULT WINAPI
HTMLDocument3_put_oncellchange(IHTMLDocument3
*iface
, VARIANT v
)
2128 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2129 FIXME("(%p)->()\n", This
);
2133 static HRESULT WINAPI
HTMLDocument3_get_oncellchange(IHTMLDocument3
*iface
, VARIANT
*p
)
2135 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2136 FIXME("(%p)->(%p)\n", This
, p
);
2140 static HRESULT WINAPI
HTMLDocument3_put_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT v
)
2142 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2143 FIXME("(%p)->()\n", This
);
2147 static HRESULT WINAPI
HTMLDocument3_get_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT
*p
)
2149 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2150 FIXME("(%p)->(%p)\n", This
, p
);
2154 static HRESULT WINAPI
HTMLDocument3_put_ondataavailable(IHTMLDocument3
*iface
, VARIANT v
)
2156 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2157 FIXME("(%p)->()\n", This
);
2161 static HRESULT WINAPI
HTMLDocument3_get_ondataavailable(IHTMLDocument3
*iface
, VARIANT
*p
)
2163 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2164 FIXME("(%p)->(%p)\n", This
, p
);
2168 static HRESULT WINAPI
HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT v
)
2170 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2171 FIXME("(%p)->()\n", This
);
2175 static HRESULT WINAPI
HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT
*p
)
2177 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2178 FIXME("(%p)->(%p)\n", This
, p
);
2182 static HRESULT WINAPI
HTMLDocument3_put_onpropertychange(IHTMLDocument3
*iface
, VARIANT v
)
2184 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2185 FIXME("(%p)->()\n", This
);
2189 static HRESULT WINAPI
HTMLDocument3_get_onpropertychange(IHTMLDocument3
*iface
, VARIANT
*p
)
2191 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2192 FIXME("(%p)->(%p)\n", This
, p
);
2196 static HRESULT WINAPI
HTMLDocument3_put_dir(IHTMLDocument3
*iface
, BSTR v
)
2198 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2202 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
2204 if(!This
->doc_node
->nsdoc
) {
2205 FIXME("NULL nsdoc\n");
2206 return E_UNEXPECTED
;
2209 nsAString_InitDepend(&dir_str
, v
);
2210 nsres
= nsIDOMHTMLDocument_SetDir(This
->doc_node
->nsdoc
, &dir_str
);
2211 nsAString_Finish(&dir_str
);
2212 if(NS_FAILED(nsres
)) {
2213 ERR("SetDir failed: %08x\n", nsres
);
2220 static HRESULT WINAPI
HTMLDocument3_get_dir(IHTMLDocument3
*iface
, BSTR
*p
)
2222 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2226 TRACE("(%p)->(%p)\n", This
, p
);
2228 if(!This
->doc_node
->nsdoc
) {
2229 FIXME("NULL nsdoc\n");
2230 return E_UNEXPECTED
;
2233 nsAString_Init(&dir_str
, NULL
);
2234 nsres
= nsIDOMHTMLDocument_GetDir(This
->doc_node
->nsdoc
, &dir_str
);
2235 return return_nsstr(nsres
, &dir_str
, p
);
2238 static HRESULT WINAPI
HTMLDocument3_put_oncontextmenu(IHTMLDocument3
*iface
, VARIANT v
)
2240 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2242 TRACE("(%p)->()\n", This
);
2244 return set_doc_event(This
, EVENTID_CONTEXTMENU
, &v
);
2247 static HRESULT WINAPI
HTMLDocument3_get_oncontextmenu(IHTMLDocument3
*iface
, VARIANT
*p
)
2249 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2251 TRACE("(%p)->(%p)\n", This
, p
);
2253 return get_doc_event(This
, EVENTID_CONTEXTMENU
, p
);
2256 static HRESULT WINAPI
HTMLDocument3_put_onstop(IHTMLDocument3
*iface
, VARIANT v
)
2258 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2259 FIXME("(%p)->()\n", This
);
2263 static HRESULT WINAPI
HTMLDocument3_get_onstop(IHTMLDocument3
*iface
, VARIANT
*p
)
2265 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2266 FIXME("(%p)->(%p)\n", This
, p
);
2270 static HRESULT WINAPI
HTMLDocument3_createDocumentFragment(IHTMLDocument3
*iface
,
2271 IHTMLDocument2
**ppNewDoc
)
2273 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2274 nsIDOMDocumentFragment
*doc_frag
;
2275 HTMLDocumentNode
*docnode
;
2279 TRACE("(%p)->(%p)\n", This
, ppNewDoc
);
2281 if(!This
->doc_node
->nsdoc
) {
2282 FIXME("NULL nsdoc\n");
2286 nsres
= nsIDOMHTMLDocument_CreateDocumentFragment(This
->doc_node
->nsdoc
, &doc_frag
);
2287 if(NS_FAILED(nsres
)) {
2288 ERR("CreateDocumentFragment failed: %08x\n", nsres
);
2292 hres
= create_document_fragment((nsIDOMNode
*)doc_frag
, This
->doc_node
, &docnode
);
2293 nsIDOMDocumentFragment_Release(doc_frag
);
2297 *ppNewDoc
= &docnode
->basedoc
.IHTMLDocument2_iface
;
2301 static HRESULT WINAPI
HTMLDocument3_get_parentDocument(IHTMLDocument3
*iface
,
2304 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2305 FIXME("(%p)->(%p)\n", This
, p
);
2309 static HRESULT WINAPI
HTMLDocument3_put_enableDownload(IHTMLDocument3
*iface
,
2312 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2313 FIXME("(%p)->(%x)\n", This
, v
);
2317 static HRESULT WINAPI
HTMLDocument3_get_enableDownload(IHTMLDocument3
*iface
,
2320 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2321 FIXME("(%p)->(%p)\n", This
, p
);
2325 static HRESULT WINAPI
HTMLDocument3_put_baseUrl(IHTMLDocument3
*iface
, BSTR v
)
2327 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2328 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2332 static HRESULT WINAPI
HTMLDocument3_get_baseUrl(IHTMLDocument3
*iface
, BSTR
*p
)
2334 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2335 FIXME("(%p)->(%p)\n", This
, p
);
2339 static HRESULT WINAPI
HTMLDocument3_get_childNodes(IHTMLDocument3
*iface
, IDispatch
**p
)
2341 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2343 TRACE("(%p)->(%p)\n", This
, p
);
2345 return IHTMLDOMNode_get_childNodes(&This
->doc_node
->node
.IHTMLDOMNode_iface
, p
);
2348 static HRESULT WINAPI
HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3
*iface
,
2351 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2352 FIXME("(%p)->()\n", This
);
2356 static HRESULT WINAPI
HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3
*iface
,
2359 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2360 FIXME("(%p)->(%p)\n", This
, p
);
2364 static HRESULT WINAPI
HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT v
)
2366 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2367 FIXME("(%p)->()\n", This
);
2371 static HRESULT WINAPI
HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT
*p
)
2373 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2374 FIXME("(%p)->(%p)\n", This
, p
);
2378 static HRESULT WINAPI
HTMLDocument3_getElementsByName(IHTMLDocument3
*iface
, BSTR v
,
2379 IHTMLElementCollection
**ppelColl
)
2381 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2382 nsIDOMNodeList
*node_list
;
2383 nsAString selector_str
;
2387 static const WCHAR formatW
[] = {'*','[','i','d','=','%','s',']',',','*','[','n','a','m','e','=','%','s',']',0};
2389 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppelColl
);
2391 if(!This
->doc_node
|| !This
->doc_node
->nsdoc
) {
2392 /* We should probably return an empty collection. */
2393 FIXME("No nsdoc\n");
2397 selector
= heap_alloc(2*SysStringLen(v
)*sizeof(WCHAR
) + sizeof(formatW
));
2399 return E_OUTOFMEMORY
;
2400 swprintf(selector
, 2*SysStringLen(v
) + ARRAY_SIZE(formatW
), formatW
, v
, v
);
2403 * NOTE: IE getElementsByName implementation differs from Gecko. It searches both name and id attributes.
2404 * That's why we use CSS selector instead. We should also use name only when it applies to given element
2405 * types and search should be case insensitive. Those are currently not supported properly.
2407 nsAString_InitDepend(&selector_str
, selector
);
2408 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->doc_node
->nsdoc
, &selector_str
, &node_list
);
2409 nsAString_Finish(&selector_str
);
2410 heap_free(selector
);
2411 if(NS_FAILED(nsres
)) {
2412 ERR("QuerySelectorAll failed: %08x\n", nsres
);
2416 *ppelColl
= create_collection_from_nodelist(node_list
, This
->doc_node
->document_mode
);
2417 nsIDOMNodeList_Release(node_list
);
2422 static HRESULT WINAPI
HTMLDocument3_getElementById(IHTMLDocument3
*iface
, BSTR v
,
2425 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2429 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
2431 hres
= get_doc_elem_by_id(This
->doc_node
, v
, &elem
);
2432 if(FAILED(hres
) || !elem
) {
2437 *pel
= &elem
->IHTMLElement_iface
;
2442 static HRESULT WINAPI
HTMLDocument3_getElementsByTagName(IHTMLDocument3
*iface
, BSTR v
,
2443 IHTMLElementCollection
**pelColl
)
2445 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
2446 nsIDOMNodeList
*nslist
;
2450 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
2452 if(This
->doc_node
->nsdoc
) {
2453 nsAString_InitDepend(&id_str
, v
);
2454 nsres
= nsIDOMHTMLDocument_GetElementsByTagName(This
->doc_node
->nsdoc
, &id_str
, &nslist
);
2455 nsAString_Finish(&id_str
);
2457 ERR("GetElementByName failed: %08x\n", nsres
);
2461 nsIDOMDocumentFragment
*docfrag
;
2466 for(ptr
=v
; *ptr
; ptr
++) {
2467 if(!iswalnum(*ptr
)) {
2468 FIXME("Unsupported invalid tag %s\n", debugstr_w(v
));
2474 nsres
= nsIDOMNode_QueryInterface(This
->doc_node
->node
.nsnode
, &IID_nsIDOMDocumentFragment
, (void**)&docfrag
);
2475 if(NS_FAILED(nsres
)) {
2476 ERR("Could not get nsIDOMDocumentFragment iface: %08x\n", nsres
);
2477 return E_UNEXPECTED
;
2480 nsAString_InitDepend(&nsstr
, v
);
2481 nsres
= nsIDOMDocumentFragment_QuerySelectorAll(docfrag
, &nsstr
, &nslist
);
2482 nsAString_Finish(&nsstr
);
2483 nsIDOMDocumentFragment_Release(docfrag
);
2484 if(NS_FAILED(nsres
)) {
2485 ERR("QuerySelectorAll failed: %08x\n", nsres
);
2491 *pelColl
= create_collection_from_nodelist(nslist
, This
->doc_node
->document_mode
);
2492 nsIDOMNodeList_Release(nslist
);
2497 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl
= {
2498 HTMLDocument3_QueryInterface
,
2499 HTMLDocument3_AddRef
,
2500 HTMLDocument3_Release
,
2501 HTMLDocument3_GetTypeInfoCount
,
2502 HTMLDocument3_GetTypeInfo
,
2503 HTMLDocument3_GetIDsOfNames
,
2504 HTMLDocument3_Invoke
,
2505 HTMLDocument3_releaseCapture
,
2506 HTMLDocument3_recalc
,
2507 HTMLDocument3_createTextNode
,
2508 HTMLDocument3_get_documentElement
,
2509 HTMLDocument3_get_uniqueID
,
2510 HTMLDocument3_attachEvent
,
2511 HTMLDocument3_detachEvent
,
2512 HTMLDocument3_put_onrowsdelete
,
2513 HTMLDocument3_get_onrowsdelete
,
2514 HTMLDocument3_put_onrowsinserted
,
2515 HTMLDocument3_get_onrowsinserted
,
2516 HTMLDocument3_put_oncellchange
,
2517 HTMLDocument3_get_oncellchange
,
2518 HTMLDocument3_put_ondatasetchanged
,
2519 HTMLDocument3_get_ondatasetchanged
,
2520 HTMLDocument3_put_ondataavailable
,
2521 HTMLDocument3_get_ondataavailable
,
2522 HTMLDocument3_put_ondatasetcomplete
,
2523 HTMLDocument3_get_ondatasetcomplete
,
2524 HTMLDocument3_put_onpropertychange
,
2525 HTMLDocument3_get_onpropertychange
,
2526 HTMLDocument3_put_dir
,
2527 HTMLDocument3_get_dir
,
2528 HTMLDocument3_put_oncontextmenu
,
2529 HTMLDocument3_get_oncontextmenu
,
2530 HTMLDocument3_put_onstop
,
2531 HTMLDocument3_get_onstop
,
2532 HTMLDocument3_createDocumentFragment
,
2533 HTMLDocument3_get_parentDocument
,
2534 HTMLDocument3_put_enableDownload
,
2535 HTMLDocument3_get_enableDownload
,
2536 HTMLDocument3_put_baseUrl
,
2537 HTMLDocument3_get_baseUrl
,
2538 HTMLDocument3_get_childNodes
,
2539 HTMLDocument3_put_inheritStyleSheets
,
2540 HTMLDocument3_get_inheritStyleSheets
,
2541 HTMLDocument3_put_onbeforeeditfocus
,
2542 HTMLDocument3_get_onbeforeeditfocus
,
2543 HTMLDocument3_getElementsByName
,
2544 HTMLDocument3_getElementById
,
2545 HTMLDocument3_getElementsByTagName
2548 static inline HTMLDocument
*impl_from_IHTMLDocument4(IHTMLDocument4
*iface
)
2550 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument4_iface
);
2553 static HRESULT WINAPI
HTMLDocument4_QueryInterface(IHTMLDocument4
*iface
,
2554 REFIID riid
, void **ppv
)
2556 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2557 return htmldoc_query_interface(This
, riid
, ppv
);
2560 static ULONG WINAPI
HTMLDocument4_AddRef(IHTMLDocument4
*iface
)
2562 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2563 return htmldoc_addref(This
);
2566 static ULONG WINAPI
HTMLDocument4_Release(IHTMLDocument4
*iface
)
2568 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2569 return htmldoc_release(This
);
2572 static HRESULT WINAPI
HTMLDocument4_GetTypeInfoCount(IHTMLDocument4
*iface
, UINT
*pctinfo
)
2574 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2575 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2578 static HRESULT WINAPI
HTMLDocument4_GetTypeInfo(IHTMLDocument4
*iface
, UINT iTInfo
,
2579 LCID lcid
, ITypeInfo
**ppTInfo
)
2581 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2582 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2585 static HRESULT WINAPI
HTMLDocument4_GetIDsOfNames(IHTMLDocument4
*iface
, REFIID riid
,
2586 LPOLESTR
*rgszNames
, UINT cNames
,
2587 LCID lcid
, DISPID
*rgDispId
)
2589 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2590 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
2594 static HRESULT WINAPI
HTMLDocument4_Invoke(IHTMLDocument4
*iface
, DISPID dispIdMember
,
2595 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2596 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2598 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2599 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2600 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2603 static HRESULT WINAPI
HTMLDocument4_focus(IHTMLDocument4
*iface
)
2605 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2606 nsIDOMHTMLElement
*nsbody
;
2609 TRACE("(%p)->()\n", This
);
2611 nsres
= nsIDOMHTMLDocument_GetBody(This
->doc_node
->nsdoc
, &nsbody
);
2612 if(NS_FAILED(nsres
) || !nsbody
) {
2613 ERR("GetBody failed: %08x\n", nsres
);
2617 nsres
= nsIDOMHTMLElement_Focus(nsbody
);
2618 nsIDOMHTMLElement_Release(nsbody
);
2619 if(NS_FAILED(nsres
)) {
2620 ERR("Focus failed: %08x\n", nsres
);
2627 static HRESULT WINAPI
HTMLDocument4_hasFocus(IHTMLDocument4
*iface
, VARIANT_BOOL
*pfFocus
)
2629 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2633 TRACE("(%p)->(%p)\n", This
, pfFocus
);
2635 if(!This
->doc_node
->nsdoc
) {
2636 FIXME("Unimplemented for fragments.\n");
2640 nsres
= nsIDOMHTMLDocument_HasFocus(This
->doc_node
->nsdoc
, &has_focus
);
2641 assert(nsres
== NS_OK
);
2643 *pfFocus
= variant_bool(has_focus
);
2647 static HRESULT WINAPI
HTMLDocument4_put_onselectionchange(IHTMLDocument4
*iface
, VARIANT v
)
2649 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2651 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2653 return set_doc_event(This
, EVENTID_SELECTIONCHANGE
, &v
);
2656 static HRESULT WINAPI
HTMLDocument4_get_onselectionchange(IHTMLDocument4
*iface
, VARIANT
*p
)
2658 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2660 TRACE("(%p)->(%p)\n", This
, p
);
2662 return get_doc_event(This
, EVENTID_SELECTIONCHANGE
, p
);
2665 static HRESULT WINAPI
HTMLDocument4_get_namespaces(IHTMLDocument4
*iface
, IDispatch
**p
)
2667 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2669 TRACE("(%p)->(%p)\n", This
, p
);
2671 if(!This
->doc_node
->namespaces
) {
2674 hres
= create_namespace_collection(&This
->doc_node
->namespaces
);
2679 IHTMLNamespaceCollection_AddRef(This
->doc_node
->namespaces
);
2680 *p
= (IDispatch
*)This
->doc_node
->namespaces
;
2684 static HRESULT WINAPI
HTMLDocument4_createDocumentFromUrl(IHTMLDocument4
*iface
, BSTR bstrUrl
,
2685 BSTR bstrOptions
, IHTMLDocument2
**newDoc
)
2687 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2688 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrUrl
), debugstr_w(bstrOptions
), newDoc
);
2692 static HRESULT WINAPI
HTMLDocument4_put_media(IHTMLDocument4
*iface
, BSTR v
)
2694 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2695 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
2699 static HRESULT WINAPI
HTMLDocument4_get_media(IHTMLDocument4
*iface
, BSTR
*p
)
2701 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2702 FIXME("(%p)->(%p)\n", This
, p
);
2706 static HRESULT WINAPI
HTMLDocument4_createEventObject(IHTMLDocument4
*iface
,
2707 VARIANT
*pvarEventObject
, IHTMLEventObj
**ppEventObj
)
2709 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2711 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(pvarEventObject
), ppEventObj
);
2713 if(pvarEventObject
&& V_VT(pvarEventObject
) != VT_ERROR
&& V_VT(pvarEventObject
) != VT_EMPTY
) {
2714 FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject
));
2718 return create_event_obj(ppEventObj
);
2721 static HRESULT WINAPI
HTMLDocument4_fireEvent(IHTMLDocument4
*iface
, BSTR bstrEventName
,
2722 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCanceled
)
2724 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2726 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrEventName
), pvarEventObject
, pfCanceled
);
2728 return fire_event(&This
->doc_node
->node
, bstrEventName
, pvarEventObject
, pfCanceled
);
2731 static HRESULT WINAPI
HTMLDocument4_createRenderStyle(IHTMLDocument4
*iface
, BSTR v
,
2732 IHTMLRenderStyle
**ppIHTMLRenderStyle
)
2734 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2735 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppIHTMLRenderStyle
);
2739 static HRESULT WINAPI
HTMLDocument4_put_oncontrolselect(IHTMLDocument4
*iface
, VARIANT v
)
2741 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2742 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2746 static HRESULT WINAPI
HTMLDocument4_get_oncontrolselect(IHTMLDocument4
*iface
, VARIANT
*p
)
2748 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2749 FIXME("(%p)->(%p)\n", This
, p
);
2753 static HRESULT WINAPI
HTMLDocument4_get_URLEncoded(IHTMLDocument4
*iface
, BSTR
*p
)
2755 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
2756 FIXME("(%p)->(%p)\n", This
, p
);
2760 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl
= {
2761 HTMLDocument4_QueryInterface
,
2762 HTMLDocument4_AddRef
,
2763 HTMLDocument4_Release
,
2764 HTMLDocument4_GetTypeInfoCount
,
2765 HTMLDocument4_GetTypeInfo
,
2766 HTMLDocument4_GetIDsOfNames
,
2767 HTMLDocument4_Invoke
,
2768 HTMLDocument4_focus
,
2769 HTMLDocument4_hasFocus
,
2770 HTMLDocument4_put_onselectionchange
,
2771 HTMLDocument4_get_onselectionchange
,
2772 HTMLDocument4_get_namespaces
,
2773 HTMLDocument4_createDocumentFromUrl
,
2774 HTMLDocument4_put_media
,
2775 HTMLDocument4_get_media
,
2776 HTMLDocument4_createEventObject
,
2777 HTMLDocument4_fireEvent
,
2778 HTMLDocument4_createRenderStyle
,
2779 HTMLDocument4_put_oncontrolselect
,
2780 HTMLDocument4_get_oncontrolselect
,
2781 HTMLDocument4_get_URLEncoded
2784 static inline HTMLDocument
*impl_from_IHTMLDocument5(IHTMLDocument5
*iface
)
2786 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument5_iface
);
2789 static HRESULT WINAPI
HTMLDocument5_QueryInterface(IHTMLDocument5
*iface
,
2790 REFIID riid
, void **ppv
)
2792 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2793 return htmldoc_query_interface(This
, riid
, ppv
);
2796 static ULONG WINAPI
HTMLDocument5_AddRef(IHTMLDocument5
*iface
)
2798 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2799 return htmldoc_addref(This
);
2802 static ULONG WINAPI
HTMLDocument5_Release(IHTMLDocument5
*iface
)
2804 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2805 return htmldoc_release(This
);
2808 static HRESULT WINAPI
HTMLDocument5_GetTypeInfoCount(IHTMLDocument5
*iface
, UINT
*pctinfo
)
2810 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2811 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2814 static HRESULT WINAPI
HTMLDocument5_GetTypeInfo(IHTMLDocument5
*iface
, UINT iTInfo
,
2815 LCID lcid
, ITypeInfo
**ppTInfo
)
2817 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2818 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2821 static HRESULT WINAPI
HTMLDocument5_GetIDsOfNames(IHTMLDocument5
*iface
, REFIID riid
,
2822 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2824 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2825 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
2829 static HRESULT WINAPI
HTMLDocument5_Invoke(IHTMLDocument5
*iface
, DISPID dispIdMember
,
2830 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2831 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2833 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2834 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2835 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2838 static HRESULT WINAPI
HTMLDocument5_put_onmousewheel(IHTMLDocument5
*iface
, VARIANT v
)
2840 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2842 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2844 return set_doc_event(This
, EVENTID_MOUSEWHEEL
, &v
);
2847 static HRESULT WINAPI
HTMLDocument5_get_onmousewheel(IHTMLDocument5
*iface
, VARIANT
*p
)
2849 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2851 TRACE("(%p)->(%p)\n", This
, p
);
2853 return get_doc_event(This
, EVENTID_MOUSEWHEEL
, p
);
2856 static HRESULT WINAPI
HTMLDocument5_get_doctype(IHTMLDocument5
*iface
, IHTMLDOMNode
**p
)
2858 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2859 FIXME("(%p)->(%p)\n", This
, p
);
2863 static HRESULT WINAPI
HTMLDocument5_get_implementation(IHTMLDocument5
*iface
, IHTMLDOMImplementation
**p
)
2865 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2866 HTMLDocumentNode
*doc_node
= This
->doc_node
;
2868 TRACE("(%p)->(%p)\n", This
, p
);
2870 if(!doc_node
->dom_implementation
) {
2873 hres
= create_dom_implementation(doc_node
, &doc_node
->dom_implementation
);
2878 IHTMLDOMImplementation_AddRef(doc_node
->dom_implementation
);
2879 *p
= doc_node
->dom_implementation
;
2883 static HRESULT WINAPI
HTMLDocument5_createAttribute(IHTMLDocument5
*iface
, BSTR bstrattrName
,
2884 IHTMLDOMAttribute
**ppattribute
)
2886 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2887 HTMLDOMAttribute
*attr
;
2890 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrattrName
), ppattribute
);
2892 hres
= HTMLDOMAttribute_Create(bstrattrName
, NULL
, 0, &attr
);
2896 *ppattribute
= &attr
->IHTMLDOMAttribute_iface
;
2900 static HRESULT WINAPI
HTMLDocument5_createComment(IHTMLDocument5
*iface
, BSTR bstrdata
,
2901 IHTMLDOMNode
**ppRetNode
)
2903 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2904 nsIDOMComment
*nscomment
;
2910 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrdata
), ppRetNode
);
2912 if(!This
->doc_node
->nsdoc
) {
2913 WARN("NULL nsdoc\n");
2914 return E_UNEXPECTED
;
2917 nsAString_InitDepend(&str
, bstrdata
);
2918 nsres
= nsIDOMHTMLDocument_CreateComment(This
->doc_node
->nsdoc
, &str
, &nscomment
);
2919 nsAString_Finish(&str
);
2920 if(NS_FAILED(nsres
)) {
2921 ERR("CreateTextNode failed: %08x\n", nsres
);
2925 hres
= HTMLCommentElement_Create(This
->doc_node
, (nsIDOMNode
*)nscomment
, &elem
);
2926 nsIDOMComment_Release(nscomment
);
2930 *ppRetNode
= &elem
->node
.IHTMLDOMNode_iface
;
2934 static HRESULT WINAPI
HTMLDocument5_put_onfocusin(IHTMLDocument5
*iface
, VARIANT v
)
2936 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2938 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2940 return set_doc_event(This
, EVENTID_FOCUSIN
, &v
);
2943 static HRESULT WINAPI
HTMLDocument5_get_onfocusin(IHTMLDocument5
*iface
, VARIANT
*p
)
2945 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2947 TRACE("(%p)->(%p)\n", This
, p
);
2949 return get_doc_event(This
, EVENTID_FOCUSIN
, p
);
2952 static HRESULT WINAPI
HTMLDocument5_put_onfocusout(IHTMLDocument5
*iface
, VARIANT v
)
2954 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2956 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2958 return set_doc_event(This
, EVENTID_FOCUSOUT
, &v
);
2961 static HRESULT WINAPI
HTMLDocument5_get_onfocusout(IHTMLDocument5
*iface
, VARIANT
*p
)
2963 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2965 TRACE("(%p)->(%p)\n", This
, p
);
2967 return get_doc_event(This
, EVENTID_FOCUSOUT
, p
);
2970 static HRESULT WINAPI
HTMLDocument5_put_onactivate(IHTMLDocument5
*iface
, VARIANT v
)
2972 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2973 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2977 static HRESULT WINAPI
HTMLDocument5_get_onactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2979 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2980 FIXME("(%p)->(%p)\n", This
, p
);
2984 static HRESULT WINAPI
HTMLDocument5_put_ondeactivate(IHTMLDocument5
*iface
, VARIANT v
)
2986 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2987 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2991 static HRESULT WINAPI
HTMLDocument5_get_ondeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
2993 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
2994 FIXME("(%p)->(%p)\n", This
, p
);
2998 static HRESULT WINAPI
HTMLDocument5_put_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT v
)
3000 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
3001 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3005 static HRESULT WINAPI
HTMLDocument5_get_onbeforeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3007 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
3008 FIXME("(%p)->(%p)\n", This
, p
);
3012 static HRESULT WINAPI
HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT v
)
3014 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
3015 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3019 static HRESULT WINAPI
HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5
*iface
, VARIANT
*p
)
3021 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
3022 FIXME("(%p)->(%p)\n", This
, p
);
3026 static HRESULT WINAPI
HTMLDocument5_get_compatMode(IHTMLDocument5
*iface
, BSTR
*p
)
3028 HTMLDocument
*This
= impl_from_IHTMLDocument5(iface
);
3030 static const WCHAR BackCompatW
[] = {'B','a','c','k','C','o','m','p','a','t',0};
3031 static const WCHAR CSS1CompatW
[] = {'C','S','S','1','C','o','m','p','a','t',0};
3033 TRACE("(%p)->(%p)\n", This
, p
);
3035 *p
= SysAllocString(This
->doc_node
->document_mode
<= COMPAT_MODE_IE5
? BackCompatW
: CSS1CompatW
);
3036 return *p
? S_OK
: E_OUTOFMEMORY
;
3039 static const IHTMLDocument5Vtbl HTMLDocument5Vtbl
= {
3040 HTMLDocument5_QueryInterface
,
3041 HTMLDocument5_AddRef
,
3042 HTMLDocument5_Release
,
3043 HTMLDocument5_GetTypeInfoCount
,
3044 HTMLDocument5_GetTypeInfo
,
3045 HTMLDocument5_GetIDsOfNames
,
3046 HTMLDocument5_Invoke
,
3047 HTMLDocument5_put_onmousewheel
,
3048 HTMLDocument5_get_onmousewheel
,
3049 HTMLDocument5_get_doctype
,
3050 HTMLDocument5_get_implementation
,
3051 HTMLDocument5_createAttribute
,
3052 HTMLDocument5_createComment
,
3053 HTMLDocument5_put_onfocusin
,
3054 HTMLDocument5_get_onfocusin
,
3055 HTMLDocument5_put_onfocusout
,
3056 HTMLDocument5_get_onfocusout
,
3057 HTMLDocument5_put_onactivate
,
3058 HTMLDocument5_get_onactivate
,
3059 HTMLDocument5_put_ondeactivate
,
3060 HTMLDocument5_get_ondeactivate
,
3061 HTMLDocument5_put_onbeforeactivate
,
3062 HTMLDocument5_get_onbeforeactivate
,
3063 HTMLDocument5_put_onbeforedeactivate
,
3064 HTMLDocument5_get_onbeforedeactivate
,
3065 HTMLDocument5_get_compatMode
3068 static inline HTMLDocument
*impl_from_IHTMLDocument6(IHTMLDocument6
*iface
)
3070 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument6_iface
);
3073 static HRESULT WINAPI
HTMLDocument6_QueryInterface(IHTMLDocument6
*iface
,
3074 REFIID riid
, void **ppv
)
3076 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3077 return htmldoc_query_interface(This
, riid
, ppv
);
3080 static ULONG WINAPI
HTMLDocument6_AddRef(IHTMLDocument6
*iface
)
3082 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3083 return htmldoc_addref(This
);
3086 static ULONG WINAPI
HTMLDocument6_Release(IHTMLDocument6
*iface
)
3088 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3089 return htmldoc_release(This
);
3092 static HRESULT WINAPI
HTMLDocument6_GetTypeInfoCount(IHTMLDocument6
*iface
, UINT
*pctinfo
)
3094 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3095 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3098 static HRESULT WINAPI
HTMLDocument6_GetTypeInfo(IHTMLDocument6
*iface
, UINT iTInfo
,
3099 LCID lcid
, ITypeInfo
**ppTInfo
)
3101 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3102 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3105 static HRESULT WINAPI
HTMLDocument6_GetIDsOfNames(IHTMLDocument6
*iface
, REFIID riid
,
3106 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3108 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3109 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
3113 static HRESULT WINAPI
HTMLDocument6_Invoke(IHTMLDocument6
*iface
, DISPID dispIdMember
,
3114 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3115 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3117 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3118 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3119 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3122 static HRESULT WINAPI
HTMLDocument6_get_compatible(IHTMLDocument6
*iface
,
3123 IHTMLDocumentCompatibleInfoCollection
**p
)
3125 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3126 FIXME("(%p)->(%p)\n", This
, p
);
3130 static HRESULT WINAPI
HTMLDocument6_get_documentMode(IHTMLDocument6
*iface
, VARIANT
*p
)
3132 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3134 TRACE("(%p)->(%p)\n", This
, p
);
3136 if(!This
->doc_node
) {
3137 FIXME("NULL doc_node\n");
3138 return E_UNEXPECTED
;
3142 V_R4(p
) = compat_mode_info
[This
->doc_node
->document_mode
].document_mode
;
3146 static HRESULT WINAPI
HTMLDocument6_get_onstorage(IHTMLDocument6
*iface
,
3149 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3150 FIXME("(%p)->(%p)\n", This
, p
);
3154 static HRESULT WINAPI
HTMLDocument6_put_onstorage(IHTMLDocument6
*iface
, VARIANT v
)
3156 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3157 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3161 static HRESULT WINAPI
HTMLDocument6_get_onstoragecommit(IHTMLDocument6
*iface
,
3164 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3165 FIXME("(%p)->(%p)\n", This
, p
);
3169 static HRESULT WINAPI
HTMLDocument6_put_onstoragecommit(IHTMLDocument6
*iface
, VARIANT v
)
3171 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3172 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3176 static HRESULT WINAPI
HTMLDocument6_getElementById(IHTMLDocument6
*iface
,
3177 BSTR bstrId
, IHTMLElement2
**p
)
3179 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3180 nsIDOMElement
*nselem
;
3186 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrId
), p
);
3189 * Unlike IHTMLDocument3 implementation, this is standard compliant and does
3190 * not search for name attributes, so we may simply let Gecko do the right thing.
3193 if(!This
->doc_node
->nsdoc
) {
3194 FIXME("Not a document\n");
3198 nsAString_InitDepend(&nsstr
, bstrId
);
3199 nsres
= nsIDOMHTMLDocument_GetElementById(This
->doc_node
->nsdoc
, &nsstr
, &nselem
);
3200 nsAString_Finish(&nsstr
);
3201 if(NS_FAILED(nsres
)) {
3202 ERR("GetElementById failed: %08x\n", nsres
);
3211 hres
= get_element(nselem
, &elem
);
3212 nsIDOMElement_Release(nselem
);
3216 *p
= &elem
->IHTMLElement2_iface
;
3220 static HRESULT WINAPI
HTMLDocument6_updateSettings(IHTMLDocument6
*iface
)
3222 HTMLDocument
*This
= impl_from_IHTMLDocument6(iface
);
3223 FIXME("(%p)->()\n", This
);
3227 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl
= {
3228 HTMLDocument6_QueryInterface
,
3229 HTMLDocument6_AddRef
,
3230 HTMLDocument6_Release
,
3231 HTMLDocument6_GetTypeInfoCount
,
3232 HTMLDocument6_GetTypeInfo
,
3233 HTMLDocument6_GetIDsOfNames
,
3234 HTMLDocument6_Invoke
,
3235 HTMLDocument6_get_compatible
,
3236 HTMLDocument6_get_documentMode
,
3237 HTMLDocument6_put_onstorage
,
3238 HTMLDocument6_get_onstorage
,
3239 HTMLDocument6_put_onstoragecommit
,
3240 HTMLDocument6_get_onstoragecommit
,
3241 HTMLDocument6_getElementById
,
3242 HTMLDocument6_updateSettings
3245 static inline HTMLDocument
*impl_from_IHTMLDocument7(IHTMLDocument7
*iface
)
3247 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument7_iface
);
3250 static HRESULT WINAPI
HTMLDocument7_QueryInterface(IHTMLDocument7
*iface
, REFIID riid
, void **ppv
)
3252 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3253 return htmldoc_query_interface(This
, riid
, ppv
);
3256 static ULONG WINAPI
HTMLDocument7_AddRef(IHTMLDocument7
*iface
)
3258 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3259 return htmldoc_addref(This
);
3262 static ULONG WINAPI
HTMLDocument7_Release(IHTMLDocument7
*iface
)
3264 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3265 return htmldoc_release(This
);
3268 static HRESULT WINAPI
HTMLDocument7_GetTypeInfoCount(IHTMLDocument7
*iface
, UINT
*pctinfo
)
3270 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3271 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
3274 static HRESULT WINAPI
HTMLDocument7_GetTypeInfo(IHTMLDocument7
*iface
, UINT iTInfo
,
3275 LCID lcid
, ITypeInfo
**ppTInfo
)
3277 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3278 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
3281 static HRESULT WINAPI
HTMLDocument7_GetIDsOfNames(IHTMLDocument7
*iface
, REFIID riid
,
3282 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3284 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3285 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
3289 static HRESULT WINAPI
HTMLDocument7_Invoke(IHTMLDocument7
*iface
, DISPID dispIdMember
,
3290 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
3291 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3293 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3294 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
3295 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3298 static HRESULT WINAPI
HTMLDocument7_get_defaultView(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
3300 HTMLDocumentNode
*This
= impl_from_IHTMLDocument7(iface
)->doc_node
;
3302 TRACE("(%p)->(%p)\n", This
, p
);
3304 if(This
->window
&& This
->window
->base
.outer_window
) {
3305 *p
= &This
->window
->base
.outer_window
->base
.IHTMLWindow2_iface
;
3306 IHTMLWindow2_AddRef(*p
);
3313 static HRESULT WINAPI
HTMLDocument7_createCDATASection(IHTMLDocument7
*iface
, BSTR text
, IHTMLDOMNode
**newCDATASectionNode
)
3315 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3316 FIXME("(%p)->(%p)\n", This
, newCDATASectionNode
);
3320 static HRESULT WINAPI
HTMLDocument7_getSelection(IHTMLDocument7
*iface
, IHTMLSelection
**ppIHTMLSelection
)
3322 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3323 FIXME("(%p)->(%p)\n", This
, ppIHTMLSelection
);
3327 static HRESULT WINAPI
HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3328 BSTR bstrLocalName
, IHTMLElementCollection
**pelColl
)
3330 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3331 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrLocalName
), pelColl
);
3335 static HRESULT WINAPI
HTMLDocument7_createElementNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
, BSTR bstrTag
, IHTMLElement
**newElem
)
3337 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3338 nsIDOMElement
*dom_element
;
3339 HTMLElement
*element
;
3344 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrTag
), newElem
);
3346 if(!This
->doc_node
->nsdoc
) {
3347 FIXME("NULL nsdoc\n");
3351 if(pvarNS
&& V_VT(pvarNS
) != VT_NULL
&& V_VT(pvarNS
) != VT_BSTR
)
3352 FIXME("Unsupported namespace %s\n", debugstr_variant(pvarNS
));
3354 nsAString_InitDepend(&ns
, pvarNS
&& V_VT(pvarNS
) == VT_BSTR
? V_BSTR(pvarNS
) : NULL
);
3355 nsAString_InitDepend(&tag
, bstrTag
);
3356 nsres
= nsIDOMHTMLDocument_CreateElementNS(This
->doc_node
->nsdoc
, &ns
, &tag
, &dom_element
);
3357 nsAString_Finish(&ns
);
3358 nsAString_Finish(&tag
);
3359 if(NS_FAILED(nsres
)) {
3360 WARN("CreateElementNS failed: %08x\n", nsres
);
3361 return map_nsresult(nsres
);
3364 hres
= HTMLElement_Create(This
->doc_node
, (nsIDOMNode
*)dom_element
, FALSE
, &element
);
3365 nsIDOMElement_Release(dom_element
);
3369 *newElem
= &element
->IHTMLElement_iface
;
3373 static HRESULT WINAPI
HTMLDocument7_createAttributeNS(IHTMLDocument7
*iface
, VARIANT
*pvarNS
,
3374 BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3376 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3377 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_variant(pvarNS
), debugstr_w(bstrAttrName
), ppAttribute
);
3381 static HRESULT WINAPI
HTMLDocument7_put_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT v
)
3383 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3384 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3388 static HRESULT WINAPI
HTMLDocument7_get_onmsthumbnailclick(IHTMLDocument7
*iface
, VARIANT
*p
)
3390 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3392 TRACE("(%p)->(%p)\n", This
, p
);
3394 return get_doc_event(This
, EVENTID_MSTHUMBNAILCLICK
, p
);
3397 static HRESULT WINAPI
HTMLDocument7_get_characterSet(IHTMLDocument7
*iface
, BSTR
*p
)
3399 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3400 nsAString charset_str
;
3403 TRACE("(%p)->(%p)\n", This
, p
);
3405 if(!This
->doc_node
->nsdoc
) {
3406 FIXME("NULL nsdoc\n");
3410 nsAString_Init(&charset_str
, NULL
);
3411 nsres
= nsIDOMHTMLDocument_GetCharacterSet(This
->doc_node
->nsdoc
, &charset_str
);
3412 return return_nsstr(nsres
, &charset_str
, p
);
3415 static HRESULT WINAPI
HTMLDocument7_createElement(IHTMLDocument7
*iface
, BSTR bstrTag
, IHTMLElement
**newElem
)
3417 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3419 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrTag
), newElem
);
3421 return IHTMLDocument2_createElement(&This
->IHTMLDocument2_iface
, bstrTag
, newElem
);
3424 static HRESULT WINAPI
HTMLDocument7_createAttribute(IHTMLDocument7
*iface
, BSTR bstrAttrName
, IHTMLDOMAttribute
**ppAttribute
)
3426 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3428 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(bstrAttrName
), ppAttribute
);
3430 return IHTMLDocument5_createAttribute(&This
->IHTMLDocument5_iface
, bstrAttrName
, ppAttribute
);
3433 static HRESULT WINAPI
HTMLDocument7_getElementsByClassName(IHTMLDocument7
*iface
, BSTR v
, IHTMLElementCollection
**pel
)
3435 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3436 nsIDOMNodeList
*nslist
;
3440 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
3442 if(!This
->doc_node
->nsdoc
) {
3443 FIXME("NULL nsdoc not supported\n");
3447 nsAString_InitDepend(&nsstr
, v
);
3448 nsres
= nsIDOMHTMLDocument_GetElementsByClassName(This
->doc_node
->nsdoc
, &nsstr
, &nslist
);
3449 nsAString_Finish(&nsstr
);
3451 ERR("GetElementByClassName failed: %08x\n", nsres
);
3456 *pel
= create_collection_from_nodelist(nslist
, This
->doc_node
->document_mode
);
3457 nsIDOMNodeList_Release(nslist
);
3461 static HRESULT WINAPI
HTMLDocument7_createProcessingInstruction(IHTMLDocument7
*iface
, BSTR target
,
3462 BSTR data
, IDOMProcessingInstruction
**newProcessingInstruction
)
3464 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3465 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(target
), debugstr_w(data
), newProcessingInstruction
);
3469 static HRESULT WINAPI
HTMLDocument7_adoptNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
, IHTMLDOMNode3
**ppNodeDest
)
3471 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3472 FIXME("(%p)->(%p %p)\n", This
, pNodeSource
, ppNodeDest
);
3476 static HRESULT WINAPI
HTMLDocument7_put_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT v
)
3478 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3479 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3483 static HRESULT WINAPI
HTMLDocument7_get_onmssitemodejumplistitemremoved(IHTMLDocument7
*iface
, VARIANT
*p
)
3485 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3486 FIXME("(%p)->(%p)\n", This
, p
);
3490 static HRESULT WINAPI
HTMLDocument7_get_all(IHTMLDocument7
*iface
, IHTMLElementCollection
**p
)
3492 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3494 TRACE("(%p)->(%p)\n", This
, p
);
3496 return IHTMLDocument2_get_all(&This
->IHTMLDocument2_iface
, p
);
3499 static HRESULT WINAPI
HTMLDocument7_get_inputEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3501 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3502 FIXME("(%p)->(%p)\n", This
, p
);
3506 static HRESULT WINAPI
HTMLDocument7_get_xmlEncoding(IHTMLDocument7
*iface
, BSTR
*p
)
3508 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3509 FIXME("(%p)->(%p)\n", This
, p
);
3513 static HRESULT WINAPI
HTMLDocument7_put_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL v
)
3515 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3516 FIXME("(%p)->(%x)\n", This
, v
);
3520 static HRESULT WINAPI
HTMLDocument7_get_xmlStandalone(IHTMLDocument7
*iface
, VARIANT_BOOL
*p
)
3522 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3523 FIXME("(%p)->(%p)\n", This
, p
);
3527 static HRESULT WINAPI
HTMLDocument7_put_xmlVersion(IHTMLDocument7
*iface
, BSTR v
)
3529 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3530 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
3534 static HRESULT WINAPI
HTMLDocument7_get_xmlVersion(IHTMLDocument7
*iface
, BSTR
*p
)
3536 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3537 FIXME("(%p)->(%p)\n", This
, p
);
3541 static HRESULT WINAPI
HTMLDocument7_hasAttributes(IHTMLDocument7
*iface
, VARIANT_BOOL
*pfHasAttributes
)
3543 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3544 FIXME("(%p)->(%p)\n", This
, pfHasAttributes
);
3548 static HRESULT WINAPI
HTMLDocument7_put_onabort(IHTMLDocument7
*iface
, VARIANT v
)
3550 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3552 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3554 return set_doc_event(This
, EVENTID_ABORT
, &v
);
3557 static HRESULT WINAPI
HTMLDocument7_get_onabort(IHTMLDocument7
*iface
, VARIANT
*p
)
3559 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3561 TRACE("(%p)->(%p)\n", This
, p
);
3563 return get_doc_event(This
, EVENTID_ABORT
, p
);
3566 static HRESULT WINAPI
HTMLDocument7_put_onblur(IHTMLDocument7
*iface
, VARIANT v
)
3568 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3570 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3572 return set_doc_event(This
, EVENTID_BLUR
, &v
);
3575 static HRESULT WINAPI
HTMLDocument7_get_onblur(IHTMLDocument7
*iface
, VARIANT
*p
)
3577 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3579 TRACE("(%p)->(%p)\n", This
, p
);
3581 return get_doc_event(This
, EVENTID_BLUR
, p
);
3584 static HRESULT WINAPI
HTMLDocument7_put_oncanplay(IHTMLDocument7
*iface
, VARIANT v
)
3586 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3587 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3591 static HRESULT WINAPI
HTMLDocument7_get_oncanplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3593 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3594 FIXME("(%p)->(%p)\n", This
, p
);
3598 static HRESULT WINAPI
HTMLDocument7_put_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT v
)
3600 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3601 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3605 static HRESULT WINAPI
HTMLDocument7_get_oncanplaythrough(IHTMLDocument7
*iface
, VARIANT
*p
)
3607 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3608 FIXME("(%p)->(%p)\n", This
, p
);
3612 static HRESULT WINAPI
HTMLDocument7_put_onchange(IHTMLDocument7
*iface
, VARIANT v
)
3614 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3616 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3618 return set_doc_event(This
, EVENTID_CHANGE
, &v
);
3621 static HRESULT WINAPI
HTMLDocument7_get_onchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3623 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3625 TRACE("(%p)->(%p)\n", This
, p
);
3627 return get_doc_event(This
, EVENTID_CHANGE
, p
);
3630 static HRESULT WINAPI
HTMLDocument7_put_ondrag(IHTMLDocument7
*iface
, VARIANT v
)
3632 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3634 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3636 return set_doc_event(This
, EVENTID_DRAG
, &v
);
3639 static HRESULT WINAPI
HTMLDocument7_get_ondrag(IHTMLDocument7
*iface
, VARIANT
*p
)
3641 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3643 TRACE("(%p)->(%p)\n", This
, p
);
3645 return get_doc_event(This
, EVENTID_DRAG
, p
);
3648 static HRESULT WINAPI
HTMLDocument7_put_ondragend(IHTMLDocument7
*iface
, VARIANT v
)
3650 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3651 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3655 static HRESULT WINAPI
HTMLDocument7_get_ondragend(IHTMLDocument7
*iface
, VARIANT
*p
)
3657 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3658 FIXME("(%p)->(%p)\n", This
, p
);
3662 static HRESULT WINAPI
HTMLDocument7_put_ondragenter(IHTMLDocument7
*iface
, VARIANT v
)
3664 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3665 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3669 static HRESULT WINAPI
HTMLDocument7_get_ondragenter(IHTMLDocument7
*iface
, VARIANT
*p
)
3671 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3672 FIXME("(%p)->(%p)\n", This
, p
);
3676 static HRESULT WINAPI
HTMLDocument7_put_ondragleave(IHTMLDocument7
*iface
, VARIANT v
)
3678 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3679 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3683 static HRESULT WINAPI
HTMLDocument7_get_ondragleave(IHTMLDocument7
*iface
, VARIANT
*p
)
3685 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3686 FIXME("(%p)->(%p)\n", This
, p
);
3690 static HRESULT WINAPI
HTMLDocument7_put_ondragover(IHTMLDocument7
*iface
, VARIANT v
)
3692 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3693 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3697 static HRESULT WINAPI
HTMLDocument7_get_ondragover(IHTMLDocument7
*iface
, VARIANT
*p
)
3699 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3700 FIXME("(%p)->(%p)\n", This
, p
);
3704 static HRESULT WINAPI
HTMLDocument7_put_ondrop(IHTMLDocument7
*iface
, VARIANT v
)
3706 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3707 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3711 static HRESULT WINAPI
HTMLDocument7_get_ondrop(IHTMLDocument7
*iface
, VARIANT
*p
)
3713 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3714 FIXME("(%p)->(%p)\n", This
, p
);
3718 static HRESULT WINAPI
HTMLDocument7_put_ondurationchange(IHTMLDocument7
*iface
, VARIANT v
)
3720 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3721 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3725 static HRESULT WINAPI
HTMLDocument7_get_ondurationchange(IHTMLDocument7
*iface
, VARIANT
*p
)
3727 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3728 FIXME("(%p)->(%p)\n", This
, p
);
3732 static HRESULT WINAPI
HTMLDocument7_put_onemptied(IHTMLDocument7
*iface
, VARIANT v
)
3734 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3735 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3739 static HRESULT WINAPI
HTMLDocument7_get_onemptied(IHTMLDocument7
*iface
, VARIANT
*p
)
3741 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3742 FIXME("(%p)->(%p)\n", This
, p
);
3746 static HRESULT WINAPI
HTMLDocument7_put_onended(IHTMLDocument7
*iface
, VARIANT v
)
3748 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3749 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3753 static HRESULT WINAPI
HTMLDocument7_get_onended(IHTMLDocument7
*iface
, VARIANT
*p
)
3755 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3756 FIXME("(%p)->(%p)\n", This
, p
);
3760 static HRESULT WINAPI
HTMLDocument7_put_onerror(IHTMLDocument7
*iface
, VARIANT v
)
3762 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3764 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3766 return set_doc_event(This
, EVENTID_ERROR
, &v
);
3769 static HRESULT WINAPI
HTMLDocument7_get_onerror(IHTMLDocument7
*iface
, VARIANT
*p
)
3771 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3773 TRACE("(%p)->(%p)\n", This
, p
);
3775 return get_doc_event(This
, EVENTID_ERROR
, p
);
3778 static HRESULT WINAPI
HTMLDocument7_put_onfocus(IHTMLDocument7
*iface
, VARIANT v
)
3780 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3782 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3784 return set_doc_event(This
, EVENTID_FOCUS
, &v
);
3787 static HRESULT WINAPI
HTMLDocument7_get_onfocus(IHTMLDocument7
*iface
, VARIANT
*p
)
3789 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3791 TRACE("(%p)->(%p)\n", This
, p
);
3793 return get_doc_event(This
, EVENTID_FOCUS
, p
);
3796 static HRESULT WINAPI
HTMLDocument7_put_oninput(IHTMLDocument7
*iface
, VARIANT v
)
3798 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3800 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3802 return set_doc_event(This
, EVENTID_INPUT
, &v
);
3805 static HRESULT WINAPI
HTMLDocument7_get_oninput(IHTMLDocument7
*iface
, VARIANT
*p
)
3807 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3809 TRACE("(%p)->(%p)\n", This
, p
);
3811 return get_doc_event(This
, EVENTID_INPUT
, p
);
3814 static HRESULT WINAPI
HTMLDocument7_put_onload(IHTMLDocument7
*iface
, VARIANT v
)
3816 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3818 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3820 return set_doc_event(This
, EVENTID_LOAD
, &v
);
3823 static HRESULT WINAPI
HTMLDocument7_get_onload(IHTMLDocument7
*iface
, VARIANT
*p
)
3825 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3827 TRACE("(%p)->(%p)\n", This
, p
);
3829 return get_doc_event(This
, EVENTID_LOAD
, p
);
3832 static HRESULT WINAPI
HTMLDocument7_put_onloadeddata(IHTMLDocument7
*iface
, VARIANT v
)
3834 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3835 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3839 static HRESULT WINAPI
HTMLDocument7_get_onloadeddata(IHTMLDocument7
*iface
, VARIANT
*p
)
3841 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3842 FIXME("(%p)->(%p)\n", This
, p
);
3846 static HRESULT WINAPI
HTMLDocument7_put_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT v
)
3848 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3849 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3853 static HRESULT WINAPI
HTMLDocument7_get_onloadedmetadata(IHTMLDocument7
*iface
, VARIANT
*p
)
3855 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3856 FIXME("(%p)->(%p)\n", This
, p
);
3860 static HRESULT WINAPI
HTMLDocument7_put_onloadstart(IHTMLDocument7
*iface
, VARIANT v
)
3862 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3863 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3867 static HRESULT WINAPI
HTMLDocument7_get_onloadstart(IHTMLDocument7
*iface
, VARIANT
*p
)
3869 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3870 FIXME("(%p)->(%p)\n", This
, p
);
3874 static HRESULT WINAPI
HTMLDocument7_put_onpause(IHTMLDocument7
*iface
, VARIANT v
)
3876 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3877 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3881 static HRESULT WINAPI
HTMLDocument7_get_onpause(IHTMLDocument7
*iface
, VARIANT
*p
)
3883 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3884 FIXME("(%p)->(%p)\n", This
, p
);
3888 static HRESULT WINAPI
HTMLDocument7_put_onplay(IHTMLDocument7
*iface
, VARIANT v
)
3890 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3891 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3895 static HRESULT WINAPI
HTMLDocument7_get_onplay(IHTMLDocument7
*iface
, VARIANT
*p
)
3897 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3898 FIXME("(%p)->(%p)\n", This
, p
);
3902 static HRESULT WINAPI
HTMLDocument7_put_onplaying(IHTMLDocument7
*iface
, VARIANT v
)
3904 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3905 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3909 static HRESULT WINAPI
HTMLDocument7_get_onplaying(IHTMLDocument7
*iface
, VARIANT
*p
)
3911 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3912 FIXME("(%p)->(%p)\n", This
, p
);
3916 static HRESULT WINAPI
HTMLDocument7_put_onprogress(IHTMLDocument7
*iface
, VARIANT v
)
3918 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3919 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3923 static HRESULT WINAPI
HTMLDocument7_get_onprogress(IHTMLDocument7
*iface
, VARIANT
*p
)
3925 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3926 FIXME("(%p)->(%p)\n", This
, p
);
3930 static HRESULT WINAPI
HTMLDocument7_put_onratechange(IHTMLDocument7
*iface
, VARIANT v
)
3932 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3933 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3937 static HRESULT WINAPI
HTMLDocument7_get_onratechange(IHTMLDocument7
*iface
, VARIANT
*p
)
3939 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3940 FIXME("(%p)->(%p)\n", This
, p
);
3944 static HRESULT WINAPI
HTMLDocument7_put_onreset(IHTMLDocument7
*iface
, VARIANT v
)
3946 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3947 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3951 static HRESULT WINAPI
HTMLDocument7_get_onreset(IHTMLDocument7
*iface
, VARIANT
*p
)
3953 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3954 FIXME("(%p)->(%p)\n", This
, p
);
3958 static HRESULT WINAPI
HTMLDocument7_put_onscroll(IHTMLDocument7
*iface
, VARIANT v
)
3960 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3962 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3964 return set_doc_event(This
, EVENTID_SCROLL
, &v
);
3967 static HRESULT WINAPI
HTMLDocument7_get_onscroll(IHTMLDocument7
*iface
, VARIANT
*p
)
3969 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3971 TRACE("(%p)->(%p)\n", This
, p
);
3973 return get_doc_event(This
, EVENTID_SCROLL
, p
);
3976 static HRESULT WINAPI
HTMLDocument7_put_onseekend(IHTMLDocument7
*iface
, VARIANT v
)
3978 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3979 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3983 static HRESULT WINAPI
HTMLDocument7_get_onseekend(IHTMLDocument7
*iface
, VARIANT
*p
)
3985 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3986 FIXME("(%p)->(%p)\n", This
, p
);
3990 static HRESULT WINAPI
HTMLDocument7_put_onseeking(IHTMLDocument7
*iface
, VARIANT v
)
3992 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
3993 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
3997 static HRESULT WINAPI
HTMLDocument7_get_onseeking(IHTMLDocument7
*iface
, VARIANT
*p
)
3999 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4000 FIXME("(%p)->(%p)\n", This
, p
);
4004 static HRESULT WINAPI
HTMLDocument7_put_onselect(IHTMLDocument7
*iface
, VARIANT v
)
4006 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4007 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4011 static HRESULT WINAPI
HTMLDocument7_get_onselect(IHTMLDocument7
*iface
, VARIANT
*p
)
4013 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4014 FIXME("(%p)->(%p)\n", This
, p
);
4018 static HRESULT WINAPI
HTMLDocument7_put_onstalled(IHTMLDocument7
*iface
, VARIANT v
)
4020 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4021 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4025 static HRESULT WINAPI
HTMLDocument7_get_onstalled(IHTMLDocument7
*iface
, VARIANT
*p
)
4027 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4028 FIXME("(%p)->(%p)\n", This
, p
);
4032 static HRESULT WINAPI
HTMLDocument7_put_onsubmit(IHTMLDocument7
*iface
, VARIANT v
)
4034 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4036 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4038 return set_doc_event(This
, EVENTID_SUBMIT
, &v
);
4041 static HRESULT WINAPI
HTMLDocument7_get_onsubmit(IHTMLDocument7
*iface
, VARIANT
*p
)
4043 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4045 TRACE("(%p)->(%p)\n", This
, p
);
4047 return get_doc_event(This
, EVENTID_SUBMIT
, p
);
4050 static HRESULT WINAPI
HTMLDocument7_put_onsuspend(IHTMLDocument7
*iface
, VARIANT v
)
4052 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4053 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4057 static HRESULT WINAPI
HTMLDocument7_get_onsuspend(IHTMLDocument7
*iface
, VARIANT
*p
)
4059 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4060 FIXME("(%p)->(%p)\n", This
, p
);
4064 static HRESULT WINAPI
HTMLDocument7_put_ontimeupdate(IHTMLDocument7
*iface
, VARIANT v
)
4066 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4067 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4071 static HRESULT WINAPI
HTMLDocument7_get_ontimeupdate(IHTMLDocument7
*iface
, VARIANT
*p
)
4073 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4074 FIXME("(%p)->(%p)\n", This
, p
);
4078 static HRESULT WINAPI
HTMLDocument7_put_onvolumechange(IHTMLDocument7
*iface
, VARIANT v
)
4080 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4081 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4085 static HRESULT WINAPI
HTMLDocument7_get_onvolumechange(IHTMLDocument7
*iface
, VARIANT
*p
)
4087 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4088 FIXME("(%p)->(%p)\n", This
, p
);
4092 static HRESULT WINAPI
HTMLDocument7_put_onwaiting(IHTMLDocument7
*iface
, VARIANT v
)
4094 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4095 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
4099 static HRESULT WINAPI
HTMLDocument7_get_onwaiting(IHTMLDocument7
*iface
, VARIANT
*p
)
4101 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4102 FIXME("(%p)->(%p)\n", This
, p
);
4106 static HRESULT WINAPI
HTMLDocument7_normalize(IHTMLDocument7
*iface
)
4108 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4109 FIXME("(%p)\n", This
);
4113 static HRESULT WINAPI
HTMLDocument7_importNode(IHTMLDocument7
*iface
, IHTMLDOMNode
*pNodeSource
,
4114 VARIANT_BOOL fDeep
, IHTMLDOMNode3
**ppNodeDest
)
4116 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4117 FIXME("(%p)->(%p %x %p)\n", This
, pNodeSource
, fDeep
, ppNodeDest
);
4121 static HRESULT WINAPI
HTMLDocument7_get_parentWindow(IHTMLDocument7
*iface
, IHTMLWindow2
**p
)
4123 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4125 TRACE("(%p)->(%p)\n", This
, p
);
4127 return IHTMLDocument7_get_defaultView(&This
->IHTMLDocument7_iface
, p
);
4130 static HRESULT WINAPI
HTMLDocument7_put_body(IHTMLDocument7
*iface
, IHTMLElement
*v
)
4132 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4133 FIXME("(%p)->(%p)\n", This
, v
);
4137 static HRESULT WINAPI
HTMLDocument7_get_body(IHTMLDocument7
*iface
, IHTMLElement
**p
)
4139 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4141 TRACE("(%p)->(%p)\n", This
, p
);
4143 return IHTMLDocument2_get_body(&This
->IHTMLDocument2_iface
, p
);
4146 static HRESULT WINAPI
HTMLDocument7_get_head(IHTMLDocument7
*iface
, IHTMLElement
**p
)
4148 HTMLDocument
*This
= impl_from_IHTMLDocument7(iface
);
4149 nsIDOMHTMLHeadElement
*nshead
;
4150 nsIDOMElement
*nselem
;
4155 TRACE("(%p)->(%p)\n", This
, p
);
4157 if(!This
->doc_node
->nsdoc
) {
4158 FIXME("No document\n");
4162 nsres
= nsIDOMHTMLDocument_GetHead(This
->doc_node
->nsdoc
, &nshead
);
4163 assert(nsres
== NS_OK
);
4170 nsres
= nsIDOMHTMLHeadElement_QueryInterface(nshead
, &IID_nsIDOMElement
, (void**)&nselem
);
4171 nsIDOMHTMLHeadElement_Release(nshead
);
4172 assert(nsres
== NS_OK
);
4174 hres
= get_element(nselem
, &elem
);
4175 nsIDOMElement_Release(nselem
);
4179 *p
= &elem
->IHTMLElement_iface
;
4183 static const IHTMLDocument7Vtbl HTMLDocument7Vtbl
= {
4184 HTMLDocument7_QueryInterface
,
4185 HTMLDocument7_AddRef
,
4186 HTMLDocument7_Release
,
4187 HTMLDocument7_GetTypeInfoCount
,
4188 HTMLDocument7_GetTypeInfo
,
4189 HTMLDocument7_GetIDsOfNames
,
4190 HTMLDocument7_Invoke
,
4191 HTMLDocument7_get_defaultView
,
4192 HTMLDocument7_createCDATASection
,
4193 HTMLDocument7_getSelection
,
4194 HTMLDocument7_getElementsByTagNameNS
,
4195 HTMLDocument7_createElementNS
,
4196 HTMLDocument7_createAttributeNS
,
4197 HTMLDocument7_put_onmsthumbnailclick
,
4198 HTMLDocument7_get_onmsthumbnailclick
,
4199 HTMLDocument7_get_characterSet
,
4200 HTMLDocument7_createElement
,
4201 HTMLDocument7_createAttribute
,
4202 HTMLDocument7_getElementsByClassName
,
4203 HTMLDocument7_createProcessingInstruction
,
4204 HTMLDocument7_adoptNode
,
4205 HTMLDocument7_put_onmssitemodejumplistitemremoved
,
4206 HTMLDocument7_get_onmssitemodejumplistitemremoved
,
4207 HTMLDocument7_get_all
,
4208 HTMLDocument7_get_inputEncoding
,
4209 HTMLDocument7_get_xmlEncoding
,
4210 HTMLDocument7_put_xmlStandalone
,
4211 HTMLDocument7_get_xmlStandalone
,
4212 HTMLDocument7_put_xmlVersion
,
4213 HTMLDocument7_get_xmlVersion
,
4214 HTMLDocument7_hasAttributes
,
4215 HTMLDocument7_put_onabort
,
4216 HTMLDocument7_get_onabort
,
4217 HTMLDocument7_put_onblur
,
4218 HTMLDocument7_get_onblur
,
4219 HTMLDocument7_put_oncanplay
,
4220 HTMLDocument7_get_oncanplay
,
4221 HTMLDocument7_put_oncanplaythrough
,
4222 HTMLDocument7_get_oncanplaythrough
,
4223 HTMLDocument7_put_onchange
,
4224 HTMLDocument7_get_onchange
,
4225 HTMLDocument7_put_ondrag
,
4226 HTMLDocument7_get_ondrag
,
4227 HTMLDocument7_put_ondragend
,
4228 HTMLDocument7_get_ondragend
,
4229 HTMLDocument7_put_ondragenter
,
4230 HTMLDocument7_get_ondragenter
,
4231 HTMLDocument7_put_ondragleave
,
4232 HTMLDocument7_get_ondragleave
,
4233 HTMLDocument7_put_ondragover
,
4234 HTMLDocument7_get_ondragover
,
4235 HTMLDocument7_put_ondrop
,
4236 HTMLDocument7_get_ondrop
,
4237 HTMLDocument7_put_ondurationchange
,
4238 HTMLDocument7_get_ondurationchange
,
4239 HTMLDocument7_put_onemptied
,
4240 HTMLDocument7_get_onemptied
,
4241 HTMLDocument7_put_onended
,
4242 HTMLDocument7_get_onended
,
4243 HTMLDocument7_put_onerror
,
4244 HTMLDocument7_get_onerror
,
4245 HTMLDocument7_put_onfocus
,
4246 HTMLDocument7_get_onfocus
,
4247 HTMLDocument7_put_oninput
,
4248 HTMLDocument7_get_oninput
,
4249 HTMLDocument7_put_onload
,
4250 HTMLDocument7_get_onload
,
4251 HTMLDocument7_put_onloadeddata
,
4252 HTMLDocument7_get_onloadeddata
,
4253 HTMLDocument7_put_onloadedmetadata
,
4254 HTMLDocument7_get_onloadedmetadata
,
4255 HTMLDocument7_put_onloadstart
,
4256 HTMLDocument7_get_onloadstart
,
4257 HTMLDocument7_put_onpause
,
4258 HTMLDocument7_get_onpause
,
4259 HTMLDocument7_put_onplay
,
4260 HTMLDocument7_get_onplay
,
4261 HTMLDocument7_put_onplaying
,
4262 HTMLDocument7_get_onplaying
,
4263 HTMLDocument7_put_onprogress
,
4264 HTMLDocument7_get_onprogress
,
4265 HTMLDocument7_put_onratechange
,
4266 HTMLDocument7_get_onratechange
,
4267 HTMLDocument7_put_onreset
,
4268 HTMLDocument7_get_onreset
,
4269 HTMLDocument7_put_onscroll
,
4270 HTMLDocument7_get_onscroll
,
4271 HTMLDocument7_put_onseekend
,
4272 HTMLDocument7_get_onseekend
,
4273 HTMLDocument7_put_onseeking
,
4274 HTMLDocument7_get_onseeking
,
4275 HTMLDocument7_put_onselect
,
4276 HTMLDocument7_get_onselect
,
4277 HTMLDocument7_put_onstalled
,
4278 HTMLDocument7_get_onstalled
,
4279 HTMLDocument7_put_onsubmit
,
4280 HTMLDocument7_get_onsubmit
,
4281 HTMLDocument7_put_onsuspend
,
4282 HTMLDocument7_get_onsuspend
,
4283 HTMLDocument7_put_ontimeupdate
,
4284 HTMLDocument7_get_ontimeupdate
,
4285 HTMLDocument7_put_onvolumechange
,
4286 HTMLDocument7_get_onvolumechange
,
4287 HTMLDocument7_put_onwaiting
,
4288 HTMLDocument7_get_onwaiting
,
4289 HTMLDocument7_normalize
,
4290 HTMLDocument7_importNode
,
4291 HTMLDocument7_get_parentWindow
,
4292 HTMLDocument7_put_body
,
4293 HTMLDocument7_get_body
,
4294 HTMLDocument7_get_head
4297 static inline HTMLDocument
*impl_from_IDocumentSelector(IDocumentSelector
*iface
)
4299 return CONTAINING_RECORD(iface
, HTMLDocument
, IDocumentSelector_iface
);
4302 static HRESULT WINAPI
DocumentSelector_QueryInterface(IDocumentSelector
*iface
, REFIID riid
, void **ppv
)
4304 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4305 return htmldoc_query_interface(This
, riid
, ppv
);
4308 static ULONG WINAPI
DocumentSelector_AddRef(IDocumentSelector
*iface
)
4310 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4311 return htmldoc_addref(This
);
4314 static ULONG WINAPI
DocumentSelector_Release(IDocumentSelector
*iface
)
4316 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4317 return htmldoc_release(This
);
4320 static HRESULT WINAPI
DocumentSelector_GetTypeInfoCount(IDocumentSelector
*iface
, UINT
*pctinfo
)
4322 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4323 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
4326 static HRESULT WINAPI
DocumentSelector_GetTypeInfo(IDocumentSelector
*iface
, UINT iTInfo
,
4327 LCID lcid
, ITypeInfo
**ppTInfo
)
4329 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4330 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4333 static HRESULT WINAPI
DocumentSelector_GetIDsOfNames(IDocumentSelector
*iface
, REFIID riid
,
4334 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4336 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4337 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
4341 static HRESULT WINAPI
DocumentSelector_Invoke(IDocumentSelector
*iface
, DISPID dispIdMember
, REFIID riid
,
4342 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4344 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4345 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
4346 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4349 static HRESULT WINAPI
DocumentSelector_querySelector(IDocumentSelector
*iface
, BSTR v
, IHTMLElement
**pel
)
4351 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4352 nsIDOMElement
*nselem
;
4358 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4360 nsAString_InitDepend(&nsstr
, v
);
4361 nsres
= nsIDOMHTMLDocument_QuerySelector(This
->doc_node
->nsdoc
, &nsstr
, &nselem
);
4362 nsAString_Finish(&nsstr
);
4363 if(NS_FAILED(nsres
)) {
4364 ERR("QuerySelector failed: %08x\n", nsres
);
4373 hres
= get_element(nselem
, &elem
);
4374 nsIDOMElement_Release(nselem
);
4378 *pel
= &elem
->IHTMLElement_iface
;
4382 static HRESULT WINAPI
DocumentSelector_querySelectorAll(IDocumentSelector
*iface
, BSTR v
, IHTMLDOMChildrenCollection
**pel
)
4384 HTMLDocument
*This
= impl_from_IDocumentSelector(iface
);
4385 nsIDOMNodeList
*node_list
;
4389 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
4391 nsAString_InitDepend(&nsstr
, v
);
4392 nsres
= nsIDOMHTMLDocument_QuerySelectorAll(This
->doc_node
->nsdoc
, &nsstr
, &node_list
);
4393 nsAString_Finish(&nsstr
);
4394 if(NS_FAILED(nsres
)) {
4395 ERR("QuerySelectorAll failed: %08x\n", nsres
);
4399 *pel
= create_child_collection(node_list
);
4400 nsIDOMNodeList_Release(node_list
);
4401 return *pel
? S_OK
: E_OUTOFMEMORY
;
4404 static const IDocumentSelectorVtbl DocumentSelectorVtbl
= {
4405 DocumentSelector_QueryInterface
,
4406 DocumentSelector_AddRef
,
4407 DocumentSelector_Release
,
4408 DocumentSelector_GetTypeInfoCount
,
4409 DocumentSelector_GetTypeInfo
,
4410 DocumentSelector_GetIDsOfNames
,
4411 DocumentSelector_Invoke
,
4412 DocumentSelector_querySelector
,
4413 DocumentSelector_querySelectorAll
4416 static inline HTMLDocument
*impl_from_IDocumentEvent(IDocumentEvent
*iface
)
4418 return CONTAINING_RECORD(iface
, HTMLDocument
, IDocumentEvent_iface
);
4421 static HRESULT WINAPI
DocumentEvent_QueryInterface(IDocumentEvent
*iface
, REFIID riid
, void **ppv
)
4423 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4424 return htmldoc_query_interface(This
, riid
, ppv
);
4427 static ULONG WINAPI
DocumentEvent_AddRef(IDocumentEvent
*iface
)
4429 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4430 return htmldoc_addref(This
);
4433 static ULONG WINAPI
DocumentEvent_Release(IDocumentEvent
*iface
)
4435 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4436 return htmldoc_release(This
);
4439 static HRESULT WINAPI
DocumentEvent_GetTypeInfoCount(IDocumentEvent
*iface
, UINT
*pctinfo
)
4441 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4442 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
4445 static HRESULT WINAPI
DocumentEvent_GetTypeInfo(IDocumentEvent
*iface
, UINT iTInfo
,
4446 LCID lcid
, ITypeInfo
**ppTInfo
)
4448 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4449 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
4452 static HRESULT WINAPI
DocumentEvent_GetIDsOfNames(IDocumentEvent
*iface
, REFIID riid
,
4453 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4455 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4456 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
4460 static HRESULT WINAPI
DocumentEvent_Invoke(IDocumentEvent
*iface
, DISPID dispIdMember
, REFIID riid
,
4461 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4463 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4464 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
4465 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4468 static HRESULT WINAPI
DocumentEvent_createEvent(IDocumentEvent
*iface
, BSTR eventType
, IDOMEvent
**p
)
4470 HTMLDocument
*This
= impl_from_IDocumentEvent(iface
);
4472 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(eventType
), p
);
4474 return create_document_event_str(This
->doc_node
, eventType
, p
);
4477 static const IDocumentEventVtbl DocumentEventVtbl
= {
4478 DocumentEvent_QueryInterface
,
4479 DocumentEvent_AddRef
,
4480 DocumentEvent_Release
,
4481 DocumentEvent_GetTypeInfoCount
,
4482 DocumentEvent_GetTypeInfo
,
4483 DocumentEvent_GetIDsOfNames
,
4484 DocumentEvent_Invoke
,
4485 DocumentEvent_createEvent
4488 static void HTMLDocument_on_advise(IUnknown
*iface
, cp_static_data_t
*cp
)
4490 HTMLDocument
*This
= impl_from_IHTMLDocument2((IHTMLDocument2
*)iface
);
4493 update_doc_cp_events(This
->doc_node
, cp
);
4496 static inline HTMLDocument
*impl_from_ISupportErrorInfo(ISupportErrorInfo
*iface
)
4498 return CONTAINING_RECORD(iface
, HTMLDocument
, ISupportErrorInfo_iface
);
4501 static HRESULT WINAPI
SupportErrorInfo_QueryInterface(ISupportErrorInfo
*iface
, REFIID riid
, void **ppv
)
4503 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4504 return htmldoc_query_interface(This
, riid
, ppv
);
4507 static ULONG WINAPI
SupportErrorInfo_AddRef(ISupportErrorInfo
*iface
)
4509 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4510 return htmldoc_addref(This
);
4513 static ULONG WINAPI
SupportErrorInfo_Release(ISupportErrorInfo
*iface
)
4515 HTMLDocument
*This
= impl_from_ISupportErrorInfo(iface
);
4516 return htmldoc_release(This
);
4519 static HRESULT WINAPI
SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo
*iface
, REFIID riid
)
4521 FIXME("(%p)->(%s)\n", iface
, debugstr_mshtml_guid(riid
));
4525 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
= {
4526 SupportErrorInfo_QueryInterface
,
4527 SupportErrorInfo_AddRef
,
4528 SupportErrorInfo_Release
,
4529 SupportErrorInfo_InterfaceSupportsErrorInfo
4532 static inline HTMLDocument
*impl_from_IDispatchEx(IDispatchEx
*iface
)
4534 return CONTAINING_RECORD(iface
, HTMLDocument
, IDispatchEx_iface
);
4537 static HRESULT
dispid_from_elem_name(HTMLDocumentNode
*This
, BSTR name
, DISPID
*dispid
)
4539 nsIDOMNodeList
*node_list
;
4546 return DISP_E_UNKNOWNNAME
;
4548 nsAString_InitDepend(&name_str
, name
);
4549 nsres
= nsIDOMHTMLDocument_GetElementsByName(This
->nsdoc
, &name_str
, &node_list
);
4550 nsAString_Finish(&name_str
);
4551 if(NS_FAILED(nsres
))
4554 nsres
= nsIDOMNodeList_GetLength(node_list
, &len
);
4555 nsIDOMNodeList_Release(node_list
);
4556 if(NS_FAILED(nsres
))
4560 return DISP_E_UNKNOWNNAME
;
4562 for(i
=0; i
< This
->elem_vars_cnt
; i
++) {
4563 if(!wcscmp(name
, This
->elem_vars
[i
])) {
4564 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
4569 if(This
->elem_vars_cnt
== This
->elem_vars_size
) {
4572 if(This
->elem_vars_size
) {
4573 new_vars
= heap_realloc(This
->elem_vars
, This
->elem_vars_size
*2*sizeof(WCHAR
*));
4575 return E_OUTOFMEMORY
;
4576 This
->elem_vars_size
*= 2;
4578 new_vars
= heap_alloc(16*sizeof(WCHAR
*));
4580 return E_OUTOFMEMORY
;
4581 This
->elem_vars_size
= 16;
4584 This
->elem_vars
= new_vars
;
4587 This
->elem_vars
[This
->elem_vars_cnt
] = heap_strdupW(name
);
4588 if(!This
->elem_vars
[This
->elem_vars_cnt
])
4589 return E_OUTOFMEMORY
;
4591 *dispid
= MSHTML_DISPID_CUSTOM_MIN
+This
->elem_vars_cnt
++;
4595 static HRESULT WINAPI
DocDispatchEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
4597 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4599 return htmldoc_query_interface(This
, riid
, ppv
);
4602 static ULONG WINAPI
DocDispatchEx_AddRef(IDispatchEx
*iface
)
4604 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4606 return htmldoc_addref(This
);
4609 static ULONG WINAPI
DocDispatchEx_Release(IDispatchEx
*iface
)
4611 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4613 return htmldoc_release(This
);
4616 static HRESULT WINAPI
DocDispatchEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
4618 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4620 return IDispatchEx_GetTypeInfoCount(This
->dispex
, pctinfo
);
4623 static HRESULT WINAPI
DocDispatchEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
4624 LCID lcid
, ITypeInfo
**ppTInfo
)
4626 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4628 return IDispatchEx_GetTypeInfo(This
->dispex
, iTInfo
, lcid
, ppTInfo
);
4631 static HRESULT WINAPI
DocDispatchEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
4632 LPOLESTR
*rgszNames
, UINT cNames
,
4633 LCID lcid
, DISPID
*rgDispId
)
4635 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4637 return IDispatchEx_GetIDsOfNames(This
->dispex
, riid
, rgszNames
, cNames
, lcid
, rgDispId
);
4640 static HRESULT WINAPI
DocDispatchEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
4641 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
4642 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4644 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4646 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
4647 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4649 switch(dispIdMember
) {
4650 case DISPID_READYSTATE
:
4651 TRACE("DISPID_READYSTATE\n");
4653 if(!(wFlags
& DISPATCH_PROPERTYGET
))
4654 return E_INVALIDARG
;
4656 V_VT(pVarResult
) = VT_I4
;
4657 V_I4(pVarResult
) = This
->window
->readystate
;
4661 return IDispatchEx_Invoke(This
->dispex
, dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
4662 pVarResult
, pExcepInfo
, puArgErr
);
4665 static HRESULT WINAPI
DocDispatchEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
4667 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4670 hres
= IDispatchEx_GetDispID(This
->dispex
, bstrName
, grfdex
, pid
);
4671 if(hres
!= DISP_E_UNKNOWNNAME
)
4674 return dispid_from_elem_name(This
->doc_node
, bstrName
, pid
);
4677 static HRESULT WINAPI
DocDispatchEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
4678 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
4680 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4682 if(This
->window
&& id
== DISPID_IHTMLDOCUMENT2_LOCATION
&& (wFlags
& DISPATCH_PROPERTYPUT
))
4683 return IDispatchEx_InvokeEx(&This
->window
->base
.IDispatchEx_iface
, DISPID_IHTMLWINDOW2_LOCATION
,
4684 lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
4687 return IDispatchEx_InvokeEx(This
->dispex
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
4690 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
4692 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4694 return IDispatchEx_DeleteMemberByName(This
->dispex
, bstrName
, grfdex
);
4697 static HRESULT WINAPI
DocDispatchEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
4699 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4701 return IDispatchEx_DeleteMemberByDispID(This
->dispex
, id
);
4704 static HRESULT WINAPI
DocDispatchEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
4706 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4708 return IDispatchEx_GetMemberProperties(This
->dispex
, id
, grfdexFetch
, pgrfdex
);
4711 static HRESULT WINAPI
DocDispatchEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
4713 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4715 return IDispatchEx_GetMemberName(This
->dispex
, id
, pbstrName
);
4718 static HRESULT WINAPI
DocDispatchEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
4720 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4722 return IDispatchEx_GetNextDispID(This
->dispex
, grfdex
, id
, pid
);
4725 static HRESULT WINAPI
DocDispatchEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
4727 HTMLDocument
*This
= impl_from_IDispatchEx(iface
);
4729 return IDispatchEx_GetNameSpaceParent(This
->dispex
, ppunk
);
4732 static const IDispatchExVtbl DocDispatchExVtbl
= {
4733 DocDispatchEx_QueryInterface
,
4734 DocDispatchEx_AddRef
,
4735 DocDispatchEx_Release
,
4736 DocDispatchEx_GetTypeInfoCount
,
4737 DocDispatchEx_GetTypeInfo
,
4738 DocDispatchEx_GetIDsOfNames
,
4739 DocDispatchEx_Invoke
,
4740 DocDispatchEx_GetDispID
,
4741 DocDispatchEx_InvokeEx
,
4742 DocDispatchEx_DeleteMemberByName
,
4743 DocDispatchEx_DeleteMemberByDispID
,
4744 DocDispatchEx_GetMemberProperties
,
4745 DocDispatchEx_GetMemberName
,
4746 DocDispatchEx_GetNextDispID
,
4747 DocDispatchEx_GetNameSpaceParent
4750 static inline HTMLDocument
*impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo
*iface
)
4752 return CONTAINING_RECORD(iface
, HTMLDocument
, IProvideMultipleClassInfo_iface
);
4755 static HRESULT WINAPI
ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo
*iface
,
4756 REFIID riid
, void **ppv
)
4758 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4759 return htmldoc_query_interface(This
, riid
, ppv
);
4762 static ULONG WINAPI
ProvideClassInfo_AddRef(IProvideMultipleClassInfo
*iface
)
4764 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4765 return htmldoc_addref(This
);
4768 static ULONG WINAPI
ProvideClassInfo_Release(IProvideMultipleClassInfo
*iface
)
4770 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4771 return htmldoc_release(This
);
4774 static HRESULT WINAPI
ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo
*iface
, ITypeInfo
**ppTI
)
4776 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4777 TRACE("(%p)->(%p)\n", This
, ppTI
);
4778 return get_class_typeinfo(&CLSID_HTMLDocument
, ppTI
);
4781 static HRESULT WINAPI
ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo
*iface
, DWORD dwGuidKind
, GUID
*pGUID
)
4783 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4784 FIXME("(%p)->(%u %p)\n", This
, dwGuidKind
, pGUID
);
4788 static HRESULT WINAPI
ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo
*iface
, ULONG
*pcti
)
4790 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4791 FIXME("(%p)->(%p)\n", This
, pcti
);
4796 static HRESULT WINAPI
ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo
*iface
, ULONG iti
,
4797 DWORD dwFlags
, ITypeInfo
**pptiCoClass
, DWORD
*pdwTIFlags
, ULONG
*pcdispidReserved
, IID
*piidPrimary
, IID
*piidSource
)
4799 HTMLDocument
*This
= impl_from_IProvideMultipleClassInfo(iface
);
4800 FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This
, iti
, dwFlags
, pptiCoClass
, pdwTIFlags
, pcdispidReserved
, piidPrimary
, piidSource
);
4804 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl
= {
4805 ProvideClassInfo_QueryInterface
,
4806 ProvideClassInfo_AddRef
,
4807 ProvideClassInfo_Release
,
4808 ProvideClassInfo_GetClassInfo
,
4809 ProvideClassInfo2_GetGUID
,
4810 ProvideMultipleClassInfo_GetMultiTypeInfoCount
,
4811 ProvideMultipleClassInfo_GetInfoOfIndex
4814 /**********************************************************
4815 * IMarkupServices implementation
4817 static inline HTMLDocument
*impl_from_IMarkupServices(IMarkupServices
*iface
)
4819 return CONTAINING_RECORD(iface
, HTMLDocument
, IMarkupServices_iface
);
4822 static HRESULT WINAPI
MarkupServices_QueryInterface(IMarkupServices
*iface
, REFIID riid
, void **ppvObject
)
4824 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4825 return htmldoc_query_interface(This
, riid
, ppvObject
);
4828 static ULONG WINAPI
MarkupServices_AddRef(IMarkupServices
*iface
)
4830 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4831 return htmldoc_addref(This
);
4834 static ULONG WINAPI
MarkupServices_Release(IMarkupServices
*iface
)
4836 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4837 return htmldoc_release(This
);
4840 static HRESULT WINAPI
MarkupServices_CreateMarkupPointer(IMarkupServices
*iface
, IMarkupPointer
**ppPointer
)
4842 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4844 TRACE("(%p)->(%p)\n", This
, ppPointer
);
4846 return create_markup_pointer(ppPointer
);
4849 static HRESULT WINAPI
MarkupServices_CreateMarkupContainer(IMarkupServices
*iface
, IMarkupContainer
**ppMarkupContainer
)
4851 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4852 FIXME("(%p)->(%p)\n", This
, ppMarkupContainer
);
4856 static HRESULT WINAPI
MarkupServices_CreateElement(IMarkupServices
*iface
,
4857 ELEMENT_TAG_ID tagID
, OLECHAR
*pchAttributes
, IHTMLElement
**ppElement
)
4859 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4860 FIXME("(%p)->(%d,%s,%p)\n", This
, tagID
, debugstr_w(pchAttributes
), ppElement
);
4864 static HRESULT WINAPI
MarkupServices_CloneElement(IMarkupServices
*iface
,
4865 IHTMLElement
*pElemCloneThis
, IHTMLElement
**ppElementTheClone
)
4867 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4868 FIXME("(%p)->(%p,%p)\n", This
, pElemCloneThis
, ppElementTheClone
);
4872 static HRESULT WINAPI
MarkupServices_InsertElement(IMarkupServices
*iface
,
4873 IHTMLElement
*pElementInsert
, IMarkupPointer
*pPointerStart
,
4874 IMarkupPointer
*pPointerFinish
)
4876 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4877 FIXME("(%p)->(%p,%p,%p)\n", This
, pElementInsert
, pPointerStart
, pPointerFinish
);
4881 static HRESULT WINAPI
MarkupServices_RemoveElement(IMarkupServices
*iface
, IHTMLElement
*pElementRemove
)
4883 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4884 FIXME("(%p)->(%p)\n", This
, pElementRemove
);
4888 static HRESULT WINAPI
MarkupServices_Remove(IMarkupServices
*iface
,
4889 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
4891 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4892 FIXME("(%p)->(%p,%p)\n", This
, pPointerStart
, pPointerFinish
);
4896 static HRESULT WINAPI
MarkupServices_Copy(IMarkupServices
*iface
,
4897 IMarkupPointer
*pPointerSourceStart
, IMarkupPointer
*pPointerSourceFinish
,
4898 IMarkupPointer
*pPointerTarget
)
4900 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4901 FIXME("(%p)->(%p,%p,%p)\n", This
, pPointerSourceStart
, pPointerSourceFinish
, pPointerTarget
);
4905 static HRESULT WINAPI
MarkupServices_Move(IMarkupServices
*iface
,
4906 IMarkupPointer
*pPointerSourceStart
, IMarkupPointer
*pPointerSourceFinish
,
4907 IMarkupPointer
*pPointerTarget
)
4909 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4910 FIXME("(%p)->(%p,%p,%p)\n", This
, pPointerSourceStart
, pPointerSourceFinish
, pPointerTarget
);
4914 static HRESULT WINAPI
MarkupServices_InsertText(IMarkupServices
*iface
,
4915 OLECHAR
*pchText
, LONG cch
, IMarkupPointer
*pPointerTarget
)
4917 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4918 FIXME("(%p)->(%s,%x,%p)\n", This
, debugstr_w(pchText
), cch
, pPointerTarget
);
4922 static HRESULT WINAPI
MarkupServices_ParseString(IMarkupServices
*iface
,
4923 OLECHAR
*pchHTML
, DWORD dwFlags
, IMarkupContainer
**ppContainerResult
,
4924 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
4926 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4927 FIXME("(%p)->(%s,%x,%p,%p,%p)\n", This
, debugstr_w(pchHTML
), dwFlags
, ppContainerResult
, pPointerStart
, pPointerFinish
);
4931 static HRESULT WINAPI
MarkupServices_ParseGlobal(IMarkupServices
*iface
,
4932 HGLOBAL hglobalHTML
, DWORD dwFlags
, IMarkupContainer
**ppContainerResult
,
4933 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
4935 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4936 FIXME("(%p)->(%s,%x,%p,%p,%p)\n", This
, debugstr_w(hglobalHTML
), dwFlags
, ppContainerResult
, pPointerStart
, pPointerFinish
);
4940 static HRESULT WINAPI
MarkupServices_IsScopedElement(IMarkupServices
*iface
,
4941 IHTMLElement
*pElement
, BOOL
*pfScoped
)
4943 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4944 FIXME("(%p)->(%p,%p)\n", This
, pElement
, pfScoped
);
4948 static HRESULT WINAPI
MarkupServices_GetElementTagId(IMarkupServices
*iface
,
4949 IHTMLElement
*pElement
, ELEMENT_TAG_ID
*ptagId
)
4951 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4952 FIXME("(%p)->(%p,%p)\n", This
, pElement
, ptagId
);
4956 static HRESULT WINAPI
MarkupServices_GetTagIDForName(IMarkupServices
*iface
,
4957 BSTR bstrName
, ELEMENT_TAG_ID
*ptagId
)
4959 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4960 FIXME("(%p)->(%s,%p)\n", This
, debugstr_w(bstrName
), ptagId
);
4964 static HRESULT WINAPI
MarkupServices_GetNameForTagID(IMarkupServices
*iface
,
4965 ELEMENT_TAG_ID tagId
, BSTR
*pbstrName
)
4967 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4968 FIXME("(%p)->(%d,%p)\n", This
, tagId
, pbstrName
);
4972 static HRESULT WINAPI
MarkupServices_MovePointersToRange(IMarkupServices
*iface
,
4973 IHTMLTxtRange
*pIRange
, IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
)
4975 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4976 FIXME("(%p)->(%p,%p,%p)\n", This
, pIRange
, pPointerStart
, pPointerFinish
);
4980 static HRESULT WINAPI
MarkupServices_MoveRangeToPointers(IMarkupServices
*iface
,
4981 IMarkupPointer
*pPointerStart
, IMarkupPointer
*pPointerFinish
, IHTMLTxtRange
*pIRange
)
4983 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4984 FIXME("(%p)->(%p,%p,%p)\n", This
, pPointerStart
, pPointerFinish
, pIRange
);
4988 static HRESULT WINAPI
MarkupServices_BeginUndoUnit(IMarkupServices
*iface
, OLECHAR
*pchTitle
)
4990 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4991 FIXME("(%p)->(%s)\n", This
, debugstr_w(pchTitle
));
4995 static HRESULT WINAPI
MarkupServices_EndUndoUnit(IMarkupServices
*iface
)
4997 HTMLDocument
*This
= impl_from_IMarkupServices(iface
);
4998 FIXME("(%p)\n", This
);
5002 static const IMarkupServicesVtbl MarkupServicesVtbl
= {
5003 MarkupServices_QueryInterface
,
5004 MarkupServices_AddRef
,
5005 MarkupServices_Release
,
5006 MarkupServices_CreateMarkupPointer
,
5007 MarkupServices_CreateMarkupContainer
,
5008 MarkupServices_CreateElement
,
5009 MarkupServices_CloneElement
,
5010 MarkupServices_InsertElement
,
5011 MarkupServices_RemoveElement
,
5012 MarkupServices_Remove
,
5013 MarkupServices_Copy
,
5014 MarkupServices_Move
,
5015 MarkupServices_InsertText
,
5016 MarkupServices_ParseString
,
5017 MarkupServices_ParseGlobal
,
5018 MarkupServices_IsScopedElement
,
5019 MarkupServices_GetElementTagId
,
5020 MarkupServices_GetTagIDForName
,
5021 MarkupServices_GetNameForTagID
,
5022 MarkupServices_MovePointersToRange
,
5023 MarkupServices_MoveRangeToPointers
,
5024 MarkupServices_BeginUndoUnit
,
5025 MarkupServices_EndUndoUnit
5028 /**********************************************************
5029 * IMarkupContainer implementation
5031 static inline HTMLDocument
*impl_from_IMarkupContainer(IMarkupContainer
*iface
)
5033 return CONTAINING_RECORD(iface
, HTMLDocument
, IMarkupContainer_iface
);
5036 static HRESULT WINAPI
MarkupContainer_QueryInterface(IMarkupContainer
*iface
, REFIID riid
, void **ppvObject
)
5038 HTMLDocument
*This
= impl_from_IMarkupContainer(iface
);
5039 return htmldoc_query_interface(This
, riid
, ppvObject
);
5042 static ULONG WINAPI
MarkupContainer_AddRef(IMarkupContainer
*iface
)
5044 HTMLDocument
*This
= impl_from_IMarkupContainer(iface
);
5045 return htmldoc_addref(This
);
5048 static ULONG WINAPI
MarkupContainer_Release(IMarkupContainer
*iface
)
5050 HTMLDocument
*This
= impl_from_IMarkupContainer(iface
);
5051 return htmldoc_release(This
);
5054 static HRESULT WINAPI
MarkupContainer_OwningDoc(IMarkupContainer
*iface
, IHTMLDocument2
**ppDoc
)
5056 HTMLDocument
*This
= impl_from_IMarkupContainer(iface
);
5057 FIXME("(%p)->(%p)\n", This
, ppDoc
);
5061 static const IMarkupContainerVtbl MarkupContainerVtbl
= {
5062 MarkupContainer_QueryInterface
,
5063 MarkupContainer_AddRef
,
5064 MarkupContainer_Release
,
5065 MarkupContainer_OwningDoc
5068 /**********************************************************
5069 * IDisplayServices implementation
5071 static inline HTMLDocument
*impl_from_IDisplayServices(IDisplayServices
*iface
)
5073 return CONTAINING_RECORD(iface
, HTMLDocument
, IDisplayServices_iface
);
5076 static HRESULT WINAPI
DisplayServices_QueryInterface(IDisplayServices
*iface
, REFIID riid
, void **ppvObject
)
5078 HTMLDocument
*This
= impl_from_IDisplayServices(iface
);
5079 return htmldoc_query_interface(This
, riid
, ppvObject
);
5082 static ULONG WINAPI
DisplayServices_AddRef(IDisplayServices
*iface
)
5084 HTMLDocument
*This
= impl_from_IDisplayServices(iface
);
5085 return htmldoc_addref(This
);
5088 static ULONG WINAPI
DisplayServices_Release(IDisplayServices
*iface
)
5090 HTMLDocument
*This
= impl_from_IDisplayServices(iface
);
5091 return htmldoc_release(This
);
5094 static HRESULT WINAPI
DisplayServices_CreateDisplayPointer(IDisplayServices
*iface
, IDisplayPointer
**ppDispPointer
)
5096 HTMLDocument
*This
= impl_from_IDisplayServices(iface
);
5097 FIXME("(%p)->(%p)\n", This
, ppDispPointer
);
5101 static HRESULT WINAPI
DisplayServices_TransformRect(IDisplayServices
*iface
,
5102 RECT
*pRect
, COORD_SYSTEM eSource
, COORD_SYSTEM eDestination
, IHTMLElement
*pIElement
)
5104 HTMLDocument
*This
= impl_from_IDisplayServices(iface
);
5105 FIXME("(%p)->(%s,%d,%d,%p)\n", This
, wine_dbgstr_rect(pRect
), eSource
, eDestination
, pIElement
);
5109 static HRESULT WINAPI
DisplayServices_TransformPoint(IDisplayServices
*iface
,
5110 POINT
*pPoint
, COORD_SYSTEM eSource
, COORD_SYSTEM eDestination
, IHTMLElement
*pIElement
)
5112 HTMLDocument
*This
= impl_from_IDisplayServices(iface
);
5113 FIXME("(%p)->(%s,%d,%d,%p)\n", This
, wine_dbgstr_point(pPoint
), eSource
, eDestination
, pIElement
);
5117 static HRESULT WINAPI
DisplayServices_GetCaret(IDisplayServices
*iface
, IHTMLCaret
**ppCaret
)
5119 HTMLDocument
*This
= impl_from_IDisplayServices(iface
);
5120 FIXME("(%p)->(%p)\n", This
, ppCaret
);
5124 static HRESULT WINAPI
DisplayServices_GetComputedStyle(IDisplayServices
*iface
,
5125 IMarkupPointer
*pPointer
, IHTMLComputedStyle
**ppComputedStyle
)
5127 HTMLDocument
*This
= impl_from_IDisplayServices(iface
);
5128 FIXME("(%p)->(%p,%p)\n", This
, pPointer
, ppComputedStyle
);
5132 static HRESULT WINAPI
DisplayServices_ScrollRectIntoView(IDisplayServices
*iface
,
5133 IHTMLElement
*pIElement
, RECT rect
)
5135 HTMLDocument
*This
= impl_from_IDisplayServices(iface
);
5136 FIXME("(%p)->(%p,%s)\n", This
, pIElement
, wine_dbgstr_rect(&rect
));
5140 static HRESULT WINAPI
DisplayServices_HasFlowLayout(IDisplayServices
*iface
,
5141 IHTMLElement
*pIElement
, BOOL
*pfHasFlowLayout
)
5143 HTMLDocument
*This
= impl_from_IDisplayServices(iface
);
5144 FIXME("(%p)->(%p,%p)\n", This
, pIElement
, pfHasFlowLayout
);
5148 static const IDisplayServicesVtbl DisplayServicesVtbl
= {
5149 DisplayServices_QueryInterface
,
5150 DisplayServices_AddRef
,
5151 DisplayServices_Release
,
5152 DisplayServices_CreateDisplayPointer
,
5153 DisplayServices_TransformRect
,
5154 DisplayServices_TransformPoint
,
5155 DisplayServices_GetCaret
,
5156 DisplayServices_GetComputedStyle
,
5157 DisplayServices_ScrollRectIntoView
,
5158 DisplayServices_HasFlowLayout
5161 /**********************************************************
5162 * IDocumentRange implementation
5164 static inline HTMLDocument
*impl_from_IDocumentRange(IDocumentRange
*iface
)
5166 return CONTAINING_RECORD(iface
, HTMLDocument
, IDocumentRange_iface
);
5169 static HRESULT WINAPI
DocumentRange_QueryInterface(IDocumentRange
*iface
, REFIID riid
, void **ppv
)
5171 HTMLDocument
*This
= impl_from_IDocumentRange(iface
);
5173 return htmldoc_query_interface(This
, riid
, ppv
);
5176 static ULONG WINAPI
DocumentRange_AddRef(IDocumentRange
*iface
)
5178 HTMLDocument
*This
= impl_from_IDocumentRange(iface
);
5180 return htmldoc_addref(This
);
5183 static ULONG WINAPI
DocumentRange_Release(IDocumentRange
*iface
)
5185 HTMLDocument
*This
= impl_from_IDocumentRange(iface
);
5187 return htmldoc_release(This
);
5190 static HRESULT WINAPI
DocumentRange_GetTypeInfoCount(IDocumentRange
*iface
, UINT
*pctinfo
)
5192 HTMLDocument
*This
= impl_from_IDocumentRange(iface
);
5194 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
5197 static HRESULT WINAPI
DocumentRange_GetTypeInfo(IDocumentRange
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
5199 HTMLDocument
*This
= impl_from_IDocumentRange(iface
);
5201 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
5204 static HRESULT WINAPI
DocumentRange_GetIDsOfNames(IDocumentRange
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
5205 LCID lcid
, DISPID
*rgDispId
)
5207 HTMLDocument
*This
= impl_from_IDocumentRange(iface
);
5209 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
5213 static HRESULT WINAPI
DocumentRange_Invoke(IDocumentRange
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
5214 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
5216 HTMLDocument
*This
= impl_from_IDocumentRange(iface
);
5218 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
5219 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
5222 static HRESULT WINAPI
DocumentRange_createRange(IDocumentRange
*iface
, IHTMLDOMRange
**p
)
5224 HTMLDocument
*This
= impl_from_IDocumentRange(iface
);
5225 nsIDOMRange
*nsrange
;
5228 TRACE("(%p)->(%p)\n", This
, p
);
5230 if(!This
->doc_node
->nsdoc
) {
5231 WARN("NULL nsdoc\n");
5232 return E_UNEXPECTED
;
5235 if(NS_FAILED(nsIDOMHTMLDocument_CreateRange(This
->doc_node
->nsdoc
, &nsrange
)))
5238 hres
= HTMLDOMRange_Create(nsrange
, p
);
5239 nsIDOMRange_Release(nsrange
);
5243 static const IDocumentRangeVtbl DocumentRangeVtbl
= {
5244 DocumentRange_QueryInterface
,
5245 DocumentRange_AddRef
,
5246 DocumentRange_Release
,
5247 DocumentRange_GetTypeInfoCount
,
5248 DocumentRange_GetTypeInfo
,
5249 DocumentRange_GetIDsOfNames
,
5250 DocumentRange_Invoke
,
5251 DocumentRange_createRange
,
5254 static BOOL
htmldoc_qi(HTMLDocument
*This
, REFIID riid
, void **ppv
)
5258 if(IsEqualGUID(&IID_IUnknown
, riid
))
5259 *ppv
= &This
->IHTMLDocument2_iface
;
5260 else if(IsEqualGUID(&IID_IDispatch
, riid
))
5261 *ppv
= &This
->IDispatchEx_iface
;
5262 else if(IsEqualGUID(&IID_IDispatchEx
, riid
))
5263 *ppv
= &This
->IDispatchEx_iface
;
5264 else if(IsEqualGUID(&IID_IHTMLDocument
, riid
))
5265 *ppv
= &This
->IHTMLDocument2_iface
;
5266 else if(IsEqualGUID(&IID_IHTMLDocument2
, riid
))
5267 *ppv
= &This
->IHTMLDocument2_iface
;
5268 else if(IsEqualGUID(&IID_IHTMLDocument3
, riid
))
5269 *ppv
= &This
->IHTMLDocument3_iface
;
5270 else if(IsEqualGUID(&IID_IHTMLDocument4
, riid
))
5271 *ppv
= &This
->IHTMLDocument4_iface
;
5272 else if(IsEqualGUID(&IID_IHTMLDocument5
, riid
))
5273 *ppv
= &This
->IHTMLDocument5_iface
;
5274 else if(IsEqualGUID(&IID_IHTMLDocument6
, riid
))
5275 *ppv
= &This
->IHTMLDocument6_iface
;
5276 else if(IsEqualGUID(&IID_IHTMLDocument7
, riid
))
5277 *ppv
= &This
->IHTMLDocument7_iface
;
5278 else if(IsEqualGUID(&IID_IDocumentSelector
, riid
))
5279 *ppv
= &This
->IDocumentSelector_iface
;
5280 else if(IsEqualGUID(&IID_IDocumentEvent
, riid
))
5281 *ppv
= &This
->IDocumentEvent_iface
;
5282 else if(IsEqualGUID(&IID_IPersist
, riid
))
5283 *ppv
= &This
->IPersistFile_iface
;
5284 else if(IsEqualGUID(&IID_IPersistMoniker
, riid
))
5285 *ppv
= &This
->IPersistMoniker_iface
;
5286 else if(IsEqualGUID(&IID_IPersistFile
, riid
))
5287 *ppv
= &This
->IPersistFile_iface
;
5288 else if(IsEqualGUID(&IID_IMonikerProp
, riid
))
5289 *ppv
= &This
->IMonikerProp_iface
;
5290 else if(IsEqualGUID(&IID_IOleObject
, riid
))
5291 *ppv
= &This
->IOleObject_iface
;
5292 else if(IsEqualGUID(&IID_IOleDocument
, riid
))
5293 *ppv
= &This
->IOleDocument_iface
;
5294 else if(IsEqualGUID(&IID_IOleInPlaceActiveObject
, riid
))
5295 *ppv
= &This
->IOleInPlaceActiveObject_iface
;
5296 else if(IsEqualGUID(&IID_IOleWindow
, riid
))
5297 *ppv
= &This
->IOleInPlaceActiveObject_iface
;
5298 else if(IsEqualGUID(&IID_IOleInPlaceObject
, riid
))
5299 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
5300 else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless
, riid
))
5301 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
5302 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
5303 *ppv
= &This
->IServiceProvider_iface
;
5304 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
5305 *ppv
= &This
->IOleCommandTarget_iface
;
5306 else if(IsEqualGUID(&IID_IOleControl
, riid
))
5307 *ppv
= &This
->IOleControl_iface
;
5308 else if(IsEqualGUID(&IID_IHlinkTarget
, riid
))
5309 *ppv
= &This
->IHlinkTarget_iface
;
5310 else if(IsEqualGUID(&IID_IConnectionPointContainer
, riid
))
5311 *ppv
= &This
->cp_container
.IConnectionPointContainer_iface
;
5312 else if(IsEqualGUID(&IID_IPersistStreamInit
, riid
))
5313 *ppv
= &This
->IPersistStreamInit_iface
;
5314 else if(IsEqualGUID(&DIID_DispHTMLDocument
, riid
))
5315 *ppv
= &This
->IHTMLDocument2_iface
;
5316 else if(IsEqualGUID(&IID_ISupportErrorInfo
, riid
))
5317 *ppv
= &This
->ISupportErrorInfo_iface
;
5318 else if(IsEqualGUID(&IID_IPersistHistory
, riid
))
5319 *ppv
= &This
->IPersistHistory_iface
;
5320 else if(IsEqualGUID(&IID_IObjectWithSite
, riid
))
5321 *ppv
= &This
->IObjectWithSite_iface
;
5322 else if(IsEqualGUID(&IID_IOleContainer
, riid
))
5323 *ppv
= &This
->IOleContainer_iface
;
5324 else if(IsEqualGUID(&IID_IObjectSafety
, riid
))
5325 *ppv
= &This
->IObjectSafety_iface
;
5326 else if(IsEqualGUID(&IID_IProvideClassInfo
, riid
))
5327 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
5328 else if(IsEqualGUID(&IID_IProvideClassInfo2
, riid
))
5329 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
5330 else if(IsEqualGUID(&IID_IProvideMultipleClassInfo
, riid
))
5331 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
5332 else if(IsEqualGUID(&IID_IMarkupServices
, riid
))
5333 *ppv
= &This
->IMarkupServices_iface
;
5334 else if(IsEqualGUID(&IID_IMarkupContainer
, riid
))
5335 *ppv
= &This
->IMarkupContainer_iface
;
5336 else if(IsEqualGUID(&IID_IDisplayServices
, riid
))
5337 *ppv
= &This
->IDisplayServices_iface
;
5338 else if(IsEqualGUID(&IID_IDocumentRange
, riid
))
5339 *ppv
= &This
->IDocumentRange_iface
;
5340 else if(IsEqualGUID(&CLSID_CMarkup
, riid
)) {
5341 FIXME("(%p)->(CLSID_CMarkup %p)\n", This
, ppv
);
5343 }else if(IsEqualGUID(&IID_IRunnableObject
, riid
)) {
5344 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This
, ppv
);
5346 }else if(IsEqualGUID(&IID_IPersistPropertyBag
, riid
)) {
5347 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This
, ppv
);
5349 }else if(IsEqualGUID(&IID_IExternalConnection
, riid
)) {
5350 TRACE("(%p)->(IID_IExternalConnection %p) returning NULL\n", This
, ppv
);
5352 }else if(IsEqualGUID(&IID_IStdMarshalInfo
, riid
)) {
5353 TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This
, ppv
);
5360 IUnknown_AddRef((IUnknown
*)*ppv
);
5364 static cp_static_data_t HTMLDocumentEvents_data
= { HTMLDocumentEvents_tid
, HTMLDocument_on_advise
};
5365 static cp_static_data_t HTMLDocumentEvents2_data
= { HTMLDocumentEvents2_tid
, HTMLDocument_on_advise
, TRUE
};
5367 static const cpc_entry_t HTMLDocument_cpc
[] = {
5368 {&IID_IDispatch
, &HTMLDocumentEvents_data
},
5369 {&IID_IPropertyNotifySink
},
5370 {&DIID_HTMLDocumentEvents
, &HTMLDocumentEvents_data
},
5371 {&DIID_HTMLDocumentEvents2
, &HTMLDocumentEvents2_data
},
5375 static void init_doc(HTMLDocument
*doc
, IUnknown
*outer
, IDispatchEx
*dispex
)
5377 doc
->IHTMLDocument2_iface
.lpVtbl
= &HTMLDocumentVtbl
;
5378 doc
->IHTMLDocument3_iface
.lpVtbl
= &HTMLDocument3Vtbl
;
5379 doc
->IHTMLDocument4_iface
.lpVtbl
= &HTMLDocument4Vtbl
;
5380 doc
->IHTMLDocument5_iface
.lpVtbl
= &HTMLDocument5Vtbl
;
5381 doc
->IHTMLDocument6_iface
.lpVtbl
= &HTMLDocument6Vtbl
;
5382 doc
->IHTMLDocument7_iface
.lpVtbl
= &HTMLDocument7Vtbl
;
5383 doc
->IDispatchEx_iface
.lpVtbl
= &DocDispatchExVtbl
;
5384 doc
->IDocumentSelector_iface
.lpVtbl
= &DocumentSelectorVtbl
;
5385 doc
->IDocumentEvent_iface
.lpVtbl
= &DocumentEventVtbl
;
5386 doc
->ISupportErrorInfo_iface
.lpVtbl
= &SupportErrorInfoVtbl
;
5387 doc
->IProvideMultipleClassInfo_iface
.lpVtbl
= &ProvideMultipleClassInfoVtbl
;
5388 doc
->IMarkupServices_iface
.lpVtbl
= &MarkupServicesVtbl
;
5389 doc
->IMarkupContainer_iface
.lpVtbl
= &MarkupContainerVtbl
;
5390 doc
->IDisplayServices_iface
.lpVtbl
= &DisplayServicesVtbl
;
5391 doc
->IDocumentRange_iface
.lpVtbl
= &DocumentRangeVtbl
;
5393 doc
->outer_unk
= outer
;
5394 doc
->dispex
= dispex
;
5396 HTMLDocument_Persist_Init(doc
);
5397 HTMLDocument_OleCmd_Init(doc
);
5398 HTMLDocument_OleObj_Init(doc
);
5399 HTMLDocument_Service_Init(doc
);
5401 ConnectionPointContainer_Init(&doc
->cp_container
, (IUnknown
*)&doc
->IHTMLDocument2_iface
, HTMLDocument_cpc
);
5404 static inline HTMLDocumentNode
*impl_from_HTMLDOMNode(HTMLDOMNode
*iface
)
5406 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
);
5409 static HRESULT
HTMLDocumentNode_QI(HTMLDOMNode
*iface
, REFIID riid
, void **ppv
)
5411 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
5413 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
5415 if(htmldoc_qi(&This
->basedoc
, riid
, ppv
))
5416 return *ppv
? S_OK
: E_NOINTERFACE
;
5418 if(IsEqualGUID(&IID_IInternetHostSecurityManager
, riid
))
5419 *ppv
= &This
->IInternetHostSecurityManager_iface
;
5421 return HTMLDOMNode_QI(&This
->node
, riid
, ppv
);
5423 IUnknown_AddRef((IUnknown
*)*ppv
);
5427 void detach_document_node(HTMLDocumentNode
*doc
)
5431 while(!list_empty(&doc
->plugin_hosts
))
5432 detach_plugin_host(LIST_ENTRY(list_head(&doc
->plugin_hosts
), PluginHost
, entry
));
5434 if(doc
->dom_implementation
) {
5435 detach_dom_implementation(doc
->dom_implementation
);
5436 IHTMLDOMImplementation_Release(doc
->dom_implementation
);
5437 doc
->dom_implementation
= NULL
;
5440 if(doc
->namespaces
) {
5441 IHTMLNamespaceCollection_Release(doc
->namespaces
);
5442 doc
->namespaces
= NULL
;
5446 detach_selection(doc
);
5449 for(i
=0; i
< doc
->elem_vars_cnt
; i
++)
5450 heap_free(doc
->elem_vars
[i
]);
5451 heap_free(doc
->elem_vars
);
5452 doc
->elem_vars_cnt
= doc
->elem_vars_size
= 0;
5453 doc
->elem_vars
= NULL
;
5456 ICatInformation_Release(doc
->catmgr
);
5460 if(!doc
->nsdoc
&& doc
->window
) {
5461 /* document fragments own reference to inner window */
5462 IHTMLWindow2_Release(&doc
->window
->base
.IHTMLWindow2_iface
);
5467 list_remove(&doc
->browser_entry
);
5468 doc
->browser
= NULL
;
5472 static void HTMLDocumentNode_destructor(HTMLDOMNode
*iface
)
5474 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
5476 TRACE("(%p)\n", This
);
5478 heap_free(This
->event_vector
);
5479 ConnectionPointContainer_Destroy(&This
->basedoc
.cp_container
);
5482 static HRESULT
HTMLDocumentNode_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
5484 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
5485 FIXME("%p\n", This
);
5489 static void HTMLDocumentNode_traverse(HTMLDOMNode
*iface
, nsCycleCollectionTraversalCallback
*cb
)
5491 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
5494 note_cc_edge((nsISupports
*)This
->nsdoc
, "This->nsdoc", cb
);
5497 static void HTMLDocumentNode_unlink(HTMLDOMNode
*iface
)
5499 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
5502 nsIDOMHTMLDocument
*nsdoc
= This
->nsdoc
;
5504 release_document_mutation(This
);
5505 detach_document_node(This
);
5507 nsIDOMHTMLDocument_Release(nsdoc
);
5508 This
->window
= NULL
;
5512 static const NodeImplVtbl HTMLDocumentNodeImplVtbl
= {
5513 &CLSID_HTMLDocument
,
5514 HTMLDocumentNode_QI
,
5515 HTMLDocumentNode_destructor
,
5517 HTMLDocumentNode_clone
,
5528 HTMLDocumentNode_traverse
,
5529 HTMLDocumentNode_unlink
5532 static HRESULT
HTMLDocumentFragment_clone(HTMLDOMNode
*iface
, nsIDOMNode
*nsnode
, HTMLDOMNode
**ret
)
5534 HTMLDocumentNode
*This
= impl_from_HTMLDOMNode(iface
);
5535 HTMLDocumentNode
*new_node
;
5538 hres
= create_document_fragment(nsnode
, This
->node
.doc
, &new_node
);
5542 *ret
= &new_node
->node
;
5546 static inline HTMLDocumentNode
*impl_from_DispatchEx(DispatchEx
*iface
)
5548 return CONTAINING_RECORD(iface
, HTMLDocumentNode
, node
.event_target
.dispex
);
5551 static HRESULT
HTMLDocumentNode_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
5552 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
5554 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5555 nsIDOMNodeList
*node_list
;
5563 if(flags
!= DISPATCH_PROPERTYGET
&& flags
!= (DISPATCH_METHOD
|DISPATCH_PROPERTYGET
)) {
5564 FIXME("unsupported flags %x\n", flags
);
5568 i
= id
- MSHTML_DISPID_CUSTOM_MIN
;
5570 if(!This
->nsdoc
|| i
>= This
->elem_vars_cnt
)
5571 return DISP_E_UNKNOWNNAME
;
5573 nsAString_InitDepend(&name_str
, This
->elem_vars
[i
]);
5574 nsres
= nsIDOMHTMLDocument_GetElementsByName(This
->nsdoc
, &name_str
, &node_list
);
5575 nsAString_Finish(&name_str
);
5576 if(NS_FAILED(nsres
))
5579 nsres
= nsIDOMNodeList_Item(node_list
, 0, &nsnode
);
5580 nsIDOMNodeList_Release(node_list
);
5581 if(NS_FAILED(nsres
) || !nsnode
)
5582 return DISP_E_UNKNOWNNAME
;
5584 hres
= get_node(nsnode
, TRUE
, &node
);
5588 V_VT(res
) = VT_DISPATCH
;
5589 V_DISPATCH(res
) = (IDispatch
*)&node
->IHTMLDOMNode_iface
;
5593 static compat_mode_t
HTMLDocumentNode_get_compat_mode(DispatchEx
*dispex
)
5595 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5597 TRACE("(%p) returning %u\n", This
, This
->document_mode
);
5599 return lock_document_mode(This
);
5602 static nsISupports
*HTMLDocumentNode_get_gecko_target(DispatchEx
*dispex
)
5604 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5605 return (nsISupports
*)This
->node
.nsnode
;
5608 static void HTMLDocumentNode_bind_event(DispatchEx
*dispex
, eventid_t eid
)
5610 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5611 ensure_doc_nsevent_handler(This
, This
->node
.nsnode
, eid
);
5614 static EventTarget
*HTMLDocumentNode_get_parent_event_target(DispatchEx
*dispex
)
5616 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5619 IHTMLWindow2_AddRef(&This
->window
->base
.IHTMLWindow2_iface
);
5620 return &This
->window
->event_target
;
5623 static ConnectionPointContainer
*HTMLDocumentNode_get_cp_container(DispatchEx
*dispex
)
5625 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5626 ConnectionPointContainer
*container
= This
->basedoc
.doc_obj
5627 ? &This
->basedoc
.doc_obj
->basedoc
.cp_container
: &This
->basedoc
.cp_container
;
5628 IConnectionPointContainer_AddRef(&container
->IConnectionPointContainer_iface
);
5632 static IHTMLEventObj
*HTMLDocumentNode_set_current_event(DispatchEx
*dispex
, IHTMLEventObj
*event
)
5634 HTMLDocumentNode
*This
= impl_from_DispatchEx(dispex
);
5635 return default_set_current_event(This
->window
, event
);
5638 static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl
= {
5642 HTMLDocumentNode_invoke
,
5643 HTMLDocumentNode_get_compat_mode
,
5646 HTMLDocumentNode_get_gecko_target
,
5647 HTMLDocumentNode_bind_event
,
5648 HTMLDocumentNode_get_parent_event_target
,
5650 HTMLDocumentNode_get_cp_container
,
5651 HTMLDocumentNode_set_current_event
5654 static const NodeImplVtbl HTMLDocumentFragmentImplVtbl
= {
5655 &CLSID_HTMLDocument
,
5656 HTMLDocumentNode_QI
,
5657 HTMLDocumentNode_destructor
,
5659 HTMLDocumentFragment_clone
5662 static const tid_t HTMLDocumentNode_iface_tids
[] = {
5668 IDocumentSelector_tid
,
5672 static void HTMLDocumentNode_init_dispex_info(dispex_data_t
*info
, compat_mode_t mode
)
5674 HTMLDOMNode_init_dispex_info(info
, mode
);
5676 if(mode
>= COMPAT_MODE_IE9
) {
5677 dispex_info_add_interface(info
, IHTMLDocument7_tid
, NULL
);
5678 dispex_info_add_interface(info
, IDocumentEvent_tid
, NULL
);
5681 /* Depending on compatibility version, we add interfaces in different order
5682 * so that the right getElementById implementation is used. */
5683 if(mode
< COMPAT_MODE_IE8
) {
5684 dispex_info_add_interface(info
, IHTMLDocument3_tid
, NULL
);
5685 dispex_info_add_interface(info
, IHTMLDocument6_tid
, NULL
);
5687 dispex_info_add_interface(info
, IHTMLDocument6_tid
, NULL
);
5688 dispex_info_add_interface(info
, IHTMLDocument3_tid
, NULL
);
5692 static dispex_static_data_t HTMLDocumentNode_dispex
= {
5693 &HTMLDocumentNode_event_target_vtbl
.dispex_vtbl
,
5694 DispHTMLDocument_tid
,
5695 HTMLDocumentNode_iface_tids
,
5696 HTMLDocumentNode_init_dispex_info
5699 static HTMLDocumentNode
*alloc_doc_node(HTMLDocumentObj
*doc_obj
, HTMLInnerWindow
*window
)
5701 HTMLDocumentNode
*doc
;
5703 doc
= heap_alloc_zero(sizeof(HTMLDocumentNode
));
5708 doc
->basedoc
.doc_node
= doc
;
5709 doc
->basedoc
.doc_obj
= doc_obj
;
5710 doc
->basedoc
.window
= window
? window
->base
.outer_window
: NULL
;
5711 doc
->window
= window
;
5713 init_doc(&doc
->basedoc
, (IUnknown
*)&doc
->node
.IHTMLDOMNode_iface
,
5714 &doc
->node
.event_target
.dispex
.IDispatchEx_iface
);
5715 HTMLDocumentNode_SecMgr_Init(doc
);
5717 list_init(&doc
->selection_list
);
5718 list_init(&doc
->range_list
);
5719 list_init(&doc
->plugin_hosts
);
5724 HRESULT
create_document_node(nsIDOMHTMLDocument
*nsdoc
, GeckoBrowser
*browser
, HTMLInnerWindow
*window
,
5725 compat_mode_t parent_mode
, HTMLDocumentNode
**ret
)
5727 HTMLDocumentObj
*doc_obj
= browser
->doc
;
5728 HTMLDocumentNode
*doc
;
5730 doc
= alloc_doc_node(doc_obj
, window
);
5732 return E_OUTOFMEMORY
;
5734 if(parent_mode
>= COMPAT_MODE_IE9
) {
5735 TRACE("using parent mode %u\n", parent_mode
);
5736 doc
->document_mode
= parent_mode
;
5737 lock_document_mode(doc
);
5740 if(!doc_obj
->basedoc
.window
|| (window
&& is_main_content_window(window
->base
.outer_window
)))
5741 doc
->basedoc
.cp_container
.forward_container
= &doc_obj
->basedoc
.cp_container
;
5743 HTMLDOMNode_Init(doc
, &doc
->node
, (nsIDOMNode
*)nsdoc
, &HTMLDocumentNode_dispex
);
5745 nsIDOMHTMLDocument_AddRef(nsdoc
);
5748 init_document_mutation(doc
);
5749 doc_init_events(doc
);
5751 doc
->node
.vtbl
= &HTMLDocumentNodeImplVtbl
;
5753 list_add_head(&browser
->document_nodes
, &doc
->browser_entry
);
5754 doc
->browser
= browser
;
5756 if(browser
->usermode
== EDITMODE
) {
5760 static const PRUnichar onW
[] = {'o','n',0};
5762 nsAString_InitDepend(&mode_str
, onW
);
5763 nsres
= nsIDOMHTMLDocument_SetDesignMode(doc
->nsdoc
, &mode_str
);
5764 nsAString_Finish(&mode_str
);
5765 if(NS_FAILED(nsres
))
5766 ERR("SetDesignMode failed: %08x\n", nsres
);
5773 static HRESULT
create_document_fragment(nsIDOMNode
*nsnode
, HTMLDocumentNode
*doc_node
, HTMLDocumentNode
**ret
)
5775 HTMLDocumentNode
*doc_frag
;
5777 doc_frag
= alloc_doc_node(doc_node
->basedoc
.doc_obj
, doc_node
->window
);
5779 return E_OUTOFMEMORY
;
5781 IHTMLWindow2_AddRef(&doc_frag
->window
->base
.IHTMLWindow2_iface
);
5783 HTMLDOMNode_Init(doc_node
, &doc_frag
->node
, nsnode
, &HTMLDocumentNode_dispex
);
5784 doc_frag
->node
.vtbl
= &HTMLDocumentFragmentImplVtbl
;
5785 doc_frag
->document_mode
= lock_document_mode(doc_node
);
5791 HRESULT
get_document_node(nsIDOMDocument
*dom_document
, HTMLDocumentNode
**ret
)
5796 hres
= get_node((nsIDOMNode
*)dom_document
, FALSE
, &node
);
5801 ERR("document not initialized\n");
5805 assert(node
->vtbl
== &HTMLDocumentNodeImplVtbl
);
5806 *ret
= impl_from_HTMLDOMNode(node
);
5810 static inline HTMLDocumentObj
*impl_from_IUnknown(IUnknown
*iface
)
5812 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IUnknown_inner
);
5815 static HRESULT WINAPI
HTMLDocumentObj_QueryInterface(IUnknown
*iface
, REFIID riid
, void **ppv
)
5817 HTMLDocumentObj
*This
= impl_from_IUnknown(iface
);
5819 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
5821 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
5822 *ppv
= &This
->IUnknown_inner
;
5823 }else if(htmldoc_qi(&This
->basedoc
, riid
, ppv
)) {
5824 return *ppv
? S_OK
: E_NOINTERFACE
;
5825 }else if(IsEqualGUID(&IID_ICustomDoc
, riid
)) {
5826 *ppv
= &This
->ICustomDoc_iface
;
5827 }else if(IsEqualGUID(&IID_IOleDocumentView
, riid
)) {
5828 *ppv
= &This
->IOleDocumentView_iface
;
5829 }else if(IsEqualGUID(&IID_IViewObject
, riid
)) {
5830 *ppv
= &This
->IViewObjectEx_iface
;
5831 }else if(IsEqualGUID(&IID_IViewObject2
, riid
)) {
5832 *ppv
= &This
->IViewObjectEx_iface
;
5833 }else if(IsEqualGUID(&IID_IViewObjectEx
, riid
)) {
5834 *ppv
= &This
->IViewObjectEx_iface
;
5835 }else if(IsEqualGUID(&IID_ITargetContainer
, riid
)) {
5836 *ppv
= &This
->ITargetContainer_iface
;
5837 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
5838 return *ppv
? S_OK
: E_NOINTERFACE
;
5840 FIXME("Unimplemented interface %s\n", debugstr_mshtml_guid(riid
));
5842 return E_NOINTERFACE
;
5845 IUnknown_AddRef((IUnknown
*)*ppv
);
5849 static ULONG WINAPI
HTMLDocumentObj_AddRef(IUnknown
*iface
)
5851 HTMLDocumentObj
*This
= impl_from_IUnknown(iface
);
5852 ULONG ref
= InterlockedIncrement(&This
->ref
);
5854 TRACE("(%p) ref = %u\n", This
, ref
);
5859 static ULONG WINAPI
HTMLDocumentObj_Release(IUnknown
*iface
)
5861 HTMLDocumentObj
*This
= impl_from_IUnknown(iface
);
5862 ULONG ref
= InterlockedDecrement(&This
->ref
);
5864 TRACE("(%p) ref = %u\n", This
, ref
);
5867 if(This
->basedoc
.doc_node
) {
5868 This
->basedoc
.doc_node
->basedoc
.doc_obj
= NULL
;
5869 htmldoc_release(&This
->basedoc
.doc_node
->basedoc
);
5871 if(This
->basedoc
.window
)
5872 IHTMLWindow2_Release(&This
->basedoc
.window
->base
.IHTMLWindow2_iface
);
5873 if(This
->advise_holder
)
5874 IOleAdviseHolder_Release(This
->advise_holder
);
5877 IAdviseSink_Release(This
->view_sink
);
5879 IOleObject_SetClientSite(&This
->basedoc
.IOleObject_iface
, NULL
);
5881 ICustomDoc_SetUIHandler(&This
->ICustomDoc_iface
, NULL
);
5882 if(This
->in_place_active
)
5883 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->basedoc
.IOleInPlaceObjectWindowless_iface
);
5885 IOleDocumentView_SetInPlaceSite(&This
->IOleDocumentView_iface
, NULL
);
5887 IOleUndoManager_Release(This
->undomgr
);
5889 IHTMLEditServices_Release(This
->editsvcs
);
5890 if(This
->tooltips_hwnd
)
5891 DestroyWindow(This
->tooltips_hwnd
);
5894 DestroyWindow(This
->hwnd
);
5895 heap_free(This
->mime
);
5897 remove_target_tasks(This
->task_magic
);
5898 ConnectionPointContainer_Destroy(&This
->basedoc
.cp_container
);
5899 release_dispex(&This
->dispex
);
5901 if(This
->nscontainer
)
5902 detach_gecko_browser(This
->nscontainer
);
5909 static const IUnknownVtbl HTMLDocumentObjVtbl
= {
5910 HTMLDocumentObj_QueryInterface
,
5911 HTMLDocumentObj_AddRef
,
5912 HTMLDocumentObj_Release
5915 /**********************************************************
5916 * ICustomDoc implementation
5919 static inline HTMLDocumentObj
*impl_from_ICustomDoc(ICustomDoc
*iface
)
5921 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, ICustomDoc_iface
);
5924 static HRESULT WINAPI
CustomDoc_QueryInterface(ICustomDoc
*iface
, REFIID riid
, void **ppv
)
5926 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5928 return htmldoc_query_interface(&This
->basedoc
, riid
, ppv
);
5931 static ULONG WINAPI
CustomDoc_AddRef(ICustomDoc
*iface
)
5933 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5935 return htmldoc_addref(&This
->basedoc
);
5938 static ULONG WINAPI
CustomDoc_Release(ICustomDoc
*iface
)
5940 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5942 return htmldoc_release(&This
->basedoc
);
5945 static HRESULT WINAPI
CustomDoc_SetUIHandler(ICustomDoc
*iface
, IDocHostUIHandler
*pUIHandler
)
5947 HTMLDocumentObj
*This
= impl_from_ICustomDoc(iface
);
5948 IOleCommandTarget
*cmdtrg
;
5951 TRACE("(%p)->(%p)\n", This
, pUIHandler
);
5953 if(This
->custom_hostui
&& This
->hostui
== pUIHandler
)
5956 This
->custom_hostui
= TRUE
;
5959 IDocHostUIHandler_Release(This
->hostui
);
5961 IDocHostUIHandler_AddRef(pUIHandler
);
5962 This
->hostui
= pUIHandler
;
5966 hres
= IDocHostUIHandler_QueryInterface(pUIHandler
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5967 if(SUCCEEDED(hres
)) {
5968 FIXME("custom UI handler supports IOleCommandTarget\n");
5969 IOleCommandTarget_Release(cmdtrg
);
5975 static const ICustomDocVtbl CustomDocVtbl
= {
5976 CustomDoc_QueryInterface
,
5979 CustomDoc_SetUIHandler
5982 static const tid_t HTMLDocumentObj_iface_tids
[] = {
5989 static dispex_static_data_t HTMLDocumentObj_dispex
= {
5991 DispHTMLDocument_tid
,
5992 HTMLDocumentObj_iface_tids
5995 static HRESULT
create_document_object(BOOL is_mhtml
, IUnknown
*outer
, REFIID riid
, void **ppv
)
5997 HTMLDocumentObj
*doc
;
6000 if(outer
&& !IsEqualGUID(&IID_IUnknown
, riid
)) {
6002 return E_INVALIDARG
;
6005 /* ensure that security manager is initialized */
6006 if(!get_security_manager())
6007 return E_OUTOFMEMORY
;
6009 doc
= heap_alloc_zero(sizeof(HTMLDocumentObj
));
6011 return E_OUTOFMEMORY
;
6014 doc
->IUnknown_inner
.lpVtbl
= &HTMLDocumentObjVtbl
;
6015 doc
->ICustomDoc_iface
.lpVtbl
= &CustomDocVtbl
;
6017 doc
->basedoc
.doc_obj
= doc
;
6019 init_dispex(&doc
->dispex
, (IUnknown
*)&doc
->ICustomDoc_iface
, &HTMLDocumentObj_dispex
);
6020 init_doc(&doc
->basedoc
, outer
? outer
: &doc
->IUnknown_inner
, &doc
->dispex
.IDispatchEx_iface
);
6021 TargetContainer_Init(doc
);
6022 doc
->is_mhtml
= is_mhtml
;
6024 doc
->task_magic
= get_task_target_magic();
6026 HTMLDocument_View_Init(doc
);
6028 hres
= create_gecko_browser(doc
, &doc
->nscontainer
);
6030 ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n");
6031 htmldoc_release(&doc
->basedoc
);
6035 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
6036 *ppv
= &doc
->IUnknown_inner
;
6038 hres
= htmldoc_query_interface(&doc
->basedoc
, riid
, ppv
);
6039 htmldoc_release(&doc
->basedoc
);
6044 doc
->basedoc
.window
= doc
->nscontainer
->content_window
;
6045 IHTMLWindow2_AddRef(&doc
->basedoc
.window
->base
.IHTMLWindow2_iface
);
6047 if(!doc
->basedoc
.doc_node
&& doc
->basedoc
.window
->base
.inner_window
->doc
) {
6048 doc
->basedoc
.doc_node
= doc
->basedoc
.window
->base
.inner_window
->doc
;
6049 htmldoc_addref(&doc
->basedoc
.doc_node
->basedoc
);
6057 HRESULT
HTMLDocument_Create(IUnknown
*outer
, REFIID riid
, void **ppv
)
6059 TRACE("(%p %s %p)\n", outer
, debugstr_mshtml_guid(riid
), ppv
);
6060 return create_document_object(FALSE
, outer
, riid
, ppv
);
6063 HRESULT
MHTMLDocument_Create(IUnknown
*outer
, REFIID riid
, void **ppv
)
6065 TRACE("(%p %s %p)\n", outer
, debugstr_mshtml_guid(riid
), ppv
);
6066 return create_document_object(TRUE
, outer
, riid
, ppv
);