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"
30 #include "wine/list.h"
31 #include "wine/unicode.h"
39 #define NS_ERROR_GENERATE_FAILURE(module,code) \
40 ((nsresult) (((PRUint32)(1<<31)) | ((PRUint32)(module+0x45)<<16) | ((PRUint32)(code))))
42 #define NS_OK ((nsresult)0x00000000L)
43 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
44 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
45 #define NS_NOINTERFACE ((nsresult)0x80004002L)
46 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
47 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
48 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
49 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
51 #define NS_ERROR_MODULE_NETWORK 6
53 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
54 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
56 #define NS_FAILED(res) ((res) & 0x80000000)
57 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
61 #define MSHTML_E_NODOC 0x800a025c
63 typedef struct HTMLDOMNode HTMLDOMNode
;
64 typedef struct ConnectionPoint ConnectionPoint
;
65 typedef struct BSCallback BSCallback
;
66 typedef struct event_target_t event_target_t
;
70 XDIID(DispCEventObj) \
72 XDIID(DispDOMChildrenCollection) \
73 XDIID(DispHTMLAnchorElement) \
75 XDIID(DispHTMLCommentElement) \
76 XDIID(DispHTMLCurrentStyle) \
77 XDIID(DispHTMLDocument) \
78 XDIID(DispHTMLDOMAttribute) \
79 XDIID(DispHTMLDOMTextNode) \
80 XDIID(DispHTMLElementCollection) \
81 XDIID(DispHTMLEmbed) \
82 XDIID(DispHTMLFormElement) \
83 XDIID(DispHTMLGenericElement) \
84 XDIID(DispHTMLFrameElement) \
85 XDIID(DispHTMLIFrame) \
87 XDIID(DispHTMLInputElement) \
88 XDIID(DispHTMLLocation) \
89 XDIID(DispHTMLNavigator) \
90 XDIID(DispHTMLObjectElement) \
91 XDIID(DispHTMLOptionElement) \
92 XDIID(DispHTMLScreen) \
93 XDIID(DispHTMLScriptElement) \
94 XDIID(DispHTMLSelectElement) \
95 XDIID(DispHTMLStyle) \
96 XDIID(DispHTMLStyleElement) \
97 XDIID(DispHTMLStyleSheetsCollection) \
98 XDIID(DispHTMLTable) \
99 XDIID(DispHTMLTableRow) \
100 XDIID(DispHTMLTextAreaElement) \
101 XDIID(DispHTMLUnknownElement) \
102 XDIID(DispHTMLWindow2) \
103 XDIID(HTMLDocumentEvents) \
104 XIID(IHTMLAnchorElement) \
105 XIID(IHTMLBodyElement) \
106 XIID(IHTMLBodyElement2) \
107 XIID(IHTMLCommentElement) \
108 XIID(IHTMLCurrentStyle) \
109 XIID(IHTMLCurrentStyle2) \
110 XIID(IHTMLCurrentStyle3) \
111 XIID(IHTMLCurrentStyle4) \
112 XIID(IHTMLDocument2) \
113 XIID(IHTMLDocument3) \
114 XIID(IHTMLDocument4) \
115 XIID(IHTMLDocument5) \
116 XIID(IHTMLDOMAttribute) \
117 XIID(IHTMLDOMChildrenCollection) \
119 XIID(IHTMLDOMNode2) \
120 XIID(IHTMLDOMTextNode) \
122 XIID(IHTMLElement2) \
123 XIID(IHTMLElement3) \
124 XIID(IHTMLElement4) \
125 XIID(IHTMLElementCollection) \
126 XIID(IHTMLEmbedElement) \
127 XIID(IHTMLEventObj) \
128 XIID(IHTMLFiltersCollection) \
129 XIID(IHTMLFormElement) \
130 XIID(IHTMLFrameBase) \
131 XIID(IHTMLFrameBase2) \
132 XIID(IHTMLFrameElement3) \
133 XIID(IHTMLGenericElement) \
134 XIID(IHTMLIFrameElement) \
135 XIID(IHTMLImageElementFactory) \
136 XIID(IHTMLImgElement) \
137 XIID(IHTMLInputElement) \
138 XIID(IHTMLLocation) \
139 XIID(IHTMLObjectElement) \
140 XIID(IHTMLOptionElement) \
141 XIID(IHTMLPluginsCollection) \
144 XIID(IHTMLScriptElement) \
145 XIID(IHTMLSelectElement) \
150 XIID(IHTMLStyleElement) \
151 XIID(IHTMLStyleSheetsCollection) \
153 XIID(IHTMLTableRow) \
154 XIID(IHTMLTextAreaElement) \
155 XIID(IHTMLTextContainer) \
156 XIID(IHTMLUniqueName) \
163 #define XIID(iface) iface ## _tid,
164 #define XDIID(iface) iface ## _tid,
171 typedef struct dispex_data_t dispex_data_t
;
172 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
174 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
175 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
176 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
178 typedef struct DispatchEx DispatchEx
;
181 HRESULT (*value
)(DispatchEx
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
182 HRESULT (*get_dispid
)(DispatchEx
*,BSTR
,DWORD
,DISPID
*);
183 HRESULT (*invoke
)(DispatchEx
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
184 } dispex_static_data_vtbl_t
;
187 const dispex_static_data_vtbl_t
*vtbl
;
188 const tid_t disp_tid
;
190 const tid_t
* const iface_tids
;
191 } dispex_static_data_t
;
194 IDispatchEx IDispatchEx_iface
;
198 dispex_static_data_t
*data
;
199 dispex_dynamic_data_t
*dynamic_data
;
202 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
203 void release_dispex(DispatchEx
*);
204 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
205 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
206 HRESULT
get_dispids(tid_t
,DWORD
*,DISPID
**);
207 HRESULT
remove_prop(DispatchEx
*,BSTR
,VARIANT_BOOL
*);
208 void release_typelib(void);
210 typedef struct HTMLWindow HTMLWindow
;
211 typedef struct HTMLDocumentNode HTMLDocumentNode
;
212 typedef struct HTMLDocumentObj HTMLDocumentObj
;
213 typedef struct HTMLFrameBase HTMLFrameBase
;
214 typedef struct NSContainer NSContainer
;
218 SCRIPTMODE_ACTIVESCRIPT
221 typedef struct ScriptHost ScriptHost
;
226 } global_prop_type_t
;
229 global_prop_type_t type
;
231 ScriptHost
*script_host
;
236 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface
;
241 } HTMLOptionElementFactory
;
245 IHTMLImageElementFactory IHTMLImageElementFactory_iface
;
250 } HTMLImageElementFactory
;
252 struct HTMLLocation
{
254 IHTMLLocation IHTMLLocation_iface
;
266 typedef struct nsChannelBSC nsChannelBSC
;
270 IHTMLWindow2 IHTMLWindow2_iface
;
271 IHTMLWindow3 IHTMLWindow3_iface
;
272 IHTMLWindow4 IHTMLWindow4_iface
;
273 IHTMLPrivateWindow IHTMLPrivateWindow_iface
;
274 IDispatchEx IDispatchEx_iface
;
275 IServiceProvider IServiceProvider_iface
;
279 windowref_t
*window_ref
;
282 HTMLDocumentNode
*doc
;
283 HTMLDocumentObj
*doc_obj
;
284 nsIDOMWindow
*nswindow
;
286 HTMLFrameBase
*frame_element
;
287 READYSTATE readystate
;
289 nsChannelBSC
*bscallback
;
293 IHTMLEventObj
*event
;
295 SCRIPTMODE scriptmode
;
296 struct list script_hosts
;
298 IInternetSecurityManager
*secmgr
;
300 HTMLOptionElementFactory
*option_factory
;
301 HTMLImageElementFactory
*image_factory
;
302 HTMLLocation
*location
;
305 global_prop_t
*global_props
;
306 DWORD global_prop_cnt
;
307 DWORD global_prop_size
;
309 struct list children
;
310 struct list sibling_entry
;
320 typedef struct _cp_static_data_t
{
322 void (*on_advise
)(IUnknown
*,struct _cp_static_data_t
*);
327 typedef struct ConnectionPointContainer
{
328 IConnectionPointContainer IConnectionPointContainer_iface
;
330 ConnectionPoint
*cp_list
;
332 struct ConnectionPointContainer
*forward_container
;
333 } ConnectionPointContainer
;
335 struct ConnectionPoint
{
336 IConnectionPoint IConnectionPoint_iface
;
338 ConnectionPointContainer
*container
;
343 IPropertyNotifySink
*propnotif
;
348 cp_static_data_t
*data
;
350 ConnectionPoint
*next
;
353 struct HTMLDocument
{
354 IHTMLDocument2 IHTMLDocument2_iface
;
355 IHTMLDocument3 IHTMLDocument3_iface
;
356 IHTMLDocument4 IHTMLDocument4_iface
;
357 IHTMLDocument5 IHTMLDocument5_iface
;
358 IHTMLDocument6 IHTMLDocument6_iface
;
359 IPersistMoniker IPersistMoniker_iface
;
360 IPersistFile IPersistFile_iface
;
361 IPersistHistory IPersistHistory_iface
;
362 IMonikerProp IMonikerProp_iface
;
363 IOleObject IOleObject_iface
;
364 IOleDocument IOleDocument_iface
;
365 IOleDocumentView IOleDocumentView_iface
;
366 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface
;
367 IViewObjectEx IViewObjectEx_iface
;
368 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface
;
369 IServiceProvider IServiceProvider_iface
;
370 IOleCommandTarget IOleCommandTarget_iface
;
371 IOleControl IOleControl_iface
;
372 IHlinkTarget IHlinkTarget_iface
;
373 IPersistStreamInit IPersistStreamInit_iface
;
374 IDispatchEx IDispatchEx_iface
;
375 ISupportErrorInfo ISupportErrorInfo_iface
;
376 IObjectWithSite IObjectWithSite_iface
;
377 IOleContainer IOleContainer_iface
;
378 IObjectSafety IObjectSafety_iface
;
383 HTMLDocumentObj
*doc_obj
;
384 HTMLDocumentNode
*doc_node
;
390 ConnectionPointContainer cp_container
;
391 ConnectionPoint cp_htmldocevents
;
392 ConnectionPoint cp_htmldocevents2
;
393 ConnectionPoint cp_propnotif
;
394 ConnectionPoint cp_dispatch
;
396 IOleAdviseHolder
*advise_holder
;
399 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
401 return IUnknown_QueryInterface(This
->unk_impl
, riid
, ppv
);
404 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
406 return IUnknown_AddRef(This
->unk_impl
);
409 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
411 return IUnknown_Release(This
->unk_impl
);
414 struct HTMLDocumentObj
{
415 HTMLDocument basedoc
;
417 ICustomDoc ICustomDoc_iface
;
421 NSContainer
*nscontainer
;
423 IOleClientSite
*client
;
424 IDocHostUIHandler
*hostui
;
426 IOleInPlaceSite
*ipsite
;
427 IOleInPlaceFrame
*frame
;
428 IOleInPlaceUIWindow
*ip_window
;
429 IAdviseSink
*view_sink
;
430 IDocObjectService
*doc_object_service
;
432 DOCHOSTUIINFO hostinfo
;
434 IOleUndoManager
*undomgr
;
439 BOOL request_uiactivate
;
440 BOOL in_place_active
;
444 BOOL container_locked
;
455 nsIWebBrowserChrome nsIWebBrowserChrome_iface
;
456 nsIContextMenuListener nsIContextMenuListener_iface
;
457 nsIURIContentListener nsIURIContentListener_iface
;
458 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface
;
459 nsITooltipListener nsITooltipListener_iface
;
460 nsIInterfaceRequestor nsIInterfaceRequestor_iface
;
461 nsIWeakReference nsIWeakReference_iface
;
462 nsISupportsWeakReference nsISupportsWeakReference_iface
;
464 nsIWebBrowser
*webbrowser
;
465 nsIWebNavigation
*navigation
;
466 nsIBaseWindow
*window
;
467 nsIWebBrowserFocus
*focus
;
470 nsIController
*editor_controller
;
475 HTMLDocumentObj
*doc
;
477 nsIURIContentListener
*content_listener
;
482 typedef struct nsWineURI nsWineURI
;
484 HRESULT
set_wine_url(nsWineURI
*,LPCWSTR
);
485 nsresult
on_start_uri_open(NSContainer
*,nsIURI
*,PRBool
*);
487 /* Keep sync with request_method_strings in nsio.c */
495 nsIHttpChannel nsIHttpChannel_iface
;
496 nsIUploadChannel nsIUploadChannel_iface
;
497 nsIHttpChannelInternal nsIHttpChannelInternal_iface
;
502 nsIInputStream
*post_data_stream
;
503 nsILoadGroup
*load_group
;
504 nsIInterfaceRequestor
*notif_callback
;
506 nsLoadFlags load_flags
;
507 nsIURI
*original_uri
;
511 PRUint32 response_status
;
512 REQUEST_METHOD request_method
;
513 struct list response_headers
;
514 struct list request_headers
;
524 HRESULT
set_http_header(struct list
*,const WCHAR
*,int,const WCHAR
*,int);
527 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
528 void (*destructor
)(HTMLDOMNode
*);
529 HRESULT (*clone
)(HTMLDOMNode
*,nsIDOMNode
*,HTMLDOMNode
**);
530 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
531 HRESULT (*call_event
)(HTMLDOMNode
*,DWORD
,BOOL
*);
532 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
533 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
534 HRESULT (*get_document
)(HTMLDOMNode
*,IDispatch
**);
535 HRESULT (*get_readystate
)(HTMLDOMNode
*,BSTR
*);
536 HRESULT (*get_dispid
)(HTMLDOMNode
*,BSTR
,DWORD
,DISPID
*);
537 HRESULT (*invoke
)(HTMLDOMNode
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
538 HRESULT (*bind_to_tree
)(HTMLDOMNode
*);
543 IHTMLDOMNode IHTMLDOMNode_iface
;
544 IHTMLDOMNode2 IHTMLDOMNode2_iface
;
545 const NodeImplVtbl
*vtbl
;
550 HTMLDocumentNode
*doc
;
551 event_target_t
*event_target
;
552 ConnectionPointContainer
*cp_container
;
559 ConnectionPointContainer cp_container
;
561 IHTMLElement IHTMLElement_iface
;
562 IHTMLElement2 IHTMLElement2_iface
;
563 IHTMLElement3 IHTMLElement3_iface
;
564 IHTMLElement4 IHTMLElement4_iface
;
566 nsIDOMHTMLElement
*nselem
;
571 #define HTMLELEMENT_TIDS \
582 IHTMLTextContainer IHTMLTextContainer_iface
;
587 struct HTMLFrameBase
{
590 IHTMLFrameBase IHTMLFrameBase_iface
;
591 IHTMLFrameBase2 IHTMLFrameBase2_iface
;
593 HTMLWindow
*content_window
;
595 nsIDOMHTMLFrameElement
*nsframe
;
596 nsIDOMHTMLIFrameElement
*nsiframe
;
599 typedef struct nsDocumentEventListener nsDocumentEventListener
;
601 struct HTMLDocumentNode
{
603 HTMLDocument basedoc
;
605 IInternetHostSecurityManager IInternetHostSecurityManager_iface
;
607 nsIDocumentObserver nsIDocumentObserver_iface
;
611 nsIDOMHTMLDocument
*nsdoc
;
614 event_target_t
*body_event_target
;
616 ICatInformation
*catmgr
;
617 nsDocumentEventListener
*nsevent_listener
;
620 BOOL skip_mutation_notif
;
622 struct list bindings
;
623 struct list selection_list
;
624 struct list range_list
;
625 struct list plugin_hosts
;
628 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
629 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
630 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocumentObj
*,HTMLWindow
*,HTMLDocumentNode
**);
631 HRESULT
create_document_fragment(nsIDOMNode
*,HTMLDocumentNode
*,HTMLDocumentNode
**);
633 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*,nsIDOMWindow
*,HTMLWindow
*,HTMLWindow
**);
634 void update_window_doc(HTMLWindow
*);
635 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
636 nsIDOMWindow
*get_nsdoc_window(nsIDOMDocument
*);
637 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
638 HTMLImageElementFactory
*HTMLImageElementFactory_Create(HTMLWindow
*);
639 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
640 IOmNavigator
*OmNavigator_Create(void);
641 HRESULT
HTMLScreen_Create(IHTMLScreen
**);
643 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
644 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
645 void HTMLDocument_Persist_Init(HTMLDocument
*);
646 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
647 void HTMLDocument_OleObj_Init(HTMLDocument
*);
648 void HTMLDocument_View_Init(HTMLDocument
*);
649 void HTMLDocument_Window_Init(HTMLDocument
*);
650 void HTMLDocument_Service_Init(HTMLDocument
*);
651 void HTMLDocument_Hlink_Init(HTMLDocument
*);
653 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
655 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
657 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
,cp_static_data_t
*);
658 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
659 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
661 NSContainer
*NSContainer_Create(HTMLDocumentObj
*,NSContainer
*);
662 void NSContainer_Release(NSContainer
*);
663 nsresult
create_chrome_window(nsIWebBrowserChrome
*,nsIWebBrowserChrome
**);
665 void init_mutation(nsIComponentManager
*);
666 void init_document_mutation(HTMLDocumentNode
*);
667 void release_document_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 HRESULT
HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*,HTMLStyle
**);
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
**);
753 IHTMLDOMAttribute IHTMLDOMAttribute_iface
;
762 HRESULT
HTMLDOMAttribute_Create(HTMLElement
*,DISPID
,HTMLDOMAttribute
**);
764 HRESULT
HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
,HTMLElement
**);
765 HRESULT
HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,HTMLElement
**);
766 HRESULT
HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
767 HRESULT
HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
768 HRESULT
HTMLEmbedElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
769 HRESULT
HTMLFormElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
770 HRESULT
HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
771 HRESULT
HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
772 HRESULT
HTMLStyleElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
773 HRESULT
HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
774 HRESULT
HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
775 HRESULT
HTMLObjectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
776 HRESULT
HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
777 HRESULT
HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
778 HRESULT
HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
779 HRESULT
HTMLTable_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
780 HRESULT
HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
781 HRESULT
HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
782 HRESULT
HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
784 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*);
785 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
786 void HTMLElement2_Init(HTMLElement
*);
787 void HTMLElement3_Init(HTMLElement
*);
788 void HTMLTextContainer_Init(HTMLTextContainer
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
789 void HTMLFrameBase_Init(HTMLFrameBase
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
791 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
792 void HTMLDOMNode_destructor(HTMLDOMNode
*);
794 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
795 void HTMLElement_destructor(HTMLDOMNode
*);
796 HRESULT
HTMLElement_clone(HTMLDOMNode
*,nsIDOMNode
*,HTMLDOMNode
**);
798 HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*,REFIID
,void**);
799 void HTMLFrameBase_destructor(HTMLFrameBase
*);
801 HRESULT
get_node(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
,HTMLDOMNode
**);
802 void release_nodes(HTMLDocumentNode
*);
804 void release_script_hosts(HTMLWindow
*);
805 void connect_scripts(HTMLWindow
*);
806 void doc_insert_script(HTMLWindow
*,nsIDOMHTMLScriptElement
*);
807 IDispatch
*script_parse_event(HTMLWindow
*,LPCWSTR
);
808 HRESULT
exec_script(HTMLWindow
*,const WCHAR
*,const WCHAR
*,VARIANT
*);
809 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
810 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
811 IDispatch
*get_script_disp(ScriptHost
*);
812 HRESULT
search_window_props(HTMLWindow
*,BSTR
,DWORD
,DISPID
*);
814 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
815 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocumentNode
*,IUnknown
*,nsIDOMNodeList
*);
816 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocumentNode
*,IUnknown
*,nsIDOMHTMLCollection
*);
821 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
822 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
825 extern const cmdtable_t editmode_cmds
[];
827 void do_ns_command(HTMLDocument
*,const char*,nsICommandParams
*);
830 #define UPDATE_UI 0x0001
831 #define UPDATE_TITLE 0x0002
833 void update_doc(HTMLDocument
*,DWORD
);
834 void update_title(HTMLDocumentObj
*);
837 void init_editor(HTMLDocument
*);
838 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
839 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
840 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
841 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
842 void handle_edit_load(HTMLDocument
*);
843 HRESULT
editor_is_dirty(HTMLDocument
*);
844 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
846 extern DWORD mshtml_tls
;
848 typedef struct task_t task_t
;
849 typedef void (*task_proc_t
)(task_t
*);
859 HTMLDocumentObj
*doc
;
864 task_t
*task_queue_head
;
865 task_t
*task_queue_tail
;
866 struct list timer_list
;
869 thread_data_t
*get_thread_data(BOOL
);
870 HWND
get_thread_hwnd(void);
872 LONG
get_task_target_magic(void);
873 void push_task(task_t
*,task_proc_t
,LONG
);
874 void remove_target_tasks(LONG
);
876 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
877 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
879 const char *debugstr_variant(const VARIANT
*);
881 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
882 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
883 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
884 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
885 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
887 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
889 DEFINE_OLEGUID(CGID_DocHostCmdPriv
, 0x000214D4L
, 0, 0);
891 /* memory allocation functions */
893 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
895 return HeapAlloc(GetProcessHeap(), 0, len
);
898 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
900 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
903 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
905 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
908 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
910 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
913 static inline BOOL
heap_free(void *mem
)
915 return HeapFree(GetProcessHeap(), 0, mem
);
918 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
925 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
926 ret
= heap_alloc(size
);
927 memcpy(ret
, str
, size
);
933 static inline LPWSTR
heap_strndupW(LPCWSTR str
, unsigned len
)
938 ret
= heap_alloc((len
+1)*sizeof(WCHAR
));
939 memcpy(ret
, str
, len
*sizeof(WCHAR
));
946 static inline char *heap_strdupA(const char *str
)
953 size
= strlen(str
)+1;
954 ret
= heap_alloc(size
);
955 memcpy(ret
, str
, size
);
961 static inline WCHAR
*heap_strdupAtoW(const char *str
)
968 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
969 ret
= heap_alloc(len
*sizeof(WCHAR
));
970 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
976 static inline char *heap_strdupWtoA(LPCWSTR str
)
981 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
982 ret
= heap_alloc(size
);
983 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
989 static inline void windowref_addref(windowref_t
*ref
)
991 InterlockedIncrement(&ref
->ref
);
994 static inline void windowref_release(windowref_t
*ref
)
996 if(!InterlockedDecrement(&ref
->ref
))
1000 HDC
get_display_dc(void);
1001 HINSTANCE
get_shdoclc(void);
1002 void set_statustext(HTMLDocumentObj
*,INT
,LPCWSTR
);
1004 extern HINSTANCE hInst
;