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**);
174 HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*);
176 typedef struct HTMLWindow HTMLWindow;
177 typedef struct HTMLDocumentNode HTMLDocumentNode;
178 typedef struct HTMLDocumentObj HTMLDocumentObj;
179 typedef struct HTMLFrameBase HTMLFrameBase;
180 typedef struct NSContainer NSContainer;
184 SCRIPTMODE_ACTIVESCRIPT
187 typedef struct ScriptHost ScriptHost;
192 } global_prop_type_t;
195 global_prop_type_t type;
197 ScriptHost *script_host;
202 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
207 } HTMLOptionElementFactory;
211 const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl;
216 } HTMLImageElementFactory;
218 struct HTMLLocation {
220 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
232 typedef struct nsChannelBSC nsChannelBSC;
236 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
237 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
238 const IHTMLWindow4Vtbl *lpHTMLWindow4Vtbl;
239 const IHTMLPrivateWindowVtbl *lpIHTMLPrivateWindowVtbl;
240 const IDispatchExVtbl *lpIDispatchExVtbl;
244 windowref_t *window_ref;
247 HTMLDocumentNode *doc;
248 HTMLDocumentObj *doc_obj;
249 nsIDOMWindow *nswindow;
251 HTMLFrameBase *frame_element;
252 READYSTATE readystate;
254 nsChannelBSC *bscallback;
258 IHTMLEventObj *event;
260 SCRIPTMODE scriptmode;
261 struct list script_hosts;
263 HTMLOptionElementFactory *option_factory;
264 HTMLImageElementFactory *image_factory;
265 HTMLLocation *location;
268 global_prop_t *global_props;
269 DWORD global_prop_cnt;
270 DWORD global_prop_size;
272 struct list children;
273 struct list sibling_entry;
283 typedef struct _cp_static_data_t {
285 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
290 typedef struct ConnectionPointContainer {
291 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
293 ConnectionPoint *cp_list;
295 struct ConnectionPointContainer *forward_container;
296 } ConnectionPointContainer;
298 struct ConnectionPoint {
299 const IConnectionPointVtbl *lpConnectionPointVtbl;
301 ConnectionPointContainer *container;
306 IPropertyNotifySink *propnotif;
311 cp_static_data_t *data;
313 ConnectionPoint *next;
316 struct HTMLDocument {
317 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
318 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
319 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
320 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
321 const IHTMLDocument6Vtbl *lpHTMLDocument6Vtbl;
322 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
323 const IPersistFileVtbl *lpPersistFileVtbl;
324 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
325 const IMonikerPropVtbl *lpMonikerPropVtbl;
326 const IOleObjectVtbl *lpOleObjectVtbl;
327 const IOleDocumentVtbl *lpOleDocumentVtbl;
328 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
329 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
330 const IViewObjectExVtbl *lpViewObjectExVtbl;
331 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
332 const IServiceProviderVtbl *lpServiceProviderVtbl;
333 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
334 const IOleControlVtbl *lpOleControlVtbl;
335 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
336 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
337 const IDispatchExVtbl *lpIDispatchExVtbl;
338 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
339 const IObjectWithSiteVtbl *lpObjectWithSiteVtbl;
344 HTMLDocumentObj *doc_obj;
345 HTMLDocumentNode *doc_node;
351 ConnectionPointContainer cp_container;
352 ConnectionPoint cp_htmldocevents;
353 ConnectionPoint cp_htmldocevents2;
354 ConnectionPoint cp_propnotif;
355 ConnectionPoint cp_dispatch;
357 IOleAdviseHolder *advise_holder;
360 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
362 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
365 static inline ULONG htmldoc_addref(HTMLDocument *This)
367 return IUnknown_AddRef(This->unk_impl);
370 static inline ULONG htmldoc_release(HTMLDocument *This)
372 return IUnknown_Release(This->unk_impl);
375 struct HTMLDocumentObj {
376 HTMLDocument basedoc;
378 const ICustomDocVtbl *lpCustomDocVtbl;
382 NSContainer *nscontainer;
384 IOleClientSite *client;
385 IDocHostUIHandler *hostui;
386 IOleInPlaceSite *ipsite;
387 IOleInPlaceFrame *frame;
388 IOleInPlaceUIWindow *ip_window;
389 IAdviseSink *view_sink;
391 DOCHOSTUIINFO hostinfo;
393 IOleUndoManager *undomgr;
398 BOOL request_uiactivate;
399 BOOL in_place_active;
403 BOOL container_locked;
414 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
415 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
416 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
417 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
418 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
419 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
420 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
421 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
423 nsIWebBrowser *webbrowser;
424 nsIWebNavigation *navigation;
425 nsIBaseWindow *window;
426 nsIWebBrowserFocus *focus;
429 nsIController *editor_controller;
434 HTMLDocumentObj *doc;
436 nsIURIContentListener *content_listener;
440 HWND reset_focus; /* hack */
443 typedef struct nsWineURI nsWineURI;
445 HRESULT set_wine_url(nsWineURI*,LPCWSTR);
446 nsresult on_start_uri_open(NSContainer*,nsIURI*,PRBool*);
449 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
450 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
451 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
456 nsIInputStream *post_data_stream;
457 nsILoadGroup *load_group;
458 nsIInterfaceRequestor *notif_callback;
460 nsLoadFlags load_flags;
461 nsIURI *original_uri;
464 PRUint32 response_status;
469 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
470 void (*destructor)(HTMLDOMNode*);
471 event_target_t **(*get_event_target)(HTMLDOMNode*);
472 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
473 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
474 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
475 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
476 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
477 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
478 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
479 HRESULT (*bind_to_tree)(HTMLDOMNode*);
484 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
485 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
486 const NodeImplVtbl *vtbl;
491 HTMLDocumentNode *doc;
492 event_target_t *event_target;
493 ConnectionPointContainer *cp_container;
500 ConnectionPointContainer cp_container;
502 const IHTMLElementVtbl *lpHTMLElementVtbl;
503 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
504 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
506 nsIDOMHTMLElement *nselem;
509 #define HTMLELEMENT_TIDS \
520 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
525 struct HTMLFrameBase {
528 const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
529 const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
531 HTMLWindow *content_window;
533 nsIDOMHTMLFrameElement *nsframe;
534 nsIDOMHTMLIFrameElement *nsiframe;
537 typedef struct _mutation_queue_t {
539 nsISupports *nsiface;
541 struct _mutation_queue_t *next;
544 typedef struct nsDocumentEventListener nsDocumentEventListener;
546 struct HTMLDocumentNode {
548 HTMLDocument basedoc;
550 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
552 const nsIDocumentObserverVtbl *lpIDocumentObserverVtbl;
553 const nsIRunnableVtbl *lpIRunnableVtbl;
557 nsIDOMHTMLDocument *nsdoc;
560 event_target_t *body_event_target;
562 IInternetSecurityManager *secmgr;
563 ICatInformation *catmgr;
564 nsDocumentEventListener *nsevent_listener;
567 mutation_queue_t *mutation_queue;
568 mutation_queue_t *mutation_queue_tail;
570 struct list bindings;
571 struct list selection_list;
572 struct list range_list;
575 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
576 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
577 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
579 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
580 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
581 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
582 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
583 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
584 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
585 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
586 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
587 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
588 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
589 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
590 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
591 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
592 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
593 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectExVtbl)
594 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectExVtbl)
595 #define VIEWOBJEX(x) ((IViewObjectEx*) &(x)->lpViewObjectExVtbl)
596 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
597 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
598 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
599 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
600 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
601 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
602 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
603 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
604 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
605 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
606 #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)
608 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
609 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
610 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
611 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
612 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
613 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
614 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
615 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
616 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
618 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
620 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
622 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
623 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
624 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
625 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
627 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
628 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
629 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
631 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
632 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
633 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
634 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
635 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
637 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
638 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
639 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
641 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
642 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
643 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
645 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
647 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
649 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
651 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
652 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
654 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
655 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
656 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
658 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**);
659 void update_window_doc(HTMLWindow*);
660 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
661 nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*);
662 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
663 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*);
664 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
665 IOmNavigator *OmNavigator_Create(void);
666 HRESULT HTMLScreen_Create(IHTMLScreen**);
668 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
669 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
670 void HTMLDocument_Persist_Init(HTMLDocument*);
671 void HTMLDocument_OleCmd_Init(HTMLDocument*);
672 void HTMLDocument_OleObj_Init(HTMLDocument*);
673 void HTMLDocument_View_Init(HTMLDocument*);
674 void HTMLDocument_Window_Init(HTMLDocument*);
675 void HTMLDocument_Service_Init(HTMLDocument*);
676 void HTMLDocument_Hlink_Init(HTMLDocument*);
678 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
680 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
682 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*);
683 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
684 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
686 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
687 void NSContainer_Release(NSContainer*);
689 void init_mutation(HTMLDocumentNode*);
690 void release_mutation(HTMLDocumentNode*);
692 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
693 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
694 void notif_focus(HTMLDocumentObj*);
696 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
697 void hide_tooltip(HTMLDocumentObj*);
698 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
700 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
702 BOOL load_gecko(BOOL);
703 void close_gecko(void);
704 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
705 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
706 void release_nsio(void);
707 BOOL install_wine_gecko(BOOL);
709 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
710 HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**);
711 HRESULT load_nsuri(HTMLWindow*,nsWineURI*,nsChannelBSC*,DWORD);
713 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD,BOOL*);
714 HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);
715 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*);
716 HRESULT set_moniker(HTMLDocument*,IMoniker*,IBindCtx*,nsChannelBSC*,BOOL);
718 void call_property_onchanged(ConnectionPoint*,DISPID);
719 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
721 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
724 void nsACString_SetData(nsACString*,const char*);
725 PRUint32 nsACString_GetData(const nsACString*,const char**);
727 BOOL nsAString_Init(nsAString*,const PRUnichar*);
728 void nsAString_InitDepend(nsAString*,const PRUnichar*);
729 void nsAString_SetData(nsAString*,const PRUnichar*);
730 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
731 void nsAString_Finish(nsAString*);
733 nsICommandParams *create_nscommand_params(void);
734 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
735 void get_editor_controller(NSContainer*);
736 nsresult get_nsinterface(nsISupports*,REFIID,void**);
738 void init_nsevents(HTMLDocumentNode*);
739 void release_nsevents(HTMLDocumentNode*);
740 void add_nsevent_listener(HTMLDocumentNode*,nsIDOMNode*,LPCWSTR);
742 void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
743 void set_current_mon(HTMLWindow*,IMoniker*);
744 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
745 HRESULT async_start_doc_binding(HTMLWindow*,nsChannelBSC*);
746 void abort_document_bindings(HTMLDocumentNode*);
748 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);
750 HRESULT create_channelbsc(IMoniker*,WCHAR*,BYTE*,DWORD,nsChannelBSC**);
751 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
752 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
753 IMoniker *get_channelbsc_mon(nsChannelBSC*);
755 void set_ready_state(HTMLWindow*,READYSTATE);
757 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
758 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
759 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
760 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
761 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
763 void detach_selection(HTMLDocumentNode*);
764 void detach_ranges(HTMLDocumentNode*);
765 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
767 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
769 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
771 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
772 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
773 HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
774 HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
775 HTMLElement *HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
776 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
777 HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
778 HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
779 HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
780 HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
781 HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
782 HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
783 HTMLElement *HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
784 HTMLElement *HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
785 HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
786 HTMLElement *HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
788 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
789 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
790 void HTMLElement2_Init(HTMLElement*);
791 void HTMLElement3_Init(HTMLElement*);
792 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
793 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
795 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
796 void HTMLDOMNode_destructor(HTMLDOMNode*);
798 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
799 void HTMLElement_destructor(HTMLDOMNode*);
801 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
802 void HTMLFrameBase_destructor(HTMLFrameBase*);
804 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
805 void release_nodes(HTMLDocumentNode*);
807 void release_script_hosts(HTMLWindow*);
808 void connect_scripts(HTMLWindow*);
809 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
810 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
811 void set_script_mode(HTMLWindow*,SCRIPTMODE);
812 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
813 IDispatch *get_script_disp(ScriptHost*);
814 HRESULT search_window_props(HTMLWindow*,BSTR,DWORD,DISPID*);
816 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
817 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
818 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
823 HRESULT (*query)(HTMLDocument*,OLECMD*);
824 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
827 extern const cmdtable_t editmode_cmds[];
829 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
832 #define UPDATE_UI 0x0001
833 #define UPDATE_TITLE 0x0002
835 void update_doc(HTMLDocument*,DWORD);
836 void update_title(HTMLDocumentObj*);
839 void init_editor(HTMLDocument*);
840 void set_ns_editmode(NSContainer*);
841 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
842 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
843 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
844 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
845 void handle_edit_load(HTMLDocument*);
846 HRESULT editor_is_dirty(HTMLDocument*);
847 void set_dirty(HTMLDocument*,VARIANT_BOOL);
849 extern DWORD mshtml_tls;
851 typedef struct task_t task_t;
852 typedef void (*task_proc_t)(task_t*);
862 HTMLDocumentObj *doc;
867 task_t *task_queue_head;
868 task_t *task_queue_tail;
869 struct list timer_list;
872 thread_data_t *get_thread_data(BOOL);
873 HWND get_thread_hwnd(void);
875 LONG get_task_target_magic(void);
876 void push_task(task_t*,task_proc_t,LONG);
877 void remove_target_tasks(LONG);
879 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
880 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
882 void release_typelib(void);
883 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
885 const char *debugstr_variant(const VARIANT*);
887 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
888 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
889 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
890 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
891 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
893 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
895 /* memory allocation functions */
897 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
899 return HeapAlloc(GetProcessHeap(), 0, len);
902 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
904 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
907 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
909 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
912 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
914 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
917 static inline BOOL heap_free(void *mem)
919 return HeapFree(GetProcessHeap(), 0, mem);
922 static inline LPWSTR heap_strdupW(LPCWSTR str)
929 size = (strlenW(str)+1)*sizeof(WCHAR);
930 ret = heap_alloc(size);
931 memcpy(ret, str, size);
937 static inline char *heap_strdupA(const char *str)
944 size = strlen(str)+1;
945 ret = heap_alloc(size);
946 memcpy(ret, str, size);
952 static inline WCHAR *heap_strdupAtoW(const char *str)
959 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
960 ret = heap_alloc(len*sizeof(WCHAR));
961 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
967 static inline char *heap_strdupWtoA(LPCWSTR str)
972 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
973 ret = heap_alloc(size);
974 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
980 static inline void windowref_addref(windowref_t *ref)
982 InterlockedIncrement(&ref->ref);
985 static inline void windowref_release(windowref_t *ref)
987 if(!InterlockedDecrement(&ref->ref))
991 HDC get_display_dc(void);
992 HINSTANCE get_shdoclc(void);
994 extern HINSTANCE hInst;