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 DispHTMLTextAreaElement_tid,
85 DispHTMLUnknownElement_tid,
87 HTMLDocumentEvents_tid,
88 IHTMLAnchorElement_tid,
90 IHTMLBodyElement2_tid,
91 IHTMLCommentElement_tid,
92 IHTMLCurrentStyle_tid,
93 IHTMLCurrentStyle2_tid,
94 IHTMLCurrentStyle3_tid,
95 IHTMLCurrentStyle4_tid,
100 IHTMLDOMChildrenCollection_tid,
103 IHTMLDOMTextNode_tid,
108 IHTMLElementCollection_tid,
110 IHTMLFiltersCollection_tid,
111 IHTMLFormElement_tid,
114 IHTMLFrameElement3_tid,
115 IHTMLGenericElement_tid,
116 IHTMLIFrameElement_tid,
117 IHTMLImageElementFactory_tid,
119 IHTMLInputElement_tid,
121 IHTMLOptionElement_tid,
123 IHTMLScriptElement_tid,
124 IHTMLSelectElement_tid,
131 IHTMLTextAreaElement_tid,
132 IHTMLTextContainer_tid,
141 typedef struct dispex_data_t dispex_data_t;
142 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
144 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
145 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
148 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
149 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
150 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
151 } dispex_static_data_vtbl_t;
154 const dispex_static_data_vtbl_t *vtbl;
155 const tid_t disp_tid;
157 const tid_t* const iface_tids;
158 } dispex_static_data_t;
161 const IDispatchExVtbl *lpIDispatchExVtbl;
165 dispex_static_data_t *data;
166 dispex_dynamic_data_t *dynamic_data;
169 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
170 void release_dispex(DispatchEx*);
171 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
172 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
173 HRESULT get_dispids(tid_t,DWORD*,DISPID**);
175 typedef struct HTMLWindow HTMLWindow;
176 typedef struct HTMLDocumentNode HTMLDocumentNode;
177 typedef struct HTMLDocumentObj HTMLDocumentObj;
178 typedef struct HTMLFrameBase HTMLFrameBase;
179 typedef struct NSContainer NSContainer;
183 SCRIPTMODE_ACTIVESCRIPT
186 typedef struct ScriptHost ScriptHost;
191 } global_prop_type_t;
194 global_prop_type_t type;
196 ScriptHost *script_host;
201 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
206 } HTMLOptionElementFactory;
210 const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl;
215 } HTMLImageElementFactory;
217 struct HTMLLocation {
219 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
231 typedef struct nsChannelBSC nsChannelBSC;
235 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
236 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
237 const IHTMLWindow4Vtbl *lpHTMLWindow4Vtbl;
238 const IDispatchExVtbl *lpIDispatchExVtbl;
242 windowref_t *window_ref;
245 HTMLDocumentNode *doc;
246 HTMLDocumentObj *doc_obj;
247 nsIDOMWindow *nswindow;
249 HTMLFrameBase *frame_element;
250 READYSTATE readystate;
252 nsChannelBSC *bscallback;
256 IHTMLEventObj *event;
258 SCRIPTMODE scriptmode;
259 struct list script_hosts;
261 HTMLOptionElementFactory *option_factory;
262 HTMLImageElementFactory *image_factory;
263 HTMLLocation *location;
266 global_prop_t *global_props;
267 DWORD global_prop_cnt;
268 DWORD global_prop_size;
270 struct list children;
271 struct list sibling_entry;
281 typedef struct _cp_static_data_t {
283 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
288 typedef struct ConnectionPointContainer {
289 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
291 ConnectionPoint *cp_list;
293 struct ConnectionPointContainer *forward_container;
294 } ConnectionPointContainer;
296 struct ConnectionPoint {
297 const IConnectionPointVtbl *lpConnectionPointVtbl;
299 ConnectionPointContainer *container;
304 IPropertyNotifySink *propnotif;
309 cp_static_data_t *data;
311 ConnectionPoint *next;
314 struct HTMLDocument {
315 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
316 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
317 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
318 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
319 const IHTMLDocument6Vtbl *lpHTMLDocument6Vtbl;
320 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
321 const IPersistFileVtbl *lpPersistFileVtbl;
322 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
323 const IMonikerPropVtbl *lpMonikerPropVtbl;
324 const IOleObjectVtbl *lpOleObjectVtbl;
325 const IOleDocumentVtbl *lpOleDocumentVtbl;
326 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
327 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
328 const IViewObjectExVtbl *lpViewObjectExVtbl;
329 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
330 const IServiceProviderVtbl *lpServiceProviderVtbl;
331 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
332 const IOleControlVtbl *lpOleControlVtbl;
333 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
334 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
335 const IDispatchExVtbl *lpIDispatchExVtbl;
336 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
337 const IObjectWithSiteVtbl *lpObjectWithSiteVtbl;
342 HTMLDocumentObj *doc_obj;
343 HTMLDocumentNode *doc_node;
349 ConnectionPointContainer cp_container;
350 ConnectionPoint cp_htmldocevents;
351 ConnectionPoint cp_htmldocevents2;
352 ConnectionPoint cp_propnotif;
353 ConnectionPoint cp_dispatch;
355 IOleAdviseHolder *advise_holder;
358 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
360 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
363 static inline ULONG htmldoc_addref(HTMLDocument *This)
365 return IUnknown_AddRef(This->unk_impl);
368 static inline ULONG htmldoc_release(HTMLDocument *This)
370 return IUnknown_Release(This->unk_impl);
373 struct HTMLDocumentObj {
374 HTMLDocument basedoc;
376 const ICustomDocVtbl *lpCustomDocVtbl;
380 NSContainer *nscontainer;
382 IOleClientSite *client;
383 IDocHostUIHandler *hostui;
384 IOleInPlaceSite *ipsite;
385 IOleInPlaceFrame *frame;
386 IOleInPlaceUIWindow *ip_window;
387 IAdviseSink *view_sink;
389 DOCHOSTUIINFO hostinfo;
391 IOleUndoManager *undomgr;
396 BOOL request_uiactivate;
397 BOOL in_place_active;
401 BOOL container_locked;
412 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
413 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
414 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
415 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
416 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
417 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
418 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
419 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
421 nsIWebBrowser *webbrowser;
422 nsIWebNavigation *navigation;
423 nsIBaseWindow *window;
424 nsIWebBrowserFocus *focus;
427 nsIController *editor_controller;
432 HTMLDocumentObj *doc;
434 nsIURIContentListener *content_listener;
438 HWND reset_focus; /* hack */
441 typedef struct nsWineURI nsWineURI;
443 HRESULT set_wine_url(nsWineURI*,LPCWSTR);
444 nsresult on_start_uri_open(NSContainer*,nsIURI*,PRBool*);
447 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
448 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
449 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
454 nsIInputStream *post_data_stream;
455 nsILoadGroup *load_group;
456 nsIInterfaceRequestor *notif_callback;
458 nsLoadFlags load_flags;
459 nsIURI *original_uri;
462 PRUint32 response_status;
467 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
468 void (*destructor)(HTMLDOMNode*);
469 event_target_t **(*get_event_target)(HTMLDOMNode*);
470 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
471 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
472 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
473 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
474 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
475 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
476 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
477 HRESULT (*bind_to_tree)(HTMLDOMNode*);
482 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
483 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
484 const NodeImplVtbl *vtbl;
489 HTMLDocumentNode *doc;
490 event_target_t *event_target;
491 ConnectionPointContainer *cp_container;
498 ConnectionPointContainer cp_container;
500 const IHTMLElementVtbl *lpHTMLElementVtbl;
501 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
502 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
504 nsIDOMHTMLElement *nselem;
507 #define HTMLELEMENT_TIDS \
518 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
523 struct HTMLFrameBase {
526 const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
527 const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
529 HTMLWindow *content_window;
531 nsIDOMHTMLFrameElement *nsframe;
532 nsIDOMHTMLIFrameElement *nsiframe;
535 typedef struct _mutation_queue_t {
537 nsISupports *nsiface;
539 struct _mutation_queue_t *next;
542 typedef struct nsDocumentEventListener nsDocumentEventListener;
544 struct HTMLDocumentNode {
546 HTMLDocument basedoc;
548 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
550 const nsIDocumentObserverVtbl *lpIDocumentObserverVtbl;
551 const nsIRunnableVtbl *lpIRunnableVtbl;
555 nsIDOMHTMLDocument *nsdoc;
558 event_target_t *body_event_target;
560 IInternetSecurityManager *secmgr;
561 ICatInformation *catmgr;
562 nsDocumentEventListener *nsevent_listener;
565 mutation_queue_t *mutation_queue;
566 mutation_queue_t *mutation_queue_tail;
568 struct list bindings;
569 struct list selection_list;
570 struct list range_list;
573 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
574 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
575 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
577 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
578 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
579 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
580 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
581 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
582 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
583 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
584 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
585 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
586 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
587 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
588 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
589 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
590 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
591 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
592 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
593 #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)
594 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
595 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
596 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
597 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
598 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
599 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
600 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
601 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
602 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
603 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
604 #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)
606 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
607 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
608 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
609 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
610 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
611 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
612 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
613 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
614 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
616 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
618 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
620 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
621 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
622 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
623 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
625 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
626 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
627 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
629 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
630 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
631 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
632 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
633 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
635 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
636 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
637 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
639 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
640 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
641 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
643 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
645 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
647 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
649 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
650 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
652 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
653 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
654 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
656 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**);
657 void update_window_doc(HTMLWindow*);
658 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
659 nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*);
660 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
661 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*);
662 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
663 IOmNavigator *OmNavigator_Create(void);
664 HRESULT HTMLScreen_Create(IHTMLScreen**);
666 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
667 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
668 void HTMLDocument_Persist_Init(HTMLDocument*);
669 void HTMLDocument_OleCmd_Init(HTMLDocument*);
670 void HTMLDocument_OleObj_Init(HTMLDocument*);
671 void HTMLDocument_View_Init(HTMLDocument*);
672 void HTMLDocument_Window_Init(HTMLDocument*);
673 void HTMLDocument_Service_Init(HTMLDocument*);
674 void HTMLDocument_Hlink_Init(HTMLDocument*);
676 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
678 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
680 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*);
681 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
682 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
684 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
685 void NSContainer_Release(NSContainer*);
687 void init_mutation(HTMLDocumentNode*);
688 void release_mutation(HTMLDocumentNode*);
690 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
691 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
692 void notif_focus(HTMLDocumentObj*);
694 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
695 void hide_tooltip(HTMLDocumentObj*);
696 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
698 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
700 BOOL load_gecko(BOOL);
701 void close_gecko(void);
702 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
703 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
704 void release_nsio(void);
705 BOOL install_wine_gecko(BOOL);
707 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
708 HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**);
709 HRESULT load_nsuri(HTMLWindow*,nsWineURI*,nsChannelBSC*,DWORD);
711 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD);
712 HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);
713 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*);
715 void call_property_onchanged(ConnectionPoint*,DISPID);
716 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
718 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
721 void nsACString_SetData(nsACString*,const char*);
722 PRUint32 nsACString_GetData(const nsACString*,const char**);
724 BOOL nsAString_Init(nsAString*,const PRUnichar*);
725 void nsAString_InitDepend(nsAString*,const PRUnichar*);
726 void nsAString_SetData(nsAString*,const PRUnichar*);
727 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
728 void nsAString_Finish(nsAString*);
730 nsICommandParams *create_nscommand_params(void);
731 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
732 void get_editor_controller(NSContainer*);
733 nsresult get_nsinterface(nsISupports*,REFIID,void**);
735 void init_nsevents(HTMLDocumentNode*);
736 void release_nsevents(HTMLDocumentNode*);
737 void add_nsevent_listener(HTMLDocumentNode*,LPCWSTR);
739 void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
740 void set_current_mon(HTMLWindow*,IMoniker*);
741 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
742 void abort_document_bindings(HTMLDocumentNode*);
744 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);
746 nsChannelBSC *create_channelbsc(IMoniker*);
747 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
748 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
749 IMoniker *get_channelbsc_mon(nsChannelBSC*);
751 void set_ready_state(HTMLWindow*,READYSTATE);
753 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
754 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
755 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
756 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
757 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
759 void detach_selection(HTMLDocumentNode*);
760 void detach_ranges(HTMLDocumentNode*);
761 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
763 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
765 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
767 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
768 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
769 HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
770 HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
771 HTMLElement *HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
772 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
773 HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
774 HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
775 HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
776 HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
777 HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
778 HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
779 HTMLElement *HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
780 HTMLElement *HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
781 HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
782 HTMLElement *HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
784 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
785 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
786 void HTMLElement2_Init(HTMLElement*);
787 void HTMLElement3_Init(HTMLElement*);
788 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
789 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
791 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
792 void HTMLDOMNode_destructor(HTMLDOMNode*);
794 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
795 void HTMLElement_destructor(HTMLDOMNode*);
797 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
798 void HTMLFrameBase_destructor(HTMLFrameBase*);
800 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
801 void release_nodes(HTMLDocumentNode*);
803 void release_script_hosts(HTMLWindow*);
804 void connect_scripts(HTMLWindow*);
805 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
806 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
807 void set_script_mode(HTMLWindow*,SCRIPTMODE);
808 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
809 IDispatch *get_script_disp(ScriptHost*);
810 HRESULT search_window_props(HTMLWindow*,BSTR,DWORD,DISPID*);
812 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
813 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
814 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
819 HRESULT (*query)(HTMLDocument*,OLECMD*);
820 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
823 extern const cmdtable_t editmode_cmds[];
825 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
828 #define UPDATE_UI 0x0001
829 #define UPDATE_TITLE 0x0002
831 void update_doc(HTMLDocument*,DWORD);
832 void update_title(HTMLDocumentObj*);
835 void init_editor(HTMLDocument*);
836 void set_ns_editmode(NSContainer*);
837 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
838 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
839 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
840 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
841 void handle_edit_load(HTMLDocument*);
842 HRESULT editor_is_dirty(HTMLDocument*);
843 void set_dirty(HTMLDocument*,VARIANT_BOOL);
845 extern DWORD mshtml_tls;
847 typedef struct task_t task_t;
848 typedef void (*task_proc_t)(task_t*);
858 HTMLDocumentObj *doc;
863 task_t *task_queue_head;
864 task_t *task_queue_tail;
865 struct list timer_list;
868 thread_data_t *get_thread_data(BOOL);
869 HWND get_thread_hwnd(void);
871 LONG get_task_target_magic(void);
872 void push_task(task_t*,task_proc_t,LONG);
873 void remove_target_tasks(LONG);
875 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
876 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
878 void release_typelib(void);
879 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
881 const char *debugstr_variant(const VARIANT*);
883 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
884 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
885 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
886 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
887 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
889 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
891 /* memory allocation functions */
893 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
895 return HeapAlloc(GetProcessHeap(), 0, len);
898 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
900 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
903 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
905 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
908 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
910 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
913 static inline BOOL heap_free(void *mem)
915 return HeapFree(GetProcessHeap(), 0, mem);
918 static inline LPWSTR heap_strdupW(LPCWSTR str)
925 size = (strlenW(str)+1)*sizeof(WCHAR);
926 ret = heap_alloc(size);
927 memcpy(ret, str, size);
933 static inline char *heap_strdupA(const char *str)
940 size = strlen(str)+1;
941 ret = heap_alloc(size);
942 memcpy(ret, str, size);
948 static inline WCHAR *heap_strdupAtoW(const char *str)
955 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
956 ret = heap_alloc(len*sizeof(WCHAR));
957 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
963 static inline char *heap_strdupWtoA(LPCWSTR str)
968 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
969 ret = heap_alloc(size);
970 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
976 static inline void windowref_addref(windowref_t *ref)
978 InterlockedIncrement(&ref->ref);
981 static inline void windowref_release(windowref_t *ref)
983 if(!InterlockedDecrement(&ref->ref))
987 HDC get_display_dc(void);
988 HINSTANCE get_shdoclc(void);
990 extern HINSTANCE hInst;