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
29 #include "wine/list.h"
30 #include "wine/unicode.h"
38 #define NS_ERROR_GENERATE_FAILURE(module,code) \
39 ((nsresult) (((PRUint32)(1<<31)) | ((PRUint32)(module+0x45)<<16) | ((PRUint32)(code))))
41 #define NS_OK ((nsresult)0x00000000L)
42 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
43 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
44 #define NS_NOINTERFACE ((nsresult)0x80004002L)
45 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
46 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
47 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
48 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
50 #define NS_ERROR_MODULE_NETWORK 6
52 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
53 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
55 #define NS_FAILED(res) ((res) & 0x80000000)
56 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
60 #define MSHTML_E_NODOC 0x800a025c
62 typedef struct HTMLDOMNode HTMLDOMNode
;
63 typedef struct ConnectionPoint ConnectionPoint
;
64 typedef struct BSCallback BSCallback
;
65 typedef struct event_target_t event_target_t
;
69 XDIID(DispCEventObj) \
71 XDIID(DispDOMChildrenCollection) \
72 XDIID(DispHTMLAnchorElement) \
74 XDIID(DispHTMLCommentElement) \
75 XDIID(DispHTMLCurrentStyle) \
76 XDIID(DispHTMLDocument) \
77 XDIID(DispHTMLDOMAttribute) \
78 XDIID(DispHTMLDOMTextNode) \
79 XDIID(DispHTMLElementCollection) \
80 XDIID(DispHTMLEmbed) \
81 XDIID(DispHTMLFormElement) \
82 XDIID(DispHTMLGenericElement) \
83 XDIID(DispHTMLFrameElement) \
84 XDIID(DispHTMLIFrame) \
86 XDIID(DispHTMLInputElement) \
87 XDIID(DispHTMLLocation) \
88 XDIID(DispHTMLNavigator) \
89 XDIID(DispHTMLObjectElement) \
90 XDIID(DispHTMLOptionElement) \
91 XDIID(DispHTMLScreen) \
92 XDIID(DispHTMLScriptElement) \
93 XDIID(DispHTMLSelectElement) \
94 XDIID(DispHTMLStyle) \
95 XDIID(DispHTMLStyleElement) \
96 XDIID(DispHTMLStyleSheetsCollection) \
97 XDIID(DispHTMLTable) \
98 XDIID(DispHTMLTableRow) \
99 XDIID(DispHTMLTextAreaElement) \
100 XDIID(DispHTMLUnknownElement) \
101 XDIID(DispHTMLWindow2) \
102 XDIID(HTMLDocumentEvents) \
103 XIID(IHTMLAnchorElement) \
104 XIID(IHTMLBodyElement) \
105 XIID(IHTMLBodyElement2) \
106 XIID(IHTMLCommentElement) \
107 XIID(IHTMLCurrentStyle) \
108 XIID(IHTMLCurrentStyle2) \
109 XIID(IHTMLCurrentStyle3) \
110 XIID(IHTMLCurrentStyle4) \
111 XIID(IHTMLDocument2) \
112 XIID(IHTMLDocument3) \
113 XIID(IHTMLDocument4) \
114 XIID(IHTMLDocument5) \
115 XIID(IHTMLDOMAttribute) \
116 XIID(IHTMLDOMChildrenCollection) \
118 XIID(IHTMLDOMNode2) \
119 XIID(IHTMLDOMTextNode) \
121 XIID(IHTMLElement2) \
122 XIID(IHTMLElement3) \
123 XIID(IHTMLElement4) \
124 XIID(IHTMLElementCollection) \
125 XIID(IHTMLEmbedElement) \
126 XIID(IHTMLEventObj) \
127 XIID(IHTMLFiltersCollection) \
128 XIID(IHTMLFormElement) \
129 XIID(IHTMLFrameBase) \
130 XIID(IHTMLFrameBase2) \
131 XIID(IHTMLFrameElement3) \
132 XIID(IHTMLGenericElement) \
133 XIID(IHTMLIFrameElement) \
134 XIID(IHTMLImageElementFactory) \
135 XIID(IHTMLImgElement) \
136 XIID(IHTMLInputElement) \
137 XIID(IHTMLLocation) \
138 XIID(IHTMLObjectElement) \
139 XIID(IHTMLOptionElement) \
140 XIID(IHTMLPluginsCollection) \
143 XIID(IHTMLScriptElement) \
144 XIID(IHTMLSelectElement) \
149 XIID(IHTMLStyleElement) \
150 XIID(IHTMLStyleSheetsCollection) \
152 XIID(IHTMLTableRow) \
153 XIID(IHTMLTextAreaElement) \
154 XIID(IHTMLTextContainer) \
155 XIID(IHTMLUniqueName) \
162 #define XIID(iface) iface ## _tid,
163 #define XDIID(iface) iface ## _tid,
170 typedef struct dispex_data_t dispex_data_t
;
171 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
173 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
174 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
175 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
177 typedef struct DispatchEx DispatchEx
;
180 HRESULT (*value
)(DispatchEx
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
181 HRESULT (*get_dispid
)(DispatchEx
*,BSTR
,DWORD
,DISPID
*);
182 HRESULT (*invoke
)(DispatchEx
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
183 } dispex_static_data_vtbl_t
;
186 const dispex_static_data_vtbl_t
*vtbl
;
187 const tid_t disp_tid
;
189 const tid_t
* const iface_tids
;
190 } dispex_static_data_t
;
193 IDispatchEx IDispatchEx_iface
;
197 dispex_static_data_t
*data
;
198 dispex_dynamic_data_t
*dynamic_data
;
201 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
202 void release_dispex(DispatchEx
*);
203 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
204 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
205 HRESULT
get_dispids(tid_t
,DWORD
*,DISPID
**);
206 HRESULT
remove_prop(DispatchEx
*,BSTR
,VARIANT_BOOL
*);
207 void release_typelib(void);
209 typedef struct HTMLWindow HTMLWindow
;
210 typedef struct HTMLDocumentNode HTMLDocumentNode
;
211 typedef struct HTMLDocumentObj HTMLDocumentObj
;
212 typedef struct HTMLFrameBase HTMLFrameBase
;
213 typedef struct NSContainer NSContainer
;
217 SCRIPTMODE_ACTIVESCRIPT
220 typedef struct ScriptHost ScriptHost
;
225 } global_prop_type_t
;
228 global_prop_type_t type
;
230 ScriptHost
*script_host
;
235 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface
;
240 } HTMLOptionElementFactory
;
244 IHTMLImageElementFactory IHTMLImageElementFactory_iface
;
249 } HTMLImageElementFactory
;
251 struct HTMLLocation
{
253 IHTMLLocation IHTMLLocation_iface
;
265 typedef struct nsChannelBSC nsChannelBSC
;
269 IHTMLWindow2 IHTMLWindow2_iface
;
270 IHTMLWindow3 IHTMLWindow3_iface
;
271 IHTMLWindow4 IHTMLWindow4_iface
;
272 IHTMLPrivateWindow IHTMLPrivateWindow_iface
;
273 IDispatchEx IDispatchEx_iface
;
274 IServiceProvider IServiceProvider_iface
;
278 windowref_t
*window_ref
;
281 HTMLDocumentNode
*doc
;
282 HTMLDocumentObj
*doc_obj
;
283 nsIDOMWindow
*nswindow
;
285 HTMLFrameBase
*frame_element
;
286 READYSTATE readystate
;
288 nsChannelBSC
*bscallback
;
292 IHTMLEventObj
*event
;
294 SCRIPTMODE scriptmode
;
295 struct list script_hosts
;
297 HTMLOptionElementFactory
*option_factory
;
298 HTMLImageElementFactory
*image_factory
;
299 HTMLLocation
*location
;
302 global_prop_t
*global_props
;
303 DWORD global_prop_cnt
;
304 DWORD global_prop_size
;
306 struct list children
;
307 struct list sibling_entry
;
317 typedef struct _cp_static_data_t
{
319 void (*on_advise
)(IUnknown
*,struct _cp_static_data_t
*);
324 typedef struct ConnectionPointContainer
{
325 IConnectionPointContainer IConnectionPointContainer_iface
;
327 ConnectionPoint
*cp_list
;
329 struct ConnectionPointContainer
*forward_container
;
330 } ConnectionPointContainer
;
332 struct ConnectionPoint
{
333 IConnectionPoint IConnectionPoint_iface
;
335 ConnectionPointContainer
*container
;
340 IPropertyNotifySink
*propnotif
;
345 cp_static_data_t
*data
;
347 ConnectionPoint
*next
;
350 struct HTMLDocument
{
351 IHTMLDocument2 IHTMLDocument2_iface
;
352 IHTMLDocument3 IHTMLDocument3_iface
;
353 IHTMLDocument4 IHTMLDocument4_iface
;
354 IHTMLDocument5 IHTMLDocument5_iface
;
355 IHTMLDocument6 IHTMLDocument6_iface
;
356 IPersistMoniker IPersistMoniker_iface
;
357 IPersistFile IPersistFile_iface
;
358 IPersistHistory IPersistHistory_iface
;
359 IMonikerProp IMonikerProp_iface
;
360 IOleObject IOleObject_iface
;
361 IOleDocument IOleDocument_iface
;
362 IOleDocumentView IOleDocumentView_iface
;
363 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface
;
364 IViewObjectEx IViewObjectEx_iface
;
365 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface
;
366 IServiceProvider IServiceProvider_iface
;
367 IOleCommandTarget IOleCommandTarget_iface
;
368 IOleControl IOleControl_iface
;
369 IHlinkTarget IHlinkTarget_iface
;
370 IPersistStreamInit IPersistStreamInit_iface
;
371 IDispatchEx IDispatchEx_iface
;
372 ISupportErrorInfo ISupportErrorInfo_iface
;
373 IObjectWithSite IObjectWithSite_iface
;
374 IOleContainer IOleContainer_iface
;
375 IObjectSafety IObjectSafety_iface
;
380 HTMLDocumentObj
*doc_obj
;
381 HTMLDocumentNode
*doc_node
;
387 ConnectionPointContainer cp_container
;
388 ConnectionPoint cp_htmldocevents
;
389 ConnectionPoint cp_htmldocevents2
;
390 ConnectionPoint cp_propnotif
;
391 ConnectionPoint cp_dispatch
;
393 IOleAdviseHolder
*advise_holder
;
396 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
398 return IUnknown_QueryInterface(This
->unk_impl
, riid
, ppv
);
401 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
403 return IUnknown_AddRef(This
->unk_impl
);
406 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
408 return IUnknown_Release(This
->unk_impl
);
411 struct HTMLDocumentObj
{
412 HTMLDocument basedoc
;
414 ICustomDoc ICustomDoc_iface
;
418 NSContainer
*nscontainer
;
420 IOleClientSite
*client
;
421 IDocHostUIHandler
*hostui
;
423 IOleInPlaceSite
*ipsite
;
424 IOleInPlaceFrame
*frame
;
425 IOleInPlaceUIWindow
*ip_window
;
426 IAdviseSink
*view_sink
;
428 DOCHOSTUIINFO hostinfo
;
430 IOleUndoManager
*undomgr
;
435 BOOL request_uiactivate
;
436 BOOL in_place_active
;
440 BOOL container_locked
;
451 nsIWebBrowserChrome nsIWebBrowserChrome_iface
;
452 nsIContextMenuListener nsIContextMenuListener_iface
;
453 nsIURIContentListener nsIURIContentListener_iface
;
454 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface
;
455 nsITooltipListener nsITooltipListener_iface
;
456 nsIInterfaceRequestor nsIInterfaceRequestor_iface
;
457 nsIWeakReference nsIWeakReference_iface
;
458 nsISupportsWeakReference nsISupportsWeakReference_iface
;
460 nsIWebBrowser
*webbrowser
;
461 nsIWebNavigation
*navigation
;
462 nsIBaseWindow
*window
;
463 nsIWebBrowserFocus
*focus
;
466 nsIController
*editor_controller
;
471 HTMLDocumentObj
*doc
;
473 nsIURIContentListener
*content_listener
;
478 typedef struct nsWineURI nsWineURI
;
480 HRESULT
set_wine_url(nsWineURI
*,LPCWSTR
);
481 nsresult
on_start_uri_open(NSContainer
*,nsIURI
*,PRBool
*);
483 /* Keep sync with request_method_strings in nsio.c */
491 nsIHttpChannel nsIHttpChannel_iface
;
492 nsIUploadChannel nsIUploadChannel_iface
;
493 nsIHttpChannelInternal nsIHttpChannelInternal_iface
;
498 nsIInputStream
*post_data_stream
;
499 nsILoadGroup
*load_group
;
500 nsIInterfaceRequestor
*notif_callback
;
502 nsLoadFlags load_flags
;
503 nsIURI
*original_uri
;
507 PRUint32 response_status
;
508 REQUEST_METHOD request_method
;
509 struct list response_headers
;
510 struct list request_headers
;
520 HRESULT
set_http_header(struct list
*,const WCHAR
*,int,const WCHAR
*,int);
523 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
524 void (*destructor
)(HTMLDOMNode
*);
525 HRESULT (*clone
)(HTMLDOMNode
*,nsIDOMNode
*,HTMLDOMNode
**);
526 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
527 HRESULT (*call_event
)(HTMLDOMNode
*,DWORD
,BOOL
*);
528 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
529 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
530 HRESULT (*get_document
)(HTMLDOMNode
*,IDispatch
**);
531 HRESULT (*get_readystate
)(HTMLDOMNode
*,BSTR
*);
532 HRESULT (*get_dispid
)(HTMLDOMNode
*,BSTR
,DWORD
,DISPID
*);
533 HRESULT (*invoke
)(HTMLDOMNode
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
534 HRESULT (*bind_to_tree
)(HTMLDOMNode
*);
539 IHTMLDOMNode IHTMLDOMNode_iface
;
540 IHTMLDOMNode2 IHTMLDOMNode2_iface
;
541 const NodeImplVtbl
*vtbl
;
546 HTMLDocumentNode
*doc
;
547 event_target_t
*event_target
;
548 ConnectionPointContainer
*cp_container
;
555 ConnectionPointContainer cp_container
;
557 IHTMLElement IHTMLElement_iface
;
558 IHTMLElement2 IHTMLElement2_iface
;
559 IHTMLElement3 IHTMLElement3_iface
;
560 IHTMLElement4 IHTMLElement4_iface
;
562 nsIDOMHTMLElement
*nselem
;
567 #define HTMLELEMENT_TIDS \
578 IHTMLTextContainer IHTMLTextContainer_iface
;
583 struct HTMLFrameBase
{
586 IHTMLFrameBase IHTMLFrameBase_iface
;
587 IHTMLFrameBase2 IHTMLFrameBase2_iface
;
589 HTMLWindow
*content_window
;
591 nsIDOMHTMLFrameElement
*nsframe
;
592 nsIDOMHTMLIFrameElement
*nsiframe
;
595 typedef struct nsDocumentEventListener nsDocumentEventListener
;
597 struct HTMLDocumentNode
{
599 HTMLDocument basedoc
;
601 IInternetHostSecurityManager IInternetHostSecurityManager_iface
;
603 nsIDocumentObserver nsIDocumentObserver_iface
;
607 nsIDOMHTMLDocument
*nsdoc
;
610 event_target_t
*body_event_target
;
612 IInternetSecurityManager
*secmgr
;
613 ICatInformation
*catmgr
;
614 nsDocumentEventListener
*nsevent_listener
;
617 BOOL skip_mutation_notif
;
619 struct list bindings
;
620 struct list selection_list
;
621 struct list range_list
;
622 struct list plugin_hosts
;
625 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
626 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
627 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocumentObj
*,HTMLWindow
*,HTMLDocumentNode
**);
628 HRESULT
create_document_fragment(nsIDOMNode
*,HTMLDocumentNode
*,HTMLDocumentNode
**);
630 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*,nsIDOMWindow
*,HTMLWindow
*,HTMLWindow
**);
631 void update_window_doc(HTMLWindow
*);
632 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
633 nsIDOMWindow
*get_nsdoc_window(nsIDOMDocument
*);
634 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
635 HTMLImageElementFactory
*HTMLImageElementFactory_Create(HTMLWindow
*);
636 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
637 IOmNavigator
*OmNavigator_Create(void);
638 HRESULT
HTMLScreen_Create(IHTMLScreen
**);
640 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
641 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
642 void HTMLDocument_Persist_Init(HTMLDocument
*);
643 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
644 void HTMLDocument_OleObj_Init(HTMLDocument
*);
645 void HTMLDocument_View_Init(HTMLDocument
*);
646 void HTMLDocument_Window_Init(HTMLDocument
*);
647 void HTMLDocument_Service_Init(HTMLDocument
*);
648 void HTMLDocument_Hlink_Init(HTMLDocument
*);
650 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
652 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
654 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
,cp_static_data_t
*);
655 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
656 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
658 NSContainer
*NSContainer_Create(HTMLDocumentObj
*,NSContainer
*);
659 void NSContainer_Release(NSContainer
*);
660 nsresult
create_chrome_window(nsIWebBrowserChrome
*,nsIWebBrowserChrome
**);
662 void init_mutation(HTMLDocumentNode
*);
663 void release_mutation(HTMLDocumentNode
*);
665 void HTMLDocument_LockContainer(HTMLDocumentObj
*,BOOL
);
666 void show_context_menu(HTMLDocumentObj
*,DWORD
,POINT
*,IDispatch
*);
667 void notif_focus(HTMLDocumentObj
*);
669 void show_tooltip(HTMLDocumentObj
*,DWORD
,DWORD
,LPCWSTR
);
670 void hide_tooltip(HTMLDocumentObj
*);
671 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
673 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
675 BOOL
load_gecko(BOOL
);
676 void close_gecko(void);
677 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
678 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
679 void release_nsio(void);
680 BOOL
is_gecko_path(const char*);
682 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
683 HRESULT
create_doc_uri(HTMLWindow
*,WCHAR
*,nsWineURI
**);
684 HRESULT
load_nsuri(HTMLWindow
*,nsWineURI
*,nsChannelBSC
*,DWORD
);
686 HRESULT
hlink_frame_navigate(HTMLDocument
*,LPCWSTR
,nsIInputStream
*,DWORD
,BOOL
*);
687 HRESULT
navigate_url(HTMLWindow
*,const WCHAR
*,const WCHAR
*);
688 HRESULT
set_frame_doc(HTMLFrameBase
*,nsIDOMDocument
*);
689 HRESULT
set_moniker(HTMLDocument
*,IMoniker
*,IBindCtx
*,nsChannelBSC
*,BOOL
);
691 void call_property_onchanged(ConnectionPoint
*,DISPID
);
692 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
694 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
697 void nsACString_InitDepend(nsACString
*,const char*);
698 void nsACString_SetData(nsACString
*,const char*);
699 PRUint32
nsACString_GetData(const nsACString
*,const char**);
700 void nsACString_Finish(nsACString
*);
702 BOOL
nsAString_Init(nsAString
*,const PRUnichar
*);
703 void nsAString_InitDepend(nsAString
*,const PRUnichar
*);
704 void nsAString_SetData(nsAString
*,const PRUnichar
*);
705 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
706 void nsAString_Finish(nsAString
*);
707 HRESULT
return_nsstr(nsresult
,nsAString
*,BSTR
*);
709 nsICommandParams
*create_nscommand_params(void);
710 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
711 void get_editor_controller(NSContainer
*);
712 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
714 void init_nsevents(HTMLDocumentNode
*);
715 void release_nsevents(HTMLDocumentNode
*);
716 void add_nsevent_listener(HTMLDocumentNode
*,nsIDOMNode
*,LPCWSTR
);
718 void set_window_bscallback(HTMLWindow
*,nsChannelBSC
*);
719 void set_current_mon(HTMLWindow
*,IMoniker
*);
720 HRESULT
start_binding(HTMLWindow
*,HTMLDocumentNode
*,BSCallback
*,IBindCtx
*);
721 HRESULT
async_start_doc_binding(HTMLWindow
*,nsChannelBSC
*);
722 void abort_document_bindings(HTMLDocumentNode
*);
724 HRESULT
bind_mon_to_buffer(HTMLDocumentNode
*,IMoniker
*,void**,DWORD
*);
726 HRESULT
create_channelbsc(IMoniker
*,WCHAR
*,BYTE
*,DWORD
,nsChannelBSC
**);
727 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
728 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
729 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
731 void set_ready_state(HTMLWindow
*,READYSTATE
);
733 HRESULT
HTMLSelectionObject_Create(HTMLDocumentNode
*,nsISelection
*,IHTMLSelectionObject
**);
734 HRESULT
HTMLTxtRange_Create(HTMLDocumentNode
*,nsIDOMRange
*,IHTMLTxtRange
**);
735 HRESULT
HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*,HTMLStyle
**);
736 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
737 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
739 void detach_selection(HTMLDocumentNode
*);
740 void detach_ranges(HTMLDocumentNode
*);
741 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
743 HRESULT
create_nselem(HTMLDocumentNode
*,const WCHAR
*,nsIDOMHTMLElement
**);
745 HRESULT
HTMLDOMTextNode_Create(HTMLDocumentNode
*,nsIDOMNode
*,HTMLDOMNode
**);
749 IHTMLDOMAttribute IHTMLDOMAttribute_iface
;
758 HRESULT
HTMLDOMAttribute_Create(HTMLElement
*,DISPID
,HTMLDOMAttribute
**);
760 HRESULT
HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
,HTMLElement
**);
761 HRESULT
HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,HTMLElement
**);
762 HRESULT
HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
763 HRESULT
HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
764 HRESULT
HTMLEmbedElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
765 HRESULT
HTMLFormElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
766 HRESULT
HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
767 HRESULT
HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
768 HRESULT
HTMLStyleElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
769 HRESULT
HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
770 HRESULT
HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
771 HRESULT
HTMLObjectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
772 HRESULT
HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
773 HRESULT
HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
774 HRESULT
HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
775 HRESULT
HTMLTable_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
776 HRESULT
HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
777 HRESULT
HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
778 HRESULT
HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
780 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*);
781 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
782 void HTMLElement2_Init(HTMLElement
*);
783 void HTMLElement3_Init(HTMLElement
*);
784 void HTMLTextContainer_Init(HTMLTextContainer
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
785 void HTMLFrameBase_Init(HTMLFrameBase
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
787 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
788 void HTMLDOMNode_destructor(HTMLDOMNode
*);
790 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
791 void HTMLElement_destructor(HTMLDOMNode
*);
792 HRESULT
HTMLElement_clone(HTMLDOMNode
*,nsIDOMNode
*,HTMLDOMNode
**);
794 HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*,REFIID
,void**);
795 void HTMLFrameBase_destructor(HTMLFrameBase
*);
797 HRESULT
get_node(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
,HTMLDOMNode
**);
798 void release_nodes(HTMLDocumentNode
*);
800 void release_script_hosts(HTMLWindow
*);
801 void connect_scripts(HTMLWindow
*);
802 void doc_insert_script(HTMLWindow
*,nsIDOMHTMLScriptElement
*);
803 IDispatch
*script_parse_event(HTMLWindow
*,LPCWSTR
);
804 HRESULT
exec_script(HTMLWindow
*,const WCHAR
*,const WCHAR
*,VARIANT
*);
805 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
806 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
807 IDispatch
*get_script_disp(ScriptHost
*);
808 HRESULT
search_window_props(HTMLWindow
*,BSTR
,DWORD
,DISPID
*);
810 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
811 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocumentNode
*,IUnknown
*,nsIDOMNodeList
*);
812 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocumentNode
*,IUnknown
*,nsIDOMHTMLCollection
*);
817 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
818 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
821 extern const cmdtable_t editmode_cmds
[];
823 void do_ns_command(HTMLDocument
*,const char*,nsICommandParams
*);
826 #define UPDATE_UI 0x0001
827 #define UPDATE_TITLE 0x0002
829 void update_doc(HTMLDocument
*,DWORD
);
830 void update_title(HTMLDocumentObj
*);
833 void init_editor(HTMLDocument
*);
834 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
835 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
836 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
837 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
838 void handle_edit_load(HTMLDocument
*);
839 HRESULT
editor_is_dirty(HTMLDocument
*);
840 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
842 extern DWORD mshtml_tls
;
844 typedef struct task_t task_t
;
845 typedef void (*task_proc_t
)(task_t
*);
855 HTMLDocumentObj
*doc
;
860 task_t
*task_queue_head
;
861 task_t
*task_queue_tail
;
862 struct list timer_list
;
865 thread_data_t
*get_thread_data(BOOL
);
866 HWND
get_thread_hwnd(void);
868 LONG
get_task_target_magic(void);
869 void push_task(task_t
*,task_proc_t
,LONG
);
870 void remove_target_tasks(LONG
);
872 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
873 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
875 const char *debugstr_variant(const VARIANT
*);
877 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
878 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
879 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
880 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
881 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
883 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
885 /* memory allocation functions */
887 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
889 return HeapAlloc(GetProcessHeap(), 0, len
);
892 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
894 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
897 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
899 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
902 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
904 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
907 static inline BOOL
heap_free(void *mem
)
909 return HeapFree(GetProcessHeap(), 0, mem
);
912 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
919 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
920 ret
= heap_alloc(size
);
921 memcpy(ret
, str
, size
);
927 static inline LPWSTR
heap_strndupW(LPCWSTR str
, unsigned len
)
932 ret
= heap_alloc((len
+1)*sizeof(WCHAR
));
933 memcpy(ret
, str
, len
*sizeof(WCHAR
));
940 static inline char *heap_strdupA(const char *str
)
947 size
= strlen(str
)+1;
948 ret
= heap_alloc(size
);
949 memcpy(ret
, str
, size
);
955 static inline WCHAR
*heap_strdupAtoW(const char *str
)
962 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
963 ret
= heap_alloc(len
*sizeof(WCHAR
));
964 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
970 static inline char *heap_strdupWtoA(LPCWSTR str
)
975 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
976 ret
= heap_alloc(size
);
977 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
983 static inline void windowref_addref(windowref_t
*ref
)
985 InterlockedIncrement(&ref
->ref
);
988 static inline void windowref_release(windowref_t
*ref
)
990 if(!InterlockedDecrement(&ref
->ref
))
994 HDC
get_display_dc(void);
995 HINSTANCE
get_shdoclc(void);
996 void set_statustext(HTMLDocumentObj
*,INT
,LPCWSTR
);
998 extern HINSTANCE hInst
;