windows.networking.hostname/tests: Add IHostNameFactory::CreateHostName() tests.
[wine.git] / dlls / mshtml / mshtml_private.h
blob59d652a828b38c70316319ed1b895ccf3552d907
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"
36 #ifdef INIT_GUID
37 #include "initguid.h"
38 #endif
40 #include "nsiface.h"
42 #include "mshtml_private_iface.h"
44 #include <assert.h>
46 #define NS_ERROR_GENERATE_FAILURE(module,code) \
47 ((nsresult) (((UINT32)(1u<<31)) | ((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
48 #define NS_ERROR_GENERATE_SUCCESS(module,code) \
49 ((nsresult) (((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
51 #define NS_OK ((nsresult)0x00000000L)
52 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
53 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
54 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
55 #define NS_NOINTERFACE ((nsresult)0x80004002L)
56 #define NS_ERROR_INVALID_POINTER ((nsresult)0x80004003L)
57 #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
58 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
59 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
60 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
61 #define NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ((nsresult)0x80530007)
62 #define NS_ERROR_DOM_SYNTAX_ERR ((nsresult)0x8053000c)
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_INVALID_PROPERTY 0x800a01b6
76 #define MSHTML_E_INVALID_ACTION 0x800a01bd
77 #define MSHTML_E_NODOC 0x800a025c
78 #define MSHTML_E_NOT_FUNC 0x800a138a
80 typedef struct DOMEvent DOMEvent;
81 typedef struct HTMLDOMNode HTMLDOMNode;
82 typedef struct ConnectionPoint ConnectionPoint;
83 typedef struct BSCallback BSCallback;
84 typedef struct EventTarget EventTarget;
86 #define TID_LIST \
87 XIID(NULL) \
88 XDIID(DispCEventObj) \
89 XDIID(DispCPlugins) \
90 XDIID(DispDOMChildrenCollection) \
91 XDIID(DispDOMCustomEvent) \
92 XDIID(DispDOMEvent) \
93 XDIID(DispDOMKeyboardEvent) \
94 XDIID(DispDOMMessageEvent) \
95 XDIID(DispDOMMouseEvent) \
96 XDIID(DispDOMProgressEvent) \
97 XDIID(DispDOMStorageEvent) \
98 XDIID(DispDOMUIEvent) \
99 XDIID(DispDOMDocumentType) \
100 XDIID(DispHTMLAnchorElement) \
101 XDIID(DispHTMLAreaElement) \
102 XDIID(DispHTMLAttributeCollection) \
103 XDIID(DispHTMLBody) \
104 XDIID(DispHTMLButtonElement) \
105 XDIID(DispHTMLCommentElement) \
106 XDIID(DispHTMLCurrentStyle) \
107 XDIID(DispHTMLDocument) \
108 XDIID(DispHTMLDOMAttribute) \
109 XDIID(DispHTMLDOMImplementation) \
110 XDIID(DispHTMLDOMRange) \
111 XDIID(DispHTMLDOMTextNode) \
112 XDIID(DispHTMLElementCollection) \
113 XDIID(DispHTMLEmbed) \
114 XDIID(DispHTMLFormElement) \
115 XDIID(DispHTMLGenericElement) \
116 XDIID(DispHTMLFrameElement) \
117 XDIID(DispHTMLHeadElement) \
118 XDIID(DispHTMLHtmlElement) \
119 XDIID(DispHTMLHistory) \
120 XDIID(DispHTMLIFrame) \
121 XDIID(DispHTMLImg) \
122 XDIID(DispHTMLInputElement) \
123 XDIID(DispHTMLLabelElement) \
124 XDIID(DispHTMLLinkElement) \
125 XDIID(DispHTMLLocation) \
126 XDIID(DispHTMLMetaElement) \
127 XDIID(DispHTMLNamespaceCollection) \
128 XDIID(DispHTMLNavigator) \
129 XDIID(DispHTMLObjectElement) \
130 XDIID(DispHTMLOptionElement) \
131 XDIID(DispHTMLScreen) \
132 XDIID(DispHTMLScriptElement) \
133 XDIID(DispHTMLSelectElement) \
134 XDIID(DispHTMLStyle) \
135 XDIID(DispHTMLStyleElement) \
136 XDIID(DispHTMLStyleSheet) \
137 XDIID(DispHTMLStyleSheetRule) \
138 XDIID(DispHTMLStyleSheetRulesCollection) \
139 XDIID(DispHTMLStyleSheetsCollection) \
140 XDIID(DispHTMLTable) \
141 XDIID(DispHTMLTableCell) \
142 XDIID(DispHTMLTableRow) \
143 XDIID(DispHTMLTextAreaElement) \
144 XDIID(DispHTMLTitleElement) \
145 XDIID(DispHTMLUnknownElement) \
146 XDIID(DispHTMLW3CComputedStyle) \
147 XDIID(DispHTMLWindow2) \
148 XDIID(DispHTMLXMLHttpRequest) \
149 XDIID(DispSVGCircleElement) \
150 XDIID(DispSVGSVGElement) \
151 XDIID(DispSVGTSpanElement) \
152 XDIID(HTMLDocumentEvents) \
153 XDIID(HTMLDocumentEvents2) \
154 XDIID(HTMLElementEvents2) \
155 XIID(IDOMCustomEvent) \
156 XIID(IDOMEvent) \
157 XIID(IDOMKeyboardEvent) \
158 XIID(IDOMMessageEvent) \
159 XIID(IDOMMouseEvent) \
160 XIID(IDOMProgressEvent) \
161 XIID(IDOMStorageEvent) \
162 XIID(IDOMUIEvent) \
163 XIID(IDOMDocumentType) \
164 XIID(IDocumentEvent) \
165 XIID(IDocumentRange) \
166 XIID(IDocumentSelector) \
167 XIID(IElementSelector) \
168 XIID(IElementTraversal) \
169 XIID(IEventTarget) \
170 XIID(IHTMLAnchorElement) \
171 XIID(IHTMLAreaElement) \
172 XIID(IHTMLAttributeCollection) \
173 XIID(IHTMLAttributeCollection2) \
174 XIID(IHTMLAttributeCollection3) \
175 XIID(IHTMLBodyElement) \
176 XIID(IHTMLBodyElement2) \
177 XIID(IHTMLButtonElement) \
178 XIID(IHTMLCSSStyleDeclaration) \
179 XIID(IHTMLCSSStyleDeclaration2) \
180 XIID(IHTMLCommentElement) \
181 XIID(IHTMLCurrentStyle) \
182 XIID(IHTMLCurrentStyle2) \
183 XIID(IHTMLCurrentStyle3) \
184 XIID(IHTMLCurrentStyle4) \
185 XIID(IHTMLDocument2) \
186 XIID(IHTMLDocument3) \
187 XIID(IHTMLDocument4) \
188 XIID(IHTMLDocument5) \
189 XIID(IHTMLDocument6) \
190 XIID(IHTMLDocument7) \
191 XIID(IHTMLDOMAttribute) \
192 XIID(IHTMLDOMAttribute2) \
193 XIID(IHTMLDOMChildrenCollection) \
194 XIID(IHTMLDOMImplementation) \
195 XIID(IHTMLDOMImplementation2) \
196 XIID(IHTMLDOMNode) \
197 XIID(IHTMLDOMNode2) \
198 XIID(IHTMLDOMNode3) \
199 XIID(IHTMLDOMRange) \
200 XIID(IHTMLDOMTextNode) \
201 XIID(IHTMLDOMTextNode2) \
202 XIID(IHTMLElement) \
203 XIID(IHTMLElement2) \
204 XIID(IHTMLElement3) \
205 XIID(IHTMLElement4) \
206 XIID(IHTMLElement6) \
207 XIID(IHTMLElement7) \
208 XIID(IHTMLElementCollection) \
209 XIID(IHTMLEmbedElement) \
210 XIID(IHTMLEventObj) \
211 XIID(IHTMLFiltersCollection) \
212 XIID(IHTMLFormElement) \
213 XIID(IHTMLFrameBase) \
214 XIID(IHTMLFrameBase2) \
215 XIID(IHTMLFrameElement3) \
216 XIID(IHTMLGenericElement) \
217 XIID(IHTMLHeadElement) \
218 XIID(IHTMLHtmlElement) \
219 XIID(IHTMLIFrameElement) \
220 XIID(IHTMLIFrameElement2) \
221 XIID(IHTMLIFrameElement3) \
222 XIID(IHTMLImageElementFactory) \
223 XIID(IHTMLImgElement) \
224 XIID(IHTMLInputElement) \
225 XIID(IHTMLInputTextElement2) \
226 XIID(IHTMLLabelElement) \
227 XIID(IHTMLLinkElement) \
228 XIID(IHTMLLocation) \
229 XIID(IHTMLMetaElement) \
230 XIID(IHTMLMimeTypesCollection) \
231 XIID(IHTMLNamespaceCollection) \
232 XIID(IHTMLObjectElement) \
233 XIID(IHTMLObjectElement2) \
234 XIID(IHTMLOptionElement) \
235 XIID(IHTMLOptionElementFactory) \
236 XIID(IHTMLPerformance) \
237 XIID(IHTMLPerformanceNavigation) \
238 XIID(IHTMLPerformanceTiming) \
239 XIID(IHTMLPluginsCollection) \
240 XIID(IHTMLRect) \
241 XIID(IHTMLRect2) \
242 XIID(IHTMLRectCollection) \
243 XIID(IHTMLScreen) \
244 XIID(IHTMLScriptElement) \
245 XIID(IHTMLSelectElement) \
246 XIID(IHTMLSelectionObject) \
247 XIID(IHTMLSelectionObject2) \
248 XIID(IHTMLStorage) \
249 XIID(IHTMLStyle) \
250 XIID(IHTMLStyle2) \
251 XIID(IHTMLStyle3) \
252 XIID(IHTMLStyle4) \
253 XIID(IHTMLStyle5) \
254 XIID(IHTMLStyle6) \
255 XIID(IHTMLStyleElement) \
256 XIID(IHTMLStyleElement2) \
257 XIID(IHTMLStyleSheet) \
258 XIID(IHTMLStyleSheet4) \
259 XIID(IHTMLStyleSheetRule) \
260 XIID(IHTMLStyleSheetRulesCollection) \
261 XIID(IHTMLStyleSheetsCollection) \
262 XIID(IHTMLTable) \
263 XIID(IHTMLTable2) \
264 XIID(IHTMLTable3) \
265 XIID(IHTMLTableCell) \
266 XIID(IHTMLTableRow) \
267 XIID(IHTMLTextAreaElement) \
268 XIID(IHTMLTextContainer) \
269 XIID(IHTMLTitleElement) \
270 XIID(IHTMLTxtRange) \
271 XIID(IHTMLUniqueName) \
272 XIID(IHTMLWindow2) \
273 XIID(IHTMLWindow3) \
274 XIID(IHTMLWindow4) \
275 XIID(IHTMLWindow5) \
276 XIID(IHTMLWindow6) \
277 XIID(IHTMLWindow7) \
278 XIID(IHTMLXMLHttpRequest) \
279 XIID(IHTMLXMLHttpRequest2) \
280 XIID(IHTMLXMLHttpRequestFactory) \
281 XIID(IOmHistory) \
282 XIID(IOmNavigator) \
283 XIID(ISVGCircleElement) \
284 XIID(ISVGElement) \
285 XIID(ISVGSVGElement) \
286 XIID(ISVGTSpanElement) \
287 XIID(ISVGTextContentElement)
289 #define PRIVATE_TID_LIST \
290 XIID(IWineDOMTokenList) \
291 XIID(IWineHTMLElementPrivate) \
292 XIID(IWineHTMLWindowPrivate) \
293 XIID(IWineHTMLWindowCompatPrivate) \
294 XIID(IWinePageTransitionEvent) \
295 XIID(IWineXMLHttpRequestPrivate) \
296 XIID(IWineMSHTMLConsole) \
297 XIID(IWineMSHTMLMediaQueryList)
299 typedef enum {
300 #define XIID(iface) iface ## _tid,
301 #define XDIID(iface) iface ## _tid,
302 TID_LIST
303 LAST_public_tid,
304 PRIVATE_TID_LIST
305 #undef XIID
306 #undef XDIID
307 LAST_tid
308 } tid_t;
310 typedef enum {
311 COMPAT_MODE_INVALID = -1,
312 COMPAT_MODE_QUIRKS,
313 COMPAT_MODE_IE5,
314 COMPAT_MODE_IE7,
315 COMPAT_MODE_IE8,
316 COMPAT_MODE_IE9,
317 COMPAT_MODE_IE10,
318 COMPAT_MODE_IE11
319 } compat_mode_t;
321 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
322 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
324 typedef struct {
325 unsigned document_mode;
326 unsigned ie_version;
327 } compat_mode_info_t;
329 extern const compat_mode_info_t compat_mode_info[COMPAT_MODE_CNT];
331 typedef struct dispex_data_t dispex_data_t;
332 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
334 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
335 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
336 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
338 typedef struct DispatchEx DispatchEx;
340 typedef struct {
341 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
342 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
343 HRESULT (*get_name)(DispatchEx*,DISPID,BSTR*);
344 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
345 HRESULT (*delete)(DispatchEx*,DISPID);
346 HRESULT (*next_dispid)(DispatchEx*,DISPID,DISPID*);
347 compat_mode_t (*get_compat_mode)(DispatchEx*);
348 HRESULT (*populate_props)(DispatchEx*);
349 } dispex_static_data_vtbl_t;
351 typedef struct {
352 const WCHAR *name;
353 const dispex_static_data_vtbl_t *vtbl;
354 const tid_t disp_tid;
355 const tid_t* const iface_tids;
356 void (*init_info)(dispex_data_t*,compat_mode_t);
357 dispex_data_t *info_cache[COMPAT_MODE_CNT];
358 dispex_data_t *delayed_init_info;
359 } dispex_static_data_t;
361 typedef HRESULT (*dispex_hook_invoke_t)(DispatchEx*,WORD,DISPPARAMS*,VARIANT*,
362 EXCEPINFO*,IServiceProvider*);
364 typedef struct {
365 DISPID dispid;
366 dispex_hook_invoke_t invoke;
367 const WCHAR *name;
368 } dispex_hook_t;
370 struct DispatchEx {
371 IDispatchEx IDispatchEx_iface;
373 IUnknown *outer;
375 dispex_data_t *info;
376 dispex_dynamic_data_t *dynamic_data;
379 typedef struct {
380 UINT_PTR x;
381 } nsCycleCollectingAutoRefCnt;
383 typedef struct {
384 void *vtbl;
385 int ref_flags;
386 void *callbacks;
387 } ExternalCycleCollectionParticipant;
389 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
391 typedef struct {
392 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
393 nsresult (NSAPI *unlink)(void*);
394 void (NSAPI *delete_cycle_collectable)(void*);
395 } CCObjCallback;
397 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
399 extern nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*);
400 extern nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*);
401 extern void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt);
402 extern void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*);
403 extern void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*);
404 extern void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*);
406 void init_dispatch(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t);
407 void release_dispex(DispatchEx*);
408 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
409 HRESULT change_type(VARIANT*,VARIANT*,VARTYPE,IServiceProvider*);
410 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
411 HRESULT get_dispids(tid_t,DWORD*,DISPID**);
412 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*);
413 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,BOOL,DISPID*);
414 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*);
415 void dispex_unlink(DispatchEx*);
416 void release_typelib(void);
417 HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**);
418 const void *dispex_get_vtbl(DispatchEx*);
419 void dispex_info_add_interface(dispex_data_t*,tid_t,const dispex_hook_t*);
420 compat_mode_t dispex_compat_mode(DispatchEx*);
421 HRESULT dispex_to_string(DispatchEx*,BSTR*);
422 HRESULT dispex_call_builtin(DispatchEx *dispex, DISPID id, DISPPARAMS *dp,
423 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller);
425 typedef enum {
426 DISPEXPROP_CUSTOM,
427 DISPEXPROP_DYNAMIC,
428 DISPEXPROP_BUILTIN
429 } dispex_prop_type_t;
431 dispex_prop_type_t get_dispid_type(DISPID);
433 typedef struct HTMLWindow HTMLWindow;
434 typedef struct HTMLInnerWindow HTMLInnerWindow;
435 typedef struct HTMLOuterWindow HTMLOuterWindow;
436 typedef struct HTMLDocumentNode HTMLDocumentNode;
437 typedef struct HTMLDocumentObj HTMLDocumentObj;
438 typedef struct HTMLFrameBase HTMLFrameBase;
439 typedef struct GeckoBrowser GeckoBrowser;
440 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
442 typedef struct ScriptHost ScriptHost;
444 typedef enum {
445 GLOBAL_SCRIPTVAR,
446 GLOBAL_ELEMENTVAR,
447 GLOBAL_DISPEXVAR,
448 GLOBAL_FRAMEVAR
449 } global_prop_type_t;
451 typedef struct {
452 global_prop_type_t type;
453 WCHAR *name;
454 ScriptHost *script_host;
455 DISPID id;
456 } global_prop_t;
458 struct EventTarget {
459 DispatchEx dispex;
460 IEventTarget IEventTarget_iface;
461 struct wine_rb_tree handler_map;
464 typedef struct {
465 DispatchEx dispex;
466 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
468 LONG ref;
470 HTMLInnerWindow *window;
471 } HTMLOptionElementFactory;
473 typedef struct {
474 DispatchEx dispex;
475 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
477 LONG ref;
479 HTMLInnerWindow *window;
480 } HTMLImageElementFactory;
482 typedef struct {
483 DispatchEx dispex;
484 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
486 LONG ref;
488 HTMLInnerWindow *window;
489 } HTMLXMLHttpRequestFactory;
491 struct HTMLLocation {
492 DispatchEx dispex;
493 IHTMLLocation IHTMLLocation_iface;
496 typedef struct {
497 DispatchEx dispex;
498 IOmHistory IOmHistory_iface;
500 LONG ref;
502 HTMLInnerWindow *window;
503 } OmHistory;
505 typedef struct {
506 DispatchEx dispex;
507 IHTMLPerformanceTiming IHTMLPerformanceTiming_iface;
509 LONG ref;
511 ULONG navigation_type;
512 ULONG redirect_count;
514 ULONGLONG navigation_start_time;
515 ULONGLONG unload_event_start_time;
516 ULONGLONG unload_event_end_time;
517 ULONGLONG redirect_time;
518 ULONGLONG dns_lookup_time;
519 ULONGLONG connect_time;
520 ULONGLONG request_time;
521 ULONGLONG response_start_time;
522 ULONGLONG response_end_time;
523 ULONGLONG dom_interactive_time;
524 ULONGLONG dom_complete_time;
525 ULONGLONG dom_content_loaded_event_start_time;
526 ULONGLONG dom_content_loaded_event_end_time;
527 ULONGLONG load_event_start_time;
528 ULONGLONG load_event_end_time;
529 ULONGLONG first_paint_time;
530 } HTMLPerformanceTiming;
532 typedef struct nsChannelBSC nsChannelBSC;
534 struct HTMLWindow {
535 IHTMLWindow2 IHTMLWindow2_iface;
536 IHTMLWindow3 IHTMLWindow3_iface;
537 IHTMLWindow4 IHTMLWindow4_iface;
538 IHTMLWindow5 IHTMLWindow5_iface;
539 IHTMLWindow6 IHTMLWindow6_iface;
540 IHTMLWindow7 IHTMLWindow7_iface;
541 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
542 IDispatchEx IDispatchEx_iface;
543 IServiceProvider IServiceProvider_iface;
544 ITravelLogClient ITravelLogClient_iface;
545 IObjectIdentity IObjectIdentity_iface;
546 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
547 IWineHTMLWindowPrivate IWineHTMLWindowPrivate_iface;
548 IWineHTMLWindowCompatPrivate IWineHTMLWindowCompatPrivate_iface;
550 IWineMSHTMLConsole *console;
552 LONG ref;
554 HTMLInnerWindow *inner_window;
555 HTMLOuterWindow *outer_window;
558 struct HTMLOuterWindow {
559 HTMLWindow base;
561 LONG task_magic;
563 nsIDOMWindow *nswindow;
564 mozIDOMWindowProxy *window_proxy;
565 HTMLOuterWindow *parent;
566 HTMLFrameBase *frame_element;
568 GeckoBrowser *browser;
569 struct list browser_entry;
571 READYSTATE readystate;
572 unsigned readystate_locked;
573 BOOL readystate_pending;
575 HTMLInnerWindow *pending_window;
576 HTMLLocation location;
577 IMoniker *mon;
578 IUri *uri;
579 IUri *uri_nofrag;
580 BSTR url;
581 DWORD load_flags;
583 struct list sibling_entry;
584 struct wine_rb_entry entry;
587 struct HTMLInnerWindow {
588 HTMLWindow base;
589 EventTarget event_target;
591 HTMLDocumentNode *doc;
593 struct list children;
594 struct list script_hosts;
596 IHTMLEventObj *event;
598 HTMLImageElementFactory *image_factory;
599 HTMLOptionElementFactory *option_factory;
600 HTMLXMLHttpRequestFactory *xhr_factory;
601 IHTMLScreen *screen;
602 OmHistory *history;
603 IOmNavigator *navigator;
604 IHTMLStorage *session_storage;
605 IHTMLStorage *local_storage;
607 BOOL performance_initialized;
608 VARIANT performance;
609 HTMLPerformanceTiming *performance_timing;
611 unsigned blocking_depth;
612 unsigned parser_callback_cnt;
613 struct list script_queue;
615 global_prop_t *global_props;
616 DWORD global_prop_cnt;
617 DWORD global_prop_size;
619 LONG task_magic;
621 IMoniker *mon;
622 nsChannelBSC *bscallback;
623 struct list bindings;
626 typedef enum {
627 UNKNOWN_USERMODE,
628 BROWSEMODE,
629 EDITMODE
630 } USERMODE;
632 typedef struct _cp_static_data_t {
633 tid_t tid;
634 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
635 BOOL pass_event_arg;
636 DWORD id_cnt;
637 DISPID *ids;
638 } cp_static_data_t;
640 typedef struct {
641 const IID *riid;
642 cp_static_data_t *desc;
643 } cpc_entry_t;
645 typedef struct ConnectionPointContainer {
646 IConnectionPointContainer IConnectionPointContainer_iface;
648 ConnectionPoint *cps;
649 const cpc_entry_t *cp_entries;
650 IUnknown *outer;
651 struct ConnectionPointContainer *forward_container;
652 } ConnectionPointContainer;
654 struct ConnectionPoint {
655 IConnectionPoint IConnectionPoint_iface;
657 ConnectionPointContainer *container;
659 union {
660 IUnknown *unk;
661 IDispatch *disp;
662 IPropertyNotifySink *propnotif;
663 } *sinks;
664 DWORD sinks_size;
666 const IID *iid;
667 cp_static_data_t *data;
670 struct HTMLDocumentObj {
671 IUnknown IUnknown_inner;
672 IDispatchEx IDispatchEx_iface;
673 ICustomDoc ICustomDoc_iface;
674 IHTMLDocument2 IHTMLDocument2_iface;
675 IHTMLDocument3 IHTMLDocument3_iface;
676 IHTMLDocument4 IHTMLDocument4_iface;
677 IHTMLDocument5 IHTMLDocument5_iface;
678 IHTMLDocument6 IHTMLDocument6_iface;
679 IHTMLDocument7 IHTMLDocument7_iface;
680 IDocumentSelector IDocumentSelector_iface;
681 IDocumentEvent IDocumentEvent_iface;
682 ISupportErrorInfo ISupportErrorInfo_iface;
683 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
684 IMarkupServices IMarkupServices_iface;
685 IMarkupContainer IMarkupContainer_iface;
686 IDisplayServices IDisplayServices_iface;
687 IDocumentRange IDocumentRange_iface;
688 IOleDocumentView IOleDocumentView_iface;
689 IViewObjectEx IViewObjectEx_iface;
690 IPersistMoniker IPersistMoniker_iface;
691 IPersistFile IPersistFile_iface;
692 IMonikerProp IMonikerProp_iface;
693 IPersistStreamInit IPersistStreamInit_iface;
694 IPersistHistory IPersistHistory_iface;
695 IHlinkTarget IHlinkTarget_iface;
696 IOleCommandTarget IOleCommandTarget_iface;
697 IOleObject IOleObject_iface;
698 IOleDocument IOleDocument_iface;
699 IOleControl IOleControl_iface;
700 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
701 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
702 IObjectWithSite IObjectWithSite_iface;
703 IOleContainer IOleContainer_iface;
704 IObjectSafety IObjectSafety_iface;
705 IServiceProvider IServiceProvider_iface;
706 ITargetContainer ITargetContainer_iface;
707 IEventTarget IEventTarget_iface;
709 IWindowForBindingUI IWindowForBindingUI_iface;
711 LONG ref;
713 IUnknown *outer_unk;
714 HTMLOuterWindow *window;
715 GeckoBrowser *nscontainer;
716 HTMLDocumentNode *doc_node;
718 IOleClientSite *client;
719 IDocHostUIHandler *hostui;
720 IOleCommandTarget *client_cmdtrg;
721 BOOL custom_hostui;
722 IOleInPlaceSite *ipsite;
723 IOleInPlaceFrame *frame;
724 IOleInPlaceUIWindow *ip_window;
725 IAdviseSink *view_sink;
726 IDocObjectService *doc_object_service;
727 IUnknown *webbrowser;
728 ITravelLog *travel_log;
729 IUnknown *browser_service;
730 IOleAdviseHolder *advise_holder;
732 ConnectionPointContainer cp_container;
733 DOCHOSTUIINFO hostinfo;
735 IOleUndoManager *undomgr;
736 IHTMLEditServices *editsvcs;
738 HWND hwnd;
739 HWND tooltips_hwnd;
741 BOOL is_mhtml;
742 BOOL request_uiactivate;
743 BOOL in_place_active;
744 BOOL ui_active;
745 BOOL window_active;
746 BOOL hostui_setup;
747 BOOL container_locked;
748 BOOL focus;
749 BOOL has_popup;
750 INT download_state;
752 LPWSTR mime;
754 DWORD update;
755 LONG task_magic;
756 SIZEL extent;
759 typedef struct nsWeakReference nsWeakReference;
762 typedef enum {
763 SCRIPTMODE_GECKO,
764 SCRIPTMODE_ACTIVESCRIPT
765 } SCRIPTMODE;
767 struct GeckoBrowser {
768 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
769 nsIContextMenuListener nsIContextMenuListener_iface;
770 nsIURIContentListener nsIURIContentListener_iface;
771 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
772 nsITooltipListener nsITooltipListener_iface;
773 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
774 nsISupportsWeakReference nsISupportsWeakReference_iface;
776 nsIWebBrowser *webbrowser;
777 nsIWebNavigation *navigation;
778 nsIBaseWindow *window;
779 nsIWebBrowserFocus *focus;
781 HTMLOuterWindow *content_window;
783 nsIEditor *editor;
784 nsIController *editor_controller;
786 LONG ref;
788 nsWeakReference *weak_reference;
790 HTMLDocumentObj *doc;
792 nsIURIContentListener *content_listener;
794 HWND hwnd;
795 SCRIPTMODE script_mode;
796 USERMODE usermode;
798 struct list document_nodes;
799 struct list outer_windows;
802 typedef struct {
803 const CLSID *clsid;
804 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
805 void (*destructor)(HTMLDOMNode*);
806 const cpc_entry_t *cpc_entries;
807 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
808 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
809 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
810 EventTarget *(*get_event_prop_target)(HTMLDOMNode*,int);
811 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
812 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
813 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
814 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
815 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
816 HRESULT (*get_name)(HTMLDOMNode*,DISPID,BSTR*);
817 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
818 HRESULT (*bind_to_tree)(HTMLDOMNode*);
819 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
820 void (*unlink)(HTMLDOMNode*);
821 BOOL (*is_text_edit)(HTMLDOMNode*);
822 BOOL (*is_settable)(HTMLDOMNode*,DISPID);
823 } NodeImplVtbl;
825 struct HTMLDOMNode {
826 EventTarget event_target;
827 IHTMLDOMNode IHTMLDOMNode_iface;
828 IHTMLDOMNode2 IHTMLDOMNode2_iface;
829 IHTMLDOMNode3 IHTMLDOMNode3_iface;
830 const NodeImplVtbl *vtbl;
832 nsCycleCollectingAutoRefCnt ccref;
834 nsIDOMNode *nsnode;
835 HTMLDocumentNode *doc;
838 HTMLDOMNode *unsafe_impl_from_IHTMLDOMNode(IHTMLDOMNode*);
840 static inline void node_addref(HTMLDOMNode *node)
842 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
845 static inline void node_release(HTMLDOMNode *node)
847 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
850 typedef struct {
851 HTMLDOMNode node;
852 ConnectionPointContainer cp_container;
854 IHTMLElement IHTMLElement_iface;
855 IHTMLElement2 IHTMLElement2_iface;
856 IHTMLElement3 IHTMLElement3_iface;
857 IHTMLElement4 IHTMLElement4_iface;
858 IHTMLElement6 IHTMLElement6_iface;
859 IHTMLElement7 IHTMLElement7_iface;
860 IHTMLUniqueName IHTMLUniqueName_iface;
861 IElementSelector IElementSelector_iface;
862 IElementTraversal IElementTraversal_iface;
863 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
864 IWineHTMLElementPrivate IWineHTMLElementPrivate_iface;
866 nsIDOMElement *dom_element; /* NULL for legacy comments represented as HTML elements */
867 nsIDOMHTMLElement *html_element; /* NULL for non-HTML elements (like SVG elements) */
868 HTMLStyle *style;
869 HTMLStyle *runtime_style;
870 HTMLAttributeCollection *attrs;
871 WCHAR *filter;
872 unsigned unique_id;
873 } HTMLElement;
875 #define HTMLELEMENT_TIDS \
876 IHTMLDOMNode_tid, \
877 IHTMLDOMNode2_tid, \
878 IHTMLElement_tid, \
879 IHTMLElement3_tid, \
880 IHTMLElement4_tid, \
881 IHTMLUniqueName_tid
883 extern cp_static_data_t HTMLElementEvents2_data;
884 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
885 extern const cpc_entry_t HTMLElement_cpc[];
887 struct HTMLFrameBase {
888 HTMLElement element;
890 IHTMLFrameBase IHTMLFrameBase_iface;
891 IHTMLFrameBase2 IHTMLFrameBase2_iface;
893 HTMLOuterWindow *content_window;
895 nsIDOMHTMLFrameElement *nsframe;
896 nsIDOMHTMLIFrameElement *nsiframe;
899 typedef struct nsDocumentEventListener nsDocumentEventListener;
901 struct HTMLDocumentNode {
902 HTMLDOMNode node;
904 IDispatchEx IDispatchEx_iface;
905 IHTMLDocument2 IHTMLDocument2_iface;
906 IHTMLDocument3 IHTMLDocument3_iface;
907 IHTMLDocument4 IHTMLDocument4_iface;
908 IHTMLDocument5 IHTMLDocument5_iface;
909 IHTMLDocument6 IHTMLDocument6_iface;
910 IHTMLDocument7 IHTMLDocument7_iface;
911 IDocumentSelector IDocumentSelector_iface;
912 IDocumentEvent IDocumentEvent_iface;
913 ISupportErrorInfo ISupportErrorInfo_iface;
914 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
915 IMarkupServices IMarkupServices_iface;
916 IMarkupContainer IMarkupContainer_iface;
917 IDisplayServices IDisplayServices_iface;
918 IDocumentRange IDocumentRange_iface;
919 IPersistMoniker IPersistMoniker_iface;
920 IPersistFile IPersistFile_iface;
921 IMonikerProp IMonikerProp_iface;
922 IPersistStreamInit IPersistStreamInit_iface;
923 IPersistHistory IPersistHistory_iface;
924 IHlinkTarget IHlinkTarget_iface;
925 IOleCommandTarget IOleCommandTarget_iface;
926 IOleObject IOleObject_iface;
927 IOleDocument IOleDocument_iface;
928 IOleControl IOleControl_iface;
929 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
930 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
931 IObjectWithSite IObjectWithSite_iface;
932 IOleContainer IOleContainer_iface;
933 IObjectSafety IObjectSafety_iface;
934 IServiceProvider IServiceProvider_iface;
935 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
937 nsIDocumentObserver nsIDocumentObserver_iface;
939 LONG ref;
941 ConnectionPointContainer cp_container;
942 HTMLOuterWindow *outer_window;
943 HTMLInnerWindow *window;
944 HTMLDocumentObj *doc_obj;
946 GeckoBrowser *browser;
947 struct list browser_entry;
949 compat_mode_t document_mode;
950 BOOL document_mode_locked;
952 nsIDOMDocument *dom_document;
953 nsIDOMHTMLDocument *html_document;
954 BOOL content_ready : 1;
955 BOOL unload_sent : 1;
957 IHTMLDOMImplementation *dom_implementation;
958 IHTMLNamespaceCollection *namespaces;
960 ICatInformation *catmgr;
961 nsDocumentEventListener *nsevent_listener;
962 BOOL *event_vector;
964 WCHAR **elem_vars;
965 unsigned elem_vars_size;
966 unsigned elem_vars_cnt;
968 BOOL skip_mutation_notif;
970 UINT charset;
972 unsigned unique_id;
974 struct list selection_list;
975 struct list range_list;
976 struct list plugin_hosts;
979 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
980 HRESULT MHTMLDocument_Create(IUnknown*,REFIID,void**);
981 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
982 HRESULT create_document_node(nsIDOMDocument*,GeckoBrowser*,HTMLInnerWindow*,
983 compat_mode_t,HTMLDocumentNode**);
984 HRESULT create_doctype_node(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**);
986 HRESULT create_outer_window(GeckoBrowser*,mozIDOMWindowProxy*,HTMLOuterWindow*,HTMLOuterWindow**);
987 HRESULT update_window_doc(HTMLInnerWindow*);
988 HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*);
989 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**);
990 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**);
991 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**);
992 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**);
993 void HTMLLocation_Init(HTMLLocation*);
994 HRESULT create_navigator(compat_mode_t,IOmNavigator**);
995 HRESULT create_html_screen(compat_mode_t,IHTMLScreen**);
996 HRESULT create_performance(HTMLInnerWindow*,IHTMLPerformance**);
997 HRESULT create_performance_timing(HTMLPerformanceTiming**);
998 HRESULT create_history(HTMLInnerWindow*,OmHistory**);
999 HRESULT create_namespace_collection(compat_mode_t,IHTMLNamespaceCollection**);
1000 HRESULT create_dom_implementation(HTMLDocumentNode*,IHTMLDOMImplementation**);
1001 void detach_dom_implementation(IHTMLDOMImplementation*);
1003 HRESULT create_html_storage(HTMLInnerWindow*,BOOL,IHTMLStorage**);
1004 void detach_html_storage(IHTMLStorage*);
1006 void HTMLDocument_View_Init(HTMLDocumentObj*);
1007 void HTMLDocumentObj_Persist_Init(HTMLDocumentObj*);
1008 void HTMLDocumentObj_Service_Init(HTMLDocumentObj*);
1009 void HTMLDocumentObj_OleCmd_Init(HTMLDocumentObj*);
1010 void TargetContainer_Init(HTMLDocumentObj*);
1012 void HTMLDocumentNode_Persist_Init(HTMLDocumentNode*);
1013 void HTMLDocumentNode_Service_Init(HTMLDocumentNode*);
1014 void HTMLDocumentNode_OleCmd_Init(HTMLDocumentNode*);
1015 void HTMLDocumentNode_OleObj_Init(HTMLDocumentNode*);
1016 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
1018 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
1020 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*);
1021 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
1023 HRESULT create_gecko_browser(HTMLDocumentObj*,GeckoBrowser**);
1024 void detach_gecko_browser(GeckoBrowser*);
1026 DWORD get_compat_mode_version(compat_mode_t compat_mode);
1027 compat_mode_t lock_document_mode(HTMLDocumentNode*);
1029 void init_mutation(nsIComponentManager*);
1030 void init_document_mutation(HTMLDocumentNode*);
1031 void release_document_mutation(HTMLDocumentNode*);
1032 JSContext *get_context_from_document(nsIDOMDocument*);
1034 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
1035 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
1036 void notif_focus(HTMLDocumentObj*);
1038 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
1039 void hide_tooltip(HTMLDocumentObj*);
1040 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
1042 UINT get_document_charset(HTMLDocumentNode*);
1044 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
1046 BOOL load_gecko(void);
1047 void close_gecko(void);
1048 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
1049 void init_nsio(nsIComponentManager*);
1050 void release_nsio(void);
1051 BOOL is_gecko_path(const char*);
1052 void set_viewer_zoom(GeckoBrowser*,float);
1053 float get_viewer_zoom(GeckoBrowser*);
1055 void init_node_cc(void);
1057 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
1059 HRESULT call_disp_func(IDispatch*,DISPPARAMS*,VARIANT*);
1060 void call_property_onchanged(ConnectionPointContainer*,DISPID);
1061 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
1063 void nsfree(void*);
1064 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(nsfree) __WINE_MALLOC;
1066 BOOL nsACString_Init(nsACString *str, const char *data);
1067 void nsACString_InitDepend(nsACString*,const char*);
1068 void nsACString_SetData(nsACString*,const char*);
1069 UINT32 nsACString_GetData(const nsACString*,const char**);
1070 void nsACString_Finish(nsACString*);
1072 BOOL nsAString_Init(nsAString*,const PRUnichar*);
1073 void nsAString_InitDepend(nsAString*,const PRUnichar*);
1074 void nsAString_SetData(nsAString*,const PRUnichar*);
1075 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**);
1076 void nsAString_Finish(nsAString*);
1078 #define NSSTR_IMPLICIT_PX 0x01
1079 #define NSSTR_COLOR 0x02
1081 HRESULT map_nsresult(nsresult);
1082 HRESULT return_nsstr(nsresult,nsAString*,BSTR*);
1083 HRESULT return_nsstr_variant(nsresult,nsAString*,unsigned,VARIANT*);
1084 HRESULT variant_to_nsstr(VARIANT*,BOOL,nsAString*);
1085 HRESULT return_nsform(nsresult,nsIDOMHTMLFormElement*,IHTMLFormElement**);
1087 nsICommandParams *create_nscommand_params(void);
1088 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
1089 void setup_editor_controller(GeckoBrowser*);
1090 nsresult get_nsinterface(nsISupports*,REFIID,void**);
1091 nsIWritableVariant *create_nsvariant(void);
1092 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow);
1093 nsresult create_nsfile(const PRUnichar*,nsIFile**);
1094 char *get_nscategory_entry(const char*,const char*);
1096 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*);
1097 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*);
1098 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*,DWORD);
1099 void abort_window_bindings(HTMLInnerWindow*);
1100 void set_download_state(HTMLDocumentObj*,int);
1101 void call_docview_84(HTMLDocumentObj*);
1102 HRESULT reload_page(HTMLOuterWindow*);
1104 void set_ready_state(HTMLOuterWindow*,READYSTATE);
1105 HRESULT get_readystate_string(READYSTATE,BSTR*);
1107 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
1108 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
1109 HRESULT create_style_sheet(nsIDOMStyleSheet*,compat_mode_t,IHTMLStyleSheet**);
1110 HRESULT create_style_sheet_collection(nsIDOMStyleSheetList*,compat_mode_t,
1111 IHTMLStyleSheetsCollection**);
1112 HRESULT create_dom_range(nsIDOMRange*,compat_mode_t,IHTMLDOMRange**);
1113 HRESULT create_markup_pointer(IMarkupPointer**);
1115 void detach_document_node(HTMLDocumentNode*);
1116 void detach_selection(HTMLDocumentNode*);
1117 void detach_ranges(HTMLDocumentNode*);
1118 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
1119 HRESULT replace_node_by_html(nsIDOMDocument*,nsIDOMNode*,const WCHAR*);
1121 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMElement**);
1122 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**);
1124 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**);
1126 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr);
1127 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret);
1129 static inline BOOL is_main_content_window(HTMLOuterWindow *window)
1131 return window->browser && window == window->browser->content_window;
1134 struct HTMLAttributeCollection {
1135 DispatchEx dispex;
1136 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
1137 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
1138 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
1140 LONG ref;
1142 HTMLElement *elem;
1143 struct list attrs;
1146 typedef struct {
1147 DispatchEx dispex;
1148 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
1149 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
1151 LONG ref;
1153 /* value is valid only for detached attributes (when elem == NULL). */
1154 VARIANT value;
1155 /* name must be valid for detached attributes */
1156 WCHAR *name;
1158 HTMLElement *elem;
1159 DISPID dispid;
1160 struct list entry;
1161 } HTMLDOMAttribute;
1163 HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*);
1165 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,compat_mode_t,HTMLDOMAttribute**);
1167 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**);
1168 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**);
1169 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1170 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1171 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1172 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1173 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1174 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1175 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1176 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1177 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1178 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1179 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1180 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1181 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1182 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1183 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1184 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1185 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1186 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1187 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1188 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1189 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1190 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1191 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1192 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1193 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1194 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**);
1196 HRESULT create_svg_element(HTMLDocumentNode*,nsIDOMSVGElement*,const WCHAR*,HTMLElement**);
1198 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*,dispex_static_data_t*);
1199 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMElement*,dispex_static_data_t*);
1201 void EventTarget_Init(EventTarget*,IUnknown*,dispex_static_data_t*,compat_mode_t);
1202 HRESULT EventTarget_QI(EventTarget*,REFIID,void**);
1203 void EventTarget_init_dispex_info(dispex_data_t*,compat_mode_t);
1205 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
1206 void HTMLDOMNode_destructor(HTMLDOMNode*);
1207 void HTMLDOMNode_init_dispex_info(dispex_data_t*,compat_mode_t);
1209 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
1210 void HTMLElement_destructor(HTMLDOMNode*);
1211 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
1212 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**);
1213 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
1214 void HTMLElement_init_dispex_info(dispex_data_t*,compat_mode_t);
1216 HRESULT get_node(nsIDOMNode*,BOOL,HTMLDOMNode**);
1217 HRESULT get_element(nsIDOMElement*,HTMLElement**);
1218 HRESULT get_document_node(nsIDOMDocument*,HTMLDocumentNode**);
1220 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*);
1222 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*);
1223 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**);
1224 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**);
1225 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*);
1226 HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*,BOOL*);
1228 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**);
1230 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
1231 IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,compat_mode_t);
1232 IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,compat_mode_t);
1233 HRESULT create_child_collection(nsIDOMNodeList*,compat_mode_t,IHTMLDOMChildrenCollection**);
1235 HRESULT attr_value_to_string(VARIANT*);
1236 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*);
1237 HRESULT get_elem_source_index(HTMLElement*,LONG*);
1239 nsresult get_elem_attr_value(nsIDOMElement*,const WCHAR*,nsAString*,const PRUnichar**);
1240 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*);
1241 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*);
1243 HRESULT elem_unique_id(unsigned id, BSTR *p);
1245 /* commands */
1246 typedef struct {
1247 DWORD id;
1248 HRESULT (*query)(HTMLDocumentNode*,OLECMD*);
1249 HRESULT (*exec)(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*);
1250 } cmdtable_t;
1252 extern const cmdtable_t editmode_cmds[];
1254 void do_ns_command(HTMLDocumentNode*,const char*,nsICommandParams*);
1256 /* timer */
1257 #define UPDATE_UI 0x0001
1258 #define UPDATE_TITLE 0x0002
1260 void update_doc(HTMLDocumentObj*,DWORD);
1261 void update_title(HTMLDocumentObj*);
1262 void set_document_navigation(HTMLDocumentObj*,BOOL);
1264 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**);
1266 /* editor */
1267 HRESULT setup_edit_mode(HTMLDocumentObj*);
1268 void init_editor(HTMLDocumentNode*);
1269 void handle_edit_event(HTMLDocumentNode*,nsIDOMEvent*);
1270 HRESULT editor_exec_copy(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*);
1271 HRESULT editor_exec_cut(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*);
1272 HRESULT editor_exec_paste(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*);
1273 HRESULT browser_is_dirty(GeckoBrowser*);
1274 void set_dirty(GeckoBrowser*,VARIANT_BOOL);
1276 extern DWORD mshtml_tls;
1278 typedef struct task_t task_t;
1279 typedef void (*task_proc_t)(task_t*);
1281 struct task_t {
1282 LONG target_magic;
1283 task_proc_t proc;
1284 task_proc_t destr;
1285 struct list entry;
1288 typedef struct event_task_t event_task_t;
1289 typedef void (*event_task_proc_t)(event_task_t*);
1291 struct event_task_t {
1292 LONG target_magic;
1293 BOOL thread_blocked;
1294 event_task_proc_t proc;
1295 event_task_proc_t destr;
1296 struct list entry;
1297 HTMLInnerWindow *window;
1300 typedef struct {
1301 task_t header;
1302 HTMLDocumentObj *doc;
1303 } docobj_task_t;
1305 typedef struct {
1306 HWND thread_hwnd;
1307 struct list task_list;
1308 struct list event_task_list;
1309 struct list timer_list;
1310 struct list *pending_xhr_events_tail;
1311 struct wine_rb_tree session_storage_map;
1312 void *blocking_xhr;
1313 } thread_data_t;
1315 thread_data_t *get_thread_data(BOOL);
1316 HWND get_thread_hwnd(void);
1317 void unblock_tasks_and_timers(thread_data_t*);
1318 int session_storage_map_cmp(const void*,const struct wine_rb_entry*);
1319 void destroy_session_storage(thread_data_t*);
1321 LONG get_task_target_magic(void);
1322 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG);
1323 HRESULT push_event_task(event_task_t*,HTMLInnerWindow*,event_task_proc_t,event_task_proc_t,LONG);
1324 void remove_target_tasks(LONG);
1325 ULONGLONG get_time_stamp(void);
1327 enum timer_type {
1328 TIMER_TIMEOUT,
1329 TIMER_INTERVAL,
1330 TIMER_ANIMATION_FRAME,
1333 HRESULT set_task_timer(HTMLInnerWindow*,LONG,enum timer_type,IDispatch*,LONG*);
1334 HRESULT clear_task_timer(HTMLInnerWindow*,DWORD);
1335 HRESULT clear_animation_timer(HTMLInnerWindow*,DWORD);
1337 const WCHAR *parse_compat_version(const WCHAR*,compat_mode_t*);
1339 const char *debugstr_mshtml_guid(const GUID*);
1341 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1342 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1343 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1344 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1345 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1347 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1349 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1351 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1352 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1354 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1355 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1357 /* memory allocation functions */
1359 static inline WCHAR *strndupW(LPCWSTR str, unsigned len)
1361 LPWSTR ret = NULL;
1363 if(str) {
1364 ret = malloc((len + 1) * sizeof(WCHAR));
1365 if(ret)
1367 memcpy(ret, str, len*sizeof(WCHAR));
1368 ret[len] = 0;
1372 return ret;
1375 static inline WCHAR *strdupAtoW(const char *str)
1377 LPWSTR ret = NULL;
1379 if(str) {
1380 DWORD len;
1382 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1383 ret = malloc(len * sizeof(WCHAR));
1384 if(ret)
1385 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1388 return ret;
1391 static inline char *strdupWtoA(const WCHAR *str)
1393 char *ret = NULL;
1395 if(str) {
1396 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1397 ret = malloc(size);
1398 if(ret)
1399 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1402 return ret;
1405 static inline WCHAR *strdupUtoW(const char *str)
1407 WCHAR *ret = NULL;
1409 if(str) {
1410 size_t len;
1412 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1413 ret = malloc(len * sizeof(WCHAR));
1414 if(ret)
1415 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1418 return ret;
1421 static inline char *strdupWtoU(const WCHAR *str)
1423 char *ret = NULL;
1425 if(str) {
1426 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1427 ret = malloc(size);
1428 if(ret)
1429 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1432 return ret;
1435 static inline char *strndupWtoU(const WCHAR *str, unsigned len)
1437 char *ret = NULL;
1438 DWORD size;
1440 if(str) {
1441 size = len ? WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL) : 0;
1442 ret = malloc(size + 1);
1443 if(ret) {
1444 if(len) WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL);
1445 ret[size] = '\0';
1449 return ret;
1452 static inline VARIANT_BOOL variant_bool(BOOL b)
1454 return b ? VARIANT_TRUE : VARIANT_FALSE;
1457 static inline BOOL is_digit(WCHAR c)
1459 return '0' <= c && c <= '9';
1462 static inline BOOL is_power_of_2(unsigned x)
1464 return !(x & (x - 1));
1467 #ifdef __i386__
1468 extern void *call_thiscall_func;
1469 #endif
1471 compat_mode_t get_max_compat_mode(IUri*);
1472 UINT cp_from_charset_string(BSTR);
1473 BSTR charset_string_from_cp(UINT);
1474 HRESULT get_mime_type_display_name(const WCHAR*,BSTR*);
1475 HINSTANCE get_shdoclc(void);
1476 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR);
1477 IInternetSecurityManager *get_security_manager(void);
1479 extern HINSTANCE hInst;
1480 void create_console(compat_mode_t compat_mode, IWineMSHTMLConsole **ret);
1481 HRESULT create_media_query_list(HTMLWindow *window, BSTR media_query, IDispatch **ret);