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
28 #include "wine/list.h"
29 #include "wine/unicode.h"
37 #define NS_ERROR_GENERATE_FAILURE(module,code) \
38 ((nsresult) (((PRUint32)(1<<31)) | ((PRUint32)(module+0x45)<<16) | ((PRUint32)(code))))
40 #define NS_OK ((nsresult)0x00000000L)
41 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
42 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
43 #define NS_NOINTERFACE ((nsresult)0x80004002L)
44 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
45 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
46 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
47 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
49 #define NS_ERROR_MODULE_NETWORK 6
51 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
52 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
54 #define NS_FAILED(res) ((res) & 0x80000000)
55 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
59 #define MSHTML_E_NODOC 0x800a025c
61 typedef struct HTMLDOMNode HTMLDOMNode
;
62 typedef struct ConnectionPoint ConnectionPoint
;
63 typedef struct BSCallback BSCallback
;
64 typedef struct event_target_t event_target_t
;
68 XDIID(DispCEventObj) \
70 XDIID(DispDOMChildrenCollection) \
71 XDIID(DispHTMLAnchorElement) \
73 XDIID(DispHTMLCommentElement) \
74 XDIID(DispHTMLCurrentStyle) \
75 XDIID(DispHTMLDocument) \
76 XDIID(DispHTMLDOMTextNode) \
77 XDIID(DispHTMLElementCollection) \
78 XDIID(DispHTMLEmbed) \
79 XDIID(DispHTMLFormElement) \
80 XDIID(DispHTMLGenericElement) \
81 XDIID(DispHTMLFrameElement) \
82 XDIID(DispHTMLIFrame) \
84 XDIID(DispHTMLInputElement) \
85 XDIID(DispHTMLLocation) \
86 XDIID(DispHTMLNavigator) \
87 XDIID(DispHTMLObjectElement) \
88 XDIID(DispHTMLOptionElement) \
89 XDIID(DispHTMLScreen) \
90 XDIID(DispHTMLScriptElement) \
91 XDIID(DispHTMLSelectElement) \
92 XDIID(DispHTMLStyle) \
93 XDIID(DispHTMLStyleElement) \
94 XDIID(DispHTMLStyleSheetsCollection) \
95 XDIID(DispHTMLTable) \
96 XDIID(DispHTMLTableRow) \
97 XDIID(DispHTMLTextAreaElement) \
98 XDIID(DispHTMLUnknownElement) \
99 XDIID(DispHTMLWindow2) \
100 XDIID(HTMLDocumentEvents) \
101 XIID(IHTMLAnchorElement) \
102 XIID(IHTMLBodyElement) \
103 XIID(IHTMLBodyElement2) \
104 XIID(IHTMLCommentElement) \
105 XIID(IHTMLCurrentStyle) \
106 XIID(IHTMLCurrentStyle2) \
107 XIID(IHTMLCurrentStyle3) \
108 XIID(IHTMLCurrentStyle4) \
109 XIID(IHTMLDocument2) \
110 XIID(IHTMLDocument3) \
111 XIID(IHTMLDocument4) \
112 XIID(IHTMLDocument5) \
113 XIID(IHTMLDOMChildrenCollection) \
115 XIID(IHTMLDOMNode2) \
116 XIID(IHTMLDOMTextNode) \
118 XIID(IHTMLElement2) \
119 XIID(IHTMLElement3) \
120 XIID(IHTMLElement4) \
121 XIID(IHTMLElementCollection) \
122 XIID(IHTMLEmbedElement) \
123 XIID(IHTMLEventObj) \
124 XIID(IHTMLFiltersCollection) \
125 XIID(IHTMLFormElement) \
126 XIID(IHTMLFrameBase) \
127 XIID(IHTMLFrameBase2) \
128 XIID(IHTMLFrameElement3) \
129 XIID(IHTMLGenericElement) \
130 XIID(IHTMLIFrameElement) \
131 XIID(IHTMLImageElementFactory) \
132 XIID(IHTMLImgElement) \
133 XIID(IHTMLInputElement) \
134 XIID(IHTMLLocation) \
135 XIID(IHTMLObjectElement) \
136 XIID(IHTMLOptionElement) \
137 XIID(IHTMLPluginsCollection) \
140 XIID(IHTMLScriptElement) \
141 XIID(IHTMLSelectElement) \
146 XIID(IHTMLStyleElement) \
147 XIID(IHTMLStyleSheetsCollection) \
149 XIID(IHTMLTableRow) \
150 XIID(IHTMLTextAreaElement) \
151 XIID(IHTMLTextContainer) \
152 XIID(IHTMLUniqueName) \
159 #define XIID(iface) iface ## _tid,
160 #define XDIID(iface) iface ## _tid,
167 typedef struct dispex_data_t dispex_data_t
;
168 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
170 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
171 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
172 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
174 typedef struct DispatchEx DispatchEx
;
177 HRESULT (*value
)(DispatchEx
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
178 HRESULT (*get_dispid
)(DispatchEx
*,BSTR
,DWORD
,DISPID
*);
179 HRESULT (*invoke
)(DispatchEx
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
180 } dispex_static_data_vtbl_t
;
183 const dispex_static_data_vtbl_t
*vtbl
;
184 const tid_t disp_tid
;
186 const tid_t
* const iface_tids
;
187 } dispex_static_data_t
;
190 IDispatchEx IDispatchEx_iface
;
194 dispex_static_data_t
*data
;
195 dispex_dynamic_data_t
*dynamic_data
;
198 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
199 void release_dispex(DispatchEx
*);
200 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
201 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
202 HRESULT
get_dispids(tid_t
,DWORD
*,DISPID
**);
203 HRESULT
remove_prop(DispatchEx
*,BSTR
,VARIANT_BOOL
*);
205 typedef struct HTMLWindow HTMLWindow
;
206 typedef struct HTMLDocumentNode HTMLDocumentNode
;
207 typedef struct HTMLDocumentObj HTMLDocumentObj
;
208 typedef struct HTMLFrameBase HTMLFrameBase
;
209 typedef struct NSContainer NSContainer
;
213 SCRIPTMODE_ACTIVESCRIPT
216 typedef struct ScriptHost ScriptHost
;
221 } global_prop_type_t
;
224 global_prop_type_t type
;
226 ScriptHost
*script_host
;
231 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface
;
236 } HTMLOptionElementFactory
;
240 IHTMLImageElementFactory IHTMLImageElementFactory_iface
;
245 } HTMLImageElementFactory
;
247 struct HTMLLocation
{
249 IHTMLLocation IHTMLLocation_iface
;
261 typedef struct nsChannelBSC nsChannelBSC
;
265 IHTMLWindow2 IHTMLWindow2_iface
;
266 IHTMLWindow3 IHTMLWindow3_iface
;
267 IHTMLWindow4 IHTMLWindow4_iface
;
268 IHTMLPrivateWindow IHTMLPrivateWindow_iface
;
269 IDispatchEx IDispatchEx_iface
;
270 IServiceProvider IServiceProvider_iface
;
274 windowref_t
*window_ref
;
277 HTMLDocumentNode
*doc
;
278 HTMLDocumentObj
*doc_obj
;
279 nsIDOMWindow
*nswindow
;
281 HTMLFrameBase
*frame_element
;
282 READYSTATE readystate
;
284 nsChannelBSC
*bscallback
;
288 IHTMLEventObj
*event
;
290 SCRIPTMODE scriptmode
;
291 struct list script_hosts
;
293 HTMLOptionElementFactory
*option_factory
;
294 HTMLImageElementFactory
*image_factory
;
295 HTMLLocation
*location
;
298 global_prop_t
*global_props
;
299 DWORD global_prop_cnt
;
300 DWORD global_prop_size
;
302 struct list children
;
303 struct list sibling_entry
;
313 typedef struct _cp_static_data_t
{
315 void (*on_advise
)(IUnknown
*,struct _cp_static_data_t
*);
320 typedef struct ConnectionPointContainer
{
321 IConnectionPointContainer IConnectionPointContainer_iface
;
323 ConnectionPoint
*cp_list
;
325 struct ConnectionPointContainer
*forward_container
;
326 } ConnectionPointContainer
;
328 struct ConnectionPoint
{
329 IConnectionPoint IConnectionPoint_iface
;
331 ConnectionPointContainer
*container
;
336 IPropertyNotifySink
*propnotif
;
341 cp_static_data_t
*data
;
343 ConnectionPoint
*next
;
346 struct HTMLDocument
{
347 IHTMLDocument2 IHTMLDocument2_iface
;
348 IHTMLDocument3 IHTMLDocument3_iface
;
349 IHTMLDocument4 IHTMLDocument4_iface
;
350 IHTMLDocument5 IHTMLDocument5_iface
;
351 IHTMLDocument6 IHTMLDocument6_iface
;
352 IPersistMoniker IPersistMoniker_iface
;
353 IPersistFile IPersistFile_iface
;
354 IPersistHistory IPersistHistory_iface
;
355 IMonikerProp IMonikerProp_iface
;
356 IOleObject IOleObject_iface
;
357 IOleDocument IOleDocument_iface
;
358 IOleDocumentView IOleDocumentView_iface
;
359 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface
;
360 IViewObjectEx IViewObjectEx_iface
;
361 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface
;
362 IServiceProvider IServiceProvider_iface
;
363 IOleCommandTarget IOleCommandTarget_iface
;
364 IOleControl IOleControl_iface
;
365 IHlinkTarget IHlinkTarget_iface
;
366 IPersistStreamInit IPersistStreamInit_iface
;
367 IDispatchEx IDispatchEx_iface
;
368 ISupportErrorInfo ISupportErrorInfo_iface
;
369 IObjectWithSite IObjectWithSite_iface
;
370 IOleContainer IOleContainer_iface
;
375 HTMLDocumentObj
*doc_obj
;
376 HTMLDocumentNode
*doc_node
;
382 ConnectionPointContainer cp_container
;
383 ConnectionPoint cp_htmldocevents
;
384 ConnectionPoint cp_htmldocevents2
;
385 ConnectionPoint cp_propnotif
;
386 ConnectionPoint cp_dispatch
;
388 IOleAdviseHolder
*advise_holder
;
391 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
393 return IUnknown_QueryInterface(This
->unk_impl
, riid
, ppv
);
396 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
398 return IUnknown_AddRef(This
->unk_impl
);
401 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
403 return IUnknown_Release(This
->unk_impl
);
406 struct HTMLDocumentObj
{
407 HTMLDocument basedoc
;
409 ICustomDoc ICustomDoc_iface
;
413 NSContainer
*nscontainer
;
415 IOleClientSite
*client
;
416 IDocHostUIHandler
*hostui
;
418 IOleInPlaceSite
*ipsite
;
419 IOleInPlaceFrame
*frame
;
420 IOleInPlaceUIWindow
*ip_window
;
421 IAdviseSink
*view_sink
;
423 DOCHOSTUIINFO hostinfo
;
425 IOleUndoManager
*undomgr
;
430 BOOL request_uiactivate
;
431 BOOL in_place_active
;
435 BOOL container_locked
;
446 nsIWebBrowserChrome nsIWebBrowserChrome_iface
;
447 nsIContextMenuListener nsIContextMenuListener_iface
;
448 nsIURIContentListener nsIURIContentListener_iface
;
449 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface
;
450 nsITooltipListener nsITooltipListener_iface
;
451 nsIInterfaceRequestor nsIInterfaceRequestor_iface
;
452 nsIWeakReference nsIWeakReference_iface
;
453 nsISupportsWeakReference nsISupportsWeakReference_iface
;
455 nsIWebBrowser
*webbrowser
;
456 nsIWebNavigation
*navigation
;
457 nsIBaseWindow
*window
;
458 nsIWebBrowserFocus
*focus
;
461 nsIController
*editor_controller
;
466 HTMLDocumentObj
*doc
;
468 nsIURIContentListener
*content_listener
;
473 typedef struct nsWineURI nsWineURI
;
475 HRESULT
set_wine_url(nsWineURI
*,LPCWSTR
);
476 nsresult
on_start_uri_open(NSContainer
*,nsIURI
*,PRBool
*);
478 /* Keep sync with request_method_strings in nsio.c */
486 nsIHttpChannel nsIHttpChannel_iface
;
487 nsIUploadChannel nsIUploadChannel_iface
;
488 nsIHttpChannelInternal nsIHttpChannelInternal_iface
;
493 nsIInputStream
*post_data_stream
;
494 nsILoadGroup
*load_group
;
495 nsIInterfaceRequestor
*notif_callback
;
497 nsLoadFlags load_flags
;
498 nsIURI
*original_uri
;
502 PRUint32 response_status
;
503 REQUEST_METHOD request_method
;
504 struct list response_headers
;
505 struct list request_headers
;
515 HRESULT
set_http_header(struct list
*,const WCHAR
*,int,const WCHAR
*,int);
518 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
519 void (*destructor
)(HTMLDOMNode
*);
520 HRESULT (*clone
)(HTMLDOMNode
*,nsIDOMNode
*,HTMLDOMNode
**);
521 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
522 HRESULT (*call_event
)(HTMLDOMNode
*,DWORD
,BOOL
*);
523 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
524 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
525 HRESULT (*get_document
)(HTMLDOMNode
*,IDispatch
**);
526 HRESULT (*get_readystate
)(HTMLDOMNode
*,BSTR
*);
527 HRESULT (*get_dispid
)(HTMLDOMNode
*,BSTR
,DWORD
,DISPID
*);
528 HRESULT (*invoke
)(HTMLDOMNode
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
529 HRESULT (*bind_to_tree
)(HTMLDOMNode
*);
534 IHTMLDOMNode IHTMLDOMNode_iface
;
535 IHTMLDOMNode2 IHTMLDOMNode2_iface
;
536 const NodeImplVtbl
*vtbl
;
541 HTMLDocumentNode
*doc
;
542 event_target_t
*event_target
;
543 ConnectionPointContainer
*cp_container
;
550 ConnectionPointContainer cp_container
;
552 IHTMLElement IHTMLElement_iface
;
553 IHTMLElement2 IHTMLElement2_iface
;
554 IHTMLElement3 IHTMLElement3_iface
;
556 nsIDOMHTMLElement
*nselem
;
559 #define HTMLELEMENT_TIDS \
570 IHTMLTextContainer IHTMLTextContainer_iface
;
575 struct HTMLFrameBase
{
578 IHTMLFrameBase IHTMLFrameBase_iface
;
579 IHTMLFrameBase2 IHTMLFrameBase2_iface
;
581 HTMLWindow
*content_window
;
583 nsIDOMHTMLFrameElement
*nsframe
;
584 nsIDOMHTMLIFrameElement
*nsiframe
;
587 typedef struct _mutation_queue_t
{
589 nsISupports
*nsiface
;
591 struct _mutation_queue_t
*next
;
594 typedef struct nsDocumentEventListener nsDocumentEventListener
;
596 struct HTMLDocumentNode
{
598 HTMLDocument basedoc
;
600 IInternetHostSecurityManager IInternetHostSecurityManager_iface
;
602 nsIDocumentObserver nsIDocumentObserver_iface
;
603 nsIRunnable nsIRunnable_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
;
618 mutation_queue_t
*mutation_queue
;
619 mutation_queue_t
*mutation_queue_tail
;
621 struct list bindings
;
622 struct list selection_list
;
623 struct list range_list
;
624 struct list plugin_hosts
;
627 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
628 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
629 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocumentObj
*,HTMLWindow
*,HTMLDocumentNode
**);
630 HRESULT
create_document_fragment(nsIDOMNode
*,HTMLDocumentNode
*,HTMLDocumentNode
**);
632 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*,nsIDOMWindow
*,HTMLWindow
*,HTMLWindow
**);
633 void update_window_doc(HTMLWindow
*);
634 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
635 nsIDOMWindow
*get_nsdoc_window(nsIDOMDocument
*);
636 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
637 HTMLImageElementFactory
*HTMLImageElementFactory_Create(HTMLWindow
*);
638 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
639 IOmNavigator
*OmNavigator_Create(void);
640 HRESULT
HTMLScreen_Create(IHTMLScreen
**);
642 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
643 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
644 void HTMLDocument_Persist_Init(HTMLDocument
*);
645 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
646 void HTMLDocument_OleObj_Init(HTMLDocument
*);
647 void HTMLDocument_View_Init(HTMLDocument
*);
648 void HTMLDocument_Window_Init(HTMLDocument
*);
649 void HTMLDocument_Service_Init(HTMLDocument
*);
650 void HTMLDocument_Hlink_Init(HTMLDocument
*);
652 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode
*);
654 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
656 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
,cp_static_data_t
*);
657 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
658 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
660 NSContainer
*NSContainer_Create(HTMLDocumentObj
*,NSContainer
*);
661 void NSContainer_Release(NSContainer
*);
662 nsresult
create_chrome_window(nsIWebBrowserChrome
*,nsIWebBrowserChrome
**);
664 void init_mutation(HTMLDocumentNode
*);
665 void release_mutation(HTMLDocumentNode
*);
667 void HTMLDocument_LockContainer(HTMLDocumentObj
*,BOOL
);
668 void show_context_menu(HTMLDocumentObj
*,DWORD
,POINT
*,IDispatch
*);
669 void notif_focus(HTMLDocumentObj
*);
671 void show_tooltip(HTMLDocumentObj
*,DWORD
,DWORD
,LPCWSTR
);
672 void hide_tooltip(HTMLDocumentObj
*);
673 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
675 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
677 BOOL
load_gecko(BOOL
);
678 void close_gecko(void);
679 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
680 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
681 void release_nsio(void);
682 BOOL
is_gecko_path(const char*);
684 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
685 HRESULT
create_doc_uri(HTMLWindow
*,WCHAR
*,nsWineURI
**);
686 HRESULT
load_nsuri(HTMLWindow
*,nsWineURI
*,nsChannelBSC
*,DWORD
);
688 HRESULT
hlink_frame_navigate(HTMLDocument
*,LPCWSTR
,nsIInputStream
*,DWORD
,BOOL
*);
689 HRESULT
navigate_url(HTMLWindow
*,const WCHAR
*,const WCHAR
*);
690 HRESULT
set_frame_doc(HTMLFrameBase
*,nsIDOMDocument
*);
691 HRESULT
set_moniker(HTMLDocument
*,IMoniker
*,IBindCtx
*,nsChannelBSC
*,BOOL
);
693 void call_property_onchanged(ConnectionPoint
*,DISPID
);
694 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
696 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
699 void nsACString_InitDepend(nsACString
*,const char*);
700 void nsACString_SetData(nsACString
*,const char*);
701 PRUint32
nsACString_GetData(const nsACString
*,const char**);
702 void nsACString_Finish(nsACString
*);
704 BOOL
nsAString_Init(nsAString
*,const PRUnichar
*);
705 void nsAString_InitDepend(nsAString
*,const PRUnichar
*);
706 void nsAString_SetData(nsAString
*,const PRUnichar
*);
707 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
708 void nsAString_Finish(nsAString
*);
709 HRESULT
return_nsstr(nsresult
,nsAString
*,BSTR
*);
711 nsICommandParams
*create_nscommand_params(void);
712 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
713 void get_editor_controller(NSContainer
*);
714 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
716 void init_nsevents(HTMLDocumentNode
*);
717 void release_nsevents(HTMLDocumentNode
*);
718 void add_nsevent_listener(HTMLDocumentNode
*,nsIDOMNode
*,LPCWSTR
);
720 void set_window_bscallback(HTMLWindow
*,nsChannelBSC
*);
721 void set_current_mon(HTMLWindow
*,IMoniker
*);
722 HRESULT
start_binding(HTMLWindow
*,HTMLDocumentNode
*,BSCallback
*,IBindCtx
*);
723 HRESULT
async_start_doc_binding(HTMLWindow
*,nsChannelBSC
*);
724 void abort_document_bindings(HTMLDocumentNode
*);
726 HRESULT
bind_mon_to_buffer(HTMLDocumentNode
*,IMoniker
*,void**,DWORD
*);
728 HRESULT
create_channelbsc(IMoniker
*,WCHAR
*,BYTE
*,DWORD
,nsChannelBSC
**);
729 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
730 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
731 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
733 void set_ready_state(HTMLWindow
*,READYSTATE
);
735 HRESULT
HTMLSelectionObject_Create(HTMLDocumentNode
*,nsISelection
*,IHTMLSelectionObject
**);
736 HRESULT
HTMLTxtRange_Create(HTMLDocumentNode
*,nsIDOMRange
*,IHTMLTxtRange
**);
737 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
738 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
739 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
741 void detach_selection(HTMLDocumentNode
*);
742 void detach_ranges(HTMLDocumentNode
*);
743 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
745 HRESULT
create_nselem(HTMLDocumentNode
*,const WCHAR
*,nsIDOMHTMLElement
**);
747 HRESULT
HTMLDOMTextNode_Create(HTMLDocumentNode
*,nsIDOMNode
*,HTMLDOMNode
**);
749 HRESULT
HTMLElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
,HTMLElement
**);
750 HRESULT
HTMLCommentElement_Create(HTMLDocumentNode
*,nsIDOMNode
*,HTMLElement
**);
751 HRESULT
HTMLAnchorElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
752 HRESULT
HTMLBodyElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
753 HRESULT
HTMLEmbedElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
754 HRESULT
HTMLFormElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
755 HRESULT
HTMLFrameElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
756 HRESULT
HTMLIFrame_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
757 HRESULT
HTMLStyleElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
758 HRESULT
HTMLImgElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
759 HRESULT
HTMLInputElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
760 HRESULT
HTMLObjectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
761 HRESULT
HTMLOptionElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
762 HRESULT
HTMLScriptElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
763 HRESULT
HTMLSelectElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
764 HRESULT
HTMLTable_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
765 HRESULT
HTMLTableRow_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
766 HRESULT
HTMLTextAreaElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
767 HRESULT
HTMLGenericElement_Create(HTMLDocumentNode
*,nsIDOMHTMLElement
*,HTMLElement
**);
769 void HTMLDOMNode_Init(HTMLDocumentNode
*,HTMLDOMNode
*,nsIDOMNode
*);
770 void HTMLElement_Init(HTMLElement
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
771 void HTMLElement2_Init(HTMLElement
*);
772 void HTMLElement3_Init(HTMLElement
*);
773 void HTMLTextContainer_Init(HTMLTextContainer
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
774 void HTMLFrameBase_Init(HTMLFrameBase
*,HTMLDocumentNode
*,nsIDOMHTMLElement
*,dispex_static_data_t
*);
776 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
777 void HTMLDOMNode_destructor(HTMLDOMNode
*);
779 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
780 void HTMLElement_destructor(HTMLDOMNode
*);
781 HRESULT
HTMLElement_clone(HTMLDOMNode
*,nsIDOMNode
*,HTMLDOMNode
**);
783 HRESULT
HTMLFrameBase_QI(HTMLFrameBase
*,REFIID
,void**);
784 void HTMLFrameBase_destructor(HTMLFrameBase
*);
786 HRESULT
get_node(HTMLDocumentNode
*,nsIDOMNode
*,BOOL
,HTMLDOMNode
**);
787 void release_nodes(HTMLDocumentNode
*);
789 void release_script_hosts(HTMLWindow
*);
790 void connect_scripts(HTMLWindow
*);
791 void doc_insert_script(HTMLWindow
*,nsIDOMHTMLScriptElement
*);
792 IDispatch
*script_parse_event(HTMLWindow
*,LPCWSTR
);
793 HRESULT
exec_script(HTMLWindow
*,const WCHAR
*,const WCHAR
*,VARIANT
*);
794 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
795 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
796 IDispatch
*get_script_disp(ScriptHost
*);
797 HRESULT
search_window_props(HTMLWindow
*,BSTR
,DWORD
,DISPID
*);
799 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
800 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocumentNode
*,IUnknown
*,nsIDOMNodeList
*);
801 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocumentNode
*,IUnknown
*,nsIDOMHTMLCollection
*);
806 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
807 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
810 extern const cmdtable_t editmode_cmds
[];
812 void do_ns_command(HTMLDocument
*,const char*,nsICommandParams
*);
815 #define UPDATE_UI 0x0001
816 #define UPDATE_TITLE 0x0002
818 void update_doc(HTMLDocument
*,DWORD
);
819 void update_title(HTMLDocumentObj
*);
822 void init_editor(HTMLDocument
*);
823 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
824 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
825 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
826 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
827 void handle_edit_load(HTMLDocument
*);
828 HRESULT
editor_is_dirty(HTMLDocument
*);
829 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
831 extern DWORD mshtml_tls
;
833 typedef struct task_t task_t
;
834 typedef void (*task_proc_t
)(task_t
*);
844 HTMLDocumentObj
*doc
;
849 task_t
*task_queue_head
;
850 task_t
*task_queue_tail
;
851 struct list timer_list
;
854 thread_data_t
*get_thread_data(BOOL
);
855 HWND
get_thread_hwnd(void);
857 LONG
get_task_target_magic(void);
858 void push_task(task_t
*,task_proc_t
,LONG
);
859 void remove_target_tasks(LONG
);
861 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
862 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
864 void release_typelib(void);
865 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*);
867 const char *debugstr_variant(const VARIANT
*);
869 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
870 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
871 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
872 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
873 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
875 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
877 /* memory allocation functions */
879 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
881 return HeapAlloc(GetProcessHeap(), 0, len
);
884 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
886 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
889 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
891 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
894 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
896 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
899 static inline BOOL
heap_free(void *mem
)
901 return HeapFree(GetProcessHeap(), 0, mem
);
904 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
911 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
912 ret
= heap_alloc(size
);
913 memcpy(ret
, str
, size
);
919 static inline LPWSTR
heap_strndupW(LPCWSTR str
, unsigned len
)
924 ret
= heap_alloc((len
+1)*sizeof(WCHAR
));
925 memcpy(ret
, str
, len
*sizeof(WCHAR
));
932 static inline char *heap_strdupA(const char *str
)
939 size
= strlen(str
)+1;
940 ret
= heap_alloc(size
);
941 memcpy(ret
, str
, size
);
947 static inline WCHAR
*heap_strdupAtoW(const char *str
)
954 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
955 ret
= heap_alloc(len
*sizeof(WCHAR
));
956 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
962 static inline char *heap_strdupWtoA(LPCWSTR str
)
967 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
968 ret
= heap_alloc(size
);
969 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
975 static inline void windowref_addref(windowref_t
*ref
)
977 InterlockedIncrement(&ref
->ref
);
980 static inline void windowref_release(windowref_t
*ref
)
982 if(!InterlockedDecrement(&ref
->ref
))
986 HDC
get_display_dc(void);
987 HINSTANCE
get_shdoclc(void);
988 void set_statustext(HTMLDocumentObj
*,INT
,LPCWSTR
);
990 extern HINSTANCE hInst
;