mshtml: Wine Gecko 2.34-beta2 release.
[wine/wine-gecko.git] / dlls / mshtml / mshtml_private.h
blob1c932f2c6d7e5dd911ce6c24287b69b2b70e9461
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(IHTMLDOMImplementation) \
140 XIID(IHTMLDOMNode) \
141 XIID(IHTMLDOMNode2) \
142 XIID(IHTMLDOMTextNode) \
143 XIID(IHTMLElement) \
144 XIID(IHTMLElement2) \
145 XIID(IHTMLElement3) \
146 XIID(IHTMLElement4) \
147 XIID(IHTMLElementCollection) \
148 XIID(IHTMLEmbedElement) \
149 XIID(IHTMLEventObj) \
150 XIID(IHTMLFiltersCollection) \
151 XIID(IHTMLFormElement) \
152 XIID(IHTMLFrameBase) \
153 XIID(IHTMLFrameBase2) \
154 XIID(IHTMLFrameElement3) \
155 XIID(IHTMLGenericElement) \
156 XIID(IHTMLHeadElement) \
157 XIID(IHTMLIFrameElement) \
158 XIID(IHTMLIFrameElement2) \
159 XIID(IHTMLIFrameElement3) \
160 XIID(IHTMLImageElementFactory) \
161 XIID(IHTMLImgElement) \
162 XIID(IHTMLInputElement) \
163 XIID(IHTMLLabelElement) \
164 XIID(IHTMLLinkElement) \
165 XIID(IHTMLLocation) \
166 XIID(IHTMLMetaElement) \
167 XIID(IHTMLMimeTypesCollection) \
168 XIID(IHTMLObjectElement) \
169 XIID(IHTMLObjectElement2) \
170 XIID(IHTMLOptionElement) \
171 XIID(IHTMLOptionElementFactory) \
172 XIID(IHTMLPluginsCollection) \
173 XIID(IHTMLRect) \
174 XIID(IHTMLScreen) \
175 XIID(IHTMLScriptElement) \
176 XIID(IHTMLSelectElement) \
177 XIID(IHTMLStorage) \
178 XIID(IHTMLStyle) \
179 XIID(IHTMLStyle2) \
180 XIID(IHTMLStyle3) \
181 XIID(IHTMLStyle4) \
182 XIID(IHTMLStyle5) \
183 XIID(IHTMLStyle6) \
184 XIID(IHTMLStyleElement) \
185 XIID(IHTMLStyleSheet) \
186 XIID(IHTMLStyleSheetRulesCollection) \
187 XIID(IHTMLStyleSheetsCollection) \
188 XIID(IHTMLTable) \
189 XIID(IHTMLTable2) \
190 XIID(IHTMLTable3) \
191 XIID(IHTMLTableCell) \
192 XIID(IHTMLTableRow) \
193 XIID(IHTMLTextAreaElement) \
194 XIID(IHTMLTextContainer) \
195 XIID(IHTMLTitleElement) \
196 XIID(IHTMLUniqueName) \
197 XIID(IHTMLWindow2) \
198 XIID(IHTMLWindow3) \
199 XIID(IHTMLWindow4) \
200 XIID(IHTMLWindow5) \
201 XIID(IHTMLWindow6) \
202 XIID(IOmHistory) \
203 XIID(IOmNavigator)
205 typedef enum {
206 #define XIID(iface) iface ## _tid,
207 #define XDIID(iface) iface ## _tid,
208 TID_LIST
209 #undef XIID
210 #undef XDIID
211 LAST_tid
212 } tid_t;
214 typedef struct dispex_data_t dispex_data_t;
215 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
217 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
218 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
219 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
221 typedef struct DispatchEx DispatchEx;
223 typedef struct {
224 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
225 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
226 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
227 HRESULT (*populate_props)(DispatchEx*);
228 } dispex_static_data_vtbl_t;
230 typedef struct {
231 const dispex_static_data_vtbl_t *vtbl;
232 const tid_t disp_tid;
233 dispex_data_t *data;
234 const tid_t* const iface_tids;
235 } dispex_static_data_t;
237 struct DispatchEx {
238 IDispatchEx IDispatchEx_iface;
240 IUnknown *outer;
242 dispex_static_data_t *data;
243 dispex_dynamic_data_t *dynamic_data;
246 typedef struct {
247 UINT_PTR x;
248 } nsCycleCollectingAutoRefCnt;
250 typedef struct {
251 void *vtbl;
252 int ref_flags;
253 void *callbacks;
254 } ExternalCycleCollectionParticipant;
256 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
258 typedef struct {
259 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
260 nsresult (NSAPI *unlink)(void*);
261 void (NSAPI *delete_cycle_collectable)(void*);
262 } CCObjCallback;
264 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
266 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*);
267 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*);
268 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt);
269 void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*);
270 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*);
271 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*);
273 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN;
274 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
275 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
276 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
277 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
278 HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*) DECLSPEC_HIDDEN;
279 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
280 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
281 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
282 void release_typelib(void) DECLSPEC_HIDDEN;
283 HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
285 typedef enum {
286 DISPEXPROP_CUSTOM,
287 DISPEXPROP_DYNAMIC,
288 DISPEXPROP_BUILTIN
289 } dispex_prop_type_t;
291 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
293 typedef struct HTMLWindow HTMLWindow;
294 typedef struct HTMLInnerWindow HTMLInnerWindow;
295 typedef struct HTMLOuterWindow HTMLOuterWindow;
296 typedef struct HTMLDocumentNode HTMLDocumentNode;
297 typedef struct HTMLDocumentObj HTMLDocumentObj;
298 typedef struct HTMLFrameBase HTMLFrameBase;
299 typedef struct NSContainer NSContainer;
300 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
302 typedef enum {
303 SCRIPTMODE_GECKO,
304 SCRIPTMODE_ACTIVESCRIPT
305 } SCRIPTMODE;
307 typedef struct ScriptHost ScriptHost;
309 typedef enum {
310 GLOBAL_SCRIPTVAR,
311 GLOBAL_ELEMENTVAR,
312 GLOBAL_DISPEXVAR,
313 GLOBAL_FRAMEVAR
314 } global_prop_type_t;
316 typedef struct {
317 global_prop_type_t type;
318 WCHAR *name;
319 ScriptHost *script_host;
320 DISPID id;
321 } global_prop_t;
323 typedef struct {
324 DispatchEx dispex;
325 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
327 LONG ref;
329 HTMLInnerWindow *window;
330 } HTMLOptionElementFactory;
332 typedef struct {
333 DispatchEx dispex;
334 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
336 LONG ref;
338 HTMLInnerWindow *window;
339 } HTMLImageElementFactory;
341 struct HTMLLocation {
342 DispatchEx dispex;
343 IHTMLLocation IHTMLLocation_iface;
345 LONG ref;
347 HTMLInnerWindow *window;
350 typedef struct {
351 DispatchEx dispex;
352 IOmHistory IOmHistory_iface;
354 LONG ref;
356 HTMLInnerWindow *window;
357 } OmHistory;
359 typedef struct {
360 HTMLOuterWindow *window;
361 LONG ref;
362 } windowref_t;
364 typedef struct nsChannelBSC nsChannelBSC;
366 struct HTMLWindow {
367 IHTMLWindow2 IHTMLWindow2_iface;
368 IHTMLWindow3 IHTMLWindow3_iface;
369 IHTMLWindow4 IHTMLWindow4_iface;
370 IHTMLWindow5 IHTMLWindow5_iface;
371 IHTMLWindow6 IHTMLWindow6_iface;
372 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
373 IDispatchEx IDispatchEx_iface;
374 IServiceProvider IServiceProvider_iface;
375 ITravelLogClient ITravelLogClient_iface;
376 IObjectIdentity IObjectIdentity_iface;
378 LONG ref;
380 HTMLInnerWindow *inner_window;
381 HTMLOuterWindow *outer_window;
384 struct HTMLOuterWindow {
385 HTMLWindow base;
387 windowref_t *window_ref;
388 LONG task_magic;
390 HTMLDocumentObj *doc_obj;
391 nsIDOMWindow *nswindow;
392 HTMLOuterWindow *parent;
393 HTMLFrameBase *frame_element;
395 READYSTATE readystate;
396 BOOL readystate_locked;
397 unsigned readystate_pending;
399 HTMLInnerWindow *pending_window;
400 IMoniker *mon;
401 IUri *uri;
402 IUri *uri_nofrag;
403 BSTR url;
404 DWORD load_flags;
406 SCRIPTMODE scriptmode;
408 IInternetSecurityManager *secmgr;
410 struct list children;
411 struct list sibling_entry;
412 struct list entry;
415 struct HTMLInnerWindow {
416 HTMLWindow base;
417 DispatchEx dispex;
419 HTMLDocumentNode *doc;
421 struct list script_hosts;
423 IHTMLEventObj *event;
425 HTMLImageElementFactory *image_factory;
426 HTMLOptionElementFactory *option_factory;
427 IHTMLScreen *screen;
428 OmHistory *history;
429 IHTMLStorage *session_storage;
431 unsigned parser_callback_cnt;
432 struct list script_queue;
434 global_prop_t *global_props;
435 DWORD global_prop_cnt;
436 DWORD global_prop_size;
438 LONG task_magic;
440 HTMLLocation *location;
442 IMoniker *mon;
443 nsChannelBSC *bscallback;
444 struct list bindings;
447 typedef enum {
448 UNKNOWN_USERMODE,
449 BROWSEMODE,
450 EDITMODE
451 } USERMODE;
453 typedef struct _cp_static_data_t {
454 tid_t tid;
455 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
456 BOOL pass_event_arg;
457 DWORD id_cnt;
458 DISPID *ids;
459 } cp_static_data_t;
461 typedef struct {
462 const IID *riid;
463 cp_static_data_t *desc;
464 } cpc_entry_t;
466 typedef struct ConnectionPointContainer {
467 IConnectionPointContainer IConnectionPointContainer_iface;
469 ConnectionPoint *cps;
470 const cpc_entry_t *cp_entries;
471 IUnknown *outer;
472 struct ConnectionPointContainer *forward_container;
473 } ConnectionPointContainer;
475 struct ConnectionPoint {
476 IConnectionPoint IConnectionPoint_iface;
478 ConnectionPointContainer *container;
480 union {
481 IUnknown *unk;
482 IDispatch *disp;
483 IPropertyNotifySink *propnotif;
484 } *sinks;
485 DWORD sinks_size;
487 const IID *iid;
488 cp_static_data_t *data;
491 struct HTMLDocument {
492 IHTMLDocument2 IHTMLDocument2_iface;
493 IHTMLDocument3 IHTMLDocument3_iface;
494 IHTMLDocument4 IHTMLDocument4_iface;
495 IHTMLDocument5 IHTMLDocument5_iface;
496 IHTMLDocument6 IHTMLDocument6_iface;
497 IHTMLDocument7 IHTMLDocument7_iface;
498 IPersistMoniker IPersistMoniker_iface;
499 IPersistFile IPersistFile_iface;
500 IPersistHistory IPersistHistory_iface;
501 IMonikerProp IMonikerProp_iface;
502 IOleObject IOleObject_iface;
503 IOleDocument IOleDocument_iface;
504 IOleDocumentView IOleDocumentView_iface;
505 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
506 IViewObjectEx IViewObjectEx_iface;
507 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
508 IServiceProvider IServiceProvider_iface;
509 IOleCommandTarget IOleCommandTarget_iface;
510 IOleControl IOleControl_iface;
511 IHlinkTarget IHlinkTarget_iface;
512 IPersistStreamInit IPersistStreamInit_iface;
513 IDispatchEx IDispatchEx_iface;
514 ISupportErrorInfo ISupportErrorInfo_iface;
515 IObjectWithSite IObjectWithSite_iface;
516 IOleContainer IOleContainer_iface;
517 IObjectSafety IObjectSafety_iface;
518 IProvideClassInfo IProvideClassInfo_iface;
520 IUnknown *unk_impl;
521 IDispatchEx *dispex;
523 HTMLDocumentObj *doc_obj;
524 HTMLDocumentNode *doc_node;
526 HTMLOuterWindow *window;
528 LONG task_magic;
530 ConnectionPointContainer cp_container;
531 IOleAdviseHolder *advise_holder;
534 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
536 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
539 static inline ULONG htmldoc_addref(HTMLDocument *This)
541 return IUnknown_AddRef(This->unk_impl);
544 static inline ULONG htmldoc_release(HTMLDocument *This)
546 return IUnknown_Release(This->unk_impl);
549 struct HTMLDocumentObj {
550 HTMLDocument basedoc;
551 DispatchEx dispex;
552 ICustomDoc ICustomDoc_iface;
553 ITargetContainer ITargetContainer_iface;
555 IWindowForBindingUI IWindowForBindingUI_iface;
557 LONG ref;
559 NSContainer *nscontainer;
561 IOleClientSite *client;
562 IDocHostUIHandler *hostui;
563 IOleCommandTarget *client_cmdtrg;
564 BOOL custom_hostui;
565 IOleInPlaceSite *ipsite;
566 IOleInPlaceFrame *frame;
567 IOleInPlaceUIWindow *ip_window;
568 IAdviseSink *view_sink;
569 IDocObjectService *doc_object_service;
570 IUnknown *webbrowser;
571 ITravelLog *travel_log;
572 IUnknown *browser_service;
574 DOCHOSTUIINFO hostinfo;
576 IOleUndoManager *undomgr;
578 HWND hwnd;
579 HWND tooltips_hwnd;
581 BOOL request_uiactivate;
582 BOOL in_place_active;
583 BOOL ui_active;
584 BOOL window_active;
585 BOOL hostui_setup;
586 BOOL container_locked;
587 BOOL focus;
588 BOOL has_popup;
589 INT download_state;
591 USERMODE usermode;
592 LPWSTR mime;
594 DWORD update;
597 typedef struct nsWeakReference nsWeakReference;
599 struct NSContainer {
600 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
601 nsIContextMenuListener nsIContextMenuListener_iface;
602 nsIURIContentListener nsIURIContentListener_iface;
603 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
604 nsITooltipListener nsITooltipListener_iface;
605 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
606 nsISupportsWeakReference nsISupportsWeakReference_iface;
608 nsIWebBrowser *webbrowser;
609 nsIWebNavigation *navigation;
610 nsIBaseWindow *window;
611 nsIWebBrowserFocus *focus;
613 nsIEditor *editor;
614 nsIController *editor_controller;
616 LONG ref;
618 nsWeakReference *weak_reference;
620 NSContainer *parent;
621 HTMLDocumentObj *doc;
623 nsIURIContentListener *content_listener;
625 HWND hwnd;
628 typedef struct {
629 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
630 void (*destructor)(HTMLDOMNode*);
631 const cpc_entry_t *cpc_entries;
632 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
633 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
634 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
635 event_target_t **(*get_event_target)(HTMLDOMNode*);
636 HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*);
637 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
638 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
639 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
640 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
641 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
642 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
643 HRESULT (*bind_to_tree)(HTMLDOMNode*);
644 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
645 void (*unlink)(HTMLDOMNode*);
646 } NodeImplVtbl;
648 struct HTMLDOMNode {
649 DispatchEx dispex;
650 IHTMLDOMNode IHTMLDOMNode_iface;
651 IHTMLDOMNode2 IHTMLDOMNode2_iface;
652 const NodeImplVtbl *vtbl;
654 nsCycleCollectingAutoRefCnt ccref;
656 nsIDOMNode *nsnode;
657 HTMLDocumentNode *doc;
658 event_target_t *event_target;
659 ConnectionPointContainer *cp_container;
662 static inline void node_addref(HTMLDOMNode *node)
664 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
667 static inline void node_release(HTMLDOMNode *node)
669 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
672 typedef struct {
673 HTMLDOMNode node;
674 ConnectionPointContainer cp_container;
676 IHTMLElement IHTMLElement_iface;
677 IHTMLElement2 IHTMLElement2_iface;
678 IHTMLElement3 IHTMLElement3_iface;
679 IHTMLElement4 IHTMLElement4_iface;
681 nsIDOMHTMLElement *nselem;
682 HTMLStyle *style;
683 HTMLStyle *runtime_style;
684 HTMLAttributeCollection *attrs;
685 WCHAR *filter;
686 } HTMLElement;
688 #define HTMLELEMENT_TIDS \
689 IHTMLDOMNode_tid, \
690 IHTMLDOMNode2_tid, \
691 IHTMLElement_tid, \
692 IHTMLElement2_tid, \
693 IHTMLElement3_tid, \
694 IHTMLElement4_tid
696 extern cp_static_data_t HTMLElementEvents2_data;
697 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
698 extern const cpc_entry_t HTMLElement_cpc[];
700 typedef struct {
701 HTMLElement element;
703 IHTMLTextContainer IHTMLTextContainer_iface;
704 } HTMLTextContainer;
706 struct HTMLFrameBase {
707 HTMLElement element;
709 IHTMLFrameBase IHTMLFrameBase_iface;
710 IHTMLFrameBase2 IHTMLFrameBase2_iface;
712 HTMLOuterWindow *content_window;
714 nsIDOMHTMLFrameElement *nsframe;
715 nsIDOMHTMLIFrameElement *nsiframe;
718 typedef struct nsDocumentEventListener nsDocumentEventListener;
720 struct HTMLDocumentNode {
721 HTMLDOMNode node;
722 HTMLDocument basedoc;
724 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
726 nsIDocumentObserver nsIDocumentObserver_iface;
728 LONG ref;
730 HTMLInnerWindow *window;
732 nsIDOMHTMLDocument *nsdoc;
733 BOOL content_ready;
734 event_target_t *body_event_target;
736 IHTMLDOMImplementation *dom_implementation;
738 ICatInformation *catmgr;
739 nsDocumentEventListener *nsevent_listener;
740 BOOL *event_vector;
742 WCHAR **elem_vars;
743 unsigned elem_vars_size;
744 unsigned elem_vars_cnt;
746 BOOL skip_mutation_notif;
748 struct list selection_list;
749 struct list range_list;
750 struct list plugin_hosts;
753 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
754 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
755 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
756 HRESULT create_document_fragment(nsIDOMNode*,HTMLDocumentNode*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
758 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
759 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
760 HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
761 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
762 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
763 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
764 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
765 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
766 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
767 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
768 HRESULT create_dom_implementation(IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
770 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
772 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
773 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
774 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
775 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN;
776 void HTMLDocument_Window_Init(HTMLDocument*) DECLSPEC_HIDDEN;
777 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
778 void HTMLDocument_Hlink_Init(HTMLDocument*) DECLSPEC_HIDDEN;
780 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
781 void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN;
783 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
785 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
787 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
788 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
790 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
791 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
793 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
794 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
795 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
796 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
798 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
799 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
800 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
802 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
803 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
804 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
806 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
808 BOOL load_gecko(void) DECLSPEC_HIDDEN;
809 void close_gecko(void) DECLSPEC_HIDDEN;
810 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
811 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*) DECLSPEC_HIDDEN;
812 void release_nsio(void) DECLSPEC_HIDDEN;
813 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
815 void init_node_cc(void);
817 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
819 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
821 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
822 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
824 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
825 void nsfree(void*) DECLSPEC_HIDDEN;
827 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
828 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
829 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
830 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
832 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
833 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
834 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
835 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
836 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
838 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
839 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
840 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
841 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
842 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
843 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
844 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
846 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
847 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
848 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
849 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
850 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
851 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
853 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
854 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
856 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
857 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
858 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
859 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
861 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
862 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
863 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
864 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
866 HRESULT insert_adjacent_node(HTMLElement*,const WCHAR*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
868 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
869 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
871 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
873 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
874 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
877 struct HTMLAttributeCollection {
878 DispatchEx dispex;
879 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
880 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
881 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
883 LONG ref;
885 HTMLElement *elem;
886 struct list attrs;
889 typedef struct {
890 DispatchEx dispex;
891 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
893 LONG ref;
895 WCHAR *name;
897 HTMLElement *elem;
898 DISPID dispid;
899 struct list entry;
900 } HTMLDOMAttribute;
902 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
904 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
905 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
906 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
907 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
908 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
909 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
910 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
911 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
912 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
913 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
914 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
915 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
916 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
917 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
918 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
919 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
920 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
921 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
922 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
923 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
924 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
925 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
926 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
927 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
928 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
929 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
931 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*) DECLSPEC_HIDDEN;
932 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
933 void HTMLElement2_Init(HTMLElement*) DECLSPEC_HIDDEN;
934 void HTMLElement3_Init(HTMLElement*) DECLSPEC_HIDDEN;
935 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
936 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
938 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
939 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
941 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
942 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
943 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
944 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
945 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
947 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
948 void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN;
950 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
951 HRESULT get_elem(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
953 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
955 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
956 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
957 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
958 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
960 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
962 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
963 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
964 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
965 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN;
967 nsresult get_elem_attr_value(nsIDOMHTMLElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
968 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
969 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
971 /* commands */
972 typedef struct {
973 DWORD id;
974 HRESULT (*query)(HTMLDocument*,OLECMD*);
975 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
976 } cmdtable_t;
978 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
980 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
982 /* timer */
983 #define UPDATE_UI 0x0001
984 #define UPDATE_TITLE 0x0002
986 void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN;
987 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
988 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
990 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
992 /* editor */
993 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
994 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
995 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
996 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
997 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
998 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
999 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
1000 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
1001 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
1003 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
1005 typedef struct task_t task_t;
1006 typedef void (*task_proc_t)(task_t*);
1008 struct task_t {
1009 LONG target_magic;
1010 task_proc_t proc;
1011 task_proc_t destr;
1012 struct task_t *next;
1015 typedef struct {
1016 task_t header;
1017 HTMLDocumentObj *doc;
1018 } docobj_task_t;
1020 typedef struct {
1021 HWND thread_hwnd;
1022 task_t *task_queue_head;
1023 task_t *task_queue_tail;
1024 struct list timer_list;
1025 } thread_data_t;
1027 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1028 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1030 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1031 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1032 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1034 HRESULT set_task_timer(HTMLInnerWindow*,DWORD,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1035 HRESULT clear_task_timer(HTMLInnerWindow*,BOOL,DWORD) DECLSPEC_HIDDEN;
1037 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1039 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1040 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1041 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1042 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1043 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1045 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1047 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1049 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1050 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1052 /* memory allocation functions */
1054 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
1056 return HeapAlloc(GetProcessHeap(), 0, len);
1059 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
1061 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
1064 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
1066 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
1069 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1071 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1074 static inline BOOL heap_free(void *mem)
1076 return HeapFree(GetProcessHeap(), 0, mem);
1079 static inline LPWSTR heap_strdupW(LPCWSTR str)
1081 LPWSTR ret = NULL;
1083 if(str) {
1084 DWORD size;
1086 size = (strlenW(str)+1)*sizeof(WCHAR);
1087 ret = heap_alloc(size);
1088 if(ret)
1089 memcpy(ret, str, size);
1092 return ret;
1095 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1097 LPWSTR ret = NULL;
1099 if(str) {
1100 ret = heap_alloc((len+1)*sizeof(WCHAR));
1101 if(ret)
1103 memcpy(ret, str, len*sizeof(WCHAR));
1104 ret[len] = 0;
1108 return ret;
1111 static inline char *heap_strdupA(const char *str)
1113 char *ret = NULL;
1115 if(str) {
1116 DWORD size;
1118 size = strlen(str)+1;
1119 ret = heap_alloc(size);
1120 if(ret)
1121 memcpy(ret, str, size);
1124 return ret;
1127 static inline WCHAR *heap_strdupAtoW(const char *str)
1129 LPWSTR ret = NULL;
1131 if(str) {
1132 DWORD len;
1134 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1135 ret = heap_alloc(len*sizeof(WCHAR));
1136 if(ret)
1137 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1140 return ret;
1143 static inline char *heap_strdupWtoA(LPCWSTR str)
1145 char *ret = NULL;
1147 if(str) {
1148 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1149 ret = heap_alloc(size);
1150 if(ret)
1151 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1154 return ret;
1157 static inline WCHAR *heap_strdupUtoW(const char *str)
1159 WCHAR *ret = NULL;
1161 if(str) {
1162 size_t len;
1164 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1165 ret = heap_alloc(len*sizeof(WCHAR));
1166 if(ret)
1167 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1170 return ret;
1173 static inline char *heap_strdupWtoU(const WCHAR *str)
1175 char *ret = NULL;
1177 if(str) {
1178 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1179 ret = heap_alloc(size);
1180 if(ret)
1181 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1184 return ret;
1187 static inline void windowref_addref(windowref_t *ref)
1189 InterlockedIncrement(&ref->ref);
1192 static inline void windowref_release(windowref_t *ref)
1194 if(!InterlockedDecrement(&ref->ref))
1195 heap_free(ref);
1198 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
1199 HDC get_display_dc(void) DECLSPEC_HIDDEN;
1200 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1201 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1203 extern HINSTANCE hInst DECLSPEC_HIDDEN;