user32: Delay registration of the builtin classes until the first window is created.
[wine.git] / dlls / mshtml / mshtml_private.h
blobff10c5ce75dc143e3a8178e46b75ff118443d13f
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 "docobjectservice.h"
22 #include "comcat.h"
23 #include "mshtml.h"
24 #include "mshtmhst.h"
25 #include "hlink.h"
26 #include "perhist.h"
27 #include "dispex.h"
28 #include "objsafe.h"
29 #include "htiframe.h"
30 #include "tlogstg.h"
31 #include "shdeprecated.h"
33 #include "wine/list.h"
34 #include "wine/unicode.h"
36 #ifdef INIT_GUID
37 #include "initguid.h"
38 #endif
40 #include "nsiface.h"
42 #define NS_ERROR_GENERATE_FAILURE(module,code) \
43 ((nsresult) (((UINT32)(1<<31)) | ((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
45 #define NS_OK ((nsresult)0x00000000L)
46 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
47 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
48 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
49 #define NS_NOINTERFACE ((nsresult)0x80004002L)
50 #define NS_ERROR_INVALID_POINTER ((nsresult)0x80004003L)
51 #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
52 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
53 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
54 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
56 #define NS_ERROR_MODULE_NETWORK 6
58 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
59 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
61 #define NS_FAILED(res) ((res) & 0x80000000)
62 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
64 #define NSAPI WINAPI
66 #define MSHTML_E_NODOC 0x800a025c
68 typedef struct HTMLDOMNode HTMLDOMNode;
69 typedef struct ConnectionPoint ConnectionPoint;
70 typedef struct BSCallback BSCallback;
71 typedef struct event_target_t event_target_t;
73 #define TID_LIST \
74 XIID(NULL) \
75 XDIID(DispCEventObj) \
76 XDIID(DispCPlugins) \
77 XDIID(DispDOMChildrenCollection) \
78 XDIID(DispHTMLAnchorElement) \
79 XDIID(DispHTMLAttributeCollection) \
80 XDIID(DispHTMLBody) \
81 XDIID(DispHTMLButtonElement) \
82 XDIID(DispHTMLCommentElement) \
83 XDIID(DispHTMLCurrentStyle) \
84 XDIID(DispHTMLDocument) \
85 XDIID(DispHTMLDOMAttribute) \
86 XDIID(DispHTMLDOMTextNode) \
87 XDIID(DispHTMLElementCollection) \
88 XDIID(DispHTMLEmbed) \
89 XDIID(DispHTMLFormElement) \
90 XDIID(DispHTMLGenericElement) \
91 XDIID(DispHTMLFrameElement) \
92 XDIID(DispHTMLHeadElement) \
93 XDIID(DispHTMLHistory) \
94 XDIID(DispHTMLIFrame) \
95 XDIID(DispHTMLImg) \
96 XDIID(DispHTMLInputElement) \
97 XDIID(DispHTMLLabelElement) \
98 XDIID(DispHTMLLinkElement) \
99 XDIID(DispHTMLLocation) \
100 XDIID(DispHTMLMetaElement) \
101 XDIID(DispHTMLNavigator) \
102 XDIID(DispHTMLObjectElement) \
103 XDIID(DispHTMLOptionElement) \
104 XDIID(DispHTMLScreen) \
105 XDIID(DispHTMLScriptElement) \
106 XDIID(DispHTMLSelectElement) \
107 XDIID(DispHTMLStyle) \
108 XDIID(DispHTMLStyleElement) \
109 XDIID(DispHTMLStyleSheet) \
110 XDIID(DispHTMLStyleSheetsCollection) \
111 XDIID(DispHTMLTable) \
112 XDIID(DispHTMLTableCell) \
113 XDIID(DispHTMLTableRow) \
114 XDIID(DispHTMLTextAreaElement) \
115 XDIID(DispHTMLTitleElement) \
116 XDIID(DispHTMLUnknownElement) \
117 XDIID(DispHTMLWindow2) \
118 XDIID(HTMLDocumentEvents) \
119 XDIID(HTMLElementEvents2) \
120 XIID(IHTMLAnchorElement) \
121 XIID(IHTMLAttributeCollection) \
122 XIID(IHTMLAttributeCollection2) \
123 XIID(IHTMLAttributeCollection3) \
124 XIID(IHTMLBodyElement) \
125 XIID(IHTMLBodyElement2) \
126 XIID(IHTMLButtonElement) \
127 XIID(IHTMLCommentElement) \
128 XIID(IHTMLCurrentStyle) \
129 XIID(IHTMLCurrentStyle2) \
130 XIID(IHTMLCurrentStyle3) \
131 XIID(IHTMLCurrentStyle4) \
132 XIID(IHTMLDocument2) \
133 XIID(IHTMLDocument3) \
134 XIID(IHTMLDocument4) \
135 XIID(IHTMLDocument5) \
136 XIID(IHTMLDOMAttribute) \
137 XIID(IHTMLDOMChildrenCollection) \
138 XIID(IHTMLDOMNode) \
139 XIID(IHTMLDOMNode2) \
140 XIID(IHTMLDOMTextNode) \
141 XIID(IHTMLElement) \
142 XIID(IHTMLElement2) \
143 XIID(IHTMLElement3) \
144 XIID(IHTMLElement4) \
145 XIID(IHTMLElementCollection) \
146 XIID(IHTMLEmbedElement) \
147 XIID(IHTMLEventObj) \
148 XIID(IHTMLFiltersCollection) \
149 XIID(IHTMLFormElement) \
150 XIID(IHTMLFrameBase) \
151 XIID(IHTMLFrameBase2) \
152 XIID(IHTMLFrameElement3) \
153 XIID(IHTMLGenericElement) \
154 XIID(IHTMLHeadElement) \
155 XIID(IHTMLIFrameElement) \
156 XIID(IHTMLIFrameElement2) \
157 XIID(IHTMLIFrameElement3) \
158 XIID(IHTMLImageElementFactory) \
159 XIID(IHTMLImgElement) \
160 XIID(IHTMLInputElement) \
161 XIID(IHTMLLabelElement) \
162 XIID(IHTMLLinkElement) \
163 XIID(IHTMLLocation) \
164 XIID(IHTMLMetaElement) \
165 XIID(IHTMLMimeTypesCollection) \
166 XIID(IHTMLObjectElement) \
167 XIID(IHTMLObjectElement2) \
168 XIID(IHTMLOptionElement) \
169 XIID(IHTMLPluginsCollection) \
170 XIID(IHTMLRect) \
171 XIID(IHTMLScreen) \
172 XIID(IHTMLScriptElement) \
173 XIID(IHTMLSelectElement) \
174 XIID(IHTMLStorage) \
175 XIID(IHTMLStyle) \
176 XIID(IHTMLStyle2) \
177 XIID(IHTMLStyle3) \
178 XIID(IHTMLStyle4) \
179 XIID(IHTMLStyle5) \
180 XIID(IHTMLStyle6) \
181 XIID(IHTMLStyleElement) \
182 XIID(IHTMLStyleSheet) \
183 XIID(IHTMLStyleSheetsCollection) \
184 XIID(IHTMLTable) \
185 XIID(IHTMLTable2) \
186 XIID(IHTMLTable3) \
187 XIID(IHTMLTableCell) \
188 XIID(IHTMLTableRow) \
189 XIID(IHTMLTextAreaElement) \
190 XIID(IHTMLTextContainer) \
191 XIID(IHTMLTitleElement) \
192 XIID(IHTMLUniqueName) \
193 XIID(IHTMLWindow2) \
194 XIID(IHTMLWindow3) \
195 XIID(IHTMLWindow4) \
196 XIID(IHTMLWindow5) \
197 XIID(IHTMLWindow6) \
198 XIID(IOmHistory) \
199 XIID(IOmNavigator)
201 typedef enum {
202 #define XIID(iface) iface ## _tid,
203 #define XDIID(iface) iface ## _tid,
204 TID_LIST
205 #undef XIID
206 #undef XDIID
207 LAST_tid
208 } tid_t;
210 typedef struct dispex_data_t dispex_data_t;
211 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
213 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
214 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
215 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
217 typedef struct DispatchEx DispatchEx;
219 typedef struct {
220 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
221 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
222 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
223 HRESULT (*populate_props)(DispatchEx*);
224 } dispex_static_data_vtbl_t;
226 typedef struct {
227 const dispex_static_data_vtbl_t *vtbl;
228 const tid_t disp_tid;
229 dispex_data_t *data;
230 const tid_t* const iface_tids;
231 } dispex_static_data_t;
233 struct DispatchEx {
234 IDispatchEx IDispatchEx_iface;
236 IUnknown *outer;
238 dispex_static_data_t *data;
239 dispex_dynamic_data_t *dynamic_data;
242 typedef struct {
243 void *x;
244 } nsCycleCollectingAutoRefCnt;
246 typedef struct {
247 void *x[9];
248 } nsXPCOMCycleCollectionParticipant;
250 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
252 typedef struct {
253 void (NSAPI *unmark_if_purple)(void*);
254 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
255 nsresult (NSAPI *unlink)(void*);
256 } CCObjCallback;
258 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
260 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*);
261 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*);
262 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt);
263 void (__cdecl *ccref_unmark_if_purple)(nsCycleCollectingAutoRefCnt*);
264 void (__cdecl *ccp_init)(nsXPCOMCycleCollectionParticipant*,const CCObjCallback*);
265 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*);
266 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*);
268 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN;
269 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
270 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
271 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
272 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
273 HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*) DECLSPEC_HIDDEN;
274 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
275 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
276 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
277 void release_typelib(void) DECLSPEC_HIDDEN;
278 HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
280 typedef enum {
281 DISPEXPROP_CUSTOM,
282 DISPEXPROP_DYNAMIC,
283 DISPEXPROP_BUILTIN
284 } dispex_prop_type_t;
286 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
288 typedef struct HTMLWindow HTMLWindow;
289 typedef struct HTMLInnerWindow HTMLInnerWindow;
290 typedef struct HTMLOuterWindow HTMLOuterWindow;
291 typedef struct HTMLDocumentNode HTMLDocumentNode;
292 typedef struct HTMLDocumentObj HTMLDocumentObj;
293 typedef struct HTMLFrameBase HTMLFrameBase;
294 typedef struct NSContainer NSContainer;
295 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
297 typedef enum {
298 SCRIPTMODE_GECKO,
299 SCRIPTMODE_ACTIVESCRIPT
300 } SCRIPTMODE;
302 typedef struct ScriptHost ScriptHost;
304 typedef enum {
305 GLOBAL_SCRIPTVAR,
306 GLOBAL_ELEMENTVAR,
307 GLOBAL_DISPEXVAR,
308 GLOBAL_FRAMEVAR
309 } global_prop_type_t;
311 typedef struct {
312 global_prop_type_t type;
313 WCHAR *name;
314 ScriptHost *script_host;
315 DISPID id;
316 } global_prop_t;
318 typedef struct {
319 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
321 LONG ref;
323 HTMLInnerWindow *window;
324 } HTMLOptionElementFactory;
326 typedef struct {
327 DispatchEx dispex;
328 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
330 LONG ref;
332 HTMLInnerWindow *window;
333 } HTMLImageElementFactory;
335 struct HTMLLocation {
336 DispatchEx dispex;
337 IHTMLLocation IHTMLLocation_iface;
339 LONG ref;
341 HTMLInnerWindow *window;
344 typedef struct {
345 DispatchEx dispex;
346 IOmHistory IOmHistory_iface;
348 LONG ref;
350 HTMLInnerWindow *window;
351 } OmHistory;
353 typedef struct {
354 HTMLOuterWindow *window;
355 LONG ref;
356 } windowref_t;
358 typedef struct nsChannelBSC nsChannelBSC;
360 struct HTMLWindow {
361 IHTMLWindow2 IHTMLWindow2_iface;
362 IHTMLWindow3 IHTMLWindow3_iface;
363 IHTMLWindow4 IHTMLWindow4_iface;
364 IHTMLWindow5 IHTMLWindow5_iface;
365 IHTMLWindow6 IHTMLWindow6_iface;
366 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
367 IDispatchEx IDispatchEx_iface;
368 IServiceProvider IServiceProvider_iface;
369 ITravelLogClient ITravelLogClient_iface;
370 IObjectIdentity IObjectIdentity_iface;
372 LONG ref;
374 HTMLInnerWindow *inner_window;
375 HTMLOuterWindow *outer_window;
378 struct HTMLOuterWindow {
379 HTMLWindow base;
381 windowref_t *window_ref;
382 LONG task_magic;
384 HTMLDocumentObj *doc_obj;
385 nsIDOMWindow *nswindow;
386 HTMLOuterWindow *parent;
387 HTMLFrameBase *frame_element;
389 READYSTATE readystate;
390 BOOL readystate_locked;
391 unsigned readystate_pending;
393 HTMLInnerWindow *pending_window;
394 IMoniker *mon;
395 IUri *uri;
396 IUri *uri_nofrag;
397 BSTR url;
398 DWORD load_flags;
400 SCRIPTMODE scriptmode;
402 IInternetSecurityManager *secmgr;
404 struct list children;
405 struct list sibling_entry;
406 struct list entry;
409 struct HTMLInnerWindow {
410 HTMLWindow base;
411 DispatchEx dispex;
413 HTMLDocumentNode *doc;
415 struct list script_hosts;
417 IHTMLEventObj *event;
419 HTMLImageElementFactory *image_factory;
420 HTMLOptionElementFactory *option_factory;
421 IHTMLScreen *screen;
422 OmHistory *history;
423 IHTMLStorage *session_storage;
425 unsigned parser_callback_cnt;
426 struct list script_queue;
428 global_prop_t *global_props;
429 DWORD global_prop_cnt;
430 DWORD global_prop_size;
432 LONG task_magic;
434 HTMLLocation *location;
436 IMoniker *mon;
437 nsChannelBSC *bscallback;
438 struct list bindings;
441 typedef enum {
442 UNKNOWN_USERMODE,
443 BROWSEMODE,
444 EDITMODE
445 } USERMODE;
447 typedef struct _cp_static_data_t {
448 tid_t tid;
449 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
450 BOOL pass_event_arg;
451 DWORD id_cnt;
452 DISPID *ids;
453 } cp_static_data_t;
455 typedef struct {
456 const IID *riid;
457 cp_static_data_t *desc;
458 } cpc_entry_t;
460 typedef struct ConnectionPointContainer {
461 IConnectionPointContainer IConnectionPointContainer_iface;
463 ConnectionPoint *cps;
464 const cpc_entry_t *cp_entries;
465 IUnknown *outer;
466 struct ConnectionPointContainer *forward_container;
467 } ConnectionPointContainer;
469 struct ConnectionPoint {
470 IConnectionPoint IConnectionPoint_iface;
472 ConnectionPointContainer *container;
474 union {
475 IUnknown *unk;
476 IDispatch *disp;
477 IPropertyNotifySink *propnotif;
478 } *sinks;
479 DWORD sinks_size;
481 const IID *iid;
482 cp_static_data_t *data;
485 struct HTMLDocument {
486 IHTMLDocument2 IHTMLDocument2_iface;
487 IHTMLDocument3 IHTMLDocument3_iface;
488 IHTMLDocument4 IHTMLDocument4_iface;
489 IHTMLDocument5 IHTMLDocument5_iface;
490 IHTMLDocument6 IHTMLDocument6_iface;
491 IPersistMoniker IPersistMoniker_iface;
492 IPersistFile IPersistFile_iface;
493 IPersistHistory IPersistHistory_iface;
494 IMonikerProp IMonikerProp_iface;
495 IOleObject IOleObject_iface;
496 IOleDocument IOleDocument_iface;
497 IOleDocumentView IOleDocumentView_iface;
498 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
499 IViewObjectEx IViewObjectEx_iface;
500 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
501 IServiceProvider IServiceProvider_iface;
502 IOleCommandTarget IOleCommandTarget_iface;
503 IOleControl IOleControl_iface;
504 IHlinkTarget IHlinkTarget_iface;
505 IPersistStreamInit IPersistStreamInit_iface;
506 IDispatchEx IDispatchEx_iface;
507 ISupportErrorInfo ISupportErrorInfo_iface;
508 IObjectWithSite IObjectWithSite_iface;
509 IOleContainer IOleContainer_iface;
510 IObjectSafety IObjectSafety_iface;
511 IProvideClassInfo IProvideClassInfo_iface;
513 IUnknown *unk_impl;
514 IDispatchEx *dispex;
516 HTMLDocumentObj *doc_obj;
517 HTMLDocumentNode *doc_node;
519 HTMLOuterWindow *window;
521 LONG task_magic;
523 ConnectionPointContainer cp_container;
524 IOleAdviseHolder *advise_holder;
527 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
529 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
532 static inline ULONG htmldoc_addref(HTMLDocument *This)
534 return IUnknown_AddRef(This->unk_impl);
537 static inline ULONG htmldoc_release(HTMLDocument *This)
539 return IUnknown_Release(This->unk_impl);
542 struct HTMLDocumentObj {
543 HTMLDocument basedoc;
544 DispatchEx dispex;
545 ICustomDoc ICustomDoc_iface;
546 ITargetContainer ITargetContainer_iface;
548 IWindowForBindingUI IWindowForBindingUI_iface;
550 LONG ref;
552 NSContainer *nscontainer;
554 IOleClientSite *client;
555 IDocHostUIHandler *hostui;
556 IOleCommandTarget *client_cmdtrg;
557 BOOL custom_hostui;
558 IOleInPlaceSite *ipsite;
559 IOleInPlaceFrame *frame;
560 IOleInPlaceUIWindow *ip_window;
561 IAdviseSink *view_sink;
562 IDocObjectService *doc_object_service;
563 IUnknown *webbrowser;
564 ITravelLog *travel_log;
565 IUnknown *browser_service;
567 DOCHOSTUIINFO hostinfo;
569 IOleUndoManager *undomgr;
571 HWND hwnd;
572 HWND tooltips_hwnd;
574 BOOL request_uiactivate;
575 BOOL in_place_active;
576 BOOL ui_active;
577 BOOL window_active;
578 BOOL hostui_setup;
579 BOOL container_locked;
580 BOOL focus;
581 BOOL has_popup;
582 INT download_state;
584 USERMODE usermode;
585 LPWSTR mime;
587 DWORD update;
590 typedef struct nsWeakReference nsWeakReference;
592 struct NSContainer {
593 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
594 nsIContextMenuListener nsIContextMenuListener_iface;
595 nsIURIContentListener nsIURIContentListener_iface;
596 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
597 nsITooltipListener nsITooltipListener_iface;
598 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
599 nsISupportsWeakReference nsISupportsWeakReference_iface;
601 nsIWebBrowser *webbrowser;
602 nsIWebNavigation *navigation;
603 nsIBaseWindow *window;
604 nsIWebBrowserFocus *focus;
606 nsIEditor *editor;
607 nsIController *editor_controller;
609 LONG ref;
611 nsWeakReference *weak_reference;
613 NSContainer *parent;
614 HTMLDocumentObj *doc;
616 nsIURIContentListener *content_listener;
618 HWND hwnd;
621 typedef struct {
622 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
623 void (*destructor)(HTMLDOMNode*);
624 const cpc_entry_t *cpc_entries;
625 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
626 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
627 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
628 event_target_t **(*get_event_target)(HTMLDOMNode*);
629 HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*);
630 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
631 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
632 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
633 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
634 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
635 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
636 HRESULT (*bind_to_tree)(HTMLDOMNode*);
637 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
638 void (*unlink)(HTMLDOMNode*);
639 } NodeImplVtbl;
641 struct HTMLDOMNode {
642 DispatchEx dispex;
643 IHTMLDOMNode IHTMLDOMNode_iface;
644 IHTMLDOMNode2 IHTMLDOMNode2_iface;
645 const NodeImplVtbl *vtbl;
647 nsCycleCollectingAutoRefCnt ccref;
649 nsIDOMNode *nsnode;
650 HTMLDocumentNode *doc;
651 event_target_t *event_target;
652 ConnectionPointContainer *cp_container;
655 static inline void node_addref(HTMLDOMNode *node)
657 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
660 static inline void node_release(HTMLDOMNode *node)
662 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
665 typedef struct {
666 HTMLDOMNode node;
667 ConnectionPointContainer cp_container;
669 IHTMLElement IHTMLElement_iface;
670 IHTMLElement2 IHTMLElement2_iface;
671 IHTMLElement3 IHTMLElement3_iface;
672 IHTMLElement4 IHTMLElement4_iface;
674 nsIDOMHTMLElement *nselem;
675 HTMLStyle *style;
676 HTMLStyle *runtime_style;
677 HTMLAttributeCollection *attrs;
678 WCHAR *filter;
679 } HTMLElement;
681 #define HTMLELEMENT_TIDS \
682 IHTMLDOMNode_tid, \
683 IHTMLDOMNode2_tid, \
684 IHTMLElement_tid, \
685 IHTMLElement2_tid, \
686 IHTMLElement3_tid, \
687 IHTMLElement4_tid
689 extern cp_static_data_t HTMLElementEvents2_data;
690 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
691 extern const cpc_entry_t HTMLElement_cpc[];
693 typedef struct {
694 HTMLElement element;
696 IHTMLTextContainer IHTMLTextContainer_iface;
697 } HTMLTextContainer;
699 struct HTMLFrameBase {
700 HTMLElement element;
702 IHTMLFrameBase IHTMLFrameBase_iface;
703 IHTMLFrameBase2 IHTMLFrameBase2_iface;
705 HTMLOuterWindow *content_window;
707 nsIDOMHTMLFrameElement *nsframe;
708 nsIDOMHTMLIFrameElement *nsiframe;
711 typedef struct nsDocumentEventListener nsDocumentEventListener;
713 struct HTMLDocumentNode {
714 HTMLDOMNode node;
715 HTMLDocument basedoc;
717 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
719 nsIDocumentObserver nsIDocumentObserver_iface;
721 LONG ref;
723 HTMLInnerWindow *window;
725 nsIDOMHTMLDocument *nsdoc;
726 nsIDOMNodeSelector *nsnode_selector;
727 BOOL content_ready;
728 event_target_t *body_event_target;
730 ICatInformation *catmgr;
731 nsDocumentEventListener *nsevent_listener;
732 BOOL *event_vector;
734 WCHAR **elem_vars;
735 unsigned elem_vars_size;
736 unsigned elem_vars_cnt;
738 BOOL skip_mutation_notif;
740 struct list selection_list;
741 struct list range_list;
742 struct list plugin_hosts;
745 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
746 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
747 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
748 HRESULT create_document_fragment(nsIDOMNode*,HTMLDocumentNode*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
750 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
751 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
752 HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
753 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
754 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
755 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
756 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
757 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
758 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
759 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
761 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
763 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*) DECLSPEC_HIDDEN;
764 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*) DECLSPEC_HIDDEN;
765 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
766 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
767 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
768 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN;
769 void HTMLDocument_Window_Init(HTMLDocument*) DECLSPEC_HIDDEN;
770 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
771 void HTMLDocument_Hlink_Init(HTMLDocument*) DECLSPEC_HIDDEN;
773 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
774 void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN;
776 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
778 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
780 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
781 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
783 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
784 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
786 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
787 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
788 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
789 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
791 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
792 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
793 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
795 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
796 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
797 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
799 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
801 BOOL load_gecko(void) DECLSPEC_HIDDEN;
802 void close_gecko(void) DECLSPEC_HIDDEN;
803 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
804 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*) DECLSPEC_HIDDEN;
805 void release_nsio(void) DECLSPEC_HIDDEN;
806 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
808 void init_node_cc(void);
810 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
812 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
814 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
815 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
817 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
818 void nsfree(void*) DECLSPEC_HIDDEN;
820 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
821 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
822 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
823 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
825 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
826 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
827 void nsAString_SetData(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
828 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
829 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
830 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
832 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
833 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
834 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
835 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
836 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
837 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
838 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
840 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
841 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
842 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
843 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
844 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
845 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
847 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
849 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
850 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
851 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
852 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
854 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
855 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
856 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
857 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
859 HRESULT insert_adjacent_node(HTMLElement*,const WCHAR*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
861 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
862 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
864 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
866 struct HTMLAttributeCollection {
867 DispatchEx dispex;
868 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
869 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
870 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
872 LONG ref;
874 HTMLElement *elem;
875 struct list attrs;
878 typedef struct {
879 DispatchEx dispex;
880 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
882 LONG ref;
884 WCHAR *name;
886 HTMLElement *elem;
887 DISPID dispid;
888 struct list entry;
889 } HTMLDOMAttribute;
891 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
893 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
894 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
895 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
896 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
897 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
898 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
899 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
900 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
901 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
902 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
903 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
904 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
905 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
906 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
907 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
908 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
909 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
910 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
911 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
912 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
913 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
914 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
915 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
916 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
917 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
918 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
920 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*) DECLSPEC_HIDDEN;
921 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
922 void HTMLElement2_Init(HTMLElement*) DECLSPEC_HIDDEN;
923 void HTMLElement3_Init(HTMLElement*) DECLSPEC_HIDDEN;
924 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
925 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
927 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
928 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
930 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
931 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
932 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
933 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
934 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
936 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
937 void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN;
939 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
940 HRESULT get_elem(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
942 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
944 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
945 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
946 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
948 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
950 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
951 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
952 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
954 /* commands */
955 typedef struct {
956 DWORD id;
957 HRESULT (*query)(HTMLDocument*,OLECMD*);
958 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
959 } cmdtable_t;
961 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
963 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
965 /* timer */
966 #define UPDATE_UI 0x0001
967 #define UPDATE_TITLE 0x0002
969 void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN;
970 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
971 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
973 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
975 /* editor */
976 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
977 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
978 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
979 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
980 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
981 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
982 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
983 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
984 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
986 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
988 typedef struct task_t task_t;
989 typedef void (*task_proc_t)(task_t*);
991 struct task_t {
992 LONG target_magic;
993 task_proc_t proc;
994 task_proc_t destr;
995 struct task_t *next;
998 typedef struct {
999 task_t header;
1000 HTMLDocumentObj *doc;
1001 } docobj_task_t;
1003 typedef struct {
1004 HWND thread_hwnd;
1005 task_t *task_queue_head;
1006 task_t *task_queue_tail;
1007 struct list timer_list;
1008 } thread_data_t;
1010 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1011 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1013 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1014 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1015 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1017 HRESULT set_task_timer(HTMLInnerWindow*,DWORD,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1018 HRESULT clear_task_timer(HTMLInnerWindow*,BOOL,DWORD) DECLSPEC_HIDDEN;
1020 const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
1022 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1023 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1024 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1025 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1026 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1028 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1030 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1032 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1033 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1035 /* memory allocation functions */
1037 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
1039 return HeapAlloc(GetProcessHeap(), 0, len);
1042 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
1044 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
1047 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
1049 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
1052 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1054 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1057 static inline BOOL heap_free(void *mem)
1059 return HeapFree(GetProcessHeap(), 0, mem);
1062 static inline LPWSTR heap_strdupW(LPCWSTR str)
1064 LPWSTR ret = NULL;
1066 if(str) {
1067 DWORD size;
1069 size = (strlenW(str)+1)*sizeof(WCHAR);
1070 ret = heap_alloc(size);
1071 if(ret)
1072 memcpy(ret, str, size);
1075 return ret;
1078 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1080 LPWSTR ret = NULL;
1082 if(str) {
1083 ret = heap_alloc((len+1)*sizeof(WCHAR));
1084 if(ret)
1086 memcpy(ret, str, len*sizeof(WCHAR));
1087 ret[len] = 0;
1091 return ret;
1094 static inline char *heap_strdupA(const char *str)
1096 char *ret = NULL;
1098 if(str) {
1099 DWORD size;
1101 size = strlen(str)+1;
1102 ret = heap_alloc(size);
1103 if(ret)
1104 memcpy(ret, str, size);
1107 return ret;
1110 static inline WCHAR *heap_strdupAtoW(const char *str)
1112 LPWSTR ret = NULL;
1114 if(str) {
1115 DWORD len;
1117 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1118 ret = heap_alloc(len*sizeof(WCHAR));
1119 if(ret)
1120 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1123 return ret;
1126 static inline char *heap_strdupWtoA(LPCWSTR str)
1128 char *ret = NULL;
1130 if(str) {
1131 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1132 ret = heap_alloc(size);
1133 if(ret)
1134 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1137 return ret;
1140 static inline WCHAR *heap_strdupUtoW(const char *str)
1142 WCHAR *ret = NULL;
1144 if(str) {
1145 size_t len;
1147 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1148 ret = heap_alloc(len*sizeof(WCHAR));
1149 if(ret)
1150 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1153 return ret;
1156 static inline char *heap_strdupWtoU(const WCHAR *str)
1158 char *ret = NULL;
1160 if(str) {
1161 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1162 ret = heap_alloc(size);
1163 if(ret)
1164 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1167 return ret;
1170 static inline void windowref_addref(windowref_t *ref)
1172 InterlockedIncrement(&ref->ref);
1175 static inline void windowref_release(windowref_t *ref)
1177 if(!InterlockedDecrement(&ref->ref))
1178 heap_free(ref);
1181 HDC get_display_dc(void) DECLSPEC_HIDDEN;
1182 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1183 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1185 extern HINSTANCE hInst DECLSPEC_HIDDEN;