mshtml: Get rid of no longer needed document argument from create_collection_from_nod...
[wine.git] / dlls / mshtml / mshtml_private.h
blobc720ef420c9716b32a5dc71fcb1638a08abbc437
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(IHTMLPluginsCollection) \
203 XIID(IHTMLRect) \
204 XIID(IHTMLScreen) \
205 XIID(IHTMLScriptElement) \
206 XIID(IHTMLSelectElement) \
207 XIID(IHTMLSelectionObject) \
208 XIID(IHTMLSelectionObject2) \
209 XIID(IHTMLStorage) \
210 XIID(IHTMLStyle) \
211 XIID(IHTMLStyle2) \
212 XIID(IHTMLStyle3) \
213 XIID(IHTMLStyle4) \
214 XIID(IHTMLStyle5) \
215 XIID(IHTMLStyle6) \
216 XIID(IHTMLStyleElement) \
217 XIID(IHTMLStyleSheet) \
218 XIID(IHTMLStyleSheetRulesCollection) \
219 XIID(IHTMLStyleSheetsCollection) \
220 XIID(IHTMLTable) \
221 XIID(IHTMLTable2) \
222 XIID(IHTMLTable3) \
223 XIID(IHTMLTableCell) \
224 XIID(IHTMLTableRow) \
225 XIID(IHTMLTextAreaElement) \
226 XIID(IHTMLTextContainer) \
227 XIID(IHTMLTitleElement) \
228 XIID(IHTMLTxtRange) \
229 XIID(IHTMLUniqueName) \
230 XIID(IHTMLWindow2) \
231 XIID(IHTMLWindow3) \
232 XIID(IHTMLWindow4) \
233 XIID(IHTMLWindow5) \
234 XIID(IHTMLWindow6) \
235 XIID(IHTMLXMLHttpRequest) \
236 XIID(IHTMLXMLHttpRequestFactory) \
237 XIID(IOmHistory) \
238 XIID(IOmNavigator)
240 typedef enum {
241 #define XIID(iface) iface ## _tid,
242 #define XDIID(iface) iface ## _tid,
243 TID_LIST
244 #undef XIID
245 #undef XDIID
246 LAST_tid
247 } tid_t;
249 typedef enum {
250 COMPAT_MODE_QUIRKS,
251 COMPAT_MODE_IE5,
252 COMPAT_MODE_IE7,
253 COMPAT_MODE_IE8,
254 COMPAT_MODE_IE9,
255 COMPAT_MODE_IE10,
256 COMPAT_MODE_IE11
257 } compat_mode_t;
259 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
260 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
262 typedef struct {
263 unsigned document_mode;
264 unsigned ie_version;
265 } compat_mode_info_t;
267 extern const compat_mode_info_t compat_mode_info[COMPAT_MODE_CNT] DECLSPEC_HIDDEN;
269 typedef struct dispex_data_t dispex_data_t;
270 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
272 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
273 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
274 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
276 typedef struct DispatchEx DispatchEx;
278 typedef struct {
279 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
280 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
281 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
282 compat_mode_t (*get_compat_mode)(DispatchEx*);
283 HRESULT (*populate_props)(DispatchEx*);
284 } dispex_static_data_vtbl_t;
286 typedef struct {
287 const dispex_static_data_vtbl_t *vtbl;
288 const tid_t disp_tid;
289 const tid_t* const iface_tids;
290 void (*init_info)(dispex_data_t*,compat_mode_t);
291 dispex_data_t *info_cache[COMPAT_MODE_CNT];
292 dispex_data_t *delayed_init_info;
293 } dispex_static_data_t;
295 typedef HRESULT (*dispex_hook_invoke_t)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,
296 EXCEPINFO*,IServiceProvider*);
298 typedef struct {
299 DISPID dispid;
300 dispex_hook_invoke_t invoke;
301 } dispex_hook_t;
303 struct DispatchEx {
304 IDispatchEx IDispatchEx_iface;
306 IUnknown *outer;
308 dispex_data_t *info;
309 dispex_dynamic_data_t *dynamic_data;
312 typedef struct {
313 UINT_PTR x;
314 } nsCycleCollectingAutoRefCnt;
316 typedef struct {
317 void *vtbl;
318 int ref_flags;
319 void *callbacks;
320 } ExternalCycleCollectionParticipant;
322 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
324 typedef struct {
325 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
326 nsresult (NSAPI *unlink)(void*);
327 void (NSAPI *delete_cycle_collectable)(void*);
328 } CCObjCallback;
330 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
332 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN;
333 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN;
334 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN;
335 void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN;
336 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
337 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
339 void init_dispex_with_compat_mode(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
340 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
341 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
342 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
343 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
344 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
345 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
346 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
347 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
348 void release_typelib(void) DECLSPEC_HIDDEN;
349 HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**) DECLSPEC_HIDDEN;
350 const void *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
351 void dispex_info_add_interface(dispex_data_t*,tid_t,const dispex_hook_t*) DECLSPEC_HIDDEN;
352 compat_mode_t dispex_compat_mode(DispatchEx*) DECLSPEC_HIDDEN;
354 static inline void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *desc)
356 init_dispex_with_compat_mode(dispex, outer, desc, COMPAT_MODE_NONE);
359 typedef enum {
360 DISPEXPROP_CUSTOM,
361 DISPEXPROP_DYNAMIC,
362 DISPEXPROP_BUILTIN
363 } dispex_prop_type_t;
365 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
367 typedef struct HTMLWindow HTMLWindow;
368 typedef struct HTMLInnerWindow HTMLInnerWindow;
369 typedef struct HTMLOuterWindow HTMLOuterWindow;
370 typedef struct HTMLDocumentNode HTMLDocumentNode;
371 typedef struct HTMLDocumentObj HTMLDocumentObj;
372 typedef struct HTMLFrameBase HTMLFrameBase;
373 typedef struct NSContainer NSContainer;
374 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
376 typedef enum {
377 SCRIPTMODE_GECKO,
378 SCRIPTMODE_ACTIVESCRIPT
379 } SCRIPTMODE;
381 typedef struct ScriptHost ScriptHost;
383 typedef enum {
384 GLOBAL_SCRIPTVAR,
385 GLOBAL_ELEMENTVAR,
386 GLOBAL_DISPEXVAR,
387 GLOBAL_FRAMEVAR
388 } global_prop_type_t;
390 typedef struct {
391 global_prop_type_t type;
392 WCHAR *name;
393 ScriptHost *script_host;
394 DISPID id;
395 } global_prop_t;
397 struct EventTarget {
398 DispatchEx dispex;
399 IEventTarget IEventTarget_iface;
400 struct wine_rb_tree handler_map;
403 typedef struct {
404 DispatchEx dispex;
405 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
407 LONG ref;
409 HTMLInnerWindow *window;
410 } HTMLOptionElementFactory;
412 typedef struct {
413 DispatchEx dispex;
414 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
416 LONG ref;
418 HTMLInnerWindow *window;
419 } HTMLImageElementFactory;
421 typedef struct {
422 DispatchEx dispex;
423 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
425 LONG ref;
427 HTMLInnerWindow *window;
428 } HTMLXMLHttpRequestFactory;
430 struct HTMLLocation {
431 DispatchEx dispex;
432 IHTMLLocation IHTMLLocation_iface;
434 LONG ref;
436 HTMLInnerWindow *window;
439 typedef struct {
440 DispatchEx dispex;
441 IOmHistory IOmHistory_iface;
443 LONG ref;
445 HTMLInnerWindow *window;
446 } OmHistory;
448 typedef struct {
449 HTMLOuterWindow *window;
450 LONG ref;
451 } windowref_t;
453 typedef struct nsChannelBSC nsChannelBSC;
455 struct HTMLWindow {
456 IHTMLWindow2 IHTMLWindow2_iface;
457 IHTMLWindow3 IHTMLWindow3_iface;
458 IHTMLWindow4 IHTMLWindow4_iface;
459 IHTMLWindow5 IHTMLWindow5_iface;
460 IHTMLWindow6 IHTMLWindow6_iface;
461 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
462 IDispatchEx IDispatchEx_iface;
463 IServiceProvider IServiceProvider_iface;
464 ITravelLogClient ITravelLogClient_iface;
465 IObjectIdentity IObjectIdentity_iface;
466 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
468 LONG ref;
470 HTMLInnerWindow *inner_window;
471 HTMLOuterWindow *outer_window;
474 struct HTMLOuterWindow {
475 HTMLWindow base;
477 windowref_t *window_ref;
478 LONG task_magic;
480 HTMLDocumentObj *doc_obj;
481 nsIDOMWindow *nswindow;
482 mozIDOMWindowProxy *window_proxy;
483 HTMLOuterWindow *parent;
484 HTMLFrameBase *frame_element;
486 READYSTATE readystate;
487 BOOL readystate_locked;
488 unsigned readystate_pending;
490 HTMLInnerWindow *pending_window;
491 IMoniker *mon;
492 IUri *uri;
493 IUri *uri_nofrag;
494 BSTR url;
495 DWORD load_flags;
497 SCRIPTMODE scriptmode;
499 IInternetSecurityManager *secmgr;
501 struct list children;
502 struct list sibling_entry;
503 struct wine_rb_entry entry;
506 struct HTMLInnerWindow {
507 HTMLWindow base;
508 EventTarget event_target;
510 HTMLDocumentNode *doc;
512 struct list script_hosts;
514 IHTMLEventObj *event;
516 HTMLImageElementFactory *image_factory;
517 HTMLOptionElementFactory *option_factory;
518 HTMLXMLHttpRequestFactory *xhr_factory;
519 IHTMLScreen *screen;
520 OmHistory *history;
521 IHTMLStorage *session_storage;
523 unsigned parser_callback_cnt;
524 struct list script_queue;
526 global_prop_t *global_props;
527 DWORD global_prop_cnt;
528 DWORD global_prop_size;
530 LONG task_magic;
532 HTMLLocation *location;
534 IMoniker *mon;
535 nsChannelBSC *bscallback;
536 struct list bindings;
539 typedef enum {
540 UNKNOWN_USERMODE,
541 BROWSEMODE,
542 EDITMODE
543 } USERMODE;
545 typedef struct _cp_static_data_t {
546 tid_t tid;
547 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
548 BOOL pass_event_arg;
549 DWORD id_cnt;
550 DISPID *ids;
551 } cp_static_data_t;
553 typedef struct {
554 const IID *riid;
555 cp_static_data_t *desc;
556 } cpc_entry_t;
558 typedef struct ConnectionPointContainer {
559 IConnectionPointContainer IConnectionPointContainer_iface;
561 ConnectionPoint *cps;
562 const cpc_entry_t *cp_entries;
563 IUnknown *outer;
564 struct ConnectionPointContainer *forward_container;
565 } ConnectionPointContainer;
567 struct ConnectionPoint {
568 IConnectionPoint IConnectionPoint_iface;
570 ConnectionPointContainer *container;
572 union {
573 IUnknown *unk;
574 IDispatch *disp;
575 IPropertyNotifySink *propnotif;
576 } *sinks;
577 DWORD sinks_size;
579 const IID *iid;
580 cp_static_data_t *data;
583 struct HTMLDocument {
584 IHTMLDocument2 IHTMLDocument2_iface;
585 IHTMLDocument3 IHTMLDocument3_iface;
586 IHTMLDocument4 IHTMLDocument4_iface;
587 IHTMLDocument5 IHTMLDocument5_iface;
588 IHTMLDocument6 IHTMLDocument6_iface;
589 IHTMLDocument7 IHTMLDocument7_iface;
590 IDocumentSelector IDocumentSelector_iface;
591 IDocumentEvent IDocumentEvent_iface;
592 IPersistMoniker IPersistMoniker_iface;
593 IPersistFile IPersistFile_iface;
594 IPersistHistory IPersistHistory_iface;
595 IMonikerProp IMonikerProp_iface;
596 IOleObject IOleObject_iface;
597 IOleDocument IOleDocument_iface;
598 IOleDocumentView IOleDocumentView_iface;
599 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
600 IViewObjectEx IViewObjectEx_iface;
601 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
602 IServiceProvider IServiceProvider_iface;
603 IOleCommandTarget IOleCommandTarget_iface;
604 IOleControl IOleControl_iface;
605 IHlinkTarget IHlinkTarget_iface;
606 IPersistStreamInit IPersistStreamInit_iface;
607 IDispatchEx IDispatchEx_iface;
608 ISupportErrorInfo ISupportErrorInfo_iface;
609 IObjectWithSite IObjectWithSite_iface;
610 IOleContainer IOleContainer_iface;
611 IObjectSafety IObjectSafety_iface;
612 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
614 IUnknown *outer_unk;
615 IDispatchEx *dispex;
617 HTMLDocumentObj *doc_obj;
618 HTMLDocumentNode *doc_node;
620 HTMLOuterWindow *window;
622 ConnectionPointContainer cp_container;
625 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
627 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
630 static inline ULONG htmldoc_addref(HTMLDocument *This)
632 return IUnknown_AddRef(This->outer_unk);
635 static inline ULONG htmldoc_release(HTMLDocument *This)
637 return IUnknown_Release(This->outer_unk);
640 struct HTMLDocumentObj {
641 HTMLDocument basedoc;
642 DispatchEx dispex;
643 IUnknown IUnknown_outer;
644 ICustomDoc ICustomDoc_iface;
645 ITargetContainer ITargetContainer_iface;
647 IWindowForBindingUI IWindowForBindingUI_iface;
649 LONG ref;
651 NSContainer *nscontainer;
653 IOleClientSite *client;
654 IDocHostUIHandler *hostui;
655 IOleCommandTarget *client_cmdtrg;
656 BOOL custom_hostui;
657 IOleInPlaceSite *ipsite;
658 IOleInPlaceFrame *frame;
659 IOleInPlaceUIWindow *ip_window;
660 IAdviseSink *view_sink;
661 IDocObjectService *doc_object_service;
662 IUnknown *webbrowser;
663 ITravelLog *travel_log;
664 IUnknown *browser_service;
665 IOleAdviseHolder *advise_holder;
667 DOCHOSTUIINFO hostinfo;
669 IOleUndoManager *undomgr;
670 IHTMLEditServices *editsvcs;
672 HWND hwnd;
673 HWND tooltips_hwnd;
675 BOOL is_mhtml;
676 BOOL request_uiactivate;
677 BOOL in_place_active;
678 BOOL ui_active;
679 BOOL window_active;
680 BOOL hostui_setup;
681 BOOL container_locked;
682 BOOL focus;
683 BOOL has_popup;
684 INT download_state;
686 USERMODE usermode;
687 LPWSTR mime;
689 DWORD update;
690 LONG task_magic;
693 typedef struct nsWeakReference nsWeakReference;
695 struct NSContainer {
696 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
697 nsIContextMenuListener nsIContextMenuListener_iface;
698 nsIURIContentListener nsIURIContentListener_iface;
699 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
700 nsITooltipListener nsITooltipListener_iface;
701 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
702 nsISupportsWeakReference nsISupportsWeakReference_iface;
704 nsIWebBrowser *webbrowser;
705 nsIWebNavigation *navigation;
706 nsIBaseWindow *window;
707 nsIWebBrowserFocus *focus;
709 nsIEditor *editor;
710 nsIController *editor_controller;
712 LONG ref;
714 nsWeakReference *weak_reference;
716 HTMLDocumentObj *doc;
718 nsIURIContentListener *content_listener;
720 HWND hwnd;
723 typedef struct {
724 const CLSID *clsid;
725 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
726 void (*destructor)(HTMLDOMNode*);
727 const cpc_entry_t *cpc_entries;
728 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
729 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
730 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
731 EventTarget *(*get_event_prop_target)(HTMLDOMNode*,int);
732 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
733 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
734 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
735 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
736 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
737 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
738 HRESULT (*bind_to_tree)(HTMLDOMNode*);
739 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
740 void (*unlink)(HTMLDOMNode*);
741 BOOL (*is_text_edit)(HTMLDOMNode*);
742 BOOL (*is_settable)(HTMLDOMNode*,DISPID);
743 } NodeImplVtbl;
745 struct HTMLDOMNode {
746 EventTarget event_target;
747 IHTMLDOMNode IHTMLDOMNode_iface;
748 IHTMLDOMNode2 IHTMLDOMNode2_iface;
749 IHTMLDOMNode3 IHTMLDOMNode3_iface;
750 const NodeImplVtbl *vtbl;
752 nsCycleCollectingAutoRefCnt ccref;
754 nsIDOMNode *nsnode;
755 HTMLDocumentNode *doc;
758 static inline void node_addref(HTMLDOMNode *node)
760 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
763 static inline void node_release(HTMLDOMNode *node)
765 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
768 typedef struct {
769 HTMLDOMNode node;
770 ConnectionPointContainer cp_container;
772 IHTMLElement IHTMLElement_iface;
773 IHTMLElement2 IHTMLElement2_iface;
774 IHTMLElement3 IHTMLElement3_iface;
775 IHTMLElement4 IHTMLElement4_iface;
776 IHTMLElement6 IHTMLElement6_iface;
777 IHTMLUniqueName IHTMLUniqueName_iface;
778 IElementSelector IElementSelector_iface;
779 IElementTraversal IElementTraversal_iface;
780 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
782 nsIDOMElement *dom_element; /* NULL for legacy comments represented as HTML elements */
783 nsIDOMHTMLElement *html_element; /* NULL for non-HTML elements (like SVG elements) */
784 HTMLStyle *style;
785 HTMLStyle *runtime_style;
786 HTMLAttributeCollection *attrs;
787 WCHAR *filter;
788 unsigned unique_id;
789 } HTMLElement;
791 #define HTMLELEMENT_TIDS \
792 IHTMLDOMNode_tid, \
793 IHTMLDOMNode2_tid, \
794 IHTMLElement_tid, \
795 IHTMLElement3_tid, \
796 IHTMLElement4_tid, \
797 IHTMLUniqueName_tid
799 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN;
800 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
801 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN;
803 typedef struct {
804 HTMLElement element;
806 IHTMLTextContainer IHTMLTextContainer_iface;
807 } HTMLTextContainer;
809 struct HTMLFrameBase {
810 HTMLElement element;
812 IHTMLFrameBase IHTMLFrameBase_iface;
813 IHTMLFrameBase2 IHTMLFrameBase2_iface;
815 HTMLOuterWindow *content_window;
817 nsIDOMHTMLFrameElement *nsframe;
818 nsIDOMHTMLIFrameElement *nsiframe;
821 typedef struct nsDocumentEventListener nsDocumentEventListener;
823 struct HTMLDocumentNode {
824 HTMLDOMNode node;
825 HTMLDocument basedoc;
827 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
829 nsIDocumentObserver nsIDocumentObserver_iface;
831 LONG ref;
833 HTMLInnerWindow *window;
835 compat_mode_t document_mode;
836 BOOL document_mode_locked;
838 nsIDOMHTMLDocument *nsdoc;
839 BOOL content_ready;
841 IHTMLDOMImplementation *dom_implementation;
843 ICatInformation *catmgr;
844 nsDocumentEventListener *nsevent_listener;
845 BOOL *event_vector;
847 WCHAR **elem_vars;
848 unsigned elem_vars_size;
849 unsigned elem_vars_cnt;
851 BOOL skip_mutation_notif;
853 UINT charset;
855 unsigned unique_id;
857 struct list selection_list;
858 struct list range_list;
859 struct list plugin_hosts;
862 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
863 HRESULT MHTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
864 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
865 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
867 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
868 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
869 HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*) DECLSPEC_HIDDEN;
870 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
871 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
872 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
873 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN;
874 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
875 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
876 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
877 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
878 HRESULT create_dom_implementation(IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
880 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
882 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
883 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
884 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
885 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN;
886 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
888 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
889 void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN;
891 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
893 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
895 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
896 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
898 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
899 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
901 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
902 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
903 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
904 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
906 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
907 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
908 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
910 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
911 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
912 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
914 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN;
916 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
918 BOOL load_gecko(void) DECLSPEC_HIDDEN;
919 void close_gecko(void) DECLSPEC_HIDDEN;
920 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
921 void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
922 void release_nsio(void) DECLSPEC_HIDDEN;
923 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
924 void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
926 void init_node_cc(void) DECLSPEC_HIDDEN;
928 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
930 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
932 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
933 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
935 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
936 void nsfree(void*) DECLSPEC_HIDDEN;
938 BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN;
939 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
940 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
941 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
942 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
944 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
945 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
946 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
947 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
949 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
950 HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p) DECLSPEC_HIDDEN;
952 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
953 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
954 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
955 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
956 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
957 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN;
958 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
959 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
961 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
962 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
963 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
964 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
965 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
966 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
968 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
969 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
971 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
972 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
973 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
974 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
976 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
977 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
978 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
979 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
981 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMElement**) DECLSPEC_HIDDEN;
982 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
984 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
986 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
987 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
990 struct HTMLAttributeCollection {
991 DispatchEx dispex;
992 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
993 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
994 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
996 LONG ref;
998 HTMLElement *elem;
999 struct list attrs;
1002 typedef struct {
1003 DispatchEx dispex;
1004 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
1005 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
1007 LONG ref;
1009 /* value is valid only for detached attributes (when elem == NULL). */
1010 VARIANT value;
1011 /* name must be valid for detached attributes */
1012 WCHAR *name;
1014 HTMLElement *elem;
1015 DISPID dispid;
1016 struct list entry;
1017 } HTMLDOMAttribute;
1019 HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*) DECLSPEC_HIDDEN;
1021 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
1023 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
1024 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
1025 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1026 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1027 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1028 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1029 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1030 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1031 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1032 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1033 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1034 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1035 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1036 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1037 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1038 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1039 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1040 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1041 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1042 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1043 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1044 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1045 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1046 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1047 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1048 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1049 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1050 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1052 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1053 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1054 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1055 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1057 void EventTarget_Init(EventTarget*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1058 HRESULT EventTarget_QI(EventTarget*,REFIID,void**) DECLSPEC_HIDDEN;
1059 void EventTarget_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1061 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1062 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1063 void HTMLDOMNode_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1065 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1066 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1067 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1068 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
1069 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1070 void HTMLElement_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1072 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
1073 void HTMLFrameBase_destructor(HTMLFrameBase*) 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;