wer: Add new stubbed wer.dll.
[wine/hramrach.git] / dlls / mshtml / mshtml_private.h
blobe4e074af3bcdf66bcb637b1ed7bc5457253ddcc8
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 "comcat.h"
22 #include "mshtml.h"
23 #include "mshtmhst.h"
24 #include "hlink.h"
25 #include "perhist.h"
26 #include "dispex.h"
28 #include "wine/list.h"
29 #include "wine/unicode.h"
31 #ifdef INIT_GUID
32 #include "initguid.h"
33 #endif
35 #include "nsiface.h"
37 #define NS_OK ((nsresult)0x00000000L)
38 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
39 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
40 #define NS_NOINTERFACE ((nsresult)0x80004002L)
41 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
42 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
43 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
44 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
45 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
47 #define NS_FAILED(res) ((res) & 0x80000000)
48 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
50 #define NSAPI WINAPI
52 #define MSHTML_E_NODOC 0x800a025c
54 typedef struct HTMLDOMNode HTMLDOMNode;
55 typedef struct ConnectionPoint ConnectionPoint;
56 typedef struct BSCallback BSCallback;
57 typedef struct event_target_t event_target_t;
59 /* NOTE: make sure to keep in sync with dispex.c */
60 typedef enum {
61 NULL_tid,
62 DispCEventObj_tid,
63 DispDOMChildrenCollection_tid,
64 DispHTMLAnchorElement_tid,
65 DispHTMLBody_tid,
66 DispHTMLCommentElement_tid,
67 DispHTMLCurrentStyle_tid,
68 DispHTMLDocument_tid,
69 DispHTMLDOMTextNode_tid,
70 DispHTMLElementCollection_tid,
71 DispHTMLFormElement_tid,
72 DispHTMLGenericElement_tid,
73 DispHTMLFrameElement_tid,
74 DispHTMLIFrame_tid,
75 DispHTMLImg_tid,
76 DispHTMLInputElement_tid,
77 DispHTMLLocation_tid,
78 DispHTMLNavigator_tid,
79 DispHTMLOptionElement_tid,
80 DispHTMLScreen_tid,
81 DispHTMLScriptElement_tid,
82 DispHTMLSelectElement_tid,
83 DispHTMLStyle_tid,
84 DispHTMLTable_tid,
85 DispHTMLTableRow_tid,
86 DispHTMLTextAreaElement_tid,
87 DispHTMLUnknownElement_tid,
88 DispHTMLWindow2_tid,
89 HTMLDocumentEvents_tid,
90 IHTMLAnchorElement_tid,
91 IHTMLBodyElement_tid,
92 IHTMLBodyElement2_tid,
93 IHTMLCommentElement_tid,
94 IHTMLCurrentStyle_tid,
95 IHTMLCurrentStyle2_tid,
96 IHTMLCurrentStyle3_tid,
97 IHTMLCurrentStyle4_tid,
98 IHTMLDocument2_tid,
99 IHTMLDocument3_tid,
100 IHTMLDocument4_tid,
101 IHTMLDocument5_tid,
102 IHTMLDOMChildrenCollection_tid,
103 IHTMLDOMNode_tid,
104 IHTMLDOMNode2_tid,
105 IHTMLDOMTextNode_tid,
106 IHTMLElement_tid,
107 IHTMLElement2_tid,
108 IHTMLElement3_tid,
109 IHTMLElement4_tid,
110 IHTMLElementCollection_tid,
111 IHTMLEventObj_tid,
112 IHTMLFiltersCollection_tid,
113 IHTMLFormElement_tid,
114 IHTMLFrameBase_tid,
115 IHTMLFrameBase2_tid,
116 IHTMLFrameElement3_tid,
117 IHTMLGenericElement_tid,
118 IHTMLIFrameElement_tid,
119 IHTMLImageElementFactory_tid,
120 IHTMLImgElement_tid,
121 IHTMLInputElement_tid,
122 IHTMLLocation_tid,
123 IHTMLOptionElement_tid,
124 IHTMLRect_tid,
125 IHTMLScreen_tid,
126 IHTMLScriptElement_tid,
127 IHTMLSelectElement_tid,
128 IHTMLStyle_tid,
129 IHTMLStyle2_tid,
130 IHTMLStyle3_tid,
131 IHTMLStyle4_tid,
132 IHTMLTable_tid,
133 IHTMLTableRow_tid,
134 IHTMLTextAreaElement_tid,
135 IHTMLTextContainer_tid,
136 IHTMLUniqueName_tid,
137 IHTMLWindow2_tid,
138 IHTMLWindow3_tid,
139 IHTMLWindow4_tid,
140 IOmNavigator_tid,
141 LAST_tid
142 } tid_t;
144 typedef struct dispex_data_t dispex_data_t;
145 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
147 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
148 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
149 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
151 typedef struct {
152 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
153 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
154 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
155 } dispex_static_data_vtbl_t;
157 typedef struct {
158 const dispex_static_data_vtbl_t *vtbl;
159 const tid_t disp_tid;
160 dispex_data_t *data;
161 const tid_t* const iface_tids;
162 } dispex_static_data_t;
164 typedef struct {
165 const IDispatchExVtbl *lpIDispatchExVtbl;
167 IUnknown *outer;
169 dispex_static_data_t *data;
170 dispex_dynamic_data_t *dynamic_data;
171 } DispatchEx;
173 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
174 void release_dispex(DispatchEx*);
175 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
176 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
177 HRESULT get_dispids(tid_t,DWORD*,DISPID**);
178 HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*);
180 typedef struct HTMLWindow HTMLWindow;
181 typedef struct HTMLDocumentNode HTMLDocumentNode;
182 typedef struct HTMLDocumentObj HTMLDocumentObj;
183 typedef struct HTMLFrameBase HTMLFrameBase;
184 typedef struct NSContainer NSContainer;
186 typedef enum {
187 SCRIPTMODE_GECKO,
188 SCRIPTMODE_ACTIVESCRIPT
189 } SCRIPTMODE;
191 typedef struct ScriptHost ScriptHost;
193 typedef enum {
194 GLOBAL_SCRIPTVAR,
195 GLOBAL_ELEMENTVAR
196 } global_prop_type_t;
198 typedef struct {
199 global_prop_type_t type;
200 WCHAR *name;
201 ScriptHost *script_host;
202 DISPID id;
203 } global_prop_t;
205 typedef struct {
206 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
208 LONG ref;
210 HTMLWindow *window;
211 } HTMLOptionElementFactory;
213 typedef struct {
214 DispatchEx dispex;
215 const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl;
217 LONG ref;
219 HTMLWindow *window;
220 } HTMLImageElementFactory;
222 struct HTMLLocation {
223 DispatchEx dispex;
224 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
226 LONG ref;
228 HTMLWindow *window;
231 typedef struct {
232 HTMLWindow *window;
233 LONG ref;
234 } windowref_t;
236 typedef struct nsChannelBSC nsChannelBSC;
238 struct HTMLWindow {
239 DispatchEx dispex;
240 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
241 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
242 const IHTMLWindow4Vtbl *lpHTMLWindow4Vtbl;
243 const IHTMLPrivateWindowVtbl *lpIHTMLPrivateWindowVtbl;
244 const IDispatchExVtbl *lpIDispatchExVtbl;
246 LONG ref;
248 windowref_t *window_ref;
249 LONG task_magic;
251 HTMLDocumentNode *doc;
252 HTMLDocumentObj *doc_obj;
253 nsIDOMWindow *nswindow;
254 HTMLWindow *parent;
255 HTMLFrameBase *frame_element;
256 READYSTATE readystate;
258 nsChannelBSC *bscallback;
259 IMoniker *mon;
260 LPOLESTR url;
262 IHTMLEventObj *event;
264 SCRIPTMODE scriptmode;
265 struct list script_hosts;
267 HTMLOptionElementFactory *option_factory;
268 HTMLImageElementFactory *image_factory;
269 HTMLLocation *location;
270 IHTMLScreen *screen;
272 global_prop_t *global_props;
273 DWORD global_prop_cnt;
274 DWORD global_prop_size;
276 struct list children;
277 struct list sibling_entry;
278 struct list entry;
281 typedef enum {
282 UNKNOWN_USERMODE,
283 BROWSEMODE,
284 EDITMODE
285 } USERMODE;
287 typedef struct _cp_static_data_t {
288 tid_t tid;
289 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
290 DWORD id_cnt;
291 DISPID *ids;
292 } cp_static_data_t;
294 typedef struct ConnectionPointContainer {
295 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
297 ConnectionPoint *cp_list;
298 IUnknown *outer;
299 struct ConnectionPointContainer *forward_container;
300 } ConnectionPointContainer;
302 struct ConnectionPoint {
303 const IConnectionPointVtbl *lpConnectionPointVtbl;
305 ConnectionPointContainer *container;
307 union {
308 IUnknown *unk;
309 IDispatch *disp;
310 IPropertyNotifySink *propnotif;
311 } *sinks;
312 DWORD sinks_size;
314 const IID *iid;
315 cp_static_data_t *data;
317 ConnectionPoint *next;
320 struct HTMLDocument {
321 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
322 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
323 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
324 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
325 const IHTMLDocument6Vtbl *lpHTMLDocument6Vtbl;
326 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
327 const IPersistFileVtbl *lpPersistFileVtbl;
328 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
329 const IMonikerPropVtbl *lpMonikerPropVtbl;
330 const IOleObjectVtbl *lpOleObjectVtbl;
331 const IOleDocumentVtbl *lpOleDocumentVtbl;
332 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
333 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
334 const IViewObjectExVtbl *lpViewObjectExVtbl;
335 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
336 const IServiceProviderVtbl *lpServiceProviderVtbl;
337 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
338 const IOleControlVtbl *lpOleControlVtbl;
339 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
340 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
341 const IDispatchExVtbl *lpIDispatchExVtbl;
342 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
343 const IObjectWithSiteVtbl *lpObjectWithSiteVtbl;
345 IUnknown *unk_impl;
346 IDispatchEx *dispex;
348 HTMLDocumentObj *doc_obj;
349 HTMLDocumentNode *doc_node;
351 HTMLWindow *window;
353 LONG task_magic;
355 ConnectionPointContainer cp_container;
356 ConnectionPoint cp_htmldocevents;
357 ConnectionPoint cp_htmldocevents2;
358 ConnectionPoint cp_propnotif;
359 ConnectionPoint cp_dispatch;
361 IOleAdviseHolder *advise_holder;
364 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
366 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
369 static inline ULONG htmldoc_addref(HTMLDocument *This)
371 return IUnknown_AddRef(This->unk_impl);
374 static inline ULONG htmldoc_release(HTMLDocument *This)
376 return IUnknown_Release(This->unk_impl);
379 struct HTMLDocumentObj {
380 HTMLDocument basedoc;
381 DispatchEx dispex;
382 const ICustomDocVtbl *lpCustomDocVtbl;
384 LONG ref;
386 NSContainer *nscontainer;
388 IOleClientSite *client;
389 IDocHostUIHandler *hostui;
390 IOleInPlaceSite *ipsite;
391 IOleInPlaceFrame *frame;
392 IOleInPlaceUIWindow *ip_window;
393 IAdviseSink *view_sink;
395 DOCHOSTUIINFO hostinfo;
397 IOleUndoManager *undomgr;
399 HWND hwnd;
400 HWND tooltips_hwnd;
402 BOOL request_uiactivate;
403 BOOL in_place_active;
404 BOOL ui_active;
405 BOOL window_active;
406 BOOL hostui_setup;
407 BOOL container_locked;
408 BOOL focus;
409 INT download_state;
411 USERMODE usermode;
412 LPWSTR mime;
414 DWORD update;
417 struct NSContainer {
418 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
419 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
420 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
421 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
422 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
423 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
424 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
425 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
427 nsIWebBrowser *webbrowser;
428 nsIWebNavigation *navigation;
429 nsIBaseWindow *window;
430 nsIWebBrowserFocus *focus;
432 nsIEditor *editor;
433 nsIController *editor_controller;
435 LONG ref;
437 NSContainer *parent;
438 HTMLDocumentObj *doc;
440 nsIURIContentListener *content_listener;
442 HWND hwnd;
445 typedef struct nsWineURI nsWineURI;
447 HRESULT set_wine_url(nsWineURI*,LPCWSTR);
448 nsresult on_start_uri_open(NSContainer*,nsIURI*,PRBool*);
450 /* Keep sync with request_method_strings in nsio.c */
451 typedef enum {
452 METHOD_GET,
453 METHOD_PUT,
454 METHOD_POST
455 } REQUEST_METHOD;
457 typedef struct {
458 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
459 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
460 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
462 LONG ref;
464 nsWineURI *uri;
465 nsIInputStream *post_data_stream;
466 BOOL parse_stream;
467 nsILoadGroup *load_group;
468 nsIInterfaceRequestor *notif_callback;
469 nsISupports *owner;
470 nsLoadFlags load_flags;
471 nsIURI *original_uri;
472 nsIURI *referrer;
473 char *content_type;
474 char *charset;
475 PRUint32 response_status;
476 REQUEST_METHOD request_method;
477 struct list response_headers;
478 struct list request_headers;
479 UINT url_scheme;
480 } nsChannel;
482 typedef struct {
483 struct list entry;
484 WCHAR *header;
485 WCHAR *data;
486 } http_header_t;
488 HRESULT set_http_header(struct list*,const WCHAR*,int,const WCHAR*,int);
490 typedef struct {
491 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
492 void (*destructor)(HTMLDOMNode*);
493 event_target_t **(*get_event_target)(HTMLDOMNode*);
494 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
495 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
496 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
497 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
498 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
499 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
500 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
501 HRESULT (*bind_to_tree)(HTMLDOMNode*);
502 } NodeImplVtbl;
504 struct HTMLDOMNode {
505 DispatchEx dispex;
506 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
507 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
508 const NodeImplVtbl *vtbl;
510 LONG ref;
512 nsIDOMNode *nsnode;
513 HTMLDocumentNode *doc;
514 event_target_t *event_target;
515 ConnectionPointContainer *cp_container;
517 HTMLDOMNode *next;
520 typedef struct {
521 HTMLDOMNode node;
522 ConnectionPointContainer cp_container;
524 const IHTMLElementVtbl *lpHTMLElementVtbl;
525 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
526 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
528 nsIDOMHTMLElement *nselem;
529 } HTMLElement;
531 #define HTMLELEMENT_TIDS \
532 IHTMLDOMNode_tid, \
533 IHTMLDOMNode2_tid, \
534 IHTMLElement_tid, \
535 IHTMLElement2_tid, \
536 IHTMLElement3_tid, \
537 IHTMLElement4_tid
539 typedef struct {
540 HTMLElement element;
542 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
544 ConnectionPoint cp;
545 } HTMLTextContainer;
547 struct HTMLFrameBase {
548 HTMLElement element;
550 const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
551 const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
553 HTMLWindow *content_window;
555 nsIDOMHTMLFrameElement *nsframe;
556 nsIDOMHTMLIFrameElement *nsiframe;
559 typedef struct _mutation_queue_t {
560 DWORD type;
561 nsISupports *nsiface;
563 struct _mutation_queue_t *next;
564 } mutation_queue_t;
566 typedef struct nsDocumentEventListener nsDocumentEventListener;
568 struct HTMLDocumentNode {
569 HTMLDOMNode node;
570 HTMLDocument basedoc;
572 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
574 const nsIDocumentObserverVtbl *lpIDocumentObserverVtbl;
575 const nsIRunnableVtbl *lpIRunnableVtbl;
577 LONG ref;
579 nsIDOMHTMLDocument *nsdoc;
580 HTMLDOMNode *nodes;
581 BOOL content_ready;
582 event_target_t *body_event_target;
584 IInternetSecurityManager *secmgr;
585 ICatInformation *catmgr;
586 nsDocumentEventListener *nsevent_listener;
587 BOOL *event_vector;
589 BOOL skip_mutation_notif;
590 mutation_queue_t *mutation_queue;
591 mutation_queue_t *mutation_queue_tail;
593 struct list bindings;
594 struct list selection_list;
595 struct list range_list;
598 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
599 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
600 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
602 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
603 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
604 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
605 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
606 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
607 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
608 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
609 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
610 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
611 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
612 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
613 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
614 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
615 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
616 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
617 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
618 #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)
619 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
620 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
621 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
622 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
623 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
624 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
625 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
626 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
627 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
628 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
629 #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)
631 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
632 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
633 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
634 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
635 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
636 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
637 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
638 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
639 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
641 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
643 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
645 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
646 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
647 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
648 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
650 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
651 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
652 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
654 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
655 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
656 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
657 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
658 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
660 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
661 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
662 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
664 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
665 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
666 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
668 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
670 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
672 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
674 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
675 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
677 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
678 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
679 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
681 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**);
682 void update_window_doc(HTMLWindow*);
683 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
684 nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*);
685 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
686 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*);
687 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
688 IOmNavigator *OmNavigator_Create(void);
689 HRESULT HTMLScreen_Create(IHTMLScreen**);
691 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
692 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
693 void HTMLDocument_Persist_Init(HTMLDocument*);
694 void HTMLDocument_OleCmd_Init(HTMLDocument*);
695 void HTMLDocument_OleObj_Init(HTMLDocument*);
696 void HTMLDocument_View_Init(HTMLDocument*);
697 void HTMLDocument_Window_Init(HTMLDocument*);
698 void HTMLDocument_Service_Init(HTMLDocument*);
699 void HTMLDocument_Hlink_Init(HTMLDocument*);
701 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
703 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
705 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*);
706 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
707 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
709 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
710 void NSContainer_Release(NSContainer*);
712 void init_mutation(HTMLDocumentNode*);
713 void release_mutation(HTMLDocumentNode*);
715 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
716 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
717 void notif_focus(HTMLDocumentObj*);
719 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
720 void hide_tooltip(HTMLDocumentObj*);
721 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
723 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
725 BOOL load_gecko(BOOL);
726 void close_gecko(void);
727 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
728 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
729 void release_nsio(void);
730 BOOL install_wine_gecko(BOOL);
731 BOOL is_gecko_path(const char*);
733 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
734 HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**);
735 HRESULT load_nsuri(HTMLWindow*,nsWineURI*,nsChannelBSC*,DWORD);
737 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD,BOOL*);
738 HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);
739 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*);
740 HRESULT set_moniker(HTMLDocument*,IMoniker*,IBindCtx*,nsChannelBSC*,BOOL);
742 void call_property_onchanged(ConnectionPoint*,DISPID);
743 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
745 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
746 void nsfree(void*);
748 void nsACString_InitDepend(nsACString*,const char*);
749 void nsACString_SetData(nsACString*,const char*);
750 PRUint32 nsACString_GetData(const nsACString*,const char**);
751 void nsACString_Finish(nsACString*);
753 BOOL nsAString_Init(nsAString*,const PRUnichar*);
754 void nsAString_InitDepend(nsAString*,const PRUnichar*);
755 void nsAString_SetData(nsAString*,const PRUnichar*);
756 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
757 void nsAString_Finish(nsAString*);
759 nsICommandParams *create_nscommand_params(void);
760 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
761 void get_editor_controller(NSContainer*);
762 nsresult get_nsinterface(nsISupports*,REFIID,void**);
764 void init_nsevents(HTMLDocumentNode*);
765 void release_nsevents(HTMLDocumentNode*);
766 void add_nsevent_listener(HTMLDocumentNode*,nsIDOMNode*,LPCWSTR);
768 void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
769 void set_current_mon(HTMLWindow*,IMoniker*);
770 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
771 HRESULT async_start_doc_binding(HTMLWindow*,nsChannelBSC*);
772 void abort_document_bindings(HTMLDocumentNode*);
774 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);
776 HRESULT create_channelbsc(IMoniker*,WCHAR*,BYTE*,DWORD,nsChannelBSC**);
777 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
778 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
779 IMoniker *get_channelbsc_mon(nsChannelBSC*);
781 void set_ready_state(HTMLWindow*,READYSTATE);
783 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
784 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
785 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
786 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
787 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
789 void detach_selection(HTMLDocumentNode*);
790 void detach_ranges(HTMLDocumentNode*);
791 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
793 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
795 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
797 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
798 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
799 HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
800 HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
801 HTMLElement *HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
802 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
803 HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
804 HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
805 HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
806 HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
807 HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
808 HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
809 HTMLElement *HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
810 HTMLElement *HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
811 HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
812 HTMLElement *HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
814 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
815 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
816 void HTMLElement2_Init(HTMLElement*);
817 void HTMLElement3_Init(HTMLElement*);
818 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
819 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
821 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
822 void HTMLDOMNode_destructor(HTMLDOMNode*);
824 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
825 void HTMLElement_destructor(HTMLDOMNode*);
827 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
828 void HTMLFrameBase_destructor(HTMLFrameBase*);
830 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
831 void release_nodes(HTMLDocumentNode*);
833 void release_script_hosts(HTMLWindow*);
834 void connect_scripts(HTMLWindow*);
835 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
836 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
837 void set_script_mode(HTMLWindow*,SCRIPTMODE);
838 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
839 IDispatch *get_script_disp(ScriptHost*);
840 HRESULT search_window_props(HTMLWindow*,BSTR,DWORD,DISPID*);
842 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
843 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
844 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
846 /* commands */
847 typedef struct {
848 DWORD id;
849 HRESULT (*query)(HTMLDocument*,OLECMD*);
850 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
851 } cmdtable_t;
853 extern const cmdtable_t editmode_cmds[];
855 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
857 /* timer */
858 #define UPDATE_UI 0x0001
859 #define UPDATE_TITLE 0x0002
861 void update_doc(HTMLDocument*,DWORD);
862 void update_title(HTMLDocumentObj*);
864 /* editor */
865 void init_editor(HTMLDocument*);
866 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
867 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
868 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
869 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
870 void handle_edit_load(HTMLDocument*);
871 HRESULT editor_is_dirty(HTMLDocument*);
872 void set_dirty(HTMLDocument*,VARIANT_BOOL);
874 extern DWORD mshtml_tls;
876 typedef struct task_t task_t;
877 typedef void (*task_proc_t)(task_t*);
879 struct task_t {
880 LONG target_magic;
881 task_proc_t proc;
882 struct task_t *next;
885 typedef struct {
886 task_t header;
887 HTMLDocumentObj *doc;
888 } docobj_task_t;
890 typedef struct {
891 HWND thread_hwnd;
892 task_t *task_queue_head;
893 task_t *task_queue_tail;
894 struct list timer_list;
895 } thread_data_t;
897 thread_data_t *get_thread_data(BOOL);
898 HWND get_thread_hwnd(void);
900 LONG get_task_target_magic(void);
901 void push_task(task_t*,task_proc_t,LONG);
902 void remove_target_tasks(LONG);
904 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
905 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
907 void release_typelib(void);
908 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
910 const char *debugstr_variant(const VARIANT*);
912 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
913 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
914 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
915 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
916 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
918 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
920 /* memory allocation functions */
922 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
924 return HeapAlloc(GetProcessHeap(), 0, len);
927 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
929 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
932 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
934 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
937 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
939 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
942 static inline BOOL heap_free(void *mem)
944 return HeapFree(GetProcessHeap(), 0, mem);
947 static inline LPWSTR heap_strdupW(LPCWSTR str)
949 LPWSTR ret = NULL;
951 if(str) {
952 DWORD size;
954 size = (strlenW(str)+1)*sizeof(WCHAR);
955 ret = heap_alloc(size);
956 memcpy(ret, str, size);
959 return ret;
962 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
964 LPWSTR ret = NULL;
966 if(str) {
967 ret = heap_alloc((len+1)*sizeof(WCHAR));
968 memcpy(ret, str, len*sizeof(WCHAR));
969 ret[len] = 0;
972 return ret;
975 static inline char *heap_strdupA(const char *str)
977 char *ret = NULL;
979 if(str) {
980 DWORD size;
982 size = strlen(str)+1;
983 ret = heap_alloc(size);
984 memcpy(ret, str, size);
987 return ret;
990 static inline WCHAR *heap_strdupAtoW(const char *str)
992 LPWSTR ret = NULL;
994 if(str) {
995 DWORD len;
997 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
998 ret = heap_alloc(len*sizeof(WCHAR));
999 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1002 return ret;
1005 static inline char *heap_strdupWtoA(LPCWSTR str)
1007 char *ret = NULL;
1009 if(str) {
1010 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1011 ret = heap_alloc(size);
1012 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1015 return ret;
1018 static inline void windowref_addref(windowref_t *ref)
1020 InterlockedIncrement(&ref->ref);
1023 static inline void windowref_release(windowref_t *ref)
1025 if(!InterlockedDecrement(&ref->ref))
1026 heap_free(ref);
1029 HDC get_display_dc(void);
1030 HINSTANCE get_shdoclc(void);
1031 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR);
1033 extern HINSTANCE hInst;