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_OK ((nsresult)0x00000000L)
38 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
39 #define NS_NOINTERFACE ((nsresult)0x80004002L)
40 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
41 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
42 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
43 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
45 #define NS_FAILED(res) ((res) & 0x80000000)
46 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
50 #define MSHTML_E_NODOC 0x800a025c
52 typedef struct HTMLDOMNode HTMLDOMNode;
53 typedef struct ConnectionPoint ConnectionPoint;
54 typedef struct BSCallback BSCallback;
55 typedef struct event_target_t event_target_t;
57 /* NOTE: make sure to keep in sync with dispex.c */
61 DispDOMChildrenCollection_tid,
62 DispHTMLAnchorElement_tid,
64 DispHTMLCommentElement_tid,
65 DispHTMLCurrentStyle_tid,
67 DispHTMLDOMTextNode_tid,
68 DispHTMLElementCollection_tid,
69 DispHTMLFormElement_tid,
70 DispHTMLGenericElement_tid,
71 DispHTMLFrameElement_tid,
74 DispHTMLInputElement_tid,
76 DispHTMLNavigator_tid,
77 DispHTMLOptionElement_tid,
79 DispHTMLScriptElement_tid,
80 DispHTMLSelectElement_tid,
84 DispHTMLUnknownElement_tid,
86 HTMLDocumentEvents_tid,
87 IHTMLAnchorElement_tid,
89 IHTMLBodyElement2_tid,
90 IHTMLCommentElement_tid,
91 IHTMLCurrentStyle_tid,
92 IHTMLCurrentStyle2_tid,
93 IHTMLCurrentStyle3_tid,
94 IHTMLCurrentStyle4_tid,
99 IHTMLDOMChildrenCollection_tid,
102 IHTMLDOMTextNode_tid,
107 IHTMLElementCollection_tid,
109 IHTMLFiltersCollection_tid,
110 IHTMLFormElement_tid,
113 IHTMLFrameElement3_tid,
114 IHTMLGenericElement_tid,
115 IHTMLIFrameElement_tid,
116 IHTMLImageElementFactory_tid,
118 IHTMLInputElement_tid,
120 IHTMLOptionElement_tid,
122 IHTMLScriptElement_tid,
123 IHTMLSelectElement_tid,
130 IHTMLTextContainer_tid,
139 typedef struct dispex_data_t dispex_data_t;
140 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
142 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
143 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
146 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
147 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
148 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
149 } dispex_static_data_vtbl_t;
152 const dispex_static_data_vtbl_t *vtbl;
153 const tid_t disp_tid;
155 const tid_t* const iface_tids;
156 } dispex_static_data_t;
159 const IDispatchExVtbl *lpIDispatchExVtbl;
163 dispex_static_data_t *data;
164 dispex_dynamic_data_t *dynamic_data;
167 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
168 void release_dispex(DispatchEx*);
169 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
170 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
171 HRESULT get_dispids(tid_t,DWORD*,DISPID**);
173 typedef struct HTMLDocumentNode HTMLDocumentNode;
174 typedef struct HTMLDocumentObj HTMLDocumentObj;
175 typedef struct HTMLFrameBase HTMLFrameBase;
179 SCRIPTMODE_ACTIVESCRIPT
182 typedef struct ScriptHost ScriptHost;
187 } global_prop_type_t;
190 global_prop_type_t type;
192 ScriptHost *script_host;
197 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
202 } HTMLOptionElementFactory;
206 const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl;
211 } HTMLImageElementFactory;
213 struct HTMLLocation {
215 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
229 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
230 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
231 const IHTMLWindow4Vtbl *lpHTMLWindow4Vtbl;
232 const IDispatchExVtbl *lpIDispatchExVtbl;
236 windowref_t *window_ref;
239 HTMLDocumentNode *doc;
240 HTMLDocumentObj *doc_obj;
241 nsIDOMWindow *nswindow;
243 HTMLFrameBase *frame_element;
244 READYSTATE readystate;
246 nsChannelBSC *bscallback;
250 IHTMLEventObj *event;
252 SCRIPTMODE scriptmode;
253 struct list script_hosts;
255 HTMLOptionElementFactory *option_factory;
256 HTMLImageElementFactory *image_factory;
257 HTMLLocation *location;
260 global_prop_t *global_props;
261 DWORD global_prop_cnt;
262 DWORD global_prop_size;
264 struct list children;
265 struct list sibling_entry;
275 typedef struct _cp_static_data_t {
277 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
282 typedef struct ConnectionPointContainer {
283 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
285 ConnectionPoint *cp_list;
287 struct ConnectionPointContainer *forward_container;
288 } ConnectionPointContainer;
290 struct ConnectionPoint {
291 const IConnectionPointVtbl *lpConnectionPointVtbl;
293 ConnectionPointContainer *container;
298 IPropertyNotifySink *propnotif;
303 cp_static_data_t *data;
305 ConnectionPoint *next;
308 struct HTMLDocument {
309 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
310 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
311 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
312 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
313 const IHTMLDocument6Vtbl *lpHTMLDocument6Vtbl;
314 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
315 const IPersistFileVtbl *lpPersistFileVtbl;
316 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
317 const IMonikerPropVtbl *lpMonikerPropVtbl;
318 const IOleObjectVtbl *lpOleObjectVtbl;
319 const IOleDocumentVtbl *lpOleDocumentVtbl;
320 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
321 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
322 const IViewObjectExVtbl *lpViewObjectExVtbl;
323 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
324 const IServiceProviderVtbl *lpServiceProviderVtbl;
325 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
326 const IOleControlVtbl *lpOleControlVtbl;
327 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
328 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
329 const IDispatchExVtbl *lpIDispatchExVtbl;
330 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
331 const IObjectWithSiteVtbl *lpObjectWithSiteVtbl;
336 HTMLDocumentObj *doc_obj;
337 HTMLDocumentNode *doc_node;
343 ConnectionPointContainer cp_container;
344 ConnectionPoint cp_htmldocevents;
345 ConnectionPoint cp_htmldocevents2;
346 ConnectionPoint cp_propnotif;
347 ConnectionPoint cp_dispatch;
349 IOleAdviseHolder *advise_holder;
352 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
354 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
357 static inline ULONG htmldoc_addref(HTMLDocument *This)
359 return IUnknown_AddRef(This->unk_impl);
362 static inline ULONG htmldoc_release(HTMLDocument *This)
364 return IUnknown_Release(This->unk_impl);
367 struct HTMLDocumentObj {
368 HTMLDocument basedoc;
370 const ICustomDocVtbl *lpCustomDocVtbl;
374 NSContainer *nscontainer;
376 IOleClientSite *client;
377 IDocHostUIHandler *hostui;
378 IOleInPlaceSite *ipsite;
379 IOleInPlaceFrame *frame;
380 IOleInPlaceUIWindow *ip_window;
382 DOCHOSTUIINFO hostinfo;
384 IOleUndoManager *undomgr;
389 BOOL request_uiactivate;
390 BOOL in_place_active;
394 BOOL container_locked;
405 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
406 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
407 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
408 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
409 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
410 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
411 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
412 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
414 nsIWebBrowser *webbrowser;
415 nsIWebNavigation *navigation;
416 nsIBaseWindow *window;
417 nsIWebBrowserFocus *focus;
420 nsIController *editor_controller;
425 HTMLDocumentObj *doc;
427 nsIURIContentListener *content_listener;
431 HWND reset_focus; /* hack */
435 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
436 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
437 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
442 nsIInputStream *post_data_stream;
443 nsILoadGroup *load_group;
444 nsIInterfaceRequestor *notif_callback;
446 nsLoadFlags load_flags;
447 nsIURI *original_uri;
450 PRUint32 response_status;
455 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
456 void (*destructor)(HTMLDOMNode*);
457 event_target_t **(*get_event_target)(HTMLDOMNode*);
458 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
459 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
460 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
461 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
462 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
463 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
464 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
465 HRESULT (*bind_to_tree)(HTMLDOMNode*);
470 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
471 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
472 const NodeImplVtbl *vtbl;
477 HTMLDocumentNode *doc;
478 event_target_t *event_target;
479 ConnectionPointContainer *cp_container;
486 ConnectionPointContainer cp_container;
488 const IHTMLElementVtbl *lpHTMLElementVtbl;
489 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
490 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
492 nsIDOMHTMLElement *nselem;
495 #define HTMLELEMENT_TIDS \
506 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
511 struct HTMLFrameBase {
514 const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
515 const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
517 HTMLWindow *content_window;
519 nsIDOMHTMLFrameElement *nsframe;
520 nsIDOMHTMLIFrameElement *nsiframe;
523 typedef struct _mutation_queue_t {
525 nsISupports *nsiface;
527 struct _mutation_queue_t *next;
530 typedef struct nsDocumentEventListener nsDocumentEventListener;
532 struct HTMLDocumentNode {
534 HTMLDocument basedoc;
536 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
538 const nsIDocumentObserverVtbl *lpIDocumentObserverVtbl;
539 const nsIRunnableVtbl *lpIRunnableVtbl;
543 nsIDOMHTMLDocument *nsdoc;
546 event_target_t *body_event_target;
548 IInternetSecurityManager *secmgr;
549 ICatInformation *catmgr;
550 nsDocumentEventListener *nsevent_listener;
553 mutation_queue_t *mutation_queue;
554 mutation_queue_t *mutation_queue_tail;
556 struct list bindings;
557 struct list selection_list;
558 struct list range_list;
561 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
562 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
563 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
565 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
566 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
567 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
568 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
569 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
570 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
571 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
572 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
573 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
574 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
575 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
576 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
577 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
578 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
579 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
580 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
581 #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)
582 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
583 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
584 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
585 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
586 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
587 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
588 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
589 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
590 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
591 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
592 #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)
594 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
595 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
596 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
597 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
598 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
599 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
600 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
601 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
602 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
604 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
606 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
608 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
609 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
610 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
611 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
613 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
614 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
615 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
617 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
618 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
619 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
620 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
621 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
623 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
624 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
625 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
627 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
628 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
629 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
631 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
633 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
635 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
637 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
638 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
640 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
641 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
642 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
644 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**);
645 void update_window_doc(HTMLWindow*);
646 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
647 nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*);
648 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
649 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*);
650 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
651 IOmNavigator *OmNavigator_Create(void);
652 HRESULT HTMLScreen_Create(IHTMLScreen**);
654 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
655 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
656 void HTMLDocument_Persist_Init(HTMLDocument*);
657 void HTMLDocument_OleCmd_Init(HTMLDocument*);
658 void HTMLDocument_OleObj_Init(HTMLDocument*);
659 void HTMLDocument_View_Init(HTMLDocument*);
660 void HTMLDocument_Window_Init(HTMLDocument*);
661 void HTMLDocument_Service_Init(HTMLDocument*);
662 void HTMLDocument_Hlink_Init(HTMLDocument*);
664 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
666 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
668 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*);
669 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
670 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
672 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
673 void NSContainer_Release(NSContainer*);
675 void init_mutation(HTMLDocumentNode*);
676 void release_mutation(HTMLDocumentNode*);
678 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
679 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
680 void notif_focus(HTMLDocumentObj*);
682 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
683 void hide_tooltip(HTMLDocumentObj*);
684 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
686 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
688 BOOL load_gecko(BOOL);
689 void close_gecko(void);
690 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
691 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
692 void release_nsio(void);
693 BOOL install_wine_gecko(BOOL);
695 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
696 HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsIWineURI**);
698 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD);
699 HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);
700 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*);
701 HRESULT load_nsuri(HTMLWindow*,nsIWineURI*,DWORD);
703 void call_property_onchanged(ConnectionPoint*,DISPID);
704 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
706 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
709 void nsACString_SetData(nsACString*,const char*);
710 PRUint32 nsACString_GetData(const nsACString*,const char**);
712 void nsAString_Init(nsAString*,const PRUnichar*);
713 void nsAString_SetData(nsAString*,const PRUnichar*);
714 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
715 void nsAString_Finish(nsAString*);
717 nsICommandParams *create_nscommand_params(void);
718 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
719 void get_editor_controller(NSContainer*);
720 nsresult get_nsinterface(nsISupports*,REFIID,void**);
722 void init_nsevents(HTMLDocumentNode*);
723 void release_nsevents(HTMLDocumentNode*);
724 void add_nsevent_listener(HTMLDocumentNode*,LPCWSTR);
726 void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
727 void set_current_mon(HTMLWindow*,IMoniker*);
728 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
729 void abort_document_bindings(HTMLDocumentNode*);
731 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);
733 nsChannelBSC *create_channelbsc(IMoniker*);
734 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
735 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
736 IMoniker *get_channelbsc_mon(nsChannelBSC*);
738 void set_ready_state(HTMLWindow*,READYSTATE);
740 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
741 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
742 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
743 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
744 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
746 void detach_selection(HTMLDocumentNode*);
747 void detach_ranges(HTMLDocumentNode*);
748 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
750 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
752 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
754 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
755 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
756 HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
757 HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
758 HTMLElement *HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
759 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
760 HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
761 HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
762 HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
763 HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
764 HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
765 HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
766 HTMLElement *HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
767 HTMLElement *HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
768 HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
769 HTMLElement *HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
771 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
772 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
773 void HTMLElement2_Init(HTMLElement*);
774 void HTMLElement3_Init(HTMLElement*);
775 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
776 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
778 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
779 void HTMLDOMNode_destructor(HTMLDOMNode*);
781 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
782 void HTMLElement_destructor(HTMLDOMNode*);
784 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
785 void HTMLFrameBase_destructor(HTMLFrameBase*);
787 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
788 void release_nodes(HTMLDocumentNode*);
790 void release_script_hosts(HTMLWindow*);
791 void connect_scripts(HTMLWindow*);
792 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
793 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
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 set_ns_editmode(NSContainer*);
824 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
825 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
826 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
827 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
828 void handle_edit_load(HTMLDocument*);
829 HRESULT editor_is_dirty(HTMLDocument*);
830 void set_dirty(HTMLDocument*,VARIANT_BOOL);
832 extern DWORD mshtml_tls;
834 typedef struct task_t task_t;
835 typedef void (*task_proc_t)(task_t*);
845 HTMLDocumentObj *doc;
850 task_t *task_queue_head;
851 task_t *task_queue_tail;
852 struct list timer_list;
855 thread_data_t *get_thread_data(BOOL);
856 HWND get_thread_hwnd(void);
858 LONG get_task_target_magic(void);
859 void push_task(task_t*,task_proc_t,LONG);
860 void remove_target_tasks(LONG);
862 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
863 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
865 void release_typelib(void);
866 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
868 const char *debugstr_variant(const VARIANT*);
870 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
871 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
872 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
873 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
874 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
876 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
878 /* memory allocation functions */
880 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
882 return HeapAlloc(GetProcessHeap(), 0, len);
885 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
887 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
890 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
892 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
895 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
897 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
900 static inline BOOL heap_free(void *mem)
902 return HeapFree(GetProcessHeap(), 0, mem);
905 static inline LPWSTR heap_strdupW(LPCWSTR str)
912 size = (strlenW(str)+1)*sizeof(WCHAR);
913 ret = heap_alloc(size);
914 memcpy(ret, str, size);
920 static inline char *heap_strdupA(const char *str)
927 size = strlen(str)+1;
928 ret = heap_alloc(size);
929 memcpy(ret, str, size);
935 static inline WCHAR *heap_strdupAtoW(const char *str)
942 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
943 ret = heap_alloc(len*sizeof(WCHAR));
944 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
950 static inline char *heap_strdupWtoA(LPCWSTR str)
955 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
956 ret = heap_alloc(size);
957 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
963 static inline void windowref_addref(windowref_t *ref)
965 InterlockedIncrement(&ref->ref);
968 static inline void windowref_release(windowref_t *ref)
970 if(!InterlockedDecrement(&ref->ref))
974 HDC get_display_dc(void);
975 HINSTANCE get_shdoclc(void);
977 extern HINSTANCE hInst;