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
27 #include "wine/list.h"
28 #include "wine/unicode.h"
36 #define NS_OK ((nsresult)0x00000000L)
37 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
38 #define NS_NOINTERFACE ((nsresult)0x80004002L)
39 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
40 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
41 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
42 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
44 #define NS_FAILED(res) ((res) & 0x80000000)
45 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
49 #define MSHTML_E_NODOC 0x800a025c
51 typedef struct HTMLDOMNode HTMLDOMNode
;
52 typedef struct ConnectionPoint ConnectionPoint
;
53 typedef struct BSCallback BSCallback
;
54 typedef struct nsChannelBSC nsChannelBSC
;
55 typedef struct event_target_t event_target_t
;
57 /* NOTE: make sure to keep in sync with dispex.c */
61 DispDOMChildrenCollection_tid
,
63 DispHTMLCommentElement_tid
,
64 DispHTMLCurrentStyle_tid
,
66 DispHTMLDOMTextNode_tid
,
67 DispHTMLElementCollection_tid
,
68 DispHTMLGenericElement_tid
,
71 DispHTMLInputElement_tid
,
73 DispHTMLNavigator_tid
,
74 DispHTMLOptionElement_tid
,
75 DispHTMLSelectElement_tid
,
79 DispHTMLUnknownElement_tid
,
82 IHTMLBodyElement2_tid
,
83 IHTMLCommentElement_tid
,
84 IHTMLCurrentStyle_tid
,
85 IHTMLCurrentStyle2_tid
,
86 IHTMLCurrentStyle3_tid
,
87 IHTMLCurrentStyle4_tid
,
92 IHTMLDOMChildrenCollection_tid
,
100 IHTMLElementCollection_tid
,
103 IHTMLGenericElement_tid
,
105 IHTMLInputElement_tid
,
107 IHTMLOptionElement_tid
,
108 IHTMLSelectElement_tid
,
115 IHTMLTextContainer_tid
,
123 typedef struct dispex_data_t dispex_data_t
;
124 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
126 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
127 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
130 HRESULT (*value
)(IUnknown
*,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
131 HRESULT (*get_dispid
)(IUnknown
*,BSTR
,DWORD
,DISPID
*);
132 HRESULT (*invoke
)(IUnknown
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
133 } dispex_static_data_vtbl_t
;
136 const dispex_static_data_vtbl_t
*vtbl
;
137 const tid_t disp_tid
;
139 const tid_t
* const iface_tids
;
140 } dispex_static_data_t
;
143 const IDispatchExVtbl
*lpIDispatchExVtbl
;
147 dispex_static_data_t
*data
;
148 dispex_dynamic_data_t
*dynamic_data
;
151 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
152 void release_dispex(DispatchEx
*);
153 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
154 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
156 typedef struct HTMLWindow HTMLWindow
;
157 typedef struct HTMLDocumentNode HTMLDocumentNode
;
158 typedef struct HTMLDocumentObj HTMLDocumentObj
;
162 SCRIPTMODE_ACTIVESCRIPT
165 typedef struct ScriptHost ScriptHost
;
169 ScriptHost
*script_host
;
174 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
179 } HTMLOptionElementFactory
;
181 struct HTMLLocation
{
183 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
192 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
193 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
194 const IDispatchExVtbl
*lpIDispatchExVtbl
;
198 HTMLDocumentNode
*doc
;
199 HTMLDocumentObj
*doc_obj
;
200 nsIDOMWindow
*nswindow
;
202 event_target_t
*event_target
;
203 IHTMLEventObj
*event
;
206 SCRIPTMODE scriptmode
;
207 struct list script_hosts
;
209 HTMLOptionElementFactory
*option_factory
;
210 HTMLLocation
*location
;
212 global_prop_t
*global_props
;
213 DWORD global_prop_cnt
;
214 DWORD global_prop_size
;
226 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
228 ConnectionPoint
*cp_list
;
230 } ConnectionPointContainer
;
232 struct ConnectionPoint
{
233 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
235 IConnectionPointContainer
*container
;
240 IPropertyNotifySink
*propnotif
;
246 ConnectionPoint
*next
;
250 HRESULT (*query_interface
)(HTMLDocument
*,REFIID
,void**);
251 ULONG (*addref
)(HTMLDocument
*);
252 ULONG (*release
)(HTMLDocument
*);
255 struct HTMLDocument
{
257 const htmldoc_vtbl_t
*vtbl
;
258 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
259 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
260 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
261 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
262 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
263 const IPersistFileVtbl
*lpPersistFileVtbl
;
264 const IPersistHistoryVtbl
*lpPersistHistoryVtbl
;
265 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
266 const IOleObjectVtbl
*lpOleObjectVtbl
;
267 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
268 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
269 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
270 const IViewObject2Vtbl
*lpViewObject2Vtbl
;
271 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
272 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
273 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
274 const IOleControlVtbl
*lpOleControlVtbl
;
275 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
276 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
277 const ICustomDocVtbl
*lpCustomDocVtbl
;
278 const IDispatchExVtbl
*lpIDispatchExVtbl
;
279 const ISupportErrorInfoVtbl
*lpSupportErrorInfoVtbl
;
281 HTMLDocumentObj
*doc_obj
;
282 HTMLDocumentNode
*doc_node
;
285 nsIDOMHTMLDocument
*nsdoc
;
287 IOleClientSite
*client
;
288 IDocHostUIHandler
*hostui
;
289 IOleInPlaceSite
*ipsite
;
290 IOleInPlaceFrame
*frame
;
291 IOleInPlaceUIWindow
*ip_window
;
293 IOleUndoManager
*undomgr
;
295 nsChannelBSC
*bscallback
;
298 struct list bindings
;
303 DOCHOSTUIINFO hostinfo
;
306 READYSTATE readystate
;
307 BOOL in_place_active
;
311 BOOL container_locked
;
317 event_target_t
*event_target
;
318 ConnectionPointContainer cp_container
;
319 ConnectionPoint cp_htmldocevents
;
320 ConnectionPoint cp_htmldocevents2
;
321 ConnectionPoint cp_propnotif
;
323 struct list selection_list
;
324 struct list range_list
;
329 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
331 return This
->vtbl
->query_interface(This
, riid
, ppv
);
334 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
336 return This
->vtbl
->addref(This
);
339 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
341 return This
->vtbl
->release(This
);
344 struct HTMLDocumentNode
{
345 HTMLDocument basedoc
;
350 struct HTMLDocumentObj
{
351 HTMLDocument basedoc
;
355 NSContainer
*nscontainer
;
359 const nsIDOMEventListenerVtbl
*lpDOMEventListenerVtbl
;
363 typedef struct _mutation_queue_t
{
365 nsISupports
*nsiface
;
367 struct _mutation_queue_t
*next
;
371 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
372 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
373 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
374 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
375 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
376 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
377 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
378 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
380 const nsIDocumentObserverVtbl
*lpDocumentObserverVtbl
;
382 const nsIRunnableVtbl
*lpRunnableVtbl
;
384 nsEventListener blur_listener
;
385 nsEventListener focus_listener
;
386 nsEventListener keypress_listener
;
387 nsEventListener load_listener
;
388 nsEventListener htmlevent_listener
;
390 nsIWebBrowser
*webbrowser
;
391 nsIWebNavigation
*navigation
;
392 nsIBaseWindow
*window
;
393 nsIWebBrowserFocus
*focus
;
396 nsIController
*editor_controller
;
401 HTMLDocumentObj
*doc
;
403 nsIURIContentListener
*content_listener
;
407 mutation_queue_t
*mutation_queue
;
408 mutation_queue_t
*mutation_queue_tail
;
410 nsChannelBSC
*bscallback
; /* hack */
411 HWND reset_focus
; /* hack */
415 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
416 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
417 const nsIHttpChannelInternalVtbl
*lpIHttpChannelInternalVtbl
;
422 nsIHttpChannel
*http_channel
;
423 nsIHttpChannelInternal
*http_channel_internal
;
425 nsIInputStream
*post_data_stream
;
426 nsILoadGroup
*load_group
;
427 nsIInterfaceRequestor
*notif_callback
;
429 nsLoadFlags load_flags
;
430 nsIURI
*original_uri
;
433 PRUint32 response_status
;
437 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
438 void (*destructor
)(HTMLDOMNode
*);
439 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
440 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
441 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
446 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
447 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
448 const NodeImplVtbl
*vtbl
;
454 event_target_t
*event_target
;
461 ConnectionPointContainer cp_container
;
463 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
464 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
465 const IHTMLElement3Vtbl
*lpHTMLElement3Vtbl
;
467 nsIDOMHTMLElement
*nselem
;
473 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
478 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
479 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
481 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
482 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
483 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
484 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
485 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
486 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
487 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
488 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
489 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
490 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
491 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
492 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
493 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
494 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
495 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
496 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
497 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
498 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
499 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
500 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
501 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
502 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
503 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
504 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
505 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
507 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
508 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
509 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
510 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
511 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
512 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
513 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
514 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
515 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
517 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
519 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
521 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
522 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
523 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
524 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
526 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
527 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
528 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
530 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
531 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
532 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
533 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
534 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
536 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
538 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
539 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
541 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
543 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
545 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
546 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
548 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
549 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
550 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocumentObj
*,HTMLWindow
*,HTMLDocumentNode
**);
552 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*,nsIDOMWindow
*,HTMLWindow
**);
553 void window_set_docnode(HTMLWindow
*,HTMLDocumentNode
*);
554 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
555 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
556 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
557 IOmNavigator
*OmNavigator_Create(void);
559 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
560 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
561 void HTMLDocument_Persist_Init(HTMLDocument
*);
562 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
563 void HTMLDocument_OleObj_Init(HTMLDocument
*);
564 void HTMLDocument_View_Init(HTMLDocument
*);
565 void HTMLDocument_Window_Init(HTMLDocument
*);
566 void HTMLDocument_Service_Init(HTMLDocument
*);
567 void HTMLDocument_Hlink_Init(HTMLDocument
*);
569 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
571 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
);
572 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
573 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
575 NSContainer
*NSContainer_Create(HTMLDocumentObj
*,NSContainer
*);
576 void NSContainer_Release(NSContainer
*);
578 void init_mutation(NSContainer
*);
579 void set_mutation_observer(NSContainer
*,nsIDOMHTMLDocument
*);
580 void remove_mutation_observer(NSContainer
*,nsIDOMHTMLDocument
*);
582 void HTMLDocument_LockContainer(HTMLDocument
*,BOOL
);
583 void show_context_menu(HTMLDocument
*,DWORD
,POINT
*,IDispatch
*);
584 void notif_focus(HTMLDocument
*);
586 void show_tooltip(HTMLDocument
*,DWORD
,DWORD
,LPCWSTR
);
587 void hide_tooltip(HTMLDocument
*);
588 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
590 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
592 BOOL
load_gecko(BOOL
);
593 void close_gecko(void);
594 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
595 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
596 void release_nsio(void);
597 BOOL
install_wine_gecko(BOOL
);
599 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
601 void hlink_frame_navigate(HTMLDocument
*,IHlinkFrame
*,LPCWSTR
,nsIInputStream
*,DWORD
);
603 void call_property_onchanged(ConnectionPoint
*,DISPID
);
604 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
606 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
609 void nsACString_Init(nsACString
*,const char*);
610 void nsACString_SetData(nsACString
*,const char*);
611 PRUint32
nsACString_GetData(const nsACString
*,const char**);
612 void nsACString_Finish(nsACString
*);
614 void nsAString_Init(nsAString
*,const PRUnichar
*);
615 void nsAString_SetData(nsAString
*,const PRUnichar
*);
616 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
617 void nsAString_Finish(nsAString
*);
619 nsICommandParams
*create_nscommand_params(void);
620 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
621 void get_editor_controller(NSContainer
*);
622 void init_nsevents(NSContainer
*);
623 void add_nsevent_listener(HTMLWindow
*,LPCWSTR
);
624 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
625 void update_nsdocument(HTMLDocumentObj
*);
627 void set_document_bscallback(HTMLDocument
*,nsChannelBSC
*);
628 void set_current_mon(HTMLDocument
*,IMoniker
*);
629 HRESULT
start_binding(HTMLDocument
*,BSCallback
*,IBindCtx
*);
631 HRESULT
bind_mon_to_buffer(HTMLDocument
*,IMoniker
*,void**,DWORD
*);
633 nsChannelBSC
*create_channelbsc(IMoniker
*);
634 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
635 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
636 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
638 IHTMLSelectionObject
*HTMLSelectionObject_Create(HTMLDocument
*,nsISelection
*);
639 IHTMLTxtRange
*HTMLTxtRange_Create(HTMLDocument
*,nsIDOMRange
*);
640 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
641 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
642 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
644 void detach_selection(HTMLDocument
*);
645 void detach_ranges(HTMLDocument
*);
646 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
648 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocument
*,nsIDOMNode
*);
650 HTMLElement
*HTMLElement_Create(HTMLDocument
*,nsIDOMNode
*,BOOL
);
651 HTMLElement
*HTMLCommentElement_Create(HTMLDocument
*,nsIDOMNode
*);
652 HTMLElement
*HTMLAnchorElement_Create(nsIDOMHTMLElement
*);
653 HTMLElement
*HTMLBodyElement_Create(nsIDOMHTMLElement
*);
654 HTMLElement
*HTMLIFrame_Create(nsIDOMHTMLElement
*);
655 HTMLElement
*HTMLImgElement_Create(nsIDOMHTMLElement
*);
656 HTMLElement
*HTMLInputElement_Create(nsIDOMHTMLElement
*);
657 HTMLElement
*HTMLOptionElement_Create(nsIDOMHTMLElement
*);
658 HTMLElement
*HTMLScriptElement_Create(nsIDOMHTMLElement
*);
659 HTMLElement
*HTMLSelectElement_Create(nsIDOMHTMLElement
*);
660 HTMLElement
*HTMLTable_Create(nsIDOMHTMLElement
*);
661 HTMLElement
*HTMLTableRow_Create(nsIDOMHTMLElement
*);
662 HTMLElement
*HTMLTextAreaElement_Create(nsIDOMHTMLElement
*);
663 HTMLElement
*HTMLGenericElement_Create(nsIDOMHTMLElement
*);
665 void HTMLDOMNode_Init(HTMLDocument
*,HTMLDOMNode
*,nsIDOMNode
*);
666 void HTMLElement_Init(HTMLElement
*);
667 void HTMLElement2_Init(HTMLElement
*);
668 void HTMLElement3_Init(HTMLElement
*);
669 void HTMLTextContainer_Init(HTMLTextContainer
*);
671 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
672 void HTMLDOMNode_destructor(HTMLDOMNode
*);
674 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
675 void HTMLElement_destructor(HTMLDOMNode
*);
677 HTMLDOMNode
*get_node(HTMLDocument
*,nsIDOMNode
*,BOOL
);
678 void release_nodes(HTMLDocument
*);
680 void release_script_hosts(HTMLWindow
*);
681 void connect_scripts(HTMLWindow
*);
682 void doc_insert_script(HTMLWindow
*,nsIDOMHTMLScriptElement
*);
683 IDispatch
*script_parse_event(HTMLWindow
*,LPCWSTR
);
684 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
685 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
686 IDispatch
*get_script_disp(ScriptHost
*);
688 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
689 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocument
*,IUnknown
*,nsIDOMNodeList
*);
690 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocument
*,IUnknown
*,nsIDOMHTMLCollection
*);
695 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
696 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
699 extern const cmdtable_t editmode_cmds
[];
701 void do_ns_command(HTMLDocument
*,const char*,nsICommandParams
*);
704 #define UPDATE_UI 0x0001
705 #define UPDATE_TITLE 0x0002
707 void update_doc(HTMLDocument
*This
, DWORD flags
);
708 void update_title(HTMLDocument
*);
711 void init_editor(HTMLDocument
*);
712 void set_ns_editmode(NSContainer
*);
713 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
714 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
715 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
716 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
717 void handle_edit_load(HTMLDocument
*);
718 HRESULT
editor_is_dirty(HTMLDocument
*);
719 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
721 extern DWORD mshtml_tls
;
723 typedef struct task_t
{
727 TASK_SETDOWNLOADSTATE
,
733 nsChannelBSC
*bscallback
;
740 task_t
*task_queue_head
;
741 task_t
*task_queue_tail
;
742 struct list timer_list
;
745 thread_data_t
*get_thread_data(BOOL
);
746 HWND
get_thread_hwnd(void);
747 void push_task(task_t
*);
748 void remove_doc_tasks(const HTMLDocument
*);
749 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
750 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
752 void release_typelib(void);
753 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*);
755 const char *debugstr_variant(const VARIANT
*);
757 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
758 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
759 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
760 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
761 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
763 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
765 /* memory allocation functions */
767 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
769 return HeapAlloc(GetProcessHeap(), 0, len
);
772 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
774 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
777 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
779 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
782 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
784 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
787 static inline BOOL
heap_free(void *mem
)
789 return HeapFree(GetProcessHeap(), 0, mem
);
792 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
799 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
800 ret
= heap_alloc(size
);
801 memcpy(ret
, str
, size
);
807 static inline char *heap_strdupA(const char *str
)
814 size
= strlen(str
)+1;
815 ret
= heap_alloc(size
);
816 memcpy(ret
, str
, size
);
822 static inline WCHAR
*heap_strdupAtoW(const char *str
)
829 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
830 ret
= heap_alloc(len
*sizeof(WCHAR
));
831 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
837 static inline char *heap_strdupWtoA(LPCWSTR str
)
842 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
843 ret
= heap_alloc(size
);
844 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
850 HINSTANCE
get_shdoclc(void);
852 extern HINSTANCE hInst
;