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
;
160 SCRIPTMODE_ACTIVESCRIPT
163 typedef struct ScriptHost ScriptHost
;
167 ScriptHost
*script_host
;
172 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
177 } HTMLOptionElementFactory
;
179 struct HTMLLocation
{
181 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
190 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
191 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
192 const IDispatchExVtbl
*lpIDispatchExVtbl
;
197 nsIDOMWindow
*nswindow
;
199 event_target_t
*event_target
;
200 IHTMLEventObj
*event
;
203 SCRIPTMODE scriptmode
;
204 struct list script_hosts
;
206 HTMLOptionElementFactory
*option_factory
;
207 HTMLLocation
*location
;
209 global_prop_t
*global_props
;
210 DWORD global_prop_cnt
;
211 DWORD global_prop_size
;
223 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
225 ConnectionPoint
*cp_list
;
227 } ConnectionPointContainer
;
229 struct ConnectionPoint
{
230 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
232 IConnectionPointContainer
*container
;
237 IPropertyNotifySink
*propnotif
;
243 ConnectionPoint
*next
;
247 HRESULT (*query_interface
)(HTMLDocument
*,REFIID
,void**);
248 ULONG (*addref
)(HTMLDocument
*);
249 ULONG (*release
)(HTMLDocument
*);
252 struct HTMLDocument
{
254 const htmldoc_vtbl_t
*vtbl
;
255 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
256 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
257 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
258 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
259 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
260 const IPersistFileVtbl
*lpPersistFileVtbl
;
261 const IPersistHistoryVtbl
*lpPersistHistoryVtbl
;
262 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
263 const IOleObjectVtbl
*lpOleObjectVtbl
;
264 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
265 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
266 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
267 const IViewObject2Vtbl
*lpViewObject2Vtbl
;
268 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
269 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
270 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
271 const IOleControlVtbl
*lpOleControlVtbl
;
272 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
273 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
274 const ICustomDocVtbl
*lpCustomDocVtbl
;
275 const IDispatchExVtbl
*lpIDispatchExVtbl
;
276 const ISupportErrorInfoVtbl
*lpSupportErrorInfoVtbl
;
278 NSContainer
*nscontainer
;
280 nsIDOMHTMLDocument
*nsdoc
;
282 IOleClientSite
*client
;
283 IDocHostUIHandler
*hostui
;
284 IOleInPlaceSite
*ipsite
;
285 IOleInPlaceFrame
*frame
;
286 IOleInPlaceUIWindow
*ip_window
;
288 IOleUndoManager
*undomgr
;
290 nsChannelBSC
*bscallback
;
293 struct list bindings
;
298 DOCHOSTUIINFO hostinfo
;
301 READYSTATE readystate
;
302 BOOL in_place_active
;
306 BOOL container_locked
;
312 event_target_t
*event_target
;
313 ConnectionPointContainer cp_container
;
314 ConnectionPoint cp_htmldocevents
;
315 ConnectionPoint cp_htmldocevents2
;
316 ConnectionPoint cp_propnotif
;
318 struct list selection_list
;
319 struct list range_list
;
324 static inline HRESULT
htmldoc_query_interface(HTMLDocument
*This
, REFIID riid
, void **ppv
)
326 return This
->vtbl
->query_interface(This
, riid
, ppv
);
329 static inline ULONG
htmldoc_addref(HTMLDocument
*This
)
331 return This
->vtbl
->addref(This
);
334 static inline ULONG
htmldoc_release(HTMLDocument
*This
)
336 return This
->vtbl
->release(This
);
340 HTMLDocument basedoc
;
346 HTMLDocument basedoc
;
352 const nsIDOMEventListenerVtbl
*lpDOMEventListenerVtbl
;
356 typedef struct _mutation_queue_t
{
358 nsISupports
*nsiface
;
360 struct _mutation_queue_t
*next
;
364 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
365 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
366 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
367 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
368 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
369 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
370 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
371 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
373 const nsIDocumentObserverVtbl
*lpDocumentObserverVtbl
;
375 const nsIRunnableVtbl
*lpRunnableVtbl
;
377 nsEventListener blur_listener
;
378 nsEventListener focus_listener
;
379 nsEventListener keypress_listener
;
380 nsEventListener load_listener
;
381 nsEventListener htmlevent_listener
;
383 nsIWebBrowser
*webbrowser
;
384 nsIWebNavigation
*navigation
;
385 nsIBaseWindow
*window
;
386 nsIWebBrowserFocus
*focus
;
389 nsIController
*editor_controller
;
396 nsIURIContentListener
*content_listener
;
400 mutation_queue_t
*mutation_queue
;
401 mutation_queue_t
*mutation_queue_tail
;
403 nsChannelBSC
*bscallback
; /* hack */
404 HWND reset_focus
; /* hack */
408 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
409 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
410 const nsIHttpChannelInternalVtbl
*lpIHttpChannelInternalVtbl
;
415 nsIHttpChannel
*http_channel
;
416 nsIHttpChannelInternal
*http_channel_internal
;
418 nsIInputStream
*post_data_stream
;
419 nsILoadGroup
*load_group
;
420 nsIInterfaceRequestor
*notif_callback
;
422 nsLoadFlags load_flags
;
423 nsIURI
*original_uri
;
426 PRUint32 response_status
;
430 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
431 void (*destructor
)(HTMLDOMNode
*);
432 event_target_t
**(*get_event_target
)(HTMLDOMNode
*);
433 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
434 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
439 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
440 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
441 const NodeImplVtbl
*vtbl
;
447 event_target_t
*event_target
;
454 ConnectionPointContainer cp_container
;
456 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
457 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
458 const IHTMLElement3Vtbl
*lpHTMLElement3Vtbl
;
460 nsIDOMHTMLElement
*nselem
;
466 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
471 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
472 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
474 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
475 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
476 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
477 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
478 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
479 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
480 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
481 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
482 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
483 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
484 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
485 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
486 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
487 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
488 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
489 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
490 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
491 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
492 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
493 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
494 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
495 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
496 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
497 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
498 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
500 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
501 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
502 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
503 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
504 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
505 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
506 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
507 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
508 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
510 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
512 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
514 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
515 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
516 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
517 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
519 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
520 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
521 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
523 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
524 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
525 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
526 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
527 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
529 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
531 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
532 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
534 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
536 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
538 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
539 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
541 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
542 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
543 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLWindow
*,HTMLDocumentNode
**);
545 HRESULT
HTMLWindow_Create(nsIDOMWindow
*,HTMLWindow
**);
546 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
547 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLWindow
*);
548 HRESULT
HTMLLocation_Create(HTMLWindow
*,HTMLLocation
**);
549 IOmNavigator
*OmNavigator_Create(void);
551 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
552 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
553 void HTMLDocument_Persist_Init(HTMLDocument
*);
554 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
555 void HTMLDocument_OleObj_Init(HTMLDocument
*);
556 void HTMLDocument_View_Init(HTMLDocument
*);
557 void HTMLDocument_Window_Init(HTMLDocument
*);
558 void HTMLDocument_Service_Init(HTMLDocument
*);
559 void HTMLDocument_Hlink_Init(HTMLDocument
*);
561 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
563 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
);
564 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
565 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
567 NSContainer
*NSContainer_Create(HTMLDocument
*,NSContainer
*);
568 void NSContainer_Release(NSContainer
*);
570 void init_mutation(NSContainer
*);
571 void set_mutation_observer(NSContainer
*,nsIDOMHTMLDocument
*);
572 void remove_mutation_observer(NSContainer
*,nsIDOMHTMLDocument
*);
574 void HTMLDocument_LockContainer(HTMLDocument
*,BOOL
);
575 void show_context_menu(HTMLDocument
*,DWORD
,POINT
*,IDispatch
*);
576 void notif_focus(HTMLDocument
*);
578 void show_tooltip(HTMLDocument
*,DWORD
,DWORD
,LPCWSTR
);
579 void hide_tooltip(HTMLDocument
*);
580 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
582 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
584 BOOL
load_gecko(BOOL
);
585 void close_gecko(void);
586 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
587 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
588 void release_nsio(void);
589 BOOL
install_wine_gecko(BOOL
);
591 HRESULT
nsuri_to_url(LPCWSTR
,BOOL
,BSTR
*);
593 void hlink_frame_navigate(HTMLDocument
*,IHlinkFrame
*,LPCWSTR
,nsIInputStream
*,DWORD
);
595 void call_property_onchanged(ConnectionPoint
*,DISPID
);
596 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
598 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
601 void nsACString_Init(nsACString
*,const char*);
602 void nsACString_SetData(nsACString
*,const char*);
603 PRUint32
nsACString_GetData(const nsACString
*,const char**);
604 void nsACString_Finish(nsACString
*);
606 void nsAString_Init(nsAString
*,const PRUnichar
*);
607 void nsAString_SetData(nsAString
*,const PRUnichar
*);
608 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
609 void nsAString_Finish(nsAString
*);
611 nsICommandParams
*create_nscommand_params(void);
612 HRESULT
nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
613 void get_editor_controller(NSContainer
*);
614 void init_nsevents(NSContainer
*);
615 void add_nsevent_listener(HTMLWindow
*,LPCWSTR
);
616 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
617 void update_nsdocument(HTMLDocument
*);
619 void set_document_bscallback(HTMLDocument
*,nsChannelBSC
*);
620 void set_current_mon(HTMLDocument
*,IMoniker
*);
621 HRESULT
start_binding(HTMLDocument
*,BSCallback
*,IBindCtx
*);
623 HRESULT
bind_mon_to_buffer(HTMLDocument
*,IMoniker
*,void**,DWORD
*);
625 nsChannelBSC
*create_channelbsc(IMoniker
*);
626 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
627 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
628 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
630 IHTMLSelectionObject
*HTMLSelectionObject_Create(HTMLDocument
*,nsISelection
*);
631 IHTMLTxtRange
*HTMLTxtRange_Create(HTMLDocument
*,nsIDOMRange
*);
632 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
633 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
634 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
636 void detach_selection(HTMLDocument
*);
637 void detach_ranges(HTMLDocument
*);
638 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
640 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocument
*,nsIDOMNode
*);
642 HTMLElement
*HTMLElement_Create(HTMLDocument
*,nsIDOMNode
*,BOOL
);
643 HTMLElement
*HTMLCommentElement_Create(HTMLDocument
*,nsIDOMNode
*);
644 HTMLElement
*HTMLAnchorElement_Create(nsIDOMHTMLElement
*);
645 HTMLElement
*HTMLBodyElement_Create(nsIDOMHTMLElement
*);
646 HTMLElement
*HTMLIFrame_Create(nsIDOMHTMLElement
*);
647 HTMLElement
*HTMLImgElement_Create(nsIDOMHTMLElement
*);
648 HTMLElement
*HTMLInputElement_Create(nsIDOMHTMLElement
*);
649 HTMLElement
*HTMLOptionElement_Create(nsIDOMHTMLElement
*);
650 HTMLElement
*HTMLScriptElement_Create(nsIDOMHTMLElement
*);
651 HTMLElement
*HTMLSelectElement_Create(nsIDOMHTMLElement
*);
652 HTMLElement
*HTMLTable_Create(nsIDOMHTMLElement
*);
653 HTMLElement
*HTMLTableRow_Create(nsIDOMHTMLElement
*);
654 HTMLElement
*HTMLTextAreaElement_Create(nsIDOMHTMLElement
*);
655 HTMLElement
*HTMLGenericElement_Create(nsIDOMHTMLElement
*);
657 void HTMLDOMNode_Init(HTMLDocument
*,HTMLDOMNode
*,nsIDOMNode
*);
658 void HTMLElement_Init(HTMLElement
*);
659 void HTMLElement2_Init(HTMLElement
*);
660 void HTMLElement3_Init(HTMLElement
*);
661 void HTMLTextContainer_Init(HTMLTextContainer
*);
663 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
664 void HTMLDOMNode_destructor(HTMLDOMNode
*);
666 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
667 void HTMLElement_destructor(HTMLDOMNode
*);
669 HTMLDOMNode
*get_node(HTMLDocument
*,nsIDOMNode
*,BOOL
);
670 void release_nodes(HTMLDocument
*);
672 void release_script_hosts(HTMLWindow
*);
673 void connect_scripts(HTMLWindow
*);
674 void doc_insert_script(HTMLDocument
*,nsIDOMHTMLScriptElement
*);
675 IDispatch
*script_parse_event(HTMLDocument
*,LPCWSTR
);
676 void set_script_mode(HTMLWindow
*,SCRIPTMODE
);
677 BOOL
find_global_prop(HTMLWindow
*,BSTR
,DWORD
,ScriptHost
**,DISPID
*);
678 IDispatch
*get_script_disp(ScriptHost
*);
680 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
681 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocument
*,IUnknown
*,nsIDOMNodeList
*);
682 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocument
*,IUnknown
*,nsIDOMHTMLCollection
*);
687 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
688 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
691 extern const cmdtable_t editmode_cmds
[];
693 void do_ns_command(NSContainer
*,const char*,nsICommandParams
*);
696 #define UPDATE_UI 0x0001
697 #define UPDATE_TITLE 0x0002
699 void update_doc(HTMLDocument
*This
, DWORD flags
);
700 void update_title(HTMLDocument
*);
703 void init_editor(HTMLDocument
*);
704 void set_ns_editmode(NSContainer
*);
705 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
706 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
707 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
708 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
709 void handle_edit_load(HTMLDocument
*);
710 HRESULT
editor_is_dirty(HTMLDocument
*);
711 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
713 extern DWORD mshtml_tls
;
715 typedef struct task_t
{
719 TASK_SETDOWNLOADSTATE
,
725 nsChannelBSC
*bscallback
;
732 task_t
*task_queue_head
;
733 task_t
*task_queue_tail
;
734 struct list timer_list
;
737 thread_data_t
*get_thread_data(BOOL
);
738 HWND
get_thread_hwnd(void);
739 void push_task(task_t
*);
740 void remove_doc_tasks(const HTMLDocument
*);
741 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
742 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
744 void release_typelib(void);
745 HRESULT
call_disp_func(IDispatch
*,DISPPARAMS
*);
747 const char *debugstr_variant(const VARIANT
*);
749 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
750 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
751 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
752 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
753 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
755 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
757 /* memory allocation functions */
759 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
761 return HeapAlloc(GetProcessHeap(), 0, len
);
764 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
766 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
769 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
771 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
774 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
776 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
779 static inline BOOL
heap_free(void *mem
)
781 return HeapFree(GetProcessHeap(), 0, mem
);
784 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
791 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
792 ret
= heap_alloc(size
);
793 memcpy(ret
, str
, size
);
799 static inline char *heap_strdupA(const char *str
)
806 size
= strlen(str
)+1;
807 ret
= heap_alloc(size
);
808 memcpy(ret
, str
, size
);
814 static inline WCHAR
*heap_strdupAtoW(const char *str
)
821 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
822 ret
= heap_alloc(len
*sizeof(WCHAR
));
823 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
829 static inline char *heap_strdupWtoA(LPCWSTR str
)
834 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
835 ret
= heap_alloc(size
);
836 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
842 HINSTANCE
get_shdoclc(void);
844 extern HINSTANCE hInst
;