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"
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))
75 #define MSHTML_E_INVALID_PROPERTY 0x800a01b6
76 #define MSHTML_E_INVALID_ACTION 0x800a01bd
77 #define MSHTML_E_NODOC 0x800a025c
78 #define MSHTML_E_NOT_FUNC 0x800a138a
80 typedef struct DOMEvent DOMEvent
;
81 typedef struct HTMLDOMNode HTMLDOMNode
;
82 typedef struct ConnectionPoint ConnectionPoint
;
83 typedef struct BSCallback BSCallback
;
84 typedef struct EventTarget EventTarget
;
88 XDIID(DispCEventObj) \
90 XDIID(DispDOMChildrenCollection) \
91 XDIID(DispDOMCustomEvent) \
93 XDIID(DispDOMKeyboardEvent) \
94 XDIID(DispDOMMessageEvent) \
95 XDIID(DispDOMMouseEvent) \
96 XDIID(DispDOMProgressEvent) \
97 XDIID(DispDOMStorageEvent) \
98 XDIID(DispDOMUIEvent) \
99 XDIID(DispDOMDocumentType) \
100 XDIID(DispHTMLAnchorElement) \
101 XDIID(DispHTMLAreaElement) \
102 XDIID(DispHTMLAttributeCollection) \
103 XDIID(DispHTMLBody) \
104 XDIID(DispHTMLButtonElement) \
105 XDIID(DispHTMLCommentElement) \
106 XDIID(DispHTMLCurrentStyle) \
107 XDIID(DispHTMLDocument) \
108 XDIID(DispHTMLDOMAttribute) \
109 XDIID(DispHTMLDOMImplementation) \
110 XDIID(DispHTMLDOMRange) \
111 XDIID(DispHTMLDOMTextNode) \
112 XDIID(DispHTMLElementCollection) \
113 XDIID(DispHTMLEmbed) \
114 XDIID(DispHTMLFormElement) \
115 XDIID(DispHTMLGenericElement) \
116 XDIID(DispHTMLFrameElement) \
117 XDIID(DispHTMLHeadElement) \
118 XDIID(DispHTMLHtmlElement) \
119 XDIID(DispHTMLHistory) \
120 XDIID(DispHTMLIFrame) \
122 XDIID(DispHTMLInputElement) \
123 XDIID(DispHTMLLabelElement) \
124 XDIID(DispHTMLLinkElement) \
125 XDIID(DispHTMLLocation) \
126 XDIID(DispHTMLMetaElement) \
127 XDIID(DispHTMLNamespaceCollection) \
128 XDIID(DispHTMLNavigator) \
129 XDIID(DispHTMLObjectElement) \
130 XDIID(DispHTMLOptionElement) \
131 XDIID(DispHTMLScreen) \
132 XDIID(DispHTMLScriptElement) \
133 XDIID(DispHTMLSelectElement) \
134 XDIID(DispHTMLStyle) \
135 XDIID(DispHTMLStyleElement) \
136 XDIID(DispHTMLStyleSheet) \
137 XDIID(DispHTMLStyleSheetRule) \
138 XDIID(DispHTMLStyleSheetRulesCollection) \
139 XDIID(DispHTMLStyleSheetsCollection) \
140 XDIID(DispHTMLTable) \
141 XDIID(DispHTMLTableCell) \
142 XDIID(DispHTMLTableRow) \
143 XDIID(DispHTMLTextAreaElement) \
144 XDIID(DispHTMLTitleElement) \
145 XDIID(DispHTMLUnknownElement) \
146 XDIID(DispHTMLW3CComputedStyle) \
147 XDIID(DispHTMLWindow2) \
148 XDIID(DispHTMLXMLHttpRequest) \
149 XDIID(DispSVGCircleElement) \
150 XDIID(DispSVGSVGElement) \
151 XDIID(DispSVGTSpanElement) \
152 XDIID(HTMLDocumentEvents) \
153 XDIID(HTMLDocumentEvents2) \
154 XDIID(HTMLElementEvents2) \
155 XIID(IDOMCustomEvent) \
157 XIID(IDOMKeyboardEvent) \
158 XIID(IDOMMessageEvent) \
159 XIID(IDOMMouseEvent) \
160 XIID(IDOMProgressEvent) \
161 XIID(IDOMStorageEvent) \
163 XIID(IDOMDocumentType) \
164 XIID(IDocumentEvent) \
165 XIID(IDocumentRange) \
166 XIID(IDocumentSelector) \
167 XIID(IElementSelector) \
168 XIID(IElementTraversal) \
170 XIID(IHTMLAnchorElement) \
171 XIID(IHTMLAreaElement) \
172 XIID(IHTMLAttributeCollection) \
173 XIID(IHTMLAttributeCollection2) \
174 XIID(IHTMLAttributeCollection3) \
175 XIID(IHTMLBodyElement) \
176 XIID(IHTMLBodyElement2) \
177 XIID(IHTMLButtonElement) \
178 XIID(IHTMLCSSStyleDeclaration) \
179 XIID(IHTMLCSSStyleDeclaration2) \
180 XIID(IHTMLCommentElement) \
181 XIID(IHTMLCurrentStyle) \
182 XIID(IHTMLCurrentStyle2) \
183 XIID(IHTMLCurrentStyle3) \
184 XIID(IHTMLCurrentStyle4) \
185 XIID(IHTMLDocument2) \
186 XIID(IHTMLDocument3) \
187 XIID(IHTMLDocument4) \
188 XIID(IHTMLDocument5) \
189 XIID(IHTMLDocument6) \
190 XIID(IHTMLDocument7) \
191 XIID(IHTMLDOMAttribute) \
192 XIID(IHTMLDOMAttribute2) \
193 XIID(IHTMLDOMChildrenCollection) \
194 XIID(IHTMLDOMImplementation) \
195 XIID(IHTMLDOMImplementation2) \
197 XIID(IHTMLDOMNode2) \
198 XIID(IHTMLDOMNode3) \
199 XIID(IHTMLDOMRange) \
200 XIID(IHTMLDOMTextNode) \
201 XIID(IHTMLDOMTextNode2) \
203 XIID(IHTMLElement2) \
204 XIID(IHTMLElement3) \
205 XIID(IHTMLElement4) \
206 XIID(IHTMLElement6) \
207 XIID(IHTMLElement7) \
208 XIID(IHTMLElementCollection) \
209 XIID(IHTMLEmbedElement) \
210 XIID(IHTMLEventObj) \
211 XIID(IHTMLFiltersCollection) \
212 XIID(IHTMLFormElement) \
213 XIID(IHTMLFrameBase) \
214 XIID(IHTMLFrameBase2) \
215 XIID(IHTMLFrameElement3) \
216 XIID(IHTMLGenericElement) \
217 XIID(IHTMLHeadElement) \
218 XIID(IHTMLHtmlElement) \
219 XIID(IHTMLIFrameElement) \
220 XIID(IHTMLIFrameElement2) \
221 XIID(IHTMLIFrameElement3) \
222 XIID(IHTMLImageElementFactory) \
223 XIID(IHTMLImgElement) \
224 XIID(IHTMLInputElement) \
225 XIID(IHTMLInputTextElement2) \
226 XIID(IHTMLLabelElement) \
227 XIID(IHTMLLinkElement) \
228 XIID(IHTMLLocation) \
229 XIID(IHTMLMetaElement) \
230 XIID(IHTMLMimeTypesCollection) \
231 XIID(IHTMLNamespaceCollection) \
232 XIID(IHTMLObjectElement) \
233 XIID(IHTMLObjectElement2) \
234 XIID(IHTMLOptionElement) \
235 XIID(IHTMLOptionElementFactory) \
236 XIID(IHTMLPerformance) \
237 XIID(IHTMLPerformanceNavigation) \
238 XIID(IHTMLPerformanceTiming) \
239 XIID(IHTMLPluginsCollection) \
242 XIID(IHTMLRectCollection) \
244 XIID(IHTMLScriptElement) \
245 XIID(IHTMLSelectElement) \
246 XIID(IHTMLSelectionObject) \
247 XIID(IHTMLSelectionObject2) \
255 XIID(IHTMLStyleElement) \
256 XIID(IHTMLStyleElement2) \
257 XIID(IHTMLStyleSheet) \
258 XIID(IHTMLStyleSheet4) \
259 XIID(IHTMLStyleSheetRule) \
260 XIID(IHTMLStyleSheetRulesCollection) \
261 XIID(IHTMLStyleSheetsCollection) \
265 XIID(IHTMLTableCell) \
266 XIID(IHTMLTableRow) \
267 XIID(IHTMLTextAreaElement) \
268 XIID(IHTMLTextContainer) \
269 XIID(IHTMLTitleElement) \
270 XIID(IHTMLTxtRange) \
271 XIID(IHTMLUniqueName) \
278 XIID(IHTMLXMLHttpRequest) \
279 XIID(IHTMLXMLHttpRequest2) \
280 XIID(IHTMLXMLHttpRequestFactory) \
283 XIID(ISVGCircleElement) \
285 XIID(ISVGSVGElement) \
286 XIID(ISVGTSpanElement) \
287 XIID(ISVGTextContentElement)
289 #define PRIVATE_TID_LIST \
290 XIID(IWineDOMTokenList) \
291 XIID(IWineHTMLElementPrivate) \
292 XIID(IWineHTMLWindowPrivate) \
293 XIID(IWineHTMLWindowCompatPrivate) \
294 XIID(IWinePageTransitionEvent) \
295 XIID(IWineXMLHttpRequestPrivate) \
296 XIID(IWineMSHTMLConsole) \
297 XIID(IWineMSHTMLMediaQueryList) \
298 XIID(IWineMSHTMLMutationObserver)
301 #define XIID(iface) iface ## _tid,
302 #define XDIID(iface) iface ## _tid,
312 COMPAT_MODE_INVALID
= -1,
322 #define COMPAT_MODE_CNT (COMPAT_MODE_IE11+1)
323 #define COMPAT_MODE_NONE COMPAT_MODE_QUIRKS
326 unsigned document_mode
;
328 } compat_mode_info_t
;
330 extern const compat_mode_info_t compat_mode_info
[COMPAT_MODE_CNT
];
332 typedef struct dispex_data_t dispex_data_t
;
333 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
335 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
336 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
337 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
339 typedef struct DispatchEx DispatchEx
;
340 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback
;
344 } nsCycleCollectingAutoRefCnt
;
347 dispex is our base IDispatchEx implementation for all mshtml objects, and the vtbl allows
348 customizing the behavior depending on the object. Objects have basically 3 types of props:
350 - builtin props: These props are implicitly generated from the TypeInfo (disp_tid and iface_tids in dispex_static_data_t).
351 - custom props: These props are specific to an object, they are created using vtbl below (e.g. indexed props in HTMLRectCollection).
352 - dynamic props: These props are generally allocated by external code (e.g. 'document.wine = 42' creates 'wine' dynamic prop on document)
355 /* Used to provide object specific interfaces (do not AddRef, just return the iface) */
356 void *(*query_interface
)(DispatchEx
*,REFIID
);
358 /* Used to implement Cycle Collection callbacks; note that the destructor is not optional!
359 Unlike delete_cycle_collectable, unlink is called before the destructor (if available). */
360 void (*destructor
)(DispatchEx
*);
361 void (*traverse
)(DispatchEx
*,nsCycleCollectionTraversalCallback
*);
362 void (*unlink
)(DispatchEx
*);
364 /* Called on the last release, when the refcount reaches 0 */
365 void (*last_release
)(DispatchEx
*);
367 /* Called when the object wants to handle DISPID_VALUE invocations */
368 HRESULT (*value
)(DispatchEx
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
370 /* Used when the object has custom props, and this returns DISPIDs for them */
371 HRESULT (*get_dispid
)(DispatchEx
*,BSTR
,DWORD
,DISPID
*);
373 /* These are called when the object implements GetMemberName, InvokeEx, DeleteMemberByDispID and GetNextDispID for custom props */
374 HRESULT (*get_name
)(DispatchEx
*,DISPID
,BSTR
*);
375 HRESULT (*invoke
)(DispatchEx
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
376 HRESULT (*delete)(DispatchEx
*,DISPID
);
377 HRESULT (*next_dispid
)(DispatchEx
*,DISPID
,DISPID
*);
379 /* Used by objects that want to delay their compat mode initialization until actually needed */
380 compat_mode_t (*get_compat_mode
)(DispatchEx
*);
382 /* Used by objects that want to populate some dynamic props on initialization */
383 HRESULT (*populate_props
)(DispatchEx
*);
384 } dispex_static_data_vtbl_t
;
388 const dispex_static_data_vtbl_t
*vtbl
;
389 const tid_t disp_tid
;
390 const tid_t
* const iface_tids
;
391 void (*init_info
)(dispex_data_t
*,compat_mode_t
);
392 dispex_data_t
*info_cache
[COMPAT_MODE_CNT
];
393 dispex_data_t
*delayed_init_info
;
394 } dispex_static_data_t
;
396 typedef HRESULT (*dispex_hook_invoke_t
)(DispatchEx
*,WORD
,DISPPARAMS
*,VARIANT
*,
397 EXCEPINFO
*,IServiceProvider
*);
401 dispex_hook_invoke_t invoke
;
406 IDispatchEx IDispatchEx_iface
;
408 nsCycleCollectingAutoRefCnt ccref
;
411 dispex_dynamic_data_t
*dynamic_data
;
418 } ExternalCycleCollectionParticipant
;
421 nsresult (NSAPI
*traverse
)(void*,void*,nsCycleCollectionTraversalCallback
*);
422 nsresult (NSAPI
*unlink
)(void*);
423 void (NSAPI
*delete_cycle_collectable
)(void*);
426 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant
, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9);
428 extern nsrefcnt (__cdecl
*ccref_incr
)(nsCycleCollectingAutoRefCnt
*,nsISupports
*);
429 extern nsrefcnt (__cdecl
*ccref_decr
)(nsCycleCollectingAutoRefCnt
*,nsISupports
*,ExternalCycleCollectionParticipant
*);
430 extern void (__cdecl
*ccref_init
)(nsCycleCollectingAutoRefCnt
*,nsrefcnt
);
431 extern void (__cdecl
*ccp_init
)(ExternalCycleCollectionParticipant
*,const CCObjCallback
*);
432 extern void (__cdecl
*describe_cc_node
)(nsCycleCollectingAutoRefCnt
*,const char*,nsCycleCollectionTraversalCallback
*);
433 extern void (__cdecl
*note_cc_edge
)(nsISupports
*,const char*,nsCycleCollectionTraversalCallback
*);
435 void init_dispatch(DispatchEx
*,dispex_static_data_t
*,compat_mode_t
);
436 void dispex_props_unlink(DispatchEx
*);
437 HRESULT
change_type(VARIANT
*,VARIANT
*,VARTYPE
,IServiceProvider
*);
438 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
439 HRESULT
get_dispids(tid_t
,DWORD
*,DISPID
**);
440 HRESULT
remove_attribute(DispatchEx
*,DISPID
,VARIANT_BOOL
*);
441 HRESULT
dispex_get_dynid(DispatchEx
*,const WCHAR
*,BOOL
,DISPID
*);
442 void release_typelib(void);
443 HRESULT
get_class_typeinfo(const CLSID
*,ITypeInfo
**);
444 const void *dispex_get_vtbl(DispatchEx
*);
445 void dispex_info_add_interface(dispex_data_t
*,tid_t
,const dispex_hook_t
*);
446 compat_mode_t
dispex_compat_mode(DispatchEx
*);
447 HRESULT
dispex_to_string(DispatchEx
*,BSTR
*);
448 HRESULT
dispex_call_builtin(DispatchEx
*dispex
, DISPID id
, DISPPARAMS
*dp
,
449 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
);
455 } dispex_prop_type_t
;
457 dispex_prop_type_t
get_dispid_type(DISPID
);
459 typedef struct HTMLWindow HTMLWindow
;
460 typedef struct HTMLInnerWindow HTMLInnerWindow
;
461 typedef struct HTMLOuterWindow HTMLOuterWindow
;
462 typedef struct HTMLDocumentNode HTMLDocumentNode
;
463 typedef struct HTMLDocumentObj HTMLDocumentObj
;
464 typedef struct HTMLFrameBase HTMLFrameBase
;
465 typedef struct GeckoBrowser GeckoBrowser
;
466 typedef struct HTMLAttributeCollection HTMLAttributeCollection
;
468 typedef struct ScriptHost ScriptHost
;
475 } global_prop_type_t
;
478 global_prop_type_t type
;
480 ScriptHost
*script_host
;
486 IEventTarget IEventTarget_iface
;
487 struct wine_rb_tree handler_map
;
492 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface
;
494 HTMLInnerWindow
*window
;
495 } HTMLOptionElementFactory
;
499 IHTMLImageElementFactory IHTMLImageElementFactory_iface
;
501 HTMLInnerWindow
*window
;
502 } HTMLImageElementFactory
;
506 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface
;
508 HTMLInnerWindow
*window
;
509 } HTMLXMLHttpRequestFactory
;
511 struct HTMLLocation
{
513 IHTMLLocation IHTMLLocation_iface
;
515 HTMLOuterWindow
*window
;
520 IOmHistory IOmHistory_iface
;
522 HTMLInnerWindow
*window
;
525 typedef struct nsChannelBSC nsChannelBSC
;
528 IHTMLWindow2 IHTMLWindow2_iface
;
529 IHTMLWindow3 IHTMLWindow3_iface
;
530 IHTMLWindow4 IHTMLWindow4_iface
;
531 IHTMLWindow5 IHTMLWindow5_iface
;
532 IHTMLWindow6 IHTMLWindow6_iface
;
533 IHTMLWindow7 IHTMLWindow7_iface
;
534 IHTMLPrivateWindow IHTMLPrivateWindow_iface
;
535 IDispatchEx IDispatchEx_iface
;
536 IServiceProvider IServiceProvider_iface
;
537 ITravelLogClient ITravelLogClient_iface
;
538 IObjectIdentity IObjectIdentity_iface
;
539 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface
;
540 IWineHTMLWindowPrivate IWineHTMLWindowPrivate_iface
;
541 IWineHTMLWindowCompatPrivate IWineHTMLWindowCompatPrivate_iface
;
543 HTMLInnerWindow
*inner_window
;
544 HTMLOuterWindow
*outer_window
;
547 struct HTMLOuterWindow
{
549 IEventTarget IEventTarget_iface
;
551 nsCycleCollectingAutoRefCnt ccref
;
554 nsIDOMWindow
*nswindow
;
555 mozIDOMWindowProxy
*window_proxy
;
556 HTMLOuterWindow
*parent
;
557 HTMLFrameBase
*frame_element
;
559 GeckoBrowser
*browser
;
560 struct list browser_entry
;
562 READYSTATE readystate
;
563 unsigned readystate_locked
;
564 BOOL readystate_pending
;
566 HTMLInnerWindow
*pending_window
;
567 HTMLLocation
*location
;
574 struct list sibling_entry
;
575 struct wine_rb_entry entry
;
578 struct HTMLInnerWindow
{
580 EventTarget event_target
;
582 HTMLDocumentNode
*doc
;
583 nsIDOMWindow
*dom_window
;
585 struct list children
;
586 struct list script_hosts
;
588 IHTMLEventObj
*event
;
590 HTMLImageElementFactory
*image_factory
;
591 HTMLOptionElementFactory
*option_factory
;
592 HTMLXMLHttpRequestFactory
*xhr_factory
;
595 IOmNavigator
*navigator
;
596 IHTMLStorage
*session_storage
;
597 IHTMLStorage
*local_storage
;
598 IWineMSHTMLConsole
*console
;
600 BOOL performance_initialized
;
603 unsigned blocking_depth
;
604 unsigned parser_callback_cnt
;
605 struct list script_queue
;
607 global_prop_t
*global_props
;
608 DWORD global_prop_cnt
;
609 DWORD global_prop_size
;
614 IDispatch
*mutation_observer_ctor
;
615 nsChannelBSC
*bscallback
;
616 struct list bindings
;
618 ULONG navigation_type
;
619 ULONG redirect_count
;
621 ULONGLONG navigation_start_time
;
622 ULONGLONG unload_event_start_time
;
623 ULONGLONG unload_event_end_time
;
624 ULONGLONG redirect_time
;
625 ULONGLONG dns_lookup_time
;
626 ULONGLONG connect_time
;
627 ULONGLONG request_time
;
628 ULONGLONG response_start_time
;
629 ULONGLONG response_end_time
;
630 ULONGLONG dom_interactive_time
;
631 ULONGLONG dom_complete_time
;
632 ULONGLONG dom_content_loaded_event_start_time
;
633 ULONGLONG dom_content_loaded_event_end_time
;
634 ULONGLONG load_event_start_time
;
635 ULONGLONG load_event_end_time
;
636 ULONGLONG first_paint_time
;
645 typedef struct _cp_static_data_t
{
647 void (*on_advise
)(IUnknown
*,struct _cp_static_data_t
*);
655 cp_static_data_t
*desc
;
658 typedef struct ConnectionPointContainer
{
659 IConnectionPointContainer IConnectionPointContainer_iface
;
661 ConnectionPoint
*cps
;
662 const cpc_entry_t
*cp_entries
;
664 struct ConnectionPointContainer
*forward_container
;
665 } ConnectionPointContainer
;
667 struct ConnectionPoint
{
668 IConnectionPoint IConnectionPoint_iface
;
670 ConnectionPointContainer
*container
;
675 IPropertyNotifySink
*propnotif
;
680 cp_static_data_t
*data
;
683 struct HTMLDocumentObj
{
684 IUnknown IUnknown_inner
;
685 IDispatchEx IDispatchEx_iface
;
686 ICustomDoc ICustomDoc_iface
;
687 IHTMLDocument2 IHTMLDocument2_iface
;
688 IHTMLDocument3 IHTMLDocument3_iface
;
689 IHTMLDocument4 IHTMLDocument4_iface
;
690 IHTMLDocument5 IHTMLDocument5_iface
;
691 IHTMLDocument6 IHTMLDocument6_iface
;
692 IHTMLDocument7 IHTMLDocument7_iface
;
693 IDocumentSelector IDocumentSelector_iface
;
694 IDocumentEvent IDocumentEvent_iface
;
695 ISupportErrorInfo ISupportErrorInfo_iface
;
696 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface
;
697 IMarkupServices IMarkupServices_iface
;
698 IMarkupContainer IMarkupContainer_iface
;
699 IDisplayServices IDisplayServices_iface
;
700 IDocumentRange IDocumentRange_iface
;
701 IOleDocumentView IOleDocumentView_iface
;
702 IViewObjectEx IViewObjectEx_iface
;
703 IPersistMoniker IPersistMoniker_iface
;
704 IPersistFile IPersistFile_iface
;
705 IMonikerProp IMonikerProp_iface
;
706 IPersistStreamInit IPersistStreamInit_iface
;
707 IPersistHistory IPersistHistory_iface
;
708 IHlinkTarget IHlinkTarget_iface
;
709 IOleCommandTarget IOleCommandTarget_iface
;
710 IOleObject IOleObject_iface
;
711 IOleDocument IOleDocument_iface
;
712 IOleControl IOleControl_iface
;
713 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface
;
714 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface
;
715 IObjectWithSite IObjectWithSite_iface
;
716 IOleContainer IOleContainer_iface
;
717 IObjectSafety IObjectSafety_iface
;
718 IServiceProvider IServiceProvider_iface
;
719 ITargetContainer ITargetContainer_iface
;
720 IEventTarget IEventTarget_iface
;
722 IWindowForBindingUI IWindowForBindingUI_iface
;
727 HTMLOuterWindow
*window
;
728 GeckoBrowser
*nscontainer
;
729 HTMLDocumentNode
*doc_node
;
731 IOleClientSite
*client
;
732 IDocHostUIHandler
*hostui
;
733 IOleCommandTarget
*client_cmdtrg
;
735 IOleInPlaceSite
*ipsite
;
736 IOleInPlaceFrame
*frame
;
737 IOleInPlaceUIWindow
*ip_window
;
738 IAdviseSink
*view_sink
;
739 IDocObjectService
*doc_object_service
;
740 IUnknown
*webbrowser
;
741 ITravelLog
*travel_log
;
742 IUnknown
*browser_service
;
743 IOleAdviseHolder
*advise_holder
;
745 ConnectionPointContainer cp_container
;
746 DOCHOSTUIINFO hostinfo
;
748 IOleUndoManager
*undomgr
;
749 IHTMLEditServices
*editsvcs
;
755 BOOL request_uiactivate
;
756 BOOL in_place_active
;
760 BOOL container_locked
;
772 typedef struct nsWeakReference nsWeakReference
;
777 SCRIPTMODE_ACTIVESCRIPT
780 struct GeckoBrowser
{
781 nsIWebBrowserChrome nsIWebBrowserChrome_iface
;
782 nsIContextMenuListener nsIContextMenuListener_iface
;
783 nsIURIContentListener nsIURIContentListener_iface
;
784 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface
;
785 nsITooltipListener nsITooltipListener_iface
;
786 nsIInterfaceRequestor nsIInterfaceRequestor_iface
;
787 nsISupportsWeakReference nsISupportsWeakReference_iface
;
789 nsIWebBrowser
*webbrowser
;
790 nsIWebNavigation
*navigation
;
791 nsIBaseWindow
*window
;
792 nsIWebBrowserFocus
*focus
;
794 HTMLOuterWindow
*content_window
;
797 nsIController
*editor_controller
;
801 nsWeakReference
*weak_reference
;
803 HTMLDocumentObj
*doc
;
805 nsIURIContentListener
*content_listener
;
808 SCRIPTMODE script_mode
;
811 struct list document_nodes
;
812 struct list outer_windows
;
817 const cpc_entry_t
*cpc_entries
;
818 HRESULT (*clone
)(HTMLDOMNode
*,nsIDOMNode
*,HTMLDOMNode
**);
819 HRESULT (*get_attr_col
)(HTMLDOMNode
*,HTMLAttributeCollection
**);
820 EventTarget
*(*get_event_prop_target
)(HTMLDOMNode
*,int);
821 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
822 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
823 HRESULT (*get_document
)(HTMLDOMNode
*,IDispatch
**);
824 HRESULT (*get_readystate
)(HTMLDOMNode
*,BSTR
*);
825 HRESULT (*bind_to_tree
)(HTMLDOMNode
*);
826 BOOL (*is_text_edit
)(HTMLDOMNode
*);
827 BOOL (*is_settable
)(HTMLDOMNode
*,DISPID
);
831 EventTarget event_target
;
832 IHTMLDOMNode IHTMLDOMNode_iface
;
833 IHTMLDOMNode2 IHTMLDOMNode2_iface
;
834 IHTMLDOMNode3 IHTMLDOMNode3_iface
;
835 const NodeImplVtbl
*vtbl
;
838 HTMLDocumentNode
*doc
;
841 HTMLDOMNode
*unsafe_impl_from_IHTMLDOMNode(IHTMLDOMNode
*);
843 static inline void node_addref(HTMLDOMNode
*node
)
845 IHTMLDOMNode_AddRef(&node
->IHTMLDOMNode_iface
);
848 static inline void node_release(HTMLDOMNode
*node
)
850 IHTMLDOMNode_Release(&node
->IHTMLDOMNode_iface
);
855 ConnectionPointContainer cp_container
;
857 IHTMLElement IHTMLElement_iface
;
858 IHTMLElement2 IHTMLElement2_iface
;
859 IHTMLElement3 IHTMLElement3_iface
;
860 IHTMLElement4 IHTMLElement4_iface
;
861 IHTMLElement6 IHTMLElement6_iface
;
862 IHTMLElement7 IHTMLElement7_iface
;
863 IHTMLUniqueName IHTMLUniqueName_iface
;
864 IElementSelector IElementSelector_iface
;
865 IElementTraversal IElementTraversal_iface
;
866 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface
;
867 IWineHTMLElementPrivate IWineHTMLElementPrivate_iface
;
869 nsIDOMElement
*dom_element
; /* NULL for legacy comments represented as HTML elements */
870 nsIDOMHTMLElement
*html_element
; /* NULL for non-HTML elements (like SVG elements) */
872 HTMLStyle
*runtime_style
;
873 HTMLAttributeCollection
*attrs
;
878 #define HTMLELEMENT_TIDS \
886 extern const tid_t HTMLElement_iface_tids
[];
887 extern cp_static_data_t HTMLElementEvents2_data
;
888 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data}
889 extern const cpc_entry_t HTMLElement_cpc
[];
891 struct HTMLFrameBase
{
894 IHTMLFrameBase IHTMLFrameBase_iface
;
895 IHTMLFrameBase2 IHTMLFrameBase2_iface
;
897 HTMLOuterWindow
*content_window
;
899 nsIDOMHTMLFrameElement
*nsframe
;
900 nsIDOMHTMLIFrameElement
*nsiframe
;
903 typedef struct nsDocumentEventListener nsDocumentEventListener
;
905 struct HTMLDocumentNode
{
908 IDispatchEx IDispatchEx_iface
;
909 IHTMLDocument2 IHTMLDocument2_iface
;
910 IHTMLDocument3 IHTMLDocument3_iface
;
911 IHTMLDocument4 IHTMLDocument4_iface
;
912 IHTMLDocument5 IHTMLDocument5_iface
;
913 IHTMLDocument6 IHTMLDocument6_iface
;
914 IHTMLDocument7 IHTMLDocument7_iface
;
915 IDocumentSelector IDocumentSelector_iface
;
916 IDocumentEvent IDocumentEvent_iface
;
917 ISupportErrorInfo ISupportErrorInfo_iface
;
918 IProvideMultipleClassInfo IProvideMultipleClassInfo_iface
;
919 IMarkupServices IMarkupServices_iface
;
920 IMarkupContainer IMarkupContainer_iface
;
921 IDisplayServices IDisplayServices_iface
;
922 IDocumentRange IDocumentRange_iface
;
923 IPersistMoniker IPersistMoniker_iface
;
924 IPersistFile IPersistFile_iface
;
925 IMonikerProp IMonikerProp_iface
;
926 IPersistStreamInit IPersistStreamInit_iface
;
927 IPersistHistory IPersistHistory_iface
;
928 IHlinkTarget IHlinkTarget_iface
;
929 IOleCommandTarget IOleCommandTarget_iface
;
930 IOleObject IOleObject_iface
;
931 IOleDocument IOleDocument_iface
;
932 IOleControl IOleControl_iface
;
933 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface
;
934 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface
;
935 IObjectWithSite IObjectWithSite_iface
;
936 IOleContainer IOleContainer_iface
;
937 IObjectSafety IObjectSafety_iface
;
938 IServiceProvider IServiceProvider_iface
;
939 IInternetHostSecurityManager IInternetHostSecurityManager_iface
;
941 nsIDocumentObserver nsIDocumentObserver_iface
;
942 ConnectionPointContainer cp_container
;
943 HTMLOuterWindow
*outer_window
;
944 HTMLInnerWindow
*window
;
945 HTMLDocumentObj
*doc_obj
;
947 GeckoBrowser
*browser
;
948 struct list browser_entry
;
950 compat_mode_t document_mode
;
951 BOOL document_mode_locked
;
953 nsIDOMDocument
*dom_document
;
954 nsIDOMHTMLDocument
*html_document
;
955 unsigned int content_ready
: 1;
956 unsigned int unload_sent
: 1;
958 IHTMLDOMImplementation
*dom_implementation
;
959 IHTMLNamespaceCollection
*namespaces
;
961 ICatInformation
*catmgr
;
962 nsDocumentEventListener
*nsevent_listener
;
966 unsigned elem_vars_size
;
967 unsigned elem_vars_cnt
;
969 BOOL skip_mutation_notif
;
975 struct list selection_list
;
976 struct list range_list
;
977 struct list plugin_hosts
;
980 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
981 HRESULT
MHTMLDocument_Create(IUnknown
*,REFIID
,void**);
982 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
983 HRESULT
create_document_node(nsIDOMDocument
*,GeckoBrowser
*,HTMLInnerWindow
*,
984 compat_mode_t
,HTMLDocumentNode
**);
985 HRESULT
create_doctype_node(HTMLDocumentNode
*,nsIDOMNode
*,HTMLDOMNode
**);
987 HRESULT
create_outer_window(GeckoBrowser
*,mozIDOMWindowProxy
*,HTMLOuterWindow
*,HTMLOuterWindow
**);
988 HRESULT
update_window_doc(HTMLInnerWindow
*);
989 HTMLOuterWindow
*mozwindow_to_window(const mozIDOMWindowProxy
*);
990 void get_top_window(HTMLOuterWindow
*,HTMLOuterWindow
**);
991 HRESULT
HTMLOptionElementFactory_Create(HTMLInnerWindow
*,HTMLOptionElementFactory
**);
992 HRESULT
HTMLImageElementFactory_Create(HTMLInnerWindow
*,HTMLImageElementFactory
**);
993 HRESULT
HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow
*,HTMLXMLHttpRequestFactory
**);
994 HRESULT
create_location(HTMLOuterWindow
*,HTMLLocation
**);
995 HRESULT
create_navigator(compat_mode_t
,IOmNavigator
**);
996 HRESULT
create_html_screen(compat_mode_t
,IHTMLScreen
**);
997 HRESULT
create_performance(HTMLInnerWindow
*,IHTMLPerformance
**);
998 HRESULT
create_history(HTMLInnerWindow
*,OmHistory
**);
999 HRESULT
create_namespace_collection(compat_mode_t
,IHTMLNamespaceCollection
**);
1000 HRESULT
create_dom_implementation(HTMLDocumentNode
*,IHTMLDOMImplementation
**);
1001 void detach_dom_implementation(IHTMLDOMImplementation
*);
1002 HRESULT
create_html_storage(HTMLInnerWindow
*,BOOL
,IHTMLStorage
**);
1004 void HTMLDocument_View_Init(HTMLDocumentObj
*);
1005 void HTMLDocumentObj_Persist_Init(HTMLDocumentObj
*);
1006 void HTMLDocumentObj_Service_Init(HTMLDocumentObj
*);
1007 void HTMLDocumentObj_OleCmd_Init(HTMLDocumentObj
*);
1008 void TargetContainer_Init(HTMLDocumentObj
*);
1010 void HTMLDocumentNode_Persist_Init(HTMLDocumentNode
*);
1011 void HTMLDocumentNode_Service_Init(HTMLDocumentNode
*);
1012 void HTMLDocumentNode_OleCmd_Init(HTMLDocumentNode
*);
1013 void HTMLDocumentNode_OleObj_Init(HTMLDocumentNode
*);
1014 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
1016 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
1018 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*,const cpc_entry_t
*);
1019 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
1021 HRESULT
create_gecko_browser(HTMLDocumentObj
*,GeckoBrowser
**);
1022 void detach_gecko_browser(GeckoBrowser
*);
1024 DWORD
get_compat_mode_version(compat_mode_t compat_mode
);
1025 compat_mode_t
lock_document_mode(HTMLDocumentNode
*);
1027 void init_mutation(nsIComponentManager
*);
1028 void init_document_mutation(HTMLDocumentNode
*);
1029 void release_document_mutation(HTMLDocumentNode
*);
1030 JSContext
*get_context_from_document(nsIDOMDocument
*);
1032 void HTMLDocument_LockContainer(HTMLDocumentObj
*,BOOL
);
1033 void show_context_menu(HTMLDocumentObj
*,DWORD
,POINT
*,IDispatch
*);
1034 void notif_focus(HTMLDocumentObj
*);
1036 void show_tooltip(HTMLDocumentObj
*,DWORD
,DWORD
,LPCWSTR
);
1037 void hide_tooltip(HTMLDocumentObj
*);
1038 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
1040 UINT
get_document_charset(HTMLDocumentNode
*);
1042 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
1044 BOOL
load_gecko(void);
1045 void close_gecko(void);
1046 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
1047 void init_nsio(nsIComponentManager
*);
1048 void release_nsio(void);
1049 BOOL
is_gecko_path(const char*);
1050 void set_viewer_zoom(GeckoBrowser
*,float);
1051 float get_viewer_zoom(GeckoBrowser
*);
1053 void init_dispex_cc(void);
1054 void init_window_cc(void);
1056 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
1058 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*,VARIANT
*);
1059 void call_property_onchanged(ConnectionPointContainer
*,DISPID
);
1060 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
1063 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(nsfree
) __WINE_MALLOC
;
1065 BOOL
nsACString_Init(nsACString
*str
, const char *data
);
1066 void nsACString_InitDepend(nsACString
*,const char*);
1067 void nsACString_SetData(nsACString
*,const char*);
1068 UINT32
nsACString_GetData(const nsACString
*,const char**);
1069 void nsACString_Finish(nsACString
*);
1071 BOOL
nsAString_Init(nsAString
*,const PRUnichar
*);
1072 void nsAString_InitDepend(nsAString
*,const PRUnichar
*);
1073 void nsAString_SetData(nsAString
*,const PRUnichar
*);
1074 UINT32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
1075 void nsAString_Finish(nsAString
*);
1077 #define NSSTR_IMPLICIT_PX 0x01
1078 #define NSSTR_COLOR 0x02
1080 HRESULT
map_nsresult(nsresult
);
1081 HRESULT
return_nsstr(nsresult
,nsAString
*,BSTR
*);
1082 HRESULT
return_nsstr_variant(nsresult
,nsAString
*,unsigned,VARIANT
*);
1083 HRESULT
variant_to_nsstr(VARIANT
*,BOOL
,nsAString
*);
1084 HRESULT
return_nsform(nsresult
,nsIDOMHTMLFormElement
*,IHTMLFormElement
**);
1086 nsICommandParams
*create_nscommand_params(void);
1087 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
1088 void setup_editor_controller(GeckoBrowser
*);
1089 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
1090 nsIWritableVariant
*create_nsvariant(void);
1091 nsIXMLHttpRequest
*create_nsxhr(nsIDOMWindow
*nswindow
);
1092 nsresult
create_nsfile(const PRUnichar
*,nsIFile
**);
1093 char *get_nscategory_entry(const char*,const char*);
1095 HRESULT
create_pending_window(HTMLOuterWindow
*,nsChannelBSC
*);
1096 HRESULT
start_binding(HTMLInnerWindow
*,BSCallback
*,IBindCtx
*);
1097 HRESULT
async_start_doc_binding(HTMLOuterWindow
*,HTMLInnerWindow
*,DWORD
);
1098 void abort_window_bindings(HTMLInnerWindow
*);
1099 void set_download_state(HTMLDocumentObj
*,int);
1100 void call_docview_84(HTMLDocumentObj
*);
1101 HRESULT
reload_page(HTMLOuterWindow
*);
1103 void set_ready_state(HTMLOuterWindow
*,READYSTATE
);
1104 HRESULT
get_readystate_string(READYSTATE
,BSTR
*);
1106 HRESULT
HTMLSelectionObject_Create(HTMLDocumentNode
*,nsISelection
*,IHTMLSelectionObject
**);
1107 HRESULT
HTMLTxtRange_Create(HTMLDocumentNode
*,nsIDOMRange
*,IHTMLTxtRange
**);
1108 HRESULT
create_style_sheet(nsIDOMStyleSheet
*,compat_mode_t
,IHTMLStyleSheet
**);
1109 HRESULT
create_style_sheet_collection(nsIDOMStyleSheetList
*,compat_mode_t
,
1110 IHTMLStyleSheetsCollection
**);
1111 HRESULT
create_dom_range(nsIDOMRange
*,compat_mode_t
,IHTMLDOMRange
**);
1112 HRESULT
create_markup_pointer(IMarkupPointer
**);
1114 void detach_document_node(HTMLDocumentNode
*);
1115 void detach_selection(HTMLDocumentNode
*);
1116 void detach_ranges(HTMLDocumentNode
*);
1117 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
1118 HRESULT
replace_node_by_html(nsIDOMDocument
*,nsIDOMNode
*,const WCHAR
*);
1120 HRESULT
create_nselem(HTMLDocumentNode
*,const WCHAR
*,nsIDOMElement
**);
1121 HRESULT
create_element(HTMLDocumentNode
*,const WCHAR
*,HTMLElement
**);
1123 HRESULT
HTMLDOMTextNode_Create(HTMLDocumentNode
*,nsIDOMNode
*,HTMLDOMNode
**);
1125 BOOL
variant_to_nscolor(const VARIANT
*v
, nsAString
*nsstr
);
1126 HRESULT
nscolor_to_str(LPCWSTR color
, BSTR
*ret
);
1128 static inline BOOL
is_main_content_window(HTMLOuterWindow
*window
)
1130 return window
->browser
&& window
== window
->browser
->content_window
;
1133 struct HTMLAttributeCollection
{
1135 IHTMLAttributeCollection IHTMLAttributeCollection_iface
;
1136 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface
;
1137 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface
;
1145 IHTMLDOMAttribute IHTMLDOMAttribute_iface
;
1146 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface
;
1148 /* value is valid only for detached attributes (when elem == NULL). */
1150 /* name must be valid for detached attributes */
1158 HTMLDOMAttribute
*unsafe_impl_from_IHTMLDOMAttribute(IHTMLDOMAttribute
*);
1160 HRESULT
HTMLDOMAttribute_Create(const WCHAR
*,HTMLElement
*,DISPID
,compat_mode_t
,HTMLDOMAttribute
**);
1162 HRESULT
HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
,HTMLElement
**);
1163 HRESULT
HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,HTMLElement
**);
1164 HRESULT
HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1165 HRESULT
HTMLAreaElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1166 HRESULT
HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1167 HRESULT
HTMLButtonElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1168 HRESULT
HTMLEmbedElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1169 HRESULT
HTMLFormElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1170 HRESULT
HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1171 HRESULT
HTMLHeadElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1172 HRESULT
HTMLHtmlElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1173 HRESULT
HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1174 HRESULT
HTMLStyleElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1175 HRESULT
HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1176 HRESULT
HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1177 HRESULT
HTMLLabelElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1178 HRESULT
HTMLLinkElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1179 HRESULT
HTMLMetaElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1180 HRESULT
HTMLObjectElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1181 HRESULT
HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1182 HRESULT
HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1183 HRESULT
HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1184 HRESULT
HTMLTable_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1185 HRESULT
HTMLTableCell_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1186 HRESULT
HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1187 HRESULT
HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1188 HRESULT
HTMLTitleElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1189 HRESULT
HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMElement
*,HTMLElement
**);
1191 HRESULT
create_svg_element(HTMLDocumentNode
*,nsIDOMSVGElement
*,const WCHAR
*,HTMLElement
**);
1193 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*,dispex_static_data_t
*);
1194 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMElement
*,dispex_static_data_t
*);
1196 void EventTarget_Init(EventTarget
*,dispex_static_data_t
*,compat_mode_t
);
1197 void *EventTarget_query_interface(EventTarget
*,REFIID
);
1198 void EventTarget_init_dispex_info(dispex_data_t
*,compat_mode_t
);
1200 void *HTMLDOMNode_query_interface(DispatchEx
*,REFIID
);
1201 void HTMLDOMNode_destructor(DispatchEx
*);
1202 void HTMLDOMNode_traverse(DispatchEx
*,nsCycleCollectionTraversalCallback
*);
1203 void HTMLDOMNode_unlink(DispatchEx
*);
1204 void HTMLDOMNode_init_dispex_info(dispex_data_t
*,compat_mode_t
);
1206 void *HTMLElement_query_interface(DispatchEx
*,REFIID
);
1207 void HTMLElement_destructor(DispatchEx
*);
1208 void HTMLElement_traverse(DispatchEx
*,nsCycleCollectionTraversalCallback
*);
1209 void HTMLElement_unlink(DispatchEx
*);
1210 HRESULT
HTMLElement_populate_props(DispatchEx
*);
1211 HRESULT
HTMLElement_clone(HTMLDOMNode
*,nsIDOMNode
*,HTMLDOMNode
**);
1212 HRESULT
HTMLElement_get_attr_col(HTMLDOMNode
*,HTMLAttributeCollection
**);
1213 void HTMLElement_init_dispex_info(dispex_data_t
*,compat_mode_t
);
1215 HRESULT
get_node(nsIDOMNode
*,BOOL
,HTMLDOMNode
**);
1216 HRESULT
get_element(nsIDOMElement
*,HTMLElement
**);
1217 HRESULT
get_document_node(nsIDOMDocument
*,HTMLDocumentNode
**);
1219 HTMLElement
*unsafe_impl_from_IHTMLElement(IHTMLElement
*);
1221 HRESULT
search_window_props(HTMLInnerWindow
*,BSTR
,DWORD
,DISPID
*);
1222 HRESULT
get_frame_by_name(HTMLOuterWindow
*,const WCHAR
*,BOOL
,HTMLOuterWindow
**);
1223 HRESULT
get_doc_elem_by_id(HTMLDocumentNode
*,const WCHAR
*,HTMLElement
**);
1224 HTMLOuterWindow
*get_target_window(HTMLOuterWindow
*,nsAString
*,BOOL
*);
1225 HRESULT
handle_link_click_event(HTMLElement
*,nsAString
*,nsAString
*,nsIDOMEvent
*,BOOL
*);
1227 HRESULT
wrap_iface(IUnknown
*,IUnknown
*,IUnknown
**);
1229 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
1230 IHTMLElementCollection
*create_collection_from_nodelist(nsIDOMNodeList
*,compat_mode_t
);
1231 IHTMLElementCollection
*create_collection_from_htmlcol(nsIDOMHTMLCollection
*,compat_mode_t
);
1232 HRESULT
create_child_collection(nsIDOMNodeList
*,compat_mode_t
,IHTMLDOMChildrenCollection
**);
1234 HRESULT
attr_value_to_string(VARIANT
*);
1235 HRESULT
get_elem_attr_value_by_dispid(HTMLElement
*,DISPID
,VARIANT
*);
1236 HRESULT
get_elem_source_index(HTMLElement
*,LONG
*);
1238 nsresult
get_elem_attr_value(nsIDOMElement
*,const WCHAR
*,nsAString
*,const PRUnichar
**);
1239 HRESULT
elem_string_attr_getter(HTMLElement
*,const WCHAR
*,BOOL
,BSTR
*);
1240 HRESULT
elem_string_attr_setter(HTMLElement
*,const WCHAR
*,const WCHAR
*);
1242 HRESULT
elem_unique_id(unsigned id
, BSTR
*p
);
1247 HRESULT (*query
)(HTMLDocumentNode
*,OLECMD
*);
1248 HRESULT (*exec
)(HTMLDocumentNode
*,DWORD
,VARIANT
*,VARIANT
*);
1251 extern const cmdtable_t editmode_cmds
[];
1253 void do_ns_command(HTMLDocumentNode
*,const char*,nsICommandParams
*);
1256 #define UPDATE_UI 0x0001
1257 #define UPDATE_TITLE 0x0002
1259 void update_doc(HTMLDocumentObj
*,DWORD
);
1260 void update_title(HTMLDocumentObj
*);
1261 void set_document_navigation(HTMLDocumentObj
*,BOOL
);
1263 HRESULT
do_query_service(IUnknown
*,REFGUID
,REFIID
,void**);
1266 HRESULT
setup_edit_mode(HTMLDocumentObj
*);
1267 void init_editor(HTMLDocumentNode
*);
1268 void handle_edit_event(HTMLDocumentNode
*,nsIDOMEvent
*);
1269 HRESULT
editor_exec_copy(HTMLDocumentNode
*,DWORD
,VARIANT
*,VARIANT
*);
1270 HRESULT
editor_exec_cut(HTMLDocumentNode
*,DWORD
,VARIANT
*,VARIANT
*);
1271 HRESULT
editor_exec_paste(HTMLDocumentNode
*,DWORD
,VARIANT
*,VARIANT
*);
1272 HRESULT
browser_is_dirty(GeckoBrowser
*);
1273 void set_dirty(GeckoBrowser
*,VARIANT_BOOL
);
1275 extern DWORD mshtml_tls
;
1277 typedef struct task_t task_t
;
1278 typedef void (*task_proc_t
)(task_t
*);
1287 typedef struct event_task_t event_task_t
;
1288 typedef void (*event_task_proc_t
)(event_task_t
*);
1290 struct event_task_t
{
1292 BOOL thread_blocked
;
1293 event_task_proc_t proc
;
1294 event_task_proc_t destr
;
1296 HTMLInnerWindow
*window
;
1301 HTMLDocumentObj
*doc
;
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
;
1314 thread_data_t
*get_thread_data(BOOL
);
1315 HWND
get_thread_hwnd(void);
1316 void unblock_tasks_and_timers(thread_data_t
*);
1317 int session_storage_map_cmp(const void*,const struct wine_rb_entry
*);
1318 void destroy_session_storage(thread_data_t
*);
1320 LONG
get_task_target_magic(void);
1321 HRESULT
push_task(task_t
*,task_proc_t
,task_proc_t
,LONG
);
1322 HRESULT
push_event_task(event_task_t
*,HTMLInnerWindow
*,event_task_proc_t
,event_task_proc_t
,LONG
);
1323 void remove_target_tasks(LONG
);
1324 ULONGLONG
get_time_stamp(void);
1329 TIMER_ANIMATION_FRAME
,
1332 HRESULT
set_task_timer(HTMLInnerWindow
*,LONG
,enum timer_type
,IDispatch
*,LONG
*);
1333 HRESULT
clear_task_timer(HTMLInnerWindow
*,DWORD
);
1334 HRESULT
clear_animation_timer(HTMLInnerWindow
*,DWORD
);
1336 const WCHAR
*parse_compat_version(const WCHAR
*,compat_mode_t
*);
1338 const char *debugstr_mshtml_guid(const GUID
*);
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
)
1363 ret
= malloc((len
+ 1) * sizeof(WCHAR
));
1366 memcpy(ret
, str
, len
*sizeof(WCHAR
));
1374 static inline WCHAR
*strdupAtoW(const char *str
)
1381 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
1382 ret
= malloc(len
* sizeof(WCHAR
));
1384 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
1390 static inline char *strdupWtoA(const WCHAR
*str
)
1395 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
1398 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
1404 static inline WCHAR
*strdupUtoW(const char *str
)
1411 len
= MultiByteToWideChar(CP_UTF8
, 0, str
, -1, NULL
, 0);
1412 ret
= malloc(len
* sizeof(WCHAR
));
1414 MultiByteToWideChar(CP_UTF8
, 0, str
, -1, ret
, len
);
1420 static inline char *strdupWtoU(const WCHAR
*str
)
1425 size_t size
= WideCharToMultiByte(CP_UTF8
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
1428 WideCharToMultiByte(CP_UTF8
, 0, str
, -1, ret
, size
, NULL
, NULL
);
1434 static inline char *strndupWtoU(const WCHAR
*str
, unsigned len
)
1440 size
= len
? WideCharToMultiByte(CP_UTF8
, 0, str
, len
, NULL
, 0, NULL
, NULL
) : 0;
1441 ret
= malloc(size
+ 1);
1443 if(len
) WideCharToMultiByte(CP_UTF8
, 0, str
, len
, ret
, size
, NULL
, NULL
);
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 static inline void unlink_ref(void *p
)
1470 IUnknown
*unk
= *ref
;
1472 IUnknown_Release(unk
);
1476 static inline void unlink_variant(VARIANT
*v
)
1478 if(V_VT(v
) == VT_DISPATCH
|| V_VT(v
) == VT_UNKNOWN
)
1479 unlink_ref(&V_UNKNOWN(v
));
1482 static inline void traverse_variant(VARIANT
*v
, const char *name
, nsCycleCollectionTraversalCallback
*cb
)
1484 if(V_VT(v
) == VT_DISPATCH
|| V_VT(v
) == VT_UNKNOWN
)
1485 note_cc_edge((nsISupports
*)V_UNKNOWN(v
), name
, cb
);
1489 extern void *call_thiscall_func
;
1492 compat_mode_t
get_max_compat_mode(IUri
*);
1493 UINT
cp_from_charset_string(BSTR
);
1494 BSTR
charset_string_from_cp(UINT
);
1495 HRESULT
get_mime_type_display_name(const WCHAR
*,BSTR
*);
1496 HINSTANCE
get_shdoclc(void);
1497 void set_statustext(HTMLDocumentObj
*,INT
,LPCWSTR
);
1498 IInternetSecurityManager
*get_security_manager(void);
1500 extern HINSTANCE hInst
;
1501 void create_console(compat_mode_t compat_mode
, IWineMSHTMLConsole
**ret
);
1502 HRESULT
create_media_query_list(HTMLWindow
*window
, BSTR media_query
, IDispatch
**ret
);
1504 HRESULT
create_mutation_observer_ctor(compat_mode_t compat_mode
, IDispatch
**ret
);