dinput: Delete the action mapping registry key on SetActionMap.
[wine.git] / dlls / mshtml / mshtml_private.h
blob8a14d2ee47f5b41d271abf628f4940689cec64bf
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
79 typedef struct DOMEvent DOMEvent;
80 typedef struct HTMLDOMNode HTMLDOMNode;
81 typedef struct ConnectionPoint ConnectionPoint;
82 typedef struct BSCallback BSCallback;
83 typedef struct EventTarget EventTarget;
85 #define TID_LIST \
86 XIID(NULL) \
87 XDIID(DispCEventObj) \
88 XDIID(DispCPlugins) \
89 XDIID(DispDOMChildrenCollection) \
90 XDIID(DispDOMCustomEvent) \
91 XDIID(DispDOMEvent) \
92 XDIID(DispDOMKeyboardEvent) \
93 XDIID(DispDOMMessageEvent) \
94 XDIID(DispDOMMouseEvent) \
95 XDIID(DispDOMProgressEvent) \
96 XDIID(DispDOMStorageEvent) \
97 XDIID(DispDOMUIEvent) \
98 XDIID(DispDOMDocumentType) \
99 XDIID(DispHTMLAnchorElement) \
100 XDIID(DispHTMLAreaElement) \
101 XDIID(DispHTMLAttributeCollection) \
102 XDIID(DispHTMLBody) \
103 XDIID(DispHTMLButtonElement) \
104 XDIID(DispHTMLCommentElement) \
105 XDIID(DispHTMLCurrentStyle) \
106 XDIID(DispHTMLDocument) \
107 XDIID(DispHTMLDOMAttribute) \
108 XDIID(DispHTMLDOMImplementation) \
109 XDIID(DispHTMLDOMRange) \
110 XDIID(DispHTMLDOMTextNode) \
111 XDIID(DispHTMLElementCollection) \
112 XDIID(DispHTMLEmbed) \
113 XDIID(DispHTMLFormElement) \
114 XDIID(DispHTMLGenericElement) \
115 XDIID(DispHTMLFrameElement) \
116 XDIID(DispHTMLHeadElement) \
117 XDIID(DispHTMLHtmlElement) \
118 XDIID(DispHTMLHistory) \
119 XDIID(DispHTMLIFrame) \
120 XDIID(DispHTMLImg) \
121 XDIID(DispHTMLInputElement) \
122 XDIID(DispHTMLLabelElement) \
123 XDIID(DispHTMLLinkElement) \
124 XDIID(DispHTMLLocation) \
125 XDIID(DispHTMLMetaElement) \
126 XDIID(DispHTMLNamespaceCollection) \
127 XDIID(DispHTMLNavigator) \
128 XDIID(DispHTMLObjectElement) \
129 XDIID(DispHTMLOptionElement) \
130 XDIID(DispHTMLScreen) \
131 XDIID(DispHTMLScriptElement) \
132 XDIID(DispHTMLSelectElement) \
133 XDIID(DispHTMLStyle) \
134 XDIID(DispHTMLStyleElement) \
135 XDIID(DispHTMLStyleSheet) \
136 XDIID(DispHTMLStyleSheetRule) \
137 XDIID(DispHTMLStyleSheetRulesCollection) \
138 XDIID(DispHTMLStyleSheetsCollection) \
139 XDIID(DispHTMLTable) \
140 XDIID(DispHTMLTableCell) \
141 XDIID(DispHTMLTableRow) \
142 XDIID(DispHTMLTextAreaElement) \
143 XDIID(DispHTMLTitleElement) \
144 XDIID(DispHTMLUnknownElement) \
145 XDIID(DispHTMLW3CComputedStyle) \
146 XDIID(DispHTMLWindow2) \
147 XDIID(DispHTMLXMLHttpRequest) \
148 XDIID(DispSVGCircleElement) \
149 XDIID(DispSVGSVGElement) \
150 XDIID(DispSVGTSpanElement) \
151 XDIID(HTMLDocumentEvents) \
152 XDIID(HTMLDocumentEvents2) \
153 XDIID(HTMLElementEvents2) \
154 XIID(IDOMCustomEvent) \
155 XIID(IDOMEvent) \
156 XIID(IDOMKeyboardEvent) \
157 XIID(IDOMMessageEvent) \
158 XIID(IDOMMouseEvent) \
159 XIID(IDOMProgressEvent) \
160 XIID(IDOMStorageEvent) \
161 XIID(IDOMUIEvent) \
162 XIID(IDOMDocumentType) \
163 XIID(IDocumentEvent) \
164 XIID(IDocumentRange) \
165 XIID(IDocumentSelector) \
166 XIID(IElementSelector) \
167 XIID(IElementTraversal) \
168 XIID(IEventTarget) \
169 XIID(IHTMLAnchorElement) \
170 XIID(IHTMLAreaElement) \
171 XIID(IHTMLAttributeCollection) \
172 XIID(IHTMLAttributeCollection2) \
173 XIID(IHTMLAttributeCollection3) \
174 XIID(IHTMLBodyElement) \
175 XIID(IHTMLBodyElement2) \
176 XIID(IHTMLButtonElement) \
177 XIID(IHTMLCSSStyleDeclaration) \
178 XIID(IHTMLCSSStyleDeclaration2) \
179 XIID(IHTMLCommentElement) \
180 XIID(IHTMLCurrentStyle) \
181 XIID(IHTMLCurrentStyle2) \
182 XIID(IHTMLCurrentStyle3) \
183 XIID(IHTMLCurrentStyle4) \
184 XIID(IHTMLDocument2) \
185 XIID(IHTMLDocument3) \
186 XIID(IHTMLDocument4) \
187 XIID(IHTMLDocument5) \
188 XIID(IHTMLDocument6) \
189 XIID(IHTMLDocument7) \
190 XIID(IHTMLDOMAttribute) \
191 XIID(IHTMLDOMAttribute2) \
192 XIID(IHTMLDOMChildrenCollection) \
193 XIID(IHTMLDOMImplementation) \
194 XIID(IHTMLDOMImplementation2) \
195 XIID(IHTMLDOMNode) \
196 XIID(IHTMLDOMNode2) \
197 XIID(IHTMLDOMNode3) \
198 XIID(IHTMLDOMRange) \
199 XIID(IHTMLDOMTextNode) \
200 XIID(IHTMLDOMTextNode2) \
201 XIID(IHTMLElement) \
202 XIID(IHTMLElement2) \
203 XIID(IHTMLElement3) \
204 XIID(IHTMLElement4) \
205 XIID(IHTMLElement6) \
206 XIID(IHTMLElement7) \
207 XIID(IHTMLElementCollection) \
208 XIID(IHTMLEmbedElement) \
209 XIID(IHTMLEventObj) \
210 XIID(IHTMLFiltersCollection) \
211 XIID(IHTMLFormElement) \
212 XIID(IHTMLFrameBase) \
213 XIID(IHTMLFrameBase2) \
214 XIID(IHTMLFrameElement3) \
215 XIID(IHTMLGenericElement) \
216 XIID(IHTMLHeadElement) \
217 XIID(IHTMLHtmlElement) \
218 XIID(IHTMLIFrameElement) \
219 XIID(IHTMLIFrameElement2) \
220 XIID(IHTMLIFrameElement3) \
221 XIID(IHTMLImageElementFactory) \
222 XIID(IHTMLImgElement) \
223 XIID(IHTMLInputElement) \
224 XIID(IHTMLInputTextElement2) \
225 XIID(IHTMLLabelElement) \
226 XIID(IHTMLLinkElement) \
227 XIID(IHTMLLocation) \
228 XIID(IHTMLMetaElement) \
229 XIID(IHTMLMimeTypesCollection) \
230 XIID(IHTMLNamespaceCollection) \
231 XIID(IHTMLObjectElement) \
232 XIID(IHTMLObjectElement2) \
233 XIID(IHTMLOptionElement) \
234 XIID(IHTMLOptionElementFactory) \
235 XIID(IHTMLPerformance) \
236 XIID(IHTMLPerformanceNavigation) \
237 XIID(IHTMLPerformanceTiming) \
238 XIID(IHTMLPluginsCollection) \
239 XIID(IHTMLRect) \
240 XIID(IHTMLRect2) \
241 XIID(IHTMLRectCollection) \
242 XIID(IHTMLScreen) \
243 XIID(IHTMLScriptElement) \
244 XIID(IHTMLSelectElement) \
245 XIID(IHTMLSelectionObject) \
246 XIID(IHTMLSelectionObject2) \
247 XIID(IHTMLStorage) \
248 XIID(IHTMLStyle) \
249 XIID(IHTMLStyle2) \
250 XIID(IHTMLStyle3) \
251 XIID(IHTMLStyle4) \
252 XIID(IHTMLStyle5) \
253 XIID(IHTMLStyle6) \
254 XIID(IHTMLStyleElement) \
255 XIID(IHTMLStyleElement2) \
256 XIID(IHTMLStyleSheet) \
257 XIID(IHTMLStyleSheet4) \
258 XIID(IHTMLStyleSheetRule) \
259 XIID(IHTMLStyleSheetRulesCollection) \
260 XIID(IHTMLStyleSheetsCollection) \
261 XIID(IHTMLTable) \
262 XIID(IHTMLTable2) \
263 XIID(IHTMLTable3) \
264 XIID(IHTMLTableCell) \
265 XIID(IHTMLTableRow) \
266 XIID(IHTMLTextAreaElement) \
267 XIID(IHTMLTextContainer) \
268 XIID(IHTMLTitleElement) \
269 XIID(IHTMLTxtRange) \
270 XIID(IHTMLUniqueName) \
271 XIID(IHTMLWindow2) \
272 XIID(IHTMLWindow3) \
273 XIID(IHTMLWindow4) \
274 XIID(IHTMLWindow5) \
275 XIID(IHTMLWindow6) \
276 XIID(IHTMLWindow7) \
277 XIID(IHTMLXMLHttpRequest) \
278 XIID(IHTMLXMLHttpRequest2) \
279 XIID(IHTMLXMLHttpRequestFactory) \
280 XIID(IOmHistory) \
281 XIID(IOmNavigator) \
282 XIID(ISVGCircleElement) \
283 XIID(ISVGElement) \
284 XIID(ISVGSVGElement) \
285 XIID(ISVGTSpanElement) \
286 XIID(ISVGTextContentElement)
288 #define PRIVATE_TID_LIST \
289 XIID(IWineDOMTokenList) \
290 XIID(IWineHTMLElementPrivate) \
291 XIID(IWineHTMLWindowPrivate) \
292 XIID(IWineHTMLWindowCompatPrivate) \
293 XIID(IWinePageTransitionEvent) \
294 XIID(IWineXMLHttpRequestPrivate) \
295 XIID(IWineMSHTMLConsole) \
296 XIID(IWineMSHTMLMediaQueryList)
298 typedef enum {
299 #define XIID(iface) iface ## _tid,
300 #define XDIID(iface) iface ## _tid,
301 TID_LIST
302 LAST_public_tid,
303 PRIVATE_TID_LIST
304 #undef XIID
305 #undef XDIID
306 LAST_tid
307 } tid_t;
309 typedef enum {
310 COMPAT_MODE_INVALID = -1,
311 COMPAT_MODE_QUIRKS,
312 COMPAT_MODE_IE5,
313 COMPAT_MODE_IE7,
314 COMPAT_MODE_IE8,
315 COMPAT_MODE_IE9,
316 COMPAT_MODE_IE10,
317 COMPAT_MODE_IE11
318 } compat_mode_t;
320 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
321 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
323 typedef struct {
324 unsigned document_mode;
325 unsigned ie_version;
326 } compat_mode_info_t;
328 extern const compat_mode_info_t compat_mode_info[COMPAT_MODE_CNT] DECLSPEC_HIDDEN;
330 typedef struct dispex_data_t dispex_data_t;
331 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
333 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
334 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
335 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
337 typedef struct DispatchEx DispatchEx;
339 typedef struct {
340 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
341 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
342 HRESULT (*get_name)(DispatchEx*,DISPID,BSTR*);
343 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
344 HRESULT (*delete)(DispatchEx*,DISPID);
345 HRESULT (*next_dispid)(DispatchEx*,DISPID,DISPID*);
346 compat_mode_t (*get_compat_mode)(DispatchEx*);
347 HRESULT (*populate_props)(DispatchEx*);
348 } dispex_static_data_vtbl_t;
350 typedef struct {
351 const WCHAR *name;
352 const dispex_static_data_vtbl_t *vtbl;
353 const tid_t disp_tid;
354 const tid_t* const iface_tids;
355 void (*init_info)(dispex_data_t*,compat_mode_t);
356 dispex_data_t *info_cache[COMPAT_MODE_CNT];
357 dispex_data_t *delayed_init_info;
358 } dispex_static_data_t;
360 typedef HRESULT (*dispex_hook_invoke_t)(DispatchEx*,WORD,DISPPARAMS*,VARIANT*,
361 EXCEPINFO*,IServiceProvider*);
363 typedef struct {
364 DISPID dispid;
365 dispex_hook_invoke_t invoke;
366 const WCHAR *name;
367 } dispex_hook_t;
369 struct DispatchEx {
370 IDispatchEx IDispatchEx_iface;
372 IUnknown *outer;
374 dispex_data_t *info;
375 dispex_dynamic_data_t *dynamic_data;
378 typedef struct {
379 UINT_PTR x;
380 } nsCycleCollectingAutoRefCnt;
382 typedef struct {
383 void *vtbl;
384 int ref_flags;
385 void *callbacks;
386 } ExternalCycleCollectionParticipant;
388 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback;
390 typedef struct {
391 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*);
392 nsresult (NSAPI *unlink)(void*);
393 void (NSAPI *delete_cycle_collectable)(void*);
394 } CCObjCallback;
396 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
398 extern nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN;
399 extern nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN;
400 extern void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN;
401 extern void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN;
402 extern void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
403 extern void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
405 void init_dispatch(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
406 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
407 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
408 HRESULT change_type(VARIANT*,VARIANT*,VARTYPE,IServiceProvider*) DECLSPEC_HIDDEN;
409 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
410 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
411 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
412 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,BOOL,DISPID*) DECLSPEC_HIDDEN;
413 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
414 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
415 void release_typelib(void) DECLSPEC_HIDDEN;
416 HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**) DECLSPEC_HIDDEN;
417 const void *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
418 void dispex_info_add_interface(dispex_data_t*,tid_t,const dispex_hook_t*) DECLSPEC_HIDDEN;
419 compat_mode_t dispex_compat_mode(DispatchEx*) DECLSPEC_HIDDEN;
420 HRESULT dispex_to_string(DispatchEx*,BSTR*) DECLSPEC_HIDDEN;
421 HRESULT dispex_call_builtin(DispatchEx *dispex, DISPID id, DISPPARAMS *dp,
422 VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) DECLSPEC_HIDDEN;
424 typedef enum {
425 DISPEXPROP_CUSTOM,
426 DISPEXPROP_DYNAMIC,
427 DISPEXPROP_BUILTIN
428 } dispex_prop_type_t;
430 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN;
432 typedef struct HTMLWindow HTMLWindow;
433 typedef struct HTMLInnerWindow HTMLInnerWindow;
434 typedef struct HTMLOuterWindow HTMLOuterWindow;
435 typedef struct HTMLDocumentNode HTMLDocumentNode;
436 typedef struct HTMLDocumentObj HTMLDocumentObj;
437 typedef struct HTMLFrameBase HTMLFrameBase;
438 typedef struct GeckoBrowser GeckoBrowser;
439 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
441 typedef struct ScriptHost ScriptHost;
443 typedef enum {
444 GLOBAL_SCRIPTVAR,
445 GLOBAL_ELEMENTVAR,
446 GLOBAL_DISPEXVAR,
447 GLOBAL_FRAMEVAR
448 } global_prop_type_t;
450 typedef struct {
451 global_prop_type_t type;
452 WCHAR *name;
453 ScriptHost *script_host;
454 DISPID id;
455 } global_prop_t;
457 struct EventTarget {
458 DispatchEx dispex;
459 IEventTarget IEventTarget_iface;
460 struct wine_rb_tree handler_map;
463 typedef struct {
464 DispatchEx dispex;
465 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
467 LONG ref;
469 HTMLInnerWindow *window;
470 } HTMLOptionElementFactory;
472 typedef struct {
473 DispatchEx dispex;
474 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
476 LONG ref;
478 HTMLInnerWindow *window;
479 } HTMLImageElementFactory;
481 typedef struct {
482 DispatchEx dispex;
483 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
485 LONG ref;
487 HTMLInnerWindow *window;
488 } HTMLXMLHttpRequestFactory;
490 struct HTMLLocation {
491 DispatchEx dispex;
492 IHTMLLocation IHTMLLocation_iface;
495 typedef struct {
496 DispatchEx dispex;
497 IOmHistory IOmHistory_iface;
499 LONG ref;
501 HTMLInnerWindow *window;
502 } OmHistory;
504 typedef struct {
505 DispatchEx dispex;
506 IHTMLPerformanceTiming IHTMLPerformanceTiming_iface;
508 LONG ref;
510 ULONG navigation_type;
511 ULONG redirect_count;
513 ULONGLONG navigation_start_time;
514 ULONGLONG unload_event_start_time;
515 ULONGLONG unload_event_end_time;
516 ULONGLONG redirect_time;
517 ULONGLONG dns_lookup_time;
518 ULONGLONG connect_time;
519 ULONGLONG request_time;
520 ULONGLONG response_start_time;
521 ULONGLONG response_end_time;
522 ULONGLONG dom_interactive_time;
523 ULONGLONG dom_complete_time;
524 ULONGLONG dom_content_loaded_event_start_time;
525 ULONGLONG dom_content_loaded_event_end_time;
526 ULONGLONG load_event_start_time;
527 ULONGLONG load_event_end_time;
528 ULONGLONG first_paint_time;
529 } HTMLPerformanceTiming;
531 typedef struct nsChannelBSC nsChannelBSC;
533 struct HTMLWindow {
534 IHTMLWindow2 IHTMLWindow2_iface;
535 IHTMLWindow3 IHTMLWindow3_iface;
536 IHTMLWindow4 IHTMLWindow4_iface;
537 IHTMLWindow5 IHTMLWindow5_iface;
538 IHTMLWindow6 IHTMLWindow6_iface;
539 IHTMLWindow7 IHTMLWindow7_iface;
540 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
541 IDispatchEx IDispatchEx_iface;
542 IServiceProvider IServiceProvider_iface;
543 ITravelLogClient ITravelLogClient_iface;
544 IObjectIdentity IObjectIdentity_iface;
545 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
546 IWineHTMLWindowPrivate IWineHTMLWindowPrivate_iface;
547 IWineHTMLWindowCompatPrivate IWineHTMLWindowCompatPrivate_iface;
549 IWineMSHTMLConsole *console;
551 LONG ref;
553 HTMLInnerWindow *inner_window;
554 HTMLOuterWindow *outer_window;
557 struct HTMLOuterWindow {
558 HTMLWindow base;
560 LONG task_magic;
562 nsIDOMWindow *nswindow;
563 mozIDOMWindowProxy *window_proxy;
564 HTMLOuterWindow *parent;
565 HTMLFrameBase *frame_element;
567 GeckoBrowser *browser;
568 struct list browser_entry;
570 READYSTATE readystate;
571 unsigned readystate_locked;
572 BOOL readystate_pending;
574 HTMLInnerWindow *pending_window;
575 HTMLLocation location;
576 IMoniker *mon;
577 IUri *uri;
578 IUri *uri_nofrag;
579 BSTR url;
580 DWORD load_flags;
582 struct list sibling_entry;
583 struct wine_rb_entry entry;
586 struct HTMLInnerWindow {
587 HTMLWindow base;
588 EventTarget event_target;
590 HTMLDocumentNode *doc;
592 struct list children;
593 struct list script_hosts;
595 IHTMLEventObj *event;
597 HTMLImageElementFactory *image_factory;
598 HTMLOptionElementFactory *option_factory;
599 HTMLXMLHttpRequestFactory *xhr_factory;
600 IHTMLScreen *screen;
601 OmHistory *history;
602 IOmNavigator *navigator;
603 IHTMLStorage *session_storage;
604 IHTMLStorage *local_storage;
606 BOOL performance_initialized;
607 VARIANT performance;
608 HTMLPerformanceTiming *performance_timing;
610 unsigned blocking_depth;
611 unsigned parser_callback_cnt;
612 struct list script_queue;
614 global_prop_t *global_props;
615 DWORD global_prop_cnt;
616 DWORD global_prop_size;
618 LONG task_magic;
620 IMoniker *mon;
621 nsChannelBSC *bscallback;
622 struct list bindings;
625 typedef enum {
626 UNKNOWN_USERMODE,
627 BROWSEMODE,
628 EDITMODE
629 } USERMODE;
631 typedef struct _cp_static_data_t {
632 tid_t tid;
633 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
634 BOOL pass_event_arg;
635 DWORD id_cnt;
636 DISPID *ids;
637 } cp_static_data_t;
639 typedef struct {
640 const IID *riid;
641 cp_static_data_t *desc;
642 } cpc_entry_t;
644 typedef struct ConnectionPointContainer {
645 IConnectionPointContainer IConnectionPointContainer_iface;
647 ConnectionPoint *cps;
648 const cpc_entry_t *cp_entries;
649 IUnknown *outer;
650 struct ConnectionPointContainer *forward_container;
651 } ConnectionPointContainer;
653 struct ConnectionPoint {
654 IConnectionPoint IConnectionPoint_iface;
656 ConnectionPointContainer *container;
658 union {
659 IUnknown *unk;
660 IDispatch *disp;
661 IPropertyNotifySink *propnotif;
662 } *sinks;
663 DWORD sinks_size;
665 const IID *iid;
666 cp_static_data_t *data;
669 struct HTMLDocumentObj {
670 IUnknown IUnknown_inner;
671 IDispatchEx IDispatchEx_iface;
672 ICustomDoc ICustomDoc_iface;
673 IHTMLDocument2 IHTMLDocument2_iface;
674 IHTMLDocument3 IHTMLDocument3_iface;
675 IHTMLDocument4 IHTMLDocument4_iface;
676 IHTMLDocument5 IHTMLDocument5_iface;
677 IHTMLDocument6 IHTMLDocument6_iface;
678 IHTMLDocument7 IHTMLDocument7_iface;
679 IDocumentSelector IDocumentSelector_iface;
680 IDocumentEvent IDocumentEvent_iface;
681 ISupportErrorInfo ISupportErrorInfo_iface;
682 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
683 IMarkupServices IMarkupServices_iface;
684 IMarkupContainer IMarkupContainer_iface;
685 IDisplayServices IDisplayServices_iface;
686 IDocumentRange IDocumentRange_iface;
687 IOleDocumentView IOleDocumentView_iface;
688 IViewObjectEx IViewObjectEx_iface;
689 IPersistMoniker IPersistMoniker_iface;
690 IPersistFile IPersistFile_iface;
691 IMonikerProp IMonikerProp_iface;
692 IPersistStreamInit IPersistStreamInit_iface;
693 IPersistHistory IPersistHistory_iface;
694 IHlinkTarget IHlinkTarget_iface;
695 IOleCommandTarget IOleCommandTarget_iface;
696 IOleObject IOleObject_iface;
697 IOleDocument IOleDocument_iface;
698 IOleControl IOleControl_iface;
699 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
700 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
701 IObjectWithSite IObjectWithSite_iface;
702 IOleContainer IOleContainer_iface;
703 IObjectSafety IObjectSafety_iface;
704 IServiceProvider IServiceProvider_iface;
705 ITargetContainer ITargetContainer_iface;
706 IEventTarget IEventTarget_iface;
708 IWindowForBindingUI IWindowForBindingUI_iface;
710 LONG ref;
712 IUnknown *outer_unk;
713 HTMLOuterWindow *window;
714 GeckoBrowser *nscontainer;
715 HTMLDocumentNode *doc_node;
717 IOleClientSite *client;
718 IDocHostUIHandler *hostui;
719 IOleCommandTarget *client_cmdtrg;
720 BOOL custom_hostui;
721 IOleInPlaceSite *ipsite;
722 IOleInPlaceFrame *frame;
723 IOleInPlaceUIWindow *ip_window;
724 IAdviseSink *view_sink;
725 IDocObjectService *doc_object_service;
726 IUnknown *webbrowser;
727 ITravelLog *travel_log;
728 IUnknown *browser_service;
729 IOleAdviseHolder *advise_holder;
731 ConnectionPointContainer cp_container;
732 DOCHOSTUIINFO hostinfo;
734 IOleUndoManager *undomgr;
735 IHTMLEditServices *editsvcs;
737 HWND hwnd;
738 HWND tooltips_hwnd;
740 BOOL is_mhtml;
741 BOOL request_uiactivate;
742 BOOL in_place_active;
743 BOOL ui_active;
744 BOOL window_active;
745 BOOL hostui_setup;
746 BOOL container_locked;
747 BOOL focus;
748 BOOL has_popup;
749 INT download_state;
751 LPWSTR mime;
753 DWORD update;
754 LONG task_magic;
755 SIZEL extent;
758 typedef struct nsWeakReference nsWeakReference;
761 typedef enum {
762 SCRIPTMODE_GECKO,
763 SCRIPTMODE_ACTIVESCRIPT
764 } SCRIPTMODE;
766 struct GeckoBrowser {
767 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
768 nsIContextMenuListener nsIContextMenuListener_iface;
769 nsIURIContentListener nsIURIContentListener_iface;
770 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
771 nsITooltipListener nsITooltipListener_iface;
772 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
773 nsISupportsWeakReference nsISupportsWeakReference_iface;
775 nsIWebBrowser *webbrowser;
776 nsIWebNavigation *navigation;
777 nsIBaseWindow *window;
778 nsIWebBrowserFocus *focus;
780 HTMLOuterWindow *content_window;
782 nsIEditor *editor;
783 nsIController *editor_controller;
785 LONG ref;
787 nsWeakReference *weak_reference;
789 HTMLDocumentObj *doc;
791 nsIURIContentListener *content_listener;
793 HWND hwnd;
794 SCRIPTMODE script_mode;
795 USERMODE usermode;
797 struct list document_nodes;
798 struct list outer_windows;
801 typedef struct {
802 const CLSID *clsid;
803 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
804 void (*destructor)(HTMLDOMNode*);
805 const cpc_entry_t *cpc_entries;
806 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
807 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
808 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
809 EventTarget *(*get_event_prop_target)(HTMLDOMNode*,int);
810 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
811 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
812 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
813 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
814 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
815 HRESULT (*get_name)(HTMLDOMNode*,DISPID,BSTR*);
816 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
817 HRESULT (*bind_to_tree)(HTMLDOMNode*);
818 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
819 void (*unlink)(HTMLDOMNode*);
820 BOOL (*is_text_edit)(HTMLDOMNode*);
821 BOOL (*is_settable)(HTMLDOMNode*,DISPID);
822 } NodeImplVtbl;
824 struct HTMLDOMNode {
825 EventTarget event_target;
826 IHTMLDOMNode IHTMLDOMNode_iface;
827 IHTMLDOMNode2 IHTMLDOMNode2_iface;
828 IHTMLDOMNode3 IHTMLDOMNode3_iface;
829 const NodeImplVtbl *vtbl;
831 nsCycleCollectingAutoRefCnt ccref;
833 nsIDOMNode *nsnode;
834 HTMLDocumentNode *doc;
837 HTMLDOMNode *unsafe_impl_from_IHTMLDOMNode(IHTMLDOMNode*) DECLSPEC_HIDDEN;
839 static inline void node_addref(HTMLDOMNode *node)
841 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface);
844 static inline void node_release(HTMLDOMNode *node)
846 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface);
849 typedef struct {
850 HTMLDOMNode node;
851 ConnectionPointContainer cp_container;
853 IHTMLElement IHTMLElement_iface;
854 IHTMLElement2 IHTMLElement2_iface;
855 IHTMLElement3 IHTMLElement3_iface;
856 IHTMLElement4 IHTMLElement4_iface;
857 IHTMLElement6 IHTMLElement6_iface;
858 IHTMLElement7 IHTMLElement7_iface;
859 IHTMLUniqueName IHTMLUniqueName_iface;
860 IElementSelector IElementSelector_iface;
861 IElementTraversal IElementTraversal_iface;
862 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
863 IWineHTMLElementPrivate IWineHTMLElementPrivate_iface;
865 nsIDOMElement *dom_element; /* NULL for legacy comments represented as HTML elements */
866 nsIDOMHTMLElement *html_element; /* NULL for non-HTML elements (like SVG elements) */
867 HTMLStyle *style;
868 HTMLStyle *runtime_style;
869 HTMLAttributeCollection *attrs;
870 WCHAR *filter;
871 unsigned unique_id;
872 } HTMLElement;
874 #define HTMLELEMENT_TIDS \
875 IHTMLDOMNode_tid, \
876 IHTMLDOMNode2_tid, \
877 IHTMLElement_tid, \
878 IHTMLElement3_tid, \
879 IHTMLElement4_tid, \
880 IHTMLUniqueName_tid
882 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN;
883 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
884 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN;
886 struct HTMLFrameBase {
887 HTMLElement element;
889 IHTMLFrameBase IHTMLFrameBase_iface;
890 IHTMLFrameBase2 IHTMLFrameBase2_iface;
892 HTMLOuterWindow *content_window;
894 nsIDOMHTMLFrameElement *nsframe;
895 nsIDOMHTMLIFrameElement *nsiframe;
898 typedef struct nsDocumentEventListener nsDocumentEventListener;
900 struct HTMLDocumentNode {
901 HTMLDOMNode node;
903 IDispatchEx IDispatchEx_iface;
904 IHTMLDocument2 IHTMLDocument2_iface;
905 IHTMLDocument3 IHTMLDocument3_iface;
906 IHTMLDocument4 IHTMLDocument4_iface;
907 IHTMLDocument5 IHTMLDocument5_iface;
908 IHTMLDocument6 IHTMLDocument6_iface;
909 IHTMLDocument7 IHTMLDocument7_iface;
910 IDocumentSelector IDocumentSelector_iface;
911 IDocumentEvent IDocumentEvent_iface;
912 ISupportErrorInfo ISupportErrorInfo_iface;
913 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
914 IMarkupServices IMarkupServices_iface;
915 IMarkupContainer IMarkupContainer_iface;
916 IDisplayServices IDisplayServices_iface;
917 IDocumentRange IDocumentRange_iface;
918 IPersistMoniker IPersistMoniker_iface;
919 IPersistFile IPersistFile_iface;
920 IMonikerProp IMonikerProp_iface;
921 IPersistStreamInit IPersistStreamInit_iface;
922 IPersistHistory IPersistHistory_iface;
923 IHlinkTarget IHlinkTarget_iface;
924 IOleCommandTarget IOleCommandTarget_iface;
925 IOleObject IOleObject_iface;
926 IOleDocument IOleDocument_iface;
927 IOleControl IOleControl_iface;
928 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
929 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
930 IObjectWithSite IObjectWithSite_iface;
931 IOleContainer IOleContainer_iface;
932 IObjectSafety IObjectSafety_iface;
933 IServiceProvider IServiceProvider_iface;
934 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
936 nsIDocumentObserver nsIDocumentObserver_iface;
938 LONG ref;
940 ConnectionPointContainer cp_container;
941 HTMLOuterWindow *outer_window;
942 HTMLInnerWindow *window;
943 HTMLDocumentObj *doc_obj;
945 GeckoBrowser *browser;
946 struct list browser_entry;
948 compat_mode_t document_mode;
949 BOOL document_mode_locked;
951 nsIDOMDocument *dom_document;
952 nsIDOMHTMLDocument *html_document;
953 BOOL content_ready : 1;
954 BOOL unload_sent : 1;
956 IHTMLDOMImplementation *dom_implementation;
957 IHTMLNamespaceCollection *namespaces;
959 ICatInformation *catmgr;
960 nsDocumentEventListener *nsevent_listener;
961 BOOL *event_vector;
963 WCHAR **elem_vars;
964 unsigned elem_vars_size;
965 unsigned elem_vars_cnt;
967 BOOL skip_mutation_notif;
969 UINT charset;
971 unsigned unique_id;
973 struct list selection_list;
974 struct list range_list;
975 struct list plugin_hosts;
978 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
979 HRESULT MHTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
980 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
981 HRESULT create_document_node(nsIDOMDocument*,GeckoBrowser*,HTMLInnerWindow*,
982 compat_mode_t,HTMLDocumentNode**) DECLSPEC_HIDDEN;
983 HRESULT create_doctype_node(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
985 HRESULT create_outer_window(GeckoBrowser*,mozIDOMWindowProxy*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
986 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN;
987 HTMLOuterWindow *mozwindow_to_window(const mozIDOMWindowProxy*) DECLSPEC_HIDDEN;
988 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
989 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
990 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
991 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN;
992 void HTMLLocation_Init(HTMLLocation*) DECLSPEC_HIDDEN;
993 HRESULT create_navigator(compat_mode_t,IOmNavigator**) DECLSPEC_HIDDEN;
994 HRESULT create_html_screen(compat_mode_t,IHTMLScreen**) DECLSPEC_HIDDEN;
995 HRESULT create_performance(HTMLInnerWindow*,IHTMLPerformance**) DECLSPEC_HIDDEN;
996 HRESULT create_performance_timing(HTMLPerformanceTiming**) DECLSPEC_HIDDEN;
997 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
998 HRESULT create_namespace_collection(compat_mode_t,IHTMLNamespaceCollection**) DECLSPEC_HIDDEN;
999 HRESULT create_dom_implementation(HTMLDocumentNode*,IHTMLDOMImplementation**) DECLSPEC_HIDDEN;
1000 void detach_dom_implementation(IHTMLDOMImplementation*) DECLSPEC_HIDDEN;
1002 HRESULT create_html_storage(HTMLInnerWindow*,BOOL,IHTMLStorage**) DECLSPEC_HIDDEN;
1003 void detach_html_storage(IHTMLStorage*) DECLSPEC_HIDDEN;
1005 void HTMLDocument_View_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1006 void HTMLDocumentObj_Persist_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1007 void HTMLDocumentObj_Service_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1008 void HTMLDocumentObj_OleCmd_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1009 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1011 void HTMLDocumentNode_Persist_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1012 void HTMLDocumentNode_Service_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1013 void HTMLDocumentNode_OleCmd_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1014 void HTMLDocumentNode_OleObj_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1015 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1017 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
1019 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
1020 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
1022 HRESULT create_gecko_browser(HTMLDocumentObj*,GeckoBrowser**) DECLSPEC_HIDDEN;
1023 void detach_gecko_browser(GeckoBrowser*) DECLSPEC_HIDDEN;
1025 DWORD get_compat_mode_version(compat_mode_t compat_mode) DECLSPEC_HIDDEN;
1026 compat_mode_t lock_document_mode(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1028 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
1029 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1030 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1031 JSContext *get_context_from_document(nsIDOMDocument*) DECLSPEC_HIDDEN;
1033 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
1034 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
1035 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1037 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
1038 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1039 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
1041 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1043 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
1045 BOOL load_gecko(void) DECLSPEC_HIDDEN;
1046 void close_gecko(void) DECLSPEC_HIDDEN;
1047 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
1048 void init_nsio(nsIComponentManager*) DECLSPEC_HIDDEN;
1049 void release_nsio(void) DECLSPEC_HIDDEN;
1050 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
1051 void set_viewer_zoom(GeckoBrowser*,float) DECLSPEC_HIDDEN;
1052 float get_viewer_zoom(GeckoBrowser*) DECLSPEC_HIDDEN;
1054 void init_node_cc(void) DECLSPEC_HIDDEN;
1056 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
1058 HRESULT call_disp_func(IDispatch*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
1059 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
1060 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
1062 void nsfree(void*) DECLSPEC_HIDDEN;
1063 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(nsfree) __WINE_MALLOC DECLSPEC_HIDDEN;
1065 BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN;
1066 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
1067 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
1068 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
1069 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
1071 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
1072 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
1073 void nsAString_SetData(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
1074 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
1075 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
1077 #define NSSTR_IMPLICIT_PX 0x01
1078 #define NSSTR_COLOR 0x02
1080 HRESULT map_nsresult(nsresult) DECLSPEC_HIDDEN;
1081 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
1082 HRESULT return_nsstr_variant(nsresult,nsAString*,unsigned,VARIANT*) DECLSPEC_HIDDEN;
1083 HRESULT variant_to_nsstr(VARIANT*,BOOL,nsAString*) DECLSPEC_HIDDEN;
1084 HRESULT return_nsform(nsresult,nsIDOMHTMLFormElement*,IHTMLFormElement**) DECLSPEC_HIDDEN;
1086 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
1087 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
1088 void setup_editor_controller(GeckoBrowser*) DECLSPEC_HIDDEN;
1089 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
1090 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
1091 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN;
1092 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN;
1093 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
1095 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
1096 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
1097 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
1098 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
1099 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
1100 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1101 HRESULT reload_page(HTMLOuterWindow*) DECLSPEC_HIDDEN;
1103 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
1104 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
1106 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
1107 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
1108 HRESULT create_style_sheet(nsIDOMStyleSheet*,compat_mode_t,IHTMLStyleSheet**) DECLSPEC_HIDDEN;
1109 HRESULT create_style_sheet_collection(nsIDOMStyleSheetList*,compat_mode_t,
1110 IHTMLStyleSheetsCollection**) DECLSPEC_HIDDEN;
1111 HRESULT create_dom_range(nsIDOMRange*,compat_mode_t,IHTMLDOMRange**) DECLSPEC_HIDDEN;
1112 HRESULT create_markup_pointer(IMarkupPointer**) DECLSPEC_HIDDEN;
1114 void detach_document_node(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1115 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1116 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1117 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
1118 HRESULT replace_node_by_html(nsIDOMDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
1120 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMElement**) DECLSPEC_HIDDEN;
1121 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1123 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1125 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN;
1126 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN;
1128 static inline BOOL is_main_content_window(HTMLOuterWindow *window)
1130 return window->browser && window == window->browser->content_window;
1133 struct HTMLAttributeCollection {
1134 DispatchEx dispex;
1135 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
1136 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
1137 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
1139 LONG ref;
1141 HTMLElement *elem;
1142 struct list attrs;
1145 typedef struct {
1146 DispatchEx dispex;
1147 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
1148 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface;
1150 LONG ref;
1152 /* value is valid only for detached attributes (when elem == NULL). */
1153 VARIANT value;
1154 /* name must be valid for detached attributes */
1155 WCHAR *name;
1157 HTMLElement *elem;
1158 DISPID dispid;
1159 struct list entry;
1160 } HTMLDOMAttribute;
1162 HTMLDOMAttribute *unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute*) DECLSPEC_HIDDEN;
1164 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,compat_mode_t,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
1166 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
1167 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
1168 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1169 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1170 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1171 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1172 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1173 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1174 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1175 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1176 HRESULT HTMLHtmlElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1177 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1178 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1179 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1180 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1181 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1182 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1183 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1184 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1185 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1186 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1187 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1188 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1189 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1190 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1191 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1192 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1193 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1195 HRESULT create_svg_element(HTMLDocumentNode*,nsIDOMSVGElement*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1197 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1198 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
1200 void EventTarget_Init(EventTarget*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1201 HRESULT EventTarget_QI(EventTarget*,REFIID,void**) DECLSPEC_HIDDEN;
1202 void EventTarget_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1204 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1205 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1206 void HTMLDOMNode_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1208 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
1209 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
1210 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
1211 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
1212 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1213 void HTMLElement_init_dispex_info(dispex_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
1215 HRESULT get_node(nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
1216 HRESULT get_element(nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN;
1217 HRESULT get_document_node(nsIDOMDocument*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
1219 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
1221 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
1222 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
1223 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
1224 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN;
1225 HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
1227 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
1229 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
1230 IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList*,compat_mode_t) DECLSPEC_HIDDEN;
1231 IHTMLElementCollection *create_collection_from_htmlcol(nsIDOMHTMLCollection*,compat_mode_t) DECLSPEC_HIDDEN;
1232 HRESULT create_child_collection(nsIDOMNodeList*,compat_mode_t,IHTMLDOMChildrenCollection**) DECLSPEC_HIDDEN;
1234 HRESULT attr_value_to_string(VARIANT*) DECLSPEC_HIDDEN;
1235 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
1236 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN;
1238 nsresult get_elem_attr_value(nsIDOMElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
1239 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN;
1240 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
1242 HRESULT elem_unique_id(unsigned id, BSTR *p) DECLSPEC_HIDDEN;
1244 /* commands */
1245 typedef struct {
1246 DWORD id;
1247 HRESULT (*query)(HTMLDocumentNode*,OLECMD*);
1248 HRESULT (*exec)(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*);
1249 } cmdtable_t;
1251 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
1253 void do_ns_command(HTMLDocumentNode*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
1255 /* timer */
1256 #define UPDATE_UI 0x0001
1257 #define UPDATE_TITLE 0x0002
1259 void update_doc(HTMLDocumentObj*,DWORD) DECLSPEC_HIDDEN;
1260 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1261 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
1263 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
1265 /* editor */
1266 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
1267 void init_editor(HTMLDocumentNode*) DECLSPEC_HIDDEN;
1268 void handle_edit_event(HTMLDocumentNode*,nsIDOMEvent*) DECLSPEC_HIDDEN;
1269 HRESULT editor_exec_copy(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1270 HRESULT editor_exec_cut(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1271 HRESULT editor_exec_paste(HTMLDocumentNode*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
1272 HRESULT browser_is_dirty(GeckoBrowser*) DECLSPEC_HIDDEN;
1273 void set_dirty(GeckoBrowser*,VARIANT_BOOL) DECLSPEC_HIDDEN;
1275 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
1277 typedef struct task_t task_t;
1278 typedef void (*task_proc_t)(task_t*);
1280 struct task_t {
1281 LONG target_magic;
1282 task_proc_t proc;
1283 task_proc_t destr;
1284 struct list entry;
1287 typedef struct event_task_t event_task_t;
1288 typedef void (*event_task_proc_t)(event_task_t*);
1290 struct event_task_t {
1291 LONG target_magic;
1292 BOOL thread_blocked;
1293 event_task_proc_t proc;
1294 event_task_proc_t destr;
1295 struct list entry;
1296 HTMLInnerWindow *window;
1299 typedef struct {
1300 task_t header;
1301 HTMLDocumentObj *doc;
1302 } docobj_task_t;
1304 typedef struct {
1305 HWND thread_hwnd;
1306 struct list task_list;
1307 struct list event_task_list;
1308 struct list timer_list;
1309 struct list *pending_xhr_events_tail;
1310 struct wine_rb_tree session_storage_map;
1311 void *blocking_xhr;
1312 } thread_data_t;
1314 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
1315 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
1316 void unblock_tasks_and_timers(thread_data_t*) DECLSPEC_HIDDEN;
1317 int session_storage_map_cmp(const void*,const struct wine_rb_entry*) DECLSPEC_HIDDEN;
1318 void destroy_session_storage(thread_data_t*) DECLSPEC_HIDDEN;
1320 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
1321 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
1322 HRESULT push_event_task(event_task_t*,HTMLInnerWindow*,event_task_proc_t,event_task_proc_t,LONG) DECLSPEC_HIDDEN;
1323 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
1324 ULONGLONG get_time_stamp(void) DECLSPEC_HIDDEN;
1326 enum timer_type {
1327 TIMER_TIMEOUT,
1328 TIMER_INTERVAL,
1329 TIMER_ANIMATION_FRAME,
1332 HRESULT set_task_timer(HTMLInnerWindow*,LONG,enum timer_type,IDispatch*,LONG*) DECLSPEC_HIDDEN;
1333 HRESULT clear_task_timer(HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
1334 HRESULT clear_animation_timer(HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
1336 const WCHAR *parse_compat_version(const WCHAR*,compat_mode_t*) DECLSPEC_HIDDEN;
1338 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN;
1340 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1341 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1342 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1343 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1344 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1346 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1348 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
1350 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1351 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1353 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1354 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1356 /* memory allocation functions */
1358 static inline WCHAR *strndupW(LPCWSTR str, unsigned len)
1360 LPWSTR ret = NULL;
1362 if(str) {
1363 ret = malloc((len + 1) * sizeof(WCHAR));
1364 if(ret)
1366 memcpy(ret, str, len*sizeof(WCHAR));
1367 ret[len] = 0;
1371 return ret;
1374 static inline WCHAR *strdupAtoW(const char *str)
1376 LPWSTR ret = NULL;
1378 if(str) {
1379 DWORD len;
1381 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1382 ret = malloc(len * sizeof(WCHAR));
1383 if(ret)
1384 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1387 return ret;
1390 static inline char *strdupWtoA(const WCHAR *str)
1392 char *ret = NULL;
1394 if(str) {
1395 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1396 ret = malloc(size);
1397 if(ret)
1398 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1401 return ret;
1404 static inline WCHAR *strdupUtoW(const char *str)
1406 WCHAR *ret = NULL;
1408 if(str) {
1409 size_t len;
1411 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
1412 ret = malloc(len * sizeof(WCHAR));
1413 if(ret)
1414 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
1417 return ret;
1420 static inline char *strdupWtoU(const WCHAR *str)
1422 char *ret = NULL;
1424 if(str) {
1425 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
1426 ret = malloc(size);
1427 if(ret)
1428 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL);
1431 return ret;
1434 static inline char *strndupWtoU(const WCHAR *str, unsigned len)
1436 char *ret = NULL;
1437 DWORD size;
1439 if(str) {
1440 size = len ? WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL) : 0;
1441 ret = malloc(size + 1);
1442 if(ret) {
1443 if(len) WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL);
1444 ret[size] = '\0';
1448 return ret;
1451 static inline VARIANT_BOOL variant_bool(BOOL b)
1453 return b ? VARIANT_TRUE : VARIANT_FALSE;
1456 static inline BOOL is_digit(WCHAR c)
1458 return '0' <= c && c <= '9';
1461 static inline BOOL is_power_of_2(unsigned x)
1463 return !(x & (x - 1));
1466 #ifdef __i386__
1467 extern void *call_thiscall_func;
1468 #endif
1470 compat_mode_t get_max_compat_mode(IUri*) DECLSPEC_HIDDEN;
1471 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
1472 BSTR charset_string_from_cp(UINT) DECLSPEC_HIDDEN;
1473 HRESULT get_mime_type_display_name(const WCHAR*,BSTR*) DECLSPEC_HIDDEN;
1474 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1475 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1476 IInternetSecurityManager *get_security_manager(void) DECLSPEC_HIDDEN;
1478 extern HINSTANCE hInst DECLSPEC_HIDDEN;
1479 void create_console(compat_mode_t compat_mode, IWineMSHTMLConsole **ret) DECLSPEC_HIDDEN;
1480 HRESULT create_media_query_list(HTMLWindow *window, BSTR media_query, IDispatch **ret) DECLSPEC_HIDDEN;