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 DispHTMLScriptElement_tid
,
80 DispHTMLSelectElement_tid
,
84 DispHTMLTextAreaElement_tid
,
85 DispHTMLUnknownElement_tid
,
87 HTMLDocumentEvents_tid
,
88 IHTMLAnchorElement_tid
,
90 IHTMLBodyElement2_tid
,
91 IHTMLCommentElement_tid
,
92 IHTMLCurrentStyle_tid
,
93 IHTMLCurrentStyle2_tid
,
94 IHTMLCurrentStyle3_tid
,
95 IHTMLCurrentStyle4_tid
,
100 IHTMLDOMChildrenCollection_tid
,
103 IHTMLDOMTextNode_tid
,
108 IHTMLElementCollection_tid
,
110 IHTMLFiltersCollection_tid
,
111 IHTMLFormElement_tid
,
114 IHTMLFrameElement3_tid
,
115 IHTMLGenericElement_tid
,
116 IHTMLIFrameElement_tid
,
117 IHTMLImageElementFactory_tid
,
119 IHTMLInputElement_tid
,
121 IHTMLOptionElement_tid
,
123 IHTMLScriptElement_tid
,
124 IHTMLSelectElement_tid
,
131 IHTMLTextAreaElement_tid
,
132 IHTMLTextContainer_tid
,
141 typedef struct dispex_data_t dispex_data_t
;
142 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
144 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
145 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
148 HRESULT (*value
)(IUnknown
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
149 HRESULT (*get_dispid
)(IUnknown
*,BSTR
,DWORD
,DISPID
*);
150 HRESULT (*invoke
)(IUnknown
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
151 } dispex_static_data_vtbl_t
;
154 const dispex_static_data_vtbl_t
*vtbl
;
155 const tid_t disp_tid
;
157 const tid_t
* const iface_tids
;
158 } dispex_static_data_t
;
161 const IDispatchExVtbl
*lpIDispatchExVtbl
;
165 dispex_static_data_t
*data
;
166 dispex_dynamic_data_t
*dynamic_data
;
169 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
170 void release_dispex(DispatchEx
*);
171 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
172 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
173 HRESULT
get_dispids(tid_t
,DWORD
*,DISPID
**);
175 typedef struct HTMLDocumentNode HTMLDocumentNode
;
176 typedef struct HTMLDocumentObj HTMLDocumentObj
;
177 typedef struct HTMLFrameBase HTMLFrameBase
;
181 SCRIPTMODE_ACTIVESCRIPT
184 typedef struct ScriptHost ScriptHost
;
189 } global_prop_type_t
;
192 global_prop_type_t type
;
194 ScriptHost
*script_host
;
199 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
204 } HTMLOptionElementFactory
;
208 const IHTMLImageElementFactoryVtbl
*lpHTMLImageElementFactoryVtbl
;
213 } HTMLImageElementFactory
;
215 struct HTMLLocation
{
217 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
231 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
232 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
233 const IHTMLWindow4Vtbl
*lpHTMLWindow4Vtbl
;
234 const IDispatchExVtbl
*lpIDispatchExVtbl
;
238 windowref_t
*window_ref
;
241 HTMLDocumentNode
*doc
;
242 HTMLDocumentObj
*doc_obj
;
243 nsIDOMWindow
*nswindow
;
245 HTMLFrameBase
*frame_element
;
246 READYSTATE readystate
;
248 nsChannelBSC
*bscallback
;
252 IHTMLEventObj
*event
;
254 SCRIPTMODE scriptmode
;
255 struct list script_hosts
;
257 HTMLOptionElementFactory
*option_factory
;
258 HTMLImageElementFactory
*image_factory
;
259 HTMLLocation
*location
;
262 global_prop_t
*global_props
;
263 DWORD global_prop_cnt
;
264 DWORD global_prop_size
;
266 struct list children
;
267 struct list sibling_entry
;
277 typedef struct _cp_static_data_t
{
279 void (*on_advise
)(IUnknown
*,struct _cp_static_data_t
*);
284 typedef struct ConnectionPointContainer
{
285 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
287 ConnectionPoint
*cp_list
;
289 struct ConnectionPointContainer
*forward_container
;
290 } ConnectionPointContainer
;
292 struct ConnectionPoint
{
293 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
295 ConnectionPointContainer
*container
;
300 IPropertyNotifySink
*propnotif
;
305 cp_static_data_t
*data
;
307 ConnectionPoint
*next
;
310 struct HTMLDocument
{
311 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
312 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
313 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
314 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
315 const IHTMLDocument6Vtbl
*lpHTMLDocument6Vtbl
;
316 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
317 const IPersistFileVtbl
*lpPersistFileVtbl
;
318 const IPersistHistoryVtbl
*lpPersistHistoryVtbl
;
319 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
320 const IOleObjectVtbl
*lpOleObjectVtbl
;
321 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
322 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
323 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
324 const IViewObjectExVtbl
*lpViewObjectExVtbl
;
325 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
326 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
327 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
328 const IOleControlVtbl
*lpOleControlVtbl
;
329 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
330 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
331 const IDispatchExVtbl
*lpIDispatchExVtbl
;
332 const ISupportErrorInfoVtbl
*lpSupportErrorInfoVtbl
;
333 const IObjectWithSiteVtbl
*lpObjectWithSiteVtbl
;
338 HTMLDocumentObj
*doc_obj
;
339 HTMLDocumentNode
*doc_node
;
345 ConnectionPointContainer cp_container
;
346 ConnectionPoint cp_htmldocevents
;
347 ConnectionPoint cp_htmldocevents2
;
348 ConnectionPoint cp_propnotif
;
349 ConnectionPoint cp_dispatch
;
351 IOleAdviseHolder
*advise_holder
;
354 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
356 return IUnknown_QueryInterface(This
->unk_impl
, riid
, ppv
);
359 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
361 return IUnknown_AddRef(This
->unk_impl
);
364 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
366 return IUnknown_Release(This
->unk_impl
);
369 struct HTMLDocumentObj
{
370 HTMLDocument basedoc
;
372 const ICustomDocVtbl
*lpCustomDocVtbl
;
376 NSContainer
*nscontainer
;
378 IOleClientSite
*client
;
379 IDocHostUIHandler
*hostui
;
380 IOleInPlaceSite
*ipsite
;
381 IOleInPlaceFrame
*frame
;
382 IOleInPlaceUIWindow
*ip_window
;
383 IAdviseSink
*view_sink
;
385 DOCHOSTUIINFO hostinfo
;
387 IOleUndoManager
*undomgr
;
392 BOOL request_uiactivate
;
393 BOOL in_place_active
;
397 BOOL container_locked
;
408 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
409 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
410 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
411 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
412 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
413 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
414 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
415 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
417 nsIWebBrowser
*webbrowser
;
418 nsIWebNavigation
*navigation
;
419 nsIBaseWindow
*window
;
420 nsIWebBrowserFocus
*focus
;
423 nsIController
*editor_controller
;
428 HTMLDocumentObj
*doc
;
430 nsIURIContentListener
*content_listener
;
434 HWND reset_focus
; /* hack */
438 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
439 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
440 const nsIHttpChannelInternalVtbl
*lpIHttpChannelInternalVtbl
;
445 nsIInputStream
*post_data_stream
;
446 nsILoadGroup
*load_group
;
447 nsIInterfaceRequestor
*notif_callback
;
449 nsLoadFlags load_flags
;
450 nsIURI
*original_uri
;
453 PRUint32 response_status
;
458 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
459 void (*destructor
)(HTMLDOMNode
*);
460 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
461 HRESULT (*call_event
)(HTMLDOMNode
*,DWORD
,BOOL
*);
462 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
463 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
464 HRESULT (*get_document
)(HTMLDOMNode
*,IDispatch
**);
465 HRESULT (*get_readystate
)(HTMLDOMNode
*,BSTR
*);
466 HRESULT (*get_dispid
)(HTMLDOMNode
*,BSTR
,DWORD
,DISPID
*);
467 HRESULT (*invoke
)(HTMLDOMNode
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
468 HRESULT (*bind_to_tree
)(HTMLDOMNode
*);
473 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
474 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
475 const NodeImplVtbl
*vtbl
;
480 HTMLDocumentNode
*doc
;
481 event_target_t
*event_target
;
482 ConnectionPointContainer
*cp_container
;
489 ConnectionPointContainer cp_container
;
491 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
492 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
493 const IHTMLElement3Vtbl
*lpHTMLElement3Vtbl
;
495 nsIDOMHTMLElement
*nselem
;
498 #define HTMLELEMENT_TIDS \
509 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
514 struct HTMLFrameBase
{
517 const IHTMLFrameBaseVtbl
*lpIHTMLFrameBaseVtbl
;
518 const IHTMLFrameBase2Vtbl
*lpIHTMLFrameBase2Vtbl
;
520 HTMLWindow
*content_window
;
522 nsIDOMHTMLFrameElement
*nsframe
;
523 nsIDOMHTMLIFrameElement
*nsiframe
;
526 typedef struct _mutation_queue_t
{
528 nsISupports
*nsiface
;
530 struct _mutation_queue_t
*next
;
533 typedef struct nsDocumentEventListener nsDocumentEventListener
;
535 struct HTMLDocumentNode
{
537 HTMLDocument basedoc
;
539 const IInternetHostSecurityManagerVtbl
*lpIInternetHostSecurityManagerVtbl
;
541 const nsIDocumentObserverVtbl
*lpIDocumentObserverVtbl
;
542 const nsIRunnableVtbl
*lpIRunnableVtbl
;
546 nsIDOMHTMLDocument
*nsdoc
;
549 event_target_t
*body_event_target
;
551 IInternetSecurityManager
*secmgr
;
552 ICatInformation
*catmgr
;
553 nsDocumentEventListener
*nsevent_listener
;
556 mutation_queue_t
*mutation_queue
;
557 mutation_queue_t
*mutation_queue_tail
;
559 struct list bindings
;
560 struct list selection_list
;
561 struct list range_list
;
564 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
565 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
566 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
568 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
569 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
570 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
571 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
572 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
573 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
574 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
575 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
576 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
577 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
578 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
579 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
580 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
581 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
582 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
583 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
584 #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)
585 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
586 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
587 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
588 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
589 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
590 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
591 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
592 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
593 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
594 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
595 #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)
597 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
598 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
599 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
600 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
601 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
602 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
603 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
604 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
605 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
607 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
609 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
611 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
612 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
613 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
614 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
616 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
617 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
618 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
620 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
621 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
622 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
623 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
624 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
626 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
627 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
628 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
630 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
631 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
632 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
634 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
636 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
638 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
640 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
641 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
643 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
644 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
645 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocumentObj
*,HTMLWindow
*,HTMLDocumentNode
**);
647 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*,nsIDOMWindow
*,HTMLWindow
*,HTMLWindow
**);
648 void update_window_doc(HTMLWindow
*);
649 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
650 nsIDOMWindow
*get_nsdoc_window(nsIDOMDocument
*);
651 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
652 HTMLImageElementFactory
*HTMLImageElementFactory_Create(HTMLWindow
*);
653 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
654 IOmNavigator
*OmNavigator_Create(void);
655 HRESULT
HTMLScreen_Create(IHTMLScreen
**);
657 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
658 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
659 void HTMLDocument_Persist_Init(HTMLDocument
*);
660 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
661 void HTMLDocument_OleObj_Init(HTMLDocument
*);
662 void HTMLDocument_View_Init(HTMLDocument
*);
663 void HTMLDocument_Window_Init(HTMLDocument
*);
664 void HTMLDocument_Service_Init(HTMLDocument
*);
665 void HTMLDocument_Hlink_Init(HTMLDocument
*);
667 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
669 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
671 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
,cp_static_data_t
*);
672 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
673 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
675 NSContainer
*NSContainer_Create(HTMLDocumentObj
*,NSContainer
*);
676 void NSContainer_Release(NSContainer
*);
678 void init_mutation(HTMLDocumentNode
*);
679 void release_mutation(HTMLDocumentNode
*);
681 void HTMLDocument_LockContainer(HTMLDocumentObj
*,BOOL
);
682 void show_context_menu(HTMLDocumentObj
*,DWORD
,POINT
*,IDispatch
*);
683 void notif_focus(HTMLDocumentObj
*);
685 void show_tooltip(HTMLDocumentObj
*,DWORD
,DWORD
,LPCWSTR
);
686 void hide_tooltip(HTMLDocumentObj
*);
687 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
689 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
691 BOOL
load_gecko(BOOL
);
692 void close_gecko(void);
693 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
694 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
695 void release_nsio(void);
696 BOOL
install_wine_gecko(BOOL
);
698 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
699 HRESULT
create_doc_uri(HTMLWindow
*,WCHAR
*,nsIWineURI
**);
701 HRESULT
hlink_frame_navigate(HTMLDocument
*,LPCWSTR
,nsIInputStream
*,DWORD
);
702 HRESULT
navigate_url(HTMLWindow
*,const WCHAR
*,const WCHAR
*);
703 HRESULT
set_frame_doc(HTMLFrameBase
*,nsIDOMDocument
*);
704 HRESULT
load_nsuri(HTMLWindow
*,nsIWineURI
*,DWORD
);
706 void call_property_onchanged(ConnectionPoint
*,DISPID
);
707 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
709 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
712 void nsACString_SetData(nsACString
*,const char*);
713 PRUint32
nsACString_GetData(const nsACString
*,const char**);
715 BOOL
nsAString_Init(nsAString
*,const PRUnichar
*);
716 void nsAString_InitDepend(nsAString
*,const PRUnichar
*);
717 void nsAString_SetData(nsAString
*,const PRUnichar
*);
718 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
719 void nsAString_Finish(nsAString
*);
721 nsICommandParams
*create_nscommand_params(void);
722 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
723 void get_editor_controller(NSContainer
*);
724 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
726 void init_nsevents(HTMLDocumentNode
*);
727 void release_nsevents(HTMLDocumentNode
*);
728 void add_nsevent_listener(HTMLDocumentNode
*,LPCWSTR
);
730 void set_window_bscallback(HTMLWindow
*,nsChannelBSC
*);
731 void set_current_mon(HTMLWindow
*,IMoniker
*);
732 HRESULT
start_binding(HTMLWindow
*,HTMLDocumentNode
*,BSCallback
*,IBindCtx
*);
733 void abort_document_bindings(HTMLDocumentNode
*);
735 HRESULT
bind_mon_to_buffer(HTMLDocumentNode
*,IMoniker
*,void**,DWORD
*);
737 nsChannelBSC
*create_channelbsc(IMoniker
*);
738 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
739 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
740 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
742 void set_ready_state(HTMLWindow
*,READYSTATE
);
744 HRESULT
HTMLSelectionObject_Create(HTMLDocumentNode
*,nsISelection
*,IHTMLSelectionObject
**);
745 HRESULT
HTMLTxtRange_Create(HTMLDocumentNode
*,nsIDOMRange
*,IHTMLTxtRange
**);
746 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
747 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
748 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
750 void detach_selection(HTMLDocumentNode
*);
751 void detach_ranges(HTMLDocumentNode
*);
752 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
754 HRESULT
create_nselem(HTMLDocumentNode
*,const WCHAR
*,nsIDOMHTMLElement
**);
756 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocumentNode
*,nsIDOMNode
*);
758 HTMLElement
*HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
759 HTMLElement
*HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*);
760 HTMLElement
*HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
761 HTMLElement
*HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
762 HTMLElement
*HTMLFormElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
763 HTMLElement
*HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
764 HTMLElement
*HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
765 HTMLElement
*HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
766 HTMLElement
*HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
767 HTMLElement
*HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
768 HTMLElement
*HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
769 HTMLElement
*HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
770 HTMLElement
*HTMLTable_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
771 HTMLElement
*HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
772 HTMLElement
*HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
773 HTMLElement
*HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
775 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*);
776 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
777 void HTMLElement2_Init(HTMLElement
*);
778 void HTMLElement3_Init(HTMLElement
*);
779 void HTMLTextContainer_Init(HTMLTextContainer
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
780 void HTMLFrameBase_Init(HTMLFrameBase
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
782 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
783 void HTMLDOMNode_destructor(HTMLDOMNode
*);
785 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
786 void HTMLElement_destructor(HTMLDOMNode
*);
788 HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*,REFIID
,void**);
789 void HTMLFrameBase_destructor(HTMLFrameBase
*);
791 HTMLDOMNode
*get_node(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
792 void release_nodes(HTMLDocumentNode
*);
794 void release_script_hosts(HTMLWindow
*);
795 void connect_scripts(HTMLWindow
*);
796 void doc_insert_script(HTMLWindow
*,nsIDOMHTMLScriptElement
*);
797 IDispatch
*script_parse_event(HTMLWindow
*,LPCWSTR
);
798 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
799 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
800 IDispatch
*get_script_disp(ScriptHost
*);
801 HRESULT
search_window_props(HTMLWindow
*,BSTR
,DWORD
,DISPID
*);
803 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
804 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocumentNode
*,IUnknown
*,nsIDOMNodeList
*);
805 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocumentNode
*,IUnknown
*,nsIDOMHTMLCollection
*);
810 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
811 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
814 extern const cmdtable_t editmode_cmds
[];
816 void do_ns_command(HTMLDocument
*,const char*,nsICommandParams
*);
819 #define UPDATE_UI 0x0001
820 #define UPDATE_TITLE 0x0002
822 void update_doc(HTMLDocument
*,DWORD
);
823 void update_title(HTMLDocumentObj
*);
826 void init_editor(HTMLDocument
*);
827 void set_ns_editmode(NSContainer
*);
828 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
829 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
830 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
831 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
832 void handle_edit_load(HTMLDocument
*);
833 HRESULT
editor_is_dirty(HTMLDocument
*);
834 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
836 extern DWORD mshtml_tls
;
838 typedef struct task_t task_t
;
839 typedef void (*task_proc_t
)(task_t
*);
849 HTMLDocumentObj
*doc
;
854 task_t
*task_queue_head
;
855 task_t
*task_queue_tail
;
856 struct list timer_list
;
859 thread_data_t
*get_thread_data(BOOL
);
860 HWND
get_thread_hwnd(void);
862 LONG
get_task_target_magic(void);
863 void push_task(task_t
*,task_proc_t
,LONG
);
864 void remove_target_tasks(LONG
);
866 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
867 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
869 void release_typelib(void);
870 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*);
872 const char *debugstr_variant(const VARIANT
*);
874 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
875 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
876 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
877 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
878 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
880 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
882 /* memory allocation functions */
884 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
886 return HeapAlloc(GetProcessHeap(), 0, len
);
889 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
891 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
894 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
896 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
899 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
901 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
904 static inline BOOL
heap_free(void *mem
)
906 return HeapFree(GetProcessHeap(), 0, mem
);
909 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
916 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
917 ret
= heap_alloc(size
);
918 memcpy(ret
, str
, size
);
924 static inline char *heap_strdupA(const char *str
)
931 size
= strlen(str
)+1;
932 ret
= heap_alloc(size
);
933 memcpy(ret
, str
, size
);
939 static inline WCHAR
*heap_strdupAtoW(const char *str
)
946 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
947 ret
= heap_alloc(len
*sizeof(WCHAR
));
948 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
954 static inline char *heap_strdupWtoA(LPCWSTR str
)
959 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
960 ret
= heap_alloc(size
);
961 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
967 static inline void windowref_addref(windowref_t
*ref
)
969 InterlockedIncrement(&ref
->ref
);
972 static inline void windowref_release(windowref_t
*ref
)
974 if(!InterlockedDecrement(&ref
->ref
))
978 HDC
get_display_dc(void);
979 HINSTANCE
get_shdoclc(void);
981 extern HINSTANCE hInst
;