2 * Copyright 2005 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
19 #define WIN32_NO_STATUS
32 //#include "winuser.h"
35 #include <wine/debug.h>
37 #include "mshtml_private.h"
38 #include "htmlevent.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
42 HRESULT
get_doc_elem_by_id(HTMLDocumentNode
*doc
, const WCHAR
*id
, HTMLElement
**ret
)
44 nsIDOMNodeList
*nsnode_list
;
45 nsIDOMElement
*nselem
;
56 nsAString_InitDepend(&id_str
, id
);
57 /* get element by id attribute */
58 nsres
= nsIDOMHTMLDocument_GetElementById(doc
->nsdoc
, &id_str
, &nselem
);
60 ERR("GetElementById failed: %08x\n", nsres
);
61 nsAString_Finish(&id_str
);
65 /* get first element by name attribute */
66 nsres
= nsIDOMHTMLDocument_GetElementsByName(doc
->nsdoc
, &id_str
, &nsnode_list
);
67 nsAString_Finish(&id_str
);
69 ERR("getElementsByName failed: %08x\n", nsres
);
71 nsIDOMElement_Release(nselem
);
75 nsres
= nsIDOMNodeList_Item(nsnode_list
, 0, &nsnode
);
76 nsIDOMNodeList_Release(nsnode_list
);
77 assert(nsres
== NS_OK
);
79 if(nsnode
&& nselem
) {
82 nsres
= nsIDOMNode_CompareDocumentPosition(nsnode
, (nsIDOMNode
*)nselem
, &pos
);
83 if(NS_FAILED(nsres
)) {
84 FIXME("CompareDocumentPosition failed: 0x%08x\n", nsres
);
85 nsIDOMNode_Release(nsnode
);
86 nsIDOMElement_Release(nselem
);
90 TRACE("CompareDocumentPosition gave: 0x%x\n", pos
);
91 if(!(pos
& (DOCUMENT_POSITION_PRECEDING
| DOCUMENT_POSITION_CONTAINS
))) {
92 nsIDOMElement_Release(nselem
);
99 nsres
= nsIDOMNode_QueryInterface(nsnode
, &IID_nsIDOMElement
, (void**)&nselem
);
100 assert(nsres
== NS_OK
);
102 nsIDOMNode_Release(nsnode
);
110 hres
= get_elem(doc
, nselem
, ret
);
111 nsIDOMElement_Release(nselem
);
115 static inline HTMLDocument
*impl_from_IHTMLDocument3(IHTMLDocument3
*iface
)
117 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument3_iface
);
120 static HRESULT WINAPI
HTMLDocument3_QueryInterface(IHTMLDocument3
*iface
,
121 REFIID riid
, void **ppv
)
123 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
124 return htmldoc_query_interface(This
, riid
, ppv
);
127 static ULONG WINAPI
HTMLDocument3_AddRef(IHTMLDocument3
*iface
)
129 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
130 return htmldoc_addref(This
);
133 static ULONG WINAPI
HTMLDocument3_Release(IHTMLDocument3
*iface
)
135 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
136 return htmldoc_release(This
);
139 static HRESULT WINAPI
HTMLDocument3_GetTypeInfoCount(IHTMLDocument3
*iface
, UINT
*pctinfo
)
141 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
142 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
145 static HRESULT WINAPI
HTMLDocument3_GetTypeInfo(IHTMLDocument3
*iface
, UINT iTInfo
,
146 LCID lcid
, ITypeInfo
**ppTInfo
)
148 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
149 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
152 static HRESULT WINAPI
HTMLDocument3_GetIDsOfNames(IHTMLDocument3
*iface
, REFIID riid
,
153 LPOLESTR
*rgszNames
, UINT cNames
,
154 LCID lcid
, DISPID
*rgDispId
)
156 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
157 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
161 static HRESULT WINAPI
HTMLDocument3_Invoke(IHTMLDocument3
*iface
, DISPID dispIdMember
,
162 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
163 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
165 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
166 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
167 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
170 static HRESULT WINAPI
HTMLDocument3_releaseCapture(IHTMLDocument3
*iface
)
172 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
173 FIXME("(%p)\n", This
);
177 static HRESULT WINAPI
HTMLDocument3_recalc(IHTMLDocument3
*iface
, VARIANT_BOOL fForce
)
179 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
180 FIXME("(%p)->(%x)\n", This
, fForce
);
184 static HRESULT WINAPI
HTMLDocument3_createTextNode(IHTMLDocument3
*iface
, BSTR text
,
185 IHTMLDOMNode
**newTextNode
)
187 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
194 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(text
), newTextNode
);
196 if(!This
->doc_node
->nsdoc
) {
197 WARN("NULL nsdoc\n");
201 nsAString_InitDepend(&text_str
, text
);
202 nsres
= nsIDOMHTMLDocument_CreateTextNode(This
->doc_node
->nsdoc
, &text_str
, &nstext
);
203 nsAString_Finish(&text_str
);
204 if(NS_FAILED(nsres
)) {
205 ERR("CreateTextNode failed: %08x\n", nsres
);
209 hres
= HTMLDOMTextNode_Create(This
->doc_node
, (nsIDOMNode
*)nstext
, &node
);
210 nsIDOMText_Release(nstext
);
214 *newTextNode
= &node
->IHTMLDOMNode_iface
;
218 static HRESULT WINAPI
HTMLDocument3_get_documentElement(IHTMLDocument3
*iface
, IHTMLElement
**p
)
220 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
221 nsIDOMElement
*nselem
= NULL
;
226 TRACE("(%p)->(%p)\n", This
, p
);
228 if(This
->window
->readystate
== READYSTATE_UNINITIALIZED
) {
233 if(!This
->doc_node
->nsdoc
) {
234 WARN("NULL nsdoc\n");
238 nsres
= nsIDOMHTMLDocument_GetDocumentElement(This
->doc_node
->nsdoc
, &nselem
);
239 if(NS_FAILED(nsres
)) {
240 ERR("GetDocumentElement failed: %08x\n", nsres
);
249 hres
= get_node(This
->doc_node
, (nsIDOMNode
*)nselem
, TRUE
, &node
);
250 nsIDOMElement_Release(nselem
);
254 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_IHTMLElement
, (void**)p
);
259 static HRESULT WINAPI
HTMLDocument3_uniqueID(IHTMLDocument3
*iface
, BSTR
*p
)
261 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
262 FIXME("(%p)->(%p)\n", This
, p
);
266 static HRESULT WINAPI
HTMLDocument3_attachEvent(IHTMLDocument3
*iface
, BSTR event
,
267 IDispatch
* pDisp
, VARIANT_BOOL
*pfResult
)
269 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
271 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
273 return attach_event(&This
->doc_node
->node
.event_target
, This
->doc_node
->node
.nsnode
, This
, event
, pDisp
, pfResult
);
276 static HRESULT WINAPI
HTMLDocument3_detachEvent(IHTMLDocument3
*iface
, BSTR event
,
279 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
281 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(event
), pDisp
);
283 return detach_event(This
->doc_node
->node
.event_target
, This
, event
, pDisp
);
286 static HRESULT WINAPI
HTMLDocument3_put_onrowsdelete(IHTMLDocument3
*iface
, VARIANT v
)
288 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
289 FIXME("(%p)->()\n", This
);
293 static HRESULT WINAPI
HTMLDocument3_get_onrowsdelete(IHTMLDocument3
*iface
, VARIANT
*p
)
295 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
296 FIXME("(%p)->(%p)\n", This
, p
);
300 static HRESULT WINAPI
HTMLDocument3_put_onrowsinserted(IHTMLDocument3
*iface
, VARIANT v
)
302 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
303 FIXME("(%p)->()\n", This
);
307 static HRESULT WINAPI
HTMLDocument3_get_onrowsinserted(IHTMLDocument3
*iface
, VARIANT
*p
)
309 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
310 FIXME("(%p)->(%p)\n", This
, p
);
314 static HRESULT WINAPI
HTMLDocument3_put_oncellchange(IHTMLDocument3
*iface
, VARIANT v
)
316 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
317 FIXME("(%p)->()\n", This
);
321 static HRESULT WINAPI
HTMLDocument3_get_oncellchange(IHTMLDocument3
*iface
, VARIANT
*p
)
323 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
324 FIXME("(%p)->(%p)\n", This
, p
);
328 static HRESULT WINAPI
HTMLDocument3_put_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT v
)
330 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
331 FIXME("(%p)->()\n", This
);
335 static HRESULT WINAPI
HTMLDocument3_get_ondatasetchanged(IHTMLDocument3
*iface
, VARIANT
*p
)
337 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
338 FIXME("(%p)->(%p)\n", This
, p
);
342 static HRESULT WINAPI
HTMLDocument3_put_ondataavailable(IHTMLDocument3
*iface
, VARIANT v
)
344 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
345 FIXME("(%p)->()\n", This
);
349 static HRESULT WINAPI
HTMLDocument3_get_ondataavailable(IHTMLDocument3
*iface
, VARIANT
*p
)
351 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
352 FIXME("(%p)->(%p)\n", This
, p
);
356 static HRESULT WINAPI
HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT v
)
358 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
359 FIXME("(%p)->()\n", This
);
363 static HRESULT WINAPI
HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3
*iface
, VARIANT
*p
)
365 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
366 FIXME("(%p)->(%p)\n", This
, p
);
370 static HRESULT WINAPI
HTMLDocument3_put_onpropertychange(IHTMLDocument3
*iface
, VARIANT v
)
372 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
373 FIXME("(%p)->()\n", This
);
377 static HRESULT WINAPI
HTMLDocument3_get_onpropertychange(IHTMLDocument3
*iface
, VARIANT
*p
)
379 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
380 FIXME("(%p)->(%p)\n", This
, p
);
384 static HRESULT WINAPI
HTMLDocument3_put_dir(IHTMLDocument3
*iface
, BSTR v
)
386 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
387 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
391 static HRESULT WINAPI
HTMLDocument3_get_dir(IHTMLDocument3
*iface
, BSTR
*p
)
393 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
394 FIXME("(%p)->(%p)\n", This
, p
);
398 static HRESULT WINAPI
HTMLDocument3_put_oncontextmenu(IHTMLDocument3
*iface
, VARIANT v
)
400 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
402 TRACE("(%p)->()\n", This
);
404 return set_doc_event(This
, EVENTID_CONTEXTMENU
, &v
);
407 static HRESULT WINAPI
HTMLDocument3_get_oncontextmenu(IHTMLDocument3
*iface
, VARIANT
*p
)
409 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
411 TRACE("(%p)->(%p)\n", This
, p
);
413 return get_doc_event(This
, EVENTID_CONTEXTMENU
, p
);
416 static HRESULT WINAPI
HTMLDocument3_put_onstop(IHTMLDocument3
*iface
, VARIANT v
)
418 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
419 FIXME("(%p)->()\n", This
);
423 static HRESULT WINAPI
HTMLDocument3_get_onstop(IHTMLDocument3
*iface
, VARIANT
*p
)
425 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
426 FIXME("(%p)->(%p)\n", This
, p
);
430 static HRESULT WINAPI
HTMLDocument3_createDocumentFragment(IHTMLDocument3
*iface
,
431 IHTMLDocument2
**ppNewDoc
)
433 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
434 nsIDOMDocumentFragment
*doc_frag
;
435 HTMLDocumentNode
*docnode
;
439 TRACE("(%p)->(%p)\n", This
, ppNewDoc
);
441 if(!This
->doc_node
->nsdoc
) {
442 FIXME("NULL nsdoc\n");
446 nsres
= nsIDOMHTMLDocument_CreateDocumentFragment(This
->doc_node
->nsdoc
, &doc_frag
);
447 if(NS_FAILED(nsres
)) {
448 ERR("CreateDocumentFragment failed: %08x\n", nsres
);
452 hres
= create_document_fragment((nsIDOMNode
*)doc_frag
, This
->doc_node
, &docnode
);
453 nsIDOMDocumentFragment_Release(doc_frag
);
457 *ppNewDoc
= &docnode
->basedoc
.IHTMLDocument2_iface
;
461 static HRESULT WINAPI
HTMLDocument3_get_parentDocument(IHTMLDocument3
*iface
,
464 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
465 FIXME("(%p)->(%p)\n", This
, p
);
469 static HRESULT WINAPI
HTMLDocument3_put_enableDownload(IHTMLDocument3
*iface
,
472 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
473 FIXME("(%p)->(%x)\n", This
, v
);
477 static HRESULT WINAPI
HTMLDocument3_get_enableDownload(IHTMLDocument3
*iface
,
480 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
481 FIXME("(%p)->(%p)\n", This
, p
);
485 static HRESULT WINAPI
HTMLDocument3_put_baseUrl(IHTMLDocument3
*iface
, BSTR v
)
487 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
488 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
492 static HRESULT WINAPI
HTMLDocument3_get_baseUrl(IHTMLDocument3
*iface
, BSTR
*p
)
494 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
495 FIXME("(%p)->(%p)\n", This
, p
);
499 static HRESULT WINAPI
HTMLDocument3_get_childNodes(IHTMLDocument3
*iface
, IDispatch
**p
)
501 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
503 TRACE("(%p)->(%p)\n", This
, p
);
505 return IHTMLDOMNode_get_childNodes(&This
->doc_node
->node
.IHTMLDOMNode_iface
, p
);
508 static HRESULT WINAPI
HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3
*iface
,
511 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
512 FIXME("(%p)->()\n", This
);
516 static HRESULT WINAPI
HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3
*iface
,
519 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
520 FIXME("(%p)->(%p)\n", This
, p
);
524 static HRESULT WINAPI
HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT v
)
526 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
527 FIXME("(%p)->()\n", This
);
531 static HRESULT WINAPI
HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3
*iface
, VARIANT
*p
)
533 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
534 FIXME("(%p)->(%p)\n", This
, p
);
538 static HRESULT WINAPI
HTMLDocument3_getElementsByName(IHTMLDocument3
*iface
, BSTR v
,
539 IHTMLElementCollection
**ppelColl
)
541 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
542 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppelColl
);
547 static HRESULT WINAPI
HTMLDocument3_getElementById(IHTMLDocument3
*iface
, BSTR v
,
550 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
554 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pel
);
556 hres
= get_doc_elem_by_id(This
->doc_node
, v
, &elem
);
557 if(FAILED(hres
) || !elem
) {
562 *pel
= &elem
->IHTMLElement_iface
;
567 static HRESULT WINAPI
HTMLDocument3_getElementsByTagName(IHTMLDocument3
*iface
, BSTR v
,
568 IHTMLElementCollection
**pelColl
)
570 HTMLDocument
*This
= impl_from_IHTMLDocument3(iface
);
571 nsIDOMNodeList
*nslist
;
575 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(v
), pelColl
);
577 if(!This
->doc_node
->nsdoc
) {
578 WARN("NULL nsdoc\n");
582 nsAString_InitDepend(&id_str
, v
);
583 nsres
= nsIDOMHTMLDocument_GetElementsByTagName(This
->doc_node
->nsdoc
, &id_str
, &nslist
);
584 nsAString_Finish(&id_str
);
586 ERR("GetElementByName failed: %08x\n", nsres
);
590 *pelColl
= create_collection_from_nodelist(This
->doc_node
, nslist
);
591 nsIDOMNodeList_Release(nslist
);
596 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl
= {
597 HTMLDocument3_QueryInterface
,
598 HTMLDocument3_AddRef
,
599 HTMLDocument3_Release
,
600 HTMLDocument3_GetTypeInfoCount
,
601 HTMLDocument3_GetTypeInfo
,
602 HTMLDocument3_GetIDsOfNames
,
603 HTMLDocument3_Invoke
,
604 HTMLDocument3_releaseCapture
,
605 HTMLDocument3_recalc
,
606 HTMLDocument3_createTextNode
,
607 HTMLDocument3_get_documentElement
,
608 HTMLDocument3_uniqueID
,
609 HTMLDocument3_attachEvent
,
610 HTMLDocument3_detachEvent
,
611 HTMLDocument3_put_onrowsdelete
,
612 HTMLDocument3_get_onrowsdelete
,
613 HTMLDocument3_put_onrowsinserted
,
614 HTMLDocument3_get_onrowsinserted
,
615 HTMLDocument3_put_oncellchange
,
616 HTMLDocument3_get_oncellchange
,
617 HTMLDocument3_put_ondatasetchanged
,
618 HTMLDocument3_get_ondatasetchanged
,
619 HTMLDocument3_put_ondataavailable
,
620 HTMLDocument3_get_ondataavailable
,
621 HTMLDocument3_put_ondatasetcomplete
,
622 HTMLDocument3_get_ondatasetcomplete
,
623 HTMLDocument3_put_onpropertychange
,
624 HTMLDocument3_get_onpropertychange
,
625 HTMLDocument3_put_dir
,
626 HTMLDocument3_get_dir
,
627 HTMLDocument3_put_oncontextmenu
,
628 HTMLDocument3_get_oncontextmenu
,
629 HTMLDocument3_put_onstop
,
630 HTMLDocument3_get_onstop
,
631 HTMLDocument3_createDocumentFragment
,
632 HTMLDocument3_get_parentDocument
,
633 HTMLDocument3_put_enableDownload
,
634 HTMLDocument3_get_enableDownload
,
635 HTMLDocument3_put_baseUrl
,
636 HTMLDocument3_get_baseUrl
,
637 HTMLDocument3_get_childNodes
,
638 HTMLDocument3_put_inheritStyleSheets
,
639 HTMLDocument3_get_inheritStyleSheets
,
640 HTMLDocument3_put_onbeforeeditfocus
,
641 HTMLDocument3_get_onbeforeeditfocus
,
642 HTMLDocument3_getElementsByName
,
643 HTMLDocument3_getElementById
,
644 HTMLDocument3_getElementsByTagName
647 static inline HTMLDocument
*impl_from_IHTMLDocument4(IHTMLDocument4
*iface
)
649 return CONTAINING_RECORD(iface
, HTMLDocument
, IHTMLDocument4_iface
);
652 static HRESULT WINAPI
HTMLDocument4_QueryInterface(IHTMLDocument4
*iface
,
653 REFIID riid
, void **ppv
)
655 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
656 return htmldoc_query_interface(This
, riid
, ppv
);
659 static ULONG WINAPI
HTMLDocument4_AddRef(IHTMLDocument4
*iface
)
661 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
662 return htmldoc_addref(This
);
665 static ULONG WINAPI
HTMLDocument4_Release(IHTMLDocument4
*iface
)
667 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
668 return htmldoc_release(This
);
671 static HRESULT WINAPI
HTMLDocument4_GetTypeInfoCount(IHTMLDocument4
*iface
, UINT
*pctinfo
)
673 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
674 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
677 static HRESULT WINAPI
HTMLDocument4_GetTypeInfo(IHTMLDocument4
*iface
, UINT iTInfo
,
678 LCID lcid
, ITypeInfo
**ppTInfo
)
680 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
681 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
684 static HRESULT WINAPI
HTMLDocument4_GetIDsOfNames(IHTMLDocument4
*iface
, REFIID riid
,
685 LPOLESTR
*rgszNames
, UINT cNames
,
686 LCID lcid
, DISPID
*rgDispId
)
688 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
689 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
693 static HRESULT WINAPI
HTMLDocument4_Invoke(IHTMLDocument4
*iface
, DISPID dispIdMember
,
694 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
695 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
697 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
698 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
699 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
702 static HRESULT WINAPI
HTMLDocument4_focus(IHTMLDocument4
*iface
)
704 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
705 nsIDOMHTMLElement
*nsbody
;
708 TRACE("(%p)->()\n", This
);
710 nsres
= nsIDOMHTMLDocument_GetBody(This
->doc_node
->nsdoc
, &nsbody
);
711 if(NS_FAILED(nsres
) || !nsbody
) {
712 ERR("GetBody failed: %08x\n", nsres
);
716 nsres
= nsIDOMHTMLElement_Focus(nsbody
);
717 nsIDOMHTMLElement_Release(nsbody
);
718 if(NS_FAILED(nsres
)) {
719 ERR("Focus failed: %08x\n", nsres
);
726 static HRESULT WINAPI
HTMLDocument4_hasFocus(IHTMLDocument4
*iface
, VARIANT_BOOL
*pfFocus
)
728 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
729 FIXME("(%p)->(%p)\n", This
, pfFocus
);
733 static HRESULT WINAPI
HTMLDocument4_put_onselectionchange(IHTMLDocument4
*iface
, VARIANT v
)
735 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
736 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
740 static HRESULT WINAPI
HTMLDocument4_get_onselectionchange(IHTMLDocument4
*iface
, VARIANT
*p
)
742 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
743 FIXME("(%p)->(%p)\n", This
, p
);
747 static HRESULT WINAPI
HTMLDocument4_get_namespace(IHTMLDocument4
*iface
, IDispatch
**p
)
749 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
750 FIXME("(%p)->(%p)\n", This
, p
);
754 static HRESULT WINAPI
HTMLDocument4_createDocumentFromUrl(IHTMLDocument4
*iface
, BSTR bstrUrl
,
755 BSTR bstrOptions
, IHTMLDocument2
**newDoc
)
757 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
758 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(bstrUrl
), debugstr_w(bstrOptions
), newDoc
);
762 static HRESULT WINAPI
HTMLDocument4_put_media(IHTMLDocument4
*iface
, BSTR v
)
764 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
765 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
769 static HRESULT WINAPI
HTMLDocument4_get_media(IHTMLDocument4
*iface
, BSTR
*p
)
771 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
772 FIXME("(%p)->(%p)\n", This
, p
);
776 static HRESULT WINAPI
HTMLDocument4_createEventObject(IHTMLDocument4
*iface
,
777 VARIANT
*pvarEventObject
, IHTMLEventObj
**ppEventObj
)
779 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
781 TRACE("(%p)->(%s %p)\n", This
, debugstr_variant(pvarEventObject
), ppEventObj
);
783 if(pvarEventObject
&& V_VT(pvarEventObject
) != VT_ERROR
&& V_VT(pvarEventObject
) != VT_EMPTY
) {
784 FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject
));
788 return create_event_obj(ppEventObj
);
791 static HRESULT WINAPI
HTMLDocument4_fireEvent(IHTMLDocument4
*iface
, BSTR bstrEventName
,
792 VARIANT
*pvarEventObject
, VARIANT_BOOL
*pfCanceled
)
794 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
796 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(bstrEventName
), pvarEventObject
, pfCanceled
);
798 return dispatch_event(&This
->doc_node
->node
, bstrEventName
, pvarEventObject
, pfCanceled
);
801 static HRESULT WINAPI
HTMLDocument4_createRenderStyle(IHTMLDocument4
*iface
, BSTR v
,
802 IHTMLRenderStyle
**ppIHTMLRenderStyle
)
804 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
805 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(v
), ppIHTMLRenderStyle
);
809 static HRESULT WINAPI
HTMLDocument4_put_oncontrolselect(IHTMLDocument4
*iface
, VARIANT v
)
811 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
812 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
816 static HRESULT WINAPI
HTMLDocument4_get_oncontrolselect(IHTMLDocument4
*iface
, VARIANT
*p
)
818 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
819 FIXME("(%p)->(%p)\n", This
, p
);
823 static HRESULT WINAPI
HTMLDocument4_get_URLEncoded(IHTMLDocument4
*iface
, BSTR
*p
)
825 HTMLDocument
*This
= impl_from_IHTMLDocument4(iface
);
826 FIXME("(%p)->(%p)\n", This
, p
);
830 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl
= {
831 HTMLDocument4_QueryInterface
,
832 HTMLDocument4_AddRef
,
833 HTMLDocument4_Release
,
834 HTMLDocument4_GetTypeInfoCount
,
835 HTMLDocument4_GetTypeInfo
,
836 HTMLDocument4_GetIDsOfNames
,
837 HTMLDocument4_Invoke
,
839 HTMLDocument4_hasFocus
,
840 HTMLDocument4_put_onselectionchange
,
841 HTMLDocument4_get_onselectionchange
,
842 HTMLDocument4_get_namespace
,
843 HTMLDocument4_createDocumentFromUrl
,
844 HTMLDocument4_put_media
,
845 HTMLDocument4_get_media
,
846 HTMLDocument4_createEventObject
,
847 HTMLDocument4_fireEvent
,
848 HTMLDocument4_createRenderStyle
,
849 HTMLDocument4_put_oncontrolselect
,
850 HTMLDocument4_get_oncontrolselect
,
851 HTMLDocument4_get_URLEncoded
854 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*This
)
856 This
->IHTMLDocument3_iface
.lpVtbl
= &HTMLDocument3Vtbl
;
857 This
->IHTMLDocument4_iface
.lpVtbl
= &HTMLDocument4Vtbl
;