webservices: Implement the Message Framing Protocol.
[wine.git] / dlls / mshtml / mshtml_private.h
blob9bdb08442172d00e7baa5d4c8ab210c42646bac1
1 /*
2 * Copyright 2005-2009 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "wingdi.h"
20 #include "docobj.h"
21 #include "docobjectservice.h"
22 #include "comcat.h"
23 #include "mshtml.h"
24 #include "mshtmhst.h"
25 #include "hlink.h"
26 #include "perhist.h"
27 #include "dispex.h"
28 #include "objsafe.h"
29 #include "htiframe.h"
30 #include "tlogstg.h"
31 #include "shdeprecated.h"
33 #include "wine/list.h"
34 #include "wine/rbtree.h"
35 #include "wine/unicode.h"
37 #ifdef INIT_GUID
38 #include "initguid.h"
39 #endif
41 #include "nsiface.h"
43 #define NS_ERROR_GENERATE_FAILURE(module,code) \
44 ((nsresult) (((UINT32)(1u<<31)) | ((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
45 #define NS_ERROR_GENERATE_SUCCESS(module,code) \
46 ((nsresult) (((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
48 #define NS_OK ((nsresult)0x00000000L)
49 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
50 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
51 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
52 #define NS_NOINTERFACE ((nsresult)0x80004002L)
53 #define NS_ERROR_INVALID_POINTER ((nsresult)0x80004003L)
54 #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
55 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
56 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
57 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
59 #define NS_ERROR_MODULE_NETWORK 6
61 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
62 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
63 #define NS_SUCCESS_DEFAULT_ACTION NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_NETWORK, 66)
65 #define NS_FAILED(res) ((res) & 0x80000000)
66 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
68 #define NSAPI WINAPI
70 #define MSHTML_E_NODOC 0x800a025c
72 typedef struct HTMLDOMNode HTMLDOMNode;
73 typedef struct ConnectionPoint ConnectionPoint;
74 typedef struct BSCallback BSCallback;
75 typedef struct EventTarget EventTarget;
77 #define TID_LIST \
78 XIID(NULL) \
79 XDIID(DispCEventObj) \
80 XDIID(DispCPlugins) \
81 XDIID(DispDOMChildrenCollection) \
82 XDIID(DispHTMLAnchorElement) \
83 XDIID(DispHTMLAreaElement) \
84 XDIID(DispHTMLAttributeCollection) \
85 XDIID(DispHTMLBody) \
86 XDIID(DispHTMLButtonElement) \
87 XDIID(DispHTMLCommentElement) \
88 XDIID(DispHTMLCurrentStyle) \
89 XDIID(DispHTMLDocument) \
90 XDIID(DispHTMLDOMAttribute) \
91 XDIID(DispHTMLDOMTextNode) \
92 XDIID(DispHTMLElementCollection) \
93 XDIID(DispHTMLEmbed) \
94 XDIID(DispHTMLFormElement) \
95 XDIID(DispHTMLGenericElement) \
96 XDIID(DispHTMLFrameElement) \
97 XDIID(DispHTMLHeadElement) \
98 XDIID(DispHTMLHtmlElement) \
99 XDIID(DispHTMLHistory) \
100 XDIID(DispHTMLIFrame) \
101 XDIID(DispHTMLImg) \
102 XDIID(DispHTMLInputElement) \
103 XDIID(DispHTMLLabelElement) \
104 XDIID(DispHTMLLinkElement) \
105 XDIID(DispHTMLLocation) \
106 XDIID(DispHTMLMetaElement) \
107 XDIID(DispHTMLNavigator) \
108 XDIID(DispHTMLObjectElement) \
109 XDIID(DispHTMLOptionElement) \
110 XDIID(DispHTMLScreen) \
111 XDIID(DispHTMLScriptElement) \
112 XDIID(DispHTMLSelectElement) \
113 XDIID(DispHTMLStyle) \
114 XDIID(DispHTMLStyleElement) \
115 XDIID(DispHTMLStyleSheet) \
116 XDIID(DispHTMLStyleSheetRulesCollection) \
117 XDIID(DispHTMLStyleSheetsCollection) \
118 XDIID(DispHTMLTable) \
119 XDIID(DispHTMLTableCell) \
120 XDIID(DispHTMLTableRow) \
121 XDIID(DispHTMLTextAreaElement) \
122 XDIID(DispHTMLTitleElement) \
123 XDIID(DispHTMLUnknownElement) \
124 XDIID(DispHTMLWindow2) \
125 XDIID(DispHTMLXMLHttpRequest) \
126 XDIID(HTMLDocumentEvents) \
127 XDIID(HTMLElementEvents2) \
128 XIID(IDocumentSelector) \
129 XIID(IElementSelector) \
130 XIID(IHTMLAnchorElement) \
131 XIID(IHTMLAreaElement) \
132 XIID(IHTMLAttributeCollection) \
133 XIID(IHTMLAttributeCollection2) \
134 XIID(IHTMLAttributeCollection3) \
135 XIID(IHTMLBodyElement) \
136 XIID(IHTMLBodyElement2) \
137 XIID(IHTMLButtonElement) \
138 XIID(IHTMLCommentElement) \
139 XIID(IHTMLCurrentStyle) \
140 XIID(IHTMLCurrentStyle2) \
141 XIID(IHTMLCurrentStyle3) \
142 XIID(IHTMLCurrentStyle4) \
143 XIID(IHTMLDocument2) \
144 XIID(IHTMLDocument3) \
145 XIID(IHTMLDocument4) \
146 XIID(IHTMLDocument5) \
147 XIID(IHTMLDocument6) \
148 XIID(IHTMLDOMAttribute) \
149 XIID(IHTMLDOMAttribute2) \
150 XIID(IHTMLDOMChildrenCollection) \
151 XIID(IHTMLDOMImplementation) \
152 XIID(IHTMLDOMNode) \
153 XIID(IHTMLDOMNode2) \
154 XIID(IHTMLDOMNode3) \
155 XIID(IHTMLDOMTextNode) \
156 XIID(IHTMLDOMTextNode2) \
157 XIID(IHTMLElement) \
158 XIID(IHTMLElement2) \
159 XIID(IHTMLElement3) \
160 XIID(IHTMLElement4) \
161 XIID(IHTMLElement6) \
162 XIID(IHTMLElementCollection) \
163 XIID(IHTMLEmbedElement) \
164 XIID(IHTMLEventObj) \
165 XIID(IHTMLFiltersCollection) \
166 XIID(IHTMLFormElement) \
167 XIID(IHTMLFrameBase) \
168 XIID(IHTMLFrameBase2) \
169 XIID(IHTMLFrameElement3) \
170 XIID(IHTMLGenericElement) \
171 XIID(IHTMLHeadElement) \
172 XIID(IHTMLHtmlElement) \
173 XIID(IHTMLIFrameElement) \
174 XIID(IHTMLIFrameElement2) \
175 XIID(IHTMLIFrameElement3) \
176 XIID(IHTMLImageElementFactory) \
177 XIID(IHTMLImgElement) \
178 XIID(IHTMLInputElement) \
179 XIID(IHTMLInputTextElement2) \
180 XIID(IHTMLLabelElement) \
181 XIID(IHTMLLinkElement) \
182 XIID(IHTMLLocation) \
183 XIID(IHTMLMetaElement) \
184 XIID(IHTMLMimeTypesCollection) \
185 XIID(IHTMLObjectElement) \
186 XIID(IHTMLObjectElement2) \
187 XIID(IHTMLOptionElement) \
188 XIID(IHTMLOptionElementFactory) \
189 XIID(IHTMLPluginsCollection) \
190 XIID(IHTMLRect) \
191 XIID(IHTMLScreen) \
192 XIID(IHTMLScriptElement) \
193 XIID(IHTMLSelectElement) \
194 XIID(IHTMLSelectionObject) \
195 XIID(IHTMLSelectionObject2) \
196 XIID(IHTMLStorage) \
197 XIID(IHTMLStyle) \
198 XIID(IHTMLStyle2) \
199 XIID(IHTMLStyle3) \
200 XIID(IHTMLStyle4) \
201 XIID(IHTMLStyle5) \
202 XIID(IHTMLStyle6) \
203 XIID(IHTMLStyleElement) \
204 XIID(IHTMLStyleSheet) \
205 XIID(IHTMLStyleSheetRulesCollection) \
206 XIID(IHTMLStyleSheetsCollection) \
207 XIID(IHTMLTable) \
208 XIID(IHTMLTable2) \
209 XIID(IHTMLTable3) \
210 XIID(IHTMLTableCell) \
211 XIID(IHTMLTableRow) \
212 XIID(IHTMLTextAreaElement) \
213 XIID(IHTMLTextContainer) \
214 XIID(IHTMLTitleElement) \
215 XIID(IHTMLTxtRange) \
216 XIID(IHTMLUniqueName) \
217 XIID(IHTMLWindow2) \
218 XIID(IHTMLWindow3) \
219 XIID(IHTMLWindow4) \
220 XIID(IHTMLWindow5) \
221 XIID(IHTMLWindow6) \
222 XIID(IHTMLXMLHttpRequest) \
223 XIID(IHTMLXMLHttpRequestFactory) \
224 XIID(IOmHistory) \
225 XIID(IOmNavigator)
227 typedef enum {
228 #define XIID(iface) iface ## _tid,
229 #define XDIID(iface) iface ## _tid,
230 TID_LIST
231 #undef XIID
232 #undef XDIID
233 LAST_tid
234 } tid_t;
236 typedef enum {
237 COMPAT_MODE_QUIRKS,
238 COMPAT_MODE_IE5,
239 COMPAT_MODE_IE7,
240 COMPAT_MODE_IE8,
241 COMPAT_MODE_IE9,
242 COMPAT_MODE_IE10,
243 COMPAT_MODE_IE11
244 } compat_mode_t;
246 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
247 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
249 typedef struct {
250 unsigned document_mode;
251 unsigned ie_version;
252 } compat_mode_info_t;
254 extern const compat_mode_info_t compat_mode_info[COMPAT_MODE_CNT] DECLSPEC_HIDDEN;
256 typedef struct dispex_data_t dispex_data_t;
257 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
259 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
260 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
261 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
263 typedef struct DispatchEx DispatchEx;
265 typedef struct {
266 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
267 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
268 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
269 HRESULT (*populate_props)(DispatchEx*);
270 /* We abuse this vtbl for EventTarget functions to avoid separated vtbl. */
271 EventTarget *(*get_event_target)(DispatchEx*);
272 void (*bind_event)(DispatchEx*,int);
273 } dispex_static_data_vtbl_t;
275 typedef struct {
276 const dispex_static_data_vtbl_t *vtbl;
277 const tid_t disp_tid;
278 const tid_t* const iface_tids;
279 void (*init_info)(dispex_data_t*,compat_mode_t);
280 dispex_data_t *info_cache[COMPAT_MODE_CNT];
281 } dispex_static_data_t;
283 struct DispatchEx {
284 IDispatchEx IDispatchEx_iface;
286 IUnknown *outer;
288 dispex_data_t *info;
289 dispex_dynamic_data_t *dynamic_data;
292 typedef struct {
293 UINT_PTR x;
294 } nsCycleCollectingAutoRefCnt;
296 typedef struct {
297 void *vtbl;
298 int ref_flags;
299 void *callbacks;
300 } ExternalCycleCollectionParticipant;
302 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
304 typedef struct {
305 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
306 nsresult (NSAPI *unlink)(void*);
307 void (NSAPI *delete_cycle_collectable)(void*);
308 } CCObjCallback;
310 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
312 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN;
313 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN;
314 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN;
315 void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN;
316 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
317 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
319 void init_dispex_with_compat_mode(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
320 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
321 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
322 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
323 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
324 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
325 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
326 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
327 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
328 void release_typelib(void) DECLSPEC_HIDDEN;
329 HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**) DECLSPEC_HIDDEN;
330 const dispex_static_data_vtbl_t *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
331 void dispex_info_add_interface(dispex_data_t*,tid_t,const DISPID*) DECLSPEC_HIDDEN;
333 static inline void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *desc)
335 init_dispex_with_compat_mode(dispex, outer, desc, COMPAT_MODE_NONE);
338 typedef enum {
339 DISPEXPROP_CUSTOM,
340 DISPEXPROP_DYNAMIC,
341 DISPEXPROP_BUILTIN
342 } dispex_prop_type_t;
344 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
346 typedef struct HTMLWindow HTMLWindow;
347 typedef struct HTMLInnerWindow HTMLInnerWindow;
348 typedef struct HTMLOuterWindow HTMLOuterWindow;
349 typedef struct HTMLDocumentNode HTMLDocumentNode;
350 typedef struct HTMLDocumentObj HTMLDocumentObj;
351 typedef struct HTMLFrameBase HTMLFrameBase;
352 typedef struct NSContainer NSContainer;
353 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
355 typedef enum {
356 SCRIPTMODE_GECKO,
357 SCRIPTMODE_ACTIVESCRIPT
358 } SCRIPTMODE;
360 typedef struct ScriptHost ScriptHost;
362 typedef enum {
363 GLOBAL_SCRIPTVAR,
364 GLOBAL_ELEMENTVAR,
365 GLOBAL_DISPEXVAR,
366 GLOBAL_FRAMEVAR
367 } global_prop_type_t;
369 typedef struct {
370 global_prop_type_t type;
371 WCHAR *name;
372 ScriptHost *script_host;
373 DISPID id;
374 } global_prop_t;
376 struct EventTarget {
377 DispatchEx dispex;
378 struct wine_rb_tree handler_map;
381 typedef struct {
382 DispatchEx dispex;
383 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
385 LONG ref;
387 HTMLInnerWindow *window;
388 } HTMLOptionElementFactory;
390 typedef struct {
391 DispatchEx dispex;
392 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
394 LONG ref;
396 HTMLInnerWindow *window;
397 } HTMLImageElementFactory;
399 typedef struct {
400 DispatchEx dispex;
401 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
403 LONG ref;
405 HTMLInnerWindow *window;
406 } HTMLXMLHttpRequestFactory;
408 struct HTMLLocation {
409 DispatchEx dispex;
410 IHTMLLocation IHTMLLocation_iface;
412 LONG ref;
414 HTMLInnerWindow *window;
417 typedef struct {
418 DispatchEx dispex;
419 IOmHistory IOmHistory_iface;
421 LONG ref;
423 HTMLInnerWindow *window;
424 } OmHistory;
426 typedef struct {
427 HTMLOuterWindow *window;
428 LONG ref;
429 } windowref_t;
431 typedef struct nsChannelBSC nsChannelBSC;
433 struct HTMLWindow {
434 IHTMLWindow2 IHTMLWindow2_iface;
435 IHTMLWindow3 IHTMLWindow3_iface;
436 IHTMLWindow4 IHTMLWindow4_iface;
437 IHTMLWindow5 IHTMLWindow5_iface;
438 IHTMLWindow6 IHTMLWindow6_iface;
439 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
440 IDispatchEx IDispatchEx_iface;
441 IServiceProvider IServiceProvider_iface;
442 ITravelLogClient ITravelLogClient_iface;
443 IObjectIdentity IObjectIdentity_iface;
444 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
446 LONG ref;
448 HTMLInnerWindow *inner_window;
449 HTMLOuterWindow *outer_window;
452 struct HTMLOuterWindow {
453 HTMLWindow base;
455 windowref_t *window_ref;
456 LONG task_magic;
458 HTMLDocumentObj *doc_obj;
459 nsIDOMWindow *nswindow;
460 mozIDOMWindowProxy *window_proxy;
461 HTMLOuterWindow *parent;
462 HTMLFrameBase *frame_element;
464 READYSTATE readystate;
465 BOOL readystate_locked;
466 unsigned readystate_pending;
468 HTMLInnerWindow *pending_window;
469 IMoniker *mon;
470 IUri *uri;
471 IUri *uri_nofrag;
472 BSTR url;
473 DWORD load_flags;
475 SCRIPTMODE scriptmode;
477 IInternetSecurityManager *secmgr;
479 struct list children;
480 struct list sibling_entry;
481 struct wine_rb_entry entry;
484 struct HTMLInnerWindow {
485 HTMLWindow base;
486 EventTarget event_target;
488 HTMLDocumentNode *doc;
490 struct list script_hosts;
492 IHTMLEventObj *event;
494 HTMLImageElementFactory *image_factory;
495 HTMLOptionElementFactory *option_factory;
496 HTMLXMLHttpRequestFactory *xhr_factory;
497 IHTMLScreen *screen;
498 OmHistory *history;
499 IHTMLStorage *session_storage;
501 unsigned parser_callback_cnt;
502 struct list script_queue;
504 global_prop_t *global_props;
505 DWORD global_prop_cnt;
506 DWORD global_prop_size;
508 LONG task_magic;
510 HTMLLocation *location;
512 IMoniker *mon;
513 nsChannelBSC *bscallback;
514 struct list bindings;
517 typedef enum {
518 UNKNOWN_USERMODE,
519 BROWSEMODE,
520 EDITMODE
521 } USERMODE;
523 typedef struct _cp_static_data_t {
524 tid_t tid;
525 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
526 BOOL pass_event_arg;
527 DWORD id_cnt;
528 DISPID *ids;
529 } cp_static_data_t;
531 typedef struct {
532 const IID *riid;
533 cp_static_data_t *desc;
534 } cpc_entry_t;
536 typedef struct ConnectionPointContainer {
537 IConnectionPointContainer IConnectionPointContainer_iface;
539 ConnectionPoint *cps;
540 const cpc_entry_t *cp_entries;
541 IUnknown *outer;
542 struct ConnectionPointContainer *forward_container;
543 } ConnectionPointContainer;
545 struct ConnectionPoint {
546 IConnectionPoint IConnectionPoint_iface;
548 ConnectionPointContainer *container;
550 union {
551 IUnknown *unk;
552 IDispatch *disp;
553 IPropertyNotifySink *propnotif;
554 } *sinks;
555 DWORD sinks_size;
557 const IID *iid;
558 cp_static_data_t *data;
561 struct HTMLDocument {
562 IHTMLDocument2 IHTMLDocument2_iface;
563 IHTMLDocument3 IHTMLDocument3_iface;
564 IHTMLDocument4 IHTMLDocument4_iface;
565 IHTMLDocument5 IHTMLDocument5_iface;
566 IHTMLDocument6 IHTMLDocument6_iface;
567 IHTMLDocument7 IHTMLDocument7_iface;
568 IDocumentSelector IDocumentSelector_iface;
569 IPersistMoniker IPersistMoniker_iface;
570 IPersistFile IPersistFile_iface;
571 IPersistHistory IPersistHistory_iface;
572 IMonikerProp IMonikerProp_iface;
573 IOleObject IOleObject_iface;
574 IOleDocument IOleDocument_iface;
575 IOleDocumentView IOleDocumentView_iface;
576 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
577 IViewObjectEx IViewObjectEx_iface;
578 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
579 IServiceProvider IServiceProvider_iface;
580 IOleCommandTarget IOleCommandTarget_iface;
581 IOleControl IOleControl_iface;
582 IHlinkTarget IHlinkTarget_iface;
583 IPersistStreamInit IPersistStreamInit_iface;
584 IDispatchEx IDispatchEx_iface;
585 ISupportErrorInfo ISupportErrorInfo_iface;
586 IObjectWithSite IObjectWithSite_iface;
587 IOleContainer IOleContainer_iface;
588 IObjectSafety IObjectSafety_iface;
589 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
591 IUnknown *outer_unk;
592 IDispatchEx *dispex;
594 HTMLDocumentObj *doc_obj;
595 HTMLDocumentNode *doc_node;
597 HTMLOuterWindow *window;
599 LONG task_magic;
601 ConnectionPointContainer cp_container;
602 IOleAdviseHolder *advise_holder;
605 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
607 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
610 static inline ULONG htmldoc_addref(HTMLDocument *This)
612 return IUnknown_AddRef(This->outer_unk);
615 static inline ULONG htmldoc_release(HTMLDocument *This)
617 return IUnknown_Release(This->outer_unk);
620 struct HTMLDocumentObj {
621 HTMLDocument basedoc;
622 DispatchEx dispex;
623 IUnknown IUnknown_outer;
624 ICustomDoc ICustomDoc_iface;
625 ITargetContainer ITargetContainer_iface;
627 IWindowForBindingUI IWindowForBindingUI_iface;
629 LONG ref;
631 NSContainer *nscontainer;
633 IOleClientSite *client;
634 IDocHostUIHandler *hostui;
635 IOleCommandTarget *client_cmdtrg;
636 BOOL custom_hostui;
637 IOleInPlaceSite *ipsite;
638 IOleInPlaceFrame *frame;
639 IOleInPlaceUIWindow *ip_window;
640 IAdviseSink *view_sink;
641 IDocObjectService *doc_object_service;
642 IUnknown *webbrowser;
643 ITravelLog *travel_log;
644 IUnknown *browser_service;
646 DOCHOSTUIINFO hostinfo;
648 IOleUndoManager *undomgr;
649 IHTMLEditServices *editsvcs;
651 HWND hwnd;
652 HWND tooltips_hwnd;
654 BOOL is_mhtml;
655 BOOL request_uiactivate;
656 BOOL in_place_active;
657 BOOL ui_active;
658 BOOL window_active;
659 BOOL hostui_setup;
660 BOOL container_locked;
661 BOOL focus;
662 BOOL has_popup;
663 INT download_state;
665 USERMODE usermode;
666 LPWSTR mime;
668 DWORD update;
671 typedef struct nsWeakReference nsWeakReference;
673 struct NSContainer {
674 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
675 nsIContextMenuListener nsIContextMenuListener_iface;
676 nsIURIContentListener nsIURIContentListener_iface;
677 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
678 nsITooltipListener nsITooltipListener_iface;
679 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
680 nsISupportsWeakReference nsISupportsWeakReference_iface;
682 nsIWebBrowser *webbrowser;
683 nsIWebNavigation *navigation;
684 nsIBaseWindow *window;
685 nsIWebBrowserFocus *focus;
687 nsIEditor *editor;
688 nsIController *editor_controller;
690 LONG ref;
692 nsWeakReference *weak_reference;
694 NSContainer *parent;
695 HTMLDocumentObj *doc;
697 nsIURIContentListener *content_listener;
699 HWND hwnd;
702 typedef struct {
703 const CLSID *clsid;
704 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
705 void (*destructor)(HTMLDOMNode*);
706 const cpc_entry_t *cpc_entries;
707 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
708 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
709 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
710 EventTarget *(*get_event_target)(HTMLDOMNode*);
711 HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*);
712 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
713 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
714 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
715 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
716 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
717 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
718 HRESULT (*bind_to_tree)(HTMLDOMNode*);
719 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
720 void (*unlink)(HTMLDOMNode*);
721 BOOL (*is_text_edit)(HTMLDOMNode*);
722 BOOL (*is_settable)(HTMLDOMNode*,DISPID);
723 } NodeImplVtbl;
725 struct HTMLDOMNode {
726 EventTarget event_target;
727 IHTMLDOMNode IHTMLDOMNode_iface;
728 IHTMLDOMNode2 IHTMLDOMNode2_iface;
729 IHTMLDOMNode3 IHTMLDOMNode3_iface;
730 const NodeImplVtbl *vtbl;
732 nsCycleCollectingAutoRefCnt ccref;
734 nsIDOMNode *nsnode;
735 HTMLDocumentNode *doc;
736 ConnectionPointContainer *cp_container;
739 static inline void node_addref(HTMLDOMNode *node)
741 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
744 static inline void node_release(HTMLDOMNode *node)
746 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
749 typedef struct {
750 HTMLDOMNode node;
751 ConnectionPointContainer cp_container;
753 IHTMLElement IHTMLElement_iface;
754 IHTMLElement2 IHTMLElement2_iface;
755 IHTMLElement3 IHTMLElement3_iface;
756 IHTMLElement4 IHTMLElement4_iface;
757 IHTMLElement6 IHTMLElement6_iface;
758 IHTMLUniqueName IHTMLUniqueName_iface;
759 IElementSelector IElementSelector_iface;
760 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
762 nsIDOMHTMLElement *nselem;
763 HTMLStyle *style;
764 HTMLStyle *runtime_style;
765 HTMLAttributeCollection *attrs;
766 WCHAR *filter;
767 unsigned unique_id;
768 } HTMLElement;
770 #define HTMLELEMENT_TIDS \
771 IHTMLDOMNode_tid, \
772 IHTMLDOMNode2_tid, \
773 IHTMLElement_tid, \
774 IHTMLElement3_tid, \
775 IHTMLElement4_tid, \
776 IHTMLUniqueName_tid
778 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN;
779 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
780 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN;
782 typedef struct {
783 HTMLElement element;
785 IHTMLTextContainer IHTMLTextContainer_iface;
786 } HTMLTextContainer;
788 struct HTMLFrameBase {
789 HTMLElement element;
791 IHTMLFrameBase IHTMLFrameBase_iface;
792 IHTMLFrameBase2 IHTMLFrameBase2_iface;
794 HTMLOuterWindow *content_window;
796 nsIDOMHTMLFrameElement *nsframe;
797 nsIDOMHTMLIFrameElement *nsiframe;
800 typedef struct nsDocumentEventListener nsDocumentEventListener;
802 struct HTMLDocumentNode {
803 HTMLDOMNode node;
804 HTMLDocument basedoc;
806 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
808 nsIDocumentObserver nsIDocumentObserver_iface;
810 LONG ref;
812 compat_mode_t document_mode;
813 HTMLInnerWindow *window;
815 nsIDOMHTMLDocument *nsdoc;
816 BOOL content_ready;
818 IHTMLDOMImplementation *dom_implementation;
820 ICatInformation *catmgr;
821 nsDocumentEventListener *nsevent_listener;
822 BOOL *event_vector;
824 WCHAR **elem_vars;
825 unsigned elem_vars_size;
826 unsigned elem_vars_cnt;
828 BOOL skip_mutation_notif;
830 UINT charset;
832 unsigned unique_id;
834 struct list selection_list;
835 struct list range_list;
836 struct list plugin_hosts;
839 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
840 HRESULT MHTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
841 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
842 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
844 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
845 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
846 HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*) DECLSPEC_HIDDEN;
847 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
848 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
849 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
850 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN;
851 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
852 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
853 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
854 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
855 HRESULT create_dom_implementation(IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
857 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
859 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
860 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
861 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
862 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN;
863 void HTMLDocument_Window_Init(HTMLDocument*) DECLSPEC_HIDDEN;
864 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
865 void HTMLDocument_Hlink_Init(HTMLDocument*) DECLSPEC_HIDDEN;
867 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
868 void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN;
870 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
872 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
874 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
875 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
877 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
878 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
880 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
881 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
882 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
883 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
885 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
886 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
887 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
889 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
890 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
891 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
893 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN;
895 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
897 BOOL load_gecko(void) DECLSPEC_HIDDEN;
898 void close_gecko(void) DECLSPEC_HIDDEN;
899 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
900 void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
901 void release_nsio(void) DECLSPEC_HIDDEN;
902 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
903 void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
905 void init_node_cc(void) DECLSPEC_HIDDEN;
907 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
909 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
911 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
912 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
914 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
915 void nsfree(void*) DECLSPEC_HIDDEN;
917 BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN;
918 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
919 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
920 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
921 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
923 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
924 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
925 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
926 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
928 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
930 static inline HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p)
932 V_VT(p) = VT_BSTR;
933 return return_nsstr(nsres, nsstr, &V_BSTR(p));
936 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
937 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
938 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
939 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
940 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
941 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN;
942 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
943 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
945 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
946 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
947 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
948 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
949 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
950 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
952 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
953 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
955 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
956 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
957 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
958 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
960 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
961 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
962 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
963 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
965 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
966 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
968 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
970 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
971 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
974 struct HTMLAttributeCollection {
975 DispatchEx dispex;
976 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
977 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
978 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
980 LONG ref;
982 HTMLElement *elem;
983 struct list attrs;
986 typedef struct {
987 DispatchEx dispex;
988 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
989 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
991 LONG ref;
993 /* value is valid only for detached attributes (when elem == NULL). */
994 VARIANT value;
995 /* name must be valid for detached attributes */
996 WCHAR *name;
998 HTMLElement *elem;
999 DISPID dispid;
1000 struct list entry;
1001 } HTMLDOMAttribute;
1003 HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*) DECLSPEC_HIDDEN;
1005 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
1007 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
1008 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
1009 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1010 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1011 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1012 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1013 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1014 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1015 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1016 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1017 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1018 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1019 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1020 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1021 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1022 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1023 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1024 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1025 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1026 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1027 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1028 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1029 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1030 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1031 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1032 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1033 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1034 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1036 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*) DECLSPEC_HIDDEN;
1037 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1038 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1039 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1041 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1042 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1043 void HTMLDOMNode_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1045 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1046 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1047 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1048 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
1049 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1050 void HTMLElement_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1052 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
1053 void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN;
1055 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
1056 HRESULT get_elem(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1058 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
1060 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
1061 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
1062 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1063 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
1064 HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1066 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
1068 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
1069 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
1070 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
1071 IHTMLDOMChildrenCollection *create_child_collection(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
1073 HRESULT attr_value_to_string(VARIANT*) DECLSPEC_HIDDEN;
1074 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
1075 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN;
1077 nsresult get_elem_attr_value(nsIDOMHTMLElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
1078 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
1079 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
1081 HRESULT elem_unique_id(unsigned id, BSTR *p) DECLSPEC_HIDDEN;
1083 /* commands */
1084 typedef struct {
1085 DWORD id;
1086 HRESULT (*query)(HTMLDocument*,OLECMD*);
1087 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
1088 } cmdtable_t;
1090 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
1092 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
1094 /* timer */
1095 #define UPDATE_UI 0x0001
1096 #define UPDATE_TITLE 0x0002
1098 void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN;
1099 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1100 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
1102 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
1104 /* editor */
1105 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1106 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
1107 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
1108 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1109 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1110 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1111 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
1112 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
1113 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
1115 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
1117 typedef struct task_t task_t;
1118 typedef void (*task_proc_t)(task_t*);
1120 struct task_t {
1121 LONG target_magic;
1122 task_proc_t proc;
1123 task_proc_t destr;
1124 struct list entry;
1127 typedef struct {
1128 task_t header;
1129 HTMLDocumentObj *doc;
1130 } docobj_task_t;
1132 typedef struct {
1133 HWND thread_hwnd;
1134 struct list task_list;
1135 struct list timer_list;
1136 } thread_data_t;
1138 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1139 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1141 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1142 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1143 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1144 void flush_pending_tasks(LONG) DECLSPEC_HIDDEN;
1146 HRESULT set_task_timer(HTMLInnerWindow*,LONG,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1147 HRESULT clear_task_timer(HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
1149 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1151 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1152 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1153 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1154 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1155 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1157 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1159 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1161 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1162 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1164 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1165 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1167 /* memory allocation functions */
1169 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
1171 return HeapAlloc(GetProcessHeap(), 0, len);
1174 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
1176 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
1179 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
1181 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
1184 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1186 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1189 static inline BOOL heap_free(void *mem)
1191 return HeapFree(GetProcessHeap(), 0, mem);
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 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
1331 BSTR charset_string_from_cp(UINT) DECLSPEC_HIDDEN;
1332 HDC get_display_dc(void) DECLSPEC_HIDDEN;
1333 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1334 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1336 extern HINSTANCE hInst DECLSPEC_HIDDEN;