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 DispHTMLGenericElement_tid,
73 DispHTMLInputElement_tid,
75 DispHTMLNavigator_tid,
76 DispHTMLOptionElement_tid,
77 DispHTMLSelectElement_tid,
81 DispHTMLUnknownElement_tid,
83 HTMLDocumentEvents_tid,
84 IHTMLAnchorElement_tid,
86 IHTMLBodyElement2_tid,
87 IHTMLCommentElement_tid,
88 IHTMLCurrentStyle_tid,
89 IHTMLCurrentStyle2_tid,
90 IHTMLCurrentStyle3_tid,
91 IHTMLCurrentStyle4_tid,
96 IHTMLDOMChildrenCollection_tid,
104 IHTMLElementCollection_tid,
108 IHTMLGenericElement_tid,
109 IHTMLImageElementFactory_tid,
111 IHTMLInputElement_tid,
113 IHTMLOptionElement_tid,
114 IHTMLSelectElement_tid,
121 IHTMLTextContainer_tid,
130 typedef struct dispex_data_t dispex_data_t;
131 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
133 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
134 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
137 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
138 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
139 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
140 } dispex_static_data_vtbl_t;
143 const dispex_static_data_vtbl_t *vtbl;
144 const tid_t disp_tid;
146 const tid_t* const iface_tids;
147 } dispex_static_data_t;
150 const IDispatchExVtbl *lpIDispatchExVtbl;
154 dispex_static_data_t *data;
155 dispex_dynamic_data_t *dynamic_data;
158 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
159 void release_dispex(DispatchEx*);
160 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
161 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
162 HRESULT get_dispids(tid_t,DWORD*,DISPID**);
164 typedef struct HTMLDocumentNode HTMLDocumentNode;
165 typedef struct HTMLDocumentObj HTMLDocumentObj;
166 typedef struct HTMLFrameBase HTMLFrameBase;
170 SCRIPTMODE_ACTIVESCRIPT
173 typedef struct ScriptHost ScriptHost;
178 } global_prop_type_t;
181 global_prop_type_t type;
183 ScriptHost *script_host;
188 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
193 } HTMLOptionElementFactory;
197 const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl;
202 } HTMLImageElementFactory;
204 struct HTMLLocation {
206 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
220 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
221 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
222 const IHTMLWindow4Vtbl *lpHTMLWindow4Vtbl;
223 const IDispatchExVtbl *lpIDispatchExVtbl;
227 windowref_t *window_ref;
230 HTMLDocumentNode *doc;
231 HTMLDocumentObj *doc_obj;
232 nsIDOMWindow *nswindow;
234 HTMLFrameBase *frame_element;
235 READYSTATE readystate;
237 nsChannelBSC *bscallback;
241 event_target_t *event_target;
242 IHTMLEventObj *event;
244 SCRIPTMODE scriptmode;
245 struct list script_hosts;
247 HTMLOptionElementFactory *option_factory;
248 HTMLImageElementFactory *image_factory;
249 HTMLLocation *location;
251 global_prop_t *global_props;
252 DWORD global_prop_cnt;
253 DWORD global_prop_size;
255 struct list children;
256 struct list sibling_entry;
272 typedef struct ConnectionPointContainer {
273 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
275 ConnectionPoint *cp_list;
277 struct ConnectionPointContainer *forward_container;
278 } ConnectionPointContainer;
280 struct ConnectionPoint {
281 const IConnectionPointVtbl *lpConnectionPointVtbl;
283 IConnectionPointContainer *container;
288 IPropertyNotifySink *propnotif;
293 cp_static_data_t *data;
295 ConnectionPoint *next;
298 struct HTMLDocument {
299 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
300 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
301 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
302 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
303 const IHTMLDocument6Vtbl *lpHTMLDocument6Vtbl;
304 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
305 const IPersistFileVtbl *lpPersistFileVtbl;
306 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
307 const IMonikerPropVtbl *lpMonikerPropVtbl;
308 const IOleObjectVtbl *lpOleObjectVtbl;
309 const IOleDocumentVtbl *lpOleDocumentVtbl;
310 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
311 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
312 const IViewObject2Vtbl *lpViewObject2Vtbl;
313 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
314 const IServiceProviderVtbl *lpServiceProviderVtbl;
315 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
316 const IOleControlVtbl *lpOleControlVtbl;
317 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
318 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
319 const IDispatchExVtbl *lpIDispatchExVtbl;
320 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
325 HTMLDocumentObj *doc_obj;
326 HTMLDocumentNode *doc_node;
332 ConnectionPointContainer cp_container;
333 ConnectionPoint cp_htmldocevents;
334 ConnectionPoint cp_htmldocevents2;
335 ConnectionPoint cp_propnotif;
338 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
340 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
343 static inline ULONG htmldoc_addref(HTMLDocument *This)
345 return IUnknown_AddRef(This->unk_impl);
348 static inline ULONG htmldoc_release(HTMLDocument *This)
350 return IUnknown_Release(This->unk_impl);
353 struct HTMLDocumentObj {
354 HTMLDocument basedoc;
356 const ICustomDocVtbl *lpCustomDocVtbl;
360 NSContainer *nscontainer;
362 IOleClientSite *client;
363 IDocHostUIHandler *hostui;
364 IOleInPlaceSite *ipsite;
365 IOleInPlaceFrame *frame;
366 IOleInPlaceUIWindow *ip_window;
368 DOCHOSTUIINFO hostinfo;
370 IOleUndoManager *undomgr;
375 BOOL in_place_active;
379 BOOL container_locked;
389 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
390 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
391 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
392 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
393 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
394 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
395 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
396 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
398 nsIWebBrowser *webbrowser;
399 nsIWebNavigation *navigation;
400 nsIBaseWindow *window;
401 nsIWebBrowserFocus *focus;
404 nsIController *editor_controller;
409 HTMLDocumentObj *doc;
411 nsIURIContentListener *content_listener;
415 nsChannelBSC *bscallback; /* hack */
416 HWND reset_focus; /* hack */
420 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
421 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
422 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
427 nsIHttpChannel *http_channel;
428 nsIHttpChannelInternal *http_channel_internal;
430 nsIInputStream *post_data_stream;
431 nsILoadGroup *load_group;
432 nsIInterfaceRequestor *notif_callback;
434 nsLoadFlags load_flags;
435 nsIURI *original_uri;
438 PRUint32 response_status;
442 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
443 void (*destructor)(HTMLDOMNode*);
444 event_target_t **(*get_event_target)(HTMLDOMNode*);
445 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
446 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
447 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
452 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
453 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
454 const NodeImplVtbl *vtbl;
459 HTMLDocumentNode *doc;
460 event_target_t *event_target;
461 ConnectionPointContainer *cp_container;
468 ConnectionPointContainer cp_container;
470 const IHTMLElementVtbl *lpHTMLElementVtbl;
471 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
472 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
474 nsIDOMHTMLElement *nselem;
480 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
485 struct HTMLFrameBase {
488 const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
490 HTMLWindow *content_window;
493 typedef struct _mutation_queue_t {
495 nsISupports *nsiface;
497 struct _mutation_queue_t *next;
500 typedef struct nsDocumentEventListener nsDocumentEventListener;
502 struct HTMLDocumentNode {
504 HTMLDocument basedoc;
506 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
508 const nsIDocumentObserverVtbl *lpIDocumentObserverVtbl;
509 const nsIRunnableVtbl *lpIRunnableVtbl;
513 nsIDOMHTMLDocument *nsdoc;
517 IInternetSecurityManager *secmgr;
518 ICatInformation *catmgr;
519 nsDocumentEventListener *nsevent_listener;
522 mutation_queue_t *mutation_queue;
523 mutation_queue_t *mutation_queue_tail;
525 struct list bindings;
526 struct list selection_list;
527 struct list range_list;
530 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
531 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
532 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
534 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
535 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
536 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
537 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
538 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
539 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
540 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
541 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
542 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
543 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
544 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
545 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
546 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
547 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
548 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
549 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
550 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
551 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
552 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
553 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
554 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
555 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
556 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
557 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
558 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
559 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
561 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
562 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
563 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
564 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
565 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
566 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
567 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
568 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
569 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
571 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
573 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
575 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
576 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
577 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
578 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
580 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
581 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
582 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
584 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
585 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
586 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
587 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
588 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
590 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
591 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
593 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
594 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
595 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
597 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
599 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
601 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
603 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
604 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
606 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
607 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
608 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
610 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**);
611 void update_window_doc(HTMLWindow*);
612 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
613 nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*);
614 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
615 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*);
616 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
617 IOmNavigator *OmNavigator_Create(void);
619 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
620 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
621 void HTMLDocument_Persist_Init(HTMLDocument*);
622 void HTMLDocument_OleCmd_Init(HTMLDocument*);
623 void HTMLDocument_OleObj_Init(HTMLDocument*);
624 void HTMLDocument_View_Init(HTMLDocument*);
625 void HTMLDocument_Window_Init(HTMLDocument*);
626 void HTMLDocument_Service_Init(HTMLDocument*);
627 void HTMLDocument_Hlink_Init(HTMLDocument*);
629 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
631 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
633 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*);
634 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
635 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
637 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
638 void NSContainer_Release(NSContainer*);
640 void init_mutation(HTMLDocumentNode*);
641 void release_mutation(HTMLDocumentNode*);
643 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
644 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
645 void notif_focus(HTMLDocumentObj*);
647 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
648 void hide_tooltip(HTMLDocumentObj*);
649 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
651 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
653 BOOL load_gecko(BOOL);
654 void close_gecko(void);
655 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
656 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
657 void release_nsio(void);
658 BOOL install_wine_gecko(BOOL);
660 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
662 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD);
663 HRESULT navigate_url(HTMLDocumentNode*,OLECHAR*);
665 void call_property_onchanged(ConnectionPoint*,DISPID);
666 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
668 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
671 void nsACString_Init(nsACString*,const char*);
672 void nsACString_SetData(nsACString*,const char*);
673 PRUint32 nsACString_GetData(const nsACString*,const char**);
674 void nsACString_Finish(nsACString*);
676 void nsAString_Init(nsAString*,const PRUnichar*);
677 void nsAString_SetData(nsAString*,const PRUnichar*);
678 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
679 void nsAString_Finish(nsAString*);
681 nsICommandParams *create_nscommand_params(void);
682 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
683 void get_editor_controller(NSContainer*);
684 nsresult get_nsinterface(nsISupports*,REFIID,void**);
686 void init_nsevents(HTMLDocumentNode*);
687 void release_nsevents(HTMLDocumentNode*);
688 void add_nsevent_listener(HTMLDocumentNode*,LPCWSTR);
690 void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
691 void set_current_mon(HTMLWindow*,IMoniker*);
692 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
693 void abort_document_bindings(HTMLDocumentNode*);
695 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);
697 nsChannelBSC *create_channelbsc(IMoniker*);
698 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
699 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
700 IMoniker *get_channelbsc_mon(nsChannelBSC*);
702 void set_ready_state(HTMLWindow*,READYSTATE);
704 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
705 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
706 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
707 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
708 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
710 void detach_selection(HTMLDocumentNode*);
711 void detach_ranges(HTMLDocumentNode*);
712 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
714 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
716 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
718 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
719 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
720 HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
721 HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
722 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*);
723 HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*);
724 HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
725 HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
726 HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
727 HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
728 HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
729 HTMLElement *HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
730 HTMLElement *HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
731 HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
732 HTMLElement *HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
734 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
735 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
736 void HTMLElement2_Init(HTMLElement*);
737 void HTMLElement3_Init(HTMLElement*);
738 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
739 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*,dispex_static_data_t*);
741 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
742 void HTMLDOMNode_destructor(HTMLDOMNode*);
744 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
745 void HTMLElement_destructor(HTMLDOMNode*);
747 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
748 void HTMLFrameBase_destructor(HTMLFrameBase*);
750 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
751 void release_nodes(HTMLDocumentNode*);
753 void release_script_hosts(HTMLWindow*);
754 void connect_scripts(HTMLWindow*);
755 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
756 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
757 void set_script_mode(HTMLWindow*,SCRIPTMODE);
758 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
759 IDispatch *get_script_disp(ScriptHost*);
761 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
762 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
763 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
768 HRESULT (*query)(HTMLDocument*,OLECMD*);
769 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
772 extern const cmdtable_t editmode_cmds[];
774 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
777 #define UPDATE_UI 0x0001
778 #define UPDATE_TITLE 0x0002
780 void update_doc(HTMLDocument*,DWORD);
781 void update_title(HTMLDocumentObj*);
784 void init_editor(HTMLDocument*);
785 void set_ns_editmode(NSContainer*);
786 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
787 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
788 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
789 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
790 void handle_edit_load(HTMLDocument*);
791 HRESULT editor_is_dirty(HTMLDocument*);
792 void set_dirty(HTMLDocument*,VARIANT_BOOL);
794 extern DWORD mshtml_tls;
796 typedef struct task_t task_t;
797 typedef void (*task_proc_t)(task_t*);
807 HTMLDocumentObj *doc;
812 task_t *task_queue_head;
813 task_t *task_queue_tail;
814 struct list timer_list;
817 thread_data_t *get_thread_data(BOOL);
818 HWND get_thread_hwnd(void);
820 LONG get_task_target_magic(void);
821 void push_task(task_t*,task_proc_t,LONG);
822 void remove_target_tasks(LONG);
824 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
825 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
827 void release_typelib(void);
828 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
830 const char *debugstr_variant(const VARIANT*);
832 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
833 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
834 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
835 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
836 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
838 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
840 /* memory allocation functions */
842 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
844 return HeapAlloc(GetProcessHeap(), 0, len);
847 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
849 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
852 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
854 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
857 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
859 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
862 static inline BOOL heap_free(void *mem)
864 return HeapFree(GetProcessHeap(), 0, mem);
867 static inline LPWSTR heap_strdupW(LPCWSTR str)
874 size = (strlenW(str)+1)*sizeof(WCHAR);
875 ret = heap_alloc(size);
876 memcpy(ret, str, size);
882 static inline char *heap_strdupA(const char *str)
889 size = strlen(str)+1;
890 ret = heap_alloc(size);
891 memcpy(ret, str, size);
897 static inline WCHAR *heap_strdupAtoW(const char *str)
904 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
905 ret = heap_alloc(len*sizeof(WCHAR));
906 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
912 static inline char *heap_strdupWtoA(LPCWSTR str)
917 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
918 ret = heap_alloc(size);
919 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
925 static inline void windowref_addref(windowref_t *ref)
927 InterlockedIncrement(&ref->ref);
930 static inline void windowref_release(windowref_t *ref)
932 if(!InterlockedDecrement(&ref->ref))
936 HINSTANCE get_shdoclc(void);
938 extern HINSTANCE hInst;