wined3d: Handle hull shader control point outputs.
[wine.git] / dlls / mshtml / mshtml_private.h
blobeceadca9354cc970aa0f7806af7d950dba4bce66
1 /*
2 * Copyright 2005-2009 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "wingdi.h"
20 #include "docobj.h"
21 #include "docobjectservice.h"
22 #include "comcat.h"
23 #include "mshtml.h"
24 #include "mshtmhst.h"
25 #include "hlink.h"
26 #include "perhist.h"
27 #include "dispex.h"
28 #include "objsafe.h"
29 #include "htiframe.h"
30 #include "tlogstg.h"
31 #include "shdeprecated.h"
33 #include "wine/list.h"
34 #include "wine/rbtree.h"
35 #include "wine/unicode.h"
37 #ifdef INIT_GUID
38 #include "initguid.h"
39 #endif
41 #include "nsiface.h"
43 #define NS_ERROR_GENERATE_FAILURE(module,code) \
44 ((nsresult) (((UINT32)(1u<<31)) | ((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
45 #define NS_ERROR_GENERATE_SUCCESS(module,code) \
46 ((nsresult) (((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
48 #define NS_OK ((nsresult)0x00000000L)
49 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
50 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
51 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
52 #define NS_NOINTERFACE ((nsresult)0x80004002L)
53 #define NS_ERROR_INVALID_POINTER ((nsresult)0x80004003L)
54 #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
55 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
56 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
57 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
59 #define NS_ERROR_MODULE_NETWORK 6
61 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
62 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
63 #define NS_SUCCESS_DEFAULT_ACTION NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_NETWORK, 66)
65 #define NS_FAILED(res) ((res) & 0x80000000)
66 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
68 #define NSAPI WINAPI
70 #define MSHTML_E_NODOC 0x800a025c
72 typedef struct HTMLDOMNode HTMLDOMNode;
73 typedef struct ConnectionPoint ConnectionPoint;
74 typedef struct BSCallback BSCallback;
75 typedef struct EventTarget EventTarget;
77 #define TID_LIST \
78 XIID(NULL) \
79 XDIID(DispCEventObj) \
80 XDIID(DispCPlugins) \
81 XDIID(DispDOMChildrenCollection) \
82 XDIID(DispHTMLAnchorElement) \
83 XDIID(DispHTMLAreaElement) \
84 XDIID(DispHTMLAttributeCollection) \
85 XDIID(DispHTMLBody) \
86 XDIID(DispHTMLButtonElement) \
87 XDIID(DispHTMLCommentElement) \
88 XDIID(DispHTMLCurrentStyle) \
89 XDIID(DispHTMLDocument) \
90 XDIID(DispHTMLDOMAttribute) \
91 XDIID(DispHTMLDOMTextNode) \
92 XDIID(DispHTMLElementCollection) \
93 XDIID(DispHTMLEmbed) \
94 XDIID(DispHTMLFormElement) \
95 XDIID(DispHTMLGenericElement) \
96 XDIID(DispHTMLFrameElement) \
97 XDIID(DispHTMLHeadElement) \
98 XDIID(DispHTMLHtmlElement) \
99 XDIID(DispHTMLHistory) \
100 XDIID(DispHTMLIFrame) \
101 XDIID(DispHTMLImg) \
102 XDIID(DispHTMLInputElement) \
103 XDIID(DispHTMLLabelElement) \
104 XDIID(DispHTMLLinkElement) \
105 XDIID(DispHTMLLocation) \
106 XDIID(DispHTMLMetaElement) \
107 XDIID(DispHTMLNavigator) \
108 XDIID(DispHTMLObjectElement) \
109 XDIID(DispHTMLOptionElement) \
110 XDIID(DispHTMLScreen) \
111 XDIID(DispHTMLScriptElement) \
112 XDIID(DispHTMLSelectElement) \
113 XDIID(DispHTMLStyle) \
114 XDIID(DispHTMLStyleElement) \
115 XDIID(DispHTMLStyleSheet) \
116 XDIID(DispHTMLStyleSheetRulesCollection) \
117 XDIID(DispHTMLStyleSheetsCollection) \
118 XDIID(DispHTMLTable) \
119 XDIID(DispHTMLTableCell) \
120 XDIID(DispHTMLTableRow) \
121 XDIID(DispHTMLTextAreaElement) \
122 XDIID(DispHTMLTitleElement) \
123 XDIID(DispHTMLUnknownElement) \
124 XDIID(DispHTMLWindow2) \
125 XDIID(DispHTMLXMLHttpRequest) \
126 XDIID(HTMLDocumentEvents) \
127 XDIID(HTMLElementEvents2) \
128 XIID(IDocumentSelector) \
129 XIID(IElementSelector) \
130 XIID(IHTMLAnchorElement) \
131 XIID(IHTMLAreaElement) \
132 XIID(IHTMLAttributeCollection) \
133 XIID(IHTMLAttributeCollection2) \
134 XIID(IHTMLAttributeCollection3) \
135 XIID(IHTMLBodyElement) \
136 XIID(IHTMLBodyElement2) \
137 XIID(IHTMLButtonElement) \
138 XIID(IHTMLCommentElement) \
139 XIID(IHTMLCurrentStyle) \
140 XIID(IHTMLCurrentStyle2) \
141 XIID(IHTMLCurrentStyle3) \
142 XIID(IHTMLCurrentStyle4) \
143 XIID(IHTMLDocument2) \
144 XIID(IHTMLDocument3) \
145 XIID(IHTMLDocument4) \
146 XIID(IHTMLDocument5) \
147 XIID(IHTMLDocument6) \
148 XIID(IHTMLDOMAttribute) \
149 XIID(IHTMLDOMAttribute2) \
150 XIID(IHTMLDOMChildrenCollection) \
151 XIID(IHTMLDOMImplementation) \
152 XIID(IHTMLDOMNode) \
153 XIID(IHTMLDOMNode2) \
154 XIID(IHTMLDOMTextNode) \
155 XIID(IHTMLDOMTextNode2) \
156 XIID(IHTMLElement) \
157 XIID(IHTMLElement2) \
158 XIID(IHTMLElement3) \
159 XIID(IHTMLElement4) \
160 XIID(IHTMLElement6) \
161 XIID(IHTMLElementCollection) \
162 XIID(IHTMLEmbedElement) \
163 XIID(IHTMLEventObj) \
164 XIID(IHTMLFiltersCollection) \
165 XIID(IHTMLFormElement) \
166 XIID(IHTMLFrameBase) \
167 XIID(IHTMLFrameBase2) \
168 XIID(IHTMLFrameElement3) \
169 XIID(IHTMLGenericElement) \
170 XIID(IHTMLHeadElement) \
171 XIID(IHTMLHtmlElement) \
172 XIID(IHTMLIFrameElement) \
173 XIID(IHTMLIFrameElement2) \
174 XIID(IHTMLIFrameElement3) \
175 XIID(IHTMLImageElementFactory) \
176 XIID(IHTMLImgElement) \
177 XIID(IHTMLInputElement) \
178 XIID(IHTMLLabelElement) \
179 XIID(IHTMLLinkElement) \
180 XIID(IHTMLLocation) \
181 XIID(IHTMLMetaElement) \
182 XIID(IHTMLMimeTypesCollection) \
183 XIID(IHTMLObjectElement) \
184 XIID(IHTMLObjectElement2) \
185 XIID(IHTMLOptionElement) \
186 XIID(IHTMLOptionElementFactory) \
187 XIID(IHTMLPluginsCollection) \
188 XIID(IHTMLRect) \
189 XIID(IHTMLScreen) \
190 XIID(IHTMLScriptElement) \
191 XIID(IHTMLSelectElement) \
192 XIID(IHTMLSelectionObject) \
193 XIID(IHTMLSelectionObject2) \
194 XIID(IHTMLStorage) \
195 XIID(IHTMLStyle) \
196 XIID(IHTMLStyle2) \
197 XIID(IHTMLStyle3) \
198 XIID(IHTMLStyle4) \
199 XIID(IHTMLStyle5) \
200 XIID(IHTMLStyle6) \
201 XIID(IHTMLStyleElement) \
202 XIID(IHTMLStyleSheet) \
203 XIID(IHTMLStyleSheetRulesCollection) \
204 XIID(IHTMLStyleSheetsCollection) \
205 XIID(IHTMLTable) \
206 XIID(IHTMLTable2) \
207 XIID(IHTMLTable3) \
208 XIID(IHTMLTableCell) \
209 XIID(IHTMLTableRow) \
210 XIID(IHTMLTextAreaElement) \
211 XIID(IHTMLTextContainer) \
212 XIID(IHTMLTitleElement) \
213 XIID(IHTMLTxtRange) \
214 XIID(IHTMLUniqueName) \
215 XIID(IHTMLWindow2) \
216 XIID(IHTMLWindow3) \
217 XIID(IHTMLWindow4) \
218 XIID(IHTMLWindow5) \
219 XIID(IHTMLWindow6) \
220 XIID(IHTMLXMLHttpRequest) \
221 XIID(IHTMLXMLHttpRequestFactory) \
222 XIID(IOmHistory) \
223 XIID(IOmNavigator)
225 typedef enum {
226 #define XIID(iface) iface ## _tid,
227 #define XDIID(iface) iface ## _tid,
228 TID_LIST
229 #undef XIID
230 #undef XDIID
231 LAST_tid
232 } tid_t;
234 typedef enum {
235 COMPAT_MODE_QUIRKS,
236 COMPAT_MODE_IE5,
237 COMPAT_MODE_IE7,
238 COMPAT_MODE_IE8,
239 COMPAT_MODE_IE9,
240 COMPAT_MODE_IE10,
241 COMPAT_MODE_IE11
242 } compat_mode_t;
244 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
245 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
247 typedef struct {
248 unsigned document_mode;
249 unsigned ie_version;
250 } compat_mode_info_t;
252 extern const compat_mode_info_t compat_mode_info[COMPAT_MODE_CNT] DECLSPEC_HIDDEN;
254 typedef struct dispex_data_t dispex_data_t;
255 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
257 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
258 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
259 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
261 typedef struct DispatchEx DispatchEx;
263 typedef struct {
264 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
265 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
266 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
267 HRESULT (*populate_props)(DispatchEx*);
268 /* We abuse this vtbl for EventTarget functions to avoid separated vtbl. */
269 EventTarget *(*get_event_target)(DispatchEx*);
270 void (*bind_event)(DispatchEx*,int);
271 } dispex_static_data_vtbl_t;
273 typedef struct {
274 const dispex_static_data_vtbl_t *vtbl;
275 const tid_t disp_tid;
276 const tid_t* const iface_tids;
277 void (*init_info)(dispex_data_t*,compat_mode_t);
278 dispex_data_t *info_cache[COMPAT_MODE_CNT];
279 } dispex_static_data_t;
281 struct DispatchEx {
282 IDispatchEx IDispatchEx_iface;
284 IUnknown *outer;
286 dispex_data_t *info;
287 dispex_dynamic_data_t *dynamic_data;
290 typedef struct {
291 UINT_PTR x;
292 } nsCycleCollectingAutoRefCnt;
294 typedef struct {
295 void *vtbl;
296 int ref_flags;
297 void *callbacks;
298 } ExternalCycleCollectionParticipant;
300 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
302 typedef struct {
303 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
304 nsresult (NSAPI *unlink)(void*);
305 void (NSAPI *delete_cycle_collectable)(void*);
306 } CCObjCallback;
308 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
310 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN;
311 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN;
312 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN;
313 void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN;
314 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
315 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
317 void init_dispex_with_compat_mode(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
318 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
319 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
320 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
321 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
322 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
323 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
324 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
325 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
326 void release_typelib(void) DECLSPEC_HIDDEN;
327 HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**) DECLSPEC_HIDDEN;
328 const dispex_static_data_vtbl_t *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
329 void dispex_info_add_interface(dispex_data_t*,tid_t,const DISPID*) DECLSPEC_HIDDEN;
331 static inline void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *desc)
333 init_dispex_with_compat_mode(dispex, outer, desc, COMPAT_MODE_NONE);
336 typedef enum {
337 DISPEXPROP_CUSTOM,
338 DISPEXPROP_DYNAMIC,
339 DISPEXPROP_BUILTIN
340 } dispex_prop_type_t;
342 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
344 typedef struct HTMLWindow HTMLWindow;
345 typedef struct HTMLInnerWindow HTMLInnerWindow;
346 typedef struct HTMLOuterWindow HTMLOuterWindow;
347 typedef struct HTMLDocumentNode HTMLDocumentNode;
348 typedef struct HTMLDocumentObj HTMLDocumentObj;
349 typedef struct HTMLFrameBase HTMLFrameBase;
350 typedef struct NSContainer NSContainer;
351 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
353 typedef enum {
354 SCRIPTMODE_GECKO,
355 SCRIPTMODE_ACTIVESCRIPT
356 } SCRIPTMODE;
358 typedef struct ScriptHost ScriptHost;
360 typedef enum {
361 GLOBAL_SCRIPTVAR,
362 GLOBAL_ELEMENTVAR,
363 GLOBAL_DISPEXVAR,
364 GLOBAL_FRAMEVAR
365 } global_prop_type_t;
367 typedef struct {
368 global_prop_type_t type;
369 WCHAR *name;
370 ScriptHost *script_host;
371 DISPID id;
372 } global_prop_t;
374 struct EventTarget {
375 DispatchEx dispex;
376 struct wine_rb_tree handler_map;
379 typedef struct {
380 DispatchEx dispex;
381 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
383 LONG ref;
385 HTMLInnerWindow *window;
386 } HTMLOptionElementFactory;
388 typedef struct {
389 DispatchEx dispex;
390 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
392 LONG ref;
394 HTMLInnerWindow *window;
395 } HTMLImageElementFactory;
397 typedef struct {
398 DispatchEx dispex;
399 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
401 LONG ref;
403 HTMLInnerWindow *window;
404 } HTMLXMLHttpRequestFactory;
406 struct HTMLLocation {
407 DispatchEx dispex;
408 IHTMLLocation IHTMLLocation_iface;
410 LONG ref;
412 HTMLInnerWindow *window;
415 typedef struct {
416 DispatchEx dispex;
417 IOmHistory IOmHistory_iface;
419 LONG ref;
421 HTMLInnerWindow *window;
422 } OmHistory;
424 typedef struct {
425 HTMLOuterWindow *window;
426 LONG ref;
427 } windowref_t;
429 typedef struct nsChannelBSC nsChannelBSC;
431 struct HTMLWindow {
432 IHTMLWindow2 IHTMLWindow2_iface;
433 IHTMLWindow3 IHTMLWindow3_iface;
434 IHTMLWindow4 IHTMLWindow4_iface;
435 IHTMLWindow5 IHTMLWindow5_iface;
436 IHTMLWindow6 IHTMLWindow6_iface;
437 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
438 IDispatchEx IDispatchEx_iface;
439 IServiceProvider IServiceProvider_iface;
440 ITravelLogClient ITravelLogClient_iface;
441 IObjectIdentity IObjectIdentity_iface;
442 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
444 LONG ref;
446 HTMLInnerWindow *inner_window;
447 HTMLOuterWindow *outer_window;
450 struct HTMLOuterWindow {
451 HTMLWindow base;
453 windowref_t *window_ref;
454 LONG task_magic;
456 HTMLDocumentObj *doc_obj;
457 nsIDOMWindow *nswindow;
458 mozIDOMWindowProxy *window_proxy;
459 HTMLOuterWindow *parent;
460 HTMLFrameBase *frame_element;
462 READYSTATE readystate;
463 BOOL readystate_locked;
464 unsigned readystate_pending;
466 HTMLInnerWindow *pending_window;
467 IMoniker *mon;
468 IUri *uri;
469 IUri *uri_nofrag;
470 BSTR url;
471 DWORD load_flags;
473 SCRIPTMODE scriptmode;
475 IInternetSecurityManager *secmgr;
477 struct list children;
478 struct list sibling_entry;
479 struct wine_rb_entry entry;
482 struct HTMLInnerWindow {
483 HTMLWindow base;
484 EventTarget event_target;
486 HTMLDocumentNode *doc;
488 struct list script_hosts;
490 IHTMLEventObj *event;
492 HTMLImageElementFactory *image_factory;
493 HTMLOptionElementFactory *option_factory;
494 HTMLXMLHttpRequestFactory *xhr_factory;
495 IHTMLScreen *screen;
496 OmHistory *history;
497 IHTMLStorage *session_storage;
499 unsigned parser_callback_cnt;
500 struct list script_queue;
502 global_prop_t *global_props;
503 DWORD global_prop_cnt;
504 DWORD global_prop_size;
506 LONG task_magic;
508 HTMLLocation *location;
510 IMoniker *mon;
511 nsChannelBSC *bscallback;
512 struct list bindings;
515 typedef enum {
516 UNKNOWN_USERMODE,
517 BROWSEMODE,
518 EDITMODE
519 } USERMODE;
521 typedef struct _cp_static_data_t {
522 tid_t tid;
523 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
524 BOOL pass_event_arg;
525 DWORD id_cnt;
526 DISPID *ids;
527 } cp_static_data_t;
529 typedef struct {
530 const IID *riid;
531 cp_static_data_t *desc;
532 } cpc_entry_t;
534 typedef struct ConnectionPointContainer {
535 IConnectionPointContainer IConnectionPointContainer_iface;
537 ConnectionPoint *cps;
538 const cpc_entry_t *cp_entries;
539 IUnknown *outer;
540 struct ConnectionPointContainer *forward_container;
541 } ConnectionPointContainer;
543 struct ConnectionPoint {
544 IConnectionPoint IConnectionPoint_iface;
546 ConnectionPointContainer *container;
548 union {
549 IUnknown *unk;
550 IDispatch *disp;
551 IPropertyNotifySink *propnotif;
552 } *sinks;
553 DWORD sinks_size;
555 const IID *iid;
556 cp_static_data_t *data;
559 struct HTMLDocument {
560 IHTMLDocument2 IHTMLDocument2_iface;
561 IHTMLDocument3 IHTMLDocument3_iface;
562 IHTMLDocument4 IHTMLDocument4_iface;
563 IHTMLDocument5 IHTMLDocument5_iface;
564 IHTMLDocument6 IHTMLDocument6_iface;
565 IHTMLDocument7 IHTMLDocument7_iface;
566 IDocumentSelector IDocumentSelector_iface;
567 IPersistMoniker IPersistMoniker_iface;
568 IPersistFile IPersistFile_iface;
569 IPersistHistory IPersistHistory_iface;
570 IMonikerProp IMonikerProp_iface;
571 IOleObject IOleObject_iface;
572 IOleDocument IOleDocument_iface;
573 IOleDocumentView IOleDocumentView_iface;
574 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
575 IViewObjectEx IViewObjectEx_iface;
576 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
577 IServiceProvider IServiceProvider_iface;
578 IOleCommandTarget IOleCommandTarget_iface;
579 IOleControl IOleControl_iface;
580 IHlinkTarget IHlinkTarget_iface;
581 IPersistStreamInit IPersistStreamInit_iface;
582 IDispatchEx IDispatchEx_iface;
583 ISupportErrorInfo ISupportErrorInfo_iface;
584 IObjectWithSite IObjectWithSite_iface;
585 IOleContainer IOleContainer_iface;
586 IObjectSafety IObjectSafety_iface;
587 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
589 IUnknown *outer_unk;
590 IDispatchEx *dispex;
592 HTMLDocumentObj *doc_obj;
593 HTMLDocumentNode *doc_node;
595 HTMLOuterWindow *window;
597 LONG task_magic;
599 ConnectionPointContainer cp_container;
600 IOleAdviseHolder *advise_holder;
603 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
605 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
608 static inline ULONG htmldoc_addref(HTMLDocument *This)
610 return IUnknown_AddRef(This->outer_unk);
613 static inline ULONG htmldoc_release(HTMLDocument *This)
615 return IUnknown_Release(This->outer_unk);
618 struct HTMLDocumentObj {
619 HTMLDocument basedoc;
620 DispatchEx dispex;
621 IUnknown IUnknown_outer;
622 ICustomDoc ICustomDoc_iface;
623 ITargetContainer ITargetContainer_iface;
625 IWindowForBindingUI IWindowForBindingUI_iface;
627 LONG ref;
629 NSContainer *nscontainer;
631 IOleClientSite *client;
632 IDocHostUIHandler *hostui;
633 IOleCommandTarget *client_cmdtrg;
634 BOOL custom_hostui;
635 IOleInPlaceSite *ipsite;
636 IOleInPlaceFrame *frame;
637 IOleInPlaceUIWindow *ip_window;
638 IAdviseSink *view_sink;
639 IDocObjectService *doc_object_service;
640 IUnknown *webbrowser;
641 ITravelLog *travel_log;
642 IUnknown *browser_service;
644 DOCHOSTUIINFO hostinfo;
646 IOleUndoManager *undomgr;
647 IHTMLEditServices *editsvcs;
649 HWND hwnd;
650 HWND tooltips_hwnd;
652 BOOL is_mhtml;
653 BOOL request_uiactivate;
654 BOOL in_place_active;
655 BOOL ui_active;
656 BOOL window_active;
657 BOOL hostui_setup;
658 BOOL container_locked;
659 BOOL focus;
660 BOOL has_popup;
661 INT download_state;
663 USERMODE usermode;
664 LPWSTR mime;
666 DWORD update;
669 typedef struct nsWeakReference nsWeakReference;
671 struct NSContainer {
672 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
673 nsIContextMenuListener nsIContextMenuListener_iface;
674 nsIURIContentListener nsIURIContentListener_iface;
675 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
676 nsITooltipListener nsITooltipListener_iface;
677 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
678 nsISupportsWeakReference nsISupportsWeakReference_iface;
680 nsIWebBrowser *webbrowser;
681 nsIWebNavigation *navigation;
682 nsIBaseWindow *window;
683 nsIWebBrowserFocus *focus;
685 nsIEditor *editor;
686 nsIController *editor_controller;
688 LONG ref;
690 nsWeakReference *weak_reference;
692 NSContainer *parent;
693 HTMLDocumentObj *doc;
695 nsIURIContentListener *content_listener;
697 HWND hwnd;
700 typedef struct {
701 const CLSID *clsid;
702 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
703 void (*destructor)(HTMLDOMNode*);
704 const cpc_entry_t *cpc_entries;
705 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
706 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
707 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
708 EventTarget *(*get_event_target)(HTMLDOMNode*);
709 HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*);
710 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
711 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
712 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
713 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
714 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
715 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
716 HRESULT (*bind_to_tree)(HTMLDOMNode*);
717 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
718 void (*unlink)(HTMLDOMNode*);
719 BOOL (*is_text_edit)(HTMLDOMNode*);
720 BOOL (*is_settable)(HTMLDOMNode*,DISPID);
721 } NodeImplVtbl;
723 struct HTMLDOMNode {
724 EventTarget event_target;
725 IHTMLDOMNode IHTMLDOMNode_iface;
726 IHTMLDOMNode2 IHTMLDOMNode2_iface;
727 const NodeImplVtbl *vtbl;
729 nsCycleCollectingAutoRefCnt ccref;
731 nsIDOMNode *nsnode;
732 HTMLDocumentNode *doc;
733 ConnectionPointContainer *cp_container;
736 static inline void node_addref(HTMLDOMNode *node)
738 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
741 static inline void node_release(HTMLDOMNode *node)
743 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
746 typedef struct {
747 HTMLDOMNode node;
748 ConnectionPointContainer cp_container;
750 IHTMLElement IHTMLElement_iface;
751 IHTMLElement2 IHTMLElement2_iface;
752 IHTMLElement3 IHTMLElement3_iface;
753 IHTMLElement4 IHTMLElement4_iface;
754 IHTMLElement6 IHTMLElement6_iface;
755 IHTMLUniqueName IHTMLUniqueName_iface;
756 IElementSelector IElementSelector_iface;
757 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
759 nsIDOMHTMLElement *nselem;
760 HTMLStyle *style;
761 HTMLStyle *runtime_style;
762 HTMLAttributeCollection *attrs;
763 WCHAR *filter;
764 unsigned unique_id;
765 } HTMLElement;
767 #define HTMLELEMENT_TIDS \
768 IHTMLDOMNode_tid, \
769 IHTMLDOMNode2_tid, \
770 IHTMLElement_tid, \
771 IHTMLElement3_tid, \
772 IHTMLElement4_tid, \
773 IHTMLUniqueName_tid
775 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN;
776 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
777 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN;
779 typedef struct {
780 HTMLElement element;
782 IHTMLTextContainer IHTMLTextContainer_iface;
783 } HTMLTextContainer;
785 struct HTMLFrameBase {
786 HTMLElement element;
788 IHTMLFrameBase IHTMLFrameBase_iface;
789 IHTMLFrameBase2 IHTMLFrameBase2_iface;
791 HTMLOuterWindow *content_window;
793 nsIDOMHTMLFrameElement *nsframe;
794 nsIDOMHTMLIFrameElement *nsiframe;
797 typedef struct nsDocumentEventListener nsDocumentEventListener;
799 struct HTMLDocumentNode {
800 HTMLDOMNode node;
801 HTMLDocument basedoc;
803 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
805 nsIDocumentObserver nsIDocumentObserver_iface;
807 LONG ref;
809 compat_mode_t document_mode;
810 HTMLInnerWindow *window;
812 nsIDOMHTMLDocument *nsdoc;
813 BOOL content_ready;
815 IHTMLDOMImplementation *dom_implementation;
817 ICatInformation *catmgr;
818 nsDocumentEventListener *nsevent_listener;
819 BOOL *event_vector;
821 WCHAR **elem_vars;
822 unsigned elem_vars_size;
823 unsigned elem_vars_cnt;
825 BOOL skip_mutation_notif;
827 UINT charset;
829 unsigned unique_id;
831 struct list selection_list;
832 struct list range_list;
833 struct list plugin_hosts;
836 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
837 HRESULT MHTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
838 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
839 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
841 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
842 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
843 HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*) DECLSPEC_HIDDEN;
844 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
845 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
846 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
847 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN;
848 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
849 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
850 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
851 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
852 HRESULT create_dom_implementation(IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
854 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
856 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
857 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
858 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
859 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN;
860 void HTMLDocument_Window_Init(HTMLDocument*) DECLSPEC_HIDDEN;
861 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
862 void HTMLDocument_Hlink_Init(HTMLDocument*) DECLSPEC_HIDDEN;
864 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
865 void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN;
867 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
869 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
871 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
872 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
874 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
875 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
877 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
878 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
879 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
880 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
882 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
883 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
884 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
886 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
887 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
888 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
890 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN;
892 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
894 BOOL load_gecko(void) DECLSPEC_HIDDEN;
895 void close_gecko(void) DECLSPEC_HIDDEN;
896 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
897 void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
898 void release_nsio(void) DECLSPEC_HIDDEN;
899 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
900 void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN;
902 void init_node_cc(void) DECLSPEC_HIDDEN;
904 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
906 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
908 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
909 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
911 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
912 void nsfree(void*) DECLSPEC_HIDDEN;
914 BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN;
915 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
916 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
917 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
918 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
920 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
921 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
922 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
923 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
925 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
927 static inline HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p)
929 V_VT(p) = VT_BSTR;
930 return return_nsstr(nsres, nsstr, &V_BSTR(p));
933 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
934 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
935 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
936 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
937 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
938 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN;
939 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
940 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
942 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
943 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
944 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
945 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
946 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
947 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
949 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
950 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
952 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
953 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
954 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
955 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
957 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
958 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
959 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
960 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
962 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
963 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
965 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
967 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
968 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
971 struct HTMLAttributeCollection {
972 DispatchEx dispex;
973 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
974 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
975 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
977 LONG ref;
979 HTMLElement *elem;
980 struct list attrs;
983 typedef struct {
984 DispatchEx dispex;
985 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
986 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
988 LONG ref;
990 /* value is valid only for detached attributes (when elem == NULL). */
991 VARIANT value;
992 /* name must be valid for detached attributes */
993 WCHAR *name;
995 HTMLElement *elem;
996 DISPID dispid;
997 struct list entry;
998 } HTMLDOMAttribute;
1000 HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*) DECLSPEC_HIDDEN;
1002 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
1004 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
1005 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
1006 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1007 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1008 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1009 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1010 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1011 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1012 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1013 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1014 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1015 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1016 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1017 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1018 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1019 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1020 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1021 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1022 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1023 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1024 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1025 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1026 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1027 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1028 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1029 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1030 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1031 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
1033 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*) DECLSPEC_HIDDEN;
1034 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1035 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1036 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1038 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1039 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1041 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1042 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1043 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1044 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
1045 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1046 void HTMLElement_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1048 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
1049 void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN;
1051 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
1052 HRESULT get_elem(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1054 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
1056 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
1057 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
1058 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1059 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
1060 HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1062 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
1064 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
1065 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
1066 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
1067 IHTMLDOMChildrenCollection *create_child_collection(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
1069 HRESULT attr_value_to_string(VARIANT*) DECLSPEC_HIDDEN;
1070 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
1071 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN;
1073 nsresult get_elem_attr_value(nsIDOMHTMLElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
1074 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
1075 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
1077 HRESULT elem_unique_id(unsigned id, BSTR *p) DECLSPEC_HIDDEN;
1079 /* commands */
1080 typedef struct {
1081 DWORD id;
1082 HRESULT (*query)(HTMLDocument*,OLECMD*);
1083 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
1084 } cmdtable_t;
1086 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
1088 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
1090 /* timer */
1091 #define UPDATE_UI 0x0001
1092 #define UPDATE_TITLE 0x0002
1094 void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN;
1095 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1096 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
1098 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
1100 /* editor */
1101 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1102 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
1103 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
1104 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1105 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1106 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1107 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
1108 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
1109 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
1111 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
1113 typedef struct task_t task_t;
1114 typedef void (*task_proc_t)(task_t*);
1116 struct task_t {
1117 LONG target_magic;
1118 task_proc_t proc;
1119 task_proc_t destr;
1120 struct list entry;
1123 typedef struct {
1124 task_t header;
1125 HTMLDocumentObj *doc;
1126 } docobj_task_t;
1128 typedef struct {
1129 HWND thread_hwnd;
1130 struct list task_list;
1131 struct list timer_list;
1132 } thread_data_t;
1134 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1135 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1137 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1138 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1139 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1140 void flush_pending_tasks(LONG) DECLSPEC_HIDDEN;
1142 HRESULT set_task_timer(HTMLInnerWindow*,LONG,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1143 HRESULT clear_task_timer(HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
1145 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1147 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1148 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1149 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1150 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1151 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1153 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1155 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1157 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1158 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1160 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1161 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1163 /* memory allocation functions */
1165 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
1167 return HeapAlloc(GetProcessHeap(), 0, len);
1170 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
1172 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
1175 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
1177 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
1180 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1182 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1185 static inline BOOL heap_free(void *mem)
1187 return HeapFree(GetProcessHeap(), 0, mem);
1190 static inline LPWSTR heap_strdupW(LPCWSTR str)
1192 LPWSTR ret = NULL;
1194 if(str) {
1195 DWORD size;
1197 size = (strlenW(str)+1)*sizeof(WCHAR);
1198 ret = heap_alloc(size);
1199 if(ret)
1200 memcpy(ret, str, size);
1203 return ret;
1206 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1208 LPWSTR ret = NULL;
1210 if(str) {
1211 ret = heap_alloc((len+1)*sizeof(WCHAR));
1212 if(ret)
1214 memcpy(ret, str, len*sizeof(WCHAR));
1215 ret[len] = 0;
1219 return ret;
1222 static inline char *heap_strdupA(const char *str)
1224 char *ret = NULL;
1226 if(str) {
1227 DWORD size;
1229 size = strlen(str)+1;
1230 ret = heap_alloc(size);
1231 if(ret)
1232 memcpy(ret, str, size);
1235 return ret;
1238 static inline WCHAR *heap_strdupAtoW(const char *str)
1240 LPWSTR ret = NULL;
1242 if(str) {
1243 DWORD len;
1245 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1246 ret = heap_alloc(len*sizeof(WCHAR));
1247 if(ret)
1248 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1251 return ret;
1254 static inline char *heap_strdupWtoA(LPCWSTR str)
1256 char *ret = NULL;
1258 if(str) {
1259 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1260 ret = heap_alloc(size);
1261 if(ret)
1262 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1265 return ret;
1268 static inline WCHAR *heap_strdupUtoW(const char *str)
1270 WCHAR *ret = NULL;
1272 if(str) {
1273 size_t len;
1275 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1276 ret = heap_alloc(len*sizeof(WCHAR));
1277 if(ret)
1278 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1281 return ret;
1284 static inline char *heap_strdupWtoU(const WCHAR *str)
1286 char *ret = NULL;
1288 if(str) {
1289 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1290 ret = heap_alloc(size);
1291 if(ret)
1292 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1295 return ret;
1298 static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len)
1300 char *ret = NULL;
1301 DWORD size;
1303 if(str && len) {
1304 size = WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL);
1305 ret = heap_alloc(size + 1);
1306 if(ret) {
1307 WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL);
1308 ret[size] = '\0';
1312 return ret;
1315 static inline void windowref_addref(windowref_t *ref)
1317 InterlockedIncrement(&ref->ref);
1320 static inline void windowref_release(windowref_t *ref)
1322 if(!InterlockedDecrement(&ref->ref))
1323 heap_free(ref);
1326 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
1327 BSTR charset_string_from_cp(UINT) DECLSPEC_HIDDEN;
1328 HDC get_display_dc(void) DECLSPEC_HIDDEN;
1329 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1330 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1332 extern HINSTANCE hInst DECLSPEC_HIDDEN;