wined3d: Add max_rt_count field to d3d_info.
[wine.git] / dlls / mshtml / mshtml_private.h
blobedaf22baab736199c95a5e5d423f3cbc3b5dd4ec
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(IHTMLCommentElement) \
151 XIID(IHTMLCurrentStyle) \
152 XIID(IHTMLCurrentStyle2) \
153 XIID(IHTMLCurrentStyle3) \
154 XIID(IHTMLCurrentStyle4) \
155 XIID(IHTMLDocument2) \
156 XIID(IHTMLDocument3) \
157 XIID(IHTMLDocument4) \
158 XIID(IHTMLDocument5) \
159 XIID(IHTMLDocument6) \
160 XIID(IHTMLDocument7) \
161 XIID(IHTMLDOMAttribute) \
162 XIID(IHTMLDOMAttribute2) \
163 XIID(IHTMLDOMChildrenCollection) \
164 XIID(IHTMLDOMImplementation) \
165 XIID(IHTMLDOMNode) \
166 XIID(IHTMLDOMNode2) \
167 XIID(IHTMLDOMNode3) \
168 XIID(IHTMLDOMTextNode) \
169 XIID(IHTMLDOMTextNode2) \
170 XIID(IHTMLElement) \
171 XIID(IHTMLElement2) \
172 XIID(IHTMLElement3) \
173 XIID(IHTMLElement4) \
174 XIID(IHTMLElement6) \
175 XIID(IHTMLElementCollection) \
176 XIID(IHTMLEmbedElement) \
177 XIID(IHTMLEventObj) \
178 XIID(IHTMLFiltersCollection) \
179 XIID(IHTMLFormElement) \
180 XIID(IHTMLFrameBase) \
181 XIID(IHTMLFrameBase2) \
182 XIID(IHTMLFrameElement3) \
183 XIID(IHTMLGenericElement) \
184 XIID(IHTMLHeadElement) \
185 XIID(IHTMLHtmlElement) \
186 XIID(IHTMLIFrameElement) \
187 XIID(IHTMLIFrameElement2) \
188 XIID(IHTMLIFrameElement3) \
189 XIID(IHTMLImageElementFactory) \
190 XIID(IHTMLImgElement) \
191 XIID(IHTMLInputElement) \
192 XIID(IHTMLInputTextElement2) \
193 XIID(IHTMLLabelElement) \
194 XIID(IHTMLLinkElement) \
195 XIID(IHTMLLocation) \
196 XIID(IHTMLMetaElement) \
197 XIID(IHTMLMimeTypesCollection) \
198 XIID(IHTMLObjectElement) \
199 XIID(IHTMLObjectElement2) \
200 XIID(IHTMLOptionElement) \
201 XIID(IHTMLOptionElementFactory) \
202 XIID(IHTMLPerformance) \
203 XIID(IHTMLPerformanceNavigation) \
204 XIID(IHTMLPerformanceTiming) \
205 XIID(IHTMLPluginsCollection) \
206 XIID(IHTMLRect) \
207 XIID(IHTMLScreen) \
208 XIID(IHTMLScriptElement) \
209 XIID(IHTMLSelectElement) \
210 XIID(IHTMLSelectionObject) \
211 XIID(IHTMLSelectionObject2) \
212 XIID(IHTMLStorage) \
213 XIID(IHTMLStyle) \
214 XIID(IHTMLStyle2) \
215 XIID(IHTMLStyle3) \
216 XIID(IHTMLStyle4) \
217 XIID(IHTMLStyle5) \
218 XIID(IHTMLStyle6) \
219 XIID(IHTMLStyleElement) \
220 XIID(IHTMLStyleSheet) \
221 XIID(IHTMLStyleSheetRulesCollection) \
222 XIID(IHTMLStyleSheetsCollection) \
223 XIID(IHTMLTable) \
224 XIID(IHTMLTable2) \
225 XIID(IHTMLTable3) \
226 XIID(IHTMLTableCell) \
227 XIID(IHTMLTableRow) \
228 XIID(IHTMLTextAreaElement) \
229 XIID(IHTMLTextContainer) \
230 XIID(IHTMLTitleElement) \
231 XIID(IHTMLTxtRange) \
232 XIID(IHTMLUniqueName) \
233 XIID(IHTMLWindow2) \
234 XIID(IHTMLWindow3) \
235 XIID(IHTMLWindow4) \
236 XIID(IHTMLWindow5) \
237 XIID(IHTMLWindow6) \
238 XIID(IHTMLWindow7) \
239 XIID(IHTMLXMLHttpRequest) \
240 XIID(IHTMLXMLHttpRequestFactory) \
241 XIID(IOmHistory) \
242 XIID(IOmNavigator)
244 typedef enum {
245 #define XIID(iface) iface ## _tid,
246 #define XDIID(iface) iface ## _tid,
247 TID_LIST
248 #undef XIID
249 #undef XDIID
250 LAST_tid
251 } tid_t;
253 typedef enum {
254 COMPAT_MODE_QUIRKS,
255 COMPAT_MODE_IE5,
256 COMPAT_MODE_IE7,
257 COMPAT_MODE_IE8,
258 COMPAT_MODE_IE9,
259 COMPAT_MODE_IE10,
260 COMPAT_MODE_IE11
261 } compat_mode_t;
263 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
264 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
266 typedef struct {
267 unsigned document_mode;
268 unsigned ie_version;
269 } compat_mode_info_t;
271 extern const compat_mode_info_t compat_mode_info[COMPAT_MODE_CNT] DECLSPEC_HIDDEN;
273 typedef struct dispex_data_t dispex_data_t;
274 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
276 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
277 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
278 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
280 typedef struct DispatchEx DispatchEx;
282 typedef struct {
283 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
284 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
285 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
286 compat_mode_t (*get_compat_mode)(DispatchEx*);
287 HRESULT (*populate_props)(DispatchEx*);
288 } dispex_static_data_vtbl_t;
290 typedef struct {
291 const dispex_static_data_vtbl_t *vtbl;
292 const tid_t disp_tid;
293 const tid_t* const iface_tids;
294 void (*init_info)(dispex_data_t*,compat_mode_t);
295 dispex_data_t *info_cache[COMPAT_MODE_CNT];
296 dispex_data_t *delayed_init_info;
297 } dispex_static_data_t;
299 typedef HRESULT (*dispex_hook_invoke_t)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,
300 EXCEPINFO*,IServiceProvider*);
302 typedef struct {
303 DISPID dispid;
304 dispex_hook_invoke_t invoke;
305 } dispex_hook_t;
307 struct DispatchEx {
308 IDispatchEx IDispatchEx_iface;
310 IUnknown *outer;
312 dispex_data_t *info;
313 dispex_dynamic_data_t *dynamic_data;
316 typedef struct {
317 UINT_PTR x;
318 } nsCycleCollectingAutoRefCnt;
320 typedef struct {
321 void *vtbl;
322 int ref_flags;
323 void *callbacks;
324 } ExternalCycleCollectionParticipant;
326 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
328 typedef struct {
329 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
330 nsresult (NSAPI *unlink)(void*);
331 void (NSAPI *delete_cycle_collectable)(void*);
332 } CCObjCallback;
334 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
336 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN;
337 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN;
338 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN;
339 void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN;
340 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
341 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
343 void init_dispex_with_compat_mode(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
344 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
345 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
346 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
347 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
348 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
349 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
350 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
351 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
352 void release_typelib(void) DECLSPEC_HIDDEN;
353 HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**) DECLSPEC_HIDDEN;
354 const void *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
355 void dispex_info_add_interface(dispex_data_t*,tid_t,const dispex_hook_t*) DECLSPEC_HIDDEN;
356 compat_mode_t dispex_compat_mode(DispatchEx*) DECLSPEC_HIDDEN;
358 static inline void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *desc)
360 init_dispex_with_compat_mode(dispex, outer, desc, COMPAT_MODE_NONE);
363 typedef enum {
364 DISPEXPROP_CUSTOM,
365 DISPEXPROP_DYNAMIC,
366 DISPEXPROP_BUILTIN
367 } dispex_prop_type_t;
369 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
371 typedef struct HTMLWindow HTMLWindow;
372 typedef struct HTMLInnerWindow HTMLInnerWindow;
373 typedef struct HTMLOuterWindow HTMLOuterWindow;
374 typedef struct HTMLDocumentNode HTMLDocumentNode;
375 typedef struct HTMLDocumentObj HTMLDocumentObj;
376 typedef struct HTMLFrameBase HTMLFrameBase;
377 typedef struct NSContainer NSContainer;
378 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
380 typedef enum {
381 SCRIPTMODE_GECKO,
382 SCRIPTMODE_ACTIVESCRIPT
383 } SCRIPTMODE;
385 typedef struct ScriptHost ScriptHost;
387 typedef enum {
388 GLOBAL_SCRIPTVAR,
389 GLOBAL_ELEMENTVAR,
390 GLOBAL_DISPEXVAR,
391 GLOBAL_FRAMEVAR
392 } global_prop_type_t;
394 typedef struct {
395 global_prop_type_t type;
396 WCHAR *name;
397 ScriptHost *script_host;
398 DISPID id;
399 } global_prop_t;
401 struct EventTarget {
402 DispatchEx dispex;
403 IEventTarget IEventTarget_iface;
404 struct wine_rb_tree handler_map;
407 typedef struct {
408 DispatchEx dispex;
409 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
411 LONG ref;
413 HTMLInnerWindow *window;
414 } HTMLOptionElementFactory;
416 typedef struct {
417 DispatchEx dispex;
418 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
420 LONG ref;
422 HTMLInnerWindow *window;
423 } HTMLImageElementFactory;
425 typedef struct {
426 DispatchEx dispex;
427 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
429 LONG ref;
431 HTMLInnerWindow *window;
432 } HTMLXMLHttpRequestFactory;
434 struct HTMLLocation {
435 DispatchEx dispex;
436 IHTMLLocation IHTMLLocation_iface;
438 LONG ref;
440 HTMLInnerWindow *window;
443 typedef struct {
444 DispatchEx dispex;
445 IOmHistory IOmHistory_iface;
447 LONG ref;
449 HTMLInnerWindow *window;
450 } OmHistory;
452 typedef struct {
453 HTMLOuterWindow *window;
454 LONG ref;
455 } windowref_t;
457 typedef struct nsChannelBSC nsChannelBSC;
459 struct HTMLWindow {
460 IHTMLWindow2 IHTMLWindow2_iface;
461 IHTMLWindow3 IHTMLWindow3_iface;
462 IHTMLWindow4 IHTMLWindow4_iface;
463 IHTMLWindow5 IHTMLWindow5_iface;
464 IHTMLWindow6 IHTMLWindow6_iface;
465 IHTMLWindow7 IHTMLWindow7_iface;
466 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
467 IDispatchEx IDispatchEx_iface;
468 IServiceProvider IServiceProvider_iface;
469 ITravelLogClient ITravelLogClient_iface;
470 IObjectIdentity IObjectIdentity_iface;
471 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
473 LONG ref;
475 HTMLInnerWindow *inner_window;
476 HTMLOuterWindow *outer_window;
479 struct HTMLOuterWindow {
480 HTMLWindow base;
482 windowref_t *window_ref;
483 LONG task_magic;
485 HTMLDocumentObj *doc_obj;
486 nsIDOMWindow *nswindow;
487 mozIDOMWindowProxy *window_proxy;
488 HTMLOuterWindow *parent;
489 HTMLFrameBase *frame_element;
491 READYSTATE readystate;
492 BOOL readystate_locked;
493 unsigned readystate_pending;
495 HTMLInnerWindow *pending_window;
496 IMoniker *mon;
497 IUri *uri;
498 IUri *uri_nofrag;
499 BSTR url;
500 DWORD load_flags;
502 SCRIPTMODE scriptmode;
504 IInternetSecurityManager *secmgr;
506 struct list children;
507 struct list sibling_entry;
508 struct wine_rb_entry entry;
511 struct HTMLInnerWindow {
512 HTMLWindow base;
513 EventTarget event_target;
515 HTMLDocumentNode *doc;
517 struct list script_hosts;
519 IHTMLEventObj *event;
521 HTMLImageElementFactory *image_factory;
522 HTMLOptionElementFactory *option_factory;
523 HTMLXMLHttpRequestFactory *xhr_factory;
524 IHTMLScreen *screen;
525 OmHistory *history;
526 IHTMLStorage *session_storage;
528 BOOL performance_initialized;
529 VARIANT performance;
531 unsigned parser_callback_cnt;
532 struct list script_queue;
534 global_prop_t *global_props;
535 DWORD global_prop_cnt;
536 DWORD global_prop_size;
538 LONG task_magic;
540 HTMLLocation *location;
542 IMoniker *mon;
543 nsChannelBSC *bscallback;
544 struct list bindings;
547 typedef enum {
548 UNKNOWN_USERMODE,
549 BROWSEMODE,
550 EDITMODE
551 } USERMODE;
553 typedef struct _cp_static_data_t {
554 tid_t tid;
555 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
556 BOOL pass_event_arg;
557 DWORD id_cnt;
558 DISPID *ids;
559 } cp_static_data_t;
561 typedef struct {
562 const IID *riid;
563 cp_static_data_t *desc;
564 } cpc_entry_t;
566 typedef struct ConnectionPointContainer {
567 IConnectionPointContainer IConnectionPointContainer_iface;
569 ConnectionPoint *cps;
570 const cpc_entry_t *cp_entries;
571 IUnknown *outer;
572 struct ConnectionPointContainer *forward_container;
573 } ConnectionPointContainer;
575 struct ConnectionPoint {
576 IConnectionPoint IConnectionPoint_iface;
578 ConnectionPointContainer *container;
580 union {
581 IUnknown *unk;
582 IDispatch *disp;
583 IPropertyNotifySink *propnotif;
584 } *sinks;
585 DWORD sinks_size;
587 const IID *iid;
588 cp_static_data_t *data;
591 struct HTMLDocument {
592 IHTMLDocument2 IHTMLDocument2_iface;
593 IHTMLDocument3 IHTMLDocument3_iface;
594 IHTMLDocument4 IHTMLDocument4_iface;
595 IHTMLDocument5 IHTMLDocument5_iface;
596 IHTMLDocument6 IHTMLDocument6_iface;
597 IHTMLDocument7 IHTMLDocument7_iface;
598 IDocumentSelector IDocumentSelector_iface;
599 IDocumentEvent IDocumentEvent_iface;
600 IPersistMoniker IPersistMoniker_iface;
601 IPersistFile IPersistFile_iface;
602 IPersistHistory IPersistHistory_iface;
603 IMonikerProp IMonikerProp_iface;
604 IOleObject IOleObject_iface;
605 IOleDocument IOleDocument_iface;
606 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
607 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
608 IServiceProvider IServiceProvider_iface;
609 IOleCommandTarget IOleCommandTarget_iface;
610 IOleControl IOleControl_iface;
611 IHlinkTarget IHlinkTarget_iface;
612 IPersistStreamInit IPersistStreamInit_iface;
613 IDispatchEx IDispatchEx_iface;
614 ISupportErrorInfo ISupportErrorInfo_iface;
615 IObjectWithSite IObjectWithSite_iface;
616 IOleContainer IOleContainer_iface;
617 IObjectSafety IObjectSafety_iface;
618 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
620 IUnknown *outer_unk;
621 IDispatchEx *dispex;
623 HTMLDocumentObj *doc_obj;
624 HTMLDocumentNode *doc_node;
626 HTMLOuterWindow *window;
628 ConnectionPointContainer cp_container;
631 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
633 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
636 static inline ULONG htmldoc_addref(HTMLDocument *This)
638 return IUnknown_AddRef(This->outer_unk);
641 static inline ULONG htmldoc_release(HTMLDocument *This)
643 return IUnknown_Release(This->outer_unk);
646 struct HTMLDocumentObj {
647 HTMLDocument basedoc;
648 DispatchEx dispex;
649 IUnknown IUnknown_outer;
650 ICustomDoc ICustomDoc_iface;
651 IOleDocumentView IOleDocumentView_iface;
652 IViewObjectEx IViewObjectEx_iface;
653 ITargetContainer ITargetContainer_iface;
655 IWindowForBindingUI IWindowForBindingUI_iface;
657 LONG ref;
659 NSContainer *nscontainer;
661 IOleClientSite *client;
662 IDocHostUIHandler *hostui;
663 IOleCommandTarget *client_cmdtrg;
664 BOOL custom_hostui;
665 IOleInPlaceSite *ipsite;
666 IOleInPlaceFrame *frame;
667 IOleInPlaceUIWindow *ip_window;
668 IAdviseSink *view_sink;
669 IDocObjectService *doc_object_service;
670 IUnknown *webbrowser;
671 ITravelLog *travel_log;
672 IUnknown *browser_service;
673 IOleAdviseHolder *advise_holder;
675 DOCHOSTUIINFO hostinfo;
677 IOleUndoManager *undomgr;
678 IHTMLEditServices *editsvcs;
680 HWND hwnd;
681 HWND tooltips_hwnd;
683 BOOL is_mhtml;
684 BOOL request_uiactivate;
685 BOOL in_place_active;
686 BOOL ui_active;
687 BOOL window_active;
688 BOOL hostui_setup;
689 BOOL container_locked;
690 BOOL focus;
691 BOOL has_popup;
692 INT download_state;
694 USERMODE usermode;
695 LPWSTR mime;
697 DWORD update;
698 LONG task_magic;
701 typedef struct nsWeakReference nsWeakReference;
703 struct NSContainer {
704 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
705 nsIContextMenuListener nsIContextMenuListener_iface;
706 nsIURIContentListener nsIURIContentListener_iface;
707 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
708 nsITooltipListener nsITooltipListener_iface;
709 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
710 nsISupportsWeakReference nsISupportsWeakReference_iface;
712 nsIWebBrowser *webbrowser;
713 nsIWebNavigation *navigation;
714 nsIBaseWindow *window;
715 nsIWebBrowserFocus *focus;
717 nsIEditor *editor;
718 nsIController *editor_controller;
720 LONG ref;
722 nsWeakReference *weak_reference;
724 HTMLDocumentObj *doc;
726 nsIURIContentListener *content_listener;
728 HWND hwnd;
731 typedef struct {
732 const CLSID *clsid;
733 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
734 void (*destructor)(HTMLDOMNode*);
735 const cpc_entry_t *cpc_entries;
736 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
737 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
738 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
739 EventTarget *(*get_event_prop_target)(HTMLDOMNode*,int);
740 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
741 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
742 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
743 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
744 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
745 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
746 HRESULT (*bind_to_tree)(HTMLDOMNode*);
747 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
748 void (*unlink)(HTMLDOMNode*);
749 BOOL (*is_text_edit)(HTMLDOMNode*);
750 BOOL (*is_settable)(HTMLDOMNode*,DISPID);
751 } NodeImplVtbl;
753 struct HTMLDOMNode {
754 EventTarget event_target;
755 IHTMLDOMNode IHTMLDOMNode_iface;
756 IHTMLDOMNode2 IHTMLDOMNode2_iface;
757 IHTMLDOMNode3 IHTMLDOMNode3_iface;
758 const NodeImplVtbl *vtbl;
760 nsCycleCollectingAutoRefCnt ccref;
762 nsIDOMNode *nsnode;
763 HTMLDocumentNode *doc;
766 static inline void node_addref(HTMLDOMNode *node)
768 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
771 static inline void node_release(HTMLDOMNode *node)
773 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
776 typedef struct {
777 HTMLDOMNode node;
778 ConnectionPointContainer cp_container;
780 IHTMLElement IHTMLElement_iface;
781 IHTMLElement2 IHTMLElement2_iface;
782 IHTMLElement3 IHTMLElement3_iface;
783 IHTMLElement4 IHTMLElement4_iface;
784 IHTMLElement6 IHTMLElement6_iface;
785 IHTMLUniqueName IHTMLUniqueName_iface;
786 IElementSelector IElementSelector_iface;
787 IElementTraversal IElementTraversal_iface;
788 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
790 nsIDOMElement *dom_element; /* NULL for legacy comments represented as HTML elements */
791 nsIDOMHTMLElement *html_element; /* NULL for non-HTML elements (like SVG elements) */
792 HTMLStyle *style;
793 HTMLStyle *runtime_style;
794 HTMLAttributeCollection *attrs;
795 WCHAR *filter;
796 unsigned unique_id;
797 } HTMLElement;
799 #define HTMLELEMENT_TIDS \
800 IHTMLDOMNode_tid, \
801 IHTMLDOMNode2_tid, \
802 IHTMLElement_tid, \
803 IHTMLElement3_tid, \
804 IHTMLElement4_tid, \
805 IHTMLUniqueName_tid
807 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN;
808 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
809 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN;
811 struct HTMLFrameBase {
812 HTMLElement element;
814 IHTMLFrameBase IHTMLFrameBase_iface;
815 IHTMLFrameBase2 IHTMLFrameBase2_iface;
817 HTMLOuterWindow *content_window;
819 nsIDOMHTMLFrameElement *nsframe;
820 nsIDOMHTMLIFrameElement *nsiframe;
823 typedef struct nsDocumentEventListener nsDocumentEventListener;
825 struct HTMLDocumentNode {
826 HTMLDOMNode node;
827 HTMLDocument basedoc;
829 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
831 nsIDocumentObserver nsIDocumentObserver_iface;
833 LONG ref;
835 HTMLInnerWindow *window;
837 compat_mode_t document_mode;
838 BOOL document_mode_locked;
840 nsIDOMHTMLDocument *nsdoc;
841 BOOL content_ready;
843 IHTMLDOMImplementation *dom_implementation;
845 ICatInformation *catmgr;
846 nsDocumentEventListener *nsevent_listener;
847 BOOL *event_vector;
849 WCHAR **elem_vars;
850 unsigned elem_vars_size;
851 unsigned elem_vars_cnt;
853 BOOL skip_mutation_notif;
855 UINT charset;
857 unsigned unique_id;
859 struct list selection_list;
860 struct list range_list;
861 struct list plugin_hosts;
864 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
865 HRESULT MHTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
866 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
867 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
869 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
870 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
871 HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*) DECLSPEC_HIDDEN;
872 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
873 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
874 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
875 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN;
876 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
877 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
878 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
879 HRESULT create_performance(IHTMLPerformance**) DECLSPEC_HIDDEN;
880 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
881 HRESULT create_dom_implementation(IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
883 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
885 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
886 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
887 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
888 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
890 void HTMLDocument_View_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
891 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
893 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
895 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
897 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
898 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
900 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
901 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
903 compat_mode_t lock_document_mode(HTMLDocumentNode*) DECLSPEC_HIDDEN;
905 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
906 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
907 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
908 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
910 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
911 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
912 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
914 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
915 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
916 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
918 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN;
920 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
922 BOOL load_gecko(void) DECLSPEC_HIDDEN;
923 void close_gecko(void) DECLSPEC_HIDDEN;
924 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
925 void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
926 void release_nsio(void) DECLSPEC_HIDDEN;
927 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
928 void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
930 void init_node_cc(void) DECLSPEC_HIDDEN;
932 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
934 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
935 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
937 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
938 void nsfree(void*) DECLSPEC_HIDDEN;
940 BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN;
941 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
942 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
943 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
944 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
946 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
947 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
948 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
949 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
951 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
952 HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p) DECLSPEC_HIDDEN;
953 HRESULT return_nsform(nsresult,nsIDOMHTMLFormElement*,IHTMLFormElement**) DECLSPEC_HIDDEN;
955 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
956 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
957 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
958 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
959 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
960 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN;
961 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
962 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
964 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
965 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
966 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
967 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
968 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
969 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
971 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
972 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
974 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
975 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
976 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
977 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
979 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
980 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
981 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
982 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
984 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMElement**) DECLSPEC_HIDDEN;
985 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
987 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
989 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
990 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
993 struct HTMLAttributeCollection {
994 DispatchEx dispex;
995 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
996 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
997 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
999 LONG ref;
1001 HTMLElement *elem;
1002 struct list attrs;
1005 typedef struct {
1006 DispatchEx dispex;
1007 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
1008 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
1010 LONG ref;
1012 /* value is valid only for detached attributes (when elem == NULL). */
1013 VARIANT value;
1014 /* name must be valid for detached attributes */
1015 WCHAR *name;
1017 HTMLElement *elem;
1018 DISPID dispid;
1019 struct list entry;
1020 } HTMLDOMAttribute;
1022 HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*) DECLSPEC_HIDDEN;
1024 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
1026 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
1027 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
1028 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1029 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1030 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1031 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1032 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1033 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1034 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1035 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1036 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1037 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1038 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1039 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1040 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1041 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1042 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1043 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1044 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1045 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1046 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1047 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1048 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1049 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1050 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1051 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1052 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1053 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1055 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1056 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1058 void EventTarget_Init(EventTarget*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1059 HRESULT EventTarget_QI(EventTarget*,REFIID,void**) DECLSPEC_HIDDEN;
1060 void EventTarget_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1062 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1063 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1064 void HTMLDOMNode_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1066 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1067 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1068 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1069 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
1070 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1071 void HTMLElement_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1073 HRESULT get_node(nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
1074 HRESULT get_element(nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1075 HRESULT get_document_node(nsIDOMDocument*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
1077 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
1079 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
1080 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
1081 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1082 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
1083 HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1085 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
1087 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
1088 IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,compat_mode_t) DECLSPEC_HIDDEN;
1089 IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,compat_mode_t) DECLSPEC_HIDDEN;
1090 IHTMLDOMChildrenCollection *create_child_collection(nsIDOMNodeList*) DECLSPEC_HIDDEN;
1092 HRESULT attr_value_to_string(VARIANT*) DECLSPEC_HIDDEN;
1093 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
1094 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN;
1096 nsresult get_elem_attr_value(nsIDOMElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
1097 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
1098 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
1100 HRESULT elem_unique_id(unsigned id, BSTR *p) DECLSPEC_HIDDEN;
1102 /* commands */
1103 typedef struct {
1104 DWORD id;
1105 HRESULT (*query)(HTMLDocument*,OLECMD*);
1106 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
1107 } cmdtable_t;
1109 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
1111 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
1113 /* timer */
1114 #define UPDATE_UI 0x0001
1115 #define UPDATE_TITLE 0x0002
1117 void update_doc(HTMLDocumentObj*,DWORD) DECLSPEC_HIDDEN;
1118 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1119 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
1121 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
1123 /* editor */
1124 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1125 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
1126 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
1127 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1128 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1129 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1130 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
1131 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
1132 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
1134 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
1136 typedef struct task_t task_t;
1137 typedef void (*task_proc_t)(task_t*);
1139 struct task_t {
1140 LONG target_magic;
1141 task_proc_t proc;
1142 task_proc_t destr;
1143 struct list entry;
1146 typedef struct {
1147 task_t header;
1148 HTMLDocumentObj *doc;
1149 } docobj_task_t;
1151 typedef struct {
1152 HWND thread_hwnd;
1153 struct list task_list;
1154 struct list timer_list;
1155 } thread_data_t;
1157 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1158 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1160 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1161 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1162 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1164 HRESULT set_task_timer(HTMLInnerWindow*,LONG,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1165 HRESULT clear_task_timer(HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
1167 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1169 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1170 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1171 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1172 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1173 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1175 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1177 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1179 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1180 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1182 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1183 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1185 /* memory allocation functions */
1187 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1189 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1192 static inline LPWSTR heap_strdupW(LPCWSTR str)
1194 LPWSTR ret = NULL;
1196 if(str) {
1197 DWORD size;
1199 size = (strlenW(str)+1)*sizeof(WCHAR);
1200 ret = heap_alloc(size);
1201 if(ret)
1202 memcpy(ret, str, size);
1205 return ret;
1208 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1210 LPWSTR ret = NULL;
1212 if(str) {
1213 ret = heap_alloc((len+1)*sizeof(WCHAR));
1214 if(ret)
1216 memcpy(ret, str, len*sizeof(WCHAR));
1217 ret[len] = 0;
1221 return ret;
1224 static inline char *heap_strdupA(const char *str)
1226 char *ret = NULL;
1228 if(str) {
1229 DWORD size;
1231 size = strlen(str)+1;
1232 ret = heap_alloc(size);
1233 if(ret)
1234 memcpy(ret, str, size);
1237 return ret;
1240 static inline WCHAR *heap_strdupAtoW(const char *str)
1242 LPWSTR ret = NULL;
1244 if(str) {
1245 DWORD len;
1247 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1248 ret = heap_alloc(len*sizeof(WCHAR));
1249 if(ret)
1250 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1253 return ret;
1256 static inline char *heap_strdupWtoA(LPCWSTR str)
1258 char *ret = NULL;
1260 if(str) {
1261 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1262 ret = heap_alloc(size);
1263 if(ret)
1264 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1267 return ret;
1270 static inline WCHAR *heap_strdupUtoW(const char *str)
1272 WCHAR *ret = NULL;
1274 if(str) {
1275 size_t len;
1277 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1278 ret = heap_alloc(len*sizeof(WCHAR));
1279 if(ret)
1280 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1283 return ret;
1286 static inline char *heap_strdupWtoU(const WCHAR *str)
1288 char *ret = NULL;
1290 if(str) {
1291 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1292 ret = heap_alloc(size);
1293 if(ret)
1294 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1297 return ret;
1300 static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len)
1302 char *ret = NULL;
1303 DWORD size;
1305 if(str && len) {
1306 size = WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL);
1307 ret = heap_alloc(size + 1);
1308 if(ret) {
1309 WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL);
1310 ret[size] = '\0';
1314 return ret;
1317 static inline void windowref_addref(windowref_t *ref)
1319 InterlockedIncrement(&ref->ref);
1322 static inline void windowref_release(windowref_t *ref)
1324 if(!InterlockedDecrement(&ref->ref))
1325 heap_free(ref);
1328 static inline VARIANT_BOOL variant_bool(BOOL b)
1330 return b ? VARIANT_TRUE : VARIANT_FALSE;
1333 #ifdef __i386__
1334 extern void *call_thiscall_func;
1335 #endif
1337 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
1338 BSTR charset_string_from_cp(UINT) DECLSPEC_HIDDEN;
1339 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1340 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1342 extern HINSTANCE hInst DECLSPEC_HIDDEN;