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
27 #include "wine/list.h"
28 #include "wine/unicode.h"
36 #define NS_OK ((nsresult)0x00000000L)
37 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
38 #define NS_NOINTERFACE ((nsresult)0x80004002L)
39 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
40 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
41 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
42 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
44 #define NS_FAILED(res) ((res) & 0x80000000)
45 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
49 #define MSHTML_E_NODOC 0x800a025c
51 typedef struct HTMLDOMNode HTMLDOMNode
;
52 typedef struct ConnectionPoint ConnectionPoint
;
53 typedef struct BSCallback BSCallback
;
54 typedef struct nsChannelBSC nsChannelBSC
;
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 DispHTMLGenericElement_tid
,
72 DispHTMLInputElement_tid
,
74 DispHTMLNavigator_tid
,
75 DispHTMLOptionElement_tid
,
76 DispHTMLSelectElement_tid
,
80 DispHTMLUnknownElement_tid
,
82 IHTMLAnchorElement_tid
,
84 IHTMLBodyElement2_tid
,
85 IHTMLCommentElement_tid
,
86 IHTMLCurrentStyle_tid
,
87 IHTMLCurrentStyle2_tid
,
88 IHTMLCurrentStyle3_tid
,
89 IHTMLCurrentStyle4_tid
,
94 IHTMLDOMChildrenCollection_tid
,
102 IHTMLElementCollection_tid
,
106 IHTMLGenericElement_tid
,
107 IHTMLImageElementFactory_tid
,
109 IHTMLInputElement_tid
,
111 IHTMLOptionElement_tid
,
112 IHTMLSelectElement_tid
,
119 IHTMLTextContainer_tid
,
127 typedef struct dispex_data_t dispex_data_t
;
128 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
130 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
131 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
134 HRESULT (*value
)(IUnknown
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
135 HRESULT (*get_dispid
)(IUnknown
*,BSTR
,DWORD
,DISPID
*);
136 HRESULT (*invoke
)(IUnknown
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
137 } dispex_static_data_vtbl_t
;
140 const dispex_static_data_vtbl_t
*vtbl
;
141 const tid_t disp_tid
;
143 const tid_t
* const iface_tids
;
144 } dispex_static_data_t
;
147 const IDispatchExVtbl
*lpIDispatchExVtbl
;
151 dispex_static_data_t
*data
;
152 dispex_dynamic_data_t
*dynamic_data
;
155 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
156 void release_dispex(DispatchEx
*);
157 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
158 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
160 typedef struct HTMLDocumentNode HTMLDocumentNode
;
161 typedef struct HTMLDocumentObj HTMLDocumentObj
;
162 typedef struct HTMLFrameBase HTMLFrameBase
;
166 SCRIPTMODE_ACTIVESCRIPT
169 typedef struct ScriptHost ScriptHost
;
174 } global_prop_type_t
;
177 global_prop_type_t type
;
179 ScriptHost
*script_host
;
184 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
189 } HTMLOptionElementFactory
;
193 const IHTMLImageElementFactoryVtbl
*lpHTMLImageElementFactoryVtbl
;
198 } HTMLImageElementFactory
;
200 struct HTMLLocation
{
202 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
216 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
217 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
218 const IDispatchExVtbl
*lpIDispatchExVtbl
;
222 windowref_t
*window_ref
;
225 HTMLDocumentNode
*doc
;
226 HTMLDocumentObj
*doc_obj
;
227 nsIDOMWindow
*nswindow
;
229 HTMLFrameBase
*frame_element
;
230 READYSTATE readystate
;
232 nsChannelBSC
*bscallback
;
236 event_target_t
*event_target
;
237 IHTMLEventObj
*event
;
239 SCRIPTMODE scriptmode
;
240 struct list script_hosts
;
242 HTMLOptionElementFactory
*option_factory
;
243 HTMLImageElementFactory
*image_factory
;
244 HTMLLocation
*location
;
246 global_prop_t
*global_props
;
247 DWORD global_prop_cnt
;
248 DWORD global_prop_size
;
250 struct list children
;
251 struct list sibling_entry
;
262 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
264 ConnectionPoint
*cp_list
;
266 } ConnectionPointContainer
;
268 struct ConnectionPoint
{
269 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
271 IConnectionPointContainer
*container
;
276 IPropertyNotifySink
*propnotif
;
282 ConnectionPoint
*next
;
285 struct HTMLDocument
{
286 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
287 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
288 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
289 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
290 const IHTMLDocument6Vtbl
*lpHTMLDocument6Vtbl
;
291 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
292 const IPersistFileVtbl
*lpPersistFileVtbl
;
293 const IPersistHistoryVtbl
*lpPersistHistoryVtbl
;
294 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
295 const IOleObjectVtbl
*lpOleObjectVtbl
;
296 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
297 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
298 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
299 const IViewObject2Vtbl
*lpViewObject2Vtbl
;
300 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
301 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
302 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
303 const IOleControlVtbl
*lpOleControlVtbl
;
304 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
305 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
306 const IDispatchExVtbl
*lpIDispatchExVtbl
;
307 const ISupportErrorInfoVtbl
*lpSupportErrorInfoVtbl
;
312 HTMLDocumentObj
*doc_obj
;
313 HTMLDocumentNode
*doc_node
;
319 ConnectionPointContainer cp_container
;
320 ConnectionPoint cp_htmldocevents
;
321 ConnectionPoint cp_htmldocevents2
;
322 ConnectionPoint cp_propnotif
;
325 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
327 return IUnknown_QueryInterface(This
->unk_impl
, riid
, ppv
);
330 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
332 return IUnknown_AddRef(This
->unk_impl
);
335 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
337 return IUnknown_Release(This
->unk_impl
);
340 struct HTMLDocumentObj
{
341 HTMLDocument basedoc
;
343 const ICustomDocVtbl
*lpCustomDocVtbl
;
347 NSContainer
*nscontainer
;
349 IOleClientSite
*client
;
350 IDocHostUIHandler
*hostui
;
351 IOleInPlaceSite
*ipsite
;
352 IOleInPlaceFrame
*frame
;
353 IOleInPlaceUIWindow
*ip_window
;
355 DOCHOSTUIINFO hostinfo
;
357 IOleUndoManager
*undomgr
;
362 BOOL in_place_active
;
366 BOOL container_locked
;
376 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
377 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
378 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
379 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
380 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
381 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
382 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
383 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
385 nsIWebBrowser
*webbrowser
;
386 nsIWebNavigation
*navigation
;
387 nsIBaseWindow
*window
;
388 nsIWebBrowserFocus
*focus
;
391 nsIController
*editor_controller
;
396 HTMLDocumentObj
*doc
;
398 nsIURIContentListener
*content_listener
;
402 nsChannelBSC
*bscallback
; /* hack */
403 HWND reset_focus
; /* hack */
407 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
408 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
409 const nsIHttpChannelInternalVtbl
*lpIHttpChannelInternalVtbl
;
414 nsIHttpChannel
*http_channel
;
415 nsIHttpChannelInternal
*http_channel_internal
;
417 nsIInputStream
*post_data_stream
;
418 nsILoadGroup
*load_group
;
419 nsIInterfaceRequestor
*notif_callback
;
421 nsLoadFlags load_flags
;
422 nsIURI
*original_uri
;
425 PRUint32 response_status
;
429 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
430 void (*destructor
)(HTMLDOMNode
*);
431 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
432 HRESULT (*call_event
)(HTMLDOMNode
*,DWORD
,BOOL
*);
433 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
434 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
439 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
440 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
441 const NodeImplVtbl
*vtbl
;
446 HTMLDocumentNode
*doc
;
447 event_target_t
*event_target
;
454 ConnectionPointContainer cp_container
;
456 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
457 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
458 const IHTMLElement3Vtbl
*lpHTMLElement3Vtbl
;
460 nsIDOMHTMLElement
*nselem
;
466 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
471 struct HTMLFrameBase
{
474 const IHTMLFrameBaseVtbl
*lpIHTMLFrameBaseVtbl
;
476 HTMLWindow
*content_window
;
479 typedef struct _mutation_queue_t
{
481 nsISupports
*nsiface
;
483 struct _mutation_queue_t
*next
;
486 typedef struct nsDocumentEventListener nsDocumentEventListener
;
488 struct HTMLDocumentNode
{
490 HTMLDocument basedoc
;
492 const IInternetHostSecurityManagerVtbl
*lpIInternetHostSecurityManagerVtbl
;
494 const nsIDocumentObserverVtbl
*lpIDocumentObserverVtbl
;
495 const nsIRunnableVtbl
*lpIRunnableVtbl
;
499 nsIDOMHTMLDocument
*nsdoc
;
503 IInternetSecurityManager
*secmgr
;
504 nsDocumentEventListener
*nsevent_listener
;
507 mutation_queue_t
*mutation_queue
;
508 mutation_queue_t
*mutation_queue_tail
;
510 struct list bindings
;
511 struct list selection_list
;
512 struct list range_list
;
515 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
516 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
518 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
519 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
520 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
521 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
522 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
523 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
524 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
525 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
526 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
527 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
528 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
529 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
530 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
531 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
532 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
533 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
534 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
535 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
536 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
537 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
538 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
539 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
540 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
541 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
542 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
543 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
545 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
546 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
547 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
548 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
549 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
550 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
551 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
552 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
553 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
555 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
557 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
559 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
560 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
561 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
562 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
564 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
565 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
566 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
568 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
569 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
570 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
571 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
572 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
574 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
575 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
577 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
578 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
579 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
581 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
583 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
585 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
587 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
588 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
590 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
591 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
592 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocumentObj
*,HTMLWindow
*,HTMLDocumentNode
**);
594 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*,nsIDOMWindow
*,HTMLWindow
*,HTMLWindow
**);
595 void update_window_doc(HTMLWindow
*);
596 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
597 nsIDOMWindow
*get_nsdoc_window(nsIDOMDocument
*);
598 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
599 HTMLImageElementFactory
*HTMLImageElementFactory_Create(HTMLWindow
*);
600 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
601 IOmNavigator
*OmNavigator_Create(void);
603 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
604 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
605 void HTMLDocument_Persist_Init(HTMLDocument
*);
606 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
607 void HTMLDocument_OleObj_Init(HTMLDocument
*);
608 void HTMLDocument_View_Init(HTMLDocument
*);
609 void HTMLDocument_Window_Init(HTMLDocument
*);
610 void HTMLDocument_Service_Init(HTMLDocument
*);
611 void HTMLDocument_Hlink_Init(HTMLDocument
*);
613 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
615 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
617 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
);
618 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
619 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
621 NSContainer
*NSContainer_Create(HTMLDocumentObj
*,NSContainer
*);
622 void NSContainer_Release(NSContainer
*);
624 void init_mutation(HTMLDocumentNode
*);
625 void release_mutation(HTMLDocumentNode
*);
627 void HTMLDocument_LockContainer(HTMLDocumentObj
*,BOOL
);
628 void show_context_menu(HTMLDocumentObj
*,DWORD
,POINT
*,IDispatch
*);
629 void notif_focus(HTMLDocumentObj
*);
631 void show_tooltip(HTMLDocumentObj
*,DWORD
,DWORD
,LPCWSTR
);
632 void hide_tooltip(HTMLDocumentObj
*);
633 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
635 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
637 BOOL
load_gecko(BOOL
);
638 void close_gecko(void);
639 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
640 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
641 void release_nsio(void);
642 BOOL
install_wine_gecko(BOOL
);
644 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
646 HRESULT
hlink_frame_navigate(HTMLDocument
*,LPCWSTR
,nsIInputStream
*,DWORD
);
647 HRESULT
navigate_url(HTMLDocumentNode
*,OLECHAR
*);
649 void call_property_onchanged(ConnectionPoint
*,DISPID
);
650 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
652 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
655 void nsACString_Init(nsACString
*,const char*);
656 void nsACString_SetData(nsACString
*,const char*);
657 PRUint32
nsACString_GetData(const nsACString
*,const char**);
658 void nsACString_Finish(nsACString
*);
660 void nsAString_Init(nsAString
*,const PRUnichar
*);
661 void nsAString_SetData(nsAString
*,const PRUnichar
*);
662 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
663 void nsAString_Finish(nsAString
*);
665 nsICommandParams
*create_nscommand_params(void);
666 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
667 void get_editor_controller(NSContainer
*);
668 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
670 void init_nsevents(HTMLDocumentNode
*);
671 void release_nsevents(HTMLDocumentNode
*);
672 void add_nsevent_listener(HTMLDocumentNode
*,LPCWSTR
);
674 void set_window_bscallback(HTMLWindow
*,nsChannelBSC
*);
675 void set_current_mon(HTMLWindow
*,IMoniker
*);
676 HRESULT
start_binding(HTMLWindow
*,HTMLDocumentNode
*,BSCallback
*,IBindCtx
*);
677 void abort_document_bindings(HTMLDocumentNode
*);
679 HRESULT
bind_mon_to_buffer(HTMLDocumentNode
*,IMoniker
*,void**,DWORD
*);
681 nsChannelBSC
*create_channelbsc(IMoniker
*);
682 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
683 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
684 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
686 void set_ready_state(HTMLWindow
*,READYSTATE
);
688 HRESULT
HTMLSelectionObject_Create(HTMLDocumentNode
*,nsISelection
*,IHTMLSelectionObject
**);
689 HRESULT
HTMLTxtRange_Create(HTMLDocumentNode
*,nsIDOMRange
*,IHTMLTxtRange
**);
690 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
691 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
692 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
694 void detach_selection(HTMLDocumentNode
*);
695 void detach_ranges(HTMLDocumentNode
*);
696 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
698 HRESULT
create_nselem(HTMLDocumentNode
*,const WCHAR
*,nsIDOMHTMLElement
**);
700 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocumentNode
*,nsIDOMNode
*);
702 HTMLElement
*HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
703 HTMLElement
*HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*);
704 HTMLElement
*HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
705 HTMLElement
*HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
706 HTMLElement
*HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLWindow
*);
707 HTMLElement
*HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLWindow
*);
708 HTMLElement
*HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
709 HTMLElement
*HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
710 HTMLElement
*HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
711 HTMLElement
*HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
712 HTMLElement
*HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
713 HTMLElement
*HTMLTable_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
714 HTMLElement
*HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
715 HTMLElement
*HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
716 HTMLElement
*HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
718 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*);
719 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
720 void HTMLElement2_Init(HTMLElement
*);
721 void HTMLElement3_Init(HTMLElement
*);
722 void HTMLTextContainer_Init(HTMLTextContainer
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
723 void HTMLFrameBase_Init(HTMLFrameBase
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLWindow
*,dispex_static_data_t
*);
725 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
726 void HTMLDOMNode_destructor(HTMLDOMNode
*);
728 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
729 void HTMLElement_destructor(HTMLDOMNode
*);
731 HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*,REFIID
,void**);
732 void HTMLFrameBase_destructor(HTMLFrameBase
*);
734 HTMLDOMNode
*get_node(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
735 void release_nodes(HTMLDocumentNode
*);
737 void release_script_hosts(HTMLWindow
*);
738 void connect_scripts(HTMLWindow
*);
739 void doc_insert_script(HTMLWindow
*,nsIDOMHTMLScriptElement
*);
740 IDispatch
*script_parse_event(HTMLWindow
*,LPCWSTR
);
741 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
742 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
743 IDispatch
*get_script_disp(ScriptHost
*);
745 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
746 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocumentNode
*,IUnknown
*,nsIDOMNodeList
*);
747 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocumentNode
*,IUnknown
*,nsIDOMHTMLCollection
*);
752 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
753 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
756 extern const cmdtable_t editmode_cmds
[];
758 void do_ns_command(HTMLDocument
*,const char*,nsICommandParams
*);
761 #define UPDATE_UI 0x0001
762 #define UPDATE_TITLE 0x0002
764 void update_doc(HTMLDocument
*,DWORD
);
765 void update_title(HTMLDocumentObj
*);
768 void init_editor(HTMLDocument
*);
769 void set_ns_editmode(NSContainer
*);
770 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
771 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
772 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
773 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
774 void handle_edit_load(HTMLDocument
*);
775 HRESULT
editor_is_dirty(HTMLDocument
*);
776 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
778 extern DWORD mshtml_tls
;
780 typedef struct task_t task_t
;
781 typedef void (*task_proc_t
)(task_t
*);
791 HTMLDocumentObj
*doc
;
796 task_t
*task_queue_head
;
797 task_t
*task_queue_tail
;
798 struct list timer_list
;
801 thread_data_t
*get_thread_data(BOOL
);
802 HWND
get_thread_hwnd(void);
804 LONG
get_task_target_magic(void);
805 void push_task(task_t
*,task_proc_t
,LONG
);
806 void remove_target_tasks(LONG
);
808 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
809 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
811 void release_typelib(void);
812 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*);
814 const char *debugstr_variant(const VARIANT
*);
816 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
817 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
818 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
819 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
820 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
822 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
824 /* memory allocation functions */
826 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
828 return HeapAlloc(GetProcessHeap(), 0, len
);
831 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
833 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
836 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
838 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
841 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
843 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
846 static inline BOOL
heap_free(void *mem
)
848 return HeapFree(GetProcessHeap(), 0, mem
);
851 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
858 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
859 ret
= heap_alloc(size
);
860 memcpy(ret
, str
, size
);
866 static inline char *heap_strdupA(const char *str
)
873 size
= strlen(str
)+1;
874 ret
= heap_alloc(size
);
875 memcpy(ret
, str
, size
);
881 static inline WCHAR
*heap_strdupAtoW(const char *str
)
888 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
889 ret
= heap_alloc(len
*sizeof(WCHAR
));
890 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
896 static inline char *heap_strdupWtoA(LPCWSTR str
)
901 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
902 ret
= heap_alloc(size
);
903 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
909 static inline void windowref_addref(windowref_t
*ref
)
911 InterlockedIncrement(&ref
->ref
);
914 static inline void windowref_release(windowref_t
*ref
)
916 if(!InterlockedDecrement(&ref
->ref
))
920 HINSTANCE
get_shdoclc(void);
922 extern HINSTANCE hInst
;