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_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
40 #define NS_NOINTERFACE ((nsresult)0x80004002L)
41 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
42 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
43 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
44 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
45 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
47 #define NS_FAILED(res) ((res) & 0x80000000)
48 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
52 #define MSHTML_E_NODOC 0x800a025c
54 typedef struct HTMLDOMNode HTMLDOMNode;
55 typedef struct ConnectionPoint ConnectionPoint;
56 typedef struct BSCallback BSCallback;
57 typedef struct event_target_t event_target_t;
59 /* NOTE: make sure to keep in sync with dispex.c */
63 DispDOMChildrenCollection_tid,
64 DispHTMLAnchorElement_tid,
66 DispHTMLCommentElement_tid,
67 DispHTMLCurrentStyle_tid,
69 DispHTMLDOMTextNode_tid,
70 DispHTMLElementCollection_tid,
71 DispHTMLFormElement_tid,
72 DispHTMLGenericElement_tid,
73 DispHTMLFrameElement_tid,
76 DispHTMLInputElement_tid,
78 DispHTMLNavigator_tid,
79 DispHTMLOptionElement_tid,
81 DispHTMLScriptElement_tid,
82 DispHTMLSelectElement_tid,
86 DispHTMLTextAreaElement_tid,
87 DispHTMLUnknownElement_tid,
89 HTMLDocumentEvents_tid,
90 IHTMLAnchorElement_tid,
92 IHTMLBodyElement2_tid,
93 IHTMLCommentElement_tid,
94 IHTMLCurrentStyle_tid,
95 IHTMLCurrentStyle2_tid,
96 IHTMLCurrentStyle3_tid,
97 IHTMLCurrentStyle4_tid,
102 IHTMLDOMChildrenCollection_tid,
105 IHTMLDOMTextNode_tid,
110 IHTMLElementCollection_tid,
112 IHTMLFiltersCollection_tid,
113 IHTMLFormElement_tid,
116 IHTMLFrameElement3_tid,
117 IHTMLGenericElement_tid,
118 IHTMLIFrameElement_tid,
119 IHTMLImageElementFactory_tid,
121 IHTMLInputElement_tid,
123 IHTMLOptionElement_tid,
126 IHTMLScriptElement_tid,
127 IHTMLSelectElement_tid,
134 IHTMLTextAreaElement_tid,
135 IHTMLTextContainer_tid,
144 typedef struct dispex_data_t dispex_data_t;
145 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
147 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
148 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
149 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
152 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
153 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
154 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
155 } dispex_static_data_vtbl_t;
158 const dispex_static_data_vtbl_t *vtbl;
159 const tid_t disp_tid;
161 const tid_t* const iface_tids;
162 } dispex_static_data_t;
165 const IDispatchExVtbl *lpIDispatchExVtbl;
169 dispex_static_data_t *data;
170 dispex_dynamic_data_t *dynamic_data;
173 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
174 void release_dispex(DispatchEx*);
175 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
176 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
177 HRESULT get_dispids(tid_t,DWORD*,DISPID**);
178 HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*);
180 typedef struct HTMLWindow HTMLWindow;
181 typedef struct HTMLDocumentNode HTMLDocumentNode;
182 typedef struct HTMLDocumentObj HTMLDocumentObj;
183 typedef struct HTMLFrameBase HTMLFrameBase;
184 typedef struct NSContainer NSContainer;
188 SCRIPTMODE_ACTIVESCRIPT
191 typedef struct ScriptHost ScriptHost;
196 } global_prop_type_t;
199 global_prop_type_t type;
201 ScriptHost *script_host;
206 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
211 } HTMLOptionElementFactory;
215 const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl;
220 } HTMLImageElementFactory;
222 struct HTMLLocation {
224 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
236 typedef struct nsChannelBSC nsChannelBSC;
240 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
241 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
242 const IHTMLWindow4Vtbl *lpHTMLWindow4Vtbl;
243 const IHTMLPrivateWindowVtbl *lpIHTMLPrivateWindowVtbl;
244 const IDispatchExVtbl *lpIDispatchExVtbl;
248 windowref_t *window_ref;
251 HTMLDocumentNode *doc;
252 HTMLDocumentObj *doc_obj;
253 nsIDOMWindow *nswindow;
255 HTMLFrameBase *frame_element;
256 READYSTATE readystate;
258 nsChannelBSC *bscallback;
262 IHTMLEventObj *event;
264 SCRIPTMODE scriptmode;
265 struct list script_hosts;
267 HTMLOptionElementFactory *option_factory;
268 HTMLImageElementFactory *image_factory;
269 HTMLLocation *location;
272 global_prop_t *global_props;
273 DWORD global_prop_cnt;
274 DWORD global_prop_size;
276 struct list children;
277 struct list sibling_entry;
287 typedef struct _cp_static_data_t {
289 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
294 typedef struct ConnectionPointContainer {
295 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
297 ConnectionPoint *cp_list;
299 struct ConnectionPointContainer *forward_container;
300 } ConnectionPointContainer;
302 struct ConnectionPoint {
303 const IConnectionPointVtbl *lpConnectionPointVtbl;
305 ConnectionPointContainer *container;
310 IPropertyNotifySink *propnotif;
315 cp_static_data_t *data;
317 ConnectionPoint *next;
320 struct HTMLDocument {
321 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
322 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
323 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
324 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
325 const IHTMLDocument6Vtbl *lpHTMLDocument6Vtbl;
326 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
327 const IPersistFileVtbl *lpPersistFileVtbl;
328 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
329 const IMonikerPropVtbl *lpMonikerPropVtbl;
330 const IOleObjectVtbl *lpOleObjectVtbl;
331 const IOleDocumentVtbl *lpOleDocumentVtbl;
332 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
333 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
334 const IViewObjectExVtbl *lpViewObjectExVtbl;
335 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
336 const IServiceProviderVtbl *lpServiceProviderVtbl;
337 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
338 const IOleControlVtbl *lpOleControlVtbl;
339 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
340 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
341 const IDispatchExVtbl *lpIDispatchExVtbl;
342 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
343 const IObjectWithSiteVtbl *lpObjectWithSiteVtbl;
348 HTMLDocumentObj *doc_obj;
349 HTMLDocumentNode *doc_node;
355 ConnectionPointContainer cp_container;
356 ConnectionPoint cp_htmldocevents;
357 ConnectionPoint cp_htmldocevents2;
358 ConnectionPoint cp_propnotif;
359 ConnectionPoint cp_dispatch;
361 IOleAdviseHolder *advise_holder;
364 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
366 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
369 static inline ULONG htmldoc_addref(HTMLDocument *This)
371 return IUnknown_AddRef(This->unk_impl);
374 static inline ULONG htmldoc_release(HTMLDocument *This)
376 return IUnknown_Release(This->unk_impl);
379 struct HTMLDocumentObj {
380 HTMLDocument basedoc;
382 const ICustomDocVtbl *lpCustomDocVtbl;
386 NSContainer *nscontainer;
388 IOleClientSite *client;
389 IDocHostUIHandler *hostui;
390 IOleInPlaceSite *ipsite;
391 IOleInPlaceFrame *frame;
392 IOleInPlaceUIWindow *ip_window;
393 IAdviseSink *view_sink;
395 DOCHOSTUIINFO hostinfo;
397 IOleUndoManager *undomgr;
402 BOOL request_uiactivate;
403 BOOL in_place_active;
407 BOOL container_locked;
418 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
419 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
420 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
421 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
422 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
423 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
424 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
425 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
427 nsIWebBrowser *webbrowser;
428 nsIWebNavigation *navigation;
429 nsIBaseWindow *window;
430 nsIWebBrowserFocus *focus;
433 nsIController *editor_controller;
438 HTMLDocumentObj *doc;
440 nsIURIContentListener *content_listener;
445 typedef struct nsWineURI nsWineURI;
447 HRESULT set_wine_url(nsWineURI*,LPCWSTR);
448 nsresult on_start_uri_open(NSContainer*,nsIURI*,PRBool*);
450 /* Keep sync with request_method_strings in nsio.c */
458 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
459 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
460 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
465 nsIInputStream *post_data_stream;
467 nsILoadGroup *load_group;
468 nsIInterfaceRequestor *notif_callback;
470 nsLoadFlags load_flags;
471 nsIURI *original_uri;
475 PRUint32 response_status;
476 REQUEST_METHOD request_method;
477 struct list response_headers;
478 struct list request_headers;
488 HRESULT set_http_header(struct list*,const WCHAR*,int,const WCHAR*,int);
491 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
492 void (*destructor)(HTMLDOMNode*);
493 event_target_t **(*get_event_target)(HTMLDOMNode*);
494 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
495 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
496 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
497 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
498 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
499 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
500 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
501 HRESULT (*bind_to_tree)(HTMLDOMNode*);
506 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
507 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
508 const NodeImplVtbl *vtbl;
513 HTMLDocumentNode *doc;
514 event_target_t *event_target;
515 ConnectionPointContainer *cp_container;
522 ConnectionPointContainer cp_container;
524 const IHTMLElementVtbl *lpHTMLElementVtbl;
525 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
526 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
528 nsIDOMHTMLElement *nselem;
531 #define HTMLELEMENT_TIDS \
542 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
547 struct HTMLFrameBase {
550 const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
551 const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
553 HTMLWindow *content_window;
555 nsIDOMHTMLFrameElement *nsframe;
556 nsIDOMHTMLIFrameElement *nsiframe;
559 typedef struct _mutation_queue_t {
561 nsISupports *nsiface;
563 struct _mutation_queue_t *next;
566 typedef struct nsDocumentEventListener nsDocumentEventListener;
568 struct HTMLDocumentNode {
570 HTMLDocument basedoc;
572 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
574 const nsIDocumentObserverVtbl *lpIDocumentObserverVtbl;
575 const nsIRunnableVtbl *lpIRunnableVtbl;
579 nsIDOMHTMLDocument *nsdoc;
582 event_target_t *body_event_target;
584 IInternetSecurityManager *secmgr;
585 ICatInformation *catmgr;
586 nsDocumentEventListener *nsevent_listener;
589 mutation_queue_t *mutation_queue;
590 mutation_queue_t *mutation_queue_tail;
592 struct list bindings;
593 struct list selection_list;
594 struct list range_list;
597 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
598 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
599 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
601 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
602 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
603 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
604 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
605 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
606 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
607 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
608 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
609 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
610 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
611 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
612 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
613 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
614 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
615 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
616 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
617 #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)
618 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
619 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
620 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
621 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
622 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
623 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
624 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
625 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
626 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
627 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
628 #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)
630 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
631 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
632 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
633 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
634 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
635 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
636 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
637 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
638 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
640 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
642 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
644 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
645 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
646 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
647 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
649 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
650 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
651 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
653 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
654 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
655 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
656 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
657 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
659 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
660 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
661 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
663 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
664 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
665 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
667 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
669 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
671 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
673 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
674 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
676 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
677 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
678 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
680 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**);
681 void update_window_doc(HTMLWindow*);
682 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
683 nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*);
684 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
685 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*);
686 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
687 IOmNavigator *OmNavigator_Create(void);
688 HRESULT HTMLScreen_Create(IHTMLScreen**);
690 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
691 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
692 void HTMLDocument_Persist_Init(HTMLDocument*);
693 void HTMLDocument_OleCmd_Init(HTMLDocument*);
694 void HTMLDocument_OleObj_Init(HTMLDocument*);
695 void HTMLDocument_View_Init(HTMLDocument*);
696 void HTMLDocument_Window_Init(HTMLDocument*);
697 void HTMLDocument_Service_Init(HTMLDocument*);
698 void HTMLDocument_Hlink_Init(HTMLDocument*);
700 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
702 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
704 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*);
705 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
706 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
708 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
709 void NSContainer_Release(NSContainer*);
711 void init_mutation(HTMLDocumentNode*);
712 void release_mutation(HTMLDocumentNode*);
714 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
715 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
716 void notif_focus(HTMLDocumentObj*);
718 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
719 void hide_tooltip(HTMLDocumentObj*);
720 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
722 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
724 BOOL load_gecko(BOOL);
725 void close_gecko(void);
726 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
727 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
728 void release_nsio(void);
729 BOOL install_wine_gecko(BOOL);
730 BOOL is_gecko_path(const char*);
732 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
733 HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**);
734 HRESULT load_nsuri(HTMLWindow*,nsWineURI*,nsChannelBSC*,DWORD);
736 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD,BOOL*);
737 HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);
738 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*);
739 HRESULT set_moniker(HTMLDocument*,IMoniker*,IBindCtx*,nsChannelBSC*,BOOL);
741 void call_property_onchanged(ConnectionPoint*,DISPID);
742 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
744 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
747 void nsACString_InitDepend(nsACString*,const char*);
748 void nsACString_SetData(nsACString*,const char*);
749 PRUint32 nsACString_GetData(const nsACString*,const char**);
750 void nsACString_Finish(nsACString*);
752 BOOL nsAString_Init(nsAString*,const PRUnichar*);
753 void nsAString_InitDepend(nsAString*,const PRUnichar*);
754 void nsAString_SetData(nsAString*,const PRUnichar*);
755 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
756 void nsAString_Finish(nsAString*);
758 nsICommandParams *create_nscommand_params(void);
759 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
760 void get_editor_controller(NSContainer*);
761 nsresult get_nsinterface(nsISupports*,REFIID,void**);
763 void init_nsevents(HTMLDocumentNode*);
764 void release_nsevents(HTMLDocumentNode*);
765 void add_nsevent_listener(HTMLDocumentNode*,nsIDOMNode*,LPCWSTR);
767 void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
768 void set_current_mon(HTMLWindow*,IMoniker*);
769 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
770 HRESULT async_start_doc_binding(HTMLWindow*,nsChannelBSC*);
771 void abort_document_bindings(HTMLDocumentNode*);
773 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);
775 HRESULT create_channelbsc(IMoniker*,WCHAR*,BYTE*,DWORD,nsChannelBSC**);
776 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
777 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
778 IMoniker *get_channelbsc_mon(nsChannelBSC*);
780 void set_ready_state(HTMLWindow*,READYSTATE);
782 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
783 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
784 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
785 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
786 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
788 void detach_selection(HTMLDocumentNode*);
789 void detach_ranges(HTMLDocumentNode*);
790 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
792 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
794 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
796 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
797 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
798 HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
799 HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
800 HTMLElement *HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
801 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
802 HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
803 HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
804 HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
805 HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
806 HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
807 HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
808 HTMLElement *HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
809 HTMLElement *HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
810 HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
811 HTMLElement *HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
813 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
814 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
815 void HTMLElement2_Init(HTMLElement*);
816 void HTMLElement3_Init(HTMLElement*);
817 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
818 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
820 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
821 void HTMLDOMNode_destructor(HTMLDOMNode*);
823 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
824 void HTMLElement_destructor(HTMLDOMNode*);
826 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
827 void HTMLFrameBase_destructor(HTMLFrameBase*);
829 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
830 void release_nodes(HTMLDocumentNode*);
832 void release_script_hosts(HTMLWindow*);
833 void connect_scripts(HTMLWindow*);
834 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
835 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
836 void set_script_mode(HTMLWindow*,SCRIPTMODE);
837 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
838 IDispatch *get_script_disp(ScriptHost*);
839 HRESULT search_window_props(HTMLWindow*,BSTR,DWORD,DISPID*);
841 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
842 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
843 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
848 HRESULT (*query)(HTMLDocument*,OLECMD*);
849 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
852 extern const cmdtable_t editmode_cmds[];
854 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
857 #define UPDATE_UI 0x0001
858 #define UPDATE_TITLE 0x0002
860 void update_doc(HTMLDocument*,DWORD);
861 void update_title(HTMLDocumentObj*);
864 void init_editor(HTMLDocument*);
865 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
866 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
867 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
868 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
869 void handle_edit_load(HTMLDocument*);
870 HRESULT editor_is_dirty(HTMLDocument*);
871 void set_dirty(HTMLDocument*,VARIANT_BOOL);
873 extern DWORD mshtml_tls;
875 typedef struct task_t task_t;
876 typedef void (*task_proc_t)(task_t*);
886 HTMLDocumentObj *doc;
891 task_t *task_queue_head;
892 task_t *task_queue_tail;
893 struct list timer_list;
896 thread_data_t *get_thread_data(BOOL);
897 HWND get_thread_hwnd(void);
899 LONG get_task_target_magic(void);
900 void push_task(task_t*,task_proc_t,LONG);
901 void remove_target_tasks(LONG);
903 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
904 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
906 void release_typelib(void);
907 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
909 const char *debugstr_variant(const VARIANT*);
911 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
912 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
913 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
914 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
915 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
917 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
919 /* memory allocation functions */
921 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
923 return HeapAlloc(GetProcessHeap(), 0, len);
926 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
928 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
931 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
933 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
936 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
938 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
941 static inline BOOL heap_free(void *mem)
943 return HeapFree(GetProcessHeap(), 0, mem);
946 static inline LPWSTR heap_strdupW(LPCWSTR str)
953 size = (strlenW(str)+1)*sizeof(WCHAR);
954 ret = heap_alloc(size);
955 memcpy(ret, str, size);
961 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
966 ret = heap_alloc((len+1)*sizeof(WCHAR));
967 memcpy(ret, str, len*sizeof(WCHAR));
974 static inline char *heap_strdupA(const char *str)
981 size = strlen(str)+1;
982 ret = heap_alloc(size);
983 memcpy(ret, str, size);
989 static inline WCHAR *heap_strdupAtoW(const char *str)
996 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
997 ret = heap_alloc(len*sizeof(WCHAR));
998 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
1004 static inline char *heap_strdupWtoA(LPCWSTR str)
1009 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1010 ret = heap_alloc(size);
1011 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1017 static inline void windowref_addref(windowref_t *ref)
1019 InterlockedIncrement(&ref->ref);
1022 static inline void windowref_release(windowref_t *ref)
1024 if(!InterlockedDecrement(&ref->ref))
1028 HDC get_display_dc(void);
1029 HINSTANCE get_shdoclc(void);
1030 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR);
1032 extern HINSTANCE hInst;