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_NOT_AVAILABLE ((nsresult)0x80040111L)
42 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
43 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
44 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
46 #define NS_FAILED(res) ((res) & 0x80000000)
47 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
51 #define MSHTML_E_NODOC 0x800a025c
53 typedef struct HTMLDOMNode HTMLDOMNode;
54 typedef struct ConnectionPoint ConnectionPoint;
55 typedef struct BSCallback BSCallback;
56 typedef struct event_target_t event_target_t;
58 /* NOTE: make sure to keep in sync with dispex.c */
62 DispDOMChildrenCollection_tid,
63 DispHTMLAnchorElement_tid,
65 DispHTMLCommentElement_tid,
66 DispHTMLCurrentStyle_tid,
68 DispHTMLDOMTextNode_tid,
69 DispHTMLElementCollection_tid,
70 DispHTMLFormElement_tid,
71 DispHTMLGenericElement_tid,
72 DispHTMLFrameElement_tid,
75 DispHTMLInputElement_tid,
77 DispHTMLNavigator_tid,
78 DispHTMLOptionElement_tid,
80 DispHTMLScriptElement_tid,
81 DispHTMLSelectElement_tid,
85 DispHTMLTextAreaElement_tid,
86 DispHTMLUnknownElement_tid,
88 HTMLDocumentEvents_tid,
89 IHTMLAnchorElement_tid,
91 IHTMLBodyElement2_tid,
92 IHTMLCommentElement_tid,
93 IHTMLCurrentStyle_tid,
94 IHTMLCurrentStyle2_tid,
95 IHTMLCurrentStyle3_tid,
96 IHTMLCurrentStyle4_tid,
101 IHTMLDOMChildrenCollection_tid,
104 IHTMLDOMTextNode_tid,
109 IHTMLElementCollection_tid,
111 IHTMLFiltersCollection_tid,
112 IHTMLFormElement_tid,
115 IHTMLFrameElement3_tid,
116 IHTMLGenericElement_tid,
117 IHTMLIFrameElement_tid,
118 IHTMLImageElementFactory_tid,
120 IHTMLInputElement_tid,
122 IHTMLOptionElement_tid,
124 IHTMLScriptElement_tid,
125 IHTMLSelectElement_tid,
132 IHTMLTextAreaElement_tid,
133 IHTMLTextContainer_tid,
142 typedef struct dispex_data_t dispex_data_t;
143 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
145 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
146 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
149 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
150 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
151 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
152 } dispex_static_data_vtbl_t;
155 const dispex_static_data_vtbl_t *vtbl;
156 const tid_t disp_tid;
158 const tid_t* const iface_tids;
159 } dispex_static_data_t;
162 const IDispatchExVtbl *lpIDispatchExVtbl;
166 dispex_static_data_t *data;
167 dispex_dynamic_data_t *dynamic_data;
170 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
171 void release_dispex(DispatchEx*);
172 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
173 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
174 HRESULT get_dispids(tid_t,DWORD*,DISPID**);
175 HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*);
177 typedef struct HTMLWindow HTMLWindow;
178 typedef struct HTMLDocumentNode HTMLDocumentNode;
179 typedef struct HTMLDocumentObj HTMLDocumentObj;
180 typedef struct HTMLFrameBase HTMLFrameBase;
181 typedef struct NSContainer NSContainer;
185 SCRIPTMODE_ACTIVESCRIPT
188 typedef struct ScriptHost ScriptHost;
193 } global_prop_type_t;
196 global_prop_type_t type;
198 ScriptHost *script_host;
203 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
208 } HTMLOptionElementFactory;
212 const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl;
217 } HTMLImageElementFactory;
219 struct HTMLLocation {
221 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
233 typedef struct nsChannelBSC nsChannelBSC;
237 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
238 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
239 const IHTMLWindow4Vtbl *lpHTMLWindow4Vtbl;
240 const IHTMLPrivateWindowVtbl *lpIHTMLPrivateWindowVtbl;
241 const IDispatchExVtbl *lpIDispatchExVtbl;
245 windowref_t *window_ref;
248 HTMLDocumentNode *doc;
249 HTMLDocumentObj *doc_obj;
250 nsIDOMWindow *nswindow;
252 HTMLFrameBase *frame_element;
253 READYSTATE readystate;
255 nsChannelBSC *bscallback;
259 IHTMLEventObj *event;
261 SCRIPTMODE scriptmode;
262 struct list script_hosts;
264 HTMLOptionElementFactory *option_factory;
265 HTMLImageElementFactory *image_factory;
266 HTMLLocation *location;
269 global_prop_t *global_props;
270 DWORD global_prop_cnt;
271 DWORD global_prop_size;
273 struct list children;
274 struct list sibling_entry;
284 typedef struct _cp_static_data_t {
286 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
291 typedef struct ConnectionPointContainer {
292 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
294 ConnectionPoint *cp_list;
296 struct ConnectionPointContainer *forward_container;
297 } ConnectionPointContainer;
299 struct ConnectionPoint {
300 const IConnectionPointVtbl *lpConnectionPointVtbl;
302 ConnectionPointContainer *container;
307 IPropertyNotifySink *propnotif;
312 cp_static_data_t *data;
314 ConnectionPoint *next;
317 struct HTMLDocument {
318 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
319 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
320 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
321 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
322 const IHTMLDocument6Vtbl *lpHTMLDocument6Vtbl;
323 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
324 const IPersistFileVtbl *lpPersistFileVtbl;
325 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
326 const IMonikerPropVtbl *lpMonikerPropVtbl;
327 const IOleObjectVtbl *lpOleObjectVtbl;
328 const IOleDocumentVtbl *lpOleDocumentVtbl;
329 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
330 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
331 const IViewObjectExVtbl *lpViewObjectExVtbl;
332 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
333 const IServiceProviderVtbl *lpServiceProviderVtbl;
334 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
335 const IOleControlVtbl *lpOleControlVtbl;
336 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
337 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
338 const IDispatchExVtbl *lpIDispatchExVtbl;
339 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
340 const IObjectWithSiteVtbl *lpObjectWithSiteVtbl;
345 HTMLDocumentObj *doc_obj;
346 HTMLDocumentNode *doc_node;
352 ConnectionPointContainer cp_container;
353 ConnectionPoint cp_htmldocevents;
354 ConnectionPoint cp_htmldocevents2;
355 ConnectionPoint cp_propnotif;
356 ConnectionPoint cp_dispatch;
358 IOleAdviseHolder *advise_holder;
361 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
363 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
366 static inline ULONG htmldoc_addref(HTMLDocument *This)
368 return IUnknown_AddRef(This->unk_impl);
371 static inline ULONG htmldoc_release(HTMLDocument *This)
373 return IUnknown_Release(This->unk_impl);
376 struct HTMLDocumentObj {
377 HTMLDocument basedoc;
379 const ICustomDocVtbl *lpCustomDocVtbl;
383 NSContainer *nscontainer;
385 IOleClientSite *client;
386 IDocHostUIHandler *hostui;
387 IOleInPlaceSite *ipsite;
388 IOleInPlaceFrame *frame;
389 IOleInPlaceUIWindow *ip_window;
390 IAdviseSink *view_sink;
392 DOCHOSTUIINFO hostinfo;
394 IOleUndoManager *undomgr;
399 BOOL request_uiactivate;
400 BOOL in_place_active;
404 BOOL container_locked;
415 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
416 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
417 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
418 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
419 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
420 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
421 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
422 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
424 nsIWebBrowser *webbrowser;
425 nsIWebNavigation *navigation;
426 nsIBaseWindow *window;
427 nsIWebBrowserFocus *focus;
430 nsIController *editor_controller;
435 HTMLDocumentObj *doc;
437 nsIURIContentListener *content_listener;
441 HWND reset_focus; /* hack */
444 typedef struct nsWineURI nsWineURI;
446 HRESULT set_wine_url(nsWineURI*,LPCWSTR);
447 nsresult on_start_uri_open(NSContainer*,nsIURI*,PRBool*);
450 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
451 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
452 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
457 nsIInputStream *post_data_stream;
458 nsILoadGroup *load_group;
459 nsIInterfaceRequestor *notif_callback;
461 nsLoadFlags load_flags;
462 nsIURI *original_uri;
465 PRUint32 response_status;
466 struct list response_headers;
470 struct ResponseHeader {
477 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
478 void (*destructor)(HTMLDOMNode*);
479 event_target_t **(*get_event_target)(HTMLDOMNode*);
480 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
481 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
482 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
483 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
484 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
485 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
486 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
487 HRESULT (*bind_to_tree)(HTMLDOMNode*);
492 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
493 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
494 const NodeImplVtbl *vtbl;
499 HTMLDocumentNode *doc;
500 event_target_t *event_target;
501 ConnectionPointContainer *cp_container;
508 ConnectionPointContainer cp_container;
510 const IHTMLElementVtbl *lpHTMLElementVtbl;
511 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
512 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
514 nsIDOMHTMLElement *nselem;
517 #define HTMLELEMENT_TIDS \
528 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
533 struct HTMLFrameBase {
536 const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
537 const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
539 HTMLWindow *content_window;
541 nsIDOMHTMLFrameElement *nsframe;
542 nsIDOMHTMLIFrameElement *nsiframe;
545 typedef struct _mutation_queue_t {
547 nsISupports *nsiface;
549 struct _mutation_queue_t *next;
552 typedef struct nsDocumentEventListener nsDocumentEventListener;
554 struct HTMLDocumentNode {
556 HTMLDocument basedoc;
558 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
560 const nsIDocumentObserverVtbl *lpIDocumentObserverVtbl;
561 const nsIRunnableVtbl *lpIRunnableVtbl;
565 nsIDOMHTMLDocument *nsdoc;
568 event_target_t *body_event_target;
570 IInternetSecurityManager *secmgr;
571 ICatInformation *catmgr;
572 nsDocumentEventListener *nsevent_listener;
575 mutation_queue_t *mutation_queue;
576 mutation_queue_t *mutation_queue_tail;
578 struct list bindings;
579 struct list selection_list;
580 struct list range_list;
583 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
584 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
585 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
587 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
588 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
589 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
590 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
591 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
592 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
593 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
594 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
595 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
596 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
597 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
598 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
599 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
600 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
601 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
602 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
603 #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)
604 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
605 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
606 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
607 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
608 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
609 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
610 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
611 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
612 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
613 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
614 #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)
616 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
617 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
618 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
619 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
620 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
621 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
622 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
623 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
624 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
626 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
628 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
630 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
631 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
632 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
633 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
635 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
636 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
637 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
639 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
640 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
641 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
642 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
643 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
645 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
646 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
647 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
649 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
650 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
651 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
653 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
655 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
657 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
659 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
660 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
662 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
663 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
664 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
666 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**);
667 void update_window_doc(HTMLWindow*);
668 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
669 nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*);
670 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
671 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*);
672 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
673 IOmNavigator *OmNavigator_Create(void);
674 HRESULT HTMLScreen_Create(IHTMLScreen**);
676 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
677 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
678 void HTMLDocument_Persist_Init(HTMLDocument*);
679 void HTMLDocument_OleCmd_Init(HTMLDocument*);
680 void HTMLDocument_OleObj_Init(HTMLDocument*);
681 void HTMLDocument_View_Init(HTMLDocument*);
682 void HTMLDocument_Window_Init(HTMLDocument*);
683 void HTMLDocument_Service_Init(HTMLDocument*);
684 void HTMLDocument_Hlink_Init(HTMLDocument*);
686 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
688 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
690 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*);
691 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
692 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
694 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
695 void NSContainer_Release(NSContainer*);
697 void init_mutation(HTMLDocumentNode*);
698 void release_mutation(HTMLDocumentNode*);
700 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
701 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
702 void notif_focus(HTMLDocumentObj*);
704 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
705 void hide_tooltip(HTMLDocumentObj*);
706 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
708 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
710 BOOL load_gecko(BOOL);
711 void close_gecko(void);
712 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
713 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
714 void release_nsio(void);
715 BOOL install_wine_gecko(BOOL);
717 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
718 HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**);
719 HRESULT load_nsuri(HTMLWindow*,nsWineURI*,nsChannelBSC*,DWORD);
721 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD,BOOL*);
722 HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);
723 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*);
724 HRESULT set_moniker(HTMLDocument*,IMoniker*,IBindCtx*,nsChannelBSC*,BOOL);
726 void call_property_onchanged(ConnectionPoint*,DISPID);
727 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
729 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
732 void nsACString_SetData(nsACString*,const char*);
733 PRUint32 nsACString_GetData(const nsACString*,const char**);
735 BOOL nsAString_Init(nsAString*,const PRUnichar*);
736 void nsAString_InitDepend(nsAString*,const PRUnichar*);
737 void nsAString_SetData(nsAString*,const PRUnichar*);
738 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
739 void nsAString_Finish(nsAString*);
741 nsICommandParams *create_nscommand_params(void);
742 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
743 void get_editor_controller(NSContainer*);
744 nsresult get_nsinterface(nsISupports*,REFIID,void**);
746 void init_nsevents(HTMLDocumentNode*);
747 void release_nsevents(HTMLDocumentNode*);
748 void add_nsevent_listener(HTMLDocumentNode*,nsIDOMNode*,LPCWSTR);
750 void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
751 void set_current_mon(HTMLWindow*,IMoniker*);
752 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
753 HRESULT async_start_doc_binding(HTMLWindow*,nsChannelBSC*);
754 void abort_document_bindings(HTMLDocumentNode*);
756 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);
758 HRESULT create_channelbsc(IMoniker*,WCHAR*,BYTE*,DWORD,nsChannelBSC**);
759 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
760 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
761 IMoniker *get_channelbsc_mon(nsChannelBSC*);
763 void set_ready_state(HTMLWindow*,READYSTATE);
765 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
766 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
767 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
768 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
769 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
771 void detach_selection(HTMLDocumentNode*);
772 void detach_ranges(HTMLDocumentNode*);
773 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
775 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
777 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
779 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
780 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
781 HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
782 HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
783 HTMLElement *HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
784 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
785 HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
786 HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
787 HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
788 HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
789 HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
790 HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
791 HTMLElement *HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
792 HTMLElement *HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
793 HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
794 HTMLElement *HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
796 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
797 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
798 void HTMLElement2_Init(HTMLElement*);
799 void HTMLElement3_Init(HTMLElement*);
800 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
801 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
803 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
804 void HTMLDOMNode_destructor(HTMLDOMNode*);
806 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
807 void HTMLElement_destructor(HTMLDOMNode*);
809 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
810 void HTMLFrameBase_destructor(HTMLFrameBase*);
812 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
813 void release_nodes(HTMLDocumentNode*);
815 void release_script_hosts(HTMLWindow*);
816 void connect_scripts(HTMLWindow*);
817 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
818 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
819 void set_script_mode(HTMLWindow*,SCRIPTMODE);
820 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
821 IDispatch *get_script_disp(ScriptHost*);
822 HRESULT search_window_props(HTMLWindow*,BSTR,DWORD,DISPID*);
824 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
825 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
826 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
831 HRESULT (*query)(HTMLDocument*,OLECMD*);
832 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
835 extern const cmdtable_t editmode_cmds[];
837 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
840 #define UPDATE_UI 0x0001
841 #define UPDATE_TITLE 0x0002
843 void update_doc(HTMLDocument*,DWORD);
844 void update_title(HTMLDocumentObj*);
847 void init_editor(HTMLDocument*);
848 void set_ns_editmode(NSContainer*);
849 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
850 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
851 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
852 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
853 void handle_edit_load(HTMLDocument*);
854 HRESULT editor_is_dirty(HTMLDocument*);
855 void set_dirty(HTMLDocument*,VARIANT_BOOL);
857 extern DWORD mshtml_tls;
859 typedef struct task_t task_t;
860 typedef void (*task_proc_t)(task_t*);
870 HTMLDocumentObj *doc;
875 task_t *task_queue_head;
876 task_t *task_queue_tail;
877 struct list timer_list;
880 thread_data_t *get_thread_data(BOOL);
881 HWND get_thread_hwnd(void);
883 LONG get_task_target_magic(void);
884 void push_task(task_t*,task_proc_t,LONG);
885 void remove_target_tasks(LONG);
887 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
888 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
890 void release_typelib(void);
891 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
893 const char *debugstr_variant(const VARIANT*);
895 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
896 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
897 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
898 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
899 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
901 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
903 /* memory allocation functions */
905 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
907 return HeapAlloc(GetProcessHeap(), 0, len);
910 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
912 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
915 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
917 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
920 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
922 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
925 static inline BOOL heap_free(void *mem)
927 return HeapFree(GetProcessHeap(), 0, mem);
930 static inline LPWSTR heap_strdupW(LPCWSTR str)
937 size = (strlenW(str)+1)*sizeof(WCHAR);
938 ret = heap_alloc(size);
939 memcpy(ret, str, size);
945 static inline char *heap_strdupA(const char *str)
952 size = strlen(str)+1;
953 ret = heap_alloc(size);
954 memcpy(ret, str, size);
960 static inline WCHAR *heap_strdupAtoW(const char *str)
967 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
968 ret = heap_alloc(len*sizeof(WCHAR));
969 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
975 static inline char *heap_strdupWtoA(LPCWSTR str)
980 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
981 ret = heap_alloc(size);
982 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
988 static inline void windowref_addref(windowref_t *ref)
990 InterlockedIncrement(&ref->ref);
993 static inline void windowref_release(windowref_t *ref)
995 if(!InterlockedDecrement(&ref->ref))
999 HDC get_display_dc(void);
1000 HINSTANCE get_shdoclc(void);
1002 extern HINSTANCE hInst;