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 event_target_t event_target_t
;
57 /* NOTE: make sure to keep in sync with dispex.c */
61 DispDOMChildrenCollection_tid
,
62 DispHTMLAnchorElement_tid
,
64 DispHTMLCommentElement_tid
,
65 DispHTMLCurrentStyle_tid
,
67 DispHTMLDOMTextNode_tid
,
68 DispHTMLElementCollection_tid
,
69 DispHTMLFormElement_tid
,
70 DispHTMLGenericElement_tid
,
73 DispHTMLInputElement_tid
,
75 DispHTMLNavigator_tid
,
76 DispHTMLOptionElement_tid
,
78 DispHTMLSelectElement_tid
,
82 DispHTMLUnknownElement_tid
,
84 HTMLDocumentEvents_tid
,
85 IHTMLAnchorElement_tid
,
87 IHTMLBodyElement2_tid
,
88 IHTMLCommentElement_tid
,
89 IHTMLCurrentStyle_tid
,
90 IHTMLCurrentStyle2_tid
,
91 IHTMLCurrentStyle3_tid
,
92 IHTMLCurrentStyle4_tid
,
97 IHTMLDOMChildrenCollection_tid
,
100 IHTMLDOMTextNode_tid
,
105 IHTMLElementCollection_tid
,
107 IHTMLFiltersCollection_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 IHTMLEventObj
*event
;
247 SCRIPTMODE scriptmode
;
248 struct list script_hosts
;
250 HTMLOptionElementFactory
*option_factory
;
251 HTMLImageElementFactory
*image_factory
;
252 HTMLLocation
*location
;
255 global_prop_t
*global_props
;
256 DWORD global_prop_cnt
;
257 DWORD global_prop_size
;
259 struct list children
;
260 struct list sibling_entry
;
270 typedef struct _cp_static_data_t
{
272 void (*on_advise
)(IUnknown
*,struct _cp_static_data_t
*);
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 ConnectionPointContainer
*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 IViewObjectExVtbl
*lpViewObjectExVtbl
;
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
;
326 const IObjectWithSiteVtbl
*lpObjectWithSiteVtbl
;
331 HTMLDocumentObj
*doc_obj
;
332 HTMLDocumentNode
*doc_node
;
338 ConnectionPointContainer cp_container
;
339 ConnectionPoint cp_htmldocevents
;
340 ConnectionPoint cp_htmldocevents2
;
341 ConnectionPoint cp_propnotif
;
342 ConnectionPoint cp_dispatch
;
344 IOleAdviseHolder
*advise_holder
;
347 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
349 return IUnknown_QueryInterface(This
->unk_impl
, riid
, ppv
);
352 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
354 return IUnknown_AddRef(This
->unk_impl
);
357 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
359 return IUnknown_Release(This
->unk_impl
);
362 struct HTMLDocumentObj
{
363 HTMLDocument basedoc
;
365 const ICustomDocVtbl
*lpCustomDocVtbl
;
369 NSContainer
*nscontainer
;
371 IOleClientSite
*client
;
372 IDocHostUIHandler
*hostui
;
373 IOleInPlaceSite
*ipsite
;
374 IOleInPlaceFrame
*frame
;
375 IOleInPlaceUIWindow
*ip_window
;
377 DOCHOSTUIINFO hostinfo
;
379 IOleUndoManager
*undomgr
;
384 BOOL request_uiactivate
;
385 BOOL in_place_active
;
389 BOOL container_locked
;
400 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
401 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
402 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
403 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
404 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
405 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
406 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
407 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
409 nsIWebBrowser
*webbrowser
;
410 nsIWebNavigation
*navigation
;
411 nsIBaseWindow
*window
;
412 nsIWebBrowserFocus
*focus
;
415 nsIController
*editor_controller
;
420 HTMLDocumentObj
*doc
;
422 nsIURIContentListener
*content_listener
;
426 HWND reset_focus
; /* hack */
430 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
431 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
432 const nsIHttpChannelInternalVtbl
*lpIHttpChannelInternalVtbl
;
437 nsIInputStream
*post_data_stream
;
438 nsILoadGroup
*load_group
;
439 nsIInterfaceRequestor
*notif_callback
;
441 nsLoadFlags load_flags
;
442 nsIURI
*original_uri
;
445 PRUint32 response_status
;
450 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
451 void (*destructor
)(HTMLDOMNode
*);
452 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
453 HRESULT (*call_event
)(HTMLDOMNode
*,DWORD
,BOOL
*);
454 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
455 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
456 HRESULT (*get_document
)(HTMLDOMNode
*,IDispatch
**);
457 HRESULT (*get_readystate
)(HTMLDOMNode
*,BSTR
*);
458 HRESULT (*get_dispid
)(HTMLDOMNode
*,BSTR
,DWORD
,DISPID
*);
459 HRESULT (*invoke
)(HTMLDOMNode
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
460 HRESULT (*bind_to_tree
)(HTMLDOMNode
*);
465 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
466 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
467 const NodeImplVtbl
*vtbl
;
472 HTMLDocumentNode
*doc
;
473 event_target_t
*event_target
;
474 ConnectionPointContainer
*cp_container
;
481 ConnectionPointContainer cp_container
;
483 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
484 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
485 const IHTMLElement3Vtbl
*lpHTMLElement3Vtbl
;
487 nsIDOMHTMLElement
*nselem
;
493 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
498 struct HTMLFrameBase
{
501 const IHTMLFrameBaseVtbl
*lpIHTMLFrameBaseVtbl
;
502 const IHTMLFrameBase2Vtbl
*lpIHTMLFrameBase2Vtbl
;
504 HTMLWindow
*content_window
;
506 nsIDOMHTMLFrameElement
*nsframe
;
507 nsIDOMHTMLIFrameElement
*nsiframe
;
510 typedef struct _mutation_queue_t
{
512 nsISupports
*nsiface
;
514 struct _mutation_queue_t
*next
;
517 typedef struct nsDocumentEventListener nsDocumentEventListener
;
519 struct HTMLDocumentNode
{
521 HTMLDocument basedoc
;
523 const IInternetHostSecurityManagerVtbl
*lpIInternetHostSecurityManagerVtbl
;
525 const nsIDocumentObserverVtbl
*lpIDocumentObserverVtbl
;
526 const nsIRunnableVtbl
*lpIRunnableVtbl
;
530 nsIDOMHTMLDocument
*nsdoc
;
533 event_target_t
*body_event_target
;
535 IInternetSecurityManager
*secmgr
;
536 ICatInformation
*catmgr
;
537 nsDocumentEventListener
*nsevent_listener
;
540 mutation_queue_t
*mutation_queue
;
541 mutation_queue_t
*mutation_queue_tail
;
543 struct list bindings
;
544 struct list selection_list
;
545 struct list range_list
;
548 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
549 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
550 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
552 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
553 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
554 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
555 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
556 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
557 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
558 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
559 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
560 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
561 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
562 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
563 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
564 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
565 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
566 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
567 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
568 #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)
569 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
570 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
571 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
572 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
573 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
574 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
575 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
576 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
577 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
578 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
579 #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)
581 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
582 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
583 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
584 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
585 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
586 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
587 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
588 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
589 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
591 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
593 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
595 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
596 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
597 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
598 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
600 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
601 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
602 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
604 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
605 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
606 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
607 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
608 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
610 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
611 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
612 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
614 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
615 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
616 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
618 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
620 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
622 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
624 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
625 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
627 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
628 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
629 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocumentObj
*,HTMLWindow
*,HTMLDocumentNode
**);
631 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*,nsIDOMWindow
*,HTMLWindow
*,HTMLWindow
**);
632 void update_window_doc(HTMLWindow
*);
633 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
634 nsIDOMWindow
*get_nsdoc_window(nsIDOMDocument
*);
635 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
636 HTMLImageElementFactory
*HTMLImageElementFactory_Create(HTMLWindow
*);
637 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
638 IOmNavigator
*OmNavigator_Create(void);
639 HRESULT
HTMLScreen_Create(IHTMLScreen
**);
641 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
642 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
643 void HTMLDocument_Persist_Init(HTMLDocument
*);
644 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
645 void HTMLDocument_OleObj_Init(HTMLDocument
*);
646 void HTMLDocument_View_Init(HTMLDocument
*);
647 void HTMLDocument_Window_Init(HTMLDocument
*);
648 void HTMLDocument_Service_Init(HTMLDocument
*);
649 void HTMLDocument_Hlink_Init(HTMLDocument
*);
651 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
653 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
655 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
,cp_static_data_t
*);
656 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
657 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
659 NSContainer
*NSContainer_Create(HTMLDocumentObj
*,NSContainer
*);
660 void NSContainer_Release(NSContainer
*);
662 void init_mutation(HTMLDocumentNode
*);
663 void release_mutation(HTMLDocumentNode
*);
665 void HTMLDocument_LockContainer(HTMLDocumentObj
*,BOOL
);
666 void show_context_menu(HTMLDocumentObj
*,DWORD
,POINT
*,IDispatch
*);
667 void notif_focus(HTMLDocumentObj
*);
669 void show_tooltip(HTMLDocumentObj
*,DWORD
,DWORD
,LPCWSTR
);
670 void hide_tooltip(HTMLDocumentObj
*);
671 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
673 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
675 BOOL
load_gecko(BOOL
);
676 void close_gecko(void);
677 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
678 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
679 void release_nsio(void);
680 BOOL
install_wine_gecko(BOOL
);
682 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
683 HRESULT
create_doc_uri(HTMLWindow
*,WCHAR
*,nsIWineURI
**);
685 HRESULT
hlink_frame_navigate(HTMLDocument
*,LPCWSTR
,nsIInputStream
*,DWORD
);
686 HRESULT
navigate_url(HTMLWindow
*,const WCHAR
*,const WCHAR
*);
687 HRESULT
set_frame_doc(HTMLFrameBase
*,nsIDOMDocument
*);
688 HRESULT
load_nsuri(HTMLWindow
*,nsIWineURI
*,DWORD
);
690 void call_property_onchanged(ConnectionPoint
*,DISPID
);
691 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
693 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
696 void nsACString_SetData(nsACString
*,const char*);
697 PRUint32
nsACString_GetData(const nsACString
*,const char**);
699 void nsAString_Init(nsAString
*,const PRUnichar
*);
700 void nsAString_SetData(nsAString
*,const PRUnichar
*);
701 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
702 void nsAString_Finish(nsAString
*);
704 nsICommandParams
*create_nscommand_params(void);
705 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
706 void get_editor_controller(NSContainer
*);
707 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
709 void init_nsevents(HTMLDocumentNode
*);
710 void release_nsevents(HTMLDocumentNode
*);
711 void add_nsevent_listener(HTMLDocumentNode
*,LPCWSTR
);
713 void set_window_bscallback(HTMLWindow
*,nsChannelBSC
*);
714 void set_current_mon(HTMLWindow
*,IMoniker
*);
715 HRESULT
start_binding(HTMLWindow
*,HTMLDocumentNode
*,BSCallback
*,IBindCtx
*);
716 void abort_document_bindings(HTMLDocumentNode
*);
718 HRESULT
bind_mon_to_buffer(HTMLDocumentNode
*,IMoniker
*,void**,DWORD
*);
720 nsChannelBSC
*create_channelbsc(IMoniker
*);
721 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
722 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
723 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
725 void set_ready_state(HTMLWindow
*,READYSTATE
);
727 HRESULT
HTMLSelectionObject_Create(HTMLDocumentNode
*,nsISelection
*,IHTMLSelectionObject
**);
728 HRESULT
HTMLTxtRange_Create(HTMLDocumentNode
*,nsIDOMRange
*,IHTMLTxtRange
**);
729 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
730 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
731 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
733 void detach_selection(HTMLDocumentNode
*);
734 void detach_ranges(HTMLDocumentNode
*);
735 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
737 HRESULT
create_nselem(HTMLDocumentNode
*,const WCHAR
*,nsIDOMHTMLElement
**);
739 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocumentNode
*,nsIDOMNode
*);
741 HTMLElement
*HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
742 HTMLElement
*HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*);
743 HTMLElement
*HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
744 HTMLElement
*HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
745 HTMLElement
*HTMLFormElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
746 HTMLElement
*HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
747 HTMLElement
*HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
748 HTMLElement
*HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
749 HTMLElement
*HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
750 HTMLElement
*HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
751 HTMLElement
*HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
752 HTMLElement
*HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
753 HTMLElement
*HTMLTable_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
754 HTMLElement
*HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
755 HTMLElement
*HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
756 HTMLElement
*HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
758 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*);
759 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
760 void HTMLElement2_Init(HTMLElement
*);
761 void HTMLElement3_Init(HTMLElement
*);
762 void HTMLTextContainer_Init(HTMLTextContainer
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
763 void HTMLFrameBase_Init(HTMLFrameBase
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
765 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
766 void HTMLDOMNode_destructor(HTMLDOMNode
*);
768 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
769 void HTMLElement_destructor(HTMLDOMNode
*);
771 HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*,REFIID
,void**);
772 void HTMLFrameBase_destructor(HTMLFrameBase
*);
774 HTMLDOMNode
*get_node(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
775 void release_nodes(HTMLDocumentNode
*);
777 void release_script_hosts(HTMLWindow
*);
778 void connect_scripts(HTMLWindow
*);
779 void doc_insert_script(HTMLWindow
*,nsIDOMHTMLScriptElement
*);
780 IDispatch
*script_parse_event(HTMLWindow
*,LPCWSTR
);
781 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
782 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
783 IDispatch
*get_script_disp(ScriptHost
*);
784 HRESULT
search_window_props(HTMLWindow
*,BSTR
,DWORD
,DISPID
*);
786 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
787 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocumentNode
*,IUnknown
*,nsIDOMNodeList
*);
788 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocumentNode
*,IUnknown
*,nsIDOMHTMLCollection
*);
793 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
794 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
797 extern const cmdtable_t editmode_cmds
[];
799 void do_ns_command(HTMLDocument
*,const char*,nsICommandParams
*);
802 #define UPDATE_UI 0x0001
803 #define UPDATE_TITLE 0x0002
805 void update_doc(HTMLDocument
*,DWORD
);
806 void update_title(HTMLDocumentObj
*);
809 void init_editor(HTMLDocument
*);
810 void set_ns_editmode(NSContainer
*);
811 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
812 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
813 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
814 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
815 void handle_edit_load(HTMLDocument
*);
816 HRESULT
editor_is_dirty(HTMLDocument
*);
817 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
819 extern DWORD mshtml_tls
;
821 typedef struct task_t task_t
;
822 typedef void (*task_proc_t
)(task_t
*);
832 HTMLDocumentObj
*doc
;
837 task_t
*task_queue_head
;
838 task_t
*task_queue_tail
;
839 struct list timer_list
;
842 thread_data_t
*get_thread_data(BOOL
);
843 HWND
get_thread_hwnd(void);
845 LONG
get_task_target_magic(void);
846 void push_task(task_t
*,task_proc_t
,LONG
);
847 void remove_target_tasks(LONG
);
849 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
850 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
852 void release_typelib(void);
853 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*);
855 const char *debugstr_variant(const VARIANT
*);
857 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
858 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
859 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
860 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
861 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
863 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
865 /* memory allocation functions */
867 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
869 return HeapAlloc(GetProcessHeap(), 0, len
);
872 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
874 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
877 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
879 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
882 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
884 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
887 static inline BOOL
heap_free(void *mem
)
889 return HeapFree(GetProcessHeap(), 0, mem
);
892 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
899 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
900 ret
= heap_alloc(size
);
901 memcpy(ret
, str
, size
);
907 static inline char *heap_strdupA(const char *str
)
914 size
= strlen(str
)+1;
915 ret
= heap_alloc(size
);
916 memcpy(ret
, str
, size
);
922 static inline WCHAR
*heap_strdupAtoW(const char *str
)
929 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
930 ret
= heap_alloc(len
*sizeof(WCHAR
));
931 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
937 static inline char *heap_strdupWtoA(LPCWSTR str
)
942 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
943 ret
= heap_alloc(size
);
944 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
950 static inline void windowref_addref(windowref_t
*ref
)
952 InterlockedIncrement(&ref
->ref
);
955 static inline void windowref_release(windowref_t
*ref
)
957 if(!InterlockedDecrement(&ref
->ref
))
961 HDC
get_display_dc(void);
962 HINSTANCE
get_shdoclc(void);
964 extern HINSTANCE hInst
;