mshtml: Make HTMLInnerWindow inherit from EventTarget.
[wine/multimedia.git] / dlls / mshtml / mshtml_private.h
blob7d743b6c0b5340e49bff89c0294a60ed83e6339b
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)(1<<31)) | ((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
45 #define NS_OK ((nsresult)0x00000000L)
46 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
47 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
48 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
49 #define NS_NOINTERFACE ((nsresult)0x80004002L)
50 #define NS_ERROR_INVALID_POINTER ((nsresult)0x80004003L)
51 #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
52 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
53 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
54 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
56 #define NS_ERROR_MODULE_NETWORK 6
58 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
59 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
61 #define NS_FAILED(res) ((res) & 0x80000000)
62 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
64 #define NSAPI WINAPI
66 #define MSHTML_E_NODOC 0x800a025c
68 typedef struct HTMLDOMNode HTMLDOMNode;
69 typedef struct ConnectionPoint ConnectionPoint;
70 typedef struct BSCallback BSCallback;
71 typedef struct event_target_t event_target_t;
73 #define TID_LIST \
74 XIID(NULL) \
75 XDIID(DispCEventObj) \
76 XDIID(DispCPlugins) \
77 XDIID(DispDOMChildrenCollection) \
78 XDIID(DispHTMLAnchorElement) \
79 XDIID(DispHTMLAttributeCollection) \
80 XDIID(DispHTMLBody) \
81 XDIID(DispHTMLButtonElement) \
82 XDIID(DispHTMLCommentElement) \
83 XDIID(DispHTMLCurrentStyle) \
84 XDIID(DispHTMLDocument) \
85 XDIID(DispHTMLDOMAttribute) \
86 XDIID(DispHTMLDOMTextNode) \
87 XDIID(DispHTMLElementCollection) \
88 XDIID(DispHTMLEmbed) \
89 XDIID(DispHTMLFormElement) \
90 XDIID(DispHTMLGenericElement) \
91 XDIID(DispHTMLFrameElement) \
92 XDIID(DispHTMLHeadElement) \
93 XDIID(DispHTMLHistory) \
94 XDIID(DispHTMLIFrame) \
95 XDIID(DispHTMLImg) \
96 XDIID(DispHTMLInputElement) \
97 XDIID(DispHTMLLabelElement) \
98 XDIID(DispHTMLLinkElement) \
99 XDIID(DispHTMLLocation) \
100 XDIID(DispHTMLMetaElement) \
101 XDIID(DispHTMLNavigator) \
102 XDIID(DispHTMLObjectElement) \
103 XDIID(DispHTMLOptionElement) \
104 XDIID(DispHTMLScreen) \
105 XDIID(DispHTMLScriptElement) \
106 XDIID(DispHTMLSelectElement) \
107 XDIID(DispHTMLStyle) \
108 XDIID(DispHTMLStyleElement) \
109 XDIID(DispHTMLStyleSheet) \
110 XDIID(DispHTMLStyleSheetRulesCollection) \
111 XDIID(DispHTMLStyleSheetsCollection) \
112 XDIID(DispHTMLTable) \
113 XDIID(DispHTMLTableCell) \
114 XDIID(DispHTMLTableRow) \
115 XDIID(DispHTMLTextAreaElement) \
116 XDIID(DispHTMLTitleElement) \
117 XDIID(DispHTMLUnknownElement) \
118 XDIID(DispHTMLWindow2) \
119 XDIID(HTMLDocumentEvents) \
120 XDIID(HTMLElementEvents2) \
121 XIID(IHTMLAnchorElement) \
122 XIID(IHTMLAttributeCollection) \
123 XIID(IHTMLAttributeCollection2) \
124 XIID(IHTMLAttributeCollection3) \
125 XIID(IHTMLBodyElement) \
126 XIID(IHTMLBodyElement2) \
127 XIID(IHTMLButtonElement) \
128 XIID(IHTMLCommentElement) \
129 XIID(IHTMLCurrentStyle) \
130 XIID(IHTMLCurrentStyle2) \
131 XIID(IHTMLCurrentStyle3) \
132 XIID(IHTMLCurrentStyle4) \
133 XIID(IHTMLDocument2) \
134 XIID(IHTMLDocument3) \
135 XIID(IHTMLDocument4) \
136 XIID(IHTMLDocument5) \
137 XIID(IHTMLDOMAttribute) \
138 XIID(IHTMLDOMAttribute2) \
139 XIID(IHTMLDOMChildrenCollection) \
140 XIID(IHTMLDOMImplementation) \
141 XIID(IHTMLDOMNode) \
142 XIID(IHTMLDOMNode2) \
143 XIID(IHTMLDOMTextNode) \
144 XIID(IHTMLDOMTextNode2) \
145 XIID(IHTMLElement) \
146 XIID(IHTMLElement2) \
147 XIID(IHTMLElement3) \
148 XIID(IHTMLElement4) \
149 XIID(IHTMLElementCollection) \
150 XIID(IHTMLEmbedElement) \
151 XIID(IHTMLEventObj) \
152 XIID(IHTMLFiltersCollection) \
153 XIID(IHTMLFormElement) \
154 XIID(IHTMLFrameBase) \
155 XIID(IHTMLFrameBase2) \
156 XIID(IHTMLFrameElement3) \
157 XIID(IHTMLGenericElement) \
158 XIID(IHTMLHeadElement) \
159 XIID(IHTMLIFrameElement) \
160 XIID(IHTMLIFrameElement2) \
161 XIID(IHTMLIFrameElement3) \
162 XIID(IHTMLImageElementFactory) \
163 XIID(IHTMLImgElement) \
164 XIID(IHTMLInputElement) \
165 XIID(IHTMLLabelElement) \
166 XIID(IHTMLLinkElement) \
167 XIID(IHTMLLocation) \
168 XIID(IHTMLMetaElement) \
169 XIID(IHTMLMimeTypesCollection) \
170 XIID(IHTMLObjectElement) \
171 XIID(IHTMLObjectElement2) \
172 XIID(IHTMLOptionElement) \
173 XIID(IHTMLOptionElementFactory) \
174 XIID(IHTMLPluginsCollection) \
175 XIID(IHTMLRect) \
176 XIID(IHTMLScreen) \
177 XIID(IHTMLScriptElement) \
178 XIID(IHTMLSelectElement) \
179 XIID(IHTMLSelectionObject) \
180 XIID(IHTMLSelectionObject2) \
181 XIID(IHTMLStorage) \
182 XIID(IHTMLStyle) \
183 XIID(IHTMLStyle2) \
184 XIID(IHTMLStyle3) \
185 XIID(IHTMLStyle4) \
186 XIID(IHTMLStyle5) \
187 XIID(IHTMLStyle6) \
188 XIID(IHTMLStyleElement) \
189 XIID(IHTMLStyleSheet) \
190 XIID(IHTMLStyleSheetRulesCollection) \
191 XIID(IHTMLStyleSheetsCollection) \
192 XIID(IHTMLTable) \
193 XIID(IHTMLTable2) \
194 XIID(IHTMLTable3) \
195 XIID(IHTMLTableCell) \
196 XIID(IHTMLTableRow) \
197 XIID(IHTMLTextAreaElement) \
198 XIID(IHTMLTextContainer) \
199 XIID(IHTMLTitleElement) \
200 XIID(IHTMLTxtRange) \
201 XIID(IHTMLUniqueName) \
202 XIID(IHTMLWindow2) \
203 XIID(IHTMLWindow3) \
204 XIID(IHTMLWindow4) \
205 XIID(IHTMLWindow5) \
206 XIID(IHTMLWindow6) \
207 XIID(IOmHistory) \
208 XIID(IOmNavigator)
210 typedef enum {
211 #define XIID(iface) iface ## _tid,
212 #define XDIID(iface) iface ## _tid,
213 TID_LIST
214 #undef XIID
215 #undef XDIID
216 LAST_tid
217 } tid_t;
219 typedef struct dispex_data_t dispex_data_t;
220 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
222 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
223 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
224 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
226 typedef struct DispatchEx DispatchEx;
228 typedef struct {
229 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
230 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
231 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
232 HRESULT (*populate_props)(DispatchEx*);
233 /* We abuse this vtbl for EventTarget functions to avoid separated vtbl. */
234 event_target_t **(*get_event_target_ptr)(DispatchEx*);
235 } dispex_static_data_vtbl_t;
237 typedef struct {
238 const dispex_static_data_vtbl_t *vtbl;
239 const tid_t disp_tid;
240 dispex_data_t *data;
241 const tid_t* const iface_tids;
242 } dispex_static_data_t;
244 struct DispatchEx {
245 IDispatchEx IDispatchEx_iface;
247 IUnknown *outer;
249 dispex_static_data_t *data;
250 dispex_dynamic_data_t *dynamic_data;
253 typedef struct {
254 UINT_PTR x;
255 } nsCycleCollectingAutoRefCnt;
257 typedef struct {
258 void *vtbl;
259 int ref_flags;
260 void *callbacks;
261 } ExternalCycleCollectionParticipant;
263 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
265 typedef struct {
266 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
267 nsresult (NSAPI *unlink)(void*);
268 void (NSAPI *delete_cycle_collectable)(void*);
269 } CCObjCallback;
271 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
273 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN;
274 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN;
275 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN;
276 void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN;
277 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
278 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
280 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN;
281 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
282 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
283 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
284 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
285 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
286 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
287 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
288 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
289 void release_typelib(void) DECLSPEC_HIDDEN;
290 HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
292 typedef enum {
293 DISPEXPROP_CUSTOM,
294 DISPEXPROP_DYNAMIC,
295 DISPEXPROP_BUILTIN
296 } dispex_prop_type_t;
298 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
300 typedef struct HTMLWindow HTMLWindow;
301 typedef struct HTMLInnerWindow HTMLInnerWindow;
302 typedef struct HTMLOuterWindow HTMLOuterWindow;
303 typedef struct HTMLDocumentNode HTMLDocumentNode;
304 typedef struct HTMLDocumentObj HTMLDocumentObj;
305 typedef struct HTMLFrameBase HTMLFrameBase;
306 typedef struct NSContainer NSContainer;
307 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
309 typedef enum {
310 SCRIPTMODE_GECKO,
311 SCRIPTMODE_ACTIVESCRIPT
312 } SCRIPTMODE;
314 typedef struct ScriptHost ScriptHost;
316 typedef enum {
317 GLOBAL_SCRIPTVAR,
318 GLOBAL_ELEMENTVAR,
319 GLOBAL_DISPEXVAR,
320 GLOBAL_FRAMEVAR
321 } global_prop_type_t;
323 typedef struct {
324 global_prop_type_t type;
325 WCHAR *name;
326 ScriptHost *script_host;
327 DISPID id;
328 } global_prop_t;
330 typedef struct {
331 DispatchEx dispex;
332 event_target_t *ptr;
333 } EventTarget;
335 typedef struct {
336 DispatchEx dispex;
337 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
339 LONG ref;
341 HTMLInnerWindow *window;
342 } HTMLOptionElementFactory;
344 typedef struct {
345 DispatchEx dispex;
346 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
348 LONG ref;
350 HTMLInnerWindow *window;
351 } HTMLImageElementFactory;
353 struct HTMLLocation {
354 DispatchEx dispex;
355 IHTMLLocation IHTMLLocation_iface;
357 LONG ref;
359 HTMLInnerWindow *window;
362 typedef struct {
363 DispatchEx dispex;
364 IOmHistory IOmHistory_iface;
366 LONG ref;
368 HTMLInnerWindow *window;
369 } OmHistory;
371 typedef struct {
372 HTMLOuterWindow *window;
373 LONG ref;
374 } windowref_t;
376 typedef struct nsChannelBSC nsChannelBSC;
378 struct HTMLWindow {
379 IHTMLWindow2 IHTMLWindow2_iface;
380 IHTMLWindow3 IHTMLWindow3_iface;
381 IHTMLWindow4 IHTMLWindow4_iface;
382 IHTMLWindow5 IHTMLWindow5_iface;
383 IHTMLWindow6 IHTMLWindow6_iface;
384 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
385 IDispatchEx IDispatchEx_iface;
386 IServiceProvider IServiceProvider_iface;
387 ITravelLogClient ITravelLogClient_iface;
388 IObjectIdentity IObjectIdentity_iface;
390 LONG ref;
392 HTMLInnerWindow *inner_window;
393 HTMLOuterWindow *outer_window;
396 struct HTMLOuterWindow {
397 HTMLWindow base;
399 windowref_t *window_ref;
400 LONG task_magic;
402 HTMLDocumentObj *doc_obj;
403 nsIDOMWindow *nswindow;
404 HTMLOuterWindow *parent;
405 HTMLFrameBase *frame_element;
407 READYSTATE readystate;
408 BOOL readystate_locked;
409 unsigned readystate_pending;
411 HTMLInnerWindow *pending_window;
412 IMoniker *mon;
413 IUri *uri;
414 IUri *uri_nofrag;
415 BSTR url;
416 DWORD load_flags;
418 SCRIPTMODE scriptmode;
420 IInternetSecurityManager *secmgr;
422 struct list children;
423 struct list sibling_entry;
424 struct list entry;
427 struct HTMLInnerWindow {
428 HTMLWindow base;
429 EventTarget event_target;
431 HTMLDocumentNode *doc;
433 struct list script_hosts;
435 IHTMLEventObj *event;
437 HTMLImageElementFactory *image_factory;
438 HTMLOptionElementFactory *option_factory;
439 IHTMLScreen *screen;
440 OmHistory *history;
441 IHTMLStorage *session_storage;
443 unsigned parser_callback_cnt;
444 struct list script_queue;
446 global_prop_t *global_props;
447 DWORD global_prop_cnt;
448 DWORD global_prop_size;
450 LONG task_magic;
452 HTMLLocation *location;
454 IMoniker *mon;
455 nsChannelBSC *bscallback;
456 struct list bindings;
459 typedef enum {
460 UNKNOWN_USERMODE,
461 BROWSEMODE,
462 EDITMODE
463 } USERMODE;
465 typedef struct _cp_static_data_t {
466 tid_t tid;
467 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
468 BOOL pass_event_arg;
469 DWORD id_cnt;
470 DISPID *ids;
471 } cp_static_data_t;
473 typedef struct {
474 const IID *riid;
475 cp_static_data_t *desc;
476 } cpc_entry_t;
478 typedef struct ConnectionPointContainer {
479 IConnectionPointContainer IConnectionPointContainer_iface;
481 ConnectionPoint *cps;
482 const cpc_entry_t *cp_entries;
483 IUnknown *outer;
484 struct ConnectionPointContainer *forward_container;
485 } ConnectionPointContainer;
487 struct ConnectionPoint {
488 IConnectionPoint IConnectionPoint_iface;
490 ConnectionPointContainer *container;
492 union {
493 IUnknown *unk;
494 IDispatch *disp;
495 IPropertyNotifySink *propnotif;
496 } *sinks;
497 DWORD sinks_size;
499 const IID *iid;
500 cp_static_data_t *data;
503 struct HTMLDocument {
504 IHTMLDocument2 IHTMLDocument2_iface;
505 IHTMLDocument3 IHTMLDocument3_iface;
506 IHTMLDocument4 IHTMLDocument4_iface;
507 IHTMLDocument5 IHTMLDocument5_iface;
508 IHTMLDocument6 IHTMLDocument6_iface;
509 IHTMLDocument7 IHTMLDocument7_iface;
510 IPersistMoniker IPersistMoniker_iface;
511 IPersistFile IPersistFile_iface;
512 IPersistHistory IPersistHistory_iface;
513 IMonikerProp IMonikerProp_iface;
514 IOleObject IOleObject_iface;
515 IOleDocument IOleDocument_iface;
516 IOleDocumentView IOleDocumentView_iface;
517 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
518 IViewObjectEx IViewObjectEx_iface;
519 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
520 IServiceProvider IServiceProvider_iface;
521 IOleCommandTarget IOleCommandTarget_iface;
522 IOleControl IOleControl_iface;
523 IHlinkTarget IHlinkTarget_iface;
524 IPersistStreamInit IPersistStreamInit_iface;
525 IDispatchEx IDispatchEx_iface;
526 ISupportErrorInfo ISupportErrorInfo_iface;
527 IObjectWithSite IObjectWithSite_iface;
528 IOleContainer IOleContainer_iface;
529 IObjectSafety IObjectSafety_iface;
530 IProvideClassInfo IProvideClassInfo_iface;
532 IUnknown *unk_impl;
533 IDispatchEx *dispex;
535 HTMLDocumentObj *doc_obj;
536 HTMLDocumentNode *doc_node;
538 HTMLOuterWindow *window;
540 LONG task_magic;
542 ConnectionPointContainer cp_container;
543 IOleAdviseHolder *advise_holder;
546 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
548 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
551 static inline ULONG htmldoc_addref(HTMLDocument *This)
553 return IUnknown_AddRef(This->unk_impl);
556 static inline ULONG htmldoc_release(HTMLDocument *This)
558 return IUnknown_Release(This->unk_impl);
561 struct HTMLDocumentObj {
562 HTMLDocument basedoc;
563 DispatchEx dispex;
564 ICustomDoc ICustomDoc_iface;
565 ITargetContainer ITargetContainer_iface;
567 IWindowForBindingUI IWindowForBindingUI_iface;
569 LONG ref;
571 NSContainer *nscontainer;
573 IOleClientSite *client;
574 IDocHostUIHandler *hostui;
575 IOleCommandTarget *client_cmdtrg;
576 BOOL custom_hostui;
577 IOleInPlaceSite *ipsite;
578 IOleInPlaceFrame *frame;
579 IOleInPlaceUIWindow *ip_window;
580 IAdviseSink *view_sink;
581 IDocObjectService *doc_object_service;
582 IUnknown *webbrowser;
583 ITravelLog *travel_log;
584 IUnknown *browser_service;
586 DOCHOSTUIINFO hostinfo;
588 IOleUndoManager *undomgr;
590 HWND hwnd;
591 HWND tooltips_hwnd;
593 BOOL request_uiactivate;
594 BOOL in_place_active;
595 BOOL ui_active;
596 BOOL window_active;
597 BOOL hostui_setup;
598 BOOL container_locked;
599 BOOL focus;
600 BOOL has_popup;
601 INT download_state;
603 USERMODE usermode;
604 LPWSTR mime;
606 DWORD update;
609 typedef struct nsWeakReference nsWeakReference;
611 struct NSContainer {
612 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
613 nsIContextMenuListener nsIContextMenuListener_iface;
614 nsIURIContentListener nsIURIContentListener_iface;
615 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
616 nsITooltipListener nsITooltipListener_iface;
617 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
618 nsISupportsWeakReference nsISupportsWeakReference_iface;
620 nsIWebBrowser *webbrowser;
621 nsIWebNavigation *navigation;
622 nsIBaseWindow *window;
623 nsIWebBrowserFocus *focus;
625 nsIEditor *editor;
626 nsIController *editor_controller;
628 LONG ref;
630 nsWeakReference *weak_reference;
632 NSContainer *parent;
633 HTMLDocumentObj *doc;
635 nsIURIContentListener *content_listener;
637 HWND hwnd;
640 typedef struct {
641 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
642 void (*destructor)(HTMLDOMNode*);
643 const cpc_entry_t *cpc_entries;
644 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
645 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
646 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
647 event_target_t **(*get_event_target_ptr)(HTMLDOMNode*);
648 HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*);
649 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
650 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
651 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
652 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
653 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
654 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
655 HRESULT (*bind_to_tree)(HTMLDOMNode*);
656 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
657 void (*unlink)(HTMLDOMNode*);
658 BOOL (*is_text_edit)(HTMLDOMNode*);
659 } NodeImplVtbl;
661 struct HTMLDOMNode {
662 EventTarget event_target;
663 IHTMLDOMNode IHTMLDOMNode_iface;
664 IHTMLDOMNode2 IHTMLDOMNode2_iface;
665 const NodeImplVtbl *vtbl;
667 nsCycleCollectingAutoRefCnt ccref;
669 nsIDOMNode *nsnode;
670 HTMLDocumentNode *doc;
671 ConnectionPointContainer *cp_container;
674 static inline void node_addref(HTMLDOMNode *node)
676 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
679 static inline void node_release(HTMLDOMNode *node)
681 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
684 typedef struct {
685 HTMLDOMNode node;
686 ConnectionPointContainer cp_container;
688 IHTMLElement IHTMLElement_iface;
689 IHTMLElement2 IHTMLElement2_iface;
690 IHTMLElement3 IHTMLElement3_iface;
691 IHTMLElement4 IHTMLElement4_iface;
693 nsIDOMHTMLElement *nselem;
694 HTMLStyle *style;
695 HTMLStyle *runtime_style;
696 HTMLAttributeCollection *attrs;
697 WCHAR *filter;
698 } HTMLElement;
700 #define HTMLELEMENT_TIDS \
701 IHTMLDOMNode_tid, \
702 IHTMLDOMNode2_tid, \
703 IHTMLElement_tid, \
704 IHTMLElement2_tid, \
705 IHTMLElement3_tid, \
706 IHTMLElement4_tid
708 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN;
709 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
710 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN;
712 typedef struct {
713 HTMLElement element;
715 IHTMLTextContainer IHTMLTextContainer_iface;
716 } HTMLTextContainer;
718 struct HTMLFrameBase {
719 HTMLElement element;
721 IHTMLFrameBase IHTMLFrameBase_iface;
722 IHTMLFrameBase2 IHTMLFrameBase2_iface;
724 HTMLOuterWindow *content_window;
726 nsIDOMHTMLFrameElement *nsframe;
727 nsIDOMHTMLIFrameElement *nsiframe;
730 typedef struct nsDocumentEventListener nsDocumentEventListener;
732 struct HTMLDocumentNode {
733 HTMLDOMNode node;
734 HTMLDocument basedoc;
736 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
738 nsIDocumentObserver nsIDocumentObserver_iface;
740 LONG ref;
742 HTMLInnerWindow *window;
744 nsIDOMHTMLDocument *nsdoc;
745 BOOL content_ready;
746 event_target_t *body_event_target;
748 IHTMLDOMImplementation *dom_implementation;
750 ICatInformation *catmgr;
751 nsDocumentEventListener *nsevent_listener;
752 BOOL *event_vector;
754 WCHAR **elem_vars;
755 unsigned elem_vars_size;
756 unsigned elem_vars_cnt;
758 BOOL skip_mutation_notif;
760 UINT charset;
762 struct list selection_list;
763 struct list range_list;
764 struct list plugin_hosts;
767 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
768 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
769 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
771 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
772 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
773 HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
774 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
775 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
776 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
777 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
778 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
779 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
780 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
781 HRESULT create_dom_implementation(IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
783 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
785 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
786 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
787 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
788 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN;
789 void HTMLDocument_Window_Init(HTMLDocument*) DECLSPEC_HIDDEN;
790 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
791 void HTMLDocument_Hlink_Init(HTMLDocument*) DECLSPEC_HIDDEN;
793 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
794 void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN;
796 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
798 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
800 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
801 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
803 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
804 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
806 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
807 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
808 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
809 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
811 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
812 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
813 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
815 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
816 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
817 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
819 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN;
821 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
823 BOOL load_gecko(void) DECLSPEC_HIDDEN;
824 void close_gecko(void) DECLSPEC_HIDDEN;
825 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
826 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*) DECLSPEC_HIDDEN;
827 void release_nsio(void) DECLSPEC_HIDDEN;
828 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
829 void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
831 void init_node_cc(void) DECLSPEC_HIDDEN;
833 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
835 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
837 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
838 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
840 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
841 void nsfree(void*) DECLSPEC_HIDDEN;
843 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
844 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
845 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
846 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
848 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
849 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
850 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
851 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
853 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
855 static inline HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p)
857 V_VT(p) = VT_BSTR;
858 return return_nsstr(nsres, nsstr, &V_BSTR(p));
861 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
862 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
863 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
864 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
865 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
866 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
867 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
869 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
870 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
871 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
872 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
873 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
874 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
876 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
877 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
879 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
880 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
881 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
882 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
884 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
885 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
886 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
887 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
889 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
890 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
892 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
894 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
895 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
898 struct HTMLAttributeCollection {
899 DispatchEx dispex;
900 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
901 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
902 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
904 LONG ref;
906 HTMLElement *elem;
907 struct list attrs;
910 typedef struct {
911 DispatchEx dispex;
912 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
913 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
915 LONG ref;
917 WCHAR *name;
919 HTMLElement *elem;
920 DISPID dispid;
921 struct list entry;
922 } HTMLDOMAttribute;
924 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
926 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
927 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
928 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
929 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
930 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
931 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
932 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
933 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
934 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
935 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
936 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
937 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
938 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
939 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
940 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
941 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
942 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
943 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
944 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
945 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
946 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
947 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
948 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
949 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
950 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
951 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
953 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*) DECLSPEC_HIDDEN;
954 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
955 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
956 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
958 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
959 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
961 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
962 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
963 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
964 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
965 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
967 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
968 void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN;
970 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
971 HRESULT get_elem(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
973 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
975 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
976 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
977 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
978 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
980 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
982 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
983 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
984 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
986 #define ATTRFLAG_CASESENSITIVE 0x0001
987 #define ATTRFLAG_ASSTRING 0x0002
988 #define ATTRFLAG_EXPANDURL 0x0004
990 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,DWORD,VARIANT*) DECLSPEC_HIDDEN;
991 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN;
993 nsresult get_elem_attr_value(nsIDOMHTMLElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
994 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
995 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
997 /* commands */
998 typedef struct {
999 DWORD id;
1000 HRESULT (*query)(HTMLDocument*,OLECMD*);
1001 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
1002 } cmdtable_t;
1004 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
1006 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
1008 /* timer */
1009 #define UPDATE_UI 0x0001
1010 #define UPDATE_TITLE 0x0002
1012 void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN;
1013 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1014 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
1016 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
1018 /* editor */
1019 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1020 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
1021 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
1022 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1023 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1024 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1025 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
1026 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
1027 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
1029 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
1031 typedef struct task_t task_t;
1032 typedef void (*task_proc_t)(task_t*);
1034 struct task_t {
1035 LONG target_magic;
1036 task_proc_t proc;
1037 task_proc_t destr;
1038 struct list entry;
1041 typedef struct {
1042 task_t header;
1043 HTMLDocumentObj *doc;
1044 } docobj_task_t;
1046 typedef struct {
1047 HWND thread_hwnd;
1048 struct list task_list;
1049 struct list timer_list;
1050 } thread_data_t;
1052 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1053 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1055 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1056 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1057 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1058 void flush_pending_tasks(LONG) DECLSPEC_HIDDEN;
1060 HRESULT set_task_timer(HTMLInnerWindow*,DWORD,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1061 HRESULT clear_task_timer(HTMLInnerWindow*,BOOL,DWORD) DECLSPEC_HIDDEN;
1063 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1065 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1066 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1067 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1068 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1069 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1071 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1073 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1075 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1076 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1078 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1079 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1081 /* memory allocation functions */
1083 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
1085 return HeapAlloc(GetProcessHeap(), 0, len);
1088 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
1090 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
1093 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
1095 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
1098 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1100 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1103 static inline BOOL heap_free(void *mem)
1105 return HeapFree(GetProcessHeap(), 0, mem);
1108 static inline LPWSTR heap_strdupW(LPCWSTR str)
1110 LPWSTR ret = NULL;
1112 if(str) {
1113 DWORD size;
1115 size = (strlenW(str)+1)*sizeof(WCHAR);
1116 ret = heap_alloc(size);
1117 if(ret)
1118 memcpy(ret, str, size);
1121 return ret;
1124 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1126 LPWSTR ret = NULL;
1128 if(str) {
1129 ret = heap_alloc((len+1)*sizeof(WCHAR));
1130 if(ret)
1132 memcpy(ret, str, len*sizeof(WCHAR));
1133 ret[len] = 0;
1137 return ret;
1140 static inline char *heap_strdupA(const char *str)
1142 char *ret = NULL;
1144 if(str) {
1145 DWORD size;
1147 size = strlen(str)+1;
1148 ret = heap_alloc(size);
1149 if(ret)
1150 memcpy(ret, str, size);
1153 return ret;
1156 static inline WCHAR *heap_strdupAtoW(const char *str)
1158 LPWSTR ret = NULL;
1160 if(str) {
1161 DWORD len;
1163 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1164 ret = heap_alloc(len*sizeof(WCHAR));
1165 if(ret)
1166 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1169 return ret;
1172 static inline char *heap_strdupWtoA(LPCWSTR str)
1174 char *ret = NULL;
1176 if(str) {
1177 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1178 ret = heap_alloc(size);
1179 if(ret)
1180 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1183 return ret;
1186 static inline WCHAR *heap_strdupUtoW(const char *str)
1188 WCHAR *ret = NULL;
1190 if(str) {
1191 size_t len;
1193 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1194 ret = heap_alloc(len*sizeof(WCHAR));
1195 if(ret)
1196 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1199 return ret;
1202 static inline char *heap_strdupWtoU(const WCHAR *str)
1204 char *ret = NULL;
1206 if(str) {
1207 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1208 ret = heap_alloc(size);
1209 if(ret)
1210 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1213 return ret;
1216 static inline void windowref_addref(windowref_t *ref)
1218 InterlockedIncrement(&ref->ref);
1221 static inline void windowref_release(windowref_t *ref)
1223 if(!InterlockedDecrement(&ref->ref))
1224 heap_free(ref);
1227 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
1228 HDC get_display_dc(void) DECLSPEC_HIDDEN;
1229 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1230 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1232 extern HINSTANCE hInst DECLSPEC_HIDDEN;