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 nsChannelBSC nsChannelBSC;
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,
74 DispHTMLInputElement_tid,
76 DispHTMLNavigator_tid,
77 DispHTMLOptionElement_tid,
79 DispHTMLSelectElement_tid,
83 DispHTMLUnknownElement_tid,
85 HTMLDocumentEvents_tid,
86 IHTMLAnchorElement_tid,
88 IHTMLBodyElement2_tid,
89 IHTMLCommentElement_tid,
90 IHTMLCurrentStyle_tid,
91 IHTMLCurrentStyle2_tid,
92 IHTMLCurrentStyle3_tid,
93 IHTMLCurrentStyle4_tid,
98 IHTMLDOMChildrenCollection_tid,
101 IHTMLDOMTextNode_tid,
106 IHTMLElementCollection_tid,
108 IHTMLFiltersCollection_tid,
109 IHTMLFormElement_tid,
112 IHTMLGenericElement_tid,
113 IHTMLImageElementFactory_tid,
115 IHTMLInputElement_tid,
117 IHTMLOptionElement_tid,
119 IHTMLSelectElement_tid,
126 IHTMLTextContainer_tid,
135 typedef struct dispex_data_t dispex_data_t;
136 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
138 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
139 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
142 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
143 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
144 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
145 } dispex_static_data_vtbl_t;
148 const dispex_static_data_vtbl_t *vtbl;
149 const tid_t disp_tid;
151 const tid_t* const iface_tids;
152 } dispex_static_data_t;
155 const IDispatchExVtbl *lpIDispatchExVtbl;
159 dispex_static_data_t *data;
160 dispex_dynamic_data_t *dynamic_data;
163 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
164 void release_dispex(DispatchEx*);
165 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
166 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
167 HRESULT get_dispids(tid_t,DWORD*,DISPID**);
169 typedef struct HTMLDocumentNode HTMLDocumentNode;
170 typedef struct HTMLDocumentObj HTMLDocumentObj;
171 typedef struct HTMLFrameBase HTMLFrameBase;
175 SCRIPTMODE_ACTIVESCRIPT
178 typedef struct ScriptHost ScriptHost;
183 } global_prop_type_t;
186 global_prop_type_t type;
188 ScriptHost *script_host;
193 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
198 } HTMLOptionElementFactory;
202 const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl;
207 } HTMLImageElementFactory;
209 struct HTMLLocation {
211 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
225 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
226 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
227 const IHTMLWindow4Vtbl *lpHTMLWindow4Vtbl;
228 const IDispatchExVtbl *lpIDispatchExVtbl;
232 windowref_t *window_ref;
235 HTMLDocumentNode *doc;
236 HTMLDocumentObj *doc_obj;
237 nsIDOMWindow *nswindow;
239 HTMLFrameBase *frame_element;
240 READYSTATE readystate;
242 nsChannelBSC *bscallback;
246 event_target_t *event_target;
247 IHTMLEventObj *event;
249 SCRIPTMODE scriptmode;
250 struct list script_hosts;
252 HTMLOptionElementFactory *option_factory;
253 HTMLImageElementFactory *image_factory;
254 HTMLLocation *location;
257 global_prop_t *global_props;
258 DWORD global_prop_cnt;
259 DWORD global_prop_size;
261 struct list children;
262 struct list sibling_entry;
278 typedef struct ConnectionPointContainer {
279 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
281 ConnectionPoint *cp_list;
283 struct ConnectionPointContainer *forward_container;
284 } ConnectionPointContainer;
286 struct ConnectionPoint {
287 const IConnectionPointVtbl *lpConnectionPointVtbl;
289 IConnectionPointContainer *container;
294 IPropertyNotifySink *propnotif;
299 cp_static_data_t *data;
301 ConnectionPoint *next;
304 struct HTMLDocument {
305 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
306 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
307 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
308 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
309 const IHTMLDocument6Vtbl *lpHTMLDocument6Vtbl;
310 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
311 const IPersistFileVtbl *lpPersistFileVtbl;
312 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
313 const IMonikerPropVtbl *lpMonikerPropVtbl;
314 const IOleObjectVtbl *lpOleObjectVtbl;
315 const IOleDocumentVtbl *lpOleDocumentVtbl;
316 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
317 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
318 const IViewObjectExVtbl *lpViewObjectExVtbl;
319 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
320 const IServiceProviderVtbl *lpServiceProviderVtbl;
321 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
322 const IOleControlVtbl *lpOleControlVtbl;
323 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
324 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
325 const IDispatchExVtbl *lpIDispatchExVtbl;
326 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
327 const IObjectWithSiteVtbl *lpObjectWithSiteVtbl;
332 HTMLDocumentObj *doc_obj;
333 HTMLDocumentNode *doc_node;
339 ConnectionPointContainer cp_container;
340 ConnectionPoint cp_htmldocevents;
341 ConnectionPoint cp_htmldocevents2;
342 ConnectionPoint cp_propnotif;
344 IOleAdviseHolder *advise_holder;
347 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
349 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
352 static inline ULONG htmldoc_addref(HTMLDocument *This)
354 return IUnknown_AddRef(This->unk_impl);
357 static inline ULONG htmldoc_release(HTMLDocument *This)
359 return IUnknown_Release(This->unk_impl);
362 struct HTMLDocumentObj {
363 HTMLDocument basedoc;
365 const ICustomDocVtbl *lpCustomDocVtbl;
369 NSContainer *nscontainer;
371 IOleClientSite *client;
372 IDocHostUIHandler *hostui;
373 IOleInPlaceSite *ipsite;
374 IOleInPlaceFrame *frame;
375 IOleInPlaceUIWindow *ip_window;
377 DOCHOSTUIINFO hostinfo;
379 IOleUndoManager *undomgr;
384 BOOL request_uiactivate;
385 BOOL in_place_active;
389 BOOL container_locked;
400 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
401 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
402 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
403 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
404 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
405 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
406 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
407 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
409 nsIWebBrowser *webbrowser;
410 nsIWebNavigation *navigation;
411 nsIBaseWindow *window;
412 nsIWebBrowserFocus *focus;
415 nsIController *editor_controller;
420 HTMLDocumentObj *doc;
422 nsIURIContentListener *content_listener;
426 nsChannelBSC *bscallback; /* hack */
427 HWND reset_focus; /* hack */
431 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
432 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
433 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
439 nsIInputStream *post_data_stream;
440 nsILoadGroup *load_group;
441 nsIInterfaceRequestor *notif_callback;
443 nsLoadFlags load_flags;
444 nsIURI *original_uri;
447 PRUint32 response_status;
452 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
453 void (*destructor)(HTMLDOMNode*);
454 event_target_t **(*get_event_target)(HTMLDOMNode*);
455 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
456 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
457 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
458 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
459 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
460 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
461 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
462 HRESULT (*bind_to_tree)(HTMLDOMNode*);
467 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
468 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
469 const NodeImplVtbl *vtbl;
474 HTMLDocumentNode *doc;
475 event_target_t *event_target;
476 ConnectionPointContainer *cp_container;
483 ConnectionPointContainer cp_container;
485 const IHTMLElementVtbl *lpHTMLElementVtbl;
486 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
487 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
489 nsIDOMHTMLElement *nselem;
495 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
500 struct HTMLFrameBase {
503 const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
504 const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
506 HTMLWindow *content_window;
508 nsIDOMHTMLFrameElement *nsframe;
509 nsIDOMHTMLIFrameElement *nsiframe;
512 typedef struct _mutation_queue_t {
514 nsISupports *nsiface;
516 struct _mutation_queue_t *next;
519 typedef struct nsDocumentEventListener nsDocumentEventListener;
521 struct HTMLDocumentNode {
523 HTMLDocument basedoc;
525 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
527 const nsIDocumentObserverVtbl *lpIDocumentObserverVtbl;
528 const nsIRunnableVtbl *lpIRunnableVtbl;
532 nsIDOMHTMLDocument *nsdoc;
536 IInternetSecurityManager *secmgr;
537 ICatInformation *catmgr;
538 nsDocumentEventListener *nsevent_listener;
541 mutation_queue_t *mutation_queue;
542 mutation_queue_t *mutation_queue_tail;
544 struct list bindings;
545 struct list selection_list;
546 struct list range_list;
549 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
550 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
551 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
553 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
554 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
555 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
556 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
557 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
558 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
559 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
560 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
561 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
562 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
563 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
564 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
565 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
566 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
567 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
568 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
569 #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)
570 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
571 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
572 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
573 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
574 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
575 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
576 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
577 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
578 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
579 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
580 #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)
582 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
583 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
584 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
585 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
586 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
587 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
588 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
589 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
590 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
592 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
594 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
596 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
597 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
598 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
599 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
601 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
602 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
603 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
605 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
606 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
607 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
608 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
609 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
611 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
612 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
613 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
615 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
616 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
617 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
619 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
621 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
623 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
625 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
626 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
628 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
629 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
630 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
632 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**);
633 void update_window_doc(HTMLWindow*);
634 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
635 nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*);
636 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
637 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*);
638 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
639 IOmNavigator *OmNavigator_Create(void);
640 HRESULT HTMLScreen_Create(IHTMLScreen**);
642 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
643 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
644 void HTMLDocument_Persist_Init(HTMLDocument*);
645 void HTMLDocument_OleCmd_Init(HTMLDocument*);
646 void HTMLDocument_OleObj_Init(HTMLDocument*);
647 void HTMLDocument_View_Init(HTMLDocument*);
648 void HTMLDocument_Window_Init(HTMLDocument*);
649 void HTMLDocument_Service_Init(HTMLDocument*);
650 void HTMLDocument_Hlink_Init(HTMLDocument*);
652 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
654 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
656 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*);
657 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
658 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
660 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
661 void NSContainer_Release(NSContainer*);
663 void init_mutation(HTMLDocumentNode*);
664 void release_mutation(HTMLDocumentNode*);
666 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
667 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
668 void notif_focus(HTMLDocumentObj*);
670 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
671 void hide_tooltip(HTMLDocumentObj*);
672 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
674 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
676 BOOL load_gecko(BOOL);
677 void close_gecko(void);
678 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
679 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
680 void release_nsio(void);
681 BOOL install_wine_gecko(BOOL);
683 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
684 HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsIWineURI**);
686 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD);
687 HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);
688 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*);
690 void call_property_onchanged(ConnectionPoint*,DISPID);
691 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
693 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
696 void nsACString_SetData(nsACString*,const char*);
697 PRUint32 nsACString_GetData(const nsACString*,const char**);
699 void nsAString_Init(nsAString*,const PRUnichar*);
700 void nsAString_SetData(nsAString*,const PRUnichar*);
701 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
702 void nsAString_Finish(nsAString*);
704 nsICommandParams *create_nscommand_params(void);
705 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
706 void get_editor_controller(NSContainer*);
707 nsresult get_nsinterface(nsISupports*,REFIID,void**);
709 void init_nsevents(HTMLDocumentNode*);
710 void release_nsevents(HTMLDocumentNode*);
711 void add_nsevent_listener(HTMLDocumentNode*,LPCWSTR);
713 void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
714 void set_current_mon(HTMLWindow*,IMoniker*);
715 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
716 void abort_document_bindings(HTMLDocumentNode*);
718 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);
720 nsChannelBSC *create_channelbsc(IMoniker*);
721 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
722 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
723 IMoniker *get_channelbsc_mon(nsChannelBSC*);
725 void set_ready_state(HTMLWindow*,READYSTATE);
727 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
728 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
729 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
730 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
731 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
733 void detach_selection(HTMLDocumentNode*);
734 void detach_ranges(HTMLDocumentNode*);
735 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
737 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
739 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
741 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
742 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
743 HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
744 HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
745 HTMLElement *HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
746 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
747 HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
748 HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
749 HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
750 HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
751 HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
752 HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
753 HTMLElement *HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
754 HTMLElement *HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
755 HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
756 HTMLElement *HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
758 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
759 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
760 void HTMLElement2_Init(HTMLElement*);
761 void HTMLElement3_Init(HTMLElement*);
762 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
763 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
765 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
766 void HTMLDOMNode_destructor(HTMLDOMNode*);
768 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
769 void HTMLElement_destructor(HTMLDOMNode*);
771 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
772 void HTMLFrameBase_destructor(HTMLFrameBase*);
774 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
775 void release_nodes(HTMLDocumentNode*);
777 void release_script_hosts(HTMLWindow*);
778 void connect_scripts(HTMLWindow*);
779 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
780 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
781 void set_script_mode(HTMLWindow*,SCRIPTMODE);
782 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
783 IDispatch *get_script_disp(ScriptHost*);
784 HRESULT search_window_props(HTMLWindow*,BSTR,DWORD,DISPID*);
786 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
787 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
788 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
793 HRESULT (*query)(HTMLDocument*,OLECMD*);
794 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
797 extern const cmdtable_t editmode_cmds[];
799 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
802 #define UPDATE_UI 0x0001
803 #define UPDATE_TITLE 0x0002
805 void update_doc(HTMLDocument*,DWORD);
806 void update_title(HTMLDocumentObj*);
809 void init_editor(HTMLDocument*);
810 void set_ns_editmode(NSContainer*);
811 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
812 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
813 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
814 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
815 void handle_edit_load(HTMLDocument*);
816 HRESULT editor_is_dirty(HTMLDocument*);
817 void set_dirty(HTMLDocument*,VARIANT_BOOL);
819 extern DWORD mshtml_tls;
821 typedef struct task_t task_t;
822 typedef void (*task_proc_t)(task_t*);
832 HTMLDocumentObj *doc;
837 task_t *task_queue_head;
838 task_t *task_queue_tail;
839 struct list timer_list;
842 thread_data_t *get_thread_data(BOOL);
843 HWND get_thread_hwnd(void);
845 LONG get_task_target_magic(void);
846 void push_task(task_t*,task_proc_t,LONG);
847 void remove_target_tasks(LONG);
849 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
850 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
852 void release_typelib(void);
853 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
855 const char *debugstr_variant(const VARIANT*);
857 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
858 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
859 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
860 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
861 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
863 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
865 /* memory allocation functions */
867 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
869 return HeapAlloc(GetProcessHeap(), 0, len);
872 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
874 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
877 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
879 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
882 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
884 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
887 static inline BOOL heap_free(void *mem)
889 return HeapFree(GetProcessHeap(), 0, mem);
892 static inline LPWSTR heap_strdupW(LPCWSTR str)
899 size = (strlenW(str)+1)*sizeof(WCHAR);
900 ret = heap_alloc(size);
901 memcpy(ret, str, size);
907 static inline char *heap_strdupA(const char *str)
914 size = strlen(str)+1;
915 ret = heap_alloc(size);
916 memcpy(ret, str, size);
922 static inline WCHAR *heap_strdupAtoW(const char *str)
929 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
930 ret = heap_alloc(len*sizeof(WCHAR));
931 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
937 static inline char *heap_strdupWtoA(LPCWSTR str)
942 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
943 ret = heap_alloc(size);
944 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
950 static inline void windowref_addref(windowref_t *ref)
952 InterlockedIncrement(&ref->ref);
955 static inline void windowref_release(windowref_t *ref)
957 if(!InterlockedDecrement(&ref->ref))
961 HDC get_display_dc(void);
962 HINSTANCE get_shdoclc(void);
964 extern HINSTANCE hInst;