comctl32: Fix a typo in comment.
[wine.git] / dlls / mshtml / mshtml_private.h
blobaef82cd18b5569bd8ffe908a686b6cbc1a581be4
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/rbtree.h"
35 #include "wine/unicode.h"
37 #ifdef INIT_GUID
38 #include "initguid.h"
39 #endif
41 #include "nsiface.h"
43 #define NS_ERROR_GENERATE_FAILURE(module,code) \
44 ((nsresult) (((UINT32)(1u<<31)) | ((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
45 #define NS_ERROR_GENERATE_SUCCESS(module,code) \
46 ((nsresult) (((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
48 #define NS_OK ((nsresult)0x00000000L)
49 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
50 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
51 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
52 #define NS_NOINTERFACE ((nsresult)0x80004002L)
53 #define NS_ERROR_INVALID_POINTER ((nsresult)0x80004003L)
54 #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
55 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
56 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
57 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
59 #define NS_ERROR_MODULE_NETWORK 6
61 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
62 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
63 #define NS_SUCCESS_DEFAULT_ACTION NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_NETWORK, 66)
65 #define NS_FAILED(res) ((res) & 0x80000000)
66 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
68 #define NSAPI WINAPI
70 #define MSHTML_E_NODOC 0x800a025c
72 typedef struct HTMLDOMNode HTMLDOMNode;
73 typedef struct ConnectionPoint ConnectionPoint;
74 typedef struct BSCallback BSCallback;
75 typedef struct EventTarget EventTarget;
77 #define TID_LIST \
78 XIID(NULL) \
79 XDIID(DispCEventObj) \
80 XDIID(DispCPlugins) \
81 XDIID(DispDOMChildrenCollection) \
82 XDIID(DispHTMLAnchorElement) \
83 XDIID(DispHTMLAreaElement) \
84 XDIID(DispHTMLAttributeCollection) \
85 XDIID(DispHTMLBody) \
86 XDIID(DispHTMLButtonElement) \
87 XDIID(DispHTMLCommentElement) \
88 XDIID(DispHTMLCurrentStyle) \
89 XDIID(DispHTMLDocument) \
90 XDIID(DispHTMLDOMAttribute) \
91 XDIID(DispHTMLDOMTextNode) \
92 XDIID(DispHTMLElementCollection) \
93 XDIID(DispHTMLEmbed) \
94 XDIID(DispHTMLFormElement) \
95 XDIID(DispHTMLGenericElement) \
96 XDIID(DispHTMLFrameElement) \
97 XDIID(DispHTMLHeadElement) \
98 XDIID(DispHTMLHtmlElement) \
99 XDIID(DispHTMLHistory) \
100 XDIID(DispHTMLIFrame) \
101 XDIID(DispHTMLImg) \
102 XDIID(DispHTMLInputElement) \
103 XDIID(DispHTMLLabelElement) \
104 XDIID(DispHTMLLinkElement) \
105 XDIID(DispHTMLLocation) \
106 XDIID(DispHTMLMetaElement) \
107 XDIID(DispHTMLNavigator) \
108 XDIID(DispHTMLObjectElement) \
109 XDIID(DispHTMLOptionElement) \
110 XDIID(DispHTMLScreen) \
111 XDIID(DispHTMLScriptElement) \
112 XDIID(DispHTMLSelectElement) \
113 XDIID(DispHTMLStyle) \
114 XDIID(DispHTMLStyleElement) \
115 XDIID(DispHTMLStyleSheet) \
116 XDIID(DispHTMLStyleSheetRulesCollection) \
117 XDIID(DispHTMLStyleSheetsCollection) \
118 XDIID(DispHTMLTable) \
119 XDIID(DispHTMLTableCell) \
120 XDIID(DispHTMLTableRow) \
121 XDIID(DispHTMLTextAreaElement) \
122 XDIID(DispHTMLTitleElement) \
123 XDIID(DispHTMLUnknownElement) \
124 XDIID(DispHTMLWindow2) \
125 XDIID(DispHTMLXMLHttpRequest) \
126 XDIID(HTMLDocumentEvents) \
127 XDIID(HTMLElementEvents2) \
128 XIID(IDOMEvent) \
129 XIID(IDocumentEvent) \
130 XIID(IDocumentSelector) \
131 XIID(IElementSelector) \
132 XIID(IElementTraversal) \
133 XIID(IEventTarget) \
134 XIID(IHTMLAnchorElement) \
135 XIID(IHTMLAreaElement) \
136 XIID(IHTMLAttributeCollection) \
137 XIID(IHTMLAttributeCollection2) \
138 XIID(IHTMLAttributeCollection3) \
139 XIID(IHTMLBodyElement) \
140 XIID(IHTMLBodyElement2) \
141 XIID(IHTMLButtonElement) \
142 XIID(IHTMLCommentElement) \
143 XIID(IHTMLCurrentStyle) \
144 XIID(IHTMLCurrentStyle2) \
145 XIID(IHTMLCurrentStyle3) \
146 XIID(IHTMLCurrentStyle4) \
147 XIID(IHTMLDocument2) \
148 XIID(IHTMLDocument3) \
149 XIID(IHTMLDocument4) \
150 XIID(IHTMLDocument5) \
151 XIID(IHTMLDocument6) \
152 XIID(IHTMLDocument7) \
153 XIID(IHTMLDOMAttribute) \
154 XIID(IHTMLDOMAttribute2) \
155 XIID(IHTMLDOMChildrenCollection) \
156 XIID(IHTMLDOMImplementation) \
157 XIID(IHTMLDOMNode) \
158 XIID(IHTMLDOMNode2) \
159 XIID(IHTMLDOMNode3) \
160 XIID(IHTMLDOMTextNode) \
161 XIID(IHTMLDOMTextNode2) \
162 XIID(IHTMLElement) \
163 XIID(IHTMLElement2) \
164 XIID(IHTMLElement3) \
165 XIID(IHTMLElement4) \
166 XIID(IHTMLElement6) \
167 XIID(IHTMLElementCollection) \
168 XIID(IHTMLEmbedElement) \
169 XIID(IHTMLEventObj) \
170 XIID(IHTMLFiltersCollection) \
171 XIID(IHTMLFormElement) \
172 XIID(IHTMLFrameBase) \
173 XIID(IHTMLFrameBase2) \
174 XIID(IHTMLFrameElement3) \
175 XIID(IHTMLGenericElement) \
176 XIID(IHTMLHeadElement) \
177 XIID(IHTMLHtmlElement) \
178 XIID(IHTMLIFrameElement) \
179 XIID(IHTMLIFrameElement2) \
180 XIID(IHTMLIFrameElement3) \
181 XIID(IHTMLImageElementFactory) \
182 XIID(IHTMLImgElement) \
183 XIID(IHTMLInputElement) \
184 XIID(IHTMLInputTextElement2) \
185 XIID(IHTMLLabelElement) \
186 XIID(IHTMLLinkElement) \
187 XIID(IHTMLLocation) \
188 XIID(IHTMLMetaElement) \
189 XIID(IHTMLMimeTypesCollection) \
190 XIID(IHTMLObjectElement) \
191 XIID(IHTMLObjectElement2) \
192 XIID(IHTMLOptionElement) \
193 XIID(IHTMLOptionElementFactory) \
194 XIID(IHTMLPluginsCollection) \
195 XIID(IHTMLRect) \
196 XIID(IHTMLScreen) \
197 XIID(IHTMLScriptElement) \
198 XIID(IHTMLSelectElement) \
199 XIID(IHTMLSelectionObject) \
200 XIID(IHTMLSelectionObject2) \
201 XIID(IHTMLStorage) \
202 XIID(IHTMLStyle) \
203 XIID(IHTMLStyle2) \
204 XIID(IHTMLStyle3) \
205 XIID(IHTMLStyle4) \
206 XIID(IHTMLStyle5) \
207 XIID(IHTMLStyle6) \
208 XIID(IHTMLStyleElement) \
209 XIID(IHTMLStyleSheet) \
210 XIID(IHTMLStyleSheetRulesCollection) \
211 XIID(IHTMLStyleSheetsCollection) \
212 XIID(IHTMLTable) \
213 XIID(IHTMLTable2) \
214 XIID(IHTMLTable3) \
215 XIID(IHTMLTableCell) \
216 XIID(IHTMLTableRow) \
217 XIID(IHTMLTextAreaElement) \
218 XIID(IHTMLTextContainer) \
219 XIID(IHTMLTitleElement) \
220 XIID(IHTMLTxtRange) \
221 XIID(IHTMLUniqueName) \
222 XIID(IHTMLWindow2) \
223 XIID(IHTMLWindow3) \
224 XIID(IHTMLWindow4) \
225 XIID(IHTMLWindow5) \
226 XIID(IHTMLWindow6) \
227 XIID(IHTMLXMLHttpRequest) \
228 XIID(IHTMLXMLHttpRequestFactory) \
229 XIID(IOmHistory) \
230 XIID(IOmNavigator)
232 typedef enum {
233 #define XIID(iface) iface ## _tid,
234 #define XDIID(iface) iface ## _tid,
235 TID_LIST
236 #undef XIID
237 #undef XDIID
238 LAST_tid
239 } tid_t;
241 typedef enum {
242 COMPAT_MODE_QUIRKS,
243 COMPAT_MODE_IE5,
244 COMPAT_MODE_IE7,
245 COMPAT_MODE_IE8,
246 COMPAT_MODE_IE9,
247 COMPAT_MODE_IE10,
248 COMPAT_MODE_IE11
249 } compat_mode_t;
251 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
252 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
254 typedef struct {
255 unsigned document_mode;
256 unsigned ie_version;
257 } compat_mode_info_t;
259 extern const compat_mode_info_t compat_mode_info[COMPAT_MODE_CNT] DECLSPEC_HIDDEN;
261 typedef struct dispex_data_t dispex_data_t;
262 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
264 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
265 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
266 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
268 typedef struct DispatchEx DispatchEx;
270 typedef struct {
271 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
272 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
273 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
274 compat_mode_t (*get_compat_mode)(DispatchEx*);
275 HRESULT (*populate_props)(DispatchEx*);
276 } dispex_static_data_vtbl_t;
278 typedef struct {
279 const dispex_static_data_vtbl_t *vtbl;
280 const tid_t disp_tid;
281 const tid_t* const iface_tids;
282 void (*init_info)(dispex_data_t*,compat_mode_t);
283 dispex_data_t *info_cache[COMPAT_MODE_CNT];
284 dispex_data_t *delayed_init_info;
285 } dispex_static_data_t;
287 typedef HRESULT (*dispex_hook_invoke_t)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,
288 EXCEPINFO*,IServiceProvider*);
290 typedef struct {
291 DISPID dispid;
292 dispex_hook_invoke_t invoke;
293 } dispex_hook_t;
295 struct DispatchEx {
296 IDispatchEx IDispatchEx_iface;
298 IUnknown *outer;
300 dispex_data_t *info;
301 dispex_dynamic_data_t *dynamic_data;
304 typedef struct {
305 UINT_PTR x;
306 } nsCycleCollectingAutoRefCnt;
308 typedef struct {
309 void *vtbl;
310 int ref_flags;
311 void *callbacks;
312 } ExternalCycleCollectionParticipant;
314 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
316 typedef struct {
317 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
318 nsresult (NSAPI *unlink)(void*);
319 void (NSAPI *delete_cycle_collectable)(void*);
320 } CCObjCallback;
322 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
324 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN;
325 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN;
326 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN;
327 void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN;
328 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
329 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
331 void init_dispex_with_compat_mode(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
332 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
333 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
334 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
335 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
336 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
337 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
338 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
339 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
340 void release_typelib(void) DECLSPEC_HIDDEN;
341 HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**) DECLSPEC_HIDDEN;
342 const void *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
343 void dispex_info_add_interface(dispex_data_t*,tid_t,const dispex_hook_t*) DECLSPEC_HIDDEN;
344 compat_mode_t dispex_compat_mode(DispatchEx*) DECLSPEC_HIDDEN;
346 static inline void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *desc)
348 init_dispex_with_compat_mode(dispex, outer, desc, COMPAT_MODE_NONE);
351 typedef enum {
352 DISPEXPROP_CUSTOM,
353 DISPEXPROP_DYNAMIC,
354 DISPEXPROP_BUILTIN
355 } dispex_prop_type_t;
357 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
359 typedef struct HTMLWindow HTMLWindow;
360 typedef struct HTMLInnerWindow HTMLInnerWindow;
361 typedef struct HTMLOuterWindow HTMLOuterWindow;
362 typedef struct HTMLDocumentNode HTMLDocumentNode;
363 typedef struct HTMLDocumentObj HTMLDocumentObj;
364 typedef struct HTMLFrameBase HTMLFrameBase;
365 typedef struct NSContainer NSContainer;
366 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
368 typedef enum {
369 SCRIPTMODE_GECKO,
370 SCRIPTMODE_ACTIVESCRIPT
371 } SCRIPTMODE;
373 typedef struct ScriptHost ScriptHost;
375 typedef enum {
376 GLOBAL_SCRIPTVAR,
377 GLOBAL_ELEMENTVAR,
378 GLOBAL_DISPEXVAR,
379 GLOBAL_FRAMEVAR
380 } global_prop_type_t;
382 typedef struct {
383 global_prop_type_t type;
384 WCHAR *name;
385 ScriptHost *script_host;
386 DISPID id;
387 } global_prop_t;
389 struct EventTarget {
390 DispatchEx dispex;
391 IEventTarget IEventTarget_iface;
392 struct wine_rb_tree handler_map;
395 typedef struct {
396 DispatchEx dispex;
397 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
399 LONG ref;
401 HTMLInnerWindow *window;
402 } HTMLOptionElementFactory;
404 typedef struct {
405 DispatchEx dispex;
406 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
408 LONG ref;
410 HTMLInnerWindow *window;
411 } HTMLImageElementFactory;
413 typedef struct {
414 DispatchEx dispex;
415 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
417 LONG ref;
419 HTMLInnerWindow *window;
420 } HTMLXMLHttpRequestFactory;
422 struct HTMLLocation {
423 DispatchEx dispex;
424 IHTMLLocation IHTMLLocation_iface;
426 LONG ref;
428 HTMLInnerWindow *window;
431 typedef struct {
432 DispatchEx dispex;
433 IOmHistory IOmHistory_iface;
435 LONG ref;
437 HTMLInnerWindow *window;
438 } OmHistory;
440 typedef struct {
441 HTMLOuterWindow *window;
442 LONG ref;
443 } windowref_t;
445 typedef struct nsChannelBSC nsChannelBSC;
447 struct HTMLWindow {
448 IHTMLWindow2 IHTMLWindow2_iface;
449 IHTMLWindow3 IHTMLWindow3_iface;
450 IHTMLWindow4 IHTMLWindow4_iface;
451 IHTMLWindow5 IHTMLWindow5_iface;
452 IHTMLWindow6 IHTMLWindow6_iface;
453 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
454 IDispatchEx IDispatchEx_iface;
455 IServiceProvider IServiceProvider_iface;
456 ITravelLogClient ITravelLogClient_iface;
457 IObjectIdentity IObjectIdentity_iface;
458 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
460 LONG ref;
462 HTMLInnerWindow *inner_window;
463 HTMLOuterWindow *outer_window;
466 struct HTMLOuterWindow {
467 HTMLWindow base;
469 windowref_t *window_ref;
470 LONG task_magic;
472 HTMLDocumentObj *doc_obj;
473 nsIDOMWindow *nswindow;
474 mozIDOMWindowProxy *window_proxy;
475 HTMLOuterWindow *parent;
476 HTMLFrameBase *frame_element;
478 READYSTATE readystate;
479 BOOL readystate_locked;
480 unsigned readystate_pending;
482 HTMLInnerWindow *pending_window;
483 IMoniker *mon;
484 IUri *uri;
485 IUri *uri_nofrag;
486 BSTR url;
487 DWORD load_flags;
489 SCRIPTMODE scriptmode;
491 IInternetSecurityManager *secmgr;
493 struct list children;
494 struct list sibling_entry;
495 struct wine_rb_entry entry;
498 struct HTMLInnerWindow {
499 HTMLWindow base;
500 EventTarget event_target;
502 HTMLDocumentNode *doc;
504 struct list script_hosts;
506 IHTMLEventObj *event;
508 HTMLImageElementFactory *image_factory;
509 HTMLOptionElementFactory *option_factory;
510 HTMLXMLHttpRequestFactory *xhr_factory;
511 IHTMLScreen *screen;
512 OmHistory *history;
513 IHTMLStorage *session_storage;
515 unsigned parser_callback_cnt;
516 struct list script_queue;
518 global_prop_t *global_props;
519 DWORD global_prop_cnt;
520 DWORD global_prop_size;
522 LONG task_magic;
524 HTMLLocation *location;
526 IMoniker *mon;
527 nsChannelBSC *bscallback;
528 struct list bindings;
531 typedef enum {
532 UNKNOWN_USERMODE,
533 BROWSEMODE,
534 EDITMODE
535 } USERMODE;
537 typedef struct _cp_static_data_t {
538 tid_t tid;
539 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
540 BOOL pass_event_arg;
541 DWORD id_cnt;
542 DISPID *ids;
543 } cp_static_data_t;
545 typedef struct {
546 const IID *riid;
547 cp_static_data_t *desc;
548 } cpc_entry_t;
550 typedef struct ConnectionPointContainer {
551 IConnectionPointContainer IConnectionPointContainer_iface;
553 ConnectionPoint *cps;
554 const cpc_entry_t *cp_entries;
555 IUnknown *outer;
556 struct ConnectionPointContainer *forward_container;
557 } ConnectionPointContainer;
559 struct ConnectionPoint {
560 IConnectionPoint IConnectionPoint_iface;
562 ConnectionPointContainer *container;
564 union {
565 IUnknown *unk;
566 IDispatch *disp;
567 IPropertyNotifySink *propnotif;
568 } *sinks;
569 DWORD sinks_size;
571 const IID *iid;
572 cp_static_data_t *data;
575 struct HTMLDocument {
576 IHTMLDocument2 IHTMLDocument2_iface;
577 IHTMLDocument3 IHTMLDocument3_iface;
578 IHTMLDocument4 IHTMLDocument4_iface;
579 IHTMLDocument5 IHTMLDocument5_iface;
580 IHTMLDocument6 IHTMLDocument6_iface;
581 IHTMLDocument7 IHTMLDocument7_iface;
582 IDocumentSelector IDocumentSelector_iface;
583 IDocumentEvent IDocumentEvent_iface;
584 IPersistMoniker IPersistMoniker_iface;
585 IPersistFile IPersistFile_iface;
586 IPersistHistory IPersistHistory_iface;
587 IMonikerProp IMonikerProp_iface;
588 IOleObject IOleObject_iface;
589 IOleDocument IOleDocument_iface;
590 IOleDocumentView IOleDocumentView_iface;
591 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
592 IViewObjectEx IViewObjectEx_iface;
593 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
594 IServiceProvider IServiceProvider_iface;
595 IOleCommandTarget IOleCommandTarget_iface;
596 IOleControl IOleControl_iface;
597 IHlinkTarget IHlinkTarget_iface;
598 IPersistStreamInit IPersistStreamInit_iface;
599 IDispatchEx IDispatchEx_iface;
600 ISupportErrorInfo ISupportErrorInfo_iface;
601 IObjectWithSite IObjectWithSite_iface;
602 IOleContainer IOleContainer_iface;
603 IObjectSafety IObjectSafety_iface;
604 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
606 IUnknown *outer_unk;
607 IDispatchEx *dispex;
609 HTMLDocumentObj *doc_obj;
610 HTMLDocumentNode *doc_node;
612 HTMLOuterWindow *window;
614 ConnectionPointContainer cp_container;
617 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
619 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
622 static inline ULONG htmldoc_addref(HTMLDocument *This)
624 return IUnknown_AddRef(This->outer_unk);
627 static inline ULONG htmldoc_release(HTMLDocument *This)
629 return IUnknown_Release(This->outer_unk);
632 struct HTMLDocumentObj {
633 HTMLDocument basedoc;
634 DispatchEx dispex;
635 IUnknown IUnknown_outer;
636 ICustomDoc ICustomDoc_iface;
637 ITargetContainer ITargetContainer_iface;
639 IWindowForBindingUI IWindowForBindingUI_iface;
641 LONG ref;
643 NSContainer *nscontainer;
645 IOleClientSite *client;
646 IDocHostUIHandler *hostui;
647 IOleCommandTarget *client_cmdtrg;
648 BOOL custom_hostui;
649 IOleInPlaceSite *ipsite;
650 IOleInPlaceFrame *frame;
651 IOleInPlaceUIWindow *ip_window;
652 IAdviseSink *view_sink;
653 IDocObjectService *doc_object_service;
654 IUnknown *webbrowser;
655 ITravelLog *travel_log;
656 IUnknown *browser_service;
657 IOleAdviseHolder *advise_holder;
659 DOCHOSTUIINFO hostinfo;
661 IOleUndoManager *undomgr;
662 IHTMLEditServices *editsvcs;
664 HWND hwnd;
665 HWND tooltips_hwnd;
667 BOOL is_mhtml;
668 BOOL request_uiactivate;
669 BOOL in_place_active;
670 BOOL ui_active;
671 BOOL window_active;
672 BOOL hostui_setup;
673 BOOL container_locked;
674 BOOL focus;
675 BOOL has_popup;
676 INT download_state;
678 USERMODE usermode;
679 LPWSTR mime;
681 DWORD update;
682 LONG task_magic;
685 typedef struct nsWeakReference nsWeakReference;
687 struct NSContainer {
688 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
689 nsIContextMenuListener nsIContextMenuListener_iface;
690 nsIURIContentListener nsIURIContentListener_iface;
691 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
692 nsITooltipListener nsITooltipListener_iface;
693 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
694 nsISupportsWeakReference nsISupportsWeakReference_iface;
696 nsIWebBrowser *webbrowser;
697 nsIWebNavigation *navigation;
698 nsIBaseWindow *window;
699 nsIWebBrowserFocus *focus;
701 nsIEditor *editor;
702 nsIController *editor_controller;
704 LONG ref;
706 nsWeakReference *weak_reference;
708 HTMLDocumentObj *doc;
710 nsIURIContentListener *content_listener;
712 HWND hwnd;
715 typedef struct {
716 const CLSID *clsid;
717 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
718 void (*destructor)(HTMLDOMNode*);
719 const cpc_entry_t *cpc_entries;
720 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
721 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
722 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
723 EventTarget *(*get_event_prop_target)(HTMLDOMNode*,int);
724 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
725 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
726 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
727 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
728 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
729 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
730 HRESULT (*bind_to_tree)(HTMLDOMNode*);
731 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
732 void (*unlink)(HTMLDOMNode*);
733 BOOL (*is_text_edit)(HTMLDOMNode*);
734 BOOL (*is_settable)(HTMLDOMNode*,DISPID);
735 } NodeImplVtbl;
737 struct HTMLDOMNode {
738 EventTarget event_target;
739 IHTMLDOMNode IHTMLDOMNode_iface;
740 IHTMLDOMNode2 IHTMLDOMNode2_iface;
741 IHTMLDOMNode3 IHTMLDOMNode3_iface;
742 const NodeImplVtbl *vtbl;
744 nsCycleCollectingAutoRefCnt ccref;
746 nsIDOMNode *nsnode;
747 HTMLDocumentNode *doc;
750 static inline void node_addref(HTMLDOMNode *node)
752 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
755 static inline void node_release(HTMLDOMNode *node)
757 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
760 typedef struct {
761 HTMLDOMNode node;
762 ConnectionPointContainer cp_container;
764 IHTMLElement IHTMLElement_iface;
765 IHTMLElement2 IHTMLElement2_iface;
766 IHTMLElement3 IHTMLElement3_iface;
767 IHTMLElement4 IHTMLElement4_iface;
768 IHTMLElement6 IHTMLElement6_iface;
769 IHTMLUniqueName IHTMLUniqueName_iface;
770 IElementSelector IElementSelector_iface;
771 IElementTraversal IElementTraversal_iface;
772 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
774 nsIDOMHTMLElement *nselem;
775 HTMLStyle *style;
776 HTMLStyle *runtime_style;
777 HTMLAttributeCollection *attrs;
778 WCHAR *filter;
779 unsigned unique_id;
780 } HTMLElement;
782 #define HTMLELEMENT_TIDS \
783 IHTMLDOMNode_tid, \
784 IHTMLDOMNode2_tid, \
785 IHTMLElement_tid, \
786 IHTMLElement3_tid, \
787 IHTMLElement4_tid, \
788 IHTMLUniqueName_tid
790 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN;
791 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
792 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN;
794 typedef struct {
795 HTMLElement element;
797 IHTMLTextContainer IHTMLTextContainer_iface;
798 } HTMLTextContainer;
800 struct HTMLFrameBase {
801 HTMLElement element;
803 IHTMLFrameBase IHTMLFrameBase_iface;
804 IHTMLFrameBase2 IHTMLFrameBase2_iface;
806 HTMLOuterWindow *content_window;
808 nsIDOMHTMLFrameElement *nsframe;
809 nsIDOMHTMLIFrameElement *nsiframe;
812 typedef struct nsDocumentEventListener nsDocumentEventListener;
814 struct HTMLDocumentNode {
815 HTMLDOMNode node;
816 HTMLDocument basedoc;
818 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
820 nsIDocumentObserver nsIDocumentObserver_iface;
822 LONG ref;
824 HTMLInnerWindow *window;
826 compat_mode_t document_mode;
827 BOOL document_mode_locked;
829 nsIDOMHTMLDocument *nsdoc;
830 BOOL content_ready;
832 IHTMLDOMImplementation *dom_implementation;
834 ICatInformation *catmgr;
835 nsDocumentEventListener *nsevent_listener;
836 BOOL *event_vector;
838 WCHAR **elem_vars;
839 unsigned elem_vars_size;
840 unsigned elem_vars_cnt;
842 BOOL skip_mutation_notif;
844 UINT charset;
846 unsigned unique_id;
848 struct list selection_list;
849 struct list range_list;
850 struct list plugin_hosts;
853 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
854 HRESULT MHTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
855 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
856 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
858 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
859 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
860 HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*) DECLSPEC_HIDDEN;
861 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
862 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
863 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
864 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN;
865 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
866 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
867 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
868 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
869 HRESULT create_dom_implementation(IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
871 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
873 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
874 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
875 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
876 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN;
877 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
879 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
880 void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN;
882 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
884 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
886 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
887 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
889 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
890 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
892 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
893 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
894 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
895 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
897 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
898 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
899 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
901 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
902 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
903 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
905 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN;
907 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
909 BOOL load_gecko(void) DECLSPEC_HIDDEN;
910 void close_gecko(void) DECLSPEC_HIDDEN;
911 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
912 void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
913 void release_nsio(void) DECLSPEC_HIDDEN;
914 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
915 void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
917 void init_node_cc(void) DECLSPEC_HIDDEN;
919 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
921 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
923 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
924 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
926 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
927 void nsfree(void*) DECLSPEC_HIDDEN;
929 BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN;
930 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
931 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
932 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
933 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
935 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
936 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
937 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
938 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
940 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
941 HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p) DECLSPEC_HIDDEN;
943 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
944 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
945 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
946 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
947 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
948 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN;
949 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
950 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
952 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
953 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
954 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
955 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
956 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
957 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
959 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
960 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
962 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
963 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
964 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
965 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
967 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
968 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
969 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
970 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
972 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
973 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
975 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
977 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
978 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
981 struct HTMLAttributeCollection {
982 DispatchEx dispex;
983 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
984 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
985 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
987 LONG ref;
989 HTMLElement *elem;
990 struct list attrs;
993 typedef struct {
994 DispatchEx dispex;
995 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
996 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
998 LONG ref;
1000 /* value is valid only for detached attributes (when elem == NULL). */
1001 VARIANT value;
1002 /* name must be valid for detached attributes */
1003 WCHAR *name;
1005 HTMLElement *elem;
1006 DISPID dispid;
1007 struct list entry;
1008 } HTMLDOMAttribute;
1010 HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*) DECLSPEC_HIDDEN;
1012 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
1014 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
1015 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
1016 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1017 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1018 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1019 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1020 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1021 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1022 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1023 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1024 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1025 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1026 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1027 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1028 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1029 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1030 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1031 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1032 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1033 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1034 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1035 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1036 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1037 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1038 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1039 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1040 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1041 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1043 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1044 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1045 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1046 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1048 void EventTarget_Init(EventTarget*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1049 HRESULT EventTarget_QI(EventTarget*,REFIID,void**) DECLSPEC_HIDDEN;
1050 void EventTarget_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1052 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1053 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1054 void HTMLDOMNode_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1056 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1057 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1058 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1059 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
1060 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1061 void HTMLElement_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1063 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
1064 void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN;
1066 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
1067 HRESULT get_elem(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1069 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
1071 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
1072 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
1073 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1074 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
1075 HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1077 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
1079 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
1080 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
1081 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
1082 IHTMLDOMChildrenCollection *create_child_collection(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
1084 HRESULT attr_value_to_string(VARIANT*) DECLSPEC_HIDDEN;
1085 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
1086 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN;
1088 nsresult get_elem_attr_value(nsIDOMHTMLElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
1089 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
1090 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
1092 HRESULT elem_unique_id(unsigned id, BSTR *p) DECLSPEC_HIDDEN;
1094 /* commands */
1095 typedef struct {
1096 DWORD id;
1097 HRESULT (*query)(HTMLDocument*,OLECMD*);
1098 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
1099 } cmdtable_t;
1101 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
1103 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
1105 /* timer */
1106 #define UPDATE_UI 0x0001
1107 #define UPDATE_TITLE 0x0002
1109 void update_doc(HTMLDocumentObj*,DWORD) DECLSPEC_HIDDEN;
1110 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1111 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
1113 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
1115 /* editor */
1116 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1117 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
1118 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
1119 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1120 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1121 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1122 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
1123 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
1124 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
1126 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
1128 typedef struct task_t task_t;
1129 typedef void (*task_proc_t)(task_t*);
1131 struct task_t {
1132 LONG target_magic;
1133 task_proc_t proc;
1134 task_proc_t destr;
1135 struct list entry;
1138 typedef struct {
1139 task_t header;
1140 HTMLDocumentObj *doc;
1141 } docobj_task_t;
1143 typedef struct {
1144 HWND thread_hwnd;
1145 struct list task_list;
1146 struct list timer_list;
1147 } thread_data_t;
1149 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1150 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1152 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1153 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1154 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1156 HRESULT set_task_timer(HTMLInnerWindow*,LONG,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1157 HRESULT clear_task_timer(HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
1159 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1161 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1162 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1163 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1164 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1165 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1167 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1169 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1171 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1172 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1174 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1175 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1177 /* memory allocation functions */
1179 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
1181 return HeapAlloc(GetProcessHeap(), 0, len);
1184 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
1186 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
1189 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
1191 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
1194 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1196 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1199 static inline BOOL heap_free(void *mem)
1201 return HeapFree(GetProcessHeap(), 0, mem);
1204 static inline LPWSTR heap_strdupW(LPCWSTR str)
1206 LPWSTR ret = NULL;
1208 if(str) {
1209 DWORD size;
1211 size = (strlenW(str)+1)*sizeof(WCHAR);
1212 ret = heap_alloc(size);
1213 if(ret)
1214 memcpy(ret, str, size);
1217 return ret;
1220 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1222 LPWSTR ret = NULL;
1224 if(str) {
1225 ret = heap_alloc((len+1)*sizeof(WCHAR));
1226 if(ret)
1228 memcpy(ret, str, len*sizeof(WCHAR));
1229 ret[len] = 0;
1233 return ret;
1236 static inline char *heap_strdupA(const char *str)
1238 char *ret = NULL;
1240 if(str) {
1241 DWORD size;
1243 size = strlen(str)+1;
1244 ret = heap_alloc(size);
1245 if(ret)
1246 memcpy(ret, str, size);
1249 return ret;
1252 static inline WCHAR *heap_strdupAtoW(const char *str)
1254 LPWSTR ret = NULL;
1256 if(str) {
1257 DWORD len;
1259 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1260 ret = heap_alloc(len*sizeof(WCHAR));
1261 if(ret)
1262 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1265 return ret;
1268 static inline char *heap_strdupWtoA(LPCWSTR str)
1270 char *ret = NULL;
1272 if(str) {
1273 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1274 ret = heap_alloc(size);
1275 if(ret)
1276 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1279 return ret;
1282 static inline WCHAR *heap_strdupUtoW(const char *str)
1284 WCHAR *ret = NULL;
1286 if(str) {
1287 size_t len;
1289 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1290 ret = heap_alloc(len*sizeof(WCHAR));
1291 if(ret)
1292 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1295 return ret;
1298 static inline char *heap_strdupWtoU(const WCHAR *str)
1300 char *ret = NULL;
1302 if(str) {
1303 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1304 ret = heap_alloc(size);
1305 if(ret)
1306 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1309 return ret;
1312 static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len)
1314 char *ret = NULL;
1315 DWORD size;
1317 if(str && len) {
1318 size = WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL);
1319 ret = heap_alloc(size + 1);
1320 if(ret) {
1321 WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL);
1322 ret[size] = '\0';
1326 return ret;
1329 static inline void windowref_addref(windowref_t *ref)
1331 InterlockedIncrement(&ref->ref);
1334 static inline void windowref_release(windowref_t *ref)
1336 if(!InterlockedDecrement(&ref->ref))
1337 heap_free(ref);
1340 static inline VARIANT_BOOL variant_bool(BOOL b)
1342 return b ? VARIANT_TRUE : VARIANT_FALSE;
1345 #ifdef __i386__
1346 extern void *call_thiscall_func;
1347 #endif
1349 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
1350 BSTR charset_string_from_cp(UINT) DECLSPEC_HIDDEN;
1351 HDC get_display_dc(void) DECLSPEC_HIDDEN;
1352 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1353 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1355 extern HINSTANCE hInst DECLSPEC_HIDDEN;