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(DispHTMLDOMTextNode) \
78 XDIID(DispHTMLElementCollection) \
79 XDIID(DispHTMLEmbed) \
80 XDIID(DispHTMLFormElement) \
81 XDIID(DispHTMLGenericElement) \
82 XDIID(DispHTMLFrameElement) \
83 XDIID(DispHTMLIFrame) \
85 XDIID(DispHTMLInputElement) \
86 XDIID(DispHTMLLocation) \
87 XDIID(DispHTMLNavigator) \
88 XDIID(DispHTMLObjectElement) \
89 XDIID(DispHTMLOptionElement) \
90 XDIID(DispHTMLScreen) \
91 XDIID(DispHTMLScriptElement) \
92 XDIID(DispHTMLSelectElement) \
93 XDIID(DispHTMLStyle) \
94 XDIID(DispHTMLStyleElement) \
95 XDIID(DispHTMLStyleSheetsCollection) \
96 XDIID(DispHTMLTable) \
97 XDIID(DispHTMLTableRow) \
98 XDIID(DispHTMLTextAreaElement) \
99 XDIID(DispHTMLUnknownElement) \
100 XDIID(DispHTMLWindow2) \
101 XDIID(HTMLDocumentEvents) \
102 XIID(IHTMLAnchorElement) \
103 XIID(IHTMLBodyElement) \
104 XIID(IHTMLBodyElement2) \
105 XIID(IHTMLCommentElement) \
106 XIID(IHTMLCurrentStyle) \
107 XIID(IHTMLCurrentStyle2) \
108 XIID(IHTMLCurrentStyle3) \
109 XIID(IHTMLCurrentStyle4) \
110 XIID(IHTMLDocument2) \
111 XIID(IHTMLDocument3) \
112 XIID(IHTMLDocument4) \
113 XIID(IHTMLDocument5) \
114 XIID(IHTMLDOMChildrenCollection) \
116 XIID(IHTMLDOMNode2) \
117 XIID(IHTMLDOMTextNode) \
119 XIID(IHTMLElement2) \
120 XIID(IHTMLElement3) \
121 XIID(IHTMLElement4) \
122 XIID(IHTMLElementCollection) \
123 XIID(IHTMLEmbedElement) \
124 XIID(IHTMLEventObj) \
125 XIID(IHTMLFiltersCollection) \
126 XIID(IHTMLFormElement) \
127 XIID(IHTMLFrameBase) \
128 XIID(IHTMLFrameBase2) \
129 XIID(IHTMLFrameElement3) \
130 XIID(IHTMLGenericElement) \
131 XIID(IHTMLIFrameElement) \
132 XIID(IHTMLImageElementFactory) \
133 XIID(IHTMLImgElement) \
134 XIID(IHTMLInputElement) \
135 XIID(IHTMLLocation) \
136 XIID(IHTMLObjectElement) \
137 XIID(IHTMLOptionElement) \
138 XIID(IHTMLPluginsCollection) \
141 XIID(IHTMLScriptElement) \
142 XIID(IHTMLSelectElement) \
147 XIID(IHTMLStyleElement) \
148 XIID(IHTMLStyleSheetsCollection) \
150 XIID(IHTMLTableRow) \
151 XIID(IHTMLTextAreaElement) \
152 XIID(IHTMLTextContainer) \
153 XIID(IHTMLUniqueName) \
160 #define XIID(iface) iface ## _tid,
161 #define XDIID(iface) iface ## _tid,
168 typedef struct dispex_data_t dispex_data_t
;
169 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
171 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
172 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
173 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
175 typedef struct DispatchEx DispatchEx
;
178 HRESULT (*value
)(DispatchEx
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
179 HRESULT (*get_dispid
)(DispatchEx
*,BSTR
,DWORD
,DISPID
*);
180 HRESULT (*invoke
)(DispatchEx
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
181 } dispex_static_data_vtbl_t
;
184 const dispex_static_data_vtbl_t
*vtbl
;
185 const tid_t disp_tid
;
187 const tid_t
* const iface_tids
;
188 } dispex_static_data_t
;
191 IDispatchEx IDispatchEx_iface
;
195 dispex_static_data_t
*data
;
196 dispex_dynamic_data_t
*dynamic_data
;
199 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
200 void release_dispex(DispatchEx
*);
201 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
202 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
203 HRESULT
get_dispids(tid_t
,DWORD
*,DISPID
**);
204 HRESULT
remove_prop(DispatchEx
*,BSTR
,VARIANT_BOOL
*);
206 typedef struct HTMLWindow HTMLWindow
;
207 typedef struct HTMLDocumentNode HTMLDocumentNode
;
208 typedef struct HTMLDocumentObj HTMLDocumentObj
;
209 typedef struct HTMLFrameBase HTMLFrameBase
;
210 typedef struct NSContainer NSContainer
;
214 SCRIPTMODE_ACTIVESCRIPT
217 typedef struct ScriptHost ScriptHost
;
222 } global_prop_type_t
;
225 global_prop_type_t type
;
227 ScriptHost
*script_host
;
232 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface
;
237 } HTMLOptionElementFactory
;
241 IHTMLImageElementFactory IHTMLImageElementFactory_iface
;
246 } HTMLImageElementFactory
;
248 struct HTMLLocation
{
250 IHTMLLocation IHTMLLocation_iface
;
262 typedef struct nsChannelBSC nsChannelBSC
;
266 IHTMLWindow2 IHTMLWindow2_iface
;
267 IHTMLWindow3 IHTMLWindow3_iface
;
268 IHTMLWindow4 IHTMLWindow4_iface
;
269 IHTMLPrivateWindow IHTMLPrivateWindow_iface
;
270 IDispatchEx IDispatchEx_iface
;
271 IServiceProvider IServiceProvider_iface
;
275 windowref_t
*window_ref
;
278 HTMLDocumentNode
*doc
;
279 HTMLDocumentObj
*doc_obj
;
280 nsIDOMWindow
*nswindow
;
282 HTMLFrameBase
*frame_element
;
283 READYSTATE readystate
;
285 nsChannelBSC
*bscallback
;
289 IHTMLEventObj
*event
;
291 SCRIPTMODE scriptmode
;
292 struct list script_hosts
;
294 HTMLOptionElementFactory
*option_factory
;
295 HTMLImageElementFactory
*image_factory
;
296 HTMLLocation
*location
;
299 global_prop_t
*global_props
;
300 DWORD global_prop_cnt
;
301 DWORD global_prop_size
;
303 struct list children
;
304 struct list sibling_entry
;
314 typedef struct _cp_static_data_t
{
316 void (*on_advise
)(IUnknown
*,struct _cp_static_data_t
*);
321 typedef struct ConnectionPointContainer
{
322 IConnectionPointContainer IConnectionPointContainer_iface
;
324 ConnectionPoint
*cp_list
;
326 struct ConnectionPointContainer
*forward_container
;
327 } ConnectionPointContainer
;
329 struct ConnectionPoint
{
330 IConnectionPoint IConnectionPoint_iface
;
332 ConnectionPointContainer
*container
;
337 IPropertyNotifySink
*propnotif
;
342 cp_static_data_t
*data
;
344 ConnectionPoint
*next
;
347 struct HTMLDocument
{
348 IHTMLDocument2 IHTMLDocument2_iface
;
349 IHTMLDocument3 IHTMLDocument3_iface
;
350 IHTMLDocument4 IHTMLDocument4_iface
;
351 IHTMLDocument5 IHTMLDocument5_iface
;
352 IHTMLDocument6 IHTMLDocument6_iface
;
353 IPersistMoniker IPersistMoniker_iface
;
354 IPersistFile IPersistFile_iface
;
355 IPersistHistory IPersistHistory_iface
;
356 IMonikerProp IMonikerProp_iface
;
357 IOleObject IOleObject_iface
;
358 IOleDocument IOleDocument_iface
;
359 IOleDocumentView IOleDocumentView_iface
;
360 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface
;
361 IViewObjectEx IViewObjectEx_iface
;
362 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface
;
363 IServiceProvider IServiceProvider_iface
;
364 IOleCommandTarget IOleCommandTarget_iface
;
365 IOleControl IOleControl_iface
;
366 IHlinkTarget IHlinkTarget_iface
;
367 IPersistStreamInit IPersistStreamInit_iface
;
368 IDispatchEx IDispatchEx_iface
;
369 ISupportErrorInfo ISupportErrorInfo_iface
;
370 IObjectWithSite IObjectWithSite_iface
;
371 IOleContainer IOleContainer_iface
;
372 IObjectSafety IObjectSafety_iface
;
377 HTMLDocumentObj
*doc_obj
;
378 HTMLDocumentNode
*doc_node
;
384 ConnectionPointContainer cp_container
;
385 ConnectionPoint cp_htmldocevents
;
386 ConnectionPoint cp_htmldocevents2
;
387 ConnectionPoint cp_propnotif
;
388 ConnectionPoint cp_dispatch
;
390 IOleAdviseHolder
*advise_holder
;
393 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
395 return IUnknown_QueryInterface(This
->unk_impl
, riid
, ppv
);
398 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
400 return IUnknown_AddRef(This
->unk_impl
);
403 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
405 return IUnknown_Release(This
->unk_impl
);
408 struct HTMLDocumentObj
{
409 HTMLDocument basedoc
;
411 ICustomDoc ICustomDoc_iface
;
415 NSContainer
*nscontainer
;
417 IOleClientSite
*client
;
418 IDocHostUIHandler
*hostui
;
420 IOleInPlaceSite
*ipsite
;
421 IOleInPlaceFrame
*frame
;
422 IOleInPlaceUIWindow
*ip_window
;
423 IAdviseSink
*view_sink
;
425 DOCHOSTUIINFO hostinfo
;
427 IOleUndoManager
*undomgr
;
432 BOOL request_uiactivate
;
433 BOOL in_place_active
;
437 BOOL container_locked
;
448 nsIWebBrowserChrome nsIWebBrowserChrome_iface
;
449 nsIContextMenuListener nsIContextMenuListener_iface
;
450 nsIURIContentListener nsIURIContentListener_iface
;
451 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface
;
452 nsITooltipListener nsITooltipListener_iface
;
453 nsIInterfaceRequestor nsIInterfaceRequestor_iface
;
454 nsIWeakReference nsIWeakReference_iface
;
455 nsISupportsWeakReference nsISupportsWeakReference_iface
;
457 nsIWebBrowser
*webbrowser
;
458 nsIWebNavigation
*navigation
;
459 nsIBaseWindow
*window
;
460 nsIWebBrowserFocus
*focus
;
463 nsIController
*editor_controller
;
468 HTMLDocumentObj
*doc
;
470 nsIURIContentListener
*content_listener
;
475 typedef struct nsWineURI nsWineURI
;
477 HRESULT
set_wine_url(nsWineURI
*,LPCWSTR
);
478 nsresult
on_start_uri_open(NSContainer
*,nsIURI
*,PRBool
*);
480 /* Keep sync with request_method_strings in nsio.c */
488 nsIHttpChannel nsIHttpChannel_iface
;
489 nsIUploadChannel nsIUploadChannel_iface
;
490 nsIHttpChannelInternal nsIHttpChannelInternal_iface
;
495 nsIInputStream
*post_data_stream
;
496 nsILoadGroup
*load_group
;
497 nsIInterfaceRequestor
*notif_callback
;
499 nsLoadFlags load_flags
;
500 nsIURI
*original_uri
;
504 PRUint32 response_status
;
505 REQUEST_METHOD request_method
;
506 struct list response_headers
;
507 struct list request_headers
;
517 HRESULT
set_http_header(struct list
*,const WCHAR
*,int,const WCHAR
*,int);
520 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
521 void (*destructor
)(HTMLDOMNode
*);
522 HRESULT (*clone
)(HTMLDOMNode
*,nsIDOMNode
*,HTMLDOMNode
**);
523 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
524 HRESULT (*call_event
)(HTMLDOMNode
*,DWORD
,BOOL
*);
525 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
526 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
527 HRESULT (*get_document
)(HTMLDOMNode
*,IDispatch
**);
528 HRESULT (*get_readystate
)(HTMLDOMNode
*,BSTR
*);
529 HRESULT (*get_dispid
)(HTMLDOMNode
*,BSTR
,DWORD
,DISPID
*);
530 HRESULT (*invoke
)(HTMLDOMNode
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
531 HRESULT (*bind_to_tree
)(HTMLDOMNode
*);
536 IHTMLDOMNode IHTMLDOMNode_iface
;
537 IHTMLDOMNode2 IHTMLDOMNode2_iface
;
538 const NodeImplVtbl
*vtbl
;
543 HTMLDocumentNode
*doc
;
544 event_target_t
*event_target
;
545 ConnectionPointContainer
*cp_container
;
552 ConnectionPointContainer cp_container
;
554 IHTMLElement IHTMLElement_iface
;
555 IHTMLElement2 IHTMLElement2_iface
;
556 IHTMLElement3 IHTMLElement3_iface
;
558 nsIDOMHTMLElement
*nselem
;
561 #define HTMLELEMENT_TIDS \
572 IHTMLTextContainer IHTMLTextContainer_iface
;
577 struct HTMLFrameBase
{
580 IHTMLFrameBase IHTMLFrameBase_iface
;
581 IHTMLFrameBase2 IHTMLFrameBase2_iface
;
583 HTMLWindow
*content_window
;
585 nsIDOMHTMLFrameElement
*nsframe
;
586 nsIDOMHTMLIFrameElement
*nsiframe
;
589 typedef struct _mutation_queue_t
{
591 nsISupports
*nsiface
;
593 struct _mutation_queue_t
*next
;
596 typedef struct nsDocumentEventListener nsDocumentEventListener
;
598 struct HTMLDocumentNode
{
600 HTMLDocument basedoc
;
602 IInternetHostSecurityManager IInternetHostSecurityManager_iface
;
604 nsIDocumentObserver nsIDocumentObserver_iface
;
605 nsIRunnable nsIRunnable_iface
;
609 nsIDOMHTMLDocument
*nsdoc
;
612 event_target_t
*body_event_target
;
614 IInternetSecurityManager
*secmgr
;
615 ICatInformation
*catmgr
;
616 nsDocumentEventListener
*nsevent_listener
;
619 BOOL skip_mutation_notif
;
620 mutation_queue_t
*mutation_queue
;
621 mutation_queue_t
*mutation_queue_tail
;
623 struct list bindings
;
624 struct list selection_list
;
625 struct list range_list
;
626 struct list plugin_hosts
;
629 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
630 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
631 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocumentObj
*,HTMLWindow
*,HTMLDocumentNode
**);
632 HRESULT
create_document_fragment(nsIDOMNode
*,HTMLDocumentNode
*,HTMLDocumentNode
**);
634 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*,nsIDOMWindow
*,HTMLWindow
*,HTMLWindow
**);
635 void update_window_doc(HTMLWindow
*);
636 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
637 nsIDOMWindow
*get_nsdoc_window(nsIDOMDocument
*);
638 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
639 HTMLImageElementFactory
*HTMLImageElementFactory_Create(HTMLWindow
*);
640 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
641 IOmNavigator
*OmNavigator_Create(void);
642 HRESULT
HTMLScreen_Create(IHTMLScreen
**);
644 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
645 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
646 void HTMLDocument_Persist_Init(HTMLDocument
*);
647 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
648 void HTMLDocument_OleObj_Init(HTMLDocument
*);
649 void HTMLDocument_View_Init(HTMLDocument
*);
650 void HTMLDocument_Window_Init(HTMLDocument
*);
651 void HTMLDocument_Service_Init(HTMLDocument
*);
652 void HTMLDocument_Hlink_Init(HTMLDocument
*);
654 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
656 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
658 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
,cp_static_data_t
*);
659 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
660 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
662 NSContainer
*NSContainer_Create(HTMLDocumentObj
*,NSContainer
*);
663 void NSContainer_Release(NSContainer
*);
664 nsresult
create_chrome_window(nsIWebBrowserChrome
*,nsIWebBrowserChrome
**);
666 void init_mutation(HTMLDocumentNode
*);
667 void release_mutation(HTMLDocumentNode
*);
669 void HTMLDocument_LockContainer(HTMLDocumentObj
*,BOOL
);
670 void show_context_menu(HTMLDocumentObj
*,DWORD
,POINT
*,IDispatch
*);
671 void notif_focus(HTMLDocumentObj
*);
673 void show_tooltip(HTMLDocumentObj
*,DWORD
,DWORD
,LPCWSTR
);
674 void hide_tooltip(HTMLDocumentObj
*);
675 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
677 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
679 BOOL
load_gecko(BOOL
);
680 void close_gecko(void);
681 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
682 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
683 void release_nsio(void);
684 BOOL
is_gecko_path(const char*);
686 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
687 HRESULT
create_doc_uri(HTMLWindow
*,WCHAR
*,nsWineURI
**);
688 HRESULT
load_nsuri(HTMLWindow
*,nsWineURI
*,nsChannelBSC
*,DWORD
);
690 HRESULT
hlink_frame_navigate(HTMLDocument
*,LPCWSTR
,nsIInputStream
*,DWORD
,BOOL
*);
691 HRESULT
navigate_url(HTMLWindow
*,const WCHAR
*,const WCHAR
*);
692 HRESULT
set_frame_doc(HTMLFrameBase
*,nsIDOMDocument
*);
693 HRESULT
set_moniker(HTMLDocument
*,IMoniker
*,IBindCtx
*,nsChannelBSC
*,BOOL
);
695 void call_property_onchanged(ConnectionPoint
*,DISPID
);
696 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
698 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
701 void nsACString_InitDepend(nsACString
*,const char*);
702 void nsACString_SetData(nsACString
*,const char*);
703 PRUint32
nsACString_GetData(const nsACString
*,const char**);
704 void nsACString_Finish(nsACString
*);
706 BOOL
nsAString_Init(nsAString
*,const PRUnichar
*);
707 void nsAString_InitDepend(nsAString
*,const PRUnichar
*);
708 void nsAString_SetData(nsAString
*,const PRUnichar
*);
709 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
710 void nsAString_Finish(nsAString
*);
711 HRESULT
return_nsstr(nsresult
,nsAString
*,BSTR
*);
713 nsICommandParams
*create_nscommand_params(void);
714 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
715 void get_editor_controller(NSContainer
*);
716 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
718 void init_nsevents(HTMLDocumentNode
*);
719 void release_nsevents(HTMLDocumentNode
*);
720 void add_nsevent_listener(HTMLDocumentNode
*,nsIDOMNode
*,LPCWSTR
);
722 void set_window_bscallback(HTMLWindow
*,nsChannelBSC
*);
723 void set_current_mon(HTMLWindow
*,IMoniker
*);
724 HRESULT
start_binding(HTMLWindow
*,HTMLDocumentNode
*,BSCallback
*,IBindCtx
*);
725 HRESULT
async_start_doc_binding(HTMLWindow
*,nsChannelBSC
*);
726 void abort_document_bindings(HTMLDocumentNode
*);
728 HRESULT
bind_mon_to_buffer(HTMLDocumentNode
*,IMoniker
*,void**,DWORD
*);
730 HRESULT
create_channelbsc(IMoniker
*,WCHAR
*,BYTE
*,DWORD
,nsChannelBSC
**);
731 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
732 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
733 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
735 void set_ready_state(HTMLWindow
*,READYSTATE
);
737 HRESULT
HTMLSelectionObject_Create(HTMLDocumentNode
*,nsISelection
*,IHTMLSelectionObject
**);
738 HRESULT
HTMLTxtRange_Create(HTMLDocumentNode
*,nsIDOMRange
*,IHTMLTxtRange
**);
739 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
740 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
741 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
743 void detach_selection(HTMLDocumentNode
*);
744 void detach_ranges(HTMLDocumentNode
*);
745 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
747 HRESULT
create_nselem(HTMLDocumentNode
*,const WCHAR
*,nsIDOMHTMLElement
**);
749 HRESULT
HTMLDOMTextNode_Create(HTMLDocumentNode
*,nsIDOMNode
*,HTMLDOMNode
**);
751 HRESULT
HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
,HTMLElement
**);
752 HRESULT
HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,HTMLElement
**);
753 HRESULT
HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
754 HRESULT
HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
755 HRESULT
HTMLEmbedElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
756 HRESULT
HTMLFormElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
757 HRESULT
HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
758 HRESULT
HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
759 HRESULT
HTMLStyleElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
760 HRESULT
HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
761 HRESULT
HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
762 HRESULT
HTMLObjectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
763 HRESULT
HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
764 HRESULT
HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
765 HRESULT
HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
766 HRESULT
HTMLTable_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
767 HRESULT
HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
768 HRESULT
HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
769 HRESULT
HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
771 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*);
772 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
773 void HTMLElement2_Init(HTMLElement
*);
774 void HTMLElement3_Init(HTMLElement
*);
775 void HTMLTextContainer_Init(HTMLTextContainer
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
776 void HTMLFrameBase_Init(HTMLFrameBase
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
778 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
779 void HTMLDOMNode_destructor(HTMLDOMNode
*);
781 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
782 void HTMLElement_destructor(HTMLDOMNode
*);
783 HRESULT
HTMLElement_clone(HTMLDOMNode
*,nsIDOMNode
*,HTMLDOMNode
**);
785 HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*,REFIID
,void**);
786 void HTMLFrameBase_destructor(HTMLFrameBase
*);
788 HRESULT
get_node(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
,HTMLDOMNode
**);
789 void release_nodes(HTMLDocumentNode
*);
791 void release_script_hosts(HTMLWindow
*);
792 void connect_scripts(HTMLWindow
*);
793 void doc_insert_script(HTMLWindow
*,nsIDOMHTMLScriptElement
*);
794 IDispatch
*script_parse_event(HTMLWindow
*,LPCWSTR
);
795 HRESULT
exec_script(HTMLWindow
*,const WCHAR
*,const WCHAR
*,VARIANT
*);
796 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
797 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
798 IDispatch
*get_script_disp(ScriptHost
*);
799 HRESULT
search_window_props(HTMLWindow
*,BSTR
,DWORD
,DISPID
*);
801 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
802 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocumentNode
*,IUnknown
*,nsIDOMNodeList
*);
803 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocumentNode
*,IUnknown
*,nsIDOMHTMLCollection
*);
808 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
809 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
812 extern const cmdtable_t editmode_cmds
[];
814 void do_ns_command(HTMLDocument
*,const char*,nsICommandParams
*);
817 #define UPDATE_UI 0x0001
818 #define UPDATE_TITLE 0x0002
820 void update_doc(HTMLDocument
*,DWORD
);
821 void update_title(HTMLDocumentObj
*);
824 void init_editor(HTMLDocument
*);
825 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
826 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
827 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
828 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
829 void handle_edit_load(HTMLDocument
*);
830 HRESULT
editor_is_dirty(HTMLDocument
*);
831 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
833 extern DWORD mshtml_tls
;
835 typedef struct task_t task_t
;
836 typedef void (*task_proc_t
)(task_t
*);
846 HTMLDocumentObj
*doc
;
851 task_t
*task_queue_head
;
852 task_t
*task_queue_tail
;
853 struct list timer_list
;
856 thread_data_t
*get_thread_data(BOOL
);
857 HWND
get_thread_hwnd(void);
859 LONG
get_task_target_magic(void);
860 void push_task(task_t
*,task_proc_t
,LONG
);
861 void remove_target_tasks(LONG
);
863 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
864 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
866 void release_typelib(void);
867 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*);
869 const char *debugstr_variant(const VARIANT
*);
871 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
872 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
873 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
874 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
875 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
877 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
879 /* memory allocation functions */
881 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
883 return HeapAlloc(GetProcessHeap(), 0, len
);
886 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
888 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
891 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
893 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
896 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
898 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
901 static inline BOOL
heap_free(void *mem
)
903 return HeapFree(GetProcessHeap(), 0, mem
);
906 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
913 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
914 ret
= heap_alloc(size
);
915 memcpy(ret
, str
, size
);
921 static inline LPWSTR
heap_strndupW(LPCWSTR str
, unsigned len
)
926 ret
= heap_alloc((len
+1)*sizeof(WCHAR
));
927 memcpy(ret
, str
, len
*sizeof(WCHAR
));
934 static inline char *heap_strdupA(const char *str
)
941 size
= strlen(str
)+1;
942 ret
= heap_alloc(size
);
943 memcpy(ret
, str
, size
);
949 static inline WCHAR
*heap_strdupAtoW(const char *str
)
956 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
957 ret
= heap_alloc(len
*sizeof(WCHAR
));
958 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
964 static inline char *heap_strdupWtoA(LPCWSTR str
)
969 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
970 ret
= heap_alloc(size
);
971 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
977 static inline void windowref_addref(windowref_t
*ref
)
979 InterlockedIncrement(&ref
->ref
);
982 static inline void windowref_release(windowref_t
*ref
)
984 if(!InterlockedDecrement(&ref
->ref
))
988 HDC
get_display_dc(void);
989 HINSTANCE
get_shdoclc(void);
990 void set_statustext(HTMLDocumentObj
*,INT
,LPCWSTR
);
992 extern HINSTANCE hInst
;