include: Add AACMFTEncoder coclass.
[wine.git] / dlls / mshtml / mshtml_private.h
blob7ce97e010531345e54edb99ef19d416cec4d1d6d
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/heap.h"
34 #include "wine/list.h"
35 #include "wine/rbtree.h"
37 #ifdef INIT_GUID
38 #include "initguid.h"
39 #endif
41 #include "nsiface.h"
43 #include "mshtml_private_iface.h"
45 #include <assert.h>
47 #define NS_ERROR_GENERATE_FAILURE(module,code) \
48 ((nsresult) (((UINT32)(1u<<31)) | ((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
49 #define NS_ERROR_GENERATE_SUCCESS(module,code) \
50 ((nsresult) (((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
52 #define NS_OK ((nsresult)0x00000000L)
53 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
54 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
55 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
56 #define NS_NOINTERFACE ((nsresult)0x80004002L)
57 #define NS_ERROR_INVALID_POINTER ((nsresult)0x80004003L)
58 #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
59 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
60 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
61 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
62 #define NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ((nsresult)0x80530007)
64 #define NS_ERROR_MODULE_NETWORK 6
66 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
67 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
68 #define NS_SUCCESS_DEFAULT_ACTION NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_NETWORK, 66)
70 #define NS_FAILED(res) ((res) & 0x80000000)
71 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
73 #define NSAPI WINAPI
75 #define MSHTML_E_NODOC 0x800a025c
77 typedef struct HTMLDOMNode HTMLDOMNode;
78 typedef struct ConnectionPoint ConnectionPoint;
79 typedef struct BSCallback BSCallback;
80 typedef struct EventTarget EventTarget;
82 #define TID_LIST \
83 XIID(NULL) \
84 XDIID(DispCEventObj) \
85 XDIID(DispCPlugins) \
86 XDIID(DispDOMChildrenCollection) \
87 XDIID(DispDOMCustomEvent) \
88 XDIID(DispDOMEvent) \
89 XDIID(DispDOMKeyboardEvent) \
90 XDIID(DispDOMMouseEvent) \
91 XDIID(DispDOMUIEvent) \
92 XDIID(DispHTMLAnchorElement) \
93 XDIID(DispHTMLAreaElement) \
94 XDIID(DispHTMLAttributeCollection) \
95 XDIID(DispHTMLBody) \
96 XDIID(DispHTMLButtonElement) \
97 XDIID(DispHTMLCommentElement) \
98 XDIID(DispHTMLCurrentStyle) \
99 XDIID(DispHTMLDocument) \
100 XDIID(DispHTMLDOMAttribute) \
101 XDIID(DispHTMLDOMImplementation) \
102 XDIID(DispHTMLDOMRange) \
103 XDIID(DispHTMLDOMTextNode) \
104 XDIID(DispHTMLElementCollection) \
105 XDIID(DispHTMLEmbed) \
106 XDIID(DispHTMLFormElement) \
107 XDIID(DispHTMLGenericElement) \
108 XDIID(DispHTMLFrameElement) \
109 XDIID(DispHTMLHeadElement) \
110 XDIID(DispHTMLHtmlElement) \
111 XDIID(DispHTMLHistory) \
112 XDIID(DispHTMLIFrame) \
113 XDIID(DispHTMLImg) \
114 XDIID(DispHTMLInputElement) \
115 XDIID(DispHTMLLabelElement) \
116 XDIID(DispHTMLLinkElement) \
117 XDIID(DispHTMLLocation) \
118 XDIID(DispHTMLMetaElement) \
119 XDIID(DispHTMLNamespaceCollection) \
120 XDIID(DispHTMLNavigator) \
121 XDIID(DispHTMLObjectElement) \
122 XDIID(DispHTMLOptionElement) \
123 XDIID(DispHTMLScreen) \
124 XDIID(DispHTMLScriptElement) \
125 XDIID(DispHTMLSelectElement) \
126 XDIID(DispHTMLStyle) \
127 XDIID(DispHTMLStyleElement) \
128 XDIID(DispHTMLStyleSheet) \
129 XDIID(DispHTMLStyleSheetRule) \
130 XDIID(DispHTMLStyleSheetRulesCollection) \
131 XDIID(DispHTMLStyleSheetsCollection) \
132 XDIID(DispHTMLTable) \
133 XDIID(DispHTMLTableCell) \
134 XDIID(DispHTMLTableRow) \
135 XDIID(DispHTMLTextAreaElement) \
136 XDIID(DispHTMLTitleElement) \
137 XDIID(DispHTMLUnknownElement) \
138 XDIID(DispHTMLW3CComputedStyle) \
139 XDIID(DispHTMLWindow2) \
140 XDIID(DispHTMLXMLHttpRequest) \
141 XDIID(DispSVGCircleElement) \
142 XDIID(DispSVGSVGElement) \
143 XDIID(DispSVGTSpanElement) \
144 XDIID(HTMLDocumentEvents) \
145 XDIID(HTMLDocumentEvents2) \
146 XDIID(HTMLElementEvents2) \
147 XIID(IDOMCustomEvent) \
148 XIID(IDOMEvent) \
149 XIID(IDOMKeyboardEvent) \
150 XIID(IDOMMouseEvent) \
151 XIID(IDOMUIEvent) \
152 XIID(IDocumentEvent) \
153 XIID(IDocumentRange) \
154 XIID(IDocumentSelector) \
155 XIID(IElementSelector) \
156 XIID(IElementTraversal) \
157 XIID(IEventTarget) \
158 XIID(IHTMLAnchorElement) \
159 XIID(IHTMLAreaElement) \
160 XIID(IHTMLAttributeCollection) \
161 XIID(IHTMLAttributeCollection2) \
162 XIID(IHTMLAttributeCollection3) \
163 XIID(IHTMLBodyElement) \
164 XIID(IHTMLBodyElement2) \
165 XIID(IHTMLButtonElement) \
166 XIID(IHTMLCSSStyleDeclaration) \
167 XIID(IHTMLCSSStyleDeclaration2) \
168 XIID(IHTMLCommentElement) \
169 XIID(IHTMLCurrentStyle) \
170 XIID(IHTMLCurrentStyle2) \
171 XIID(IHTMLCurrentStyle3) \
172 XIID(IHTMLCurrentStyle4) \
173 XIID(IHTMLDocument2) \
174 XIID(IHTMLDocument3) \
175 XIID(IHTMLDocument4) \
176 XIID(IHTMLDocument5) \
177 XIID(IHTMLDocument6) \
178 XIID(IHTMLDocument7) \
179 XIID(IHTMLDOMAttribute) \
180 XIID(IHTMLDOMAttribute2) \
181 XIID(IHTMLDOMChildrenCollection) \
182 XIID(IHTMLDOMImplementation) \
183 XIID(IHTMLDOMImplementation2) \
184 XIID(IHTMLDOMNode) \
185 XIID(IHTMLDOMNode2) \
186 XIID(IHTMLDOMNode3) \
187 XIID(IHTMLDOMRange) \
188 XIID(IHTMLDOMTextNode) \
189 XIID(IHTMLDOMTextNode2) \
190 XIID(IHTMLElement) \
191 XIID(IHTMLElement2) \
192 XIID(IHTMLElement3) \
193 XIID(IHTMLElement4) \
194 XIID(IHTMLElement6) \
195 XIID(IHTMLElement7) \
196 XIID(IHTMLElementCollection) \
197 XIID(IHTMLEmbedElement) \
198 XIID(IHTMLEventObj) \
199 XIID(IHTMLFiltersCollection) \
200 XIID(IHTMLFormElement) \
201 XIID(IHTMLFrameBase) \
202 XIID(IHTMLFrameBase2) \
203 XIID(IHTMLFrameElement3) \
204 XIID(IHTMLGenericElement) \
205 XIID(IHTMLHeadElement) \
206 XIID(IHTMLHtmlElement) \
207 XIID(IHTMLIFrameElement) \
208 XIID(IHTMLIFrameElement2) \
209 XIID(IHTMLIFrameElement3) \
210 XIID(IHTMLImageElementFactory) \
211 XIID(IHTMLImgElement) \
212 XIID(IHTMLInputElement) \
213 XIID(IHTMLInputTextElement2) \
214 XIID(IHTMLLabelElement) \
215 XIID(IHTMLLinkElement) \
216 XIID(IHTMLLocation) \
217 XIID(IHTMLMetaElement) \
218 XIID(IHTMLMimeTypesCollection) \
219 XIID(IHTMLNamespaceCollection) \
220 XIID(IHTMLObjectElement) \
221 XIID(IHTMLObjectElement2) \
222 XIID(IHTMLOptionElement) \
223 XIID(IHTMLOptionElementFactory) \
224 XIID(IHTMLPerformance) \
225 XIID(IHTMLPerformanceNavigation) \
226 XIID(IHTMLPerformanceTiming) \
227 XIID(IHTMLPluginsCollection) \
228 XIID(IHTMLRect) \
229 XIID(IHTMLRectCollection) \
230 XIID(IHTMLScreen) \
231 XIID(IHTMLScriptElement) \
232 XIID(IHTMLSelectElement) \
233 XIID(IHTMLSelectionObject) \
234 XIID(IHTMLSelectionObject2) \
235 XIID(IHTMLStorage) \
236 XIID(IHTMLStyle) \
237 XIID(IHTMLStyle2) \
238 XIID(IHTMLStyle3) \
239 XIID(IHTMLStyle4) \
240 XIID(IHTMLStyle5) \
241 XIID(IHTMLStyle6) \
242 XIID(IHTMLStyleElement) \
243 XIID(IHTMLStyleElement2) \
244 XIID(IHTMLStyleSheet) \
245 XIID(IHTMLStyleSheet4) \
246 XIID(IHTMLStyleSheetRule) \
247 XIID(IHTMLStyleSheetRulesCollection) \
248 XIID(IHTMLStyleSheetsCollection) \
249 XIID(IHTMLTable) \
250 XIID(IHTMLTable2) \
251 XIID(IHTMLTable3) \
252 XIID(IHTMLTableCell) \
253 XIID(IHTMLTableRow) \
254 XIID(IHTMLTextAreaElement) \
255 XIID(IHTMLTextContainer) \
256 XIID(IHTMLTitleElement) \
257 XIID(IHTMLTxtRange) \
258 XIID(IHTMLUniqueName) \
259 XIID(IHTMLWindow2) \
260 XIID(IHTMLWindow3) \
261 XIID(IHTMLWindow4) \
262 XIID(IHTMLWindow5) \
263 XIID(IHTMLWindow6) \
264 XIID(IHTMLWindow7) \
265 XIID(IHTMLXMLHttpRequest) \
266 XIID(IHTMLXMLHttpRequestFactory) \
267 XIID(IOmHistory) \
268 XIID(IOmNavigator) \
269 XIID(ISVGCircleElement) \
270 XIID(ISVGElement) \
271 XIID(ISVGSVGElement) \
272 XIID(ISVGTSpanElement) \
273 XIID(ISVGTextContentElement)
275 #define PRIVATE_TID_LIST \
276 XIID(IWineDOMTokenList) \
277 XIID(IWineHTMLElementPrivate) \
278 XIID(IWineHTMLWindowPrivate) \
279 XIID(IWineHTMLWindowCompatPrivate) \
280 XIID(IWineMSHTMLConsole)
282 typedef enum {
283 #define XIID(iface) iface ## _tid,
284 #define XDIID(iface) iface ## _tid,
285 TID_LIST
286 LAST_public_tid,
287 PRIVATE_TID_LIST
288 #undef XIID
289 #undef XDIID
290 LAST_tid
291 } tid_t;
293 typedef enum {
294 COMPAT_MODE_QUIRKS,
295 COMPAT_MODE_IE5,
296 COMPAT_MODE_IE7,
297 COMPAT_MODE_IE8,
298 COMPAT_MODE_IE9,
299 COMPAT_MODE_IE10,
300 COMPAT_MODE_IE11
301 } compat_mode_t;
303 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
304 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
306 typedef struct {
307 unsigned document_mode;
308 unsigned ie_version;
309 } compat_mode_info_t;
311 extern const compat_mode_info_t compat_mode_info[COMPAT_MODE_CNT] DECLSPEC_HIDDEN;
313 typedef struct dispex_data_t dispex_data_t;
314 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
316 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
317 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
318 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
320 typedef struct DispatchEx DispatchEx;
322 typedef struct {
323 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
324 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
325 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
326 compat_mode_t (*get_compat_mode)(DispatchEx*);
327 HRESULT (*populate_props)(DispatchEx*);
328 } dispex_static_data_vtbl_t;
330 typedef struct {
331 const WCHAR *name;
332 const dispex_static_data_vtbl_t *vtbl;
333 const tid_t disp_tid;
334 const tid_t* const iface_tids;
335 void (*init_info)(dispex_data_t*,compat_mode_t);
336 dispex_data_t *info_cache[COMPAT_MODE_CNT];
337 dispex_data_t *delayed_init_info;
338 } dispex_static_data_t;
340 typedef HRESULT (*dispex_hook_invoke_t)(DispatchEx*,WORD,DISPPARAMS*,VARIANT*,
341 EXCEPINFO*,IServiceProvider*);
343 typedef struct {
344 DISPID dispid;
345 dispex_hook_invoke_t invoke;
346 } dispex_hook_t;
348 struct DispatchEx {
349 IDispatchEx IDispatchEx_iface;
351 IUnknown *outer;
353 dispex_data_t *info;
354 dispex_dynamic_data_t *dynamic_data;
357 typedef struct {
358 UINT_PTR x;
359 } nsCycleCollectingAutoRefCnt;
361 typedef struct {
362 void *vtbl;
363 int ref_flags;
364 void *callbacks;
365 } ExternalCycleCollectionParticipant;
367 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
369 typedef struct {
370 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
371 nsresult (NSAPI *unlink)(void*);
372 void (NSAPI *delete_cycle_collectable)(void*);
373 } CCObjCallback;
375 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
377 extern nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN;
378 extern nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN;
379 extern void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN;
380 extern void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN;
381 extern void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
382 extern void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
384 void init_dispatch(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
385 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
386 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
387 HRESULT change_type(VARIANT*,VARIANT*,VARTYPE,IServiceProvider*) DECLSPEC_HIDDEN;
388 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
389 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
390 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
391 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
392 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
393 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
394 void release_typelib(void) DECLSPEC_HIDDEN;
395 HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**) DECLSPEC_HIDDEN;
396 const void *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
397 void dispex_info_add_interface(dispex_data_t*,tid_t,const dispex_hook_t*) DECLSPEC_HIDDEN;
398 compat_mode_t dispex_compat_mode(DispatchEx*) DECLSPEC_HIDDEN;
399 HRESULT dispex_to_string(DispatchEx*,BSTR*) DECLSPEC_HIDDEN;
400 HRESULT dispex_call_builtin(DispatchEx *dispex, DISPID id, DISPPARAMS *dp,
401 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) DECLSPEC_HIDDEN;
403 typedef enum {
404 DISPEXPROP_CUSTOM,
405 DISPEXPROP_DYNAMIC,
406 DISPEXPROP_BUILTIN
407 } dispex_prop_type_t;
409 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
411 typedef struct HTMLWindow HTMLWindow;
412 typedef struct HTMLInnerWindow HTMLInnerWindow;
413 typedef struct HTMLOuterWindow HTMLOuterWindow;
414 typedef struct HTMLDocumentNode HTMLDocumentNode;
415 typedef struct HTMLDocumentObj HTMLDocumentObj;
416 typedef struct HTMLFrameBase HTMLFrameBase;
417 typedef struct GeckoBrowser GeckoBrowser;
418 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
420 typedef struct ScriptHost ScriptHost;
422 typedef enum {
423 GLOBAL_SCRIPTVAR,
424 GLOBAL_ELEMENTVAR,
425 GLOBAL_DISPEXVAR,
426 GLOBAL_FRAMEVAR
427 } global_prop_type_t;
429 typedef struct {
430 global_prop_type_t type;
431 WCHAR *name;
432 ScriptHost *script_host;
433 DISPID id;
434 } global_prop_t;
436 struct EventTarget {
437 DispatchEx dispex;
438 IEventTarget IEventTarget_iface;
439 struct wine_rb_tree handler_map;
442 typedef struct {
443 DispatchEx dispex;
444 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
446 LONG ref;
448 HTMLInnerWindow *window;
449 } HTMLOptionElementFactory;
451 typedef struct {
452 DispatchEx dispex;
453 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
455 LONG ref;
457 HTMLInnerWindow *window;
458 } HTMLImageElementFactory;
460 typedef struct {
461 DispatchEx dispex;
462 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
464 LONG ref;
466 HTMLInnerWindow *window;
467 } HTMLXMLHttpRequestFactory;
469 struct HTMLLocation {
470 DispatchEx dispex;
471 IHTMLLocation IHTMLLocation_iface;
473 LONG ref;
475 HTMLInnerWindow *window;
478 typedef struct {
479 DispatchEx dispex;
480 IOmHistory IOmHistory_iface;
482 LONG ref;
484 HTMLInnerWindow *window;
485 } OmHistory;
487 typedef struct nsChannelBSC nsChannelBSC;
489 struct HTMLWindow {
490 IHTMLWindow2 IHTMLWindow2_iface;
491 IHTMLWindow3 IHTMLWindow3_iface;
492 IHTMLWindow4 IHTMLWindow4_iface;
493 IHTMLWindow5 IHTMLWindow5_iface;
494 IHTMLWindow6 IHTMLWindow6_iface;
495 IHTMLWindow7 IHTMLWindow7_iface;
496 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
497 IDispatchEx IDispatchEx_iface;
498 IServiceProvider IServiceProvider_iface;
499 ITravelLogClient ITravelLogClient_iface;
500 IObjectIdentity IObjectIdentity_iface;
501 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
502 IWineHTMLWindowPrivate IWineHTMLWindowPrivate_iface;
503 IWineHTMLWindowCompatPrivate IWineHTMLWindowCompatPrivate_iface;
505 IWineMSHTMLConsole *console;
507 LONG ref;
509 HTMLInnerWindow *inner_window;
510 HTMLOuterWindow *outer_window;
513 struct HTMLOuterWindow {
514 HTMLWindow base;
516 LONG task_magic;
518 nsIDOMWindow *nswindow;
519 mozIDOMWindowProxy *window_proxy;
520 HTMLOuterWindow *parent;
521 HTMLFrameBase *frame_element;
523 GeckoBrowser *browser;
524 struct list browser_entry;
526 READYSTATE readystate;
527 BOOL readystate_locked;
528 unsigned readystate_pending;
530 HTMLInnerWindow *pending_window;
531 IMoniker *mon;
532 IUri *uri;
533 IUri *uri_nofrag;
534 BSTR url;
535 DWORD load_flags;
537 struct list sibling_entry;
538 struct wine_rb_entry entry;
541 struct HTMLInnerWindow {
542 HTMLWindow base;
543 EventTarget event_target;
545 HTMLDocumentNode *doc;
547 struct list children;
548 struct list script_hosts;
550 IHTMLEventObj *event;
552 HTMLImageElementFactory *image_factory;
553 HTMLOptionElementFactory *option_factory;
554 HTMLXMLHttpRequestFactory *xhr_factory;
555 IHTMLScreen *screen;
556 OmHistory *history;
557 IOmNavigator *navigator;
558 IHTMLStorage *session_storage;
559 IHTMLStorage *local_storage;
561 BOOL performance_initialized;
562 VARIANT performance;
564 unsigned parser_callback_cnt;
565 struct list script_queue;
567 global_prop_t *global_props;
568 DWORD global_prop_cnt;
569 DWORD global_prop_size;
571 LONG task_magic;
573 HTMLLocation *location;
575 IMoniker *mon;
576 nsChannelBSC *bscallback;
577 struct list bindings;
580 typedef enum {
581 UNKNOWN_USERMODE,
582 BROWSEMODE,
583 EDITMODE
584 } USERMODE;
586 typedef struct _cp_static_data_t {
587 tid_t tid;
588 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
589 BOOL pass_event_arg;
590 DWORD id_cnt;
591 DISPID *ids;
592 } cp_static_data_t;
594 typedef struct {
595 const IID *riid;
596 cp_static_data_t *desc;
597 } cpc_entry_t;
599 typedef struct ConnectionPointContainer {
600 IConnectionPointContainer IConnectionPointContainer_iface;
602 ConnectionPoint *cps;
603 const cpc_entry_t *cp_entries;
604 IUnknown *outer;
605 struct ConnectionPointContainer *forward_container;
606 } ConnectionPointContainer;
608 struct ConnectionPoint {
609 IConnectionPoint IConnectionPoint_iface;
611 ConnectionPointContainer *container;
613 union {
614 IUnknown *unk;
615 IDispatch *disp;
616 IPropertyNotifySink *propnotif;
617 } *sinks;
618 DWORD sinks_size;
620 const IID *iid;
621 cp_static_data_t *data;
624 struct HTMLDocument {
625 IHTMLDocument2 IHTMLDocument2_iface;
626 IHTMLDocument3 IHTMLDocument3_iface;
627 IHTMLDocument4 IHTMLDocument4_iface;
628 IHTMLDocument5 IHTMLDocument5_iface;
629 IHTMLDocument6 IHTMLDocument6_iface;
630 IHTMLDocument7 IHTMLDocument7_iface;
631 IDocumentSelector IDocumentSelector_iface;
632 IDocumentEvent IDocumentEvent_iface;
633 IPersistMoniker IPersistMoniker_iface;
634 IPersistFile IPersistFile_iface;
635 IPersistHistory IPersistHistory_iface;
636 IMonikerProp IMonikerProp_iface;
637 IOleObject IOleObject_iface;
638 IOleDocument IOleDocument_iface;
639 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
640 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
641 IServiceProvider IServiceProvider_iface;
642 IOleCommandTarget IOleCommandTarget_iface;
643 IOleControl IOleControl_iface;
644 IHlinkTarget IHlinkTarget_iface;
645 IPersistStreamInit IPersistStreamInit_iface;
646 IDispatchEx IDispatchEx_iface;
647 ISupportErrorInfo ISupportErrorInfo_iface;
648 IObjectWithSite IObjectWithSite_iface;
649 IOleContainer IOleContainer_iface;
650 IObjectSafety IObjectSafety_iface;
651 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
652 IMarkupServices IMarkupServices_iface;
653 IMarkupContainer IMarkupContainer_iface;
654 IDisplayServices IDisplayServices_iface;
655 IDocumentRange IDocumentRange_iface;
657 IUnknown *outer_unk;
658 IDispatchEx *dispex;
660 HTMLDocumentObj *doc_obj;
661 HTMLDocumentNode *doc_node;
663 HTMLOuterWindow *window;
665 ConnectionPointContainer cp_container;
668 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
670 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
673 static inline ULONG htmldoc_addref(HTMLDocument *This)
675 return IUnknown_AddRef(This->outer_unk);
678 static inline ULONG htmldoc_release(HTMLDocument *This)
680 return IUnknown_Release(This->outer_unk);
683 struct HTMLDocumentObj {
684 HTMLDocument basedoc;
685 DispatchEx dispex;
686 IUnknown IUnknown_inner;
687 ICustomDoc ICustomDoc_iface;
688 IOleDocumentView IOleDocumentView_iface;
689 IViewObjectEx IViewObjectEx_iface;
690 ITargetContainer ITargetContainer_iface;
692 IWindowForBindingUI IWindowForBindingUI_iface;
694 LONG ref;
696 GeckoBrowser *nscontainer;
698 IOleClientSite *client;
699 IDocHostUIHandler *hostui;
700 IOleCommandTarget *client_cmdtrg;
701 BOOL custom_hostui;
702 IOleInPlaceSite *ipsite;
703 IOleInPlaceFrame *frame;
704 IOleInPlaceUIWindow *ip_window;
705 IAdviseSink *view_sink;
706 IDocObjectService *doc_object_service;
707 IUnknown *webbrowser;
708 ITravelLog *travel_log;
709 IUnknown *browser_service;
710 IOleAdviseHolder *advise_holder;
712 DOCHOSTUIINFO hostinfo;
714 IOleUndoManager *undomgr;
715 IHTMLEditServices *editsvcs;
717 HWND hwnd;
718 HWND tooltips_hwnd;
720 BOOL is_mhtml;
721 BOOL request_uiactivate;
722 BOOL in_place_active;
723 BOOL ui_active;
724 BOOL window_active;
725 BOOL hostui_setup;
726 BOOL container_locked;
727 BOOL focus;
728 BOOL has_popup;
729 INT download_state;
731 LPWSTR mime;
733 DWORD update;
734 LONG task_magic;
735 SIZEL extent;
738 typedef struct nsWeakReference nsWeakReference;
741 typedef enum {
742 SCRIPTMODE_GECKO,
743 SCRIPTMODE_ACTIVESCRIPT
744 } SCRIPTMODE;
746 struct GeckoBrowser {
747 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
748 nsIContextMenuListener nsIContextMenuListener_iface;
749 nsIURIContentListener nsIURIContentListener_iface;
750 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
751 nsITooltipListener nsITooltipListener_iface;
752 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
753 nsISupportsWeakReference nsISupportsWeakReference_iface;
755 nsIWebBrowser *webbrowser;
756 nsIWebNavigation *navigation;
757 nsIBaseWindow *window;
758 nsIWebBrowserFocus *focus;
760 HTMLOuterWindow *content_window;
762 nsIEditor *editor;
763 nsIController *editor_controller;
765 LONG ref;
767 nsWeakReference *weak_reference;
769 HTMLDocumentObj *doc;
771 nsIURIContentListener *content_listener;
773 HWND hwnd;
774 SCRIPTMODE script_mode;
775 USERMODE usermode;
777 struct list document_nodes;
778 struct list outer_windows;
781 typedef struct {
782 const CLSID *clsid;
783 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
784 void (*destructor)(HTMLDOMNode*);
785 const cpc_entry_t *cpc_entries;
786 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
787 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
788 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
789 EventTarget *(*get_event_prop_target)(HTMLDOMNode*,int);
790 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
791 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
792 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
793 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
794 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
795 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
796 HRESULT (*bind_to_tree)(HTMLDOMNode*);
797 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
798 void (*unlink)(HTMLDOMNode*);
799 BOOL (*is_text_edit)(HTMLDOMNode*);
800 BOOL (*is_settable)(HTMLDOMNode*,DISPID);
801 } NodeImplVtbl;
803 struct HTMLDOMNode {
804 EventTarget event_target;
805 IHTMLDOMNode IHTMLDOMNode_iface;
806 IHTMLDOMNode2 IHTMLDOMNode2_iface;
807 IHTMLDOMNode3 IHTMLDOMNode3_iface;
808 const NodeImplVtbl *vtbl;
810 nsCycleCollectingAutoRefCnt ccref;
812 nsIDOMNode *nsnode;
813 HTMLDocumentNode *doc;
816 static inline void node_addref(HTMLDOMNode *node)
818 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
821 static inline void node_release(HTMLDOMNode *node)
823 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
826 typedef struct {
827 HTMLDOMNode node;
828 ConnectionPointContainer cp_container;
830 IHTMLElement IHTMLElement_iface;
831 IHTMLElement2 IHTMLElement2_iface;
832 IHTMLElement3 IHTMLElement3_iface;
833 IHTMLElement4 IHTMLElement4_iface;
834 IHTMLElement6 IHTMLElement6_iface;
835 IHTMLElement7 IHTMLElement7_iface;
836 IHTMLUniqueName IHTMLUniqueName_iface;
837 IElementSelector IElementSelector_iface;
838 IElementTraversal IElementTraversal_iface;
839 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
840 IWineHTMLElementPrivate IWineHTMLElementPrivate_iface;
842 nsIDOMElement *dom_element; /* NULL for legacy comments represented as HTML elements */
843 nsIDOMHTMLElement *html_element; /* NULL for non-HTML elements (like SVG elements) */
844 HTMLStyle *style;
845 HTMLStyle *runtime_style;
846 HTMLAttributeCollection *attrs;
847 WCHAR *filter;
848 unsigned unique_id;
849 } HTMLElement;
851 #define HTMLELEMENT_TIDS \
852 IHTMLDOMNode_tid, \
853 IHTMLDOMNode2_tid, \
854 IHTMLElement_tid, \
855 IHTMLElement3_tid, \
856 IHTMLElement4_tid, \
857 IHTMLUniqueName_tid
859 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN;
860 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
861 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN;
863 struct HTMLFrameBase {
864 HTMLElement element;
866 IHTMLFrameBase IHTMLFrameBase_iface;
867 IHTMLFrameBase2 IHTMLFrameBase2_iface;
869 HTMLOuterWindow *content_window;
871 nsIDOMHTMLFrameElement *nsframe;
872 nsIDOMHTMLIFrameElement *nsiframe;
875 typedef struct nsDocumentEventListener nsDocumentEventListener;
877 struct HTMLDocumentNode {
878 HTMLDOMNode node;
879 HTMLDocument basedoc;
881 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
883 nsIDocumentObserver nsIDocumentObserver_iface;
885 LONG ref;
887 HTMLInnerWindow *window;
889 GeckoBrowser *browser;
890 struct list browser_entry;
892 compat_mode_t document_mode;
893 BOOL document_mode_locked;
895 nsIDOMHTMLDocument *nsdoc;
896 BOOL content_ready;
898 IHTMLDOMImplementation *dom_implementation;
899 IHTMLNamespaceCollection *namespaces;
901 ICatInformation *catmgr;
902 nsDocumentEventListener *nsevent_listener;
903 BOOL *event_vector;
905 WCHAR **elem_vars;
906 unsigned elem_vars_size;
907 unsigned elem_vars_cnt;
909 BOOL skip_mutation_notif;
911 UINT charset;
913 unsigned unique_id;
915 struct list selection_list;
916 struct list range_list;
917 struct list plugin_hosts;
920 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
921 HRESULT MHTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
922 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
923 HRESULT create_document_node(nsIDOMHTMLDocument*,GeckoBrowser*,HTMLInnerWindow*,
924 compat_mode_t,HTMLDocumentNode**) DECLSPEC_HIDDEN;
926 HRESULT create_outer_window(GeckoBrowser*,mozIDOMWindowProxy*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
927 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
928 HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*) DECLSPEC_HIDDEN;
929 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
930 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
931 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
932 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN;
933 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
934 HRESULT create_navigator(compat_mode_t,IOmNavigator**) DECLSPEC_HIDDEN;
935 HRESULT create_html_screen(compat_mode_t,IHTMLScreen**) DECLSPEC_HIDDEN;
936 HRESULT create_performance(compat_mode_t,IHTMLPerformance**) DECLSPEC_HIDDEN;
937 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
938 HRESULT create_namespace_collection(compat_mode_t,IHTMLNamespaceCollection**) DECLSPEC_HIDDEN;
939 HRESULT create_dom_implementation(HTMLDocumentNode*,IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
940 void detach_dom_implementation(IHTMLDOMImplementation*) DECLSPEC_HIDDEN;
942 HRESULT create_html_storage(compat_mode_t,IHTMLStorage**) DECLSPEC_HIDDEN;
944 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
945 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
946 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
947 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
949 void HTMLDocument_View_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
950 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
952 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
954 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
956 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
957 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
959 HRESULT create_gecko_browser(HTMLDocumentObj*,GeckoBrowser**) DECLSPEC_HIDDEN;
960 void detach_gecko_browser(GeckoBrowser*) DECLSPEC_HIDDEN;
962 compat_mode_t lock_document_mode(HTMLDocumentNode*) DECLSPEC_HIDDEN;
964 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
965 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
966 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
967 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN;
969 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
970 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
971 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
973 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
974 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
975 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
977 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN;
979 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
981 BOOL load_gecko(void) DECLSPEC_HIDDEN;
982 void close_gecko(void) DECLSPEC_HIDDEN;
983 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
984 void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
985 void release_nsio(void) DECLSPEC_HIDDEN;
986 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
987 void set_viewer_zoom(GeckoBrowser*,float) DECLSPEC_HIDDEN;
988 float get_viewer_zoom(GeckoBrowser*) DECLSPEC_HIDDEN;
990 void init_node_cc(void) DECLSPEC_HIDDEN;
992 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
994 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
995 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
997 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
998 void nsfree(void*) DECLSPEC_HIDDEN;
1000 BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN;
1001 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
1002 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
1003 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
1004 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
1006 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
1007 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
1008 void nsAString_SetData(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
1009 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
1010 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
1012 #define NSSTR_IMPLICIT_PX 0x01
1013 #define NSSTR_COLOR 0x02
1015 HRESULT map_nsresult(nsresult) DECLSPEC_HIDDEN;
1016 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
1017 HRESULT return_nsstr_variant(nsresult,nsAString*,unsigned,VARIANT*) DECLSPEC_HIDDEN;
1018 HRESULT variant_to_nsstr(VARIANT*,BOOL,nsAString*) DECLSPEC_HIDDEN;
1019 HRESULT return_nsform(nsresult,nsIDOMHTMLFormElement*,IHTMLFormElement**) DECLSPEC_HIDDEN;
1021 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
1022 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
1023 void setup_editor_controller(GeckoBrowser*) DECLSPEC_HIDDEN;
1024 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
1025 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
1026 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN;
1027 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
1028 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
1030 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
1031 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
1032 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
1033 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
1034 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
1035 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1037 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
1038 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
1040 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
1041 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
1042 HRESULT create_style_sheet(nsIDOMStyleSheet*,compat_mode_t,IHTMLStyleSheet**) DECLSPEC_HIDDEN;
1043 HRESULT create_style_sheet_collection(nsIDOMStyleSheetList*,compat_mode_t,
1044 IHTMLStyleSheetsCollection**) DECLSPEC_HIDDEN;
1045 HRESULT create_dom_range(nsIDOMRange*,compat_mode_t,IHTMLDOMRange**) DECLSPEC_HIDDEN;
1046 HRESULT create_markup_pointer(IMarkupPointer**) DECLSPEC_HIDDEN;
1048 void detach_document_node(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1049 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1050 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1051 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
1052 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
1054 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMElement**) DECLSPEC_HIDDEN;
1055 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1057 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1059 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
1060 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
1062 static inline BOOL is_main_content_window(HTMLOuterWindow *window)
1064 return window->browser && window == window->browser->content_window;
1067 struct HTMLAttributeCollection {
1068 DispatchEx dispex;
1069 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
1070 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
1071 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
1073 LONG ref;
1075 HTMLElement *elem;
1076 struct list attrs;
1079 typedef struct {
1080 DispatchEx dispex;
1081 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
1082 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
1084 LONG ref;
1086 /* value is valid only for detached attributes (when elem == NULL). */
1087 VARIANT value;
1088 /* name must be valid for detached attributes */
1089 WCHAR *name;
1091 HTMLElement *elem;
1092 DISPID dispid;
1093 struct list entry;
1094 } HTMLDOMAttribute;
1096 HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*) DECLSPEC_HIDDEN;
1098 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,compat_mode_t,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
1100 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
1101 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
1102 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1103 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1104 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1105 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1106 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1107 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1108 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1109 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1110 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1111 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1112 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1113 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1114 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1115 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1116 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1117 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1118 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1119 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1120 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1121 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1122 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1123 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1124 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1125 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1126 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1127 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1129 HRESULT create_svg_element(HTMLDocumentNode*,nsIDOMSVGElement*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1131 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1132 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1134 void EventTarget_Init(EventTarget*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1135 HRESULT EventTarget_QI(EventTarget*,REFIID,void**) DECLSPEC_HIDDEN;
1136 void EventTarget_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1138 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1139 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1140 void HTMLDOMNode_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1142 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1143 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1144 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1145 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
1146 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1147 void HTMLElement_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1149 HRESULT get_node(nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
1150 HRESULT get_element(nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1151 HRESULT get_document_node(nsIDOMDocument*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
1153 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
1155 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
1156 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
1157 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1158 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
1159 HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1161 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
1163 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
1164 IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,compat_mode_t) DECLSPEC_HIDDEN;
1165 IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,compat_mode_t) DECLSPEC_HIDDEN;
1166 HRESULT create_child_collection(nsIDOMNodeList*,compat_mode_t,IHTMLDOMChildrenCollection**) DECLSPEC_HIDDEN;
1168 HRESULT attr_value_to_string(VARIANT*) DECLSPEC_HIDDEN;
1169 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
1170 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN;
1172 nsresult get_elem_attr_value(nsIDOMElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
1173 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
1174 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
1176 HRESULT elem_unique_id(unsigned id, BSTR *p) DECLSPEC_HIDDEN;
1178 /* commands */
1179 typedef struct {
1180 DWORD id;
1181 HRESULT (*query)(HTMLDocumentNode*,OLECMD*);
1182 HRESULT (*exec)(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*);
1183 } cmdtable_t;
1185 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
1187 void do_ns_command(HTMLDocumentNode*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
1189 /* timer */
1190 #define UPDATE_UI 0x0001
1191 #define UPDATE_TITLE 0x0002
1193 void update_doc(HTMLDocumentObj*,DWORD) DECLSPEC_HIDDEN;
1194 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1195 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
1197 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
1199 /* editor */
1200 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1201 void init_editor(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1202 void handle_edit_event(HTMLDocumentNode*,nsIDOMEvent*) DECLSPEC_HIDDEN;
1203 HRESULT editor_exec_copy(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1204 HRESULT editor_exec_cut(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1205 HRESULT editor_exec_paste(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1206 HRESULT browser_is_dirty(GeckoBrowser*) DECLSPEC_HIDDEN;
1207 void set_dirty(GeckoBrowser*,VARIANT_BOOL) DECLSPEC_HIDDEN;
1209 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
1211 typedef struct task_t task_t;
1212 typedef void (*task_proc_t)(task_t*);
1214 struct task_t {
1215 LONG target_magic;
1216 task_proc_t proc;
1217 task_proc_t destr;
1218 struct list entry;
1221 typedef struct {
1222 task_t header;
1223 HTMLDocumentObj *doc;
1224 } docobj_task_t;
1226 typedef struct {
1227 HWND thread_hwnd;
1228 struct list task_list;
1229 struct list timer_list;
1230 } thread_data_t;
1232 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1233 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1235 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1236 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1237 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1238 ULONGLONG get_time_stamp(void) DECLSPEC_HIDDEN;
1240 enum timer_type {
1241 TIMER_TIMEOUT,
1242 TIMER_INTERVAL,
1243 TIMER_ANIMATION_FRAME,
1246 HRESULT set_task_timer(HTMLInnerWindow*,LONG,enum timer_type,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1247 HRESULT clear_task_timer(HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
1249 BOOL parse_compat_version(const WCHAR*,compat_mode_t*) DECLSPEC_HIDDEN;
1251 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1253 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1254 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1255 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1256 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1257 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1259 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1261 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1263 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1264 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1266 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1267 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1269 /* memory allocation functions */
1271 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
1273 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
1276 static inline LPWSTR heap_strdupW(LPCWSTR str)
1278 LPWSTR ret = NULL;
1280 if(str) {
1281 DWORD size;
1283 size = (lstrlenW(str)+1)*sizeof(WCHAR);
1284 ret = heap_alloc(size);
1285 if(ret)
1286 memcpy(ret, str, size);
1289 return ret;
1292 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
1294 LPWSTR ret = NULL;
1296 if(str) {
1297 ret = heap_alloc((len+1)*sizeof(WCHAR));
1298 if(ret)
1300 memcpy(ret, str, len*sizeof(WCHAR));
1301 ret[len] = 0;
1305 return ret;
1308 static inline char *heap_strdupA(const char *str)
1310 char *ret = NULL;
1312 if(str) {
1313 DWORD size;
1315 size = strlen(str)+1;
1316 ret = heap_alloc(size);
1317 if(ret)
1318 memcpy(ret, str, size);
1321 return ret;
1324 static inline WCHAR *heap_strdupAtoW(const char *str)
1326 LPWSTR ret = NULL;
1328 if(str) {
1329 DWORD len;
1331 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1332 ret = heap_alloc(len*sizeof(WCHAR));
1333 if(ret)
1334 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1337 return ret;
1340 static inline char *heap_strdupWtoA(LPCWSTR str)
1342 char *ret = NULL;
1344 if(str) {
1345 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1346 ret = heap_alloc(size);
1347 if(ret)
1348 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1351 return ret;
1354 static inline WCHAR *heap_strdupUtoW(const char *str)
1356 WCHAR *ret = NULL;
1358 if(str) {
1359 size_t len;
1361 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1362 ret = heap_alloc(len*sizeof(WCHAR));
1363 if(ret)
1364 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1367 return ret;
1370 static inline char *heap_strdupWtoU(const WCHAR *str)
1372 char *ret = NULL;
1374 if(str) {
1375 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1376 ret = heap_alloc(size);
1377 if(ret)
1378 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1381 return ret;
1384 static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len)
1386 char *ret = NULL;
1387 DWORD size;
1389 if(str && len) {
1390 size = WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL);
1391 ret = heap_alloc(size + 1);
1392 if(ret) {
1393 WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL);
1394 ret[size] = '\0';
1398 return ret;
1401 static inline VARIANT_BOOL variant_bool(BOOL b)
1403 return b ? VARIANT_TRUE : VARIANT_FALSE;
1406 static inline BOOL is_digit(WCHAR c)
1408 return '0' <= c && c <= '9';
1411 #ifdef __i386__
1412 extern void *call_thiscall_func;
1413 #endif
1415 compat_mode_t get_max_compat_mode(IUri*) DECLSPEC_HIDDEN;
1416 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
1417 BSTR charset_string_from_cp(UINT) DECLSPEC_HIDDEN;
1418 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1419 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1420 IInternetSecurityManager *get_security_manager(void) DECLSPEC_HIDDEN;
1422 extern HINSTANCE hInst DECLSPEC_HIDDEN;
1423 void create_console(compat_mode_t compat_mode, IWineMSHTMLConsole **ret) DECLSPEC_HIDDEN;