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,
78 DispHTMLSelectElement_tid,
82 DispHTMLUnknownElement_tid,
84 HTMLDocumentEvents_tid,
85 IHTMLAnchorElement_tid,
87 IHTMLBodyElement2_tid,
88 IHTMLCommentElement_tid,
89 IHTMLCurrentStyle_tid,
90 IHTMLCurrentStyle2_tid,
91 IHTMLCurrentStyle3_tid,
92 IHTMLCurrentStyle4_tid,
97 IHTMLDOMChildrenCollection_tid,
100 IHTMLDOMTextNode_tid,
105 IHTMLElementCollection_tid,
109 IHTMLGenericElement_tid,
110 IHTMLImageElementFactory_tid,
112 IHTMLInputElement_tid,
114 IHTMLOptionElement_tid,
116 IHTMLSelectElement_tid,
123 IHTMLTextContainer_tid,
132 typedef struct dispex_data_t dispex_data_t;
133 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
135 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
136 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
139 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
140 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
141 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
142 } dispex_static_data_vtbl_t;
145 const dispex_static_data_vtbl_t *vtbl;
146 const tid_t disp_tid;
148 const tid_t* const iface_tids;
149 } dispex_static_data_t;
152 const IDispatchExVtbl *lpIDispatchExVtbl;
156 dispex_static_data_t *data;
157 dispex_dynamic_data_t *dynamic_data;
160 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
161 void release_dispex(DispatchEx*);
162 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
163 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
164 HRESULT get_dispids(tid_t,DWORD*,DISPID**);
166 typedef struct HTMLDocumentNode HTMLDocumentNode;
167 typedef struct HTMLDocumentObj HTMLDocumentObj;
168 typedef struct HTMLFrameBase HTMLFrameBase;
172 SCRIPTMODE_ACTIVESCRIPT
175 typedef struct ScriptHost ScriptHost;
180 } global_prop_type_t;
183 global_prop_type_t type;
185 ScriptHost *script_host;
190 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
195 } HTMLOptionElementFactory;
199 const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl;
204 } HTMLImageElementFactory;
206 struct HTMLLocation {
208 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
222 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
223 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
224 const IHTMLWindow4Vtbl *lpHTMLWindow4Vtbl;
225 const IDispatchExVtbl *lpIDispatchExVtbl;
229 windowref_t *window_ref;
232 HTMLDocumentNode *doc;
233 HTMLDocumentObj *doc_obj;
234 nsIDOMWindow *nswindow;
236 HTMLFrameBase *frame_element;
237 READYSTATE readystate;
239 nsChannelBSC *bscallback;
243 event_target_t *event_target;
244 IHTMLEventObj *event;
246 SCRIPTMODE scriptmode;
247 struct list script_hosts;
249 HTMLOptionElementFactory *option_factory;
250 HTMLImageElementFactory *image_factory;
251 HTMLLocation *location;
254 global_prop_t *global_props;
255 DWORD global_prop_cnt;
256 DWORD global_prop_size;
258 struct list children;
259 struct list sibling_entry;
275 typedef struct ConnectionPointContainer {
276 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
278 ConnectionPoint *cp_list;
280 struct ConnectionPointContainer *forward_container;
281 } ConnectionPointContainer;
283 struct ConnectionPoint {
284 const IConnectionPointVtbl *lpConnectionPointVtbl;
286 IConnectionPointContainer *container;
291 IPropertyNotifySink *propnotif;
296 cp_static_data_t *data;
298 ConnectionPoint *next;
301 struct HTMLDocument {
302 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
303 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
304 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
305 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
306 const IHTMLDocument6Vtbl *lpHTMLDocument6Vtbl;
307 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
308 const IPersistFileVtbl *lpPersistFileVtbl;
309 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
310 const IMonikerPropVtbl *lpMonikerPropVtbl;
311 const IOleObjectVtbl *lpOleObjectVtbl;
312 const IOleDocumentVtbl *lpOleDocumentVtbl;
313 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
314 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
315 const IViewObject2Vtbl *lpViewObject2Vtbl;
316 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
317 const IServiceProviderVtbl *lpServiceProviderVtbl;
318 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
319 const IOleControlVtbl *lpOleControlVtbl;
320 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
321 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
322 const IDispatchExVtbl *lpIDispatchExVtbl;
323 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
328 HTMLDocumentObj *doc_obj;
329 HTMLDocumentNode *doc_node;
335 ConnectionPointContainer cp_container;
336 ConnectionPoint cp_htmldocevents;
337 ConnectionPoint cp_htmldocevents2;
338 ConnectionPoint cp_propnotif;
341 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
343 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
346 static inline ULONG htmldoc_addref(HTMLDocument *This)
348 return IUnknown_AddRef(This->unk_impl);
351 static inline ULONG htmldoc_release(HTMLDocument *This)
353 return IUnknown_Release(This->unk_impl);
356 struct HTMLDocumentObj {
357 HTMLDocument basedoc;
359 const ICustomDocVtbl *lpCustomDocVtbl;
363 NSContainer *nscontainer;
365 IOleClientSite *client;
366 IDocHostUIHandler *hostui;
367 IOleInPlaceSite *ipsite;
368 IOleInPlaceFrame *frame;
369 IOleInPlaceUIWindow *ip_window;
371 DOCHOSTUIINFO hostinfo;
373 IOleUndoManager *undomgr;
378 BOOL in_place_active;
382 BOOL container_locked;
392 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
393 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
394 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
395 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
396 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
397 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
398 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
399 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
401 nsIWebBrowser *webbrowser;
402 nsIWebNavigation *navigation;
403 nsIBaseWindow *window;
404 nsIWebBrowserFocus *focus;
407 nsIController *editor_controller;
412 HTMLDocumentObj *doc;
414 nsIURIContentListener *content_listener;
418 nsChannelBSC *bscallback; /* hack */
419 HWND reset_focus; /* hack */
423 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
424 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
425 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
430 nsIHttpChannel *http_channel;
431 nsIHttpChannelInternal *http_channel_internal;
433 nsIInputStream *post_data_stream;
434 nsILoadGroup *load_group;
435 nsIInterfaceRequestor *notif_callback;
437 nsLoadFlags load_flags;
438 nsIURI *original_uri;
441 PRUint32 response_status;
445 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
446 void (*destructor)(HTMLDOMNode*);
447 event_target_t **(*get_event_target)(HTMLDOMNode*);
448 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
449 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
450 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
451 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
452 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
457 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
458 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
459 const NodeImplVtbl *vtbl;
464 HTMLDocumentNode *doc;
465 event_target_t *event_target;
466 ConnectionPointContainer *cp_container;
473 ConnectionPointContainer cp_container;
475 const IHTMLElementVtbl *lpHTMLElementVtbl;
476 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
477 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
479 nsIDOMHTMLElement *nselem;
485 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
490 struct HTMLFrameBase {
493 const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
494 const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
496 HTMLWindow *content_window;
499 typedef struct _mutation_queue_t {
501 nsISupports *nsiface;
503 struct _mutation_queue_t *next;
506 typedef struct nsDocumentEventListener nsDocumentEventListener;
508 struct HTMLDocumentNode {
510 HTMLDocument basedoc;
512 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
514 const nsIDocumentObserverVtbl *lpIDocumentObserverVtbl;
515 const nsIRunnableVtbl *lpIRunnableVtbl;
519 nsIDOMHTMLDocument *nsdoc;
523 IInternetSecurityManager *secmgr;
524 ICatInformation *catmgr;
525 nsDocumentEventListener *nsevent_listener;
528 mutation_queue_t *mutation_queue;
529 mutation_queue_t *mutation_queue_tail;
531 struct list bindings;
532 struct list selection_list;
533 struct list range_list;
536 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
537 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
538 #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
540 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
541 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
542 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
543 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
544 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
545 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
546 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
547 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
548 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
549 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
550 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
551 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
552 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
553 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
554 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
555 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
556 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
557 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
558 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
559 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
560 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
561 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
562 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
563 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
564 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
565 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
567 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
568 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
569 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
570 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
571 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
572 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
573 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
574 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
575 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
577 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
579 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
581 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
582 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
583 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
584 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
586 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
587 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
588 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
590 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
591 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
592 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
593 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
594 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
596 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
597 #define HTMLFRAMEBASE(x) ((IHTMLFrameBase*) &(x)->lpIHTMLFrameBaseVtbl)
598 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
600 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
601 #define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
602 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
604 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
606 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
608 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
610 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
611 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
613 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
614 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
615 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
617 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**);
618 void update_window_doc(HTMLWindow*);
619 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
620 nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*);
621 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
622 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*);
623 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
624 IOmNavigator *OmNavigator_Create(void);
625 HRESULT HTMLScreen_Create(IHTMLScreen**);
627 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
628 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
629 void HTMLDocument_Persist_Init(HTMLDocument*);
630 void HTMLDocument_OleCmd_Init(HTMLDocument*);
631 void HTMLDocument_OleObj_Init(HTMLDocument*);
632 void HTMLDocument_View_Init(HTMLDocument*);
633 void HTMLDocument_Window_Init(HTMLDocument*);
634 void HTMLDocument_Service_Init(HTMLDocument*);
635 void HTMLDocument_Hlink_Init(HTMLDocument*);
637 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
639 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
641 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*);
642 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
643 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
645 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
646 void NSContainer_Release(NSContainer*);
648 void init_mutation(HTMLDocumentNode*);
649 void release_mutation(HTMLDocumentNode*);
651 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
652 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
653 void notif_focus(HTMLDocumentObj*);
655 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
656 void hide_tooltip(HTMLDocumentObj*);
657 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
659 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
661 BOOL load_gecko(BOOL);
662 void close_gecko(void);
663 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
664 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
665 void release_nsio(void);
666 BOOL install_wine_gecko(BOOL);
668 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
670 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD);
671 HRESULT navigate_url(HTMLDocumentNode*,OLECHAR*);
673 void call_property_onchanged(ConnectionPoint*,DISPID);
674 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
676 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
679 void nsACString_Init(nsACString*,const char*);
680 void nsACString_SetData(nsACString*,const char*);
681 PRUint32 nsACString_GetData(const nsACString*,const char**);
682 void nsACString_Finish(nsACString*);
684 void nsAString_Init(nsAString*,const PRUnichar*);
685 void nsAString_SetData(nsAString*,const PRUnichar*);
686 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
687 void nsAString_Finish(nsAString*);
689 nsICommandParams *create_nscommand_params(void);
690 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
691 void get_editor_controller(NSContainer*);
692 nsresult get_nsinterface(nsISupports*,REFIID,void**);
694 void init_nsevents(HTMLDocumentNode*);
695 void release_nsevents(HTMLDocumentNode*);
696 void add_nsevent_listener(HTMLDocumentNode*,LPCWSTR);
698 void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
699 void set_current_mon(HTMLWindow*,IMoniker*);
700 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
701 void abort_document_bindings(HTMLDocumentNode*);
703 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);
705 nsChannelBSC *create_channelbsc(IMoniker*);
706 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
707 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
708 IMoniker *get_channelbsc_mon(nsChannelBSC*);
710 void set_ready_state(HTMLWindow*,READYSTATE);
712 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
713 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
714 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
715 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
716 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
718 void detach_selection(HTMLDocumentNode*);
719 void detach_ranges(HTMLDocumentNode*);
720 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
722 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
724 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
726 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
727 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
728 HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
729 HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
730 HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*);
731 HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*);
732 HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
733 HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
734 HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
735 HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
736 HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
737 HTMLElement *HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
738 HTMLElement *HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
739 HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
740 HTMLElement *HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
742 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
743 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
744 void HTMLElement2_Init(HTMLElement*);
745 void HTMLElement3_Init(HTMLElement*);
746 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
747 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*,dispex_static_data_t*);
749 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
750 void HTMLDOMNode_destructor(HTMLDOMNode*);
752 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
753 void HTMLElement_destructor(HTMLDOMNode*);
755 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
756 void HTMLFrameBase_destructor(HTMLFrameBase*);
758 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
759 void release_nodes(HTMLDocumentNode*);
761 void release_script_hosts(HTMLWindow*);
762 void connect_scripts(HTMLWindow*);
763 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
764 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
765 void set_script_mode(HTMLWindow*,SCRIPTMODE);
766 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
767 IDispatch *get_script_disp(ScriptHost*);
769 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
770 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
771 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
776 HRESULT (*query)(HTMLDocument*,OLECMD*);
777 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
780 extern const cmdtable_t editmode_cmds[];
782 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
785 #define UPDATE_UI 0x0001
786 #define UPDATE_TITLE 0x0002
788 void update_doc(HTMLDocument*,DWORD);
789 void update_title(HTMLDocumentObj*);
792 void init_editor(HTMLDocument*);
793 void set_ns_editmode(NSContainer*);
794 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
795 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
796 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
797 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
798 void handle_edit_load(HTMLDocument*);
799 HRESULT editor_is_dirty(HTMLDocument*);
800 void set_dirty(HTMLDocument*,VARIANT_BOOL);
802 extern DWORD mshtml_tls;
804 typedef struct task_t task_t;
805 typedef void (*task_proc_t)(task_t*);
815 HTMLDocumentObj *doc;
820 task_t *task_queue_head;
821 task_t *task_queue_tail;
822 struct list timer_list;
825 thread_data_t *get_thread_data(BOOL);
826 HWND get_thread_hwnd(void);
828 LONG get_task_target_magic(void);
829 void push_task(task_t*,task_proc_t,LONG);
830 void remove_target_tasks(LONG);
832 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
833 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
835 void release_typelib(void);
836 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
838 const char *debugstr_variant(const VARIANT*);
840 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
841 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
842 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
843 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
844 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
846 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
848 /* memory allocation functions */
850 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
852 return HeapAlloc(GetProcessHeap(), 0, len);
855 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
857 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
860 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
862 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
865 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
867 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
870 static inline BOOL heap_free(void *mem)
872 return HeapFree(GetProcessHeap(), 0, mem);
875 static inline LPWSTR heap_strdupW(LPCWSTR str)
882 size = (strlenW(str)+1)*sizeof(WCHAR);
883 ret = heap_alloc(size);
884 memcpy(ret, str, size);
890 static inline char *heap_strdupA(const char *str)
897 size = strlen(str)+1;
898 ret = heap_alloc(size);
899 memcpy(ret, str, size);
905 static inline WCHAR *heap_strdupAtoW(const char *str)
912 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
913 ret = heap_alloc(len*sizeof(WCHAR));
914 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
920 static inline char *heap_strdupWtoA(LPCWSTR str)
925 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
926 ret = heap_alloc(size);
927 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
933 static inline void windowref_addref(windowref_t *ref)
935 InterlockedIncrement(&ref->ref);
938 static inline void windowref_release(windowref_t *ref)
940 if(!InterlockedDecrement(&ref->ref))
944 HDC get_display_dc(void);
945 HINSTANCE get_shdoclc(void);
947 extern HINSTANCE hInst;