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
,
71 DispHTMLFrameElement_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 IHTMLFiltersCollection_tid
,
109 IHTMLFormElement_tid
,
112 IHTMLFrameElement3_tid
,
113 IHTMLGenericElement_tid
,
114 IHTMLIFrameElement_tid
,
115 IHTMLImageElementFactory_tid
,
117 IHTMLInputElement_tid
,
119 IHTMLOptionElement_tid
,
121 IHTMLSelectElement_tid
,
128 IHTMLTextContainer_tid
,
137 typedef struct dispex_data_t dispex_data_t
;
138 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
140 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
141 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
144 HRESULT (*value
)(IUnknown
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
145 HRESULT (*get_dispid
)(IUnknown
*,BSTR
,DWORD
,DISPID
*);
146 HRESULT (*invoke
)(IUnknown
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
147 } dispex_static_data_vtbl_t
;
150 const dispex_static_data_vtbl_t
*vtbl
;
151 const tid_t disp_tid
;
153 const tid_t
* const iface_tids
;
154 } dispex_static_data_t
;
157 const IDispatchExVtbl
*lpIDispatchExVtbl
;
161 dispex_static_data_t
*data
;
162 dispex_dynamic_data_t
*dynamic_data
;
165 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
166 void release_dispex(DispatchEx
*);
167 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
168 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
169 HRESULT
get_dispids(tid_t
,DWORD
*,DISPID
**);
171 typedef struct HTMLDocumentNode HTMLDocumentNode
;
172 typedef struct HTMLDocumentObj HTMLDocumentObj
;
173 typedef struct HTMLFrameBase HTMLFrameBase
;
177 SCRIPTMODE_ACTIVESCRIPT
180 typedef struct ScriptHost ScriptHost
;
185 } global_prop_type_t
;
188 global_prop_type_t type
;
190 ScriptHost
*script_host
;
195 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
200 } HTMLOptionElementFactory
;
204 const IHTMLImageElementFactoryVtbl
*lpHTMLImageElementFactoryVtbl
;
209 } HTMLImageElementFactory
;
211 struct HTMLLocation
{
213 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
227 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
228 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
229 const IHTMLWindow4Vtbl
*lpHTMLWindow4Vtbl
;
230 const IDispatchExVtbl
*lpIDispatchExVtbl
;
234 windowref_t
*window_ref
;
237 HTMLDocumentNode
*doc
;
238 HTMLDocumentObj
*doc_obj
;
239 nsIDOMWindow
*nswindow
;
241 HTMLFrameBase
*frame_element
;
242 READYSTATE readystate
;
244 nsChannelBSC
*bscallback
;
248 IHTMLEventObj
*event
;
250 SCRIPTMODE scriptmode
;
251 struct list script_hosts
;
253 HTMLOptionElementFactory
*option_factory
;
254 HTMLImageElementFactory
*image_factory
;
255 HTMLLocation
*location
;
258 global_prop_t
*global_props
;
259 DWORD global_prop_cnt
;
260 DWORD global_prop_size
;
262 struct list children
;
263 struct list sibling_entry
;
273 typedef struct _cp_static_data_t
{
275 void (*on_advise
)(IUnknown
*,struct _cp_static_data_t
*);
280 typedef struct ConnectionPointContainer
{
281 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
283 ConnectionPoint
*cp_list
;
285 struct ConnectionPointContainer
*forward_container
;
286 } ConnectionPointContainer
;
288 struct ConnectionPoint
{
289 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
291 ConnectionPointContainer
*container
;
296 IPropertyNotifySink
*propnotif
;
301 cp_static_data_t
*data
;
303 ConnectionPoint
*next
;
306 struct HTMLDocument
{
307 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
308 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
309 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
310 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
311 const IHTMLDocument6Vtbl
*lpHTMLDocument6Vtbl
;
312 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
313 const IPersistFileVtbl
*lpPersistFileVtbl
;
314 const IPersistHistoryVtbl
*lpPersistHistoryVtbl
;
315 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
316 const IOleObjectVtbl
*lpOleObjectVtbl
;
317 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
318 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
319 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
320 const IViewObjectExVtbl
*lpViewObjectExVtbl
;
321 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
322 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
323 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
324 const IOleControlVtbl
*lpOleControlVtbl
;
325 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
326 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
327 const IDispatchExVtbl
*lpIDispatchExVtbl
;
328 const ISupportErrorInfoVtbl
*lpSupportErrorInfoVtbl
;
329 const IObjectWithSiteVtbl
*lpObjectWithSiteVtbl
;
334 HTMLDocumentObj
*doc_obj
;
335 HTMLDocumentNode
*doc_node
;
341 ConnectionPointContainer cp_container
;
342 ConnectionPoint cp_htmldocevents
;
343 ConnectionPoint cp_htmldocevents2
;
344 ConnectionPoint cp_propnotif
;
345 ConnectionPoint cp_dispatch
;
347 IOleAdviseHolder
*advise_holder
;
350 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
352 return IUnknown_QueryInterface(This
->unk_impl
, riid
, ppv
);
355 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
357 return IUnknown_AddRef(This
->unk_impl
);
360 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
362 return IUnknown_Release(This
->unk_impl
);
365 struct HTMLDocumentObj
{
366 HTMLDocument basedoc
;
368 const ICustomDocVtbl
*lpCustomDocVtbl
;
372 NSContainer
*nscontainer
;
374 IOleClientSite
*client
;
375 IDocHostUIHandler
*hostui
;
376 IOleInPlaceSite
*ipsite
;
377 IOleInPlaceFrame
*frame
;
378 IOleInPlaceUIWindow
*ip_window
;
380 DOCHOSTUIINFO hostinfo
;
382 IOleUndoManager
*undomgr
;
387 BOOL request_uiactivate
;
388 BOOL in_place_active
;
392 BOOL container_locked
;
403 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
404 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
405 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
406 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
407 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
408 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
409 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
410 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
412 nsIWebBrowser
*webbrowser
;
413 nsIWebNavigation
*navigation
;
414 nsIBaseWindow
*window
;
415 nsIWebBrowserFocus
*focus
;
418 nsIController
*editor_controller
;
423 HTMLDocumentObj
*doc
;
425 nsIURIContentListener
*content_listener
;
429 HWND reset_focus
; /* hack */
433 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
434 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
435 const nsIHttpChannelInternalVtbl
*lpIHttpChannelInternalVtbl
;
440 nsIInputStream
*post_data_stream
;
441 nsILoadGroup
*load_group
;
442 nsIInterfaceRequestor
*notif_callback
;
444 nsLoadFlags load_flags
;
445 nsIURI
*original_uri
;
448 PRUint32 response_status
;
453 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
454 void (*destructor
)(HTMLDOMNode
*);
455 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
456 HRESULT (*call_event
)(HTMLDOMNode
*,DWORD
,BOOL
*);
457 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
458 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
459 HRESULT (*get_document
)(HTMLDOMNode
*,IDispatch
**);
460 HRESULT (*get_readystate
)(HTMLDOMNode
*,BSTR
*);
461 HRESULT (*get_dispid
)(HTMLDOMNode
*,BSTR
,DWORD
,DISPID
*);
462 HRESULT (*invoke
)(HTMLDOMNode
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
463 HRESULT (*bind_to_tree
)(HTMLDOMNode
*);
468 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
469 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
470 const NodeImplVtbl
*vtbl
;
475 HTMLDocumentNode
*doc
;
476 event_target_t
*event_target
;
477 ConnectionPointContainer
*cp_container
;
484 ConnectionPointContainer cp_container
;
486 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
487 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
488 const IHTMLElement3Vtbl
*lpHTMLElement3Vtbl
;
490 nsIDOMHTMLElement
*nselem
;
496 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
501 struct HTMLFrameBase
{
504 const IHTMLFrameBaseVtbl
*lpIHTMLFrameBaseVtbl
;
505 const IHTMLFrameBase2Vtbl
*lpIHTMLFrameBase2Vtbl
;
507 HTMLWindow
*content_window
;
509 nsIDOMHTMLFrameElement
*nsframe
;
510 nsIDOMHTMLIFrameElement
*nsiframe
;
513 typedef struct _mutation_queue_t
{
515 nsISupports
*nsiface
;
517 struct _mutation_queue_t
*next
;
520 typedef struct nsDocumentEventListener nsDocumentEventListener
;
522 struct HTMLDocumentNode
{
524 HTMLDocument basedoc
;
526 const IInternetHostSecurityManagerVtbl
*lpIInternetHostSecurityManagerVtbl
;
528 const nsIDocumentObserverVtbl
*lpIDocumentObserverVtbl
;
529 const nsIRunnableVtbl
*lpIRunnableVtbl
;
533 nsIDOMHTMLDocument
*nsdoc
;
536 event_target_t
*body_event_target
;
538 IInternetSecurityManager
*secmgr
;
539 ICatInformation
*catmgr
;
540 nsDocumentEventListener
*nsevent_listener
;
543 mutation_queue_t
*mutation_queue
;
544 mutation_queue_t
*mutation_queue_tail
;
546 struct list bindings
;
547 struct list selection_list
;
548 struct list range_list
;
551 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
552 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
553 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
555 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
556 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
557 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
558 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
559 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
560 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
561 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
562 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
563 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
564 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
565 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
566 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
567 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
568 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
569 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
570 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
571 #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)
572 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
573 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
574 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
575 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
576 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
577 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
578 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
579 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
580 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
581 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
582 #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)
584 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
585 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
586 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
587 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
588 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
589 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
590 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
591 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
592 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
594 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
596 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
598 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
599 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
600 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
601 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
603 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
604 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
605 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
607 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
608 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
609 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
610 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
611 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
613 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
614 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
615 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
617 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
618 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
619 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
621 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
623 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
625 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
627 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
628 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
630 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
631 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
632 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocumentObj
*,HTMLWindow
*,HTMLDocumentNode
**);
634 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*,nsIDOMWindow
*,HTMLWindow
*,HTMLWindow
**);
635 void update_window_doc(HTMLWindow
*);
636 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
637 nsIDOMWindow
*get_nsdoc_window(nsIDOMDocument
*);
638 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
639 HTMLImageElementFactory
*HTMLImageElementFactory_Create(HTMLWindow
*);
640 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
641 IOmNavigator
*OmNavigator_Create(void);
642 HRESULT
HTMLScreen_Create(IHTMLScreen
**);
644 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
645 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
646 void HTMLDocument_Persist_Init(HTMLDocument
*);
647 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
648 void HTMLDocument_OleObj_Init(HTMLDocument
*);
649 void HTMLDocument_View_Init(HTMLDocument
*);
650 void HTMLDocument_Window_Init(HTMLDocument
*);
651 void HTMLDocument_Service_Init(HTMLDocument
*);
652 void HTMLDocument_Hlink_Init(HTMLDocument
*);
654 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
656 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
658 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
,cp_static_data_t
*);
659 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
660 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
662 NSContainer
*NSContainer_Create(HTMLDocumentObj
*,NSContainer
*);
663 void NSContainer_Release(NSContainer
*);
665 void init_mutation(HTMLDocumentNode
*);
666 void release_mutation(HTMLDocumentNode
*);
668 void HTMLDocument_LockContainer(HTMLDocumentObj
*,BOOL
);
669 void show_context_menu(HTMLDocumentObj
*,DWORD
,POINT
*,IDispatch
*);
670 void notif_focus(HTMLDocumentObj
*);
672 void show_tooltip(HTMLDocumentObj
*,DWORD
,DWORD
,LPCWSTR
);
673 void hide_tooltip(HTMLDocumentObj
*);
674 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
676 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
678 BOOL
load_gecko(BOOL
);
679 void close_gecko(void);
680 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
681 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
682 void release_nsio(void);
683 BOOL
install_wine_gecko(BOOL
);
685 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
686 HRESULT
create_doc_uri(HTMLWindow
*,WCHAR
*,nsIWineURI
**);
688 HRESULT
hlink_frame_navigate(HTMLDocument
*,LPCWSTR
,nsIInputStream
*,DWORD
);
689 HRESULT
navigate_url(HTMLWindow
*,const WCHAR
*,const WCHAR
*);
690 HRESULT
set_frame_doc(HTMLFrameBase
*,nsIDOMDocument
*);
691 HRESULT
load_nsuri(HTMLWindow
*,nsIWineURI
*,DWORD
);
693 void call_property_onchanged(ConnectionPoint
*,DISPID
);
694 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
696 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
699 void nsACString_SetData(nsACString
*,const char*);
700 PRUint32
nsACString_GetData(const nsACString
*,const char**);
702 void nsAString_Init(nsAString
*,const PRUnichar
*);
703 void nsAString_SetData(nsAString
*,const PRUnichar
*);
704 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
705 void nsAString_Finish(nsAString
*);
707 nsICommandParams
*create_nscommand_params(void);
708 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
709 void get_editor_controller(NSContainer
*);
710 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
712 void init_nsevents(HTMLDocumentNode
*);
713 void release_nsevents(HTMLDocumentNode
*);
714 void add_nsevent_listener(HTMLDocumentNode
*,LPCWSTR
);
716 void set_window_bscallback(HTMLWindow
*,nsChannelBSC
*);
717 void set_current_mon(HTMLWindow
*,IMoniker
*);
718 HRESULT
start_binding(HTMLWindow
*,HTMLDocumentNode
*,BSCallback
*,IBindCtx
*);
719 void abort_document_bindings(HTMLDocumentNode
*);
721 HRESULT
bind_mon_to_buffer(HTMLDocumentNode
*,IMoniker
*,void**,DWORD
*);
723 nsChannelBSC
*create_channelbsc(IMoniker
*);
724 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
725 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
726 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
728 void set_ready_state(HTMLWindow
*,READYSTATE
);
730 HRESULT
HTMLSelectionObject_Create(HTMLDocumentNode
*,nsISelection
*,IHTMLSelectionObject
**);
731 HRESULT
HTMLTxtRange_Create(HTMLDocumentNode
*,nsIDOMRange
*,IHTMLTxtRange
**);
732 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
733 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
734 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
736 void detach_selection(HTMLDocumentNode
*);
737 void detach_ranges(HTMLDocumentNode
*);
738 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
740 HRESULT
create_nselem(HTMLDocumentNode
*,const WCHAR
*,nsIDOMHTMLElement
**);
742 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocumentNode
*,nsIDOMNode
*);
744 HTMLElement
*HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
745 HTMLElement
*HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*);
746 HTMLElement
*HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
747 HTMLElement
*HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
748 HTMLElement
*HTMLFormElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
749 HTMLElement
*HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
750 HTMLElement
*HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
751 HTMLElement
*HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
752 HTMLElement
*HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
753 HTMLElement
*HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
754 HTMLElement
*HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
755 HTMLElement
*HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
756 HTMLElement
*HTMLTable_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
757 HTMLElement
*HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
758 HTMLElement
*HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
759 HTMLElement
*HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
761 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*);
762 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
763 void HTMLElement2_Init(HTMLElement
*);
764 void HTMLElement3_Init(HTMLElement
*);
765 void HTMLTextContainer_Init(HTMLTextContainer
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
766 void HTMLFrameBase_Init(HTMLFrameBase
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
768 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
769 void HTMLDOMNode_destructor(HTMLDOMNode
*);
771 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
772 void HTMLElement_destructor(HTMLDOMNode
*);
774 HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*,REFIID
,void**);
775 void HTMLFrameBase_destructor(HTMLFrameBase
*);
777 HTMLDOMNode
*get_node(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
778 void release_nodes(HTMLDocumentNode
*);
780 void release_script_hosts(HTMLWindow
*);
781 void connect_scripts(HTMLWindow
*);
782 void doc_insert_script(HTMLWindow
*,nsIDOMHTMLScriptElement
*);
783 IDispatch
*script_parse_event(HTMLWindow
*,LPCWSTR
);
784 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
785 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
786 IDispatch
*get_script_disp(ScriptHost
*);
787 HRESULT
search_window_props(HTMLWindow
*,BSTR
,DWORD
,DISPID
*);
789 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
790 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocumentNode
*,IUnknown
*,nsIDOMNodeList
*);
791 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocumentNode
*,IUnknown
*,nsIDOMHTMLCollection
*);
796 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
797 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
800 extern const cmdtable_t editmode_cmds
[];
802 void do_ns_command(HTMLDocument
*,const char*,nsICommandParams
*);
805 #define UPDATE_UI 0x0001
806 #define UPDATE_TITLE 0x0002
808 void update_doc(HTMLDocument
*,DWORD
);
809 void update_title(HTMLDocumentObj
*);
812 void init_editor(HTMLDocument
*);
813 void set_ns_editmode(NSContainer
*);
814 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
815 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
816 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
817 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
818 void handle_edit_load(HTMLDocument
*);
819 HRESULT
editor_is_dirty(HTMLDocument
*);
820 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
822 extern DWORD mshtml_tls
;
824 typedef struct task_t task_t
;
825 typedef void (*task_proc_t
)(task_t
*);
835 HTMLDocumentObj
*doc
;
840 task_t
*task_queue_head
;
841 task_t
*task_queue_tail
;
842 struct list timer_list
;
845 thread_data_t
*get_thread_data(BOOL
);
846 HWND
get_thread_hwnd(void);
848 LONG
get_task_target_magic(void);
849 void push_task(task_t
*,task_proc_t
,LONG
);
850 void remove_target_tasks(LONG
);
852 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
853 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
855 void release_typelib(void);
856 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*);
858 const char *debugstr_variant(const VARIANT
*);
860 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
861 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
862 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
863 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
864 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
866 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
868 /* memory allocation functions */
870 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
872 return HeapAlloc(GetProcessHeap(), 0, len
);
875 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
877 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
880 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
882 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
885 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
887 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
890 static inline BOOL
heap_free(void *mem
)
892 return HeapFree(GetProcessHeap(), 0, mem
);
895 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
902 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
903 ret
= heap_alloc(size
);
904 memcpy(ret
, str
, size
);
910 static inline char *heap_strdupA(const char *str
)
917 size
= strlen(str
)+1;
918 ret
= heap_alloc(size
);
919 memcpy(ret
, str
, size
);
925 static inline WCHAR
*heap_strdupAtoW(const char *str
)
932 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
933 ret
= heap_alloc(len
*sizeof(WCHAR
));
934 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
940 static inline char *heap_strdupWtoA(LPCWSTR str
)
945 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
946 ret
= heap_alloc(size
);
947 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
953 static inline void windowref_addref(windowref_t
*ref
)
955 InterlockedIncrement(&ref
->ref
);
958 static inline void windowref_release(windowref_t
*ref
)
960 if(!InterlockedDecrement(&ref
->ref
))
964 HDC
get_display_dc(void);
965 HINSTANCE
get_shdoclc(void);
967 extern HINSTANCE hInst
;