d3d9/tests: Add test for regression in IDirect3DDevice9_Reset().
[wine.git] / dlls / mshtml / mshtml_private.h
blob875d95a336b99bf25fb89c53a44b3289970c3d1c
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/unicode.h"
36 #ifdef INIT_GUID
37 #include "initguid.h"
38 #endif
40 #include "nsiface.h"
42 #define NS_ERROR_GENERATE_FAILURE(module,code) \
43 ((nsresult) (((UINT32)(1u<<31)) | ((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
44 #define NS_ERROR_GENERATE_SUCCESS(module,code) \
45 ((nsresult) (((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
47 #define NS_OK ((nsresult)0x00000000L)
48 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
49 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
50 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
51 #define NS_NOINTERFACE ((nsresult)0x80004002L)
52 #define NS_ERROR_INVALID_POINTER ((nsresult)0x80004003L)
53 #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
54 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
55 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
56 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
58 #define NS_ERROR_MODULE_NETWORK 6
60 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
61 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
62 #define NS_SUCCESS_DEFAULT_ACTION NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_NETWORK, 66)
64 #define NS_FAILED(res) ((res) & 0x80000000)
65 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
67 #define NSAPI WINAPI
69 #define MSHTML_E_NODOC 0x800a025c
71 typedef struct HTMLDOMNode HTMLDOMNode;
72 typedef struct ConnectionPoint ConnectionPoint;
73 typedef struct BSCallback BSCallback;
74 typedef struct event_target_t event_target_t;
76 #define TID_LIST \
77 XIID(NULL) \
78 XDIID(DispCEventObj) \
79 XDIID(DispCPlugins) \
80 XDIID(DispDOMChildrenCollection) \
81 XDIID(DispHTMLAnchorElement) \
82 XDIID(DispHTMLAreaElement) \
83 XDIID(DispHTMLAttributeCollection) \
84 XDIID(DispHTMLBody) \
85 XDIID(DispHTMLButtonElement) \
86 XDIID(DispHTMLCommentElement) \
87 XDIID(DispHTMLCurrentStyle) \
88 XDIID(DispHTMLDocument) \
89 XDIID(DispHTMLDOMAttribute) \
90 XDIID(DispHTMLDOMTextNode) \
91 XDIID(DispHTMLElementCollection) \
92 XDIID(DispHTMLEmbed) \
93 XDIID(DispHTMLFormElement) \
94 XDIID(DispHTMLGenericElement) \
95 XDIID(DispHTMLFrameElement) \
96 XDIID(DispHTMLHeadElement) \
97 XDIID(DispHTMLHtmlElement) \
98 XDIID(DispHTMLHistory) \
99 XDIID(DispHTMLIFrame) \
100 XDIID(DispHTMLImg) \
101 XDIID(DispHTMLInputElement) \
102 XDIID(DispHTMLLabelElement) \
103 XDIID(DispHTMLLinkElement) \
104 XDIID(DispHTMLLocation) \
105 XDIID(DispHTMLMetaElement) \
106 XDIID(DispHTMLNavigator) \
107 XDIID(DispHTMLObjectElement) \
108 XDIID(DispHTMLOptionElement) \
109 XDIID(DispHTMLScreen) \
110 XDIID(DispHTMLScriptElement) \
111 XDIID(DispHTMLSelectElement) \
112 XDIID(DispHTMLStyle) \
113 XDIID(DispHTMLStyleElement) \
114 XDIID(DispHTMLStyleSheet) \
115 XDIID(DispHTMLStyleSheetRulesCollection) \
116 XDIID(DispHTMLStyleSheetsCollection) \
117 XDIID(DispHTMLTable) \
118 XDIID(DispHTMLTableCell) \
119 XDIID(DispHTMLTableRow) \
120 XDIID(DispHTMLTextAreaElement) \
121 XDIID(DispHTMLTitleElement) \
122 XDIID(DispHTMLUnknownElement) \
123 XDIID(DispHTMLWindow2) \
124 XDIID(DispHTMLXMLHttpRequest) \
125 XDIID(HTMLDocumentEvents) \
126 XDIID(HTMLElementEvents2) \
127 XIID(IDocumentSelector) \
128 XIID(IElementSelector) \
129 XIID(IHTMLAnchorElement) \
130 XIID(IHTMLAreaElement) \
131 XIID(IHTMLAttributeCollection) \
132 XIID(IHTMLAttributeCollection2) \
133 XIID(IHTMLAttributeCollection3) \
134 XIID(IHTMLBodyElement) \
135 XIID(IHTMLBodyElement2) \
136 XIID(IHTMLButtonElement) \
137 XIID(IHTMLCommentElement) \
138 XIID(IHTMLCurrentStyle) \
139 XIID(IHTMLCurrentStyle2) \
140 XIID(IHTMLCurrentStyle3) \
141 XIID(IHTMLCurrentStyle4) \
142 XIID(IHTMLDocument2) \
143 XIID(IHTMLDocument3) \
144 XIID(IHTMLDocument4) \
145 XIID(IHTMLDocument5) \
146 XIID(IHTMLDocument6) \
147 XIID(IHTMLDOMAttribute) \
148 XIID(IHTMLDOMAttribute2) \
149 XIID(IHTMLDOMChildrenCollection) \
150 XIID(IHTMLDOMImplementation) \
151 XIID(IHTMLDOMNode) \
152 XIID(IHTMLDOMNode2) \
153 XIID(IHTMLDOMTextNode) \
154 XIID(IHTMLDOMTextNode2) \
155 XIID(IHTMLElement) \
156 XIID(IHTMLElement2) \
157 XIID(IHTMLElement3) \
158 XIID(IHTMLElement4) \
159 XIID(IHTMLElement6) \
160 XIID(IHTMLElementCollection) \
161 XIID(IHTMLEmbedElement) \
162 XIID(IHTMLEventObj) \
163 XIID(IHTMLFiltersCollection) \
164 XIID(IHTMLFormElement) \
165 XIID(IHTMLFrameBase) \
166 XIID(IHTMLFrameBase2) \
167 XIID(IHTMLFrameElement3) \
168 XIID(IHTMLGenericElement) \
169 XIID(IHTMLHeadElement) \
170 XIID(IHTMLHtmlElement) \
171 XIID(IHTMLIFrameElement) \
172 XIID(IHTMLIFrameElement2) \
173 XIID(IHTMLIFrameElement3) \
174 XIID(IHTMLImageElementFactory) \
175 XIID(IHTMLImgElement) \
176 XIID(IHTMLInputElement) \
177 XIID(IHTMLLabelElement) \
178 XIID(IHTMLLinkElement) \
179 XIID(IHTMLLocation) \
180 XIID(IHTMLMetaElement) \
181 XIID(IHTMLMimeTypesCollection) \
182 XIID(IHTMLObjectElement) \
183 XIID(IHTMLObjectElement2) \
184 XIID(IHTMLOptionElement) \
185 XIID(IHTMLOptionElementFactory) \
186 XIID(IHTMLPluginsCollection) \
187 XIID(IHTMLRect) \
188 XIID(IHTMLScreen) \
189 XIID(IHTMLScriptElement) \
190 XIID(IHTMLSelectElement) \
191 XIID(IHTMLSelectionObject) \
192 XIID(IHTMLSelectionObject2) \
193 XIID(IHTMLStorage) \
194 XIID(IHTMLStyle) \
195 XIID(IHTMLStyle2) \
196 XIID(IHTMLStyle3) \
197 XIID(IHTMLStyle4) \
198 XIID(IHTMLStyle5) \
199 XIID(IHTMLStyle6) \
200 XIID(IHTMLStyleElement) \
201 XIID(IHTMLStyleSheet) \
202 XIID(IHTMLStyleSheetRulesCollection) \
203 XIID(IHTMLStyleSheetsCollection) \
204 XIID(IHTMLTable) \
205 XIID(IHTMLTable2) \
206 XIID(IHTMLTable3) \
207 XIID(IHTMLTableCell) \
208 XIID(IHTMLTableRow) \
209 XIID(IHTMLTextAreaElement) \
210 XIID(IHTMLTextContainer) \
211 XIID(IHTMLTitleElement) \
212 XIID(IHTMLTxtRange) \
213 XIID(IHTMLUniqueName) \
214 XIID(IHTMLWindow2) \
215 XIID(IHTMLWindow3) \
216 XIID(IHTMLWindow4) \
217 XIID(IHTMLWindow5) \
218 XIID(IHTMLWindow6) \
219 XIID(IHTMLXMLHttpRequest) \
220 XIID(IHTMLXMLHttpRequestFactory) \
221 XIID(IOmHistory) \
222 XIID(IOmNavigator)
224 typedef enum {
225 #define XIID(iface) iface ## _tid,
226 #define XDIID(iface) iface ## _tid,
227 TID_LIST
228 #undef XIID
229 #undef XDIID
230 LAST_tid
231 } tid_t;
233 typedef enum {
234 COMPAT_MODE_QUIRKS,
235 COMPAT_MODE_IE7,
236 COMPAT_MODE_IE8,
237 COMPAT_MODE_IE9,
238 COMPAT_MODE_IE10,
239 COMPAT_MODE_IE11
240 } compat_mode_t;
242 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
243 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
245 typedef struct dispex_data_t dispex_data_t;
246 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
248 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
249 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
250 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
252 typedef struct DispatchEx DispatchEx;
254 typedef struct {
255 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
256 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
257 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
258 HRESULT (*populate_props)(DispatchEx*);
259 /* We abuse this vtbl for EventTarget functions to avoid separated vtbl. */
260 event_target_t **(*get_event_target_ptr)(DispatchEx*);
261 void (*bind_event)(DispatchEx*,int);
262 } dispex_static_data_vtbl_t;
264 typedef struct {
265 const dispex_static_data_vtbl_t *vtbl;
266 const tid_t disp_tid;
267 const tid_t* const iface_tids;
268 void (*init_info)(dispex_data_t*,compat_mode_t);
269 dispex_data_t *info_cache[COMPAT_MODE_CNT];
270 } dispex_static_data_t;
272 struct DispatchEx {
273 IDispatchEx IDispatchEx_iface;
275 IUnknown *outer;
277 dispex_data_t *info;
278 dispex_dynamic_data_t *dynamic_data;
281 typedef struct {
282 UINT_PTR x;
283 } nsCycleCollectingAutoRefCnt;
285 typedef struct {
286 void *vtbl;
287 int ref_flags;
288 void *callbacks;
289 } ExternalCycleCollectionParticipant;
291 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
293 typedef struct {
294 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
295 nsresult (NSAPI *unlink)(void*);
296 void (NSAPI *delete_cycle_collectable)(void*);
297 } CCObjCallback;
299 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
301 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN;
302 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN;
303 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN;
304 void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN;
305 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
306 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
308 void init_dispex_with_compat_mode(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
309 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
310 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
311 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
312 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
313 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
314 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
315 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
316 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
317 void release_typelib(void) DECLSPEC_HIDDEN;
318 HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
319 const dispex_static_data_vtbl_t *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
320 void dispex_info_add_interface(dispex_data_t*,tid_t) DECLSPEC_HIDDEN;
322 static inline void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *desc)
324 init_dispex_with_compat_mode(dispex, outer, desc, COMPAT_MODE_NONE);
327 typedef enum {
328 DISPEXPROP_CUSTOM,
329 DISPEXPROP_DYNAMIC,
330 DISPEXPROP_BUILTIN
331 } dispex_prop_type_t;
333 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
335 typedef struct HTMLWindow HTMLWindow;
336 typedef struct HTMLInnerWindow HTMLInnerWindow;
337 typedef struct HTMLOuterWindow HTMLOuterWindow;
338 typedef struct HTMLDocumentNode HTMLDocumentNode;
339 typedef struct HTMLDocumentObj HTMLDocumentObj;
340 typedef struct HTMLFrameBase HTMLFrameBase;
341 typedef struct NSContainer NSContainer;
342 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
344 typedef enum {
345 SCRIPTMODE_GECKO,
346 SCRIPTMODE_ACTIVESCRIPT
347 } SCRIPTMODE;
349 typedef struct ScriptHost ScriptHost;
351 typedef enum {
352 GLOBAL_SCRIPTVAR,
353 GLOBAL_ELEMENTVAR,
354 GLOBAL_DISPEXVAR,
355 GLOBAL_FRAMEVAR
356 } global_prop_type_t;
358 typedef struct {
359 global_prop_type_t type;
360 WCHAR *name;
361 ScriptHost *script_host;
362 DISPID id;
363 } global_prop_t;
365 typedef struct {
366 DispatchEx dispex;
367 event_target_t *ptr;
368 } EventTarget;
370 typedef struct {
371 DispatchEx dispex;
372 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
374 LONG ref;
376 HTMLInnerWindow *window;
377 } HTMLOptionElementFactory;
379 typedef struct {
380 DispatchEx dispex;
381 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
383 LONG ref;
385 HTMLInnerWindow *window;
386 } HTMLImageElementFactory;
388 typedef struct {
389 DispatchEx dispex;
390 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
392 LONG ref;
394 HTMLInnerWindow *window;
395 } HTMLXMLHttpRequestFactory;
397 struct HTMLLocation {
398 DispatchEx dispex;
399 IHTMLLocation IHTMLLocation_iface;
401 LONG ref;
403 HTMLInnerWindow *window;
406 typedef struct {
407 DispatchEx dispex;
408 IOmHistory IOmHistory_iface;
410 LONG ref;
412 HTMLInnerWindow *window;
413 } OmHistory;
415 typedef struct {
416 HTMLOuterWindow *window;
417 LONG ref;
418 } windowref_t;
420 typedef struct nsChannelBSC nsChannelBSC;
422 struct HTMLWindow {
423 IHTMLWindow2 IHTMLWindow2_iface;
424 IHTMLWindow3 IHTMLWindow3_iface;
425 IHTMLWindow4 IHTMLWindow4_iface;
426 IHTMLWindow5 IHTMLWindow5_iface;
427 IHTMLWindow6 IHTMLWindow6_iface;
428 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
429 IDispatchEx IDispatchEx_iface;
430 IServiceProvider IServiceProvider_iface;
431 ITravelLogClient ITravelLogClient_iface;
432 IObjectIdentity IObjectIdentity_iface;
434 LONG ref;
436 HTMLInnerWindow *inner_window;
437 HTMLOuterWindow *outer_window;
440 struct HTMLOuterWindow {
441 HTMLWindow base;
443 windowref_t *window_ref;
444 LONG task_magic;
446 HTMLDocumentObj *doc_obj;
447 nsIDOMWindow *nswindow;
448 mozIDOMWindowProxy *window_proxy;
449 HTMLOuterWindow *parent;
450 HTMLFrameBase *frame_element;
452 READYSTATE readystate;
453 BOOL readystate_locked;
454 unsigned readystate_pending;
456 HTMLInnerWindow *pending_window;
457 IMoniker *mon;
458 IUri *uri;
459 IUri *uri_nofrag;
460 BSTR url;
461 DWORD load_flags;
463 SCRIPTMODE scriptmode;
465 IInternetSecurityManager *secmgr;
467 struct list children;
468 struct list sibling_entry;
469 struct list entry;
472 struct HTMLInnerWindow {
473 HTMLWindow base;
474 EventTarget event_target;
476 HTMLDocumentNode *doc;
478 struct list script_hosts;
480 IHTMLEventObj *event;
482 HTMLImageElementFactory *image_factory;
483 HTMLOptionElementFactory *option_factory;
484 HTMLXMLHttpRequestFactory *xhr_factory;
485 IHTMLScreen *screen;
486 OmHistory *history;
487 IHTMLStorage *session_storage;
489 unsigned parser_callback_cnt;
490 struct list script_queue;
492 global_prop_t *global_props;
493 DWORD global_prop_cnt;
494 DWORD global_prop_size;
496 LONG task_magic;
498 HTMLLocation *location;
500 IMoniker *mon;
501 nsChannelBSC *bscallback;
502 struct list bindings;
505 typedef enum {
506 UNKNOWN_USERMODE,
507 BROWSEMODE,
508 EDITMODE
509 } USERMODE;
511 typedef struct _cp_static_data_t {
512 tid_t tid;
513 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
514 BOOL pass_event_arg;
515 DWORD id_cnt;
516 DISPID *ids;
517 } cp_static_data_t;
519 typedef struct {
520 const IID *riid;
521 cp_static_data_t *desc;
522 } cpc_entry_t;
524 typedef struct ConnectionPointContainer {
525 IConnectionPointContainer IConnectionPointContainer_iface;
527 ConnectionPoint *cps;
528 const cpc_entry_t *cp_entries;
529 IUnknown *outer;
530 struct ConnectionPointContainer *forward_container;
531 } ConnectionPointContainer;
533 struct ConnectionPoint {
534 IConnectionPoint IConnectionPoint_iface;
536 ConnectionPointContainer *container;
538 union {
539 IUnknown *unk;
540 IDispatch *disp;
541 IPropertyNotifySink *propnotif;
542 } *sinks;
543 DWORD sinks_size;
545 const IID *iid;
546 cp_static_data_t *data;
549 struct HTMLDocument {
550 IHTMLDocument2 IHTMLDocument2_iface;
551 IHTMLDocument3 IHTMLDocument3_iface;
552 IHTMLDocument4 IHTMLDocument4_iface;
553 IHTMLDocument5 IHTMLDocument5_iface;
554 IHTMLDocument6 IHTMLDocument6_iface;
555 IHTMLDocument7 IHTMLDocument7_iface;
556 IDocumentSelector IDocumentSelector_iface;
557 IPersistMoniker IPersistMoniker_iface;
558 IPersistFile IPersistFile_iface;
559 IPersistHistory IPersistHistory_iface;
560 IMonikerProp IMonikerProp_iface;
561 IOleObject IOleObject_iface;
562 IOleDocument IOleDocument_iface;
563 IOleDocumentView IOleDocumentView_iface;
564 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
565 IViewObjectEx IViewObjectEx_iface;
566 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
567 IServiceProvider IServiceProvider_iface;
568 IOleCommandTarget IOleCommandTarget_iface;
569 IOleControl IOleControl_iface;
570 IHlinkTarget IHlinkTarget_iface;
571 IPersistStreamInit IPersistStreamInit_iface;
572 IDispatchEx IDispatchEx_iface;
573 ISupportErrorInfo ISupportErrorInfo_iface;
574 IObjectWithSite IObjectWithSite_iface;
575 IOleContainer IOleContainer_iface;
576 IObjectSafety IObjectSafety_iface;
577 IProvideClassInfo IProvideClassInfo_iface;
579 IUnknown *unk_impl;
580 IDispatchEx *dispex;
582 HTMLDocumentObj *doc_obj;
583 HTMLDocumentNode *doc_node;
585 HTMLOuterWindow *window;
587 LONG task_magic;
589 ConnectionPointContainer cp_container;
590 IOleAdviseHolder *advise_holder;
593 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
595 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
598 static inline ULONG htmldoc_addref(HTMLDocument *This)
600 return IUnknown_AddRef(This->unk_impl);
603 static inline ULONG htmldoc_release(HTMLDocument *This)
605 return IUnknown_Release(This->unk_impl);
608 struct HTMLDocumentObj {
609 HTMLDocument basedoc;
610 DispatchEx dispex;
611 ICustomDoc ICustomDoc_iface;
612 ITargetContainer ITargetContainer_iface;
614 IWindowForBindingUI IWindowForBindingUI_iface;
616 LONG ref;
618 NSContainer *nscontainer;
620 IOleClientSite *client;
621 IDocHostUIHandler *hostui;
622 IOleCommandTarget *client_cmdtrg;
623 BOOL custom_hostui;
624 IOleInPlaceSite *ipsite;
625 IOleInPlaceFrame *frame;
626 IOleInPlaceUIWindow *ip_window;
627 IAdviseSink *view_sink;
628 IDocObjectService *doc_object_service;
629 IUnknown *webbrowser;
630 ITravelLog *travel_log;
631 IUnknown *browser_service;
633 DOCHOSTUIINFO hostinfo;
635 IOleUndoManager *undomgr;
636 IHTMLEditServices *editsvcs;
638 HWND hwnd;
639 HWND tooltips_hwnd;
641 BOOL request_uiactivate;
642 BOOL in_place_active;
643 BOOL ui_active;
644 BOOL window_active;
645 BOOL hostui_setup;
646 BOOL container_locked;
647 BOOL focus;
648 BOOL has_popup;
649 INT download_state;
651 USERMODE usermode;
652 LPWSTR mime;
654 DWORD update;
657 typedef struct nsWeakReference nsWeakReference;
659 struct NSContainer {
660 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
661 nsIContextMenuListener nsIContextMenuListener_iface;
662 nsIURIContentListener nsIURIContentListener_iface;
663 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
664 nsITooltipListener nsITooltipListener_iface;
665 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
666 nsISupportsWeakReference nsISupportsWeakReference_iface;
668 nsIWebBrowser *webbrowser;
669 nsIWebNavigation *navigation;
670 nsIBaseWindow *window;
671 nsIWebBrowserFocus *focus;
673 nsIEditor *editor;
674 nsIController *editor_controller;
676 LONG ref;
678 nsWeakReference *weak_reference;
680 NSContainer *parent;
681 HTMLDocumentObj *doc;
683 nsIURIContentListener *content_listener;
685 HWND hwnd;
688 typedef struct {
689 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
690 void (*destructor)(HTMLDOMNode*);
691 const cpc_entry_t *cpc_entries;
692 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
693 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
694 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
695 event_target_t **(*get_event_target_ptr)(HTMLDOMNode*);
696 HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*);
697 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
698 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
699 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
700 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
701 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
702 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
703 HRESULT (*bind_to_tree)(HTMLDOMNode*);
704 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
705 void (*unlink)(HTMLDOMNode*);
706 BOOL (*is_text_edit)(HTMLDOMNode*);
707 BOOL (*is_settable)(HTMLDOMNode*,DISPID);
708 } NodeImplVtbl;
710 struct HTMLDOMNode {
711 EventTarget event_target;
712 IHTMLDOMNode IHTMLDOMNode_iface;
713 IHTMLDOMNode2 IHTMLDOMNode2_iface;
714 const NodeImplVtbl *vtbl;
716 nsCycleCollectingAutoRefCnt ccref;
718 nsIDOMNode *nsnode;
719 HTMLDocumentNode *doc;
720 ConnectionPointContainer *cp_container;
723 static inline void node_addref(HTMLDOMNode *node)
725 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
728 static inline void node_release(HTMLDOMNode *node)
730 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
733 typedef struct {
734 HTMLDOMNode node;
735 ConnectionPointContainer cp_container;
737 IHTMLElement IHTMLElement_iface;
738 IHTMLElement2 IHTMLElement2_iface;
739 IHTMLElement3 IHTMLElement3_iface;
740 IHTMLElement4 IHTMLElement4_iface;
741 IHTMLElement6 IHTMLElement6_iface;
742 IHTMLUniqueName IHTMLUniqueName_iface;
743 IElementSelector IElementSelector_iface;
745 nsIDOMHTMLElement *nselem;
746 HTMLStyle *style;
747 HTMLStyle *runtime_style;
748 HTMLAttributeCollection *attrs;
749 WCHAR *filter;
750 unsigned unique_id;
751 } HTMLElement;
753 #define HTMLELEMENT_TIDS \
754 IHTMLDOMNode_tid, \
755 IHTMLDOMNode2_tid, \
756 IHTMLElement_tid, \
757 IHTMLElement2_tid, \
758 IHTMLElement3_tid, \
759 IHTMLElement4_tid, \
760 IHTMLUniqueName_tid
762 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN;
763 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
764 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN;
766 typedef struct {
767 HTMLElement element;
769 IHTMLTextContainer IHTMLTextContainer_iface;
770 } HTMLTextContainer;
772 struct HTMLFrameBase {
773 HTMLElement element;
775 IHTMLFrameBase IHTMLFrameBase_iface;
776 IHTMLFrameBase2 IHTMLFrameBase2_iface;
778 HTMLOuterWindow *content_window;
780 nsIDOMHTMLFrameElement *nsframe;
781 nsIDOMHTMLIFrameElement *nsiframe;
784 typedef struct nsDocumentEventListener nsDocumentEventListener;
786 struct HTMLDocumentNode {
787 HTMLDOMNode node;
788 HTMLDocument basedoc;
790 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
792 nsIDocumentObserver nsIDocumentObserver_iface;
794 LONG ref;
796 compat_mode_t document_mode;
797 HTMLInnerWindow *window;
799 nsIDOMHTMLDocument *nsdoc;
800 BOOL content_ready;
801 event_target_t *body_event_target;
803 IHTMLDOMImplementation *dom_implementation;
805 ICatInformation *catmgr;
806 nsDocumentEventListener *nsevent_listener;
807 BOOL *event_vector;
809 WCHAR **elem_vars;
810 unsigned elem_vars_size;
811 unsigned elem_vars_cnt;
813 BOOL skip_mutation_notif;
815 UINT charset;
817 unsigned unique_id;
819 struct list selection_list;
820 struct list range_list;
821 struct list plugin_hosts;
824 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
825 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
826 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
828 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
829 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
830 HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*) DECLSPEC_HIDDEN;
831 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
832 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
833 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
834 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN;
835 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
836 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
837 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
838 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
839 HRESULT create_dom_implementation(IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
841 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
843 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
844 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
845 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
846 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN;
847 void HTMLDocument_Window_Init(HTMLDocument*) DECLSPEC_HIDDEN;
848 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
849 void HTMLDocument_Hlink_Init(HTMLDocument*) DECLSPEC_HIDDEN;
851 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
852 void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN;
854 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
856 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
858 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
859 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
861 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
862 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
864 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
865 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
866 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
867 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
869 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
870 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
871 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
873 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
874 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
875 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
877 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN;
879 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
881 BOOL load_gecko(void) DECLSPEC_HIDDEN;
882 void close_gecko(void) DECLSPEC_HIDDEN;
883 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
884 void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
885 void release_nsio(void) DECLSPEC_HIDDEN;
886 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
887 void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
889 void init_node_cc(void) DECLSPEC_HIDDEN;
891 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
893 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
895 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
896 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
898 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
899 void nsfree(void*) DECLSPEC_HIDDEN;
901 BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN;
902 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
903 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
904 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
905 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
907 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
908 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
909 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
910 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
912 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
914 static inline HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p)
916 V_VT(p) = VT_BSTR;
917 return return_nsstr(nsres, nsstr, &V_BSTR(p));
920 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
921 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
922 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
923 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
924 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
925 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN;
926 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
927 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
929 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
930 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
931 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
932 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
933 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
934 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
936 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
937 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
939 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
940 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
941 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
942 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
944 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
945 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
946 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
947 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
949 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
950 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
952 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
954 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
955 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
958 struct HTMLAttributeCollection {
959 DispatchEx dispex;
960 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
961 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
962 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
964 LONG ref;
966 HTMLElement *elem;
967 struct list attrs;
970 typedef struct {
971 DispatchEx dispex;
972 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
973 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
975 LONG ref;
977 /* value is valid only for detached attributes (when elem == NULL). */
978 VARIANT value;
979 /* name must be valid for detached attributes */
980 WCHAR *name;
982 HTMLElement *elem;
983 DISPID dispid;
984 struct list entry;
985 } HTMLDOMAttribute;
987 HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*) DECLSPEC_HIDDEN;
989 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
991 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
992 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
993 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
994 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
995 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
996 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
997 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
998 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
999 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1000 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1001 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1002 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1003 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1004 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1005 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1006 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1007 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1008 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1009 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1010 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1011 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1012 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1013 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1014 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1015 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1016 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1017 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1018 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1020 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*) DECLSPEC_HIDDEN;
1021 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1022 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1023 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1025 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1026 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1028 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1029 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1030 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1031 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
1032 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1033 void HTMLElement_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1035 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
1036 void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN;
1038 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
1039 HRESULT get_elem(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1041 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
1043 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
1044 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
1045 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1046 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
1047 HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1049 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
1051 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
1052 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
1053 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
1054 IHTMLDOMChildrenCollection *create_child_collection(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
1056 HRESULT attr_value_to_string(VARIANT*) DECLSPEC_HIDDEN;
1057 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
1058 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN;
1060 nsresult get_elem_attr_value(nsIDOMHTMLElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
1061 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
1062 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
1064 HRESULT elem_unique_id(unsigned id, BSTR *p) DECLSPEC_HIDDEN;
1066 /* commands */
1067 typedef struct {
1068 DWORD id;
1069 HRESULT (*query)(HTMLDocument*,OLECMD*);
1070 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
1071 } cmdtable_t;
1073 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
1075 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
1077 /* timer */
1078 #define UPDATE_UI 0x0001
1079 #define UPDATE_TITLE 0x0002
1081 void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN;
1082 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1083 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
1085 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
1087 /* editor */
1088 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1089 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
1090 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
1091 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1092 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1093 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1094 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
1095 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
1096 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
1098 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
1100 typedef struct task_t task_t;
1101 typedef void (*task_proc_t)(task_t*);
1103 struct task_t {
1104 LONG target_magic;
1105 task_proc_t proc;
1106 task_proc_t destr;
1107 struct list entry;
1110 typedef struct {
1111 task_t header;
1112 HTMLDocumentObj *doc;
1113 } docobj_task_t;
1115 typedef struct {
1116 HWND thread_hwnd;
1117 struct list task_list;
1118 struct list timer_list;
1119 } thread_data_t;
1121 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1122 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1124 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1125 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1126 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1127 void flush_pending_tasks(LONG) DECLSPEC_HIDDEN;
1129 HRESULT set_task_timer(HTMLInnerWindow*,LONG,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1130 HRESULT clear_task_timer(HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
1132 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1134 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1135 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1136 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1137 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1138 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1140 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1142 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1144 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1145 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1147 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1148 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1150 /* memory allocation functions */
1152 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
1154 return HeapAlloc(GetProcessHeap(), 0, len);
1157 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
1159 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
1162 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
1164 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
1167 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1169 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1172 static inline BOOL heap_free(void *mem)
1174 return HeapFree(GetProcessHeap(), 0, mem);
1177 static inline LPWSTR heap_strdupW(LPCWSTR str)
1179 LPWSTR ret = NULL;
1181 if(str) {
1182 DWORD size;
1184 size = (strlenW(str)+1)*sizeof(WCHAR);
1185 ret = heap_alloc(size);
1186 if(ret)
1187 memcpy(ret, str, size);
1190 return ret;
1193 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1195 LPWSTR ret = NULL;
1197 if(str) {
1198 ret = heap_alloc((len+1)*sizeof(WCHAR));
1199 if(ret)
1201 memcpy(ret, str, len*sizeof(WCHAR));
1202 ret[len] = 0;
1206 return ret;
1209 static inline char *heap_strdupA(const char *str)
1211 char *ret = NULL;
1213 if(str) {
1214 DWORD size;
1216 size = strlen(str)+1;
1217 ret = heap_alloc(size);
1218 if(ret)
1219 memcpy(ret, str, size);
1222 return ret;
1225 static inline WCHAR *heap_strdupAtoW(const char *str)
1227 LPWSTR ret = NULL;
1229 if(str) {
1230 DWORD len;
1232 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1233 ret = heap_alloc(len*sizeof(WCHAR));
1234 if(ret)
1235 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1238 return ret;
1241 static inline char *heap_strdupWtoA(LPCWSTR str)
1243 char *ret = NULL;
1245 if(str) {
1246 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1247 ret = heap_alloc(size);
1248 if(ret)
1249 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1252 return ret;
1255 static inline WCHAR *heap_strdupUtoW(const char *str)
1257 WCHAR *ret = NULL;
1259 if(str) {
1260 size_t len;
1262 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1263 ret = heap_alloc(len*sizeof(WCHAR));
1264 if(ret)
1265 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1268 return ret;
1271 static inline char *heap_strdupWtoU(const WCHAR *str)
1273 char *ret = NULL;
1275 if(str) {
1276 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1277 ret = heap_alloc(size);
1278 if(ret)
1279 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1282 return ret;
1285 static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len)
1287 char *ret = NULL;
1288 DWORD size;
1290 if(str && len) {
1291 size = WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL);
1292 ret = heap_alloc(size + 1);
1293 if(ret) {
1294 WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL);
1295 ret[size] = '\0';
1299 return ret;
1302 static inline void windowref_addref(windowref_t *ref)
1304 InterlockedIncrement(&ref->ref);
1307 static inline void windowref_release(windowref_t *ref)
1309 if(!InterlockedDecrement(&ref->ref))
1310 heap_free(ref);
1313 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
1314 BSTR charset_string_from_cp(UINT) DECLSPEC_HIDDEN;
1315 HDC get_display_dc(void) DECLSPEC_HIDDEN;
1316 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1317 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1319 extern HINSTANCE hInst DECLSPEC_HIDDEN;