shlwapi/tests: Add some tests for memory stream.
[wine.git] / dlls / mshtml / mshtml_private.h
blobd551693363ad370b616f3ecda9a018545f40a281
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"
36 #include "wine/unicode.h"
38 #ifdef INIT_GUID
39 #include "initguid.h"
40 #endif
42 #include "nsiface.h"
44 #define NS_ERROR_GENERATE_FAILURE(module,code) \
45 ((nsresult) (((UINT32)(1u<<31)) | ((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
46 #define NS_ERROR_GENERATE_SUCCESS(module,code) \
47 ((nsresult) (((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
49 #define NS_OK ((nsresult)0x00000000L)
50 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
51 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
52 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
53 #define NS_NOINTERFACE ((nsresult)0x80004002L)
54 #define NS_ERROR_INVALID_POINTER ((nsresult)0x80004003L)
55 #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
56 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
57 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
58 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
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(DispDOMEvent) \
84 XDIID(DispDOMKeyboardEvent) \
85 XDIID(DispDOMMouseEvent) \
86 XDIID(DispDOMUIEvent) \
87 XDIID(DispHTMLAnchorElement) \
88 XDIID(DispHTMLAreaElement) \
89 XDIID(DispHTMLAttributeCollection) \
90 XDIID(DispHTMLBody) \
91 XDIID(DispHTMLButtonElement) \
92 XDIID(DispHTMLCommentElement) \
93 XDIID(DispHTMLCurrentStyle) \
94 XDIID(DispHTMLDocument) \
95 XDIID(DispHTMLDOMAttribute) \
96 XDIID(DispHTMLDOMTextNode) \
97 XDIID(DispHTMLElementCollection) \
98 XDIID(DispHTMLEmbed) \
99 XDIID(DispHTMLFormElement) \
100 XDIID(DispHTMLGenericElement) \
101 XDIID(DispHTMLFrameElement) \
102 XDIID(DispHTMLHeadElement) \
103 XDIID(DispHTMLHtmlElement) \
104 XDIID(DispHTMLHistory) \
105 XDIID(DispHTMLIFrame) \
106 XDIID(DispHTMLImg) \
107 XDIID(DispHTMLInputElement) \
108 XDIID(DispHTMLLabelElement) \
109 XDIID(DispHTMLLinkElement) \
110 XDIID(DispHTMLLocation) \
111 XDIID(DispHTMLMetaElement) \
112 XDIID(DispHTMLNavigator) \
113 XDIID(DispHTMLObjectElement) \
114 XDIID(DispHTMLOptionElement) \
115 XDIID(DispHTMLScreen) \
116 XDIID(DispHTMLScriptElement) \
117 XDIID(DispHTMLSelectElement) \
118 XDIID(DispHTMLStyle) \
119 XDIID(DispHTMLStyleElement) \
120 XDIID(DispHTMLStyleSheet) \
121 XDIID(DispHTMLStyleSheetRulesCollection) \
122 XDIID(DispHTMLStyleSheetsCollection) \
123 XDIID(DispHTMLTable) \
124 XDIID(DispHTMLTableCell) \
125 XDIID(DispHTMLTableRow) \
126 XDIID(DispHTMLTextAreaElement) \
127 XDIID(DispHTMLTitleElement) \
128 XDIID(DispHTMLUnknownElement) \
129 XDIID(DispHTMLWindow2) \
130 XDIID(DispHTMLXMLHttpRequest) \
131 XDIID(HTMLDocumentEvents) \
132 XDIID(HTMLElementEvents2) \
133 XIID(IDOMEvent) \
134 XIID(IDOMKeyboardEvent) \
135 XIID(IDOMMouseEvent) \
136 XIID(IDOMUIEvent) \
137 XIID(IDocumentEvent) \
138 XIID(IDocumentSelector) \
139 XIID(IElementSelector) \
140 XIID(IElementTraversal) \
141 XIID(IEventTarget) \
142 XIID(IHTMLAnchorElement) \
143 XIID(IHTMLAreaElement) \
144 XIID(IHTMLAttributeCollection) \
145 XIID(IHTMLAttributeCollection2) \
146 XIID(IHTMLAttributeCollection3) \
147 XIID(IHTMLBodyElement) \
148 XIID(IHTMLBodyElement2) \
149 XIID(IHTMLButtonElement) \
150 XIID(IHTMLCSSStyleDeclaration) \
151 XIID(IHTMLCSSStyleDeclaration2) \
152 XIID(IHTMLCommentElement) \
153 XIID(IHTMLCurrentStyle) \
154 XIID(IHTMLCurrentStyle2) \
155 XIID(IHTMLCurrentStyle3) \
156 XIID(IHTMLCurrentStyle4) \
157 XIID(IHTMLDocument2) \
158 XIID(IHTMLDocument3) \
159 XIID(IHTMLDocument4) \
160 XIID(IHTMLDocument5) \
161 XIID(IHTMLDocument6) \
162 XIID(IHTMLDocument7) \
163 XIID(IHTMLDOMAttribute) \
164 XIID(IHTMLDOMAttribute2) \
165 XIID(IHTMLDOMChildrenCollection) \
166 XIID(IHTMLDOMImplementation) \
167 XIID(IHTMLDOMNode) \
168 XIID(IHTMLDOMNode2) \
169 XIID(IHTMLDOMNode3) \
170 XIID(IHTMLDOMTextNode) \
171 XIID(IHTMLDOMTextNode2) \
172 XIID(IHTMLElement) \
173 XIID(IHTMLElement2) \
174 XIID(IHTMLElement3) \
175 XIID(IHTMLElement4) \
176 XIID(IHTMLElement6) \
177 XIID(IHTMLElementCollection) \
178 XIID(IHTMLEmbedElement) \
179 XIID(IHTMLEventObj) \
180 XIID(IHTMLFiltersCollection) \
181 XIID(IHTMLFormElement) \
182 XIID(IHTMLFrameBase) \
183 XIID(IHTMLFrameBase2) \
184 XIID(IHTMLFrameElement3) \
185 XIID(IHTMLGenericElement) \
186 XIID(IHTMLHeadElement) \
187 XIID(IHTMLHtmlElement) \
188 XIID(IHTMLIFrameElement) \
189 XIID(IHTMLIFrameElement2) \
190 XIID(IHTMLIFrameElement3) \
191 XIID(IHTMLImageElementFactory) \
192 XIID(IHTMLImgElement) \
193 XIID(IHTMLInputElement) \
194 XIID(IHTMLInputTextElement2) \
195 XIID(IHTMLLabelElement) \
196 XIID(IHTMLLinkElement) \
197 XIID(IHTMLLocation) \
198 XIID(IHTMLMetaElement) \
199 XIID(IHTMLMimeTypesCollection) \
200 XIID(IHTMLObjectElement) \
201 XIID(IHTMLObjectElement2) \
202 XIID(IHTMLOptionElement) \
203 XIID(IHTMLOptionElementFactory) \
204 XIID(IHTMLPerformance) \
205 XIID(IHTMLPerformanceNavigation) \
206 XIID(IHTMLPerformanceTiming) \
207 XIID(IHTMLPluginsCollection) \
208 XIID(IHTMLRect) \
209 XIID(IHTMLScreen) \
210 XIID(IHTMLScriptElement) \
211 XIID(IHTMLSelectElement) \
212 XIID(IHTMLSelectionObject) \
213 XIID(IHTMLSelectionObject2) \
214 XIID(IHTMLStorage) \
215 XIID(IHTMLStyle) \
216 XIID(IHTMLStyle2) \
217 XIID(IHTMLStyle3) \
218 XIID(IHTMLStyle4) \
219 XIID(IHTMLStyle5) \
220 XIID(IHTMLStyle6) \
221 XIID(IHTMLStyleElement) \
222 XIID(IHTMLStyleSheet) \
223 XIID(IHTMLStyleSheetRulesCollection) \
224 XIID(IHTMLStyleSheetsCollection) \
225 XIID(IHTMLTable) \
226 XIID(IHTMLTable2) \
227 XIID(IHTMLTable3) \
228 XIID(IHTMLTableCell) \
229 XIID(IHTMLTableRow) \
230 XIID(IHTMLTextAreaElement) \
231 XIID(IHTMLTextContainer) \
232 XIID(IHTMLTitleElement) \
233 XIID(IHTMLTxtRange) \
234 XIID(IHTMLUniqueName) \
235 XIID(IHTMLWindow2) \
236 XIID(IHTMLWindow3) \
237 XIID(IHTMLWindow4) \
238 XIID(IHTMLWindow5) \
239 XIID(IHTMLWindow6) \
240 XIID(IHTMLWindow7) \
241 XIID(IHTMLXMLHttpRequest) \
242 XIID(IHTMLXMLHttpRequestFactory) \
243 XIID(IOmHistory) \
244 XIID(IOmNavigator)
246 typedef enum {
247 #define XIID(iface) iface ## _tid,
248 #define XDIID(iface) iface ## _tid,
249 TID_LIST
250 #undef XIID
251 #undef XDIID
252 LAST_tid
253 } tid_t;
255 typedef enum {
256 COMPAT_MODE_QUIRKS,
257 COMPAT_MODE_IE5,
258 COMPAT_MODE_IE7,
259 COMPAT_MODE_IE8,
260 COMPAT_MODE_IE9,
261 COMPAT_MODE_IE10,
262 COMPAT_MODE_IE11
263 } compat_mode_t;
265 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
266 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
268 typedef struct {
269 unsigned document_mode;
270 unsigned ie_version;
271 } compat_mode_info_t;
273 extern const compat_mode_info_t compat_mode_info[COMPAT_MODE_CNT] DECLSPEC_HIDDEN;
275 typedef struct dispex_data_t dispex_data_t;
276 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
278 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
279 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
280 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
282 typedef struct DispatchEx DispatchEx;
284 typedef struct {
285 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
286 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
287 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
288 compat_mode_t (*get_compat_mode)(DispatchEx*);
289 HRESULT (*populate_props)(DispatchEx*);
290 } dispex_static_data_vtbl_t;
292 typedef struct {
293 const dispex_static_data_vtbl_t *vtbl;
294 const tid_t disp_tid;
295 const tid_t* const iface_tids;
296 void (*init_info)(dispex_data_t*,compat_mode_t);
297 dispex_data_t *info_cache[COMPAT_MODE_CNT];
298 dispex_data_t *delayed_init_info;
299 } dispex_static_data_t;
301 typedef HRESULT (*dispex_hook_invoke_t)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,
302 EXCEPINFO*,IServiceProvider*);
304 typedef struct {
305 DISPID dispid;
306 dispex_hook_invoke_t invoke;
307 } dispex_hook_t;
309 struct DispatchEx {
310 IDispatchEx IDispatchEx_iface;
312 IUnknown *outer;
314 dispex_data_t *info;
315 dispex_dynamic_data_t *dynamic_data;
318 typedef struct {
319 UINT_PTR x;
320 } nsCycleCollectingAutoRefCnt;
322 typedef struct {
323 void *vtbl;
324 int ref_flags;
325 void *callbacks;
326 } ExternalCycleCollectionParticipant;
328 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
330 typedef struct {
331 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
332 nsresult (NSAPI *unlink)(void*);
333 void (NSAPI *delete_cycle_collectable)(void*);
334 } CCObjCallback;
336 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
338 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN;
339 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN;
340 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN;
341 void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN;
342 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
343 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
345 void init_dispex_with_compat_mode(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
346 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
347 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
348 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
349 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
350 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
351 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
352 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
353 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
354 void release_typelib(void) DECLSPEC_HIDDEN;
355 HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**) DECLSPEC_HIDDEN;
356 const void *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
357 void dispex_info_add_interface(dispex_data_t*,tid_t,const dispex_hook_t*) DECLSPEC_HIDDEN;
358 compat_mode_t dispex_compat_mode(DispatchEx*) DECLSPEC_HIDDEN;
360 static inline void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *desc)
362 init_dispex_with_compat_mode(dispex, outer, desc, COMPAT_MODE_NONE);
365 typedef enum {
366 DISPEXPROP_CUSTOM,
367 DISPEXPROP_DYNAMIC,
368 DISPEXPROP_BUILTIN
369 } dispex_prop_type_t;
371 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
373 typedef struct HTMLWindow HTMLWindow;
374 typedef struct HTMLInnerWindow HTMLInnerWindow;
375 typedef struct HTMLOuterWindow HTMLOuterWindow;
376 typedef struct HTMLDocumentNode HTMLDocumentNode;
377 typedef struct HTMLDocumentObj HTMLDocumentObj;
378 typedef struct HTMLFrameBase HTMLFrameBase;
379 typedef struct NSContainer NSContainer;
380 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
382 typedef enum {
383 SCRIPTMODE_GECKO,
384 SCRIPTMODE_ACTIVESCRIPT
385 } SCRIPTMODE;
387 typedef struct ScriptHost ScriptHost;
389 typedef enum {
390 GLOBAL_SCRIPTVAR,
391 GLOBAL_ELEMENTVAR,
392 GLOBAL_DISPEXVAR,
393 GLOBAL_FRAMEVAR
394 } global_prop_type_t;
396 typedef struct {
397 global_prop_type_t type;
398 WCHAR *name;
399 ScriptHost *script_host;
400 DISPID id;
401 } global_prop_t;
403 struct EventTarget {
404 DispatchEx dispex;
405 IEventTarget IEventTarget_iface;
406 struct wine_rb_tree handler_map;
409 typedef struct {
410 DispatchEx dispex;
411 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
413 LONG ref;
415 HTMLInnerWindow *window;
416 } HTMLOptionElementFactory;
418 typedef struct {
419 DispatchEx dispex;
420 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
422 LONG ref;
424 HTMLInnerWindow *window;
425 } HTMLImageElementFactory;
427 typedef struct {
428 DispatchEx dispex;
429 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
431 LONG ref;
433 HTMLInnerWindow *window;
434 } HTMLXMLHttpRequestFactory;
436 struct HTMLLocation {
437 DispatchEx dispex;
438 IHTMLLocation IHTMLLocation_iface;
440 LONG ref;
442 HTMLInnerWindow *window;
445 typedef struct {
446 DispatchEx dispex;
447 IOmHistory IOmHistory_iface;
449 LONG ref;
451 HTMLInnerWindow *window;
452 } OmHistory;
454 typedef struct {
455 HTMLOuterWindow *window;
456 LONG ref;
457 } windowref_t;
459 typedef struct nsChannelBSC nsChannelBSC;
461 struct HTMLWindow {
462 IHTMLWindow2 IHTMLWindow2_iface;
463 IHTMLWindow3 IHTMLWindow3_iface;
464 IHTMLWindow4 IHTMLWindow4_iface;
465 IHTMLWindow5 IHTMLWindow5_iface;
466 IHTMLWindow6 IHTMLWindow6_iface;
467 IHTMLWindow7 IHTMLWindow7_iface;
468 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
469 IDispatchEx IDispatchEx_iface;
470 IServiceProvider IServiceProvider_iface;
471 ITravelLogClient ITravelLogClient_iface;
472 IObjectIdentity IObjectIdentity_iface;
473 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
475 LONG ref;
477 HTMLInnerWindow *inner_window;
478 HTMLOuterWindow *outer_window;
481 struct HTMLOuterWindow {
482 HTMLWindow base;
484 windowref_t *window_ref;
485 LONG task_magic;
487 HTMLDocumentObj *doc_obj;
488 nsIDOMWindow *nswindow;
489 mozIDOMWindowProxy *window_proxy;
490 HTMLOuterWindow *parent;
491 HTMLFrameBase *frame_element;
493 READYSTATE readystate;
494 BOOL readystate_locked;
495 unsigned readystate_pending;
497 HTMLInnerWindow *pending_window;
498 IMoniker *mon;
499 IUri *uri;
500 IUri *uri_nofrag;
501 BSTR url;
502 DWORD load_flags;
504 SCRIPTMODE scriptmode;
506 IInternetSecurityManager *secmgr;
508 struct list children;
509 struct list sibling_entry;
510 struct wine_rb_entry entry;
513 struct HTMLInnerWindow {
514 HTMLWindow base;
515 EventTarget event_target;
517 HTMLDocumentNode *doc;
519 struct list script_hosts;
521 IHTMLEventObj *event;
523 HTMLImageElementFactory *image_factory;
524 HTMLOptionElementFactory *option_factory;
525 HTMLXMLHttpRequestFactory *xhr_factory;
526 IHTMLScreen *screen;
527 OmHistory *history;
528 IHTMLStorage *session_storage;
530 BOOL performance_initialized;
531 VARIANT performance;
533 unsigned parser_callback_cnt;
534 struct list script_queue;
536 global_prop_t *global_props;
537 DWORD global_prop_cnt;
538 DWORD global_prop_size;
540 LONG task_magic;
542 HTMLLocation *location;
544 IMoniker *mon;
545 nsChannelBSC *bscallback;
546 struct list bindings;
549 typedef enum {
550 UNKNOWN_USERMODE,
551 BROWSEMODE,
552 EDITMODE
553 } USERMODE;
555 typedef struct _cp_static_data_t {
556 tid_t tid;
557 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
558 BOOL pass_event_arg;
559 DWORD id_cnt;
560 DISPID *ids;
561 } cp_static_data_t;
563 typedef struct {
564 const IID *riid;
565 cp_static_data_t *desc;
566 } cpc_entry_t;
568 typedef struct ConnectionPointContainer {
569 IConnectionPointContainer IConnectionPointContainer_iface;
571 ConnectionPoint *cps;
572 const cpc_entry_t *cp_entries;
573 IUnknown *outer;
574 struct ConnectionPointContainer *forward_container;
575 } ConnectionPointContainer;
577 struct ConnectionPoint {
578 IConnectionPoint IConnectionPoint_iface;
580 ConnectionPointContainer *container;
582 union {
583 IUnknown *unk;
584 IDispatch *disp;
585 IPropertyNotifySink *propnotif;
586 } *sinks;
587 DWORD sinks_size;
589 const IID *iid;
590 cp_static_data_t *data;
593 struct HTMLDocument {
594 IHTMLDocument2 IHTMLDocument2_iface;
595 IHTMLDocument3 IHTMLDocument3_iface;
596 IHTMLDocument4 IHTMLDocument4_iface;
597 IHTMLDocument5 IHTMLDocument5_iface;
598 IHTMLDocument6 IHTMLDocument6_iface;
599 IHTMLDocument7 IHTMLDocument7_iface;
600 IDocumentSelector IDocumentSelector_iface;
601 IDocumentEvent IDocumentEvent_iface;
602 IPersistMoniker IPersistMoniker_iface;
603 IPersistFile IPersistFile_iface;
604 IPersistHistory IPersistHistory_iface;
605 IMonikerProp IMonikerProp_iface;
606 IOleObject IOleObject_iface;
607 IOleDocument IOleDocument_iface;
608 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
609 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
610 IServiceProvider IServiceProvider_iface;
611 IOleCommandTarget IOleCommandTarget_iface;
612 IOleControl IOleControl_iface;
613 IHlinkTarget IHlinkTarget_iface;
614 IPersistStreamInit IPersistStreamInit_iface;
615 IDispatchEx IDispatchEx_iface;
616 ISupportErrorInfo ISupportErrorInfo_iface;
617 IObjectWithSite IObjectWithSite_iface;
618 IOleContainer IOleContainer_iface;
619 IObjectSafety IObjectSafety_iface;
620 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
622 IUnknown *outer_unk;
623 IDispatchEx *dispex;
625 HTMLDocumentObj *doc_obj;
626 HTMLDocumentNode *doc_node;
628 HTMLOuterWindow *window;
630 ConnectionPointContainer cp_container;
633 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
635 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
638 static inline ULONG htmldoc_addref(HTMLDocument *This)
640 return IUnknown_AddRef(This->outer_unk);
643 static inline ULONG htmldoc_release(HTMLDocument *This)
645 return IUnknown_Release(This->outer_unk);
648 struct HTMLDocumentObj {
649 HTMLDocument basedoc;
650 DispatchEx dispex;
651 IUnknown IUnknown_outer;
652 ICustomDoc ICustomDoc_iface;
653 IOleDocumentView IOleDocumentView_iface;
654 IViewObjectEx IViewObjectEx_iface;
655 ITargetContainer ITargetContainer_iface;
657 IWindowForBindingUI IWindowForBindingUI_iface;
659 LONG ref;
661 NSContainer *nscontainer;
663 IOleClientSite *client;
664 IDocHostUIHandler *hostui;
665 IOleCommandTarget *client_cmdtrg;
666 BOOL custom_hostui;
667 IOleInPlaceSite *ipsite;
668 IOleInPlaceFrame *frame;
669 IOleInPlaceUIWindow *ip_window;
670 IAdviseSink *view_sink;
671 IDocObjectService *doc_object_service;
672 IUnknown *webbrowser;
673 ITravelLog *travel_log;
674 IUnknown *browser_service;
675 IOleAdviseHolder *advise_holder;
677 DOCHOSTUIINFO hostinfo;
679 IOleUndoManager *undomgr;
680 IHTMLEditServices *editsvcs;
682 HWND hwnd;
683 HWND tooltips_hwnd;
685 BOOL is_mhtml;
686 BOOL request_uiactivate;
687 BOOL in_place_active;
688 BOOL ui_active;
689 BOOL window_active;
690 BOOL hostui_setup;
691 BOOL container_locked;
692 BOOL focus;
693 BOOL has_popup;
694 INT download_state;
696 USERMODE usermode;
697 LPWSTR mime;
699 DWORD update;
700 LONG task_magic;
703 typedef struct nsWeakReference nsWeakReference;
705 struct NSContainer {
706 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
707 nsIContextMenuListener nsIContextMenuListener_iface;
708 nsIURIContentListener nsIURIContentListener_iface;
709 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
710 nsITooltipListener nsITooltipListener_iface;
711 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
712 nsISupportsWeakReference nsISupportsWeakReference_iface;
714 nsIWebBrowser *webbrowser;
715 nsIWebNavigation *navigation;
716 nsIBaseWindow *window;
717 nsIWebBrowserFocus *focus;
719 nsIEditor *editor;
720 nsIController *editor_controller;
722 LONG ref;
724 nsWeakReference *weak_reference;
726 HTMLDocumentObj *doc;
728 nsIURIContentListener *content_listener;
730 HWND hwnd;
733 typedef struct {
734 const CLSID *clsid;
735 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
736 void (*destructor)(HTMLDOMNode*);
737 const cpc_entry_t *cpc_entries;
738 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
739 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
740 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
741 EventTarget *(*get_event_prop_target)(HTMLDOMNode*,int);
742 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
743 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
744 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
745 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
746 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
747 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
748 HRESULT (*bind_to_tree)(HTMLDOMNode*);
749 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
750 void (*unlink)(HTMLDOMNode*);
751 BOOL (*is_text_edit)(HTMLDOMNode*);
752 BOOL (*is_settable)(HTMLDOMNode*,DISPID);
753 } NodeImplVtbl;
755 struct HTMLDOMNode {
756 EventTarget event_target;
757 IHTMLDOMNode IHTMLDOMNode_iface;
758 IHTMLDOMNode2 IHTMLDOMNode2_iface;
759 IHTMLDOMNode3 IHTMLDOMNode3_iface;
760 const NodeImplVtbl *vtbl;
762 nsCycleCollectingAutoRefCnt ccref;
764 nsIDOMNode *nsnode;
765 HTMLDocumentNode *doc;
768 static inline void node_addref(HTMLDOMNode *node)
770 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
773 static inline void node_release(HTMLDOMNode *node)
775 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
778 typedef struct {
779 HTMLDOMNode node;
780 ConnectionPointContainer cp_container;
782 IHTMLElement IHTMLElement_iface;
783 IHTMLElement2 IHTMLElement2_iface;
784 IHTMLElement3 IHTMLElement3_iface;
785 IHTMLElement4 IHTMLElement4_iface;
786 IHTMLElement6 IHTMLElement6_iface;
787 IHTMLUniqueName IHTMLUniqueName_iface;
788 IElementSelector IElementSelector_iface;
789 IElementTraversal IElementTraversal_iface;
790 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
792 nsIDOMElement *dom_element; /* NULL for legacy comments represented as HTML elements */
793 nsIDOMHTMLElement *html_element; /* NULL for non-HTML elements (like SVG elements) */
794 HTMLStyle *style;
795 HTMLStyle *runtime_style;
796 HTMLAttributeCollection *attrs;
797 WCHAR *filter;
798 unsigned unique_id;
799 } HTMLElement;
801 #define HTMLELEMENT_TIDS \
802 IHTMLDOMNode_tid, \
803 IHTMLDOMNode2_tid, \
804 IHTMLElement_tid, \
805 IHTMLElement3_tid, \
806 IHTMLElement4_tid, \
807 IHTMLUniqueName_tid
809 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN;
810 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
811 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN;
813 struct HTMLFrameBase {
814 HTMLElement element;
816 IHTMLFrameBase IHTMLFrameBase_iface;
817 IHTMLFrameBase2 IHTMLFrameBase2_iface;
819 HTMLOuterWindow *content_window;
821 nsIDOMHTMLFrameElement *nsframe;
822 nsIDOMHTMLIFrameElement *nsiframe;
825 typedef struct nsDocumentEventListener nsDocumentEventListener;
827 struct HTMLDocumentNode {
828 HTMLDOMNode node;
829 HTMLDocument basedoc;
831 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
833 nsIDocumentObserver nsIDocumentObserver_iface;
835 LONG ref;
837 HTMLInnerWindow *window;
839 compat_mode_t document_mode;
840 BOOL document_mode_locked;
842 nsIDOMHTMLDocument *nsdoc;
843 BOOL content_ready;
845 IHTMLDOMImplementation *dom_implementation;
847 ICatInformation *catmgr;
848 nsDocumentEventListener *nsevent_listener;
849 BOOL *event_vector;
851 WCHAR **elem_vars;
852 unsigned elem_vars_size;
853 unsigned elem_vars_cnt;
855 BOOL skip_mutation_notif;
857 UINT charset;
859 unsigned unique_id;
861 struct list selection_list;
862 struct list range_list;
863 struct list plugin_hosts;
866 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
867 HRESULT MHTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
868 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
869 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
871 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
872 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
873 HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*) DECLSPEC_HIDDEN;
874 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
875 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
876 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
877 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN;
878 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
879 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
880 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
881 HRESULT create_performance(IHTMLPerformance**) DECLSPEC_HIDDEN;
882 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
883 HRESULT create_dom_implementation(IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
885 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
887 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
888 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
889 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
890 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
892 void HTMLDocument_View_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
893 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
895 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
897 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
899 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
900 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
902 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
903 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
905 compat_mode_t lock_document_mode(HTMLDocumentNode*) DECLSPEC_HIDDEN;
907 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
908 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
909 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
910 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
912 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
913 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
914 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
916 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
917 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
918 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
920 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN;
922 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
924 BOOL load_gecko(void) DECLSPEC_HIDDEN;
925 void close_gecko(void) DECLSPEC_HIDDEN;
926 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
927 void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
928 void release_nsio(void) DECLSPEC_HIDDEN;
929 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
930 void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
932 void init_node_cc(void) DECLSPEC_HIDDEN;
934 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
936 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
937 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
939 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
940 void nsfree(void*) DECLSPEC_HIDDEN;
942 BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN;
943 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
944 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
945 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
946 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
948 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
949 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
950 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
951 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
953 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
954 HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p) DECLSPEC_HIDDEN;
955 HRESULT return_nsform(nsresult,nsIDOMHTMLFormElement*,IHTMLFormElement**) DECLSPEC_HIDDEN;
957 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
958 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
959 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
960 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
961 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
962 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN;
963 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
964 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
966 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
967 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
968 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
969 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
970 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
971 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
973 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
974 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
976 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
977 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
978 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
979 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
981 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
982 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
983 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
984 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
986 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMElement**) DECLSPEC_HIDDEN;
987 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
989 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
991 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
992 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
995 struct HTMLAttributeCollection {
996 DispatchEx dispex;
997 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
998 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
999 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
1001 LONG ref;
1003 HTMLElement *elem;
1004 struct list attrs;
1007 typedef struct {
1008 DispatchEx dispex;
1009 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
1010 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
1012 LONG ref;
1014 /* value is valid only for detached attributes (when elem == NULL). */
1015 VARIANT value;
1016 /* name must be valid for detached attributes */
1017 WCHAR *name;
1019 HTMLElement *elem;
1020 DISPID dispid;
1021 struct list entry;
1022 } HTMLDOMAttribute;
1024 HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*) DECLSPEC_HIDDEN;
1026 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
1028 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
1029 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
1030 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1031 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1032 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1033 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1034 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1035 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1036 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1037 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1038 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1039 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1040 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1041 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1042 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1043 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1044 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1045 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1046 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1047 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1048 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1049 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1050 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1051 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1052 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1053 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1054 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1055 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1057 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1058 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1060 void EventTarget_Init(EventTarget*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1061 HRESULT EventTarget_QI(EventTarget*,REFIID,void**) DECLSPEC_HIDDEN;
1062 void EventTarget_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1064 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1065 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1066 void HTMLDOMNode_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1068 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1069 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1070 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1071 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
1072 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1073 void HTMLElement_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1075 HRESULT get_node(nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
1076 HRESULT get_element(nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1077 HRESULT get_document_node(nsIDOMDocument*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
1079 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
1081 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
1082 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
1083 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1084 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
1085 HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1087 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
1089 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
1090 IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,compat_mode_t) DECLSPEC_HIDDEN;
1091 IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,compat_mode_t) DECLSPEC_HIDDEN;
1092 IHTMLDOMChildrenCollection *create_child_collection(nsIDOMNodeList*) DECLSPEC_HIDDEN;
1094 HRESULT attr_value_to_string(VARIANT*) DECLSPEC_HIDDEN;
1095 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
1096 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN;
1098 nsresult get_elem_attr_value(nsIDOMElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
1099 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
1100 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
1102 HRESULT elem_unique_id(unsigned id, BSTR *p) DECLSPEC_HIDDEN;
1104 /* commands */
1105 typedef struct {
1106 DWORD id;
1107 HRESULT (*query)(HTMLDocument*,OLECMD*);
1108 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
1109 } cmdtable_t;
1111 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
1113 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
1115 /* timer */
1116 #define UPDATE_UI 0x0001
1117 #define UPDATE_TITLE 0x0002
1119 void update_doc(HTMLDocumentObj*,DWORD) DECLSPEC_HIDDEN;
1120 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1121 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
1123 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
1125 /* editor */
1126 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1127 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
1128 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
1129 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1130 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1131 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1132 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
1133 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
1134 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
1136 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
1138 typedef struct task_t task_t;
1139 typedef void (*task_proc_t)(task_t*);
1141 struct task_t {
1142 LONG target_magic;
1143 task_proc_t proc;
1144 task_proc_t destr;
1145 struct list entry;
1148 typedef struct {
1149 task_t header;
1150 HTMLDocumentObj *doc;
1151 } docobj_task_t;
1153 typedef struct {
1154 HWND thread_hwnd;
1155 struct list task_list;
1156 struct list timer_list;
1157 } thread_data_t;
1159 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1160 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1162 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1163 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1164 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1166 HRESULT set_task_timer(HTMLInnerWindow*,LONG,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1167 HRESULT clear_task_timer(HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
1169 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1171 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1172 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1173 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1174 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1175 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1177 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1179 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1181 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1182 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1184 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1185 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1187 /* memory allocation functions */
1189 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1191 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1194 static inline LPWSTR heap_strdupW(LPCWSTR str)
1196 LPWSTR ret = NULL;
1198 if(str) {
1199 DWORD size;
1201 size = (strlenW(str)+1)*sizeof(WCHAR);
1202 ret = heap_alloc(size);
1203 if(ret)
1204 memcpy(ret, str, size);
1207 return ret;
1210 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1212 LPWSTR ret = NULL;
1214 if(str) {
1215 ret = heap_alloc((len+1)*sizeof(WCHAR));
1216 if(ret)
1218 memcpy(ret, str, len*sizeof(WCHAR));
1219 ret[len] = 0;
1223 return ret;
1226 static inline char *heap_strdupA(const char *str)
1228 char *ret = NULL;
1230 if(str) {
1231 DWORD size;
1233 size = strlen(str)+1;
1234 ret = heap_alloc(size);
1235 if(ret)
1236 memcpy(ret, str, size);
1239 return ret;
1242 static inline WCHAR *heap_strdupAtoW(const char *str)
1244 LPWSTR ret = NULL;
1246 if(str) {
1247 DWORD len;
1249 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1250 ret = heap_alloc(len*sizeof(WCHAR));
1251 if(ret)
1252 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1255 return ret;
1258 static inline char *heap_strdupWtoA(LPCWSTR str)
1260 char *ret = NULL;
1262 if(str) {
1263 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1264 ret = heap_alloc(size);
1265 if(ret)
1266 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1269 return ret;
1272 static inline WCHAR *heap_strdupUtoW(const char *str)
1274 WCHAR *ret = NULL;
1276 if(str) {
1277 size_t len;
1279 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1280 ret = heap_alloc(len*sizeof(WCHAR));
1281 if(ret)
1282 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1285 return ret;
1288 static inline char *heap_strdupWtoU(const WCHAR *str)
1290 char *ret = NULL;
1292 if(str) {
1293 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1294 ret = heap_alloc(size);
1295 if(ret)
1296 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1299 return ret;
1302 static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len)
1304 char *ret = NULL;
1305 DWORD size;
1307 if(str && len) {
1308 size = WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL);
1309 ret = heap_alloc(size + 1);
1310 if(ret) {
1311 WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL);
1312 ret[size] = '\0';
1316 return ret;
1319 static inline void windowref_addref(windowref_t *ref)
1321 InterlockedIncrement(&ref->ref);
1324 static inline void windowref_release(windowref_t *ref)
1326 if(!InterlockedDecrement(&ref->ref))
1327 heap_free(ref);
1330 static inline VARIANT_BOOL variant_bool(BOOL b)
1332 return b ? VARIANT_TRUE : VARIANT_FALSE;
1335 #ifdef __i386__
1336 extern void *call_thiscall_func;
1337 #endif
1339 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
1340 BSTR charset_string_from_cp(UINT) DECLSPEC_HIDDEN;
1341 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1342 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1344 extern HINSTANCE hInst DECLSPEC_HIDDEN;