mshtml: Wine Gecko 2.44 release.
[wine.git] / dlls / mshtml / mshtml_private.h
blob1f0255f8832f8a9a651b20d4eda9a0ce631d55c1
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(DispHTMLHistory) \
98 XDIID(DispHTMLIFrame) \
99 XDIID(DispHTMLImg) \
100 XDIID(DispHTMLInputElement) \
101 XDIID(DispHTMLLabelElement) \
102 XDIID(DispHTMLLinkElement) \
103 XDIID(DispHTMLLocation) \
104 XDIID(DispHTMLMetaElement) \
105 XDIID(DispHTMLNavigator) \
106 XDIID(DispHTMLObjectElement) \
107 XDIID(DispHTMLOptionElement) \
108 XDIID(DispHTMLScreen) \
109 XDIID(DispHTMLScriptElement) \
110 XDIID(DispHTMLSelectElement) \
111 XDIID(DispHTMLStyle) \
112 XDIID(DispHTMLStyleElement) \
113 XDIID(DispHTMLStyleSheet) \
114 XDIID(DispHTMLStyleSheetRulesCollection) \
115 XDIID(DispHTMLStyleSheetsCollection) \
116 XDIID(DispHTMLTable) \
117 XDIID(DispHTMLTableCell) \
118 XDIID(DispHTMLTableRow) \
119 XDIID(DispHTMLTextAreaElement) \
120 XDIID(DispHTMLTitleElement) \
121 XDIID(DispHTMLUnknownElement) \
122 XDIID(DispHTMLWindow2) \
123 XDIID(DispHTMLXMLHttpRequest) \
124 XDIID(HTMLDocumentEvents) \
125 XDIID(HTMLElementEvents2) \
126 XIID(IHTMLAnchorElement) \
127 XIID(IHTMLAreaElement) \
128 XIID(IHTMLAttributeCollection) \
129 XIID(IHTMLAttributeCollection2) \
130 XIID(IHTMLAttributeCollection3) \
131 XIID(IHTMLBodyElement) \
132 XIID(IHTMLBodyElement2) \
133 XIID(IHTMLButtonElement) \
134 XIID(IHTMLCommentElement) \
135 XIID(IHTMLCurrentStyle) \
136 XIID(IHTMLCurrentStyle2) \
137 XIID(IHTMLCurrentStyle3) \
138 XIID(IHTMLCurrentStyle4) \
139 XIID(IHTMLDocument2) \
140 XIID(IHTMLDocument3) \
141 XIID(IHTMLDocument4) \
142 XIID(IHTMLDocument5) \
143 XIID(IHTMLDOMAttribute) \
144 XIID(IHTMLDOMAttribute2) \
145 XIID(IHTMLDOMChildrenCollection) \
146 XIID(IHTMLDOMImplementation) \
147 XIID(IHTMLDOMNode) \
148 XIID(IHTMLDOMNode2) \
149 XIID(IHTMLDOMTextNode) \
150 XIID(IHTMLDOMTextNode2) \
151 XIID(IHTMLElement) \
152 XIID(IHTMLElement2) \
153 XIID(IHTMLElement3) \
154 XIID(IHTMLElement4) \
155 XIID(IHTMLElementCollection) \
156 XIID(IHTMLEmbedElement) \
157 XIID(IHTMLEventObj) \
158 XIID(IHTMLFiltersCollection) \
159 XIID(IHTMLFormElement) \
160 XIID(IHTMLFrameBase) \
161 XIID(IHTMLFrameBase2) \
162 XIID(IHTMLFrameElement3) \
163 XIID(IHTMLGenericElement) \
164 XIID(IHTMLHeadElement) \
165 XIID(IHTMLIFrameElement) \
166 XIID(IHTMLIFrameElement2) \
167 XIID(IHTMLIFrameElement3) \
168 XIID(IHTMLImageElementFactory) \
169 XIID(IHTMLImgElement) \
170 XIID(IHTMLInputElement) \
171 XIID(IHTMLLabelElement) \
172 XIID(IHTMLLinkElement) \
173 XIID(IHTMLLocation) \
174 XIID(IHTMLMetaElement) \
175 XIID(IHTMLMimeTypesCollection) \
176 XIID(IHTMLObjectElement) \
177 XIID(IHTMLObjectElement2) \
178 XIID(IHTMLOptionElement) \
179 XIID(IHTMLOptionElementFactory) \
180 XIID(IHTMLPluginsCollection) \
181 XIID(IHTMLRect) \
182 XIID(IHTMLScreen) \
183 XIID(IHTMLScriptElement) \
184 XIID(IHTMLSelectElement) \
185 XIID(IHTMLSelectionObject) \
186 XIID(IHTMLSelectionObject2) \
187 XIID(IHTMLStorage) \
188 XIID(IHTMLStyle) \
189 XIID(IHTMLStyle2) \
190 XIID(IHTMLStyle3) \
191 XIID(IHTMLStyle4) \
192 XIID(IHTMLStyle5) \
193 XIID(IHTMLStyle6) \
194 XIID(IHTMLStyleElement) \
195 XIID(IHTMLStyleSheet) \
196 XIID(IHTMLStyleSheetRulesCollection) \
197 XIID(IHTMLStyleSheetsCollection) \
198 XIID(IHTMLTable) \
199 XIID(IHTMLTable2) \
200 XIID(IHTMLTable3) \
201 XIID(IHTMLTableCell) \
202 XIID(IHTMLTableRow) \
203 XIID(IHTMLTextAreaElement) \
204 XIID(IHTMLTextContainer) \
205 XIID(IHTMLTitleElement) \
206 XIID(IHTMLTxtRange) \
207 XIID(IHTMLUniqueName) \
208 XIID(IHTMLWindow2) \
209 XIID(IHTMLWindow3) \
210 XIID(IHTMLWindow4) \
211 XIID(IHTMLWindow5) \
212 XIID(IHTMLWindow6) \
213 XIID(IHTMLXMLHttpRequest) \
214 XIID(IHTMLXMLHttpRequestFactory) \
215 XIID(IOmHistory) \
216 XIID(IOmNavigator)
218 typedef enum {
219 #define XIID(iface) iface ## _tid,
220 #define XDIID(iface) iface ## _tid,
221 TID_LIST
222 #undef XIID
223 #undef XDIID
224 LAST_tid
225 } tid_t;
227 typedef struct dispex_data_t dispex_data_t;
228 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
230 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
231 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
232 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
234 typedef struct DispatchEx DispatchEx;
236 typedef struct {
237 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
238 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
239 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
240 HRESULT (*populate_props)(DispatchEx*);
241 /* We abuse this vtbl for EventTarget functions to avoid separated vtbl. */
242 event_target_t **(*get_event_target_ptr)(DispatchEx*);
243 void (*bind_event)(DispatchEx*,int);
244 } dispex_static_data_vtbl_t;
246 typedef struct {
247 const dispex_static_data_vtbl_t *vtbl;
248 const tid_t disp_tid;
249 dispex_data_t *data;
250 const tid_t* const iface_tids;
251 } dispex_static_data_t;
253 struct DispatchEx {
254 IDispatchEx IDispatchEx_iface;
256 IUnknown *outer;
258 dispex_static_data_t *data;
259 dispex_dynamic_data_t *dynamic_data;
262 typedef struct {
263 UINT_PTR x;
264 } nsCycleCollectingAutoRefCnt;
266 typedef struct {
267 void *vtbl;
268 int ref_flags;
269 void *callbacks;
270 } ExternalCycleCollectionParticipant;
272 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
274 typedef struct {
275 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
276 nsresult (NSAPI *unlink)(void*);
277 void (NSAPI *delete_cycle_collectable)(void*);
278 } CCObjCallback;
280 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
282 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN;
283 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN;
284 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN;
285 void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN;
286 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
287 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
289 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN;
290 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
291 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
292 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
293 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
294 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
295 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
296 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
297 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
298 void release_typelib(void) DECLSPEC_HIDDEN;
299 HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
301 typedef enum {
302 DISPEXPROP_CUSTOM,
303 DISPEXPROP_DYNAMIC,
304 DISPEXPROP_BUILTIN
305 } dispex_prop_type_t;
307 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
309 typedef struct HTMLWindow HTMLWindow;
310 typedef struct HTMLInnerWindow HTMLInnerWindow;
311 typedef struct HTMLOuterWindow HTMLOuterWindow;
312 typedef struct HTMLDocumentNode HTMLDocumentNode;
313 typedef struct HTMLDocumentObj HTMLDocumentObj;
314 typedef struct HTMLFrameBase HTMLFrameBase;
315 typedef struct NSContainer NSContainer;
316 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
318 typedef enum {
319 SCRIPTMODE_GECKO,
320 SCRIPTMODE_ACTIVESCRIPT
321 } SCRIPTMODE;
323 typedef struct ScriptHost ScriptHost;
325 typedef enum {
326 GLOBAL_SCRIPTVAR,
327 GLOBAL_ELEMENTVAR,
328 GLOBAL_DISPEXVAR,
329 GLOBAL_FRAMEVAR
330 } global_prop_type_t;
332 typedef struct {
333 global_prop_type_t type;
334 WCHAR *name;
335 ScriptHost *script_host;
336 DISPID id;
337 } global_prop_t;
339 typedef struct {
340 DispatchEx dispex;
341 event_target_t *ptr;
342 } EventTarget;
344 typedef struct {
345 DispatchEx dispex;
346 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
348 LONG ref;
350 HTMLInnerWindow *window;
351 } HTMLOptionElementFactory;
353 typedef struct {
354 DispatchEx dispex;
355 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
357 LONG ref;
359 HTMLInnerWindow *window;
360 } HTMLImageElementFactory;
362 typedef struct {
363 DispatchEx dispex;
364 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
366 LONG ref;
368 HTMLInnerWindow *window;
369 } HTMLXMLHttpRequestFactory;
371 struct HTMLLocation {
372 DispatchEx dispex;
373 IHTMLLocation IHTMLLocation_iface;
375 LONG ref;
377 HTMLInnerWindow *window;
380 typedef struct {
381 DispatchEx dispex;
382 IOmHistory IOmHistory_iface;
384 LONG ref;
386 HTMLInnerWindow *window;
387 } OmHistory;
389 typedef struct {
390 HTMLOuterWindow *window;
391 LONG ref;
392 } windowref_t;
394 typedef struct nsChannelBSC nsChannelBSC;
396 struct HTMLWindow {
397 IHTMLWindow2 IHTMLWindow2_iface;
398 IHTMLWindow3 IHTMLWindow3_iface;
399 IHTMLWindow4 IHTMLWindow4_iface;
400 IHTMLWindow5 IHTMLWindow5_iface;
401 IHTMLWindow6 IHTMLWindow6_iface;
402 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
403 IDispatchEx IDispatchEx_iface;
404 IServiceProvider IServiceProvider_iface;
405 ITravelLogClient ITravelLogClient_iface;
406 IObjectIdentity IObjectIdentity_iface;
408 LONG ref;
410 HTMLInnerWindow *inner_window;
411 HTMLOuterWindow *outer_window;
414 struct HTMLOuterWindow {
415 HTMLWindow base;
417 windowref_t *window_ref;
418 LONG task_magic;
420 HTMLDocumentObj *doc_obj;
421 nsIDOMWindow *nswindow;
422 HTMLOuterWindow *parent;
423 HTMLFrameBase *frame_element;
425 READYSTATE readystate;
426 BOOL readystate_locked;
427 unsigned readystate_pending;
429 HTMLInnerWindow *pending_window;
430 IMoniker *mon;
431 IUri *uri;
432 IUri *uri_nofrag;
433 BSTR url;
434 DWORD load_flags;
436 SCRIPTMODE scriptmode;
438 IInternetSecurityManager *secmgr;
440 struct list children;
441 struct list sibling_entry;
442 struct list entry;
445 struct HTMLInnerWindow {
446 HTMLWindow base;
447 EventTarget event_target;
449 HTMLDocumentNode *doc;
451 struct list script_hosts;
453 IHTMLEventObj *event;
455 HTMLImageElementFactory *image_factory;
456 HTMLOptionElementFactory *option_factory;
457 HTMLXMLHttpRequestFactory *xhr_factory;
458 IHTMLScreen *screen;
459 OmHistory *history;
460 IHTMLStorage *session_storage;
462 unsigned parser_callback_cnt;
463 struct list script_queue;
465 global_prop_t *global_props;
466 DWORD global_prop_cnt;
467 DWORD global_prop_size;
469 LONG task_magic;
471 HTMLLocation *location;
473 IMoniker *mon;
474 nsChannelBSC *bscallback;
475 struct list bindings;
478 typedef enum {
479 UNKNOWN_USERMODE,
480 BROWSEMODE,
481 EDITMODE
482 } USERMODE;
484 typedef struct _cp_static_data_t {
485 tid_t tid;
486 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
487 BOOL pass_event_arg;
488 DWORD id_cnt;
489 DISPID *ids;
490 } cp_static_data_t;
492 typedef struct {
493 const IID *riid;
494 cp_static_data_t *desc;
495 } cpc_entry_t;
497 typedef struct ConnectionPointContainer {
498 IConnectionPointContainer IConnectionPointContainer_iface;
500 ConnectionPoint *cps;
501 const cpc_entry_t *cp_entries;
502 IUnknown *outer;
503 struct ConnectionPointContainer *forward_container;
504 } ConnectionPointContainer;
506 struct ConnectionPoint {
507 IConnectionPoint IConnectionPoint_iface;
509 ConnectionPointContainer *container;
511 union {
512 IUnknown *unk;
513 IDispatch *disp;
514 IPropertyNotifySink *propnotif;
515 } *sinks;
516 DWORD sinks_size;
518 const IID *iid;
519 cp_static_data_t *data;
522 struct HTMLDocument {
523 IHTMLDocument2 IHTMLDocument2_iface;
524 IHTMLDocument3 IHTMLDocument3_iface;
525 IHTMLDocument4 IHTMLDocument4_iface;
526 IHTMLDocument5 IHTMLDocument5_iface;
527 IHTMLDocument6 IHTMLDocument6_iface;
528 IHTMLDocument7 IHTMLDocument7_iface;
529 IPersistMoniker IPersistMoniker_iface;
530 IPersistFile IPersistFile_iface;
531 IPersistHistory IPersistHistory_iface;
532 IMonikerProp IMonikerProp_iface;
533 IOleObject IOleObject_iface;
534 IOleDocument IOleDocument_iface;
535 IOleDocumentView IOleDocumentView_iface;
536 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
537 IViewObjectEx IViewObjectEx_iface;
538 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
539 IServiceProvider IServiceProvider_iface;
540 IOleCommandTarget IOleCommandTarget_iface;
541 IOleControl IOleControl_iface;
542 IHlinkTarget IHlinkTarget_iface;
543 IPersistStreamInit IPersistStreamInit_iface;
544 IDispatchEx IDispatchEx_iface;
545 ISupportErrorInfo ISupportErrorInfo_iface;
546 IObjectWithSite IObjectWithSite_iface;
547 IOleContainer IOleContainer_iface;
548 IObjectSafety IObjectSafety_iface;
549 IProvideClassInfo IProvideClassInfo_iface;
551 IUnknown *unk_impl;
552 IDispatchEx *dispex;
554 HTMLDocumentObj *doc_obj;
555 HTMLDocumentNode *doc_node;
557 HTMLOuterWindow *window;
559 LONG task_magic;
561 ConnectionPointContainer cp_container;
562 IOleAdviseHolder *advise_holder;
565 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
567 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
570 static inline ULONG htmldoc_addref(HTMLDocument *This)
572 return IUnknown_AddRef(This->unk_impl);
575 static inline ULONG htmldoc_release(HTMLDocument *This)
577 return IUnknown_Release(This->unk_impl);
580 struct HTMLDocumentObj {
581 HTMLDocument basedoc;
582 DispatchEx dispex;
583 ICustomDoc ICustomDoc_iface;
584 ITargetContainer ITargetContainer_iface;
586 IWindowForBindingUI IWindowForBindingUI_iface;
588 LONG ref;
590 NSContainer *nscontainer;
592 IOleClientSite *client;
593 IDocHostUIHandler *hostui;
594 IOleCommandTarget *client_cmdtrg;
595 BOOL custom_hostui;
596 IOleInPlaceSite *ipsite;
597 IOleInPlaceFrame *frame;
598 IOleInPlaceUIWindow *ip_window;
599 IAdviseSink *view_sink;
600 IDocObjectService *doc_object_service;
601 IUnknown *webbrowser;
602 ITravelLog *travel_log;
603 IUnknown *browser_service;
605 DOCHOSTUIINFO hostinfo;
607 IOleUndoManager *undomgr;
608 IHTMLEditServices *editsvcs;
610 HWND hwnd;
611 HWND tooltips_hwnd;
613 BOOL request_uiactivate;
614 BOOL in_place_active;
615 BOOL ui_active;
616 BOOL window_active;
617 BOOL hostui_setup;
618 BOOL container_locked;
619 BOOL focus;
620 BOOL has_popup;
621 INT download_state;
623 USERMODE usermode;
624 LPWSTR mime;
626 DWORD update;
629 typedef struct nsWeakReference nsWeakReference;
631 struct NSContainer {
632 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
633 nsIContextMenuListener nsIContextMenuListener_iface;
634 nsIURIContentListener nsIURIContentListener_iface;
635 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
636 nsITooltipListener nsITooltipListener_iface;
637 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
638 nsISupportsWeakReference nsISupportsWeakReference_iface;
640 nsIWebBrowser *webbrowser;
641 nsIWebNavigation *navigation;
642 nsIBaseWindow *window;
643 nsIWebBrowserFocus *focus;
645 nsIEditor *editor;
646 nsIController *editor_controller;
648 LONG ref;
650 nsWeakReference *weak_reference;
652 NSContainer *parent;
653 HTMLDocumentObj *doc;
655 nsIURIContentListener *content_listener;
657 HWND hwnd;
660 typedef struct {
661 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
662 void (*destructor)(HTMLDOMNode*);
663 const cpc_entry_t *cpc_entries;
664 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
665 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
666 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
667 event_target_t **(*get_event_target_ptr)(HTMLDOMNode*);
668 HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*);
669 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
670 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
671 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
672 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
673 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
674 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
675 HRESULT (*bind_to_tree)(HTMLDOMNode*);
676 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
677 void (*unlink)(HTMLDOMNode*);
678 BOOL (*is_text_edit)(HTMLDOMNode*);
679 } NodeImplVtbl;
681 struct HTMLDOMNode {
682 EventTarget event_target;
683 IHTMLDOMNode IHTMLDOMNode_iface;
684 IHTMLDOMNode2 IHTMLDOMNode2_iface;
685 const NodeImplVtbl *vtbl;
687 nsCycleCollectingAutoRefCnt ccref;
689 nsIDOMNode *nsnode;
690 HTMLDocumentNode *doc;
691 ConnectionPointContainer *cp_container;
694 static inline void node_addref(HTMLDOMNode *node)
696 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
699 static inline void node_release(HTMLDOMNode *node)
701 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
704 typedef struct {
705 HTMLDOMNode node;
706 ConnectionPointContainer cp_container;
708 IHTMLElement IHTMLElement_iface;
709 IHTMLElement2 IHTMLElement2_iface;
710 IHTMLElement3 IHTMLElement3_iface;
711 IHTMLElement4 IHTMLElement4_iface;
712 IHTMLUniqueName IHTMLUniqueName_iface;
714 nsIDOMHTMLElement *nselem;
715 HTMLStyle *style;
716 HTMLStyle *runtime_style;
717 HTMLAttributeCollection *attrs;
718 WCHAR *filter;
719 unsigned unique_id;
720 } HTMLElement;
722 #define HTMLELEMENT_TIDS \
723 IHTMLDOMNode_tid, \
724 IHTMLDOMNode2_tid, \
725 IHTMLElement_tid, \
726 IHTMLElement2_tid, \
727 IHTMLElement3_tid, \
728 IHTMLElement4_tid, \
729 IHTMLUniqueName_tid
731 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN;
732 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
733 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN;
735 typedef struct {
736 HTMLElement element;
738 IHTMLTextContainer IHTMLTextContainer_iface;
739 } HTMLTextContainer;
741 struct HTMLFrameBase {
742 HTMLElement element;
744 IHTMLFrameBase IHTMLFrameBase_iface;
745 IHTMLFrameBase2 IHTMLFrameBase2_iface;
747 HTMLOuterWindow *content_window;
749 nsIDOMHTMLFrameElement *nsframe;
750 nsIDOMHTMLIFrameElement *nsiframe;
753 typedef struct nsDocumentEventListener nsDocumentEventListener;
755 struct HTMLDocumentNode {
756 HTMLDOMNode node;
757 HTMLDocument basedoc;
759 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
761 nsIDocumentObserver nsIDocumentObserver_iface;
763 LONG ref;
765 HTMLInnerWindow *window;
767 nsIDOMHTMLDocument *nsdoc;
768 BOOL content_ready;
769 event_target_t *body_event_target;
771 IHTMLDOMImplementation *dom_implementation;
773 ICatInformation *catmgr;
774 nsDocumentEventListener *nsevent_listener;
775 BOOL *event_vector;
777 WCHAR **elem_vars;
778 unsigned elem_vars_size;
779 unsigned elem_vars_cnt;
781 BOOL skip_mutation_notif;
783 UINT charset;
785 unsigned unique_id;
787 struct list selection_list;
788 struct list range_list;
789 struct list plugin_hosts;
792 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
793 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
794 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
796 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
797 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
798 HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
799 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
800 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
801 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
802 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN;
803 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
804 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
805 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
806 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
807 HRESULT create_dom_implementation(IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
809 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
811 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
812 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
813 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
814 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN;
815 void HTMLDocument_Window_Init(HTMLDocument*) DECLSPEC_HIDDEN;
816 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
817 void HTMLDocument_Hlink_Init(HTMLDocument*) DECLSPEC_HIDDEN;
819 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
820 void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN;
822 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
824 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
826 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
827 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
829 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
830 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
832 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
833 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
834 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
835 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
837 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
838 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
839 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
841 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
842 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
843 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
845 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN;
847 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
849 BOOL load_gecko(void) DECLSPEC_HIDDEN;
850 void close_gecko(void) DECLSPEC_HIDDEN;
851 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
852 void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
853 void release_nsio(void) DECLSPEC_HIDDEN;
854 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
855 void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
857 void init_node_cc(void) DECLSPEC_HIDDEN;
859 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
861 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
863 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
864 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
866 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
867 void nsfree(void*) DECLSPEC_HIDDEN;
869 BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN;
870 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
871 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
872 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
873 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
875 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
876 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
877 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
878 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
880 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
882 static inline HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p)
884 V_VT(p) = VT_BSTR;
885 return return_nsstr(nsres, nsstr, &V_BSTR(p));
888 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
889 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
890 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
891 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
892 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
893 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN;
894 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
895 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
897 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
898 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
899 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
900 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
901 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
902 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
904 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
905 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
907 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
908 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
909 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
910 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
912 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
913 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
914 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
915 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
917 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
918 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
920 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
922 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
923 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
926 struct HTMLAttributeCollection {
927 DispatchEx dispex;
928 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
929 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
930 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
932 LONG ref;
934 HTMLElement *elem;
935 struct list attrs;
938 typedef struct {
939 DispatchEx dispex;
940 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
941 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
943 LONG ref;
945 WCHAR *name;
947 HTMLElement *elem;
948 DISPID dispid;
949 struct list entry;
950 } HTMLDOMAttribute;
952 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
954 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
955 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
956 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
957 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
958 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
959 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
960 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
961 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
962 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
963 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
964 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
965 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
966 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
967 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
968 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
969 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
970 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
971 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
972 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
973 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
974 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
975 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
976 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
977 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
978 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
979 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
980 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
982 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*) DECLSPEC_HIDDEN;
983 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
984 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
985 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
987 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
988 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
990 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
991 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
992 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
993 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
994 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
996 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
997 void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN;
999 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
1000 HRESULT get_elem(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1002 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
1004 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
1005 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
1006 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1007 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
1008 HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1010 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
1012 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
1013 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
1014 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
1016 #define ATTRFLAG_CASESENSITIVE 0x0001
1017 #define ATTRFLAG_ASSTRING 0x0002
1018 #define ATTRFLAG_EXPANDURL 0x0004
1020 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,DWORD,VARIANT*) DECLSPEC_HIDDEN;
1021 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN;
1023 nsresult get_elem_attr_value(nsIDOMHTMLElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
1024 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
1025 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
1027 HRESULT elem_unique_id(unsigned id, BSTR *p) DECLSPEC_HIDDEN;
1029 /* commands */
1030 typedef struct {
1031 DWORD id;
1032 HRESULT (*query)(HTMLDocument*,OLECMD*);
1033 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
1034 } cmdtable_t;
1036 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
1038 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
1040 /* timer */
1041 #define UPDATE_UI 0x0001
1042 #define UPDATE_TITLE 0x0002
1044 void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN;
1045 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1046 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
1048 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
1050 /* editor */
1051 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1052 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
1053 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
1054 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1055 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1056 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1057 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
1058 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
1059 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
1061 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
1063 typedef struct task_t task_t;
1064 typedef void (*task_proc_t)(task_t*);
1066 struct task_t {
1067 LONG target_magic;
1068 task_proc_t proc;
1069 task_proc_t destr;
1070 struct list entry;
1073 typedef struct {
1074 task_t header;
1075 HTMLDocumentObj *doc;
1076 } docobj_task_t;
1078 typedef struct {
1079 HWND thread_hwnd;
1080 struct list task_list;
1081 struct list timer_list;
1082 } thread_data_t;
1084 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1085 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1087 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1088 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1089 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1090 void flush_pending_tasks(LONG) DECLSPEC_HIDDEN;
1092 HRESULT set_task_timer(HTMLInnerWindow*,DWORD,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1093 HRESULT clear_task_timer(HTMLInnerWindow*,BOOL,DWORD) DECLSPEC_HIDDEN;
1095 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1097 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1098 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1099 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1100 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1101 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1103 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1105 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1107 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1108 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1110 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1111 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1113 /* memory allocation functions */
1115 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
1117 return HeapAlloc(GetProcessHeap(), 0, len);
1120 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
1122 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
1125 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
1127 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
1130 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1132 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1135 static inline BOOL heap_free(void *mem)
1137 return HeapFree(GetProcessHeap(), 0, mem);
1140 static inline LPWSTR heap_strdupW(LPCWSTR str)
1142 LPWSTR ret = NULL;
1144 if(str) {
1145 DWORD size;
1147 size = (strlenW(str)+1)*sizeof(WCHAR);
1148 ret = heap_alloc(size);
1149 if(ret)
1150 memcpy(ret, str, size);
1153 return ret;
1156 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1158 LPWSTR ret = NULL;
1160 if(str) {
1161 ret = heap_alloc((len+1)*sizeof(WCHAR));
1162 if(ret)
1164 memcpy(ret, str, len*sizeof(WCHAR));
1165 ret[len] = 0;
1169 return ret;
1172 static inline char *heap_strdupA(const char *str)
1174 char *ret = NULL;
1176 if(str) {
1177 DWORD size;
1179 size = strlen(str)+1;
1180 ret = heap_alloc(size);
1181 if(ret)
1182 memcpy(ret, str, size);
1185 return ret;
1188 static inline WCHAR *heap_strdupAtoW(const char *str)
1190 LPWSTR ret = NULL;
1192 if(str) {
1193 DWORD len;
1195 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1196 ret = heap_alloc(len*sizeof(WCHAR));
1197 if(ret)
1198 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1201 return ret;
1204 static inline char *heap_strdupWtoA(LPCWSTR str)
1206 char *ret = NULL;
1208 if(str) {
1209 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1210 ret = heap_alloc(size);
1211 if(ret)
1212 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1215 return ret;
1218 static inline WCHAR *heap_strdupUtoW(const char *str)
1220 WCHAR *ret = NULL;
1222 if(str) {
1223 size_t len;
1225 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1226 ret = heap_alloc(len*sizeof(WCHAR));
1227 if(ret)
1228 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1231 return ret;
1234 static inline char *heap_strdupWtoU(const WCHAR *str)
1236 char *ret = NULL;
1238 if(str) {
1239 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1240 ret = heap_alloc(size);
1241 if(ret)
1242 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1245 return ret;
1248 static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len)
1250 char *ret = NULL;
1251 DWORD size;
1253 if(str && len) {
1254 size = WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL);
1255 ret = heap_alloc(size + 1);
1256 if(ret) {
1257 WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL);
1258 ret[size] = '\0';
1262 return ret;
1265 static inline void windowref_addref(windowref_t *ref)
1267 InterlockedIncrement(&ref->ref);
1270 static inline void windowref_release(windowref_t *ref)
1272 if(!InterlockedDecrement(&ref->ref))
1273 heap_free(ref);
1276 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
1277 BSTR charset_string_from_cp(UINT) DECLSPEC_HIDDEN;
1278 HDC get_display_dc(void) DECLSPEC_HIDDEN;
1279 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1280 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1282 extern HINSTANCE hInst DECLSPEC_HIDDEN;