wine/debug.h: Added debugstr_variant and debugstr_vt aliases and removed all duplicat...
[wine.git] / dlls / mshtml / mshtml_private.h
blob5424a19ed952ea39323d1fdca4028f80ec1a8faf
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(DispHTMLStyleSheetRulesCollection) \
111 XDIID(DispHTMLStyleSheetsCollection) \
112 XDIID(DispHTMLTable) \
113 XDIID(DispHTMLTableCell) \
114 XDIID(DispHTMLTableRow) \
115 XDIID(DispHTMLTextAreaElement) \
116 XDIID(DispHTMLTitleElement) \
117 XDIID(DispHTMLUnknownElement) \
118 XDIID(DispHTMLWindow2) \
119 XDIID(HTMLDocumentEvents) \
120 XDIID(HTMLElementEvents2) \
121 XIID(IHTMLAnchorElement) \
122 XIID(IHTMLAttributeCollection) \
123 XIID(IHTMLAttributeCollection2) \
124 XIID(IHTMLAttributeCollection3) \
125 XIID(IHTMLBodyElement) \
126 XIID(IHTMLBodyElement2) \
127 XIID(IHTMLButtonElement) \
128 XIID(IHTMLCommentElement) \
129 XIID(IHTMLCurrentStyle) \
130 XIID(IHTMLCurrentStyle2) \
131 XIID(IHTMLCurrentStyle3) \
132 XIID(IHTMLCurrentStyle4) \
133 XIID(IHTMLDocument2) \
134 XIID(IHTMLDocument3) \
135 XIID(IHTMLDocument4) \
136 XIID(IHTMLDocument5) \
137 XIID(IHTMLDOMAttribute) \
138 XIID(IHTMLDOMChildrenCollection) \
139 XIID(IHTMLDOMNode) \
140 XIID(IHTMLDOMNode2) \
141 XIID(IHTMLDOMTextNode) \
142 XIID(IHTMLElement) \
143 XIID(IHTMLElement2) \
144 XIID(IHTMLElement3) \
145 XIID(IHTMLElement4) \
146 XIID(IHTMLElementCollection) \
147 XIID(IHTMLEmbedElement) \
148 XIID(IHTMLEventObj) \
149 XIID(IHTMLFiltersCollection) \
150 XIID(IHTMLFormElement) \
151 XIID(IHTMLFrameBase) \
152 XIID(IHTMLFrameBase2) \
153 XIID(IHTMLFrameElement3) \
154 XIID(IHTMLGenericElement) \
155 XIID(IHTMLHeadElement) \
156 XIID(IHTMLIFrameElement) \
157 XIID(IHTMLIFrameElement2) \
158 XIID(IHTMLIFrameElement3) \
159 XIID(IHTMLImageElementFactory) \
160 XIID(IHTMLImgElement) \
161 XIID(IHTMLInputElement) \
162 XIID(IHTMLLabelElement) \
163 XIID(IHTMLLinkElement) \
164 XIID(IHTMLLocation) \
165 XIID(IHTMLMetaElement) \
166 XIID(IHTMLMimeTypesCollection) \
167 XIID(IHTMLObjectElement) \
168 XIID(IHTMLObjectElement2) \
169 XIID(IHTMLOptionElement) \
170 XIID(IHTMLOptionElementFactory) \
171 XIID(IHTMLPluginsCollection) \
172 XIID(IHTMLRect) \
173 XIID(IHTMLScreen) \
174 XIID(IHTMLScriptElement) \
175 XIID(IHTMLSelectElement) \
176 XIID(IHTMLStorage) \
177 XIID(IHTMLStyle) \
178 XIID(IHTMLStyle2) \
179 XIID(IHTMLStyle3) \
180 XIID(IHTMLStyle4) \
181 XIID(IHTMLStyle5) \
182 XIID(IHTMLStyle6) \
183 XIID(IHTMLStyleElement) \
184 XIID(IHTMLStyleSheet) \
185 XIID(IHTMLStyleSheetRulesCollection) \
186 XIID(IHTMLStyleSheetsCollection) \
187 XIID(IHTMLTable) \
188 XIID(IHTMLTable2) \
189 XIID(IHTMLTable3) \
190 XIID(IHTMLTableCell) \
191 XIID(IHTMLTableRow) \
192 XIID(IHTMLTextAreaElement) \
193 XIID(IHTMLTextContainer) \
194 XIID(IHTMLTitleElement) \
195 XIID(IHTMLUniqueName) \
196 XIID(IHTMLWindow2) \
197 XIID(IHTMLWindow3) \
198 XIID(IHTMLWindow4) \
199 XIID(IHTMLWindow5) \
200 XIID(IHTMLWindow6) \
201 XIID(IOmHistory) \
202 XIID(IOmNavigator)
204 typedef enum {
205 #define XIID(iface) iface ## _tid,
206 #define XDIID(iface) iface ## _tid,
207 TID_LIST
208 #undef XIID
209 #undef XDIID
210 LAST_tid
211 } tid_t;
213 typedef struct dispex_data_t dispex_data_t;
214 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
216 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
217 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
218 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
220 typedef struct DispatchEx DispatchEx;
222 typedef struct {
223 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
224 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
225 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
226 HRESULT (*populate_props)(DispatchEx*);
227 } dispex_static_data_vtbl_t;
229 typedef struct {
230 const dispex_static_data_vtbl_t *vtbl;
231 const tid_t disp_tid;
232 dispex_data_t *data;
233 const tid_t* const iface_tids;
234 } dispex_static_data_t;
236 struct DispatchEx {
237 IDispatchEx IDispatchEx_iface;
239 IUnknown *outer;
241 dispex_static_data_t *data;
242 dispex_dynamic_data_t *dynamic_data;
245 typedef struct {
246 void *x;
247 } nsCycleCollectingAutoRefCnt;
249 typedef struct {
250 void *x[9];
251 } nsXPCOMCycleCollectionParticipant;
253 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
255 typedef struct {
256 void (NSAPI *unmark_if_purple)(void*);
257 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
258 nsresult (NSAPI *unlink)(void*);
259 } CCObjCallback;
261 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
263 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*);
264 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*);
265 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt);
266 void (__cdecl *ccref_unmark_if_purple)(nsCycleCollectingAutoRefCnt*);
267 void (__cdecl *ccp_init)(nsXPCOMCycleCollectionParticipant*,const CCObjCallback*);
268 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*);
269 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*);
271 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN;
272 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
273 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
274 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
275 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
276 HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*) DECLSPEC_HIDDEN;
277 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
278 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
279 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
280 void release_typelib(void) DECLSPEC_HIDDEN;
281 HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
283 typedef enum {
284 DISPEXPROP_CUSTOM,
285 DISPEXPROP_DYNAMIC,
286 DISPEXPROP_BUILTIN
287 } dispex_prop_type_t;
289 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
291 typedef struct HTMLWindow HTMLWindow;
292 typedef struct HTMLInnerWindow HTMLInnerWindow;
293 typedef struct HTMLOuterWindow HTMLOuterWindow;
294 typedef struct HTMLDocumentNode HTMLDocumentNode;
295 typedef struct HTMLDocumentObj HTMLDocumentObj;
296 typedef struct HTMLFrameBase HTMLFrameBase;
297 typedef struct NSContainer NSContainer;
298 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
300 typedef enum {
301 SCRIPTMODE_GECKO,
302 SCRIPTMODE_ACTIVESCRIPT
303 } SCRIPTMODE;
305 typedef struct ScriptHost ScriptHost;
307 typedef enum {
308 GLOBAL_SCRIPTVAR,
309 GLOBAL_ELEMENTVAR,
310 GLOBAL_DISPEXVAR,
311 GLOBAL_FRAMEVAR
312 } global_prop_type_t;
314 typedef struct {
315 global_prop_type_t type;
316 WCHAR *name;
317 ScriptHost *script_host;
318 DISPID id;
319 } global_prop_t;
321 typedef struct {
322 DispatchEx dispex;
323 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
325 LONG ref;
327 HTMLInnerWindow *window;
328 } HTMLOptionElementFactory;
330 typedef struct {
331 DispatchEx dispex;
332 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
334 LONG ref;
336 HTMLInnerWindow *window;
337 } HTMLImageElementFactory;
339 struct HTMLLocation {
340 DispatchEx dispex;
341 IHTMLLocation IHTMLLocation_iface;
343 LONG ref;
345 HTMLInnerWindow *window;
348 typedef struct {
349 DispatchEx dispex;
350 IOmHistory IOmHistory_iface;
352 LONG ref;
354 HTMLInnerWindow *window;
355 } OmHistory;
357 typedef struct {
358 HTMLOuterWindow *window;
359 LONG ref;
360 } windowref_t;
362 typedef struct nsChannelBSC nsChannelBSC;
364 struct HTMLWindow {
365 IHTMLWindow2 IHTMLWindow2_iface;
366 IHTMLWindow3 IHTMLWindow3_iface;
367 IHTMLWindow4 IHTMLWindow4_iface;
368 IHTMLWindow5 IHTMLWindow5_iface;
369 IHTMLWindow6 IHTMLWindow6_iface;
370 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
371 IDispatchEx IDispatchEx_iface;
372 IServiceProvider IServiceProvider_iface;
373 ITravelLogClient ITravelLogClient_iface;
374 IObjectIdentity IObjectIdentity_iface;
376 LONG ref;
378 HTMLInnerWindow *inner_window;
379 HTMLOuterWindow *outer_window;
382 struct HTMLOuterWindow {
383 HTMLWindow base;
385 windowref_t *window_ref;
386 LONG task_magic;
388 HTMLDocumentObj *doc_obj;
389 nsIDOMWindow *nswindow;
390 HTMLOuterWindow *parent;
391 HTMLFrameBase *frame_element;
393 READYSTATE readystate;
394 BOOL readystate_locked;
395 unsigned readystate_pending;
397 HTMLInnerWindow *pending_window;
398 IMoniker *mon;
399 IUri *uri;
400 IUri *uri_nofrag;
401 BSTR url;
402 DWORD load_flags;
404 SCRIPTMODE scriptmode;
406 IInternetSecurityManager *secmgr;
408 struct list children;
409 struct list sibling_entry;
410 struct list entry;
413 struct HTMLInnerWindow {
414 HTMLWindow base;
415 DispatchEx dispex;
417 HTMLDocumentNode *doc;
419 struct list script_hosts;
421 IHTMLEventObj *event;
423 HTMLImageElementFactory *image_factory;
424 HTMLOptionElementFactory *option_factory;
425 IHTMLScreen *screen;
426 OmHistory *history;
427 IHTMLStorage *session_storage;
429 unsigned parser_callback_cnt;
430 struct list script_queue;
432 global_prop_t *global_props;
433 DWORD global_prop_cnt;
434 DWORD global_prop_size;
436 LONG task_magic;
438 HTMLLocation *location;
440 IMoniker *mon;
441 nsChannelBSC *bscallback;
442 struct list bindings;
445 typedef enum {
446 UNKNOWN_USERMODE,
447 BROWSEMODE,
448 EDITMODE
449 } USERMODE;
451 typedef struct _cp_static_data_t {
452 tid_t tid;
453 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
454 BOOL pass_event_arg;
455 DWORD id_cnt;
456 DISPID *ids;
457 } cp_static_data_t;
459 typedef struct {
460 const IID *riid;
461 cp_static_data_t *desc;
462 } cpc_entry_t;
464 typedef struct ConnectionPointContainer {
465 IConnectionPointContainer IConnectionPointContainer_iface;
467 ConnectionPoint *cps;
468 const cpc_entry_t *cp_entries;
469 IUnknown *outer;
470 struct ConnectionPointContainer *forward_container;
471 } ConnectionPointContainer;
473 struct ConnectionPoint {
474 IConnectionPoint IConnectionPoint_iface;
476 ConnectionPointContainer *container;
478 union {
479 IUnknown *unk;
480 IDispatch *disp;
481 IPropertyNotifySink *propnotif;
482 } *sinks;
483 DWORD sinks_size;
485 const IID *iid;
486 cp_static_data_t *data;
489 struct HTMLDocument {
490 IHTMLDocument2 IHTMLDocument2_iface;
491 IHTMLDocument3 IHTMLDocument3_iface;
492 IHTMLDocument4 IHTMLDocument4_iface;
493 IHTMLDocument5 IHTMLDocument5_iface;
494 IHTMLDocument6 IHTMLDocument6_iface;
495 IHTMLDocument7 IHTMLDocument7_iface;
496 IPersistMoniker IPersistMoniker_iface;
497 IPersistFile IPersistFile_iface;
498 IPersistHistory IPersistHistory_iface;
499 IMonikerProp IMonikerProp_iface;
500 IOleObject IOleObject_iface;
501 IOleDocument IOleDocument_iface;
502 IOleDocumentView IOleDocumentView_iface;
503 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
504 IViewObjectEx IViewObjectEx_iface;
505 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
506 IServiceProvider IServiceProvider_iface;
507 IOleCommandTarget IOleCommandTarget_iface;
508 IOleControl IOleControl_iface;
509 IHlinkTarget IHlinkTarget_iface;
510 IPersistStreamInit IPersistStreamInit_iface;
511 IDispatchEx IDispatchEx_iface;
512 ISupportErrorInfo ISupportErrorInfo_iface;
513 IObjectWithSite IObjectWithSite_iface;
514 IOleContainer IOleContainer_iface;
515 IObjectSafety IObjectSafety_iface;
516 IProvideClassInfo IProvideClassInfo_iface;
518 IUnknown *unk_impl;
519 IDispatchEx *dispex;
521 HTMLDocumentObj *doc_obj;
522 HTMLDocumentNode *doc_node;
524 HTMLOuterWindow *window;
526 LONG task_magic;
528 ConnectionPointContainer cp_container;
529 IOleAdviseHolder *advise_holder;
532 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
534 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
537 static inline ULONG htmldoc_addref(HTMLDocument *This)
539 return IUnknown_AddRef(This->unk_impl);
542 static inline ULONG htmldoc_release(HTMLDocument *This)
544 return IUnknown_Release(This->unk_impl);
547 struct HTMLDocumentObj {
548 HTMLDocument basedoc;
549 DispatchEx dispex;
550 ICustomDoc ICustomDoc_iface;
551 ITargetContainer ITargetContainer_iface;
553 IWindowForBindingUI IWindowForBindingUI_iface;
555 LONG ref;
557 NSContainer *nscontainer;
559 IOleClientSite *client;
560 IDocHostUIHandler *hostui;
561 IOleCommandTarget *client_cmdtrg;
562 BOOL custom_hostui;
563 IOleInPlaceSite *ipsite;
564 IOleInPlaceFrame *frame;
565 IOleInPlaceUIWindow *ip_window;
566 IAdviseSink *view_sink;
567 IDocObjectService *doc_object_service;
568 IUnknown *webbrowser;
569 ITravelLog *travel_log;
570 IUnknown *browser_service;
572 DOCHOSTUIINFO hostinfo;
574 IOleUndoManager *undomgr;
576 HWND hwnd;
577 HWND tooltips_hwnd;
579 BOOL request_uiactivate;
580 BOOL in_place_active;
581 BOOL ui_active;
582 BOOL window_active;
583 BOOL hostui_setup;
584 BOOL container_locked;
585 BOOL focus;
586 BOOL has_popup;
587 INT download_state;
589 USERMODE usermode;
590 LPWSTR mime;
592 DWORD update;
595 typedef struct nsWeakReference nsWeakReference;
597 struct NSContainer {
598 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
599 nsIContextMenuListener nsIContextMenuListener_iface;
600 nsIURIContentListener nsIURIContentListener_iface;
601 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
602 nsITooltipListener nsITooltipListener_iface;
603 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
604 nsISupportsWeakReference nsISupportsWeakReference_iface;
606 nsIWebBrowser *webbrowser;
607 nsIWebNavigation *navigation;
608 nsIBaseWindow *window;
609 nsIWebBrowserFocus *focus;
611 nsIEditor *editor;
612 nsIController *editor_controller;
614 LONG ref;
616 nsWeakReference *weak_reference;
618 NSContainer *parent;
619 HTMLDocumentObj *doc;
621 nsIURIContentListener *content_listener;
623 HWND hwnd;
626 typedef struct {
627 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
628 void (*destructor)(HTMLDOMNode*);
629 const cpc_entry_t *cpc_entries;
630 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
631 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
632 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
633 event_target_t **(*get_event_target)(HTMLDOMNode*);
634 HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*);
635 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
636 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
637 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
638 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
639 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
640 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
641 HRESULT (*bind_to_tree)(HTMLDOMNode*);
642 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
643 void (*unlink)(HTMLDOMNode*);
644 } NodeImplVtbl;
646 struct HTMLDOMNode {
647 DispatchEx dispex;
648 IHTMLDOMNode IHTMLDOMNode_iface;
649 IHTMLDOMNode2 IHTMLDOMNode2_iface;
650 const NodeImplVtbl *vtbl;
652 nsCycleCollectingAutoRefCnt ccref;
654 nsIDOMNode *nsnode;
655 HTMLDocumentNode *doc;
656 event_target_t *event_target;
657 ConnectionPointContainer *cp_container;
660 static inline void node_addref(HTMLDOMNode *node)
662 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
665 static inline void node_release(HTMLDOMNode *node)
667 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
670 typedef struct {
671 HTMLDOMNode node;
672 ConnectionPointContainer cp_container;
674 IHTMLElement IHTMLElement_iface;
675 IHTMLElement2 IHTMLElement2_iface;
676 IHTMLElement3 IHTMLElement3_iface;
677 IHTMLElement4 IHTMLElement4_iface;
679 nsIDOMHTMLElement *nselem;
680 HTMLStyle *style;
681 HTMLStyle *runtime_style;
682 HTMLAttributeCollection *attrs;
683 WCHAR *filter;
684 } HTMLElement;
686 #define HTMLELEMENT_TIDS \
687 IHTMLDOMNode_tid, \
688 IHTMLDOMNode2_tid, \
689 IHTMLElement_tid, \
690 IHTMLElement2_tid, \
691 IHTMLElement3_tid, \
692 IHTMLElement4_tid
694 extern cp_static_data_t HTMLElementEvents2_data;
695 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
696 extern const cpc_entry_t HTMLElement_cpc[];
698 typedef struct {
699 HTMLElement element;
701 IHTMLTextContainer IHTMLTextContainer_iface;
702 } HTMLTextContainer;
704 struct HTMLFrameBase {
705 HTMLElement element;
707 IHTMLFrameBase IHTMLFrameBase_iface;
708 IHTMLFrameBase2 IHTMLFrameBase2_iface;
710 HTMLOuterWindow *content_window;
712 nsIDOMHTMLFrameElement *nsframe;
713 nsIDOMHTMLIFrameElement *nsiframe;
716 typedef struct nsDocumentEventListener nsDocumentEventListener;
718 struct HTMLDocumentNode {
719 HTMLDOMNode node;
720 HTMLDocument basedoc;
722 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
724 nsIDocumentObserver nsIDocumentObserver_iface;
726 LONG ref;
728 HTMLInnerWindow *window;
730 nsIDOMHTMLDocument *nsdoc;
731 nsIDOMNodeSelector *nsnode_selector;
732 BOOL content_ready;
733 event_target_t *body_event_target;
735 ICatInformation *catmgr;
736 nsDocumentEventListener *nsevent_listener;
737 BOOL *event_vector;
739 WCHAR **elem_vars;
740 unsigned elem_vars_size;
741 unsigned elem_vars_cnt;
743 BOOL skip_mutation_notif;
745 struct list selection_list;
746 struct list range_list;
747 struct list plugin_hosts;
750 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
751 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
752 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
753 HRESULT create_document_fragment(nsIDOMNode*,HTMLDocumentNode*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
755 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
756 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
757 HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
758 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
759 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
760 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
761 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
762 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
763 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
764 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
766 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
768 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
769 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
770 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
771 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN;
772 void HTMLDocument_Window_Init(HTMLDocument*) DECLSPEC_HIDDEN;
773 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
774 void HTMLDocument_Hlink_Init(HTMLDocument*) DECLSPEC_HIDDEN;
776 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
777 void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN;
779 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
781 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
783 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
784 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
786 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
787 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
789 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
790 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
791 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
792 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
794 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
795 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
796 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
798 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
799 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
800 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
802 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
804 BOOL load_gecko(void) DECLSPEC_HIDDEN;
805 void close_gecko(void) DECLSPEC_HIDDEN;
806 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
807 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*) DECLSPEC_HIDDEN;
808 void release_nsio(void) DECLSPEC_HIDDEN;
809 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
811 void init_node_cc(void);
813 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
815 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
817 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
818 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
820 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
821 void nsfree(void*) DECLSPEC_HIDDEN;
823 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
824 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
825 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
826 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
828 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
829 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
830 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
831 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
832 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
834 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
835 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
836 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
837 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
838 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
839 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
840 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
842 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
843 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
844 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
845 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
846 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
847 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
849 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
851 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
852 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
853 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
854 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
856 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
857 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
858 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
859 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
861 HRESULT insert_adjacent_node(HTMLElement*,const WCHAR*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
863 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
864 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
866 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
868 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
869 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
872 struct HTMLAttributeCollection {
873 DispatchEx dispex;
874 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
875 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
876 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
878 LONG ref;
880 HTMLElement *elem;
881 struct list attrs;
884 typedef struct {
885 DispatchEx dispex;
886 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
888 LONG ref;
890 WCHAR *name;
892 HTMLElement *elem;
893 DISPID dispid;
894 struct list entry;
895 } HTMLDOMAttribute;
897 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
899 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
900 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
901 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
902 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
903 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
904 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
905 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
906 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
907 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
908 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
909 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
910 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
911 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
912 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
913 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
914 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
915 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
916 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
917 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
918 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
919 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
920 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
921 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
922 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
923 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
924 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
926 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*) DECLSPEC_HIDDEN;
927 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
928 void HTMLElement2_Init(HTMLElement*) DECLSPEC_HIDDEN;
929 void HTMLElement3_Init(HTMLElement*) DECLSPEC_HIDDEN;
930 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
931 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
933 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
934 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
936 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
937 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
938 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
939 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
940 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
942 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
943 void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN;
945 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
946 HRESULT get_elem(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
948 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
950 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
951 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
952 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
953 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
955 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
957 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
958 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
959 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
961 nsresult get_elem_attr_value(nsIDOMHTMLElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
962 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
963 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
965 /* commands */
966 typedef struct {
967 DWORD id;
968 HRESULT (*query)(HTMLDocument*,OLECMD*);
969 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
970 } cmdtable_t;
972 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
974 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
976 /* timer */
977 #define UPDATE_UI 0x0001
978 #define UPDATE_TITLE 0x0002
980 void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN;
981 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
982 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
984 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
986 /* editor */
987 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
988 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
989 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
990 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
991 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
992 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
993 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
994 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
995 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
997 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
999 typedef struct task_t task_t;
1000 typedef void (*task_proc_t)(task_t*);
1002 struct task_t {
1003 LONG target_magic;
1004 task_proc_t proc;
1005 task_proc_t destr;
1006 struct task_t *next;
1009 typedef struct {
1010 task_t header;
1011 HTMLDocumentObj *doc;
1012 } docobj_task_t;
1014 typedef struct {
1015 HWND thread_hwnd;
1016 task_t *task_queue_head;
1017 task_t *task_queue_tail;
1018 struct list timer_list;
1019 } thread_data_t;
1021 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1022 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1024 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1025 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1026 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1028 HRESULT set_task_timer(HTMLInnerWindow*,DWORD,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1029 HRESULT clear_task_timer(HTMLInnerWindow*,BOOL,DWORD) DECLSPEC_HIDDEN;
1031 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1033 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1034 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1035 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1036 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1037 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1039 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1041 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1043 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1044 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1046 /* memory allocation functions */
1048 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
1050 return HeapAlloc(GetProcessHeap(), 0, len);
1053 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
1055 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
1058 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
1060 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
1063 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1065 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1068 static inline BOOL heap_free(void *mem)
1070 return HeapFree(GetProcessHeap(), 0, mem);
1073 static inline LPWSTR heap_strdupW(LPCWSTR str)
1075 LPWSTR ret = NULL;
1077 if(str) {
1078 DWORD size;
1080 size = (strlenW(str)+1)*sizeof(WCHAR);
1081 ret = heap_alloc(size);
1082 if(ret)
1083 memcpy(ret, str, size);
1086 return ret;
1089 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1091 LPWSTR ret = NULL;
1093 if(str) {
1094 ret = heap_alloc((len+1)*sizeof(WCHAR));
1095 if(ret)
1097 memcpy(ret, str, len*sizeof(WCHAR));
1098 ret[len] = 0;
1102 return ret;
1105 static inline char *heap_strdupA(const char *str)
1107 char *ret = NULL;
1109 if(str) {
1110 DWORD size;
1112 size = strlen(str)+1;
1113 ret = heap_alloc(size);
1114 if(ret)
1115 memcpy(ret, str, size);
1118 return ret;
1121 static inline WCHAR *heap_strdupAtoW(const char *str)
1123 LPWSTR ret = NULL;
1125 if(str) {
1126 DWORD len;
1128 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1129 ret = heap_alloc(len*sizeof(WCHAR));
1130 if(ret)
1131 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1134 return ret;
1137 static inline char *heap_strdupWtoA(LPCWSTR str)
1139 char *ret = NULL;
1141 if(str) {
1142 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1143 ret = heap_alloc(size);
1144 if(ret)
1145 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1148 return ret;
1151 static inline WCHAR *heap_strdupUtoW(const char *str)
1153 WCHAR *ret = NULL;
1155 if(str) {
1156 size_t len;
1158 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1159 ret = heap_alloc(len*sizeof(WCHAR));
1160 if(ret)
1161 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1164 return ret;
1167 static inline char *heap_strdupWtoU(const WCHAR *str)
1169 char *ret = NULL;
1171 if(str) {
1172 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1173 ret = heap_alloc(size);
1174 if(ret)
1175 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1178 return ret;
1181 static inline void windowref_addref(windowref_t *ref)
1183 InterlockedIncrement(&ref->ref);
1186 static inline void windowref_release(windowref_t *ref)
1188 if(!InterlockedDecrement(&ref->ref))
1189 heap_free(ref);
1192 HDC get_display_dc(void) DECLSPEC_HIDDEN;
1193 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1194 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1196 extern HINSTANCE hInst DECLSPEC_HIDDEN;