mshtml: Added IInternetHostSecurity::ProcessUrlAction implementation.
[wine/wine-gecko.git] / dlls / mshtml / mshtml_private.h
blob82e1c60a64d01f38975f7b939728f559dd648c49
1 /*
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
19 #include "wingdi.h"
20 #include "docobj.h"
21 #include "mshtml.h"
22 #include "mshtmhst.h"
23 #include "hlink.h"
24 #include "perhist.h"
25 #include "dispex.h"
27 #include "wine/list.h"
28 #include "wine/unicode.h"
30 #ifdef INIT_GUID
31 #include "initguid.h"
32 #endif
34 #include "nsiface.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))
47 #define NSAPI WINAPI
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 */
58 typedef enum {
59 NULL_tid,
60 DispCEventObj_tid,
61 DispDOMChildrenCollection_tid,
62 DispHTMLBody_tid,
63 DispHTMLCommentElement_tid,
64 DispHTMLCurrentStyle_tid,
65 DispHTMLDocument_tid,
66 DispHTMLDOMTextNode_tid,
67 DispHTMLElementCollection_tid,
68 DispHTMLGenericElement_tid,
69 DispHTMLIFrame_tid,
70 DispHTMLImg_tid,
71 DispHTMLInputElement_tid,
72 DispHTMLLocation_tid,
73 DispHTMLNavigator_tid,
74 DispHTMLOptionElement_tid,
75 DispHTMLSelectElement_tid,
76 DispHTMLStyle_tid,
77 DispHTMLTable_tid,
78 DispHTMLTableRow_tid,
79 DispHTMLUnknownElement_tid,
80 DispHTMLWindow2_tid,
81 IHTMLBodyElement_tid,
82 IHTMLBodyElement2_tid,
83 IHTMLCommentElement_tid,
84 IHTMLCurrentStyle_tid,
85 IHTMLCurrentStyle2_tid,
86 IHTMLCurrentStyle3_tid,
87 IHTMLCurrentStyle4_tid,
88 IHTMLDocument2_tid,
89 IHTMLDocument3_tid,
90 IHTMLDocument4_tid,
91 IHTMLDocument5_tid,
92 IHTMLDOMChildrenCollection_tid,
93 IHTMLDOMNode_tid,
94 IHTMLDOMNode2_tid,
95 IHTMLDOMTextNode_tid,
96 IHTMLElement_tid,
97 IHTMLElement2_tid,
98 IHTMLElement3_tid,
99 IHTMLElement4_tid,
100 IHTMLElementCollection_tid,
101 IHTMLEventObj_tid,
102 IHTMLFrameBase2_tid,
103 IHTMLGenericElement_tid,
104 IHTMLImgElement_tid,
105 IHTMLInputElement_tid,
106 IHTMLLocation_tid,
107 IHTMLOptionElement_tid,
108 IHTMLSelectElement_tid,
109 IHTMLStyle_tid,
110 IHTMLStyle2_tid,
111 IHTMLStyle3_tid,
112 IHTMLStyle4_tid,
113 IHTMLTable_tid,
114 IHTMLTableRow_tid,
115 IHTMLTextContainer_tid,
116 IHTMLUniqueName_tid,
117 IHTMLWindow2_tid,
118 IHTMLWindow3_tid,
119 IOmNavigator_tid,
120 LAST_tid
121 } tid_t;
123 typedef struct dispex_data_t dispex_data_t;
124 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
126 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
127 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
129 typedef struct {
130 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
131 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
132 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
133 } dispex_static_data_vtbl_t;
135 typedef struct {
136 const dispex_static_data_vtbl_t *vtbl;
137 const tid_t disp_tid;
138 dispex_data_t *data;
139 const tid_t* const iface_tids;
140 } dispex_static_data_t;
142 typedef struct {
143 const IDispatchExVtbl *lpIDispatchExVtbl;
145 IUnknown *outer;
147 dispex_static_data_t *data;
148 dispex_dynamic_data_t *dynamic_data;
149 } DispatchEx;
151 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
152 void release_dispex(DispatchEx*);
153 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
154 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
156 typedef struct HTMLWindow HTMLWindow;
157 typedef struct HTMLDocumentNode HTMLDocumentNode;
158 typedef struct HTMLDocumentObj HTMLDocumentObj;
160 typedef enum {
161 SCRIPTMODE_GECKO,
162 SCRIPTMODE_ACTIVESCRIPT
163 } SCRIPTMODE;
165 typedef struct ScriptHost ScriptHost;
167 typedef struct {
168 WCHAR *name;
169 ScriptHost *script_host;
170 DISPID id;
171 } global_prop_t;
173 typedef struct {
174 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
176 LONG ref;
178 HTMLWindow *window;
179 } HTMLOptionElementFactory;
181 struct HTMLLocation {
182 DispatchEx dispex;
183 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
185 LONG ref;
187 HTMLWindow *window;
190 struct HTMLWindow {
191 DispatchEx dispex;
192 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
193 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
194 const IDispatchExVtbl *lpIDispatchExVtbl;
196 LONG ref;
198 HTMLDocumentNode *doc;
199 HTMLDocumentObj *doc_obj;
200 nsIDOMWindow *nswindow;
202 event_target_t *event_target;
203 IHTMLEventObj *event;
204 BOOL *event_vector;
206 SCRIPTMODE scriptmode;
207 struct list script_hosts;
209 HTMLOptionElementFactory *option_factory;
210 HTMLLocation *location;
212 global_prop_t *global_props;
213 DWORD global_prop_cnt;
214 DWORD global_prop_size;
216 struct list entry;
219 typedef enum {
220 UNKNOWN_USERMODE,
221 BROWSEMODE,
222 EDITMODE
223 } USERMODE;
225 typedef struct {
226 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
228 ConnectionPoint *cp_list;
229 IUnknown *outer;
230 } ConnectionPointContainer;
232 struct ConnectionPoint {
233 const IConnectionPointVtbl *lpConnectionPointVtbl;
235 IConnectionPointContainer *container;
237 union {
238 IUnknown *unk;
239 IDispatch *disp;
240 IPropertyNotifySink *propnotif;
241 } *sinks;
242 DWORD sinks_size;
244 const IID *iid;
246 ConnectionPoint *next;
249 struct HTMLDocument {
250 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
251 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
252 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
253 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
254 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
255 const IPersistFileVtbl *lpPersistFileVtbl;
256 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
257 const IMonikerPropVtbl *lpMonikerPropVtbl;
258 const IOleObjectVtbl *lpOleObjectVtbl;
259 const IOleDocumentVtbl *lpOleDocumentVtbl;
260 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
261 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
262 const IViewObject2Vtbl *lpViewObject2Vtbl;
263 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
264 const IServiceProviderVtbl *lpServiceProviderVtbl;
265 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
266 const IOleControlVtbl *lpOleControlVtbl;
267 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
268 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
269 const IDispatchExVtbl *lpIDispatchExVtbl;
270 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
272 IUnknown *unk_impl;
273 IDispatchEx *dispex;
275 HTMLDocumentObj *doc_obj;
276 HTMLDocumentNode *doc_node;
278 HTMLWindow *window;
279 nsIDOMHTMLDocument *nsdoc;
281 ConnectionPointContainer cp_container;
282 ConnectionPoint cp_htmldocevents;
283 ConnectionPoint cp_htmldocevents2;
284 ConnectionPoint cp_propnotif;
287 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
289 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
292 static inline ULONG htmldoc_addref(HTMLDocument *This)
294 return IUnknown_AddRef(This->unk_impl);
297 static inline ULONG htmldoc_release(HTMLDocument *This)
299 return IUnknown_Release(This->unk_impl);
302 struct HTMLDocumentObj {
303 HTMLDocument basedoc;
304 DispatchEx dispex;
305 const ICustomDocVtbl *lpCustomDocVtbl;
307 LONG ref;
309 NSContainer *nscontainer;
311 IOleClientSite *client;
312 IDocHostUIHandler *hostui;
313 IOleInPlaceSite *ipsite;
314 IOleInPlaceFrame *frame;
315 IOleInPlaceUIWindow *ip_window;
317 DOCHOSTUIINFO hostinfo;
319 IOleUndoManager *undomgr;
321 HWND hwnd;
322 HWND tooltips_hwnd;
324 BOOL in_place_active;
325 BOOL ui_active;
326 BOOL window_active;
327 BOOL has_key_path;
328 BOOL container_locked;
329 BOOL focus;
331 USERMODE usermode;
332 READYSTATE readystate;
333 LPWSTR mime;
335 DWORD update;
337 /* FIXME: probably should be in document node object */
338 nsChannelBSC *bscallback;
339 IMoniker *mon;
340 LPOLESTR url;
341 struct list bindings;
344 typedef struct {
345 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
346 NSContainer *This;
347 } nsEventListener;
349 typedef struct _mutation_queue_t {
350 DWORD type;
351 nsISupports *nsiface;
353 struct _mutation_queue_t *next;
354 } mutation_queue_t;
356 struct NSContainer {
357 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
358 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
359 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
360 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
361 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
362 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
363 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
364 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
366 const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
368 const nsIRunnableVtbl *lpRunnableVtbl;
370 nsEventListener blur_listener;
371 nsEventListener focus_listener;
372 nsEventListener keypress_listener;
373 nsEventListener load_listener;
374 nsEventListener htmlevent_listener;
376 nsIWebBrowser *webbrowser;
377 nsIWebNavigation *navigation;
378 nsIBaseWindow *window;
379 nsIWebBrowserFocus *focus;
381 nsIEditor *editor;
382 nsIController *editor_controller;
384 LONG ref;
386 NSContainer *parent;
387 HTMLDocumentObj *doc;
389 nsIURIContentListener *content_listener;
391 HWND hwnd;
393 mutation_queue_t *mutation_queue;
394 mutation_queue_t *mutation_queue_tail;
396 nsChannelBSC *bscallback; /* hack */
397 HWND reset_focus; /* hack */
400 typedef struct {
401 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
402 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
403 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
405 LONG ref;
407 nsIChannel *channel;
408 nsIHttpChannel *http_channel;
409 nsIHttpChannelInternal *http_channel_internal;
410 nsIWineURI *uri;
411 nsIInputStream *post_data_stream;
412 nsILoadGroup *load_group;
413 nsIInterfaceRequestor *notif_callback;
414 nsISupports *owner;
415 nsLoadFlags load_flags;
416 nsIURI *original_uri;
417 char *content_type;
418 char *charset;
419 PRUint32 response_status;
420 } nsChannel;
422 typedef struct {
423 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
424 void (*destructor)(HTMLDOMNode*);
425 event_target_t **(*get_event_target)(HTMLDOMNode*);
426 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
427 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
428 } NodeImplVtbl;
430 struct HTMLDOMNode {
431 DispatchEx dispex;
432 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
433 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
434 const NodeImplVtbl *vtbl;
436 LONG ref;
438 nsIDOMNode *nsnode;
439 HTMLDocumentNode *doc;
440 event_target_t *event_target;
442 HTMLDOMNode *next;
445 typedef struct {
446 HTMLDOMNode node;
447 ConnectionPointContainer cp_container;
449 const IHTMLElementVtbl *lpHTMLElementVtbl;
450 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
451 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
453 nsIDOMHTMLElement *nselem;
454 } HTMLElement;
456 typedef struct {
457 HTMLElement element;
459 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
461 ConnectionPoint cp;
462 } HTMLTextContainer;
464 struct HTMLDocumentNode {
465 HTMLDOMNode node;
466 HTMLDocument basedoc;
468 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
470 LONG ref;
472 HTMLDOMNode *nodes;
474 IInternetSecurityManager *secmgr;
476 struct list selection_list;
477 struct list range_list;
480 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
481 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
483 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
484 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
485 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
486 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
487 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
488 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
489 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
490 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
491 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
492 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
493 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
494 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
495 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
496 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
497 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
498 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
499 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
500 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
501 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
502 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
503 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
504 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
505 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
506 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
507 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
509 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
510 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
511 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
512 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
513 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
514 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
515 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
516 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
517 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
519 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
521 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
523 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
524 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
525 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
526 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
528 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
529 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
530 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
532 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
533 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
534 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
535 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
536 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
538 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
540 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
541 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
543 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
545 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
547 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
549 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
550 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
552 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
553 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
554 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
556 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow**);
557 void window_set_docnode(HTMLWindow*,HTMLDocumentNode*);
558 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
559 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
560 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
561 IOmNavigator *OmNavigator_Create(void);
563 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
564 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
565 void HTMLDocument_Persist_Init(HTMLDocument*);
566 void HTMLDocument_OleCmd_Init(HTMLDocument*);
567 void HTMLDocument_OleObj_Init(HTMLDocument*);
568 void HTMLDocument_View_Init(HTMLDocument*);
569 void HTMLDocument_Window_Init(HTMLDocument*);
570 void HTMLDocument_Service_Init(HTMLDocument*);
571 void HTMLDocument_Hlink_Init(HTMLDocument*);
573 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
575 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
577 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
578 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
579 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
581 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
582 void NSContainer_Release(NSContainer*);
584 void init_mutation(NSContainer*);
585 void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
586 void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
588 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
589 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
590 void notif_focus(HTMLDocumentObj*);
592 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
593 void hide_tooltip(HTMLDocumentObj*);
594 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
596 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
598 BOOL load_gecko(BOOL);
599 void close_gecko(void);
600 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
601 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
602 void release_nsio(void);
603 BOOL install_wine_gecko(BOOL);
605 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
607 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
609 void call_property_onchanged(ConnectionPoint*,DISPID);
610 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
612 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
613 void nsfree(void*);
615 void nsACString_Init(nsACString*,const char*);
616 void nsACString_SetData(nsACString*,const char*);
617 PRUint32 nsACString_GetData(const nsACString*,const char**);
618 void nsACString_Finish(nsACString*);
620 void nsAString_Init(nsAString*,const PRUnichar*);
621 void nsAString_SetData(nsAString*,const PRUnichar*);
622 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
623 void nsAString_Finish(nsAString*);
625 nsICommandParams *create_nscommand_params(void);
626 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
627 void get_editor_controller(NSContainer*);
628 void init_nsevents(NSContainer*);
629 void add_nsevent_listener(HTMLWindow*,LPCWSTR);
630 nsresult get_nsinterface(nsISupports*,REFIID,void**);
631 void update_nsdocument(HTMLDocumentObj*);
633 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
634 void set_current_mon(HTMLDocument*,IMoniker*);
635 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
637 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
639 nsChannelBSC *create_channelbsc(IMoniker*);
640 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
641 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
642 IMoniker *get_channelbsc_mon(nsChannelBSC*);
644 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
645 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
646 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
647 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
648 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
650 void detach_selection(HTMLDocumentNode*);
651 void detach_ranges(HTMLDocumentNode*);
652 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
654 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
656 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
657 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
658 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
659 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
660 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
661 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
662 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
663 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
664 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
665 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
666 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
667 HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
668 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
669 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
671 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
672 void HTMLElement_Init(HTMLElement*);
673 void HTMLElement2_Init(HTMLElement*);
674 void HTMLElement3_Init(HTMLElement*);
675 void HTMLTextContainer_Init(HTMLTextContainer*);
677 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
678 void HTMLDOMNode_destructor(HTMLDOMNode*);
680 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
681 void HTMLElement_destructor(HTMLDOMNode*);
683 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
684 void release_nodes(HTMLDocumentNode*);
686 void release_script_hosts(HTMLWindow*);
687 void connect_scripts(HTMLWindow*);
688 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
689 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
690 void set_script_mode(HTMLWindow*,SCRIPTMODE);
691 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
692 IDispatch *get_script_disp(ScriptHost*);
694 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
695 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
696 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
698 /* commands */
699 typedef struct {
700 DWORD id;
701 HRESULT (*query)(HTMLDocument*,OLECMD*);
702 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
703 } cmdtable_t;
705 extern const cmdtable_t editmode_cmds[];
707 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
709 /* timer */
710 #define UPDATE_UI 0x0001
711 #define UPDATE_TITLE 0x0002
713 void update_doc(HTMLDocument*,DWORD);
714 void update_title(HTMLDocumentObj*);
716 /* editor */
717 void init_editor(HTMLDocument*);
718 void set_ns_editmode(NSContainer*);
719 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
720 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
721 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
722 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
723 void handle_edit_load(HTMLDocument*);
724 HRESULT editor_is_dirty(HTMLDocument*);
725 void set_dirty(HTMLDocument*,VARIANT_BOOL);
727 extern DWORD mshtml_tls;
729 typedef struct task_t {
730 HTMLDocument *doc;
732 enum {
733 TASK_SETDOWNLOADSTATE,
734 TASK_PARSECOMPLETE,
735 TASK_SETPROGRESS,
736 TASK_START_BINDING
737 } task_id;
739 nsChannelBSC *bscallback;
741 struct task_t *next;
742 } task_t;
744 typedef struct {
745 HWND thread_hwnd;
746 task_t *task_queue_head;
747 task_t *task_queue_tail;
748 struct list timer_list;
749 } thread_data_t;
751 thread_data_t *get_thread_data(BOOL);
752 HWND get_thread_hwnd(void);
753 void push_task(task_t*);
754 void remove_doc_tasks(const HTMLDocument*);
755 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
756 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
758 void release_typelib(void);
759 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
761 const char *debugstr_variant(const VARIANT*);
763 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
764 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
765 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
766 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
767 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
769 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
771 /* memory allocation functions */
773 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
775 return HeapAlloc(GetProcessHeap(), 0, len);
778 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
780 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
783 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
785 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
788 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
790 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
793 static inline BOOL heap_free(void *mem)
795 return HeapFree(GetProcessHeap(), 0, mem);
798 static inline LPWSTR heap_strdupW(LPCWSTR str)
800 LPWSTR ret = NULL;
802 if(str) {
803 DWORD size;
805 size = (strlenW(str)+1)*sizeof(WCHAR);
806 ret = heap_alloc(size);
807 memcpy(ret, str, size);
810 return ret;
813 static inline char *heap_strdupA(const char *str)
815 char *ret = NULL;
817 if(str) {
818 DWORD size;
820 size = strlen(str)+1;
821 ret = heap_alloc(size);
822 memcpy(ret, str, size);
825 return ret;
828 static inline WCHAR *heap_strdupAtoW(const char *str)
830 LPWSTR ret = NULL;
832 if(str) {
833 DWORD len;
835 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
836 ret = heap_alloc(len*sizeof(WCHAR));
837 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
840 return ret;
843 static inline char *heap_strdupWtoA(LPCWSTR str)
845 char *ret = NULL;
847 if(str) {
848 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
849 ret = heap_alloc(size);
850 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
853 return ret;
856 HINSTANCE get_shdoclc(void);
858 extern HINSTANCE hInst;