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
21 #include "docobjectservice.h"
31 #include "shdeprecated.h"
33 #include "wine/list.h"
34 #include "wine/rbtree.h"
42 #include "mshtml_private_iface.h"
43 #include "../jscript/jsdisp.h"
47 #define NS_ERROR_GENERATE_FAILURE(module,code) \
48 ((nsresult) (((UINT32)(1u<<31)) | ((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
49 #define NS_ERROR_GENERATE_SUCCESS(module,code) \
50 ((nsresult) (((UINT32)(module+0x45)<<16) | ((UINT32)(code))))
52 #define NS_OK ((nsresult)0x00000000L)
53 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
54 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
55 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
56 #define NS_NOINTERFACE ((nsresult)0x80004002L)
57 #define NS_ERROR_INVALID_POINTER ((nsresult)0x80004003L)
58 #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
59 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
60 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
61 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
62 #define NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ((nsresult)0x80530007)
63 #define NS_ERROR_DOM_SYNTAX_ERR ((nsresult)0x8053000c)
65 #define NS_ERROR_MODULE_NETWORK 6
67 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
68 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
69 #define NS_SUCCESS_DEFAULT_ACTION NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_NETWORK, 66)
71 #define NS_FAILED(res) ((res) & 0x80000000)
72 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
76 #define MSHTML_E_INVALID_PROPERTY 0x800a01b6
77 #define MSHTML_E_INVALID_ACTION 0x800a01bd
78 #define MSHTML_E_NODOC 0x800a025c
79 #define MSHTML_E_NOT_FUNC 0x800a138a
81 typedef struct HTMLWindow HTMLWindow
;
82 typedef struct HTMLInnerWindow HTMLInnerWindow
;
83 typedef struct HTMLOuterWindow HTMLOuterWindow
;
84 typedef struct HTMLDocumentNode HTMLDocumentNode
;
85 typedef struct HTMLDocumentObj HTMLDocumentObj
;
86 typedef struct HTMLFrameBase HTMLFrameBase
;
87 typedef struct GeckoBrowser GeckoBrowser
;
88 typedef struct HTMLAttributeCollection HTMLAttributeCollection
;
89 typedef struct DOMEvent DOMEvent
;
90 typedef struct HTMLDOMNode HTMLDOMNode
;
91 typedef struct ConnectionPoint ConnectionPoint
;
92 typedef struct BSCallback BSCallback
;
93 typedef struct EventTarget EventTarget
;
94 typedef struct ScriptHost ScriptHost
;
98 XDIID(DispCEventObj) \
100 XDIID(DispDOMChildrenCollection) \
101 XDIID(DispDOMCustomEvent) \
102 XDIID(DispDOMEvent) \
103 XDIID(DispDOMKeyboardEvent) \
104 XDIID(DispDOMMessageEvent) \
105 XDIID(DispDOMMouseEvent) \
106 XDIID(DispDOMProgressEvent) \
107 XDIID(DispDOMStorageEvent) \
108 XDIID(DispDOMUIEvent) \
109 XDIID(DispDOMDocumentType) \
110 XDIID(DispHTMLAnchorElement) \
111 XDIID(DispHTMLAreaElement) \
112 XDIID(DispHTMLAttributeCollection) \
113 XDIID(DispHTMLBody) \
114 XDIID(DispHTMLButtonElement) \
115 XDIID(DispHTMLCommentElement) \
116 XDIID(DispHTMLCurrentStyle) \
117 XDIID(DispHTMLDocument) \
118 XDIID(DispHTMLDOMAttribute) \
119 XDIID(DispHTMLDOMImplementation) \
120 XDIID(DispHTMLDOMRange) \
121 XDIID(DispHTMLDOMTextNode) \
122 XDIID(DispHTMLElementCollection) \
123 XDIID(DispHTMLEmbed) \
124 XDIID(DispHTMLFormElement) \
125 XDIID(DispHTMLGenericElement) \
126 XDIID(DispHTMLFrameElement) \
127 XDIID(DispHTMLHeadElement) \
128 XDIID(DispHTMLHtmlElement) \
129 XDIID(DispHTMLHistory) \
130 XDIID(DispHTMLIFrame) \
132 XDIID(DispHTMLInputElement) \
133 XDIID(DispHTMLLabelElement) \
134 XDIID(DispHTMLLinkElement) \
135 XDIID(DispHTMLLocation) \
136 XDIID(DispHTMLMetaElement) \
137 XDIID(DispHTMLNamespaceCollection) \
138 XDIID(DispHTMLNavigator) \
139 XDIID(DispHTMLObjectElement) \
140 XDIID(DispHTMLOptionElement) \
141 XDIID(DispHTMLScreen) \
142 XDIID(DispHTMLScriptElement) \
143 XDIID(DispHTMLSelectElement) \
144 XDIID(DispHTMLStyle) \
145 XDIID(DispHTMLStyleElement) \
146 XDIID(DispHTMLStyleSheet) \
147 XDIID(DispHTMLStyleSheetRule) \
148 XDIID(DispHTMLStyleSheetRulesCollection) \
149 XDIID(DispHTMLStyleSheetsCollection) \
150 XDIID(DispHTMLTable) \
151 XDIID(DispHTMLTableCell) \
152 XDIID(DispHTMLTableRow) \
153 XDIID(DispHTMLTextAreaElement) \
154 XDIID(DispHTMLTitleElement) \
155 XDIID(DispHTMLUnknownElement) \
156 XDIID(DispHTMLW3CComputedStyle) \
157 XDIID(DispHTMLWindow2) \
158 XDIID(DispHTMLXMLHttpRequest) \
159 XDIID(DispSVGCircleElement) \
160 XDIID(DispSVGSVGElement) \
161 XDIID(DispSVGTSpanElement) \
162 XDIID(HTMLDocumentEvents) \
163 XDIID(HTMLDocumentEvents2) \
164 XDIID(HTMLElementEvents2) \
165 XIID(IDOMCustomEvent) \
167 XIID(IDOMKeyboardEvent) \
168 XIID(IDOMMessageEvent) \
169 XIID(IDOMMouseEvent) \
170 XIID(IDOMProgressEvent) \
171 XIID(IDOMStorageEvent) \
173 XIID(IDOMDocumentType) \
174 XIID(IDocumentEvent) \
175 XIID(IDocumentRange) \
176 XIID(IDocumentSelector) \
177 XIID(IElementSelector) \
178 XIID(IElementTraversal) \
180 XIID(IHTMLAnchorElement) \
181 XIID(IHTMLAreaElement) \
182 XIID(IHTMLAttributeCollection) \
183 XIID(IHTMLAttributeCollection2) \
184 XIID(IHTMLAttributeCollection3) \
185 XIID(IHTMLBodyElement) \
186 XIID(IHTMLBodyElement2) \
187 XIID(IHTMLButtonElement) \
188 XIID(IHTMLCSSStyleDeclaration) \
189 XIID(IHTMLCSSStyleDeclaration2) \
190 XIID(IHTMLCommentElement) \
191 XIID(IHTMLCurrentStyle) \
192 XIID(IHTMLCurrentStyle2) \
193 XIID(IHTMLCurrentStyle3) \
194 XIID(IHTMLCurrentStyle4) \
195 XIID(IHTMLDocument2) \
196 XIID(IHTMLDocument3) \
197 XIID(IHTMLDocument4) \
198 XIID(IHTMLDocument5) \
199 XIID(IHTMLDocument6) \
200 XIID(IHTMLDocument7) \
201 XIID(IHTMLDOMAttribute) \
202 XIID(IHTMLDOMAttribute2) \
203 XIID(IHTMLDOMChildrenCollection) \
204 XIID(IHTMLDOMImplementation) \
205 XIID(IHTMLDOMImplementation2) \
207 XIID(IHTMLDOMNode2) \
208 XIID(IHTMLDOMNode3) \
209 XIID(IHTMLDOMRange) \
210 XIID(IHTMLDOMTextNode) \
211 XIID(IHTMLDOMTextNode2) \
213 XIID(IHTMLElement2) \
214 XIID(IHTMLElement3) \
215 XIID(IHTMLElement4) \
216 XIID(IHTMLElement6) \
217 XIID(IHTMLElement7) \
218 XIID(IHTMLElementCollection) \
219 XIID(IHTMLEmbedElement) \
220 XIID(IHTMLEventObj) \
221 XIID(IHTMLEventObj5) \
222 XIID(IHTMLFiltersCollection) \
223 XIID(IHTMLFormElement) \
224 XIID(IHTMLFrameBase) \
225 XIID(IHTMLFrameBase2) \
226 XIID(IHTMLFrameElement3) \
227 XIID(IHTMLGenericElement) \
228 XIID(IHTMLHeadElement) \
229 XIID(IHTMLHtmlElement) \
230 XIID(IHTMLIFrameElement) \
231 XIID(IHTMLIFrameElement2) \
232 XIID(IHTMLIFrameElement3) \
233 XIID(IHTMLImageElementFactory) \
234 XIID(IHTMLImgElement) \
235 XIID(IHTMLInputElement) \
236 XIID(IHTMLInputTextElement2) \
237 XIID(IHTMLLabelElement) \
238 XIID(IHTMLLinkElement) \
239 XIID(IHTMLLocation) \
240 XIID(IHTMLMetaElement) \
241 XIID(IHTMLMimeTypesCollection) \
242 XIID(IHTMLNamespaceCollection) \
243 XIID(IHTMLObjectElement) \
244 XIID(IHTMLObjectElement2) \
245 XIID(IHTMLOptionElement) \
246 XIID(IHTMLOptionElementFactory) \
247 XIID(IHTMLPerformance) \
248 XIID(IHTMLPerformanceNavigation) \
249 XIID(IHTMLPerformanceTiming) \
250 XIID(IHTMLPluginsCollection) \
253 XIID(IHTMLRectCollection) \
255 XIID(IHTMLScriptElement) \
256 XIID(IHTMLSelectElement) \
257 XIID(IHTMLSelectionObject) \
258 XIID(IHTMLSelectionObject2) \
266 XIID(IHTMLStyleElement) \
267 XIID(IHTMLStyleElement2) \
268 XIID(IHTMLStyleSheet) \
269 XIID(IHTMLStyleSheet4) \
270 XIID(IHTMLStyleSheetRule) \
271 XIID(IHTMLStyleSheetRulesCollection) \
272 XIID(IHTMLStyleSheetsCollection) \
276 XIID(IHTMLTableCell) \
277 XIID(IHTMLTableRow) \
278 XIID(IHTMLTextAreaElement) \
279 XIID(IHTMLTextContainer) \
280 XIID(IHTMLTitleElement) \
281 XIID(IHTMLTxtRange) \
282 XIID(IHTMLUniqueName) \
289 XIID(IHTMLXMLHttpRequest) \
290 XIID(IHTMLXMLHttpRequest2) \
291 XIID(IHTMLXMLHttpRequestFactory) \
294 XIID(ISVGCircleElement) \
296 XIID(ISVGSVGElement) \
297 XIID(ISVGTSpanElement) \
298 XIID(ISVGTextContentElement)
300 #define PRIVATE_TID_LIST \
301 XIID(IWineDOMTokenList) \
302 XIID(IWineHTMLElementPrivate) \
303 XIID(IWineHTMLWindowPrivate) \
304 XIID(IWineHTMLWindowCompatPrivate) \
305 XIID(IWinePageTransitionEvent) \
306 XIID(IWineXMLHttpRequestPrivate) \
307 XIID(IWineMSHTMLConsole) \
308 XIID(IWineMSHTMLMediaQueryList) \
309 XIID(IWineMSHTMLMutationObserver)
312 #define XIID(iface) iface ## _tid,
313 #define XDIID(iface) iface ## _tid,
323 COMPAT_MODE_INVALID
= -1,
333 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
334 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
337 unsigned document_mode
;
339 } compat_mode_info_t
;
341 extern const compat_mode_info_t compat_mode_info
[COMPAT_MODE_CNT
];
343 typedef struct dispex_data_t dispex_data_t
;
344 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
346 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
347 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
348 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
350 typedef struct DispatchEx DispatchEx
;
351 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback
;
355 } nsCycleCollectingAutoRefCnt
;
358 dispex is our base IDispatchEx implementation for all mshtml objects, and the vtbl allows
359 customizing the behavior depending on the object. Objects have basically 3 types of props:
361 - builtin props: These props are implicitly generated from the TypeInfo (disp_tid and iface_tids in dispex_static_data_t).
362 - custom props: These props are specific to an object, they are created using vtbl below (e.g. indexed props in HTMLRectCollection).
363 - dynamic props: These props are generally allocated by external code (e.g. 'document.wine = 42' creates 'wine' dynamic prop on document)
366 /* Used to provide object specific interfaces (do not AddRef, just return the iface) */
367 void *(*query_interface
)(DispatchEx
*,REFIID
);
369 /* Used to implement Cycle Collection callbacks; note that the destructor is not optional!
370 Unlike delete_cycle_collectable, unlink is called before the destructor (if available). */
371 void (*destructor
)(DispatchEx
*);
372 void (*traverse
)(DispatchEx
*,nsCycleCollectionTraversalCallback
*);
373 void (*unlink
)(DispatchEx
*);
375 /* Called on the last release, when the refcount reaches 0 */
376 void (*last_release
)(DispatchEx
*);
378 /* Called when the object wants to handle DISPID_VALUE invocations */
379 HRESULT (*value
)(DispatchEx
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
381 /* Used when the object has custom props, and this returns DISPIDs for them */
382 HRESULT (*get_dispid
)(DispatchEx
*,const WCHAR
*,DWORD
,DISPID
*);
384 /* Similar to get_dispid, but called only when a dynamic property can't be found */
385 HRESULT (*find_dispid
)(DispatchEx
*,const WCHAR
*,DWORD
,DISPID
*);
387 /* Similar to get_dispid, but called before any other lookup */
388 HRESULT (*lookup_dispid
)(DispatchEx
*,const WCHAR
*,DWORD
,DISPID
*);
390 /* These are called when the object implements GetMemberName, InvokeEx, DeleteMemberByDispID and GetNextDispID for custom props */
391 HRESULT (*get_name
)(DispatchEx
*,DISPID
,BSTR
*);
392 HRESULT (*invoke
)(DispatchEx
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
393 HRESULT (*delete)(DispatchEx
*,DISPID
);
394 HRESULT (*next_dispid
)(DispatchEx
*,DISPID
,DISPID
*);
396 /* Similar to invoke, but allows overriding all dispids */
397 HRESULT (*disp_invoke
)(DispatchEx
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
399 /* Used by objects that want to delay their compat mode initialization until actually needed */
400 compat_mode_t (*get_compat_mode
)(DispatchEx
*);
402 /* Used by objects that want to populate some dynamic props on initialization */
403 HRESULT (*populate_props
)(DispatchEx
*);
404 } dispex_static_data_vtbl_t
;
408 const dispex_static_data_vtbl_t
*vtbl
;
409 const tid_t disp_tid
;
410 const tid_t
* const iface_tids
;
411 void (*init_info
)(dispex_data_t
*,compat_mode_t
);
412 dispex_data_t
*info_cache
[COMPAT_MODE_CNT
];
413 dispex_data_t
*delayed_init_info
;
414 } dispex_static_data_t
;
416 typedef HRESULT (*dispex_hook_invoke_t
)(DispatchEx
*,WORD
,DISPPARAMS
*,VARIANT
*,
417 EXCEPINFO
*,IServiceProvider
*);
421 dispex_hook_invoke_t invoke
;
426 IWineJSDispatchHost IWineJSDispatchHost_iface
;
428 nsCycleCollectingAutoRefCnt ccref
;
430 IWineJSDispatch
*jsdisp
;
432 dispex_dynamic_data_t
*dynamic_data
;
435 #define DISPEX_IDISPATCH_NOUNK_IMPL(prefix, iface_name, dispex) \
436 static HRESULT WINAPI prefix##_GetTypeInfoCount(iface_name *iface, UINT *count) \
438 return IWineJSDispatchHost_GetTypeInfoCount(&(dispex).IWineJSDispatchHost_iface, count); \
440 static HRESULT WINAPI prefix##_GetTypeInfo(iface_name *iface, \
441 UINT index, LCID lcid, ITypeInfo **ret) \
443 return IWineJSDispatchHost_GetTypeInfo(&(dispex).IWineJSDispatchHost_iface, index, lcid, ret); \
445 static HRESULT WINAPI prefix##_GetIDsOfNames(iface_name *iface, REFIID riid, \
446 LPOLESTR *names, UINT count, LCID lcid, DISPID *dispid) \
448 return IWineJSDispatchHost_GetIDsOfNames(&(dispex).IWineJSDispatchHost_iface, \
449 riid, names, count, lcid, dispid); \
451 static HRESULT WINAPI prefix##_Invoke(iface_name *iface, DISPID dispid, REFIID riid, \
452 LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, UINT *err) \
454 return IWineJSDispatchHost_Invoke(&(dispex).IWineJSDispatchHost_iface, dispid, \
455 riid, lcid, flags, params, res, ei, err); \
458 #define DISPEX_IDISPATCH_IMPL(prefix, iface_name, dispex) \
459 static HRESULT WINAPI prefix##_QueryInterface(iface_name *iface, REFIID riid, void **ppv) \
461 return IWineJSDispatchHost_QueryInterface(&(dispex).IWineJSDispatchHost_iface, riid, ppv); \
463 static ULONG WINAPI prefix##_AddRef(iface_name *iface) \
465 return IWineJSDispatchHost_AddRef(&(dispex).IWineJSDispatchHost_iface); \
467 static ULONG WINAPI prefix##_Release(iface_name *iface) \
469 return IWineJSDispatchHost_Release(&(dispex).IWineJSDispatchHost_iface); \
471 DISPEX_IDISPATCH_NOUNK_IMPL(prefix, iface_name, dispex)
477 } ExternalCycleCollectionParticipant
;
480 nsresult (NSAPI
*traverse
)(void*,void*,nsCycleCollectionTraversalCallback
*);
481 nsresult (NSAPI
*unlink
)(void*);
482 void (NSAPI
*delete_cycle_collectable
)(void*);
485 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant
, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
487 extern nsrefcnt (__cdecl
*ccref_incr
)(nsCycleCollectingAutoRefCnt
*,nsISupports
*);
488 extern nsrefcnt (__cdecl
*ccref_decr
)(nsCycleCollectingAutoRefCnt
*,nsISupports
*,ExternalCycleCollectionParticipant
*);
489 extern void (__cdecl
*ccref_init
)(nsCycleCollectingAutoRefCnt
*,nsrefcnt
);
490 extern void (__cdecl
*ccp_init
)(ExternalCycleCollectionParticipant
*,const CCObjCallback
*);
491 extern void (__cdecl
*describe_cc_node
)(nsCycleCollectingAutoRefCnt
*,const char*,nsCycleCollectionTraversalCallback
*);
492 extern void (__cdecl
*note_cc_edge
)(nsISupports
*,const char*,nsCycleCollectionTraversalCallback
*);
494 void init_dispatch(DispatchEx
*,dispex_static_data_t
*,HTMLInnerWindow
*,compat_mode_t
);
495 void init_dispatch_with_owner(DispatchEx
*,dispex_static_data_t
*,DispatchEx
*);
496 HTMLInnerWindow
*get_script_global(DispatchEx
*);
497 void dispex_props_unlink(DispatchEx
*);
498 HRESULT
change_type(VARIANT
*,VARIANT
*,VARTYPE
,IServiceProvider
*);
499 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
500 HRESULT
get_dispids(tid_t
,DWORD
*,DISPID
**);
501 HRESULT
remove_attribute(DispatchEx
*,DISPID
,VARIANT_BOOL
*);
502 HRESULT
dispex_get_dynid(DispatchEx
*,const WCHAR
*,BOOL
,DISPID
*);
503 void release_typelib(void);
504 HRESULT
get_class_typeinfo(const CLSID
*,ITypeInfo
**);
505 const void *dispex_get_vtbl(DispatchEx
*);
506 void dispex_info_add_interface(dispex_data_t
*,tid_t
,const dispex_hook_t
*);
507 compat_mode_t
dispex_compat_mode(DispatchEx
*);
508 HRESULT
dispex_to_string(DispatchEx
*,BSTR
*);
509 HRESULT
dispex_call_builtin(DispatchEx
*dispex
, DISPID id
, DISPPARAMS
*dp
,
510 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
);
511 HRESULT
dispex_prop_get(DispatchEx
*dispex
, DISPID id
, LCID lcid
, VARIANT
*r
, EXCEPINFO
*ei
,
512 IServiceProvider
*caller
);
513 HRESULT
dispex_prop_put(DispatchEx
*dispex
, DISPID id
, LCID lcid
, VARIANT
*v
, EXCEPINFO
*ei
,
514 IServiceProvider
*caller
);
515 HRESULT
dispex_get_id(DispatchEx
*dispex
, const WCHAR
*name
, DWORD flags
, DISPID
*pid
);
516 HRESULT
dispex_next_id(DispatchEx
*dispex
, DISPID id
, DISPID
*ret
);
517 HRESULT
dispex_prop_name(DispatchEx
*dispex
, DISPID id
, BSTR
*ret
);
523 } dispex_prop_type_t
;
525 dispex_prop_type_t
get_dispid_type(DISPID
);
532 } global_prop_type_t
;
535 global_prop_type_t type
;
537 ScriptHost
*script_host
;
543 IEventTarget IEventTarget_iface
;
544 struct wine_rb_tree handler_map
;
549 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface
;
551 HTMLInnerWindow
*window
;
552 } HTMLOptionElementFactory
;
556 IHTMLImageElementFactory IHTMLImageElementFactory_iface
;
558 HTMLInnerWindow
*window
;
559 } HTMLImageElementFactory
;
563 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface
;
565 HTMLInnerWindow
*window
;
566 } HTMLXMLHttpRequestFactory
;
568 struct HTMLLocation
{
570 IHTMLLocation IHTMLLocation_iface
;
572 HTMLOuterWindow
*window
;
577 IOmHistory IOmHistory_iface
;
579 HTMLInnerWindow
*window
;
582 typedef struct nsChannelBSC nsChannelBSC
;
585 IHTMLWindow2 IHTMLWindow2_iface
;
586 IHTMLWindow3 IHTMLWindow3_iface
;
587 IHTMLWindow4 IHTMLWindow4_iface
;
588 IHTMLWindow5 IHTMLWindow5_iface
;
589 IHTMLWindow6 IHTMLWindow6_iface
;
590 IHTMLWindow7 IHTMLWindow7_iface
;
591 IHTMLPrivateWindow IHTMLPrivateWindow_iface
;
592 IServiceProvider IServiceProvider_iface
;
593 ITravelLogClient ITravelLogClient_iface
;
594 IObjectIdentity IObjectIdentity_iface
;
595 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface
;
596 IWineHTMLWindowPrivate IWineHTMLWindowPrivate_iface
;
597 IWineHTMLWindowCompatPrivate IWineHTMLWindowCompatPrivate_iface
;
599 HTMLInnerWindow
*inner_window
;
600 HTMLOuterWindow
*outer_window
;
603 struct HTMLOuterWindow
{
605 IEventTarget IEventTarget_iface
;
606 IWineJSDispatchHost IWineJSDispatchHost_iface
;
608 nsCycleCollectingAutoRefCnt ccref
;
611 nsIDOMWindow
*nswindow
;
612 mozIDOMWindowProxy
*window_proxy
;
613 HTMLOuterWindow
*parent
;
614 HTMLFrameBase
*frame_element
;
616 GeckoBrowser
*browser
;
617 struct list browser_entry
;
619 READYSTATE readystate
;
620 unsigned readystate_locked
;
621 BOOL readystate_pending
;
623 HTMLInnerWindow
*pending_window
;
624 HTMLLocation
*location
;
631 struct list sibling_entry
;
632 struct wine_rb_entry entry
;
635 struct HTMLInnerWindow
{
637 EventTarget event_target
;
639 HTMLDocumentNode
*doc
;
640 nsIDOMWindow
*dom_window
;
642 struct list children
;
643 struct list script_hosts
;
644 struct list documents
;
645 IWineJScript
*jscript
;
647 IHTMLEventObj
*event
;
649 HTMLImageElementFactory
*image_factory
;
650 HTMLOptionElementFactory
*option_factory
;
651 HTMLXMLHttpRequestFactory
*xhr_factory
;
654 IOmNavigator
*navigator
;
655 IHTMLStorage
*session_storage
;
656 IHTMLStorage
*local_storage
;
657 IWineMSHTMLConsole
*console
;
659 BOOL performance_initialized
;
662 unsigned blocking_depth
;
663 unsigned parser_callback_cnt
;
664 struct list script_queue
;
666 global_prop_t
*global_props
;
667 DWORD global_prop_cnt
;
668 DWORD global_prop_size
;
673 IDispatch
*mutation_observer_ctor
;
674 nsChannelBSC
*bscallback
;
675 struct list bindings
;
677 ULONG navigation_type
;
678 ULONG redirect_count
;
680 ULONGLONG navigation_start_time
;
681 ULONGLONG unload_event_start_time
;
682 ULONGLONG unload_event_end_time
;
683 ULONGLONG redirect_time
;
684 ULONGLONG dns_lookup_time
;
685 ULONGLONG connect_time
;
686 ULONGLONG request_time
;
687 ULONGLONG response_start_time
;
688 ULONGLONG response_end_time
;
689 ULONGLONG dom_interactive_time
;
690 ULONGLONG dom_complete_time
;
691 ULONGLONG dom_content_loaded_event_start_time
;
692 ULONGLONG dom_content_loaded_event_end_time
;
693 ULONGLONG load_event_start_time
;
694 ULONGLONG load_event_end_time
;
695 ULONGLONG first_paint_time
;
704 typedef struct _cp_static_data_t
{
706 void (*on_advise
)(IUnknown
*,struct _cp_static_data_t
*);
714 cp_static_data_t
*desc
;
717 typedef struct ConnectionPointContainer
{
718 IConnectionPointContainer IConnectionPointContainer_iface
;
720 ConnectionPoint
*cps
;
721 const cpc_entry_t
*cp_entries
;
723 struct ConnectionPointContainer
*forward_container
;
724 } ConnectionPointContainer
;
726 struct ConnectionPoint
{
727 IConnectionPoint IConnectionPoint_iface
;
729 ConnectionPointContainer
*container
;
734 IPropertyNotifySink
*propnotif
;
739 cp_static_data_t
*data
;
742 struct HTMLDocumentObj
{
743 IUnknown IUnknown_inner
;
744 IDispatchEx IDispatchEx_iface
;
745 ICustomDoc ICustomDoc_iface
;
746 IHTMLDocument2 IHTMLDocument2_iface
;
747 IHTMLDocument3 IHTMLDocument3_iface
;
748 IHTMLDocument4 IHTMLDocument4_iface
;
749 IHTMLDocument5 IHTMLDocument5_iface
;
750 IHTMLDocument6 IHTMLDocument6_iface
;
751 IHTMLDocument7 IHTMLDocument7_iface
;
752 IDocumentSelector IDocumentSelector_iface
;
753 IDocumentEvent IDocumentEvent_iface
;
754 ISupportErrorInfo ISupportErrorInfo_iface
;
755 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface
;
756 IMarkupServices IMarkupServices_iface
;
757 IMarkupContainer IMarkupContainer_iface
;
758 IDisplayServices IDisplayServices_iface
;
759 IDocumentRange IDocumentRange_iface
;
760 IOleDocumentView IOleDocumentView_iface
;
761 IViewObjectEx IViewObjectEx_iface
;
762 IPersistMoniker IPersistMoniker_iface
;
763 IPersistFile IPersistFile_iface
;
764 IMonikerProp IMonikerProp_iface
;
765 IPersistStreamInit IPersistStreamInit_iface
;
766 IPersistHistory IPersistHistory_iface
;
767 IHlinkTarget IHlinkTarget_iface
;
768 IOleCommandTarget IOleCommandTarget_iface
;
769 IOleObject IOleObject_iface
;
770 IOleDocument IOleDocument_iface
;
771 IOleControl IOleControl_iface
;
772 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface
;
773 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface
;
774 IObjectWithSite IObjectWithSite_iface
;
775 IOleContainer IOleContainer_iface
;
776 IObjectSafety IObjectSafety_iface
;
777 IServiceProvider IServiceProvider_iface
;
778 ITargetContainer ITargetContainer_iface
;
779 IEventTarget IEventTarget_iface
;
781 IWindowForBindingUI IWindowForBindingUI_iface
;
786 HTMLOuterWindow
*window
;
787 GeckoBrowser
*nscontainer
;
788 HTMLDocumentNode
*doc_node
;
790 IOleClientSite
*client
;
791 IDocHostUIHandler
*hostui
;
792 IOleCommandTarget
*client_cmdtrg
;
794 IOleInPlaceSite
*ipsite
;
795 IOleInPlaceFrame
*frame
;
796 IOleInPlaceUIWindow
*ip_window
;
797 IAdviseSink
*view_sink
;
798 IDocObjectService
*doc_object_service
;
799 IUnknown
*webbrowser
;
800 ITravelLog
*travel_log
;
801 IUnknown
*browser_service
;
802 IOleAdviseHolder
*advise_holder
;
804 ConnectionPointContainer cp_container
;
805 DOCHOSTUIINFO hostinfo
;
807 IOleUndoManager
*undomgr
;
808 IHTMLEditServices
*editsvcs
;
814 BOOL request_uiactivate
;
815 BOOL in_place_active
;
819 BOOL container_locked
;
831 typedef struct nsWeakReference nsWeakReference
;
836 SCRIPTMODE_ACTIVESCRIPT
839 struct GeckoBrowser
{
840 nsIWebBrowserChrome nsIWebBrowserChrome_iface
;
841 nsIContextMenuListener nsIContextMenuListener_iface
;
842 nsIURIContentListener nsIURIContentListener_iface
;
843 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface
;
844 nsITooltipListener nsITooltipListener_iface
;
845 nsIInterfaceRequestor nsIInterfaceRequestor_iface
;
846 nsISupportsWeakReference nsISupportsWeakReference_iface
;
848 nsIWebBrowser
*webbrowser
;
849 nsIWebNavigation
*navigation
;
850 nsIBaseWindow
*window
;
851 nsIWebBrowserFocus
*focus
;
853 HTMLOuterWindow
*content_window
;
856 nsIController
*editor_controller
;
860 nsWeakReference
*weak_reference
;
862 HTMLDocumentObj
*doc
;
864 nsIURIContentListener
*content_listener
;
867 SCRIPTMODE script_mode
;
870 struct list document_nodes
;
871 struct list outer_windows
;
876 const cpc_entry_t
*cpc_entries
;
877 HRESULT (*clone
)(HTMLDOMNode
*,nsIDOMNode
*,HTMLDOMNode
**);
878 HRESULT (*get_attr_col
)(HTMLDOMNode
*,HTMLAttributeCollection
**);
879 EventTarget
*(*get_event_prop_target
)(HTMLDOMNode
*,int);
880 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
881 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
882 HRESULT (*get_document
)(HTMLDOMNode
*,IDispatch
**);
883 HRESULT (*get_readystate
)(HTMLDOMNode
*,BSTR
*);
884 HRESULT (*bind_to_tree
)(HTMLDOMNode
*);
885 BOOL (*is_text_edit
)(HTMLDOMNode
*);
886 BOOL (*is_settable
)(HTMLDOMNode
*,DISPID
);
890 EventTarget event_target
;
891 IHTMLDOMNode IHTMLDOMNode_iface
;
892 IHTMLDOMNode2 IHTMLDOMNode2_iface
;
893 IHTMLDOMNode3 IHTMLDOMNode3_iface
;
894 const NodeImplVtbl
*vtbl
;
897 HTMLDocumentNode
*doc
;
900 HTMLDOMNode
*unsafe_impl_from_IHTMLDOMNode(IHTMLDOMNode
*);
902 static inline void node_addref(HTMLDOMNode
*node
)
904 IHTMLDOMNode_AddRef(&node
->IHTMLDOMNode_iface
);
907 static inline void node_release(HTMLDOMNode
*node
)
909 IHTMLDOMNode_Release(&node
->IHTMLDOMNode_iface
);
914 ConnectionPointContainer cp_container
;
916 IHTMLElement IHTMLElement_iface
;
917 IHTMLElement2 IHTMLElement2_iface
;
918 IHTMLElement3 IHTMLElement3_iface
;
919 IHTMLElement4 IHTMLElement4_iface
;
920 IHTMLElement6 IHTMLElement6_iface
;
921 IHTMLElement7 IHTMLElement7_iface
;
922 IHTMLUniqueName IHTMLUniqueName_iface
;
923 IElementSelector IElementSelector_iface
;
924 IElementTraversal IElementTraversal_iface
;
925 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface
;
926 IWineHTMLElementPrivate IWineHTMLElementPrivate_iface
;
928 nsIDOMElement
*dom_element
; /* NULL for legacy comments represented as HTML elements */
929 nsIDOMHTMLElement
*html_element
; /* NULL for non-HTML elements (like SVG elements) */
931 HTMLStyle
*runtime_style
;
932 HTMLAttributeCollection
*attrs
;
937 #define HTMLELEMENT_TIDS \
945 extern const tid_t HTMLElement_iface_tids
[];
946 extern cp_static_data_t HTMLElementEvents2_data
;
947 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
948 extern const cpc_entry_t HTMLElement_cpc
[];
950 struct HTMLFrameBase
{
953 IHTMLFrameBase IHTMLFrameBase_iface
;
954 IHTMLFrameBase2 IHTMLFrameBase2_iface
;
956 HTMLOuterWindow
*content_window
;
958 nsIDOMHTMLFrameElement
*nsframe
;
959 nsIDOMHTMLIFrameElement
*nsiframe
;
962 typedef struct nsDocumentEventListener nsDocumentEventListener
;
964 struct HTMLDocumentNode
{
967 IHTMLDocument2 IHTMLDocument2_iface
;
968 IHTMLDocument3 IHTMLDocument3_iface
;
969 IHTMLDocument4 IHTMLDocument4_iface
;
970 IHTMLDocument5 IHTMLDocument5_iface
;
971 IHTMLDocument6 IHTMLDocument6_iface
;
972 IHTMLDocument7 IHTMLDocument7_iface
;
973 IDocumentSelector IDocumentSelector_iface
;
974 IDocumentEvent IDocumentEvent_iface
;
975 ISupportErrorInfo ISupportErrorInfo_iface
;
976 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface
;
977 IMarkupServices IMarkupServices_iface
;
978 IMarkupContainer IMarkupContainer_iface
;
979 IDisplayServices IDisplayServices_iface
;
980 IDocumentRange IDocumentRange_iface
;
981 IPersistMoniker IPersistMoniker_iface
;
982 IPersistFile IPersistFile_iface
;
983 IMonikerProp IMonikerProp_iface
;
984 IPersistStreamInit IPersistStreamInit_iface
;
985 IPersistHistory IPersistHistory_iface
;
986 IHlinkTarget IHlinkTarget_iface
;
987 IOleCommandTarget IOleCommandTarget_iface
;
988 IOleObject IOleObject_iface
;
989 IOleDocument IOleDocument_iface
;
990 IOleControl IOleControl_iface
;
991 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface
;
992 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface
;
993 IObjectWithSite IObjectWithSite_iface
;
994 IOleContainer IOleContainer_iface
;
995 IObjectSafety IObjectSafety_iface
;
996 IServiceProvider IServiceProvider_iface
;
997 IInternetHostSecurityManager IInternetHostSecurityManager_iface
;
999 nsIDocumentObserver nsIDocumentObserver_iface
;
1000 ConnectionPointContainer cp_container
;
1001 HTMLInnerWindow
*window
;
1002 HTMLDocumentObj
*doc_obj
;
1004 GeckoBrowser
*browser
;
1005 struct list browser_entry
;
1007 HTMLInnerWindow
*script_global
;
1008 struct list script_global_entry
;
1010 compat_mode_t document_mode
;
1011 BOOL document_mode_locked
;
1013 nsIDOMDocument
*dom_document
;
1014 nsIDOMHTMLDocument
*html_document
;
1015 unsigned int content_ready
: 1;
1016 unsigned int unload_sent
: 1;
1018 IHTMLDOMImplementation
*dom_implementation
;
1019 IHTMLNamespaceCollection
*namespaces
;
1021 ICatInformation
*catmgr
;
1022 nsDocumentEventListener
*nsevent_listener
;
1026 unsigned elem_vars_size
;
1027 unsigned elem_vars_cnt
;
1029 BOOL skip_mutation_notif
;
1035 struct list selection_list
;
1036 struct list range_list
;
1037 struct list plugin_hosts
;
1040 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
1041 HRESULT
MHTMLDocument_Create(IUnknown
*,REFIID
,void**);
1042 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
1043 HRESULT
create_document_node(nsIDOMDocument
*,GeckoBrowser
*,HTMLInnerWindow
*,HTMLInnerWindow
*,
1044 compat_mode_t
,HTMLDocumentNode
**);
1045 HRESULT
create_doctype_node(HTMLDocumentNode
*,nsIDOMNode
*,HTMLDOMNode
**);
1047 HRESULT
create_outer_window(GeckoBrowser
*,mozIDOMWindowProxy
*,HTMLOuterWindow
*,HTMLOuterWindow
**);
1048 HRESULT
update_window_doc(HTMLInnerWindow
*);
1049 HTMLOuterWindow
*mozwindow_to_window(const mozIDOMWindowProxy
*);
1050 void get_top_window(HTMLOuterWindow
*,HTMLOuterWindow
**);
1051 HRESULT
HTMLOptionElementFactory_Create(HTMLInnerWindow
*,HTMLOptionElementFactory
**);
1052 HRESULT
HTMLImageElementFactory_Create(HTMLInnerWindow
*,HTMLImageElementFactory
**);
1053 HRESULT
HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow
*,HTMLXMLHttpRequestFactory
**);
1054 HRESULT
create_location(HTMLOuterWindow
*,HTMLLocation
**);
1055 HRESULT
create_navigator(HTMLInnerWindow
*,IOmNavigator
**);
1056 HRESULT
create_html_screen(HTMLInnerWindow
*,IHTMLScreen
**);
1057 HRESULT
create_performance(HTMLInnerWindow
*,IHTMLPerformance
**);
1058 HRESULT
create_history(HTMLInnerWindow
*,OmHistory
**);
1059 HRESULT
create_namespace_collection(HTMLDocumentNode
*,IHTMLNamespaceCollection
**);
1060 HRESULT
create_dom_implementation(HTMLDocumentNode
*,IHTMLDOMImplementation
**);
1061 void detach_dom_implementation(IHTMLDOMImplementation
*);
1062 HRESULT
create_html_storage(HTMLInnerWindow
*,BOOL
,IHTMLStorage
**);
1064 void HTMLDocument_View_Init(HTMLDocumentObj
*);
1065 void HTMLDocumentObj_Persist_Init(HTMLDocumentObj
*);
1066 void HTMLDocumentObj_Service_Init(HTMLDocumentObj
*);
1067 void HTMLDocumentObj_OleCmd_Init(HTMLDocumentObj
*);
1068 void TargetContainer_Init(HTMLDocumentObj
*);
1070 void HTMLDocumentNode_Persist_Init(HTMLDocumentNode
*);
1071 void HTMLDocumentNode_Service_Init(HTMLDocumentNode
*);
1072 void HTMLDocumentNode_OleCmd_Init(HTMLDocumentNode
*);
1073 void HTMLDocumentNode_OleObj_Init(HTMLDocumentNode
*);
1074 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
1076 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
1078 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*,const cpc_entry_t
*);
1079 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
1081 HRESULT
create_gecko_browser(HTMLDocumentObj
*,GeckoBrowser
**);
1082 void detach_gecko_browser(GeckoBrowser
*);
1084 DWORD
get_compat_mode_version(compat_mode_t compat_mode
);
1085 compat_mode_t
lock_document_mode(HTMLDocumentNode
*);
1087 void init_mutation(nsIComponentManager
*);
1088 void init_document_mutation(HTMLDocumentNode
*);
1089 void release_document_mutation(HTMLDocumentNode
*);
1090 JSContext
*get_context_from_document(nsIDOMDocument
*);
1092 void HTMLDocument_LockContainer(HTMLDocumentObj
*,BOOL
);
1093 void show_context_menu(HTMLDocumentObj
*,DWORD
,POINT
*,IDispatch
*);
1094 void notif_focus(HTMLDocumentObj
*);
1096 void show_tooltip(HTMLDocumentObj
*,DWORD
,DWORD
,LPCWSTR
);
1097 void hide_tooltip(HTMLDocumentObj
*);
1098 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
1100 UINT
get_document_charset(HTMLDocumentNode
*);
1102 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
1104 BOOL
load_gecko(void);
1105 void close_gecko(void);
1106 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
1107 void init_nsio(nsIComponentManager
*);
1108 void release_nsio(void);
1109 BOOL
is_gecko_path(const char*);
1110 void set_viewer_zoom(GeckoBrowser
*,float);
1111 float get_viewer_zoom(GeckoBrowser
*);
1113 void init_dispex_cc(void);
1114 void init_window_cc(void);
1116 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
1118 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*,VARIANT
*);
1119 void call_property_onchanged(ConnectionPointContainer
*,DISPID
);
1120 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
1123 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(nsfree
) __WINE_MALLOC
;
1125 BOOL
nsACString_Init(nsACString
*str
, const char *data
);
1126 void nsACString_InitDepend(nsACString
*,const char*);
1127 void nsACString_SetData(nsACString
*,const char*);
1128 UINT32
nsACString_GetData(const nsACString
*,const char**);
1129 void nsACString_Finish(nsACString
*);
1131 BOOL
nsAString_Init(nsAString
*,const PRUnichar
*);
1132 void nsAString_InitDepend(nsAString
*,const PRUnichar
*);
1133 void nsAString_SetData(nsAString
*,const PRUnichar
*);
1134 UINT32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
1135 void nsAString_Finish(nsAString
*);
1137 #define NSSTR_IMPLICIT_PX 0x01
1138 #define NSSTR_COLOR 0x02
1140 HRESULT
map_nsresult(nsresult
);
1141 HRESULT
return_nsstr(nsresult
,nsAString
*,BSTR
*);
1142 HRESULT
return_nsstr_variant(nsresult
,nsAString
*,unsigned,VARIANT
*);
1143 HRESULT
variant_to_nsstr(VARIANT
*,BOOL
,nsAString
*);
1144 HRESULT
return_nsform(nsresult
,nsIDOMHTMLFormElement
*,IHTMLFormElement
**);
1146 nsICommandParams
*create_nscommand_params(void);
1147 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
1148 void setup_editor_controller(GeckoBrowser
*);
1149 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
1150 nsIWritableVariant
*create_nsvariant(void);
1151 nsIXMLHttpRequest
*create_nsxhr(nsIDOMWindow
*nswindow
);
1152 nsresult
create_nsfile(const PRUnichar
*,nsIFile
**);
1153 char *get_nscategory_entry(const char*,const char*);
1155 HRESULT
create_pending_window(HTMLOuterWindow
*,nsChannelBSC
*);
1156 HRESULT
start_binding(HTMLInnerWindow
*,BSCallback
*,IBindCtx
*);
1157 HRESULT
async_start_doc_binding(HTMLOuterWindow
*,HTMLInnerWindow
*,DWORD
);
1158 void abort_window_bindings(HTMLInnerWindow
*);
1159 void set_download_state(HTMLDocumentObj
*,int);
1160 void call_docview_84(HTMLDocumentObj
*);
1161 HRESULT
reload_page(HTMLOuterWindow
*);
1163 void set_ready_state(HTMLOuterWindow
*,READYSTATE
);
1164 HRESULT
get_readystate_string(READYSTATE
,BSTR
*);
1166 HRESULT
HTMLSelectionObject_Create(HTMLDocumentNode
*,nsISelection
*,IHTMLSelectionObject
**);
1167 HRESULT
HTMLTxtRange_Create(HTMLDocumentNode
*,nsIDOMRange
*,IHTMLTxtRange
**);
1168 HRESULT
create_style_sheet(nsIDOMStyleSheet
*,compat_mode_t
,IHTMLStyleSheet
**);
1169 HRESULT
create_style_sheet_collection(nsIDOMStyleSheetList
*,compat_mode_t
,
1170 IHTMLStyleSheetsCollection
**);
1171 HRESULT
create_dom_range(nsIDOMRange
*,HTMLDocumentNode
*,IHTMLDOMRange
**);
1172 HRESULT
create_markup_pointer(IMarkupPointer
**);
1174 void detach_document_node(HTMLDocumentNode
*);
1175 void detach_selection(HTMLDocumentNode
*);
1176 void detach_ranges(HTMLDocumentNode
*);
1177 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
1178 HRESULT
replace_node_by_html(nsIDOMDocument
*,nsIDOMNode
*,const WCHAR
*);
1180 HRESULT
create_nselem(HTMLDocumentNode
*,const WCHAR
*,nsIDOMElement
**);
1181 HRESULT
create_element(HTMLDocumentNode
*,const WCHAR
*,HTMLElement
**);
1183 HRESULT
HTMLDOMTextNode_Create(HTMLDocumentNode
*,nsIDOMNode
*,HTMLDOMNode
**);
1185 BOOL
variant_to_nscolor(const VARIANT
*v
, nsAString
*nsstr
);
1186 HRESULT
nscolor_to_str(LPCWSTR color
, BSTR
*ret
);
1188 static inline BOOL
is_main_content_window(HTMLOuterWindow
*window
)
1190 return window
->browser
&& window
== window
->browser
->content_window
;
1193 struct HTMLAttributeCollection
{
1195 IHTMLAttributeCollection IHTMLAttributeCollection_iface
;
1196 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface
;
1197 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface
;
1205 IHTMLDOMAttribute IHTMLDOMAttribute_iface
;
1206 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface
;
1208 /* value is valid only for detached attributes (when elem == NULL). */
1210 /* name must be valid for detached attributes */
1218 HTMLDOMAttribute
*unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute
*);
1220 HRESULT
HTMLDOMAttribute_Create(const WCHAR
*,HTMLElement
*,DISPID
,HTMLDocumentNode
*,HTMLDOMAttribute
**);
1222 HRESULT
HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
,HTMLElement
**);
1223 HRESULT
HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,HTMLElement
**);
1224 HRESULT
HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1225 HRESULT
HTMLAreaElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1226 HRESULT
HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1227 HRESULT
HTMLButtonElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1228 HRESULT
HTMLEmbedElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1229 HRESULT
HTMLFormElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1230 HRESULT
HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1231 HRESULT
HTMLHeadElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1232 HRESULT
HTMLHtmlElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1233 HRESULT
HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1234 HRESULT
HTMLStyleElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1235 HRESULT
HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1236 HRESULT
HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1237 HRESULT
HTMLLabelElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1238 HRESULT
HTMLLinkElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1239 HRESULT
HTMLMetaElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1240 HRESULT
HTMLObjectElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1241 HRESULT
HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1242 HRESULT
HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1243 HRESULT
HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1244 HRESULT
HTMLTable_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1245 HRESULT
HTMLTableCell_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1246 HRESULT
HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1247 HRESULT
HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1248 HRESULT
HTMLTitleElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1249 HRESULT
HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1251 HRESULT
create_svg_element(HTMLDocumentNode
*,nsIDOMSVGElement
*,const WCHAR
*,HTMLElement
**);
1253 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*,dispex_static_data_t
*);
1254 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMElement
*,dispex_static_data_t
*);
1256 void EventTarget_Init(EventTarget
*,dispex_static_data_t
*,compat_mode_t
);
1257 void init_event_target(EventTarget
*,dispex_static_data_t
*,HTMLInnerWindow
*);
1258 void *EventTarget_query_interface(EventTarget
*,REFIID
);
1259 void EventTarget_init_dispex_info(dispex_data_t
*,compat_mode_t
);
1261 void *HTMLDOMNode_query_interface(DispatchEx
*,REFIID
);
1262 void HTMLDOMNode_destructor(DispatchEx
*);
1263 void HTMLDOMNode_traverse(DispatchEx
*,nsCycleCollectionTraversalCallback
*);
1264 void HTMLDOMNode_unlink(DispatchEx
*);
1265 void HTMLDOMNode_init_dispex_info(dispex_data_t
*,compat_mode_t
);
1267 void *HTMLElement_query_interface(DispatchEx
*,REFIID
);
1268 void HTMLElement_destructor(DispatchEx
*);
1269 void HTMLElement_traverse(DispatchEx
*,nsCycleCollectionTraversalCallback
*);
1270 void HTMLElement_unlink(DispatchEx
*);
1271 HRESULT
HTMLElement_populate_props(DispatchEx
*);
1272 HRESULT
HTMLElement_clone(HTMLDOMNode
*,nsIDOMNode
*,HTMLDOMNode
**);
1273 HRESULT
HTMLElement_get_attr_col(HTMLDOMNode
*,HTMLAttributeCollection
**);
1274 void HTMLElement_init_dispex_info(dispex_data_t
*,compat_mode_t
);
1276 HRESULT
get_node(nsIDOMNode
*,BOOL
,HTMLDOMNode
**);
1277 HRESULT
get_element(nsIDOMElement
*,HTMLElement
**);
1278 HRESULT
get_document_node(nsIDOMDocument
*,HTMLDocumentNode
**);
1280 HTMLElement
*unsafe_impl_from_IHTMLElement(IHTMLElement
*);
1282 HRESULT
search_window_props(HTMLInnerWindow
*,const WCHAR
*,DWORD
,DISPID
*);
1283 HRESULT
get_frame_by_name(HTMLOuterWindow
*,const WCHAR
*,BOOL
,HTMLOuterWindow
**);
1284 HRESULT
get_doc_elem_by_id(HTMLDocumentNode
*,const WCHAR
*,HTMLElement
**);
1285 HTMLOuterWindow
*get_target_window(HTMLOuterWindow
*,nsAString
*,BOOL
*);
1286 HRESULT
handle_link_click_event(HTMLElement
*,nsAString
*,nsAString
*,nsIDOMEvent
*,BOOL
*);
1288 HRESULT WINAPI
wrapper_QueryInterface(IUnknown
*iface
, REFIID riid
, void **ppv
);
1289 ULONG WINAPI
wrapper_AddRef(IUnknown
*iface
);
1290 ULONG WINAPI
wrapper_Release(IUnknown
*iface
);
1291 extern const void *iface_wrapper_vtbl
[];
1293 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
1294 IHTMLElementCollection
*create_collection_from_nodelist(nsIDOMNodeList
*,compat_mode_t
);
1295 IHTMLElementCollection
*create_collection_from_htmlcol(nsIDOMHTMLCollection
*,compat_mode_t
);
1296 HRESULT
create_child_collection(nsIDOMNodeList
*,compat_mode_t
,IHTMLDOMChildrenCollection
**);
1298 HRESULT
attr_value_to_string(VARIANT
*);
1299 HRESULT
get_elem_attr_value_by_dispid(HTMLElement
*,DISPID
,VARIANT
*);
1300 HRESULT
get_elem_source_index(HTMLElement
*,LONG
*);
1302 nsresult
get_elem_attr_value(nsIDOMElement
*,const WCHAR
*,nsAString
*,const PRUnichar
**);
1303 HRESULT
elem_string_attr_getter(HTMLElement
*,const WCHAR
*,BOOL
,BSTR
*);
1304 HRESULT
elem_string_attr_setter(HTMLElement
*,const WCHAR
*,const WCHAR
*);
1306 HRESULT
elem_unique_id(unsigned id
, BSTR
*p
);
1311 HRESULT (*query
)(HTMLDocumentNode
*,OLECMD
*);
1312 HRESULT (*exec
)(HTMLDocumentNode
*,DWORD
,VARIANT
*,VARIANT
*);
1315 extern const cmdtable_t editmode_cmds
[];
1317 void do_ns_command(HTMLDocumentNode
*,const char*,nsICommandParams
*);
1320 #define UPDATE_UI 0x0001
1321 #define UPDATE_TITLE 0x0002
1323 void update_doc(HTMLDocumentObj
*,DWORD
);
1324 void update_title(HTMLDocumentObj
*);
1325 void set_document_navigation(HTMLDocumentObj
*,BOOL
);
1327 HRESULT
do_query_service(IUnknown
*,REFGUID
,REFIID
,void**);
1330 HRESULT
setup_edit_mode(HTMLDocumentObj
*);
1331 void init_editor(HTMLDocumentNode
*);
1332 void handle_edit_event(HTMLDocumentNode
*,nsIDOMEvent
*);
1333 HRESULT
editor_exec_copy(HTMLDocumentNode
*,DWORD
,VARIANT
*,VARIANT
*);
1334 HRESULT
editor_exec_cut(HTMLDocumentNode
*,DWORD
,VARIANT
*,VARIANT
*);
1335 HRESULT
editor_exec_paste(HTMLDocumentNode
*,DWORD
,VARIANT
*,VARIANT
*);
1336 HRESULT
browser_is_dirty(GeckoBrowser
*);
1337 void set_dirty(GeckoBrowser
*,VARIANT_BOOL
);
1339 extern DWORD mshtml_tls
;
1341 typedef struct task_t task_t
;
1342 typedef void (*task_proc_t
)(task_t
*);
1351 typedef struct event_task_t event_task_t
;
1352 typedef void (*event_task_proc_t
)(event_task_t
*);
1354 struct event_task_t
{
1356 BOOL thread_blocked
;
1357 event_task_proc_t proc
;
1358 event_task_proc_t destr
;
1360 HTMLInnerWindow
*window
;
1365 HTMLDocumentObj
*doc
;
1370 struct list task_list
;
1371 struct list event_task_list
;
1372 struct list timer_list
;
1373 struct list
*pending_xhr_events_tail
;
1374 struct wine_rb_tree session_storage_map
;
1378 thread_data_t
*get_thread_data(BOOL
);
1379 HWND
get_thread_hwnd(void);
1380 void unblock_tasks_and_timers(thread_data_t
*);
1381 int session_storage_map_cmp(const void*,const struct wine_rb_entry
*);
1382 void destroy_session_storage(thread_data_t
*);
1384 LONG
get_task_target_magic(void);
1385 HRESULT
push_task(task_t
*,task_proc_t
,task_proc_t
,LONG
);
1386 HRESULT
push_event_task(event_task_t
*,HTMLInnerWindow
*,event_task_proc_t
,event_task_proc_t
,LONG
);
1387 void remove_target_tasks(LONG
);
1388 ULONGLONG
get_time_stamp(void);
1393 TIMER_ANIMATION_FRAME
,
1396 HRESULT
set_task_timer(HTMLInnerWindow
*,LONG
,enum timer_type
,IDispatch
*,LONG
*);
1397 HRESULT
clear_task_timer(HTMLInnerWindow
*,DWORD
);
1398 HRESULT
clear_animation_timer(HTMLInnerWindow
*,DWORD
);
1400 const WCHAR
*parse_compat_version(const WCHAR
*,compat_mode_t
*);
1402 const char *debugstr_mshtml_guid(const GUID
*);
1404 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1405 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1406 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1407 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
1408 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
1410 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
1412 DEFINE_OLEGUID(CGID_DocHostCmdPriv
, 0x000214D4L
, 0, 0);
1414 DEFINE_GUID(CLSID_JScript
, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58);
1415 DEFINE_GUID(CLSID_VBScript
, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8);
1417 DEFINE_GUID(IID_UndocumentedScriptIface
,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0);
1418 DEFINE_GUID(IID_IDispatchJS
,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6);
1420 /* memory allocation functions */
1422 static inline WCHAR
*strndupW(LPCWSTR str
, unsigned len
)
1427 ret
= malloc((len
+ 1) * sizeof(WCHAR
));
1430 memcpy(ret
, str
, len
*sizeof(WCHAR
));
1438 static inline WCHAR
*strdupAtoW(const char *str
)
1445 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
1446 ret
= malloc(len
* sizeof(WCHAR
));
1448 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
1454 static inline char *strdupWtoA(const WCHAR
*str
)
1459 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
1462 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
1468 static inline WCHAR
*strdupUtoW(const char *str
)
1475 len
= MultiByteToWideChar(CP_UTF8
, 0, str
, -1, NULL
, 0);
1476 ret
= malloc(len
* sizeof(WCHAR
));
1478 MultiByteToWideChar(CP_UTF8
, 0, str
, -1, ret
, len
);
1484 static inline char *strdupWtoU(const WCHAR
*str
)
1489 size_t size
= WideCharToMultiByte(CP_UTF8
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
1492 WideCharToMultiByte(CP_UTF8
, 0, str
, -1, ret
, size
, NULL
, NULL
);
1498 static inline char *strndupWtoU(const WCHAR
*str
, unsigned len
)
1504 size
= len
? WideCharToMultiByte(CP_UTF8
, 0, str
, len
, NULL
, 0, NULL
, NULL
) : 0;
1505 ret
= malloc(size
+ 1);
1507 if(len
) WideCharToMultiByte(CP_UTF8
, 0, str
, len
, ret
, size
, NULL
, NULL
);
1515 static inline VARIANT_BOOL
variant_bool(BOOL b
)
1517 return b
? VARIANT_TRUE
: VARIANT_FALSE
;
1520 static inline BOOL
is_digit(WCHAR c
)
1522 return '0' <= c
&& c
<= '9';
1525 static inline BOOL
is_power_of_2(unsigned x
)
1527 return !(x
& (x
- 1));
1530 static inline void unlink_ref(void *p
)
1534 IUnknown
*unk
= *ref
;
1536 IUnknown_Release(unk
);
1540 static inline void unlink_variant(VARIANT
*v
)
1542 if(V_VT(v
) == VT_DISPATCH
|| V_VT(v
) == VT_UNKNOWN
)
1543 unlink_ref(&V_UNKNOWN(v
));
1546 static inline void traverse_variant(VARIANT
*v
, const char *name
, nsCycleCollectionTraversalCallback
*cb
)
1548 if(V_VT(v
) == VT_DISPATCH
|| V_VT(v
) == VT_UNKNOWN
)
1549 note_cc_edge((nsISupports
*)V_UNKNOWN(v
), name
, cb
);
1553 extern void *call_thiscall_func
;
1556 compat_mode_t
get_max_compat_mode(IUri
*);
1557 UINT
cp_from_charset_string(BSTR
);
1558 BSTR
charset_string_from_cp(UINT
);
1559 HRESULT
get_mime_type_display_name(const WCHAR
*,BSTR
*);
1560 HINSTANCE
get_shdoclc(void);
1561 void set_statustext(HTMLDocumentObj
*,INT
,LPCWSTR
);
1562 IInternetSecurityManager
*get_security_manager(void);
1564 extern HINSTANCE hInst
;
1565 void create_console(HTMLInnerWindow
*window
, IWineMSHTMLConsole
**ret
);
1566 HRESULT
create_media_query_list(HTMLInnerWindow
*window
, BSTR media_query
, IDispatch
**ret
);
1568 HRESULT
create_mutation_observer_ctor(compat_mode_t compat_mode
, IDispatch
**ret
);