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
28 #include "wine/list.h"
29 #include "wine/unicode.h"
37 #define NS_OK ((nsresult)0x00000000L)
38 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
39 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
40 #define NS_NOINTERFACE ((nsresult)0x80004002L)
41 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
42 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
43 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
44 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
45 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
47 #define NS_FAILED(res) ((res) & 0x80000000)
48 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
52 #define MSHTML_E_NODOC 0x800a025c
54 typedef struct HTMLDOMNode HTMLDOMNode
;
55 typedef struct ConnectionPoint ConnectionPoint
;
56 typedef struct BSCallback BSCallback
;
57 typedef struct event_target_t event_target_t
;
59 /* NOTE: make sure to keep in sync with dispex.c */
63 DispDOMChildrenCollection_tid
,
64 DispHTMLAnchorElement_tid
,
66 DispHTMLCommentElement_tid
,
67 DispHTMLCurrentStyle_tid
,
69 DispHTMLDOMTextNode_tid
,
70 DispHTMLElementCollection_tid
,
71 DispHTMLFormElement_tid
,
72 DispHTMLGenericElement_tid
,
73 DispHTMLFrameElement_tid
,
76 DispHTMLInputElement_tid
,
78 DispHTMLNavigator_tid
,
79 DispHTMLOptionElement_tid
,
81 DispHTMLScriptElement_tid
,
82 DispHTMLSelectElement_tid
,
86 DispHTMLTextAreaElement_tid
,
87 DispHTMLUnknownElement_tid
,
89 HTMLDocumentEvents_tid
,
90 IHTMLAnchorElement_tid
,
92 IHTMLBodyElement2_tid
,
93 IHTMLCommentElement_tid
,
94 IHTMLCurrentStyle_tid
,
95 IHTMLCurrentStyle2_tid
,
96 IHTMLCurrentStyle3_tid
,
97 IHTMLCurrentStyle4_tid
,
102 IHTMLDOMChildrenCollection_tid
,
105 IHTMLDOMTextNode_tid
,
110 IHTMLElementCollection_tid
,
112 IHTMLFiltersCollection_tid
,
113 IHTMLFormElement_tid
,
116 IHTMLFrameElement3_tid
,
117 IHTMLGenericElement_tid
,
118 IHTMLIFrameElement_tid
,
119 IHTMLImageElementFactory_tid
,
121 IHTMLInputElement_tid
,
123 IHTMLOptionElement_tid
,
126 IHTMLScriptElement_tid
,
127 IHTMLSelectElement_tid
,
134 IHTMLTextAreaElement_tid
,
135 IHTMLTextContainer_tid
,
144 typedef struct dispex_data_t dispex_data_t
;
145 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
147 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
148 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
149 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
152 HRESULT (*value
)(IUnknown
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
153 HRESULT (*get_dispid
)(IUnknown
*,BSTR
,DWORD
,DISPID
*);
154 HRESULT (*invoke
)(IUnknown
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
155 } dispex_static_data_vtbl_t
;
158 const dispex_static_data_vtbl_t
*vtbl
;
159 const tid_t disp_tid
;
161 const tid_t
* const iface_tids
;
162 } dispex_static_data_t
;
165 const IDispatchExVtbl
*lpIDispatchExVtbl
;
169 dispex_static_data_t
*data
;
170 dispex_dynamic_data_t
*dynamic_data
;
173 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
174 void release_dispex(DispatchEx
*);
175 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
176 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
177 HRESULT
get_dispids(tid_t
,DWORD
*,DISPID
**);
178 HRESULT
remove_prop(DispatchEx
*,BSTR
,VARIANT_BOOL
*);
180 typedef struct HTMLWindow HTMLWindow
;
181 typedef struct HTMLDocumentNode HTMLDocumentNode
;
182 typedef struct HTMLDocumentObj HTMLDocumentObj
;
183 typedef struct HTMLFrameBase HTMLFrameBase
;
184 typedef struct NSContainer NSContainer
;
188 SCRIPTMODE_ACTIVESCRIPT
191 typedef struct ScriptHost ScriptHost
;
196 } global_prop_type_t
;
199 global_prop_type_t type
;
201 ScriptHost
*script_host
;
206 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
211 } HTMLOptionElementFactory
;
215 const IHTMLImageElementFactoryVtbl
*lpHTMLImageElementFactoryVtbl
;
220 } HTMLImageElementFactory
;
222 struct HTMLLocation
{
224 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
236 typedef struct nsChannelBSC nsChannelBSC
;
240 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
241 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
242 const IHTMLWindow4Vtbl
*lpHTMLWindow4Vtbl
;
243 const IHTMLPrivateWindowVtbl
*lpIHTMLPrivateWindowVtbl
;
244 const IDispatchExVtbl
*lpIDispatchExVtbl
;
248 windowref_t
*window_ref
;
251 HTMLDocumentNode
*doc
;
252 HTMLDocumentObj
*doc_obj
;
253 nsIDOMWindow
*nswindow
;
255 HTMLFrameBase
*frame_element
;
256 READYSTATE readystate
;
258 nsChannelBSC
*bscallback
;
262 IHTMLEventObj
*event
;
264 SCRIPTMODE scriptmode
;
265 struct list script_hosts
;
267 HTMLOptionElementFactory
*option_factory
;
268 HTMLImageElementFactory
*image_factory
;
269 HTMLLocation
*location
;
272 global_prop_t
*global_props
;
273 DWORD global_prop_cnt
;
274 DWORD global_prop_size
;
276 struct list children
;
277 struct list sibling_entry
;
287 typedef struct _cp_static_data_t
{
289 void (*on_advise
)(IUnknown
*,struct _cp_static_data_t
*);
294 typedef struct ConnectionPointContainer
{
295 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
297 ConnectionPoint
*cp_list
;
299 struct ConnectionPointContainer
*forward_container
;
300 } ConnectionPointContainer
;
302 struct ConnectionPoint
{
303 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
305 ConnectionPointContainer
*container
;
310 IPropertyNotifySink
*propnotif
;
315 cp_static_data_t
*data
;
317 ConnectionPoint
*next
;
320 struct HTMLDocument
{
321 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
322 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
323 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
324 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
325 const IHTMLDocument6Vtbl
*lpHTMLDocument6Vtbl
;
326 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
327 const IPersistFileVtbl
*lpPersistFileVtbl
;
328 const IPersistHistoryVtbl
*lpPersistHistoryVtbl
;
329 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
330 const IOleObjectVtbl
*lpOleObjectVtbl
;
331 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
332 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
333 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
334 const IViewObjectExVtbl
*lpViewObjectExVtbl
;
335 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
336 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
337 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
338 const IOleControlVtbl
*lpOleControlVtbl
;
339 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
340 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
341 const IDispatchExVtbl
*lpIDispatchExVtbl
;
342 const ISupportErrorInfoVtbl
*lpSupportErrorInfoVtbl
;
343 const IObjectWithSiteVtbl
*lpObjectWithSiteVtbl
;
348 HTMLDocumentObj
*doc_obj
;
349 HTMLDocumentNode
*doc_node
;
355 ConnectionPointContainer cp_container
;
356 ConnectionPoint cp_htmldocevents
;
357 ConnectionPoint cp_htmldocevents2
;
358 ConnectionPoint cp_propnotif
;
359 ConnectionPoint cp_dispatch
;
361 IOleAdviseHolder
*advise_holder
;
364 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
366 return IUnknown_QueryInterface(This
->unk_impl
, riid
, ppv
);
369 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
371 return IUnknown_AddRef(This
->unk_impl
);
374 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
376 return IUnknown_Release(This
->unk_impl
);
379 struct HTMLDocumentObj
{
380 HTMLDocument basedoc
;
382 const ICustomDocVtbl
*lpCustomDocVtbl
;
386 NSContainer
*nscontainer
;
388 IOleClientSite
*client
;
389 IDocHostUIHandler
*hostui
;
390 IOleInPlaceSite
*ipsite
;
391 IOleInPlaceFrame
*frame
;
392 IOleInPlaceUIWindow
*ip_window
;
393 IAdviseSink
*view_sink
;
395 DOCHOSTUIINFO hostinfo
;
397 IOleUndoManager
*undomgr
;
402 BOOL request_uiactivate
;
403 BOOL in_place_active
;
407 BOOL container_locked
;
418 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
419 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
420 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
421 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
422 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
423 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
424 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
425 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
427 nsIWebBrowser
*webbrowser
;
428 nsIWebNavigation
*navigation
;
429 nsIBaseWindow
*window
;
430 nsIWebBrowserFocus
*focus
;
433 nsIController
*editor_controller
;
438 HTMLDocumentObj
*doc
;
440 nsIURIContentListener
*content_listener
;
445 typedef struct nsWineURI nsWineURI
;
447 HRESULT
set_wine_url(nsWineURI
*,LPCWSTR
);
448 nsresult
on_start_uri_open(NSContainer
*,nsIURI
*,PRBool
*);
450 /* Keep sync with request_method_strings in nsio.c */
458 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
459 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
460 const nsIHttpChannelInternalVtbl
*lpIHttpChannelInternalVtbl
;
465 nsIInputStream
*post_data_stream
;
467 nsILoadGroup
*load_group
;
468 nsIInterfaceRequestor
*notif_callback
;
470 nsLoadFlags load_flags
;
471 nsIURI
*original_uri
;
475 PRUint32 response_status
;
476 REQUEST_METHOD request_method
;
477 struct list response_headers
;
478 struct list request_headers
;
488 HRESULT
set_http_header(struct list
*,const WCHAR
*,int,const WCHAR
*,int);
491 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
492 void (*destructor
)(HTMLDOMNode
*);
493 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
494 HRESULT (*call_event
)(HTMLDOMNode
*,DWORD
,BOOL
*);
495 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
496 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
497 HRESULT (*get_document
)(HTMLDOMNode
*,IDispatch
**);
498 HRESULT (*get_readystate
)(HTMLDOMNode
*,BSTR
*);
499 HRESULT (*get_dispid
)(HTMLDOMNode
*,BSTR
,DWORD
,DISPID
*);
500 HRESULT (*invoke
)(HTMLDOMNode
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
501 HRESULT (*bind_to_tree
)(HTMLDOMNode
*);
506 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
507 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
508 const NodeImplVtbl
*vtbl
;
513 HTMLDocumentNode
*doc
;
514 event_target_t
*event_target
;
515 ConnectionPointContainer
*cp_container
;
522 ConnectionPointContainer cp_container
;
524 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
525 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
526 const IHTMLElement3Vtbl
*lpHTMLElement3Vtbl
;
528 nsIDOMHTMLElement
*nselem
;
531 #define HTMLELEMENT_TIDS \
542 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
547 struct HTMLFrameBase
{
550 const IHTMLFrameBaseVtbl
*lpIHTMLFrameBaseVtbl
;
551 const IHTMLFrameBase2Vtbl
*lpIHTMLFrameBase2Vtbl
;
553 HTMLWindow
*content_window
;
555 nsIDOMHTMLFrameElement
*nsframe
;
556 nsIDOMHTMLIFrameElement
*nsiframe
;
559 typedef struct _mutation_queue_t
{
561 nsISupports
*nsiface
;
563 struct _mutation_queue_t
*next
;
566 typedef struct nsDocumentEventListener nsDocumentEventListener
;
568 struct HTMLDocumentNode
{
570 HTMLDocument basedoc
;
572 const IInternetHostSecurityManagerVtbl
*lpIInternetHostSecurityManagerVtbl
;
574 const nsIDocumentObserverVtbl
*lpIDocumentObserverVtbl
;
575 const nsIRunnableVtbl
*lpIRunnableVtbl
;
579 nsIDOMHTMLDocument
*nsdoc
;
582 event_target_t
*body_event_target
;
584 IInternetSecurityManager
*secmgr
;
585 ICatInformation
*catmgr
;
586 nsDocumentEventListener
*nsevent_listener
;
589 BOOL skip_mutation_notif
;
590 mutation_queue_t
*mutation_queue
;
591 mutation_queue_t
*mutation_queue_tail
;
593 struct list bindings
;
594 struct list selection_list
;
595 struct list range_list
;
598 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
599 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
600 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
602 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
603 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
604 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
605 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
606 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
607 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
608 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
609 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
610 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
611 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
612 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
613 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
614 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
615 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
616 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
617 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
618 #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)
619 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
620 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
621 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
622 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
623 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
624 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
625 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
626 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
627 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
628 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
629 #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)
631 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
632 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
633 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
634 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
635 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
636 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
637 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
638 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
639 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
641 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
643 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
645 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
646 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
647 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
648 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
650 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
651 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
652 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
654 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
655 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
656 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
657 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
658 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
660 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
661 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
662 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
664 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
665 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
666 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
668 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
670 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
672 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
674 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
675 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
677 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
678 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
679 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocumentObj
*,HTMLWindow
*,HTMLDocumentNode
**);
681 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*,nsIDOMWindow
*,HTMLWindow
*,HTMLWindow
**);
682 void update_window_doc(HTMLWindow
*);
683 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
684 nsIDOMWindow
*get_nsdoc_window(nsIDOMDocument
*);
685 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
686 HTMLImageElementFactory
*HTMLImageElementFactory_Create(HTMLWindow
*);
687 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
688 IOmNavigator
*OmNavigator_Create(void);
689 HRESULT
HTMLScreen_Create(IHTMLScreen
**);
691 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
692 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
693 void HTMLDocument_Persist_Init(HTMLDocument
*);
694 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
695 void HTMLDocument_OleObj_Init(HTMLDocument
*);
696 void HTMLDocument_View_Init(HTMLDocument
*);
697 void HTMLDocument_Window_Init(HTMLDocument
*);
698 void HTMLDocument_Service_Init(HTMLDocument
*);
699 void HTMLDocument_Hlink_Init(HTMLDocument
*);
701 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
703 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
705 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
,cp_static_data_t
*);
706 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
707 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
709 NSContainer
*NSContainer_Create(HTMLDocumentObj
*,NSContainer
*);
710 void NSContainer_Release(NSContainer
*);
712 void init_mutation(HTMLDocumentNode
*);
713 void release_mutation(HTMLDocumentNode
*);
715 void HTMLDocument_LockContainer(HTMLDocumentObj
*,BOOL
);
716 void show_context_menu(HTMLDocumentObj
*,DWORD
,POINT
*,IDispatch
*);
717 void notif_focus(HTMLDocumentObj
*);
719 void show_tooltip(HTMLDocumentObj
*,DWORD
,DWORD
,LPCWSTR
);
720 void hide_tooltip(HTMLDocumentObj
*);
721 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
723 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
725 BOOL
load_gecko(BOOL
);
726 void close_gecko(void);
727 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
728 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
729 void release_nsio(void);
730 BOOL
install_wine_gecko(BOOL
);
731 BOOL
is_gecko_path(const char*);
733 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
734 HRESULT
create_doc_uri(HTMLWindow
*,WCHAR
*,nsWineURI
**);
735 HRESULT
load_nsuri(HTMLWindow
*,nsWineURI
*,nsChannelBSC
*,DWORD
);
737 HRESULT
hlink_frame_navigate(HTMLDocument
*,LPCWSTR
,nsIInputStream
*,DWORD
,BOOL
*);
738 HRESULT
navigate_url(HTMLWindow
*,const WCHAR
*,const WCHAR
*);
739 HRESULT
set_frame_doc(HTMLFrameBase
*,nsIDOMDocument
*);
740 HRESULT
set_moniker(HTMLDocument
*,IMoniker
*,IBindCtx
*,nsChannelBSC
*,BOOL
);
742 void call_property_onchanged(ConnectionPoint
*,DISPID
);
743 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
745 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
748 void nsACString_InitDepend(nsACString
*,const char*);
749 void nsACString_SetData(nsACString
*,const char*);
750 PRUint32
nsACString_GetData(const nsACString
*,const char**);
751 void nsACString_Finish(nsACString
*);
753 BOOL
nsAString_Init(nsAString
*,const PRUnichar
*);
754 void nsAString_InitDepend(nsAString
*,const PRUnichar
*);
755 void nsAString_SetData(nsAString
*,const PRUnichar
*);
756 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
757 void nsAString_Finish(nsAString
*);
759 nsICommandParams
*create_nscommand_params(void);
760 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
761 void get_editor_controller(NSContainer
*);
762 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
764 void init_nsevents(HTMLDocumentNode
*);
765 void release_nsevents(HTMLDocumentNode
*);
766 void add_nsevent_listener(HTMLDocumentNode
*,nsIDOMNode
*,LPCWSTR
);
768 void set_window_bscallback(HTMLWindow
*,nsChannelBSC
*);
769 void set_current_mon(HTMLWindow
*,IMoniker
*);
770 HRESULT
start_binding(HTMLWindow
*,HTMLDocumentNode
*,BSCallback
*,IBindCtx
*);
771 HRESULT
async_start_doc_binding(HTMLWindow
*,nsChannelBSC
*);
772 void abort_document_bindings(HTMLDocumentNode
*);
774 HRESULT
bind_mon_to_buffer(HTMLDocumentNode
*,IMoniker
*,void**,DWORD
*);
776 HRESULT
create_channelbsc(IMoniker
*,WCHAR
*,BYTE
*,DWORD
,nsChannelBSC
**);
777 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
778 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
779 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
781 void set_ready_state(HTMLWindow
*,READYSTATE
);
783 HRESULT
HTMLSelectionObject_Create(HTMLDocumentNode
*,nsISelection
*,IHTMLSelectionObject
**);
784 HRESULT
HTMLTxtRange_Create(HTMLDocumentNode
*,nsIDOMRange
*,IHTMLTxtRange
**);
785 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
786 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
787 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
789 void detach_selection(HTMLDocumentNode
*);
790 void detach_ranges(HTMLDocumentNode
*);
791 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
793 HRESULT
create_nselem(HTMLDocumentNode
*,const WCHAR
*,nsIDOMHTMLElement
**);
795 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocumentNode
*,nsIDOMNode
*);
797 HTMLElement
*HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
798 HTMLElement
*HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*);
799 HTMLElement
*HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
800 HTMLElement
*HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
801 HTMLElement
*HTMLFormElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
802 HTMLElement
*HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
803 HTMLElement
*HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
804 HTMLElement
*HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
805 HTMLElement
*HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
806 HTMLElement
*HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
807 HTMLElement
*HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
808 HTMLElement
*HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
809 HTMLElement
*HTMLTable_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
810 HTMLElement
*HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
811 HTMLElement
*HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
812 HTMLElement
*HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
814 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*);
815 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
816 void HTMLElement2_Init(HTMLElement
*);
817 void HTMLElement3_Init(HTMLElement
*);
818 void HTMLTextContainer_Init(HTMLTextContainer
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
819 void HTMLFrameBase_Init(HTMLFrameBase
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
821 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
822 void HTMLDOMNode_destructor(HTMLDOMNode
*);
824 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
825 void HTMLElement_destructor(HTMLDOMNode
*);
827 HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*,REFIID
,void**);
828 void HTMLFrameBase_destructor(HTMLFrameBase
*);
830 HTMLDOMNode
*get_node(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
831 void release_nodes(HTMLDocumentNode
*);
833 void release_script_hosts(HTMLWindow
*);
834 void connect_scripts(HTMLWindow
*);
835 void doc_insert_script(HTMLWindow
*,nsIDOMHTMLScriptElement
*);
836 IDispatch
*script_parse_event(HTMLWindow
*,LPCWSTR
);
837 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
838 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
839 IDispatch
*get_script_disp(ScriptHost
*);
840 HRESULT
search_window_props(HTMLWindow
*,BSTR
,DWORD
,DISPID
*);
842 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
843 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocumentNode
*,IUnknown
*,nsIDOMNodeList
*);
844 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocumentNode
*,IUnknown
*,nsIDOMHTMLCollection
*);
849 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
850 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
853 extern const cmdtable_t editmode_cmds
[];
855 void do_ns_command(HTMLDocument
*,const char*,nsICommandParams
*);
858 #define UPDATE_UI 0x0001
859 #define UPDATE_TITLE 0x0002
861 void update_doc(HTMLDocument
*,DWORD
);
862 void update_title(HTMLDocumentObj
*);
865 void init_editor(HTMLDocument
*);
866 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
867 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
868 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
869 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
870 void handle_edit_load(HTMLDocument
*);
871 HRESULT
editor_is_dirty(HTMLDocument
*);
872 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
874 extern DWORD mshtml_tls
;
876 typedef struct task_t task_t
;
877 typedef void (*task_proc_t
)(task_t
*);
887 HTMLDocumentObj
*doc
;
892 task_t
*task_queue_head
;
893 task_t
*task_queue_tail
;
894 struct list timer_list
;
897 thread_data_t
*get_thread_data(BOOL
);
898 HWND
get_thread_hwnd(void);
900 LONG
get_task_target_magic(void);
901 void push_task(task_t
*,task_proc_t
,LONG
);
902 void remove_target_tasks(LONG
);
904 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
905 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
907 void release_typelib(void);
908 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*);
910 const char *debugstr_variant(const VARIANT
*);
912 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
913 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
914 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
915 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
916 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
918 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
920 /* memory allocation functions */
922 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
924 return HeapAlloc(GetProcessHeap(), 0, len
);
927 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
929 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
932 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
934 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
937 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
939 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
942 static inline BOOL
heap_free(void *mem
)
944 return HeapFree(GetProcessHeap(), 0, mem
);
947 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
954 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
955 ret
= heap_alloc(size
);
956 memcpy(ret
, str
, size
);
962 static inline LPWSTR
heap_strndupW(LPCWSTR str
, unsigned len
)
967 ret
= heap_alloc((len
+1)*sizeof(WCHAR
));
968 memcpy(ret
, str
, len
*sizeof(WCHAR
));
975 static inline char *heap_strdupA(const char *str
)
982 size
= strlen(str
)+1;
983 ret
= heap_alloc(size
);
984 memcpy(ret
, str
, size
);
990 static inline WCHAR
*heap_strdupAtoW(const char *str
)
997 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
998 ret
= heap_alloc(len
*sizeof(WCHAR
));
999 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
1005 static inline char *heap_strdupWtoA(LPCWSTR str
)
1010 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
1011 ret
= heap_alloc(size
);
1012 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
1018 static inline void windowref_addref(windowref_t
*ref
)
1020 InterlockedIncrement(&ref
->ref
);
1023 static inline void windowref_release(windowref_t
*ref
)
1025 if(!InterlockedDecrement(&ref
->ref
))
1029 HDC
get_display_dc(void);
1030 HINSTANCE
get_shdoclc(void);
1031 void set_statustext(HTMLDocumentObj
*,INT
,LPCWSTR
);
1033 extern HINSTANCE hInst
;