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_NOINTERFACE ((nsresult)0x80004002L)
40 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
41 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
42 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
43 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
45 #define NS_FAILED(res) ((res) & 0x80000000)
46 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
50 #define MSHTML_E_NODOC 0x800a025c
52 typedef struct HTMLDOMNode HTMLDOMNode
;
53 typedef struct ConnectionPoint ConnectionPoint
;
54 typedef struct BSCallback BSCallback
;
55 typedef struct nsChannelBSC nsChannelBSC
;
56 typedef struct event_target_t event_target_t
;
58 /* NOTE: make sure to keep in sync with dispex.c */
62 DispDOMChildrenCollection_tid
,
63 DispHTMLAnchorElement_tid
,
65 DispHTMLCommentElement_tid
,
66 DispHTMLCurrentStyle_tid
,
68 DispHTMLDOMTextNode_tid
,
69 DispHTMLElementCollection_tid
,
70 DispHTMLFormElement_tid
,
71 DispHTMLGenericElement_tid
,
74 DispHTMLInputElement_tid
,
76 DispHTMLNavigator_tid
,
77 DispHTMLOptionElement_tid
,
79 DispHTMLSelectElement_tid
,
83 DispHTMLUnknownElement_tid
,
85 HTMLDocumentEvents_tid
,
86 IHTMLAnchorElement_tid
,
88 IHTMLBodyElement2_tid
,
89 IHTMLCommentElement_tid
,
90 IHTMLCurrentStyle_tid
,
91 IHTMLCurrentStyle2_tid
,
92 IHTMLCurrentStyle3_tid
,
93 IHTMLCurrentStyle4_tid
,
98 IHTMLDOMChildrenCollection_tid
,
101 IHTMLDOMTextNode_tid
,
106 IHTMLElementCollection_tid
,
108 IHTMLFormElement_tid
,
111 IHTMLGenericElement_tid
,
112 IHTMLImageElementFactory_tid
,
114 IHTMLInputElement_tid
,
116 IHTMLOptionElement_tid
,
118 IHTMLSelectElement_tid
,
125 IHTMLTextContainer_tid
,
134 typedef struct dispex_data_t dispex_data_t
;
135 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
137 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
138 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
141 HRESULT (*value
)(IUnknown
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
142 HRESULT (*get_dispid
)(IUnknown
*,BSTR
,DWORD
,DISPID
*);
143 HRESULT (*invoke
)(IUnknown
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
144 } dispex_static_data_vtbl_t
;
147 const dispex_static_data_vtbl_t
*vtbl
;
148 const tid_t disp_tid
;
150 const tid_t
* const iface_tids
;
151 } dispex_static_data_t
;
154 const IDispatchExVtbl
*lpIDispatchExVtbl
;
158 dispex_static_data_t
*data
;
159 dispex_dynamic_data_t
*dynamic_data
;
162 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
163 void release_dispex(DispatchEx
*);
164 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
165 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
166 HRESULT
get_dispids(tid_t
,DWORD
*,DISPID
**);
168 typedef struct HTMLDocumentNode HTMLDocumentNode
;
169 typedef struct HTMLDocumentObj HTMLDocumentObj
;
170 typedef struct HTMLFrameBase HTMLFrameBase
;
174 SCRIPTMODE_ACTIVESCRIPT
177 typedef struct ScriptHost ScriptHost
;
182 } global_prop_type_t
;
185 global_prop_type_t type
;
187 ScriptHost
*script_host
;
192 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
197 } HTMLOptionElementFactory
;
201 const IHTMLImageElementFactoryVtbl
*lpHTMLImageElementFactoryVtbl
;
206 } HTMLImageElementFactory
;
208 struct HTMLLocation
{
210 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
224 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
225 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
226 const IHTMLWindow4Vtbl
*lpHTMLWindow4Vtbl
;
227 const IDispatchExVtbl
*lpIDispatchExVtbl
;
231 windowref_t
*window_ref
;
234 HTMLDocumentNode
*doc
;
235 HTMLDocumentObj
*doc_obj
;
236 nsIDOMWindow
*nswindow
;
238 HTMLFrameBase
*frame_element
;
239 READYSTATE readystate
;
241 nsChannelBSC
*bscallback
;
245 event_target_t
*event_target
;
246 IHTMLEventObj
*event
;
248 SCRIPTMODE scriptmode
;
249 struct list script_hosts
;
251 HTMLOptionElementFactory
*option_factory
;
252 HTMLImageElementFactory
*image_factory
;
253 HTMLLocation
*location
;
256 global_prop_t
*global_props
;
257 DWORD global_prop_cnt
;
258 DWORD global_prop_size
;
260 struct list children
;
261 struct list sibling_entry
;
277 typedef struct ConnectionPointContainer
{
278 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
280 ConnectionPoint
*cp_list
;
282 struct ConnectionPointContainer
*forward_container
;
283 } ConnectionPointContainer
;
285 struct ConnectionPoint
{
286 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
288 IConnectionPointContainer
*container
;
293 IPropertyNotifySink
*propnotif
;
298 cp_static_data_t
*data
;
300 ConnectionPoint
*next
;
303 struct HTMLDocument
{
304 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
305 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
306 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
307 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
308 const IHTMLDocument6Vtbl
*lpHTMLDocument6Vtbl
;
309 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
310 const IPersistFileVtbl
*lpPersistFileVtbl
;
311 const IPersistHistoryVtbl
*lpPersistHistoryVtbl
;
312 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
313 const IOleObjectVtbl
*lpOleObjectVtbl
;
314 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
315 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
316 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
317 const IViewObject2Vtbl
*lpViewObject2Vtbl
;
318 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
319 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
320 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
321 const IOleControlVtbl
*lpOleControlVtbl
;
322 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
323 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
324 const IDispatchExVtbl
*lpIDispatchExVtbl
;
325 const ISupportErrorInfoVtbl
*lpSupportErrorInfoVtbl
;
330 HTMLDocumentObj
*doc_obj
;
331 HTMLDocumentNode
*doc_node
;
337 ConnectionPointContainer cp_container
;
338 ConnectionPoint cp_htmldocevents
;
339 ConnectionPoint cp_htmldocevents2
;
340 ConnectionPoint cp_propnotif
;
343 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
345 return IUnknown_QueryInterface(This
->unk_impl
, riid
, ppv
);
348 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
350 return IUnknown_AddRef(This
->unk_impl
);
353 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
355 return IUnknown_Release(This
->unk_impl
);
358 struct HTMLDocumentObj
{
359 HTMLDocument basedoc
;
361 const ICustomDocVtbl
*lpCustomDocVtbl
;
365 NSContainer
*nscontainer
;
367 IOleClientSite
*client
;
368 IDocHostUIHandler
*hostui
;
369 IOleInPlaceSite
*ipsite
;
370 IOleInPlaceFrame
*frame
;
371 IOleInPlaceUIWindow
*ip_window
;
373 DOCHOSTUIINFO hostinfo
;
375 IOleUndoManager
*undomgr
;
380 BOOL in_place_active
;
384 BOOL container_locked
;
394 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
395 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
396 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
397 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
398 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
399 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
400 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
401 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
403 nsIWebBrowser
*webbrowser
;
404 nsIWebNavigation
*navigation
;
405 nsIBaseWindow
*window
;
406 nsIWebBrowserFocus
*focus
;
409 nsIController
*editor_controller
;
414 HTMLDocumentObj
*doc
;
416 nsIURIContentListener
*content_listener
;
420 nsChannelBSC
*bscallback
; /* hack */
421 HWND reset_focus
; /* hack */
425 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
426 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
427 const nsIHttpChannelInternalVtbl
*lpIHttpChannelInternalVtbl
;
432 nsIHttpChannel
*http_channel
;
433 nsIHttpChannelInternal
*http_channel_internal
;
435 nsIInputStream
*post_data_stream
;
436 nsILoadGroup
*load_group
;
437 nsIInterfaceRequestor
*notif_callback
;
439 nsLoadFlags load_flags
;
440 nsIURI
*original_uri
;
443 PRUint32 response_status
;
448 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
449 void (*destructor
)(HTMLDOMNode
*);
450 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
451 HRESULT (*call_event
)(HTMLDOMNode
*,DWORD
,BOOL
*);
452 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
453 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
454 HRESULT (*get_document
)(HTMLDOMNode
*,IDispatch
**);
455 HRESULT (*get_readystate
)(HTMLDOMNode
*,BSTR
*);
456 HRESULT (*get_dispid
)(HTMLDOMNode
*,BSTR
,DWORD
,DISPID
*);
457 HRESULT (*invoke
)(HTMLDOMNode
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
458 HRESULT (*bind_to_tree
)(HTMLDOMNode
*);
463 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
464 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
465 const NodeImplVtbl
*vtbl
;
470 HTMLDocumentNode
*doc
;
471 event_target_t
*event_target
;
472 ConnectionPointContainer
*cp_container
;
479 ConnectionPointContainer cp_container
;
481 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
482 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
483 const IHTMLElement3Vtbl
*lpHTMLElement3Vtbl
;
485 nsIDOMHTMLElement
*nselem
;
491 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
496 struct HTMLFrameBase
{
499 const IHTMLFrameBaseVtbl
*lpIHTMLFrameBaseVtbl
;
500 const IHTMLFrameBase2Vtbl
*lpIHTMLFrameBase2Vtbl
;
502 HTMLWindow
*content_window
;
505 typedef struct _mutation_queue_t
{
507 nsISupports
*nsiface
;
509 struct _mutation_queue_t
*next
;
512 typedef struct nsDocumentEventListener nsDocumentEventListener
;
514 struct HTMLDocumentNode
{
516 HTMLDocument basedoc
;
518 const IInternetHostSecurityManagerVtbl
*lpIInternetHostSecurityManagerVtbl
;
520 const nsIDocumentObserverVtbl
*lpIDocumentObserverVtbl
;
521 const nsIRunnableVtbl
*lpIRunnableVtbl
;
525 nsIDOMHTMLDocument
*nsdoc
;
529 IInternetSecurityManager
*secmgr
;
530 ICatInformation
*catmgr
;
531 nsDocumentEventListener
*nsevent_listener
;
534 mutation_queue_t
*mutation_queue
;
535 mutation_queue_t
*mutation_queue_tail
;
537 struct list bindings
;
538 struct list selection_list
;
539 struct list range_list
;
542 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
543 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
544 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
546 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
547 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
548 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
549 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
550 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
551 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
552 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
553 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
554 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
555 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
556 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
557 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
558 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
559 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
560 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
561 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
562 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
563 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
564 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
565 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
566 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
567 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
568 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
569 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
570 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
571 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
573 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
574 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
575 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
576 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
577 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
578 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
579 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
580 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
581 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
583 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
585 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
587 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
588 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
589 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
590 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
592 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
593 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
594 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
596 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
597 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
598 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
599 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
600 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
602 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
603 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
604 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
606 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
607 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
608 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
610 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
612 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
614 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
616 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
617 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
619 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
620 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
621 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocumentObj
*,HTMLWindow
*,HTMLDocumentNode
**);
623 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*,nsIDOMWindow
*,HTMLWindow
*,HTMLWindow
**);
624 void update_window_doc(HTMLWindow
*);
625 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
626 nsIDOMWindow
*get_nsdoc_window(nsIDOMDocument
*);
627 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
628 HTMLImageElementFactory
*HTMLImageElementFactory_Create(HTMLWindow
*);
629 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
630 IOmNavigator
*OmNavigator_Create(void);
631 HRESULT
HTMLScreen_Create(IHTMLScreen
**);
633 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
634 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
635 void HTMLDocument_Persist_Init(HTMLDocument
*);
636 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
637 void HTMLDocument_OleObj_Init(HTMLDocument
*);
638 void HTMLDocument_View_Init(HTMLDocument
*);
639 void HTMLDocument_Window_Init(HTMLDocument
*);
640 void HTMLDocument_Service_Init(HTMLDocument
*);
641 void HTMLDocument_Hlink_Init(HTMLDocument
*);
643 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
645 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
647 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
,cp_static_data_t
*);
648 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
649 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
651 NSContainer
*NSContainer_Create(HTMLDocumentObj
*,NSContainer
*);
652 void NSContainer_Release(NSContainer
*);
654 void init_mutation(HTMLDocumentNode
*);
655 void release_mutation(HTMLDocumentNode
*);
657 void HTMLDocument_LockContainer(HTMLDocumentObj
*,BOOL
);
658 void show_context_menu(HTMLDocumentObj
*,DWORD
,POINT
*,IDispatch
*);
659 void notif_focus(HTMLDocumentObj
*);
661 void show_tooltip(HTMLDocumentObj
*,DWORD
,DWORD
,LPCWSTR
);
662 void hide_tooltip(HTMLDocumentObj
*);
663 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
665 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
667 BOOL
load_gecko(BOOL
);
668 void close_gecko(void);
669 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
670 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
671 void release_nsio(void);
672 BOOL
install_wine_gecko(BOOL
);
674 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
675 HRESULT
create_doc_uri(HTMLWindow
*,WCHAR
*,nsIWineURI
**);
677 HRESULT
hlink_frame_navigate(HTMLDocument
*,LPCWSTR
,nsIInputStream
*,DWORD
);
678 HRESULT
navigate_url(HTMLWindow
*,const WCHAR
*,const WCHAR
*);
679 HRESULT
set_frame_doc(HTMLFrameBase
*,nsIDOMDocument
*);
681 void call_property_onchanged(ConnectionPoint
*,DISPID
);
682 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
684 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
687 void nsACString_SetData(nsACString
*,const char*);
688 PRUint32
nsACString_GetData(const nsACString
*,const char**);
690 void nsAString_Init(nsAString
*,const PRUnichar
*);
691 void nsAString_SetData(nsAString
*,const PRUnichar
*);
692 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
693 void nsAString_Finish(nsAString
*);
695 nsICommandParams
*create_nscommand_params(void);
696 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
697 void get_editor_controller(NSContainer
*);
698 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
700 void init_nsevents(HTMLDocumentNode
*);
701 void release_nsevents(HTMLDocumentNode
*);
702 void add_nsevent_listener(HTMLDocumentNode
*,LPCWSTR
);
704 void set_window_bscallback(HTMLWindow
*,nsChannelBSC
*);
705 void set_current_mon(HTMLWindow
*,IMoniker
*);
706 HRESULT
start_binding(HTMLWindow
*,HTMLDocumentNode
*,BSCallback
*,IBindCtx
*);
707 void abort_document_bindings(HTMLDocumentNode
*);
709 HRESULT
bind_mon_to_buffer(HTMLDocumentNode
*,IMoniker
*,void**,DWORD
*);
711 nsChannelBSC
*create_channelbsc(IMoniker
*);
712 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
713 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
714 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
716 void set_ready_state(HTMLWindow
*,READYSTATE
);
718 HRESULT
HTMLSelectionObject_Create(HTMLDocumentNode
*,nsISelection
*,IHTMLSelectionObject
**);
719 HRESULT
HTMLTxtRange_Create(HTMLDocumentNode
*,nsIDOMRange
*,IHTMLTxtRange
**);
720 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
721 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
722 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
724 void detach_selection(HTMLDocumentNode
*);
725 void detach_ranges(HTMLDocumentNode
*);
726 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
728 HRESULT
create_nselem(HTMLDocumentNode
*,const WCHAR
*,nsIDOMHTMLElement
**);
730 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocumentNode
*,nsIDOMNode
*);
732 HTMLElement
*HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
733 HTMLElement
*HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*);
734 HTMLElement
*HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
735 HTMLElement
*HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
736 HTMLElement
*HTMLFormElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
737 HTMLElement
*HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
738 HTMLElement
*HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
739 HTMLElement
*HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
740 HTMLElement
*HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
741 HTMLElement
*HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
742 HTMLElement
*HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
743 HTMLElement
*HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
744 HTMLElement
*HTMLTable_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
745 HTMLElement
*HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
746 HTMLElement
*HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
747 HTMLElement
*HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
749 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*);
750 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
751 void HTMLElement2_Init(HTMLElement
*);
752 void HTMLElement3_Init(HTMLElement
*);
753 void HTMLTextContainer_Init(HTMLTextContainer
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
754 void HTMLFrameBase_Init(HTMLFrameBase
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
756 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
757 void HTMLDOMNode_destructor(HTMLDOMNode
*);
759 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
760 void HTMLElement_destructor(HTMLDOMNode
*);
762 HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*,REFIID
,void**);
763 void HTMLFrameBase_destructor(HTMLFrameBase
*);
765 HTMLDOMNode
*get_node(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
766 void release_nodes(HTMLDocumentNode
*);
768 void release_script_hosts(HTMLWindow
*);
769 void connect_scripts(HTMLWindow
*);
770 void doc_insert_script(HTMLWindow
*,nsIDOMHTMLScriptElement
*);
771 IDispatch
*script_parse_event(HTMLWindow
*,LPCWSTR
);
772 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
773 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
774 IDispatch
*get_script_disp(ScriptHost
*);
776 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
777 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocumentNode
*,IUnknown
*,nsIDOMNodeList
*);
778 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocumentNode
*,IUnknown
*,nsIDOMHTMLCollection
*);
783 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
784 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
787 extern const cmdtable_t editmode_cmds
[];
789 void do_ns_command(HTMLDocument
*,const char*,nsICommandParams
*);
792 #define UPDATE_UI 0x0001
793 #define UPDATE_TITLE 0x0002
795 void update_doc(HTMLDocument
*,DWORD
);
796 void update_title(HTMLDocumentObj
*);
799 void init_editor(HTMLDocument
*);
800 void set_ns_editmode(NSContainer
*);
801 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
802 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
803 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
804 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
805 void handle_edit_load(HTMLDocument
*);
806 HRESULT
editor_is_dirty(HTMLDocument
*);
807 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
809 extern DWORD mshtml_tls
;
811 typedef struct task_t task_t
;
812 typedef void (*task_proc_t
)(task_t
*);
822 HTMLDocumentObj
*doc
;
827 task_t
*task_queue_head
;
828 task_t
*task_queue_tail
;
829 struct list timer_list
;
832 thread_data_t
*get_thread_data(BOOL
);
833 HWND
get_thread_hwnd(void);
835 LONG
get_task_target_magic(void);
836 void push_task(task_t
*,task_proc_t
,LONG
);
837 void remove_target_tasks(LONG
);
839 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
840 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
842 void release_typelib(void);
843 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*);
845 const char *debugstr_variant(const VARIANT
*);
847 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
848 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
849 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
850 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
851 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
853 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
855 /* memory allocation functions */
857 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
859 return HeapAlloc(GetProcessHeap(), 0, len
);
862 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
864 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
867 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
869 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
872 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
874 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
877 static inline BOOL
heap_free(void *mem
)
879 return HeapFree(GetProcessHeap(), 0, mem
);
882 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
889 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
890 ret
= heap_alloc(size
);
891 memcpy(ret
, str
, size
);
897 static inline char *heap_strdupA(const char *str
)
904 size
= strlen(str
)+1;
905 ret
= heap_alloc(size
);
906 memcpy(ret
, str
, size
);
912 static inline WCHAR
*heap_strdupAtoW(const char *str
)
919 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
920 ret
= heap_alloc(len
*sizeof(WCHAR
));
921 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
927 static inline char *heap_strdupWtoA(LPCWSTR str
)
932 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
933 ret
= heap_alloc(size
);
934 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
940 static inline void windowref_addref(windowref_t
*ref
)
942 InterlockedIncrement(&ref
->ref
);
945 static inline void windowref_release(windowref_t
*ref
)
947 if(!InterlockedDecrement(&ref
->ref
))
951 HDC
get_display_dc(void);
952 HINSTANCE
get_shdoclc(void);
954 extern HINSTANCE hInst
;