mshtml: Added IHTMLTableRow::bgColor property implementation.
[wine.git] / dlls / mshtml / mshtml_private.h
blobc40d7732ef13335fb54195179ac15980b3d17bc9
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(DispHTMLStyleSheetsCollection) \
111 XDIID(DispHTMLTable) \
112 XDIID(DispHTMLTableCell) \
113 XDIID(DispHTMLTableRow) \
114 XDIID(DispHTMLTextAreaElement) \
115 XDIID(DispHTMLTitleElement) \
116 XDIID(DispHTMLUnknownElement) \
117 XDIID(DispHTMLWindow2) \
118 XDIID(HTMLDocumentEvents) \
119 XDIID(HTMLElementEvents2) \
120 XIID(IHTMLAnchorElement) \
121 XIID(IHTMLAttributeCollection) \
122 XIID(IHTMLAttributeCollection2) \
123 XIID(IHTMLAttributeCollection3) \
124 XIID(IHTMLBodyElement) \
125 XIID(IHTMLBodyElement2) \
126 XIID(IHTMLButtonElement) \
127 XIID(IHTMLCommentElement) \
128 XIID(IHTMLCurrentStyle) \
129 XIID(IHTMLCurrentStyle2) \
130 XIID(IHTMLCurrentStyle3) \
131 XIID(IHTMLCurrentStyle4) \
132 XIID(IHTMLDocument2) \
133 XIID(IHTMLDocument3) \
134 XIID(IHTMLDocument4) \
135 XIID(IHTMLDocument5) \
136 XIID(IHTMLDOMAttribute) \
137 XIID(IHTMLDOMChildrenCollection) \
138 XIID(IHTMLDOMNode) \
139 XIID(IHTMLDOMNode2) \
140 XIID(IHTMLDOMTextNode) \
141 XIID(IHTMLElement) \
142 XIID(IHTMLElement2) \
143 XIID(IHTMLElement3) \
144 XIID(IHTMLElement4) \
145 XIID(IHTMLElementCollection) \
146 XIID(IHTMLEmbedElement) \
147 XIID(IHTMLEventObj) \
148 XIID(IHTMLFiltersCollection) \
149 XIID(IHTMLFormElement) \
150 XIID(IHTMLFrameBase) \
151 XIID(IHTMLFrameBase2) \
152 XIID(IHTMLFrameElement3) \
153 XIID(IHTMLGenericElement) \
154 XIID(IHTMLHeadElement) \
155 XIID(IHTMLIFrameElement) \
156 XIID(IHTMLIFrameElement2) \
157 XIID(IHTMLIFrameElement3) \
158 XIID(IHTMLImageElementFactory) \
159 XIID(IHTMLImgElement) \
160 XIID(IHTMLInputElement) \
161 XIID(IHTMLLabelElement) \
162 XIID(IHTMLLinkElement) \
163 XIID(IHTMLLocation) \
164 XIID(IHTMLMetaElement) \
165 XIID(IHTMLMimeTypesCollection) \
166 XIID(IHTMLObjectElement) \
167 XIID(IHTMLObjectElement2) \
168 XIID(IHTMLOptionElement) \
169 XIID(IHTMLPluginsCollection) \
170 XIID(IHTMLRect) \
171 XIID(IHTMLScreen) \
172 XIID(IHTMLScriptElement) \
173 XIID(IHTMLSelectElement) \
174 XIID(IHTMLStorage) \
175 XIID(IHTMLStyle) \
176 XIID(IHTMLStyle2) \
177 XIID(IHTMLStyle3) \
178 XIID(IHTMLStyle4) \
179 XIID(IHTMLStyle5) \
180 XIID(IHTMLStyle6) \
181 XIID(IHTMLStyleElement) \
182 XIID(IHTMLStyleSheet) \
183 XIID(IHTMLStyleSheetsCollection) \
184 XIID(IHTMLTable) \
185 XIID(IHTMLTable2) \
186 XIID(IHTMLTable3) \
187 XIID(IHTMLTableCell) \
188 XIID(IHTMLTableRow) \
189 XIID(IHTMLTextAreaElement) \
190 XIID(IHTMLTextContainer) \
191 XIID(IHTMLTitleElement) \
192 XIID(IHTMLUniqueName) \
193 XIID(IHTMLWindow2) \
194 XIID(IHTMLWindow3) \
195 XIID(IHTMLWindow4) \
196 XIID(IHTMLWindow5) \
197 XIID(IHTMLWindow6) \
198 XIID(IOmHistory) \
199 XIID(IOmNavigator)
201 typedef enum {
202 #define XIID(iface) iface ## _tid,
203 #define XDIID(iface) iface ## _tid,
204 TID_LIST
205 #undef XIID
206 #undef XDIID
207 LAST_tid
208 } tid_t;
210 typedef struct dispex_data_t dispex_data_t;
211 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
213 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
214 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
215 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
217 typedef struct DispatchEx DispatchEx;
219 typedef struct {
220 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
221 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
222 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
223 HRESULT (*populate_props)(DispatchEx*);
224 } dispex_static_data_vtbl_t;
226 typedef struct {
227 const dispex_static_data_vtbl_t *vtbl;
228 const tid_t disp_tid;
229 dispex_data_t *data;
230 const tid_t* const iface_tids;
231 } dispex_static_data_t;
233 struct DispatchEx {
234 IDispatchEx IDispatchEx_iface;
236 IUnknown *outer;
238 dispex_static_data_t *data;
239 dispex_dynamic_data_t *dynamic_data;
242 typedef struct {
243 void *x;
244 } nsCycleCollectingAutoRefCnt;
246 typedef struct {
247 void *x[9];
248 } nsXPCOMCycleCollectionParticipant;
250 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
252 typedef struct {
253 void (NSAPI *unmark_if_purple)(void*);
254 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
255 nsresult (NSAPI *unlink)(void*);
256 } CCObjCallback;
258 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
260 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*);
261 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*);
262 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt);
263 void (__cdecl *ccref_unmark_if_purple)(nsCycleCollectingAutoRefCnt*);
264 void (__cdecl *ccp_init)(nsXPCOMCycleCollectionParticipant*,const CCObjCallback*);
265 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*);
266 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*);
268 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN;
269 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
270 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
271 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
272 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
273 HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*) DECLSPEC_HIDDEN;
274 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
275 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
276 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
277 void release_typelib(void) DECLSPEC_HIDDEN;
278 HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
280 typedef enum {
281 DISPEXPROP_CUSTOM,
282 DISPEXPROP_DYNAMIC,
283 DISPEXPROP_BUILTIN
284 } dispex_prop_type_t;
286 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
288 typedef struct HTMLWindow HTMLWindow;
289 typedef struct HTMLInnerWindow HTMLInnerWindow;
290 typedef struct HTMLOuterWindow HTMLOuterWindow;
291 typedef struct HTMLDocumentNode HTMLDocumentNode;
292 typedef struct HTMLDocumentObj HTMLDocumentObj;
293 typedef struct HTMLFrameBase HTMLFrameBase;
294 typedef struct NSContainer NSContainer;
295 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
297 typedef enum {
298 SCRIPTMODE_GECKO,
299 SCRIPTMODE_ACTIVESCRIPT
300 } SCRIPTMODE;
302 typedef struct ScriptHost ScriptHost;
304 typedef enum {
305 GLOBAL_SCRIPTVAR,
306 GLOBAL_ELEMENTVAR,
307 GLOBAL_DISPEXVAR,
308 GLOBAL_FRAMEVAR
309 } global_prop_type_t;
311 typedef struct {
312 global_prop_type_t type;
313 WCHAR *name;
314 ScriptHost *script_host;
315 DISPID id;
316 } global_prop_t;
318 typedef struct {
319 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
321 LONG ref;
323 HTMLInnerWindow *window;
324 } HTMLOptionElementFactory;
326 typedef struct {
327 DispatchEx dispex;
328 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
330 LONG ref;
332 HTMLInnerWindow *window;
333 } HTMLImageElementFactory;
335 struct HTMLLocation {
336 DispatchEx dispex;
337 IHTMLLocation IHTMLLocation_iface;
339 LONG ref;
341 HTMLInnerWindow *window;
344 typedef struct {
345 DispatchEx dispex;
346 IOmHistory IOmHistory_iface;
348 LONG ref;
350 HTMLInnerWindow *window;
351 } OmHistory;
353 typedef struct {
354 HTMLOuterWindow *window;
355 LONG ref;
356 } windowref_t;
358 typedef struct nsChannelBSC nsChannelBSC;
360 struct HTMLWindow {
361 IHTMLWindow2 IHTMLWindow2_iface;
362 IHTMLWindow3 IHTMLWindow3_iface;
363 IHTMLWindow4 IHTMLWindow4_iface;
364 IHTMLWindow5 IHTMLWindow5_iface;
365 IHTMLWindow6 IHTMLWindow6_iface;
366 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
367 IDispatchEx IDispatchEx_iface;
368 IServiceProvider IServiceProvider_iface;
369 ITravelLogClient ITravelLogClient_iface;
370 IObjectIdentity IObjectIdentity_iface;
372 LONG ref;
374 HTMLInnerWindow *inner_window;
375 HTMLOuterWindow *outer_window;
378 struct HTMLOuterWindow {
379 HTMLWindow base;
381 windowref_t *window_ref;
382 LONG task_magic;
384 HTMLDocumentObj *doc_obj;
385 nsIDOMWindow *nswindow;
386 HTMLOuterWindow *parent;
387 HTMLFrameBase *frame_element;
389 READYSTATE readystate;
390 BOOL readystate_locked;
391 unsigned readystate_pending;
393 HTMLInnerWindow *pending_window;
394 IMoniker *mon;
395 IUri *uri;
396 IUri *uri_nofrag;
397 BSTR url;
398 DWORD load_flags;
400 SCRIPTMODE scriptmode;
402 IInternetSecurityManager *secmgr;
404 struct list children;
405 struct list sibling_entry;
406 struct list entry;
409 struct HTMLInnerWindow {
410 HTMLWindow base;
411 DispatchEx dispex;
413 HTMLDocumentNode *doc;
415 struct list script_hosts;
417 IHTMLEventObj *event;
419 HTMLImageElementFactory *image_factory;
420 HTMLOptionElementFactory *option_factory;
421 IHTMLScreen *screen;
422 OmHistory *history;
423 IHTMLStorage *session_storage;
425 unsigned parser_callback_cnt;
426 struct list script_queue;
428 global_prop_t *global_props;
429 DWORD global_prop_cnt;
430 DWORD global_prop_size;
432 LONG task_magic;
434 HTMLLocation *location;
436 IMoniker *mon;
437 nsChannelBSC *bscallback;
438 struct list bindings;
441 typedef enum {
442 UNKNOWN_USERMODE,
443 BROWSEMODE,
444 EDITMODE
445 } USERMODE;
447 typedef struct _cp_static_data_t {
448 tid_t tid;
449 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
450 BOOL pass_event_arg;
451 DWORD id_cnt;
452 DISPID *ids;
453 } cp_static_data_t;
455 typedef struct {
456 const IID *riid;
457 cp_static_data_t *desc;
458 } cpc_entry_t;
460 typedef struct ConnectionPointContainer {
461 IConnectionPointContainer IConnectionPointContainer_iface;
463 ConnectionPoint *cps;
464 const cpc_entry_t *cp_entries;
465 IUnknown *outer;
466 struct ConnectionPointContainer *forward_container;
467 } ConnectionPointContainer;
469 struct ConnectionPoint {
470 IConnectionPoint IConnectionPoint_iface;
472 ConnectionPointContainer *container;
474 union {
475 IUnknown *unk;
476 IDispatch *disp;
477 IPropertyNotifySink *propnotif;
478 } *sinks;
479 DWORD sinks_size;
481 const IID *iid;
482 cp_static_data_t *data;
485 struct HTMLDocument {
486 IHTMLDocument2 IHTMLDocument2_iface;
487 IHTMLDocument3 IHTMLDocument3_iface;
488 IHTMLDocument4 IHTMLDocument4_iface;
489 IHTMLDocument5 IHTMLDocument5_iface;
490 IHTMLDocument6 IHTMLDocument6_iface;
491 IHTMLDocument7 IHTMLDocument7_iface;
492 IPersistMoniker IPersistMoniker_iface;
493 IPersistFile IPersistFile_iface;
494 IPersistHistory IPersistHistory_iface;
495 IMonikerProp IMonikerProp_iface;
496 IOleObject IOleObject_iface;
497 IOleDocument IOleDocument_iface;
498 IOleDocumentView IOleDocumentView_iface;
499 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
500 IViewObjectEx IViewObjectEx_iface;
501 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
502 IServiceProvider IServiceProvider_iface;
503 IOleCommandTarget IOleCommandTarget_iface;
504 IOleControl IOleControl_iface;
505 IHlinkTarget IHlinkTarget_iface;
506 IPersistStreamInit IPersistStreamInit_iface;
507 IDispatchEx IDispatchEx_iface;
508 ISupportErrorInfo ISupportErrorInfo_iface;
509 IObjectWithSite IObjectWithSite_iface;
510 IOleContainer IOleContainer_iface;
511 IObjectSafety IObjectSafety_iface;
512 IProvideClassInfo IProvideClassInfo_iface;
514 IUnknown *unk_impl;
515 IDispatchEx *dispex;
517 HTMLDocumentObj *doc_obj;
518 HTMLDocumentNode *doc_node;
520 HTMLOuterWindow *window;
522 LONG task_magic;
524 ConnectionPointContainer cp_container;
525 IOleAdviseHolder *advise_holder;
528 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
530 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
533 static inline ULONG htmldoc_addref(HTMLDocument *This)
535 return IUnknown_AddRef(This->unk_impl);
538 static inline ULONG htmldoc_release(HTMLDocument *This)
540 return IUnknown_Release(This->unk_impl);
543 struct HTMLDocumentObj {
544 HTMLDocument basedoc;
545 DispatchEx dispex;
546 ICustomDoc ICustomDoc_iface;
547 ITargetContainer ITargetContainer_iface;
549 IWindowForBindingUI IWindowForBindingUI_iface;
551 LONG ref;
553 NSContainer *nscontainer;
555 IOleClientSite *client;
556 IDocHostUIHandler *hostui;
557 IOleCommandTarget *client_cmdtrg;
558 BOOL custom_hostui;
559 IOleInPlaceSite *ipsite;
560 IOleInPlaceFrame *frame;
561 IOleInPlaceUIWindow *ip_window;
562 IAdviseSink *view_sink;
563 IDocObjectService *doc_object_service;
564 IUnknown *webbrowser;
565 ITravelLog *travel_log;
566 IUnknown *browser_service;
568 DOCHOSTUIINFO hostinfo;
570 IOleUndoManager *undomgr;
572 HWND hwnd;
573 HWND tooltips_hwnd;
575 BOOL request_uiactivate;
576 BOOL in_place_active;
577 BOOL ui_active;
578 BOOL window_active;
579 BOOL hostui_setup;
580 BOOL container_locked;
581 BOOL focus;
582 BOOL has_popup;
583 INT download_state;
585 USERMODE usermode;
586 LPWSTR mime;
588 DWORD update;
591 typedef struct nsWeakReference nsWeakReference;
593 struct NSContainer {
594 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
595 nsIContextMenuListener nsIContextMenuListener_iface;
596 nsIURIContentListener nsIURIContentListener_iface;
597 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
598 nsITooltipListener nsITooltipListener_iface;
599 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
600 nsISupportsWeakReference nsISupportsWeakReference_iface;
602 nsIWebBrowser *webbrowser;
603 nsIWebNavigation *navigation;
604 nsIBaseWindow *window;
605 nsIWebBrowserFocus *focus;
607 nsIEditor *editor;
608 nsIController *editor_controller;
610 LONG ref;
612 nsWeakReference *weak_reference;
614 NSContainer *parent;
615 HTMLDocumentObj *doc;
617 nsIURIContentListener *content_listener;
619 HWND hwnd;
622 typedef struct {
623 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
624 void (*destructor)(HTMLDOMNode*);
625 const cpc_entry_t *cpc_entries;
626 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
627 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
628 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
629 event_target_t **(*get_event_target)(HTMLDOMNode*);
630 HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*);
631 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
632 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
633 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
634 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
635 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
636 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
637 HRESULT (*bind_to_tree)(HTMLDOMNode*);
638 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
639 void (*unlink)(HTMLDOMNode*);
640 } NodeImplVtbl;
642 struct HTMLDOMNode {
643 DispatchEx dispex;
644 IHTMLDOMNode IHTMLDOMNode_iface;
645 IHTMLDOMNode2 IHTMLDOMNode2_iface;
646 const NodeImplVtbl *vtbl;
648 nsCycleCollectingAutoRefCnt ccref;
650 nsIDOMNode *nsnode;
651 HTMLDocumentNode *doc;
652 event_target_t *event_target;
653 ConnectionPointContainer *cp_container;
656 static inline void node_addref(HTMLDOMNode *node)
658 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
661 static inline void node_release(HTMLDOMNode *node)
663 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
666 typedef struct {
667 HTMLDOMNode node;
668 ConnectionPointContainer cp_container;
670 IHTMLElement IHTMLElement_iface;
671 IHTMLElement2 IHTMLElement2_iface;
672 IHTMLElement3 IHTMLElement3_iface;
673 IHTMLElement4 IHTMLElement4_iface;
675 nsIDOMHTMLElement *nselem;
676 HTMLStyle *style;
677 HTMLStyle *runtime_style;
678 HTMLAttributeCollection *attrs;
679 WCHAR *filter;
680 } HTMLElement;
682 #define HTMLELEMENT_TIDS \
683 IHTMLDOMNode_tid, \
684 IHTMLDOMNode2_tid, \
685 IHTMLElement_tid, \
686 IHTMLElement2_tid, \
687 IHTMLElement3_tid, \
688 IHTMLElement4_tid
690 extern cp_static_data_t HTMLElementEvents2_data;
691 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
692 extern const cpc_entry_t HTMLElement_cpc[];
694 typedef struct {
695 HTMLElement element;
697 IHTMLTextContainer IHTMLTextContainer_iface;
698 } HTMLTextContainer;
700 struct HTMLFrameBase {
701 HTMLElement element;
703 IHTMLFrameBase IHTMLFrameBase_iface;
704 IHTMLFrameBase2 IHTMLFrameBase2_iface;
706 HTMLOuterWindow *content_window;
708 nsIDOMHTMLFrameElement *nsframe;
709 nsIDOMHTMLIFrameElement *nsiframe;
712 typedef struct nsDocumentEventListener nsDocumentEventListener;
714 struct HTMLDocumentNode {
715 HTMLDOMNode node;
716 HTMLDocument basedoc;
718 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
720 nsIDocumentObserver nsIDocumentObserver_iface;
722 LONG ref;
724 HTMLInnerWindow *window;
726 nsIDOMHTMLDocument *nsdoc;
727 nsIDOMNodeSelector *nsnode_selector;
728 BOOL content_ready;
729 event_target_t *body_event_target;
731 ICatInformation *catmgr;
732 nsDocumentEventListener *nsevent_listener;
733 BOOL *event_vector;
735 WCHAR **elem_vars;
736 unsigned elem_vars_size;
737 unsigned elem_vars_cnt;
739 BOOL skip_mutation_notif;
741 struct list selection_list;
742 struct list range_list;
743 struct list plugin_hosts;
746 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
747 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
748 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
749 HRESULT create_document_fragment(nsIDOMNode*,HTMLDocumentNode*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
751 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
752 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
753 HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
754 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
755 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
756 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
757 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
758 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
759 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
760 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
762 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
764 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
765 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
766 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
767 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN;
768 void HTMLDocument_Window_Init(HTMLDocument*) DECLSPEC_HIDDEN;
769 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
770 void HTMLDocument_Hlink_Init(HTMLDocument*) DECLSPEC_HIDDEN;
772 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
773 void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN;
775 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
777 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
779 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
780 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
782 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
783 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
785 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
786 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
787 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
788 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
790 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
791 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
792 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
794 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
795 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
796 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
798 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
800 BOOL load_gecko(void) DECLSPEC_HIDDEN;
801 void close_gecko(void) DECLSPEC_HIDDEN;
802 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
803 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*) DECLSPEC_HIDDEN;
804 void release_nsio(void) DECLSPEC_HIDDEN;
805 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
807 void init_node_cc(void);
809 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
811 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
813 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
814 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
816 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
817 void nsfree(void*) DECLSPEC_HIDDEN;
819 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
820 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
821 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
822 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
824 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
825 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
826 void nsAString_SetData(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
827 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
828 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
829 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
831 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
832 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
833 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
834 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
835 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
836 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
837 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
839 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
840 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
841 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
842 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
843 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
844 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
846 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
848 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
849 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
850 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
851 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
853 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
854 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
855 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
856 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
858 HRESULT insert_adjacent_node(HTMLElement*,const WCHAR*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
860 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
861 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
863 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
865 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
866 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
869 struct HTMLAttributeCollection {
870 DispatchEx dispex;
871 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
872 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
873 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
875 LONG ref;
877 HTMLElement *elem;
878 struct list attrs;
881 typedef struct {
882 DispatchEx dispex;
883 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
885 LONG ref;
887 WCHAR *name;
889 HTMLElement *elem;
890 DISPID dispid;
891 struct list entry;
892 } HTMLDOMAttribute;
894 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
896 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
897 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
898 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
899 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
900 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
901 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
902 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
903 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
904 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
905 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
906 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
907 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
908 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
909 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
910 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
911 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
912 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
913 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
914 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
915 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
916 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
917 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
918 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
919 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
920 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
921 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
923 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*) DECLSPEC_HIDDEN;
924 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
925 void HTMLElement2_Init(HTMLElement*) DECLSPEC_HIDDEN;
926 void HTMLElement3_Init(HTMLElement*) DECLSPEC_HIDDEN;
927 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
928 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
930 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
931 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
933 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
934 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
935 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
936 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
937 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
939 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
940 void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN;
942 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
943 HRESULT get_elem(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
945 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
947 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
948 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
949 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
950 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
952 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
954 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
955 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
956 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
958 /* commands */
959 typedef struct {
960 DWORD id;
961 HRESULT (*query)(HTMLDocument*,OLECMD*);
962 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
963 } cmdtable_t;
965 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
967 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
969 /* timer */
970 #define UPDATE_UI 0x0001
971 #define UPDATE_TITLE 0x0002
973 void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN;
974 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
975 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
977 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
979 /* editor */
980 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
981 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
982 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
983 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
984 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
985 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
986 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
987 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
988 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
990 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
992 typedef struct task_t task_t;
993 typedef void (*task_proc_t)(task_t*);
995 struct task_t {
996 LONG target_magic;
997 task_proc_t proc;
998 task_proc_t destr;
999 struct task_t *next;
1002 typedef struct {
1003 task_t header;
1004 HTMLDocumentObj *doc;
1005 } docobj_task_t;
1007 typedef struct {
1008 HWND thread_hwnd;
1009 task_t *task_queue_head;
1010 task_t *task_queue_tail;
1011 struct list timer_list;
1012 } thread_data_t;
1014 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1015 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1017 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1018 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1019 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1021 HRESULT set_task_timer(HTMLInnerWindow*,DWORD,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1022 HRESULT clear_task_timer(HTMLInnerWindow*,BOOL,DWORD) DECLSPEC_HIDDEN;
1024 const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
1026 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1027 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1028 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1029 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1030 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1032 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1034 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1036 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1037 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1039 /* memory allocation functions */
1041 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
1043 return HeapAlloc(GetProcessHeap(), 0, len);
1046 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
1048 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
1051 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
1053 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
1056 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1058 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1061 static inline BOOL heap_free(void *mem)
1063 return HeapFree(GetProcessHeap(), 0, mem);
1066 static inline LPWSTR heap_strdupW(LPCWSTR str)
1068 LPWSTR ret = NULL;
1070 if(str) {
1071 DWORD size;
1073 size = (strlenW(str)+1)*sizeof(WCHAR);
1074 ret = heap_alloc(size);
1075 if(ret)
1076 memcpy(ret, str, size);
1079 return ret;
1082 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1084 LPWSTR ret = NULL;
1086 if(str) {
1087 ret = heap_alloc((len+1)*sizeof(WCHAR));
1088 if(ret)
1090 memcpy(ret, str, len*sizeof(WCHAR));
1091 ret[len] = 0;
1095 return ret;
1098 static inline char *heap_strdupA(const char *str)
1100 char *ret = NULL;
1102 if(str) {
1103 DWORD size;
1105 size = strlen(str)+1;
1106 ret = heap_alloc(size);
1107 if(ret)
1108 memcpy(ret, str, size);
1111 return ret;
1114 static inline WCHAR *heap_strdupAtoW(const char *str)
1116 LPWSTR ret = NULL;
1118 if(str) {
1119 DWORD len;
1121 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1122 ret = heap_alloc(len*sizeof(WCHAR));
1123 if(ret)
1124 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1127 return ret;
1130 static inline char *heap_strdupWtoA(LPCWSTR str)
1132 char *ret = NULL;
1134 if(str) {
1135 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1136 ret = heap_alloc(size);
1137 if(ret)
1138 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1141 return ret;
1144 static inline WCHAR *heap_strdupUtoW(const char *str)
1146 WCHAR *ret = NULL;
1148 if(str) {
1149 size_t len;
1151 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1152 ret = heap_alloc(len*sizeof(WCHAR));
1153 if(ret)
1154 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1157 return ret;
1160 static inline char *heap_strdupWtoU(const WCHAR *str)
1162 char *ret = NULL;
1164 if(str) {
1165 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1166 ret = heap_alloc(size);
1167 if(ret)
1168 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1171 return ret;
1174 static inline void windowref_addref(windowref_t *ref)
1176 InterlockedIncrement(&ref->ref);
1179 static inline void windowref_release(windowref_t *ref)
1181 if(!InterlockedDecrement(&ref->ref))
1182 heap_free(ref);
1185 HDC get_display_dc(void) DECLSPEC_HIDDEN;
1186 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1187 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1189 extern HINSTANCE hInst DECLSPEC_HIDDEN;