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_ERROR_GENERATE_FAILURE(module,code) \
38 ((nsresult) (((PRUint32)(1<<31)) | ((PRUint32)(module+0x45)<<16) | ((PRUint32)(code))))
40 #define NS_OK ((nsresult)0x00000000L)
41 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
42 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
43 #define NS_NOINTERFACE ((nsresult)0x80004002L)
44 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
45 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
46 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
47 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
49 #define NS_ERROR_MODULE_NETWORK 6
51 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
52 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
54 #define NS_FAILED(res) ((res) & 0x80000000)
55 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
59 #define MSHTML_E_NODOC 0x800a025c
61 typedef struct HTMLDOMNode HTMLDOMNode
;
62 typedef struct ConnectionPoint ConnectionPoint
;
63 typedef struct BSCallback BSCallback
;
64 typedef struct event_target_t event_target_t
;
68 XDIID(DispCEventObj) \
70 XDIID(DispDOMChildrenCollection) \
71 XDIID(DispHTMLAnchorElement) \
73 XDIID(DispHTMLCommentElement) \
74 XDIID(DispHTMLCurrentStyle) \
75 XDIID(DispHTMLDocument) \
76 XDIID(DispHTMLDOMTextNode) \
77 XDIID(DispHTMLElementCollection) \
78 XDIID(DispHTMLEmbed) \
79 XDIID(DispHTMLFormElement) \
80 XDIID(DispHTMLGenericElement) \
81 XDIID(DispHTMLFrameElement) \
82 XDIID(DispHTMLIFrame) \
84 XDIID(DispHTMLInputElement) \
85 XDIID(DispHTMLLocation) \
86 XDIID(DispHTMLNavigator) \
87 XDIID(DispHTMLObjectElement) \
88 XDIID(DispHTMLOptionElement) \
89 XDIID(DispHTMLScreen) \
90 XDIID(DispHTMLScriptElement) \
91 XDIID(DispHTMLSelectElement) \
92 XDIID(DispHTMLStyle) \
93 XDIID(DispHTMLStyleElement) \
94 XDIID(DispHTMLStyleSheetsCollection) \
95 XDIID(DispHTMLTable) \
96 XDIID(DispHTMLTableRow) \
97 XDIID(DispHTMLTextAreaElement) \
98 XDIID(DispHTMLUnknownElement) \
99 XDIID(DispHTMLWindow2) \
100 XDIID(HTMLDocumentEvents) \
101 XIID(IHTMLAnchorElement) \
102 XIID(IHTMLBodyElement) \
103 XIID(IHTMLBodyElement2) \
104 XIID(IHTMLCommentElement) \
105 XIID(IHTMLCurrentStyle) \
106 XIID(IHTMLCurrentStyle2) \
107 XIID(IHTMLCurrentStyle3) \
108 XIID(IHTMLCurrentStyle4) \
109 XIID(IHTMLDocument2) \
110 XIID(IHTMLDocument3) \
111 XIID(IHTMLDocument4) \
112 XIID(IHTMLDocument5) \
113 XIID(IHTMLDOMChildrenCollection) \
115 XIID(IHTMLDOMNode2) \
116 XIID(IHTMLDOMTextNode) \
118 XIID(IHTMLElement2) \
119 XIID(IHTMLElement3) \
120 XIID(IHTMLElement4) \
121 XIID(IHTMLElementCollection) \
122 XIID(IHTMLEmbedElement) \
123 XIID(IHTMLEventObj) \
124 XIID(IHTMLFiltersCollection) \
125 XIID(IHTMLFormElement) \
126 XIID(IHTMLFrameBase) \
127 XIID(IHTMLFrameBase2) \
128 XIID(IHTMLFrameElement3) \
129 XIID(IHTMLGenericElement) \
130 XIID(IHTMLIFrameElement) \
131 XIID(IHTMLImageElementFactory) \
132 XIID(IHTMLImgElement) \
133 XIID(IHTMLInputElement) \
134 XIID(IHTMLLocation) \
135 XIID(IHTMLObjectElement) \
136 XIID(IHTMLOptionElement) \
137 XIID(IHTMLPluginsCollection) \
140 XIID(IHTMLScriptElement) \
141 XIID(IHTMLSelectElement) \
146 XIID(IHTMLStyleElement) \
147 XIID(IHTMLStyleSheetsCollection) \
149 XIID(IHTMLTableRow) \
150 XIID(IHTMLTextAreaElement) \
151 XIID(IHTMLTextContainer) \
152 XIID(IHTMLUniqueName) \
159 #define XIID(iface) iface ## _tid,
160 #define XDIID(iface) iface ## _tid,
167 typedef struct dispex_data_t dispex_data_t
;
168 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
170 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
171 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
172 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
175 HRESULT (*value
)(IUnknown
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
176 HRESULT (*get_dispid
)(IUnknown
*,BSTR
,DWORD
,DISPID
*);
177 HRESULT (*invoke
)(IUnknown
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
178 } dispex_static_data_vtbl_t
;
181 const dispex_static_data_vtbl_t
*vtbl
;
182 const tid_t disp_tid
;
184 const tid_t
* const iface_tids
;
185 } dispex_static_data_t
;
188 const IDispatchExVtbl
*lpIDispatchExVtbl
;
192 dispex_static_data_t
*data
;
193 dispex_dynamic_data_t
*dynamic_data
;
196 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
197 void release_dispex(DispatchEx
*);
198 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
199 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
200 HRESULT
get_dispids(tid_t
,DWORD
*,DISPID
**);
201 HRESULT
remove_prop(DispatchEx
*,BSTR
,VARIANT_BOOL
*);
203 typedef struct HTMLWindow HTMLWindow
;
204 typedef struct HTMLDocumentNode HTMLDocumentNode
;
205 typedef struct HTMLDocumentObj HTMLDocumentObj
;
206 typedef struct HTMLFrameBase HTMLFrameBase
;
207 typedef struct NSContainer NSContainer
;
211 SCRIPTMODE_ACTIVESCRIPT
214 typedef struct ScriptHost ScriptHost
;
219 } global_prop_type_t
;
222 global_prop_type_t type
;
224 ScriptHost
*script_host
;
229 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
234 } HTMLOptionElementFactory
;
238 const IHTMLImageElementFactoryVtbl
*lpHTMLImageElementFactoryVtbl
;
243 } HTMLImageElementFactory
;
245 struct HTMLLocation
{
247 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
259 typedef struct nsChannelBSC nsChannelBSC
;
263 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
264 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
265 const IHTMLWindow4Vtbl
*lpHTMLWindow4Vtbl
;
266 const IHTMLPrivateWindowVtbl
*lpIHTMLPrivateWindowVtbl
;
267 const IDispatchExVtbl
*lpIDispatchExVtbl
;
268 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
272 windowref_t
*window_ref
;
275 HTMLDocumentNode
*doc
;
276 HTMLDocumentObj
*doc_obj
;
277 nsIDOMWindow
*nswindow
;
279 HTMLFrameBase
*frame_element
;
280 READYSTATE readystate
;
282 nsChannelBSC
*bscallback
;
286 IHTMLEventObj
*event
;
288 SCRIPTMODE scriptmode
;
289 struct list script_hosts
;
291 HTMLOptionElementFactory
*option_factory
;
292 HTMLImageElementFactory
*image_factory
;
293 HTMLLocation
*location
;
296 global_prop_t
*global_props
;
297 DWORD global_prop_cnt
;
298 DWORD global_prop_size
;
300 struct list children
;
301 struct list sibling_entry
;
311 typedef struct _cp_static_data_t
{
313 void (*on_advise
)(IUnknown
*,struct _cp_static_data_t
*);
318 typedef struct ConnectionPointContainer
{
319 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
321 ConnectionPoint
*cp_list
;
323 struct ConnectionPointContainer
*forward_container
;
324 } ConnectionPointContainer
;
326 struct ConnectionPoint
{
327 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
329 ConnectionPointContainer
*container
;
334 IPropertyNotifySink
*propnotif
;
339 cp_static_data_t
*data
;
341 ConnectionPoint
*next
;
344 struct HTMLDocument
{
345 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
346 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
347 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
348 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
349 const IHTMLDocument6Vtbl
*lpHTMLDocument6Vtbl
;
350 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
351 const IPersistFileVtbl
*lpPersistFileVtbl
;
352 const IPersistHistoryVtbl
*lpPersistHistoryVtbl
;
353 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
354 const IOleObjectVtbl
*lpOleObjectVtbl
;
355 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
356 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
357 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
358 const IViewObjectExVtbl
*lpViewObjectExVtbl
;
359 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
360 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
361 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
362 const IOleControlVtbl
*lpOleControlVtbl
;
363 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
364 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
365 const IDispatchExVtbl
*lpIDispatchExVtbl
;
366 const ISupportErrorInfoVtbl
*lpSupportErrorInfoVtbl
;
367 const IObjectWithSiteVtbl
*lpObjectWithSiteVtbl
;
372 HTMLDocumentObj
*doc_obj
;
373 HTMLDocumentNode
*doc_node
;
379 ConnectionPointContainer cp_container
;
380 ConnectionPoint cp_htmldocevents
;
381 ConnectionPoint cp_htmldocevents2
;
382 ConnectionPoint cp_propnotif
;
383 ConnectionPoint cp_dispatch
;
385 IOleAdviseHolder
*advise_holder
;
388 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
390 return IUnknown_QueryInterface(This
->unk_impl
, riid
, ppv
);
393 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
395 return IUnknown_AddRef(This
->unk_impl
);
398 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
400 return IUnknown_Release(This
->unk_impl
);
403 struct HTMLDocumentObj
{
404 HTMLDocument basedoc
;
406 const ICustomDocVtbl
*lpCustomDocVtbl
;
410 NSContainer
*nscontainer
;
412 IOleClientSite
*client
;
413 IDocHostUIHandler
*hostui
;
414 IOleInPlaceSite
*ipsite
;
415 IOleInPlaceFrame
*frame
;
416 IOleInPlaceUIWindow
*ip_window
;
417 IAdviseSink
*view_sink
;
419 DOCHOSTUIINFO hostinfo
;
421 IOleUndoManager
*undomgr
;
426 BOOL request_uiactivate
;
427 BOOL in_place_active
;
431 BOOL container_locked
;
442 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
443 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
444 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
445 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
446 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
447 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
448 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
449 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
451 nsIWebBrowser
*webbrowser
;
452 nsIWebNavigation
*navigation
;
453 nsIBaseWindow
*window
;
454 nsIWebBrowserFocus
*focus
;
457 nsIController
*editor_controller
;
462 HTMLDocumentObj
*doc
;
464 nsIURIContentListener
*content_listener
;
469 typedef struct nsWineURI nsWineURI
;
471 HRESULT
set_wine_url(nsWineURI
*,LPCWSTR
);
472 nsresult
on_start_uri_open(NSContainer
*,nsIURI
*,PRBool
*);
474 /* Keep sync with request_method_strings in nsio.c */
482 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
483 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
484 const nsIHttpChannelInternalVtbl
*lpIHttpChannelInternalVtbl
;
489 nsIInputStream
*post_data_stream
;
490 nsILoadGroup
*load_group
;
491 nsIInterfaceRequestor
*notif_callback
;
493 nsLoadFlags load_flags
;
494 nsIURI
*original_uri
;
498 PRUint32 response_status
;
499 REQUEST_METHOD request_method
;
500 struct list response_headers
;
501 struct list request_headers
;
511 HRESULT
set_http_header(struct list
*,const WCHAR
*,int,const WCHAR
*,int);
514 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
515 void (*destructor
)(HTMLDOMNode
*);
516 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
517 HRESULT (*call_event
)(HTMLDOMNode
*,DWORD
,BOOL
*);
518 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
519 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
520 HRESULT (*get_document
)(HTMLDOMNode
*,IDispatch
**);
521 HRESULT (*get_readystate
)(HTMLDOMNode
*,BSTR
*);
522 HRESULT (*get_dispid
)(HTMLDOMNode
*,BSTR
,DWORD
,DISPID
*);
523 HRESULT (*invoke
)(HTMLDOMNode
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
524 HRESULT (*bind_to_tree
)(HTMLDOMNode
*);
529 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
530 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
531 const NodeImplVtbl
*vtbl
;
536 HTMLDocumentNode
*doc
;
537 event_target_t
*event_target
;
538 ConnectionPointContainer
*cp_container
;
545 ConnectionPointContainer cp_container
;
547 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
548 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
549 const IHTMLElement3Vtbl
*lpHTMLElement3Vtbl
;
551 nsIDOMHTMLElement
*nselem
;
554 #define HTMLELEMENT_TIDS \
565 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
570 struct HTMLFrameBase
{
573 const IHTMLFrameBaseVtbl
*lpIHTMLFrameBaseVtbl
;
574 const IHTMLFrameBase2Vtbl
*lpIHTMLFrameBase2Vtbl
;
576 HTMLWindow
*content_window
;
578 nsIDOMHTMLFrameElement
*nsframe
;
579 nsIDOMHTMLIFrameElement
*nsiframe
;
582 typedef struct _mutation_queue_t
{
584 nsISupports
*nsiface
;
586 struct _mutation_queue_t
*next
;
589 typedef struct nsDocumentEventListener nsDocumentEventListener
;
591 struct HTMLDocumentNode
{
593 HTMLDocument basedoc
;
595 const IInternetHostSecurityManagerVtbl
*lpIInternetHostSecurityManagerVtbl
;
597 const nsIDocumentObserverVtbl
*lpIDocumentObserverVtbl
;
598 const nsIRunnableVtbl
*lpIRunnableVtbl
;
602 nsIDOMHTMLDocument
*nsdoc
;
605 event_target_t
*body_event_target
;
607 IInternetSecurityManager
*secmgr
;
608 ICatInformation
*catmgr
;
609 nsDocumentEventListener
*nsevent_listener
;
612 BOOL skip_mutation_notif
;
613 mutation_queue_t
*mutation_queue
;
614 mutation_queue_t
*mutation_queue_tail
;
616 struct list bindings
;
617 struct list selection_list
;
618 struct list range_list
;
621 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
622 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
623 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
625 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
626 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
627 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
628 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
629 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
630 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
631 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
632 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
633 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
634 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
635 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
636 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
637 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
638 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
639 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
640 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
641 #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)
642 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
643 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
644 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
645 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
646 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
647 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
648 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
649 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
650 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
651 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
652 #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)
654 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
655 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
656 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
657 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
658 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
659 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
660 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
661 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
662 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
664 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
666 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
668 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
669 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
670 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
671 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
673 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
674 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
675 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
677 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
678 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
679 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
680 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
681 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
683 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
684 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
685 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
687 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
688 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
689 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
691 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
693 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
695 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
697 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
698 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
700 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
701 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
702 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocumentObj
*,HTMLWindow
*,HTMLDocumentNode
**);
704 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*,nsIDOMWindow
*,HTMLWindow
*,HTMLWindow
**);
705 void update_window_doc(HTMLWindow
*);
706 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
707 nsIDOMWindow
*get_nsdoc_window(nsIDOMDocument
*);
708 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
709 HTMLImageElementFactory
*HTMLImageElementFactory_Create(HTMLWindow
*);
710 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
711 IOmNavigator
*OmNavigator_Create(void);
712 HRESULT
HTMLScreen_Create(IHTMLScreen
**);
714 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
715 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
716 void HTMLDocument_Persist_Init(HTMLDocument
*);
717 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
718 void HTMLDocument_OleObj_Init(HTMLDocument
*);
719 void HTMLDocument_View_Init(HTMLDocument
*);
720 void HTMLDocument_Window_Init(HTMLDocument
*);
721 void HTMLDocument_Service_Init(HTMLDocument
*);
722 void HTMLDocument_Hlink_Init(HTMLDocument
*);
724 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
726 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
728 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
,cp_static_data_t
*);
729 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
730 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
732 NSContainer
*NSContainer_Create(HTMLDocumentObj
*,NSContainer
*);
733 void NSContainer_Release(NSContainer
*);
735 void init_mutation(HTMLDocumentNode
*);
736 void release_mutation(HTMLDocumentNode
*);
738 void HTMLDocument_LockContainer(HTMLDocumentObj
*,BOOL
);
739 void show_context_menu(HTMLDocumentObj
*,DWORD
,POINT
*,IDispatch
*);
740 void notif_focus(HTMLDocumentObj
*);
742 void show_tooltip(HTMLDocumentObj
*,DWORD
,DWORD
,LPCWSTR
);
743 void hide_tooltip(HTMLDocumentObj
*);
744 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
746 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
748 BOOL
load_gecko(BOOL
);
749 void close_gecko(void);
750 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
751 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
752 void release_nsio(void);
753 BOOL
install_wine_gecko(BOOL
);
754 BOOL
is_gecko_path(const char*);
756 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
757 HRESULT
create_doc_uri(HTMLWindow
*,WCHAR
*,nsWineURI
**);
758 HRESULT
load_nsuri(HTMLWindow
*,nsWineURI
*,nsChannelBSC
*,DWORD
);
760 HRESULT
hlink_frame_navigate(HTMLDocument
*,LPCWSTR
,nsIInputStream
*,DWORD
,BOOL
*);
761 HRESULT
navigate_url(HTMLWindow
*,const WCHAR
*,const WCHAR
*);
762 HRESULT
set_frame_doc(HTMLFrameBase
*,nsIDOMDocument
*);
763 HRESULT
set_moniker(HTMLDocument
*,IMoniker
*,IBindCtx
*,nsChannelBSC
*,BOOL
);
765 void call_property_onchanged(ConnectionPoint
*,DISPID
);
766 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
768 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
771 void nsACString_InitDepend(nsACString
*,const char*);
772 void nsACString_SetData(nsACString
*,const char*);
773 PRUint32
nsACString_GetData(const nsACString
*,const char**);
774 void nsACString_Finish(nsACString
*);
776 BOOL
nsAString_Init(nsAString
*,const PRUnichar
*);
777 void nsAString_InitDepend(nsAString
*,const PRUnichar
*);
778 void nsAString_SetData(nsAString
*,const PRUnichar
*);
779 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
780 void nsAString_Finish(nsAString
*);
782 nsICommandParams
*create_nscommand_params(void);
783 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
784 void get_editor_controller(NSContainer
*);
785 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
787 void init_nsevents(HTMLDocumentNode
*);
788 void release_nsevents(HTMLDocumentNode
*);
789 void add_nsevent_listener(HTMLDocumentNode
*,nsIDOMNode
*,LPCWSTR
);
791 void set_window_bscallback(HTMLWindow
*,nsChannelBSC
*);
792 void set_current_mon(HTMLWindow
*,IMoniker
*);
793 HRESULT
start_binding(HTMLWindow
*,HTMLDocumentNode
*,BSCallback
*,IBindCtx
*);
794 HRESULT
async_start_doc_binding(HTMLWindow
*,nsChannelBSC
*);
795 void abort_document_bindings(HTMLDocumentNode
*);
797 HRESULT
bind_mon_to_buffer(HTMLDocumentNode
*,IMoniker
*,void**,DWORD
*);
799 HRESULT
create_channelbsc(IMoniker
*,WCHAR
*,BYTE
*,DWORD
,nsChannelBSC
**);
800 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
801 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
802 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
804 void set_ready_state(HTMLWindow
*,READYSTATE
);
806 HRESULT
HTMLSelectionObject_Create(HTMLDocumentNode
*,nsISelection
*,IHTMLSelectionObject
**);
807 HRESULT
HTMLTxtRange_Create(HTMLDocumentNode
*,nsIDOMRange
*,IHTMLTxtRange
**);
808 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
809 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
810 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
812 void detach_selection(HTMLDocumentNode
*);
813 void detach_ranges(HTMLDocumentNode
*);
814 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
816 HRESULT
create_nselem(HTMLDocumentNode
*,const WCHAR
*,nsIDOMHTMLElement
**);
818 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocumentNode
*,nsIDOMNode
*);
820 HTMLElement
*HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
821 HTMLElement
*HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*);
822 HTMLElement
*HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
823 HTMLElement
*HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
824 HTMLElement
*HTMLEmbedElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
825 HTMLElement
*HTMLFormElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
826 HTMLElement
*HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
827 HTMLElement
*HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
828 HTMLElement
*HTMLStyleElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
829 HTMLElement
*HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
830 HTMLElement
*HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
831 HTMLElement
*HTMLObjectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
832 HTMLElement
*HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
833 HTMLElement
*HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
834 HTMLElement
*HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
835 HTMLElement
*HTMLTable_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
836 HTMLElement
*HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
837 HTMLElement
*HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
838 HTMLElement
*HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*);
840 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*);
841 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
842 void HTMLElement2_Init(HTMLElement
*);
843 void HTMLElement3_Init(HTMLElement
*);
844 void HTMLTextContainer_Init(HTMLTextContainer
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
845 void HTMLFrameBase_Init(HTMLFrameBase
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
847 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
848 void HTMLDOMNode_destructor(HTMLDOMNode
*);
850 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
851 void HTMLElement_destructor(HTMLDOMNode
*);
853 HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*,REFIID
,void**);
854 void HTMLFrameBase_destructor(HTMLFrameBase
*);
856 HTMLDOMNode
*get_node(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
);
857 void release_nodes(HTMLDocumentNode
*);
859 void release_script_hosts(HTMLWindow
*);
860 void connect_scripts(HTMLWindow
*);
861 void doc_insert_script(HTMLWindow
*,nsIDOMHTMLScriptElement
*);
862 IDispatch
*script_parse_event(HTMLWindow
*,LPCWSTR
);
863 HRESULT
exec_script(HTMLWindow
*,const WCHAR
*,const WCHAR
*,VARIANT
*);
864 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
865 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
866 IDispatch
*get_script_disp(ScriptHost
*);
867 HRESULT
search_window_props(HTMLWindow
*,BSTR
,DWORD
,DISPID
*);
869 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
870 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocumentNode
*,IUnknown
*,nsIDOMNodeList
*);
871 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocumentNode
*,IUnknown
*,nsIDOMHTMLCollection
*);
876 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
877 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
880 extern const cmdtable_t editmode_cmds
[];
882 void do_ns_command(HTMLDocument
*,const char*,nsICommandParams
*);
885 #define UPDATE_UI 0x0001
886 #define UPDATE_TITLE 0x0002
888 void update_doc(HTMLDocument
*,DWORD
);
889 void update_title(HTMLDocumentObj
*);
892 void init_editor(HTMLDocument
*);
893 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
894 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
895 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
896 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
897 void handle_edit_load(HTMLDocument
*);
898 HRESULT
editor_is_dirty(HTMLDocument
*);
899 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
901 extern DWORD mshtml_tls
;
903 typedef struct task_t task_t
;
904 typedef void (*task_proc_t
)(task_t
*);
914 HTMLDocumentObj
*doc
;
919 task_t
*task_queue_head
;
920 task_t
*task_queue_tail
;
921 struct list timer_list
;
924 thread_data_t
*get_thread_data(BOOL
);
925 HWND
get_thread_hwnd(void);
927 LONG
get_task_target_magic(void);
928 void push_task(task_t
*,task_proc_t
,LONG
);
929 void remove_target_tasks(LONG
);
931 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
932 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
934 void release_typelib(void);
935 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*);
937 const char *debugstr_variant(const VARIANT
*);
939 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
940 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
941 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
942 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
943 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
945 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
947 /* memory allocation functions */
949 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
951 return HeapAlloc(GetProcessHeap(), 0, len
);
954 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
956 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
959 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
961 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
964 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
966 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
969 static inline BOOL
heap_free(void *mem
)
971 return HeapFree(GetProcessHeap(), 0, mem
);
974 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
981 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
982 ret
= heap_alloc(size
);
983 memcpy(ret
, str
, size
);
989 static inline LPWSTR
heap_strndupW(LPCWSTR str
, unsigned len
)
994 ret
= heap_alloc((len
+1)*sizeof(WCHAR
));
995 memcpy(ret
, str
, len
*sizeof(WCHAR
));
1002 static inline char *heap_strdupA(const char *str
)
1009 size
= strlen(str
)+1;
1010 ret
= heap_alloc(size
);
1011 memcpy(ret
, str
, size
);
1017 static inline WCHAR
*heap_strdupAtoW(const char *str
)
1024 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
1025 ret
= heap_alloc(len
*sizeof(WCHAR
));
1026 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
1032 static inline char *heap_strdupWtoA(LPCWSTR str
)
1037 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
1038 ret
= heap_alloc(size
);
1039 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
1045 static inline void windowref_addref(windowref_t
*ref
)
1047 InterlockedIncrement(&ref
->ref
);
1050 static inline void windowref_release(windowref_t
*ref
)
1052 if(!InterlockedDecrement(&ref
->ref
))
1056 HDC
get_display_dc(void);
1057 HINSTANCE
get_shdoclc(void);
1058 void set_statustext(HTMLDocumentObj
*,INT
,LPCWSTR
);
1060 extern HINSTANCE hInst
;