mshtml: Add support for DIID_HTMLDocumentEvents2 connection point sink.
[wine.git] / dlls / mshtml / mshtml_private.h
blob6bfce89698cc66f9dd62bbc41873a748868a4553
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/heap.h"
34 #include "wine/list.h"
35 #include "wine/rbtree.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)
58 #define NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ((nsresult)0x80530007)
60 #define NS_ERROR_MODULE_NETWORK 6
62 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
63 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
64 #define NS_SUCCESS_DEFAULT_ACTION NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_NETWORK, 66)
66 #define NS_FAILED(res) ((res) & 0x80000000)
67 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
69 #define NSAPI WINAPI
71 #define MSHTML_E_NODOC 0x800a025c
73 typedef struct HTMLDOMNode HTMLDOMNode;
74 typedef struct ConnectionPoint ConnectionPoint;
75 typedef struct BSCallback BSCallback;
76 typedef struct EventTarget EventTarget;
78 #define TID_LIST \
79 XIID(NULL) \
80 XDIID(DispCEventObj) \
81 XDIID(DispCPlugins) \
82 XDIID(DispDOMChildrenCollection) \
83 XDIID(DispDOMCustomEvent) \
84 XDIID(DispDOMEvent) \
85 XDIID(DispDOMKeyboardEvent) \
86 XDIID(DispDOMMouseEvent) \
87 XDIID(DispDOMUIEvent) \
88 XDIID(DispHTMLAnchorElement) \
89 XDIID(DispHTMLAreaElement) \
90 XDIID(DispHTMLAttributeCollection) \
91 XDIID(DispHTMLBody) \
92 XDIID(DispHTMLButtonElement) \
93 XDIID(DispHTMLCommentElement) \
94 XDIID(DispHTMLCurrentStyle) \
95 XDIID(DispHTMLDocument) \
96 XDIID(DispHTMLDOMAttribute) \
97 XDIID(DispHTMLDOMImplementation) \
98 XDIID(DispHTMLDOMTextNode) \
99 XDIID(DispHTMLElementCollection) \
100 XDIID(DispHTMLEmbed) \
101 XDIID(DispHTMLFormElement) \
102 XDIID(DispHTMLGenericElement) \
103 XDIID(DispHTMLFrameElement) \
104 XDIID(DispHTMLHeadElement) \
105 XDIID(DispHTMLHtmlElement) \
106 XDIID(DispHTMLHistory) \
107 XDIID(DispHTMLIFrame) \
108 XDIID(DispHTMLImg) \
109 XDIID(DispHTMLInputElement) \
110 XDIID(DispHTMLLabelElement) \
111 XDIID(DispHTMLLinkElement) \
112 XDIID(DispHTMLLocation) \
113 XDIID(DispHTMLMetaElement) \
114 XDIID(DispHTMLNavigator) \
115 XDIID(DispHTMLObjectElement) \
116 XDIID(DispHTMLOptionElement) \
117 XDIID(DispHTMLScreen) \
118 XDIID(DispHTMLScriptElement) \
119 XDIID(DispHTMLSelectElement) \
120 XDIID(DispHTMLStyle) \
121 XDIID(DispHTMLStyleElement) \
122 XDIID(DispHTMLStyleSheet) \
123 XDIID(DispHTMLStyleSheetRule) \
124 XDIID(DispHTMLStyleSheetRulesCollection) \
125 XDIID(DispHTMLStyleSheetsCollection) \
126 XDIID(DispHTMLTable) \
127 XDIID(DispHTMLTableCell) \
128 XDIID(DispHTMLTableRow) \
129 XDIID(DispHTMLTextAreaElement) \
130 XDIID(DispHTMLTitleElement) \
131 XDIID(DispHTMLUnknownElement) \
132 XDIID(DispHTMLW3CComputedStyle) \
133 XDIID(DispHTMLWindow2) \
134 XDIID(DispHTMLXMLHttpRequest) \
135 XDIID(DispSVGCircleElement) \
136 XDIID(DispSVGSVGElement) \
137 XDIID(DispSVGTSpanElement) \
138 XDIID(HTMLDocumentEvents) \
139 XDIID(HTMLDocumentEvents2) \
140 XDIID(HTMLElementEvents2) \
141 XIID(IDOMCustomEvent) \
142 XIID(IDOMEvent) \
143 XIID(IDOMKeyboardEvent) \
144 XIID(IDOMMouseEvent) \
145 XIID(IDOMUIEvent) \
146 XIID(IDocumentEvent) \
147 XIID(IDocumentSelector) \
148 XIID(IElementSelector) \
149 XIID(IElementTraversal) \
150 XIID(IEventTarget) \
151 XIID(IHTMLAnchorElement) \
152 XIID(IHTMLAreaElement) \
153 XIID(IHTMLAttributeCollection) \
154 XIID(IHTMLAttributeCollection2) \
155 XIID(IHTMLAttributeCollection3) \
156 XIID(IHTMLBodyElement) \
157 XIID(IHTMLBodyElement2) \
158 XIID(IHTMLButtonElement) \
159 XIID(IHTMLCSSStyleDeclaration) \
160 XIID(IHTMLCSSStyleDeclaration2) \
161 XIID(IHTMLCommentElement) \
162 XIID(IHTMLCurrentStyle) \
163 XIID(IHTMLCurrentStyle2) \
164 XIID(IHTMLCurrentStyle3) \
165 XIID(IHTMLCurrentStyle4) \
166 XIID(IHTMLDocument2) \
167 XIID(IHTMLDocument3) \
168 XIID(IHTMLDocument4) \
169 XIID(IHTMLDocument5) \
170 XIID(IHTMLDocument6) \
171 XIID(IHTMLDocument7) \
172 XIID(IHTMLDOMAttribute) \
173 XIID(IHTMLDOMAttribute2) \
174 XIID(IHTMLDOMChildrenCollection) \
175 XIID(IHTMLDOMImplementation) \
176 XIID(IHTMLDOMImplementation2) \
177 XIID(IHTMLDOMNode) \
178 XIID(IHTMLDOMNode2) \
179 XIID(IHTMLDOMNode3) \
180 XIID(IHTMLDOMTextNode) \
181 XIID(IHTMLDOMTextNode2) \
182 XIID(IHTMLElement) \
183 XIID(IHTMLElement2) \
184 XIID(IHTMLElement3) \
185 XIID(IHTMLElement4) \
186 XIID(IHTMLElement6) \
187 XIID(IHTMLElementCollection) \
188 XIID(IHTMLEmbedElement) \
189 XIID(IHTMLEventObj) \
190 XIID(IHTMLFiltersCollection) \
191 XIID(IHTMLFormElement) \
192 XIID(IHTMLFrameBase) \
193 XIID(IHTMLFrameBase2) \
194 XIID(IHTMLFrameElement3) \
195 XIID(IHTMLGenericElement) \
196 XIID(IHTMLHeadElement) \
197 XIID(IHTMLHtmlElement) \
198 XIID(IHTMLIFrameElement) \
199 XIID(IHTMLIFrameElement2) \
200 XIID(IHTMLIFrameElement3) \
201 XIID(IHTMLImageElementFactory) \
202 XIID(IHTMLImgElement) \
203 XIID(IHTMLInputElement) \
204 XIID(IHTMLInputTextElement2) \
205 XIID(IHTMLLabelElement) \
206 XIID(IHTMLLinkElement) \
207 XIID(IHTMLLocation) \
208 XIID(IHTMLMetaElement) \
209 XIID(IHTMLMimeTypesCollection) \
210 XIID(IHTMLObjectElement) \
211 XIID(IHTMLObjectElement2) \
212 XIID(IHTMLOptionElement) \
213 XIID(IHTMLOptionElementFactory) \
214 XIID(IHTMLPerformance) \
215 XIID(IHTMLPerformanceNavigation) \
216 XIID(IHTMLPerformanceTiming) \
217 XIID(IHTMLPluginsCollection) \
218 XIID(IHTMLRect) \
219 XIID(IHTMLRectCollection) \
220 XIID(IHTMLScreen) \
221 XIID(IHTMLScriptElement) \
222 XIID(IHTMLSelectElement) \
223 XIID(IHTMLSelectionObject) \
224 XIID(IHTMLSelectionObject2) \
225 XIID(IHTMLStorage) \
226 XIID(IHTMLStyle) \
227 XIID(IHTMLStyle2) \
228 XIID(IHTMLStyle3) \
229 XIID(IHTMLStyle4) \
230 XIID(IHTMLStyle5) \
231 XIID(IHTMLStyle6) \
232 XIID(IHTMLStyleElement) \
233 XIID(IHTMLStyleSheet) \
234 XIID(IHTMLStyleSheetRule) \
235 XIID(IHTMLStyleSheetRulesCollection) \
236 XIID(IHTMLStyleSheetsCollection) \
237 XIID(IHTMLTable) \
238 XIID(IHTMLTable2) \
239 XIID(IHTMLTable3) \
240 XIID(IHTMLTableCell) \
241 XIID(IHTMLTableRow) \
242 XIID(IHTMLTextAreaElement) \
243 XIID(IHTMLTextContainer) \
244 XIID(IHTMLTitleElement) \
245 XIID(IHTMLTxtRange) \
246 XIID(IHTMLUniqueName) \
247 XIID(IHTMLWindow2) \
248 XIID(IHTMLWindow3) \
249 XIID(IHTMLWindow4) \
250 XIID(IHTMLWindow5) \
251 XIID(IHTMLWindow6) \
252 XIID(IHTMLWindow7) \
253 XIID(IHTMLXMLHttpRequest) \
254 XIID(IHTMLXMLHttpRequestFactory) \
255 XIID(IOmHistory) \
256 XIID(IOmNavigator) \
257 XIID(ISVGCircleElement) \
258 XIID(ISVGElement) \
259 XIID(ISVGSVGElement) \
260 XIID(ISVGTSpanElement) \
261 XIID(ISVGTextContentElement)
263 typedef enum {
264 #define XIID(iface) iface ## _tid,
265 #define XDIID(iface) iface ## _tid,
266 TID_LIST
267 #undef XIID
268 #undef XDIID
269 LAST_tid
270 } tid_t;
272 typedef enum {
273 COMPAT_MODE_QUIRKS,
274 COMPAT_MODE_IE5,
275 COMPAT_MODE_IE7,
276 COMPAT_MODE_IE8,
277 COMPAT_MODE_IE9,
278 COMPAT_MODE_IE10,
279 COMPAT_MODE_IE11
280 } compat_mode_t;
282 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
283 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
285 typedef struct {
286 unsigned document_mode;
287 unsigned ie_version;
288 } compat_mode_info_t;
290 extern const compat_mode_info_t compat_mode_info[COMPAT_MODE_CNT] DECLSPEC_HIDDEN;
292 typedef struct dispex_data_t dispex_data_t;
293 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
295 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
296 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
297 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
299 typedef struct DispatchEx DispatchEx;
301 typedef struct {
302 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
303 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
304 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
305 compat_mode_t (*get_compat_mode)(DispatchEx*);
306 HRESULT (*populate_props)(DispatchEx*);
307 } dispex_static_data_vtbl_t;
309 typedef struct {
310 const dispex_static_data_vtbl_t *vtbl;
311 const tid_t disp_tid;
312 const tid_t* const iface_tids;
313 void (*init_info)(dispex_data_t*,compat_mode_t);
314 dispex_data_t *info_cache[COMPAT_MODE_CNT];
315 dispex_data_t *delayed_init_info;
316 } dispex_static_data_t;
318 typedef HRESULT (*dispex_hook_invoke_t)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,
319 EXCEPINFO*,IServiceProvider*);
321 typedef struct {
322 DISPID dispid;
323 dispex_hook_invoke_t invoke;
324 } dispex_hook_t;
326 struct DispatchEx {
327 IDispatchEx IDispatchEx_iface;
329 IUnknown *outer;
331 dispex_data_t *info;
332 dispex_dynamic_data_t *dynamic_data;
335 typedef struct {
336 UINT_PTR x;
337 } nsCycleCollectingAutoRefCnt;
339 typedef struct {
340 void *vtbl;
341 int ref_flags;
342 void *callbacks;
343 } ExternalCycleCollectionParticipant;
345 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
347 typedef struct {
348 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
349 nsresult (NSAPI *unlink)(void*);
350 void (NSAPI *delete_cycle_collectable)(void*);
351 } CCObjCallback;
353 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
355 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN;
356 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN;
357 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN;
358 void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN;
359 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
360 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
362 void init_dispex_with_compat_mode(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
363 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
364 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
365 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
366 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
367 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
368 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
369 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
370 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
371 void release_typelib(void) DECLSPEC_HIDDEN;
372 HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**) DECLSPEC_HIDDEN;
373 const void *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
374 void dispex_info_add_interface(dispex_data_t*,tid_t,const dispex_hook_t*) DECLSPEC_HIDDEN;
375 compat_mode_t dispex_compat_mode(DispatchEx*) DECLSPEC_HIDDEN;
377 static inline void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *desc)
379 init_dispex_with_compat_mode(dispex, outer, desc, COMPAT_MODE_NONE);
382 typedef enum {
383 DISPEXPROP_CUSTOM,
384 DISPEXPROP_DYNAMIC,
385 DISPEXPROP_BUILTIN
386 } dispex_prop_type_t;
388 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
390 typedef struct HTMLWindow HTMLWindow;
391 typedef struct HTMLInnerWindow HTMLInnerWindow;
392 typedef struct HTMLOuterWindow HTMLOuterWindow;
393 typedef struct HTMLDocumentNode HTMLDocumentNode;
394 typedef struct HTMLDocumentObj HTMLDocumentObj;
395 typedef struct HTMLFrameBase HTMLFrameBase;
396 typedef struct GeckoBrowser GeckoBrowser;
397 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
399 typedef struct ScriptHost ScriptHost;
401 typedef enum {
402 GLOBAL_SCRIPTVAR,
403 GLOBAL_ELEMENTVAR,
404 GLOBAL_DISPEXVAR,
405 GLOBAL_FRAMEVAR
406 } global_prop_type_t;
408 typedef struct {
409 global_prop_type_t type;
410 WCHAR *name;
411 ScriptHost *script_host;
412 DISPID id;
413 } global_prop_t;
415 struct EventTarget {
416 DispatchEx dispex;
417 IEventTarget IEventTarget_iface;
418 struct wine_rb_tree handler_map;
421 typedef struct {
422 DispatchEx dispex;
423 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
425 LONG ref;
427 HTMLInnerWindow *window;
428 } HTMLOptionElementFactory;
430 typedef struct {
431 DispatchEx dispex;
432 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
434 LONG ref;
436 HTMLInnerWindow *window;
437 } HTMLImageElementFactory;
439 typedef struct {
440 DispatchEx dispex;
441 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
443 LONG ref;
445 HTMLInnerWindow *window;
446 } HTMLXMLHttpRequestFactory;
448 struct HTMLLocation {
449 DispatchEx dispex;
450 IHTMLLocation IHTMLLocation_iface;
452 LONG ref;
454 HTMLInnerWindow *window;
457 typedef struct {
458 DispatchEx dispex;
459 IOmHistory IOmHistory_iface;
461 LONG ref;
463 HTMLInnerWindow *window;
464 } OmHistory;
466 typedef struct nsChannelBSC nsChannelBSC;
468 struct HTMLWindow {
469 IHTMLWindow2 IHTMLWindow2_iface;
470 IHTMLWindow3 IHTMLWindow3_iface;
471 IHTMLWindow4 IHTMLWindow4_iface;
472 IHTMLWindow5 IHTMLWindow5_iface;
473 IHTMLWindow6 IHTMLWindow6_iface;
474 IHTMLWindow7 IHTMLWindow7_iface;
475 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
476 IDispatchEx IDispatchEx_iface;
477 IServiceProvider IServiceProvider_iface;
478 ITravelLogClient ITravelLogClient_iface;
479 IObjectIdentity IObjectIdentity_iface;
480 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
482 LONG ref;
484 HTMLInnerWindow *inner_window;
485 HTMLOuterWindow *outer_window;
488 struct HTMLOuterWindow {
489 HTMLWindow base;
491 LONG task_magic;
493 nsIDOMWindow *nswindow;
494 mozIDOMWindowProxy *window_proxy;
495 HTMLOuterWindow *parent;
496 HTMLFrameBase *frame_element;
498 GeckoBrowser *browser;
499 struct list browser_entry;
501 READYSTATE readystate;
502 BOOL readystate_locked;
503 unsigned readystate_pending;
505 HTMLInnerWindow *pending_window;
506 IMoniker *mon;
507 IUri *uri;
508 IUri *uri_nofrag;
509 BSTR url;
510 DWORD load_flags;
512 struct list sibling_entry;
513 struct wine_rb_entry entry;
516 struct HTMLInnerWindow {
517 HTMLWindow base;
518 EventTarget event_target;
520 HTMLDocumentNode *doc;
522 struct list children;
523 struct list script_hosts;
525 IHTMLEventObj *event;
527 HTMLImageElementFactory *image_factory;
528 HTMLOptionElementFactory *option_factory;
529 HTMLXMLHttpRequestFactory *xhr_factory;
530 IHTMLScreen *screen;
531 OmHistory *history;
532 IHTMLStorage *session_storage;
533 IHTMLStorage *local_storage;
535 BOOL performance_initialized;
536 VARIANT performance;
538 unsigned parser_callback_cnt;
539 struct list script_queue;
541 global_prop_t *global_props;
542 DWORD global_prop_cnt;
543 DWORD global_prop_size;
545 LONG task_magic;
547 HTMLLocation *location;
549 IMoniker *mon;
550 nsChannelBSC *bscallback;
551 struct list bindings;
554 typedef enum {
555 UNKNOWN_USERMODE,
556 BROWSEMODE,
557 EDITMODE
558 } USERMODE;
560 typedef struct _cp_static_data_t {
561 tid_t tid;
562 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
563 BOOL pass_event_arg;
564 DWORD id_cnt;
565 DISPID *ids;
566 } cp_static_data_t;
568 typedef struct {
569 const IID *riid;
570 cp_static_data_t *desc;
571 } cpc_entry_t;
573 typedef struct ConnectionPointContainer {
574 IConnectionPointContainer IConnectionPointContainer_iface;
576 ConnectionPoint *cps;
577 const cpc_entry_t *cp_entries;
578 IUnknown *outer;
579 struct ConnectionPointContainer *forward_container;
580 } ConnectionPointContainer;
582 struct ConnectionPoint {
583 IConnectionPoint IConnectionPoint_iface;
585 ConnectionPointContainer *container;
587 union {
588 IUnknown *unk;
589 IDispatch *disp;
590 IPropertyNotifySink *propnotif;
591 } *sinks;
592 DWORD sinks_size;
594 const IID *iid;
595 cp_static_data_t *data;
598 struct HTMLDocument {
599 IHTMLDocument2 IHTMLDocument2_iface;
600 IHTMLDocument3 IHTMLDocument3_iface;
601 IHTMLDocument4 IHTMLDocument4_iface;
602 IHTMLDocument5 IHTMLDocument5_iface;
603 IHTMLDocument6 IHTMLDocument6_iface;
604 IHTMLDocument7 IHTMLDocument7_iface;
605 IDocumentSelector IDocumentSelector_iface;
606 IDocumentEvent IDocumentEvent_iface;
607 IPersistMoniker IPersistMoniker_iface;
608 IPersistFile IPersistFile_iface;
609 IPersistHistory IPersistHistory_iface;
610 IMonikerProp IMonikerProp_iface;
611 IOleObject IOleObject_iface;
612 IOleDocument IOleDocument_iface;
613 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
614 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
615 IServiceProvider IServiceProvider_iface;
616 IOleCommandTarget IOleCommandTarget_iface;
617 IOleControl IOleControl_iface;
618 IHlinkTarget IHlinkTarget_iface;
619 IPersistStreamInit IPersistStreamInit_iface;
620 IDispatchEx IDispatchEx_iface;
621 ISupportErrorInfo ISupportErrorInfo_iface;
622 IObjectWithSite IObjectWithSite_iface;
623 IOleContainer IOleContainer_iface;
624 IObjectSafety IObjectSafety_iface;
625 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
626 IMarkupServices IMarkupServices_iface;
627 IMarkupContainer IMarkupContainer_iface;
628 IDisplayServices IDisplayServices_iface;
630 IUnknown *outer_unk;
631 IDispatchEx *dispex;
633 HTMLDocumentObj *doc_obj;
634 HTMLDocumentNode *doc_node;
636 HTMLOuterWindow *window;
638 ConnectionPointContainer cp_container;
641 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
643 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
646 static inline ULONG htmldoc_addref(HTMLDocument *This)
648 return IUnknown_AddRef(This->outer_unk);
651 static inline ULONG htmldoc_release(HTMLDocument *This)
653 return IUnknown_Release(This->outer_unk);
656 struct HTMLDocumentObj {
657 HTMLDocument basedoc;
658 DispatchEx dispex;
659 IUnknown IUnknown_inner;
660 ICustomDoc ICustomDoc_iface;
661 IOleDocumentView IOleDocumentView_iface;
662 IViewObjectEx IViewObjectEx_iface;
663 ITargetContainer ITargetContainer_iface;
665 IWindowForBindingUI IWindowForBindingUI_iface;
667 LONG ref;
669 GeckoBrowser *nscontainer;
671 IOleClientSite *client;
672 IDocHostUIHandler *hostui;
673 IOleCommandTarget *client_cmdtrg;
674 BOOL custom_hostui;
675 IOleInPlaceSite *ipsite;
676 IOleInPlaceFrame *frame;
677 IOleInPlaceUIWindow *ip_window;
678 IAdviseSink *view_sink;
679 IDocObjectService *doc_object_service;
680 IUnknown *webbrowser;
681 ITravelLog *travel_log;
682 IUnknown *browser_service;
683 IOleAdviseHolder *advise_holder;
685 DOCHOSTUIINFO hostinfo;
687 IOleUndoManager *undomgr;
688 IHTMLEditServices *editsvcs;
690 HWND hwnd;
691 HWND tooltips_hwnd;
693 BOOL is_mhtml;
694 BOOL request_uiactivate;
695 BOOL in_place_active;
696 BOOL ui_active;
697 BOOL window_active;
698 BOOL hostui_setup;
699 BOOL container_locked;
700 BOOL focus;
701 BOOL has_popup;
702 INT download_state;
704 LPWSTR mime;
706 DWORD update;
707 LONG task_magic;
710 typedef struct nsWeakReference nsWeakReference;
713 typedef enum {
714 SCRIPTMODE_GECKO,
715 SCRIPTMODE_ACTIVESCRIPT
716 } SCRIPTMODE;
718 struct GeckoBrowser {
719 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
720 nsIContextMenuListener nsIContextMenuListener_iface;
721 nsIURIContentListener nsIURIContentListener_iface;
722 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
723 nsITooltipListener nsITooltipListener_iface;
724 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
725 nsISupportsWeakReference nsISupportsWeakReference_iface;
727 nsIWebBrowser *webbrowser;
728 nsIWebNavigation *navigation;
729 nsIBaseWindow *window;
730 nsIWebBrowserFocus *focus;
732 HTMLOuterWindow *content_window;
734 nsIEditor *editor;
735 nsIController *editor_controller;
737 LONG ref;
739 nsWeakReference *weak_reference;
741 HTMLDocumentObj *doc;
743 nsIURIContentListener *content_listener;
745 HWND hwnd;
746 SCRIPTMODE script_mode;
747 USERMODE usermode;
749 struct list document_nodes;
750 struct list outer_windows;
753 typedef struct {
754 const CLSID *clsid;
755 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
756 void (*destructor)(HTMLDOMNode*);
757 const cpc_entry_t *cpc_entries;
758 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
759 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
760 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
761 EventTarget *(*get_event_prop_target)(HTMLDOMNode*,int);
762 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
763 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
764 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
765 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
766 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
767 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
768 HRESULT (*bind_to_tree)(HTMLDOMNode*);
769 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
770 void (*unlink)(HTMLDOMNode*);
771 BOOL (*is_text_edit)(HTMLDOMNode*);
772 BOOL (*is_settable)(HTMLDOMNode*,DISPID);
773 } NodeImplVtbl;
775 struct HTMLDOMNode {
776 EventTarget event_target;
777 IHTMLDOMNode IHTMLDOMNode_iface;
778 IHTMLDOMNode2 IHTMLDOMNode2_iface;
779 IHTMLDOMNode3 IHTMLDOMNode3_iface;
780 const NodeImplVtbl *vtbl;
782 nsCycleCollectingAutoRefCnt ccref;
784 nsIDOMNode *nsnode;
785 HTMLDocumentNode *doc;
788 static inline void node_addref(HTMLDOMNode *node)
790 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
793 static inline void node_release(HTMLDOMNode *node)
795 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
798 typedef struct {
799 HTMLDOMNode node;
800 ConnectionPointContainer cp_container;
802 IHTMLElement IHTMLElement_iface;
803 IHTMLElement2 IHTMLElement2_iface;
804 IHTMLElement3 IHTMLElement3_iface;
805 IHTMLElement4 IHTMLElement4_iface;
806 IHTMLElement6 IHTMLElement6_iface;
807 IHTMLUniqueName IHTMLUniqueName_iface;
808 IElementSelector IElementSelector_iface;
809 IElementTraversal IElementTraversal_iface;
810 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
812 nsIDOMElement *dom_element; /* NULL for legacy comments represented as HTML elements */
813 nsIDOMHTMLElement *html_element; /* NULL for non-HTML elements (like SVG elements) */
814 HTMLStyle *style;
815 HTMLStyle *runtime_style;
816 HTMLAttributeCollection *attrs;
817 WCHAR *filter;
818 unsigned unique_id;
819 } HTMLElement;
821 #define HTMLELEMENT_TIDS \
822 IHTMLDOMNode_tid, \
823 IHTMLDOMNode2_tid, \
824 IHTMLElement_tid, \
825 IHTMLElement3_tid, \
826 IHTMLElement4_tid, \
827 IHTMLUniqueName_tid
829 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN;
830 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
831 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN;
833 struct HTMLFrameBase {
834 HTMLElement element;
836 IHTMLFrameBase IHTMLFrameBase_iface;
837 IHTMLFrameBase2 IHTMLFrameBase2_iface;
839 HTMLOuterWindow *content_window;
841 nsIDOMHTMLFrameElement *nsframe;
842 nsIDOMHTMLIFrameElement *nsiframe;
845 typedef struct nsDocumentEventListener nsDocumentEventListener;
847 struct HTMLDocumentNode {
848 HTMLDOMNode node;
849 HTMLDocument basedoc;
851 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
853 nsIDocumentObserver nsIDocumentObserver_iface;
855 LONG ref;
857 HTMLInnerWindow *window;
859 GeckoBrowser *browser;
860 struct list browser_entry;
862 compat_mode_t document_mode;
863 BOOL document_mode_locked;
865 nsIDOMHTMLDocument *nsdoc;
866 BOOL content_ready;
868 IHTMLDOMImplementation *dom_implementation;
870 ICatInformation *catmgr;
871 nsDocumentEventListener *nsevent_listener;
872 BOOL *event_vector;
874 WCHAR **elem_vars;
875 unsigned elem_vars_size;
876 unsigned elem_vars_cnt;
878 BOOL skip_mutation_notif;
880 UINT charset;
882 unsigned unique_id;
884 struct list selection_list;
885 struct list range_list;
886 struct list plugin_hosts;
889 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
890 HRESULT MHTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
891 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
892 HRESULT create_document_node(nsIDOMHTMLDocument*,GeckoBrowser*,HTMLInnerWindow*,
893 compat_mode_t,HTMLDocumentNode**) DECLSPEC_HIDDEN;
895 HRESULT create_outer_window(GeckoBrowser*,mozIDOMWindowProxy*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
896 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
897 HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*) DECLSPEC_HIDDEN;
898 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
899 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
900 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
901 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN;
902 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
903 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
904 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
905 HRESULT create_performance(IHTMLPerformance**) DECLSPEC_HIDDEN;
906 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
907 HRESULT create_dom_implementation(HTMLDocumentNode*,IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
908 void detach_dom_implementation(IHTMLDOMImplementation*) DECLSPEC_HIDDEN;
910 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
912 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
913 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
914 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
915 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
917 void HTMLDocument_View_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
918 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
920 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
922 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
924 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
925 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
927 HRESULT create_gecko_browser(HTMLDocumentObj*,GeckoBrowser**) DECLSPEC_HIDDEN;
928 void detach_gecko_browser(GeckoBrowser*) DECLSPEC_HIDDEN;
930 compat_mode_t lock_document_mode(HTMLDocumentNode*) DECLSPEC_HIDDEN;
932 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
933 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
934 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
935 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
937 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
938 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
939 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
941 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
942 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
943 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
945 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN;
947 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
949 BOOL load_gecko(void) DECLSPEC_HIDDEN;
950 void close_gecko(void) DECLSPEC_HIDDEN;
951 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
952 void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
953 void release_nsio(void) DECLSPEC_HIDDEN;
954 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
955 void set_viewer_zoom(GeckoBrowser*,float) DECLSPEC_HIDDEN;
956 float get_viewer_zoom(GeckoBrowser*) DECLSPEC_HIDDEN;
958 void init_node_cc(void) DECLSPEC_HIDDEN;
960 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
962 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
963 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
965 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
966 void nsfree(void*) DECLSPEC_HIDDEN;
968 BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN;
969 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
970 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
971 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
972 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
974 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
975 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
976 void nsAString_SetData(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
977 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
978 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
980 HRESULT map_nsresult(nsresult) DECLSPEC_HIDDEN;
981 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
982 HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p) DECLSPEC_HIDDEN;
983 HRESULT variant_to_nsstr(VARIANT*,BOOL,nsAString*) DECLSPEC_HIDDEN;
984 HRESULT return_nsform(nsresult,nsIDOMHTMLFormElement*,IHTMLFormElement**) DECLSPEC_HIDDEN;
986 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
987 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
988 void setup_editor_controller(GeckoBrowser*) DECLSPEC_HIDDEN;
989 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
990 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
991 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN;
992 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
993 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
995 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
996 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
997 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
998 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
999 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
1000 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1002 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
1003 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
1005 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
1006 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
1007 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
1008 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
1010 void detach_document_node(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1011 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1012 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1013 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
1014 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
1016 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMElement**) DECLSPEC_HIDDEN;
1017 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1019 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1021 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
1022 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
1024 static inline BOOL is_main_content_window(HTMLOuterWindow *window)
1026 return window->browser && window == window->browser->content_window;
1029 struct HTMLAttributeCollection {
1030 DispatchEx dispex;
1031 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
1032 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
1033 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
1035 LONG ref;
1037 HTMLElement *elem;
1038 struct list attrs;
1041 typedef struct {
1042 DispatchEx dispex;
1043 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
1044 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
1046 LONG ref;
1048 /* value is valid only for detached attributes (when elem == NULL). */
1049 VARIANT value;
1050 /* name must be valid for detached attributes */
1051 WCHAR *name;
1053 HTMLElement *elem;
1054 DISPID dispid;
1055 struct list entry;
1056 } HTMLDOMAttribute;
1058 HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*) DECLSPEC_HIDDEN;
1060 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
1062 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
1063 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
1064 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1065 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1066 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1067 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1068 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1069 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1070 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1071 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1072 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1073 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1074 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1075 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1076 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1077 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1078 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1079 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1080 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1081 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1082 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1083 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1084 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1085 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1086 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1087 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1088 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1089 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1091 HRESULT create_svg_element(HTMLDocumentNode*,nsIDOMSVGElement*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1093 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1094 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1096 void EventTarget_Init(EventTarget*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1097 HRESULT EventTarget_QI(EventTarget*,REFIID,void**) DECLSPEC_HIDDEN;
1098 void EventTarget_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1100 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1101 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1102 void HTMLDOMNode_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1104 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1105 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1106 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1107 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
1108 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1109 void HTMLElement_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1111 HRESULT get_node(nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
1112 HRESULT get_element(nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1113 HRESULT get_document_node(nsIDOMDocument*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
1115 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
1117 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
1118 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
1119 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1120 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
1121 HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1123 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
1125 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
1126 IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,compat_mode_t) DECLSPEC_HIDDEN;
1127 IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,compat_mode_t) DECLSPEC_HIDDEN;
1128 IHTMLDOMChildrenCollection *create_child_collection(nsIDOMNodeList*) DECLSPEC_HIDDEN;
1130 HRESULT attr_value_to_string(VARIANT*) DECLSPEC_HIDDEN;
1131 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
1132 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN;
1134 nsresult get_elem_attr_value(nsIDOMElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
1135 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
1136 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
1138 HRESULT elem_unique_id(unsigned id, BSTR *p) DECLSPEC_HIDDEN;
1140 /* commands */
1141 typedef struct {
1142 DWORD id;
1143 HRESULT (*query)(HTMLDocumentNode*,OLECMD*);
1144 HRESULT (*exec)(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*);
1145 } cmdtable_t;
1147 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
1149 void do_ns_command(HTMLDocumentNode*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
1151 /* timer */
1152 #define UPDATE_UI 0x0001
1153 #define UPDATE_TITLE 0x0002
1155 void update_doc(HTMLDocumentObj*,DWORD) DECLSPEC_HIDDEN;
1156 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1157 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
1159 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
1161 /* editor */
1162 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1163 void init_editor(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1164 void handle_edit_event(HTMLDocumentNode*,nsIDOMEvent*) DECLSPEC_HIDDEN;
1165 HRESULT editor_exec_copy(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1166 HRESULT editor_exec_cut(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1167 HRESULT editor_exec_paste(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1168 HRESULT browser_is_dirty(GeckoBrowser*) DECLSPEC_HIDDEN;
1169 void set_dirty(GeckoBrowser*,VARIANT_BOOL) DECLSPEC_HIDDEN;
1171 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
1173 typedef struct task_t task_t;
1174 typedef void (*task_proc_t)(task_t*);
1176 struct task_t {
1177 LONG target_magic;
1178 task_proc_t proc;
1179 task_proc_t destr;
1180 struct list entry;
1183 typedef struct {
1184 task_t header;
1185 HTMLDocumentObj *doc;
1186 } docobj_task_t;
1188 typedef struct {
1189 HWND thread_hwnd;
1190 struct list task_list;
1191 struct list timer_list;
1192 } thread_data_t;
1194 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1195 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1197 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1198 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1199 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1201 HRESULT set_task_timer(HTMLInnerWindow*,LONG,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1202 HRESULT clear_task_timer(HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
1204 BOOL parse_compat_version(const WCHAR*,compat_mode_t*) DECLSPEC_HIDDEN;
1206 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1208 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1209 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1210 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1211 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1212 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1214 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1216 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1218 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1219 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1221 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1222 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1224 /* memory allocation functions */
1226 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1228 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1231 static inline LPWSTR heap_strdupW(LPCWSTR str)
1233 LPWSTR ret = NULL;
1235 if(str) {
1236 DWORD size;
1238 size = (lstrlenW(str)+1)*sizeof(WCHAR);
1239 ret = heap_alloc(size);
1240 if(ret)
1241 memcpy(ret, str, size);
1244 return ret;
1247 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1249 LPWSTR ret = NULL;
1251 if(str) {
1252 ret = heap_alloc((len+1)*sizeof(WCHAR));
1253 if(ret)
1255 memcpy(ret, str, len*sizeof(WCHAR));
1256 ret[len] = 0;
1260 return ret;
1263 static inline char *heap_strdupA(const char *str)
1265 char *ret = NULL;
1267 if(str) {
1268 DWORD size;
1270 size = strlen(str)+1;
1271 ret = heap_alloc(size);
1272 if(ret)
1273 memcpy(ret, str, size);
1276 return ret;
1279 static inline WCHAR *heap_strdupAtoW(const char *str)
1281 LPWSTR ret = NULL;
1283 if(str) {
1284 DWORD len;
1286 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1287 ret = heap_alloc(len*sizeof(WCHAR));
1288 if(ret)
1289 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1292 return ret;
1295 static inline char *heap_strdupWtoA(LPCWSTR str)
1297 char *ret = NULL;
1299 if(str) {
1300 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1301 ret = heap_alloc(size);
1302 if(ret)
1303 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1306 return ret;
1309 static inline WCHAR *heap_strdupUtoW(const char *str)
1311 WCHAR *ret = NULL;
1313 if(str) {
1314 size_t len;
1316 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1317 ret = heap_alloc(len*sizeof(WCHAR));
1318 if(ret)
1319 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1322 return ret;
1325 static inline char *heap_strdupWtoU(const WCHAR *str)
1327 char *ret = NULL;
1329 if(str) {
1330 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1331 ret = heap_alloc(size);
1332 if(ret)
1333 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1336 return ret;
1339 static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len)
1341 char *ret = NULL;
1342 DWORD size;
1344 if(str && len) {
1345 size = WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL);
1346 ret = heap_alloc(size + 1);
1347 if(ret) {
1348 WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL);
1349 ret[size] = '\0';
1353 return ret;
1356 static inline VARIANT_BOOL variant_bool(BOOL b)
1358 return b ? VARIANT_TRUE : VARIANT_FALSE;
1361 #ifdef __i386__
1362 extern void *call_thiscall_func;
1363 #endif
1365 compat_mode_t get_max_compat_mode(IUri*) DECLSPEC_HIDDEN;
1366 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
1367 BSTR charset_string_from_cp(UINT) DECLSPEC_HIDDEN;
1368 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1369 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1370 IInternetSecurityManager *get_security_manager(void) DECLSPEC_HIDDEN;
1372 extern HINSTANCE hInst DECLSPEC_HIDDEN;