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
27 #include "wine/list.h"
28 #include "wine/unicode.h"
36 #define NS_OK ((nsresult)0x00000000L)
37 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
38 #define NS_NOINTERFACE ((nsresult)0x80004002L)
39 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
40 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
41 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
42 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
44 #define NS_FAILED(res) ((res) & 0x80000000)
45 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
49 #define MSHTML_E_NODOC 0x800a025c
51 typedef struct HTMLDOMNode HTMLDOMNode;
52 typedef struct ConnectionPoint ConnectionPoint;
53 typedef struct BSCallback BSCallback;
54 typedef struct nsChannelBSC nsChannelBSC;
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 DispHTMLGenericElement_tid,
72 DispHTMLInputElement_tid,
74 DispHTMLNavigator_tid,
75 DispHTMLOptionElement_tid,
76 DispHTMLSelectElement_tid,
80 DispHTMLUnknownElement_tid,
82 IHTMLAnchorElement_tid,
84 IHTMLBodyElement2_tid,
85 IHTMLCommentElement_tid,
86 IHTMLCurrentStyle_tid,
87 IHTMLCurrentStyle2_tid,
88 IHTMLCurrentStyle3_tid,
89 IHTMLCurrentStyle4_tid,
94 IHTMLDOMChildrenCollection_tid,
102 IHTMLElementCollection_tid,
105 IHTMLGenericElement_tid,
107 IHTMLInputElement_tid,
109 IHTMLOptionElement_tid,
110 IHTMLSelectElement_tid,
117 IHTMLTextContainer_tid,
125 typedef struct dispex_data_t dispex_data_t;
126 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
128 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
129 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
132 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
133 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
134 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
135 } dispex_static_data_vtbl_t;
138 const dispex_static_data_vtbl_t *vtbl;
139 const tid_t disp_tid;
141 const tid_t* const iface_tids;
142 } dispex_static_data_t;
145 const IDispatchExVtbl *lpIDispatchExVtbl;
149 dispex_static_data_t *data;
150 dispex_dynamic_data_t *dynamic_data;
153 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
154 void release_dispex(DispatchEx*);
155 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
156 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
158 typedef struct HTMLWindow HTMLWindow;
159 typedef struct HTMLDocumentNode HTMLDocumentNode;
160 typedef struct HTMLDocumentObj HTMLDocumentObj;
164 SCRIPTMODE_ACTIVESCRIPT
167 typedef struct ScriptHost ScriptHost;
171 ScriptHost *script_host;
176 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
181 } HTMLOptionElementFactory;
183 struct HTMLLocation {
185 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
194 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
195 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
196 const IDispatchExVtbl *lpIDispatchExVtbl;
200 HTMLDocumentNode *doc;
201 HTMLDocumentObj *doc_obj;
202 nsIDOMWindow *nswindow;
204 event_target_t *event_target;
205 IHTMLEventObj *event;
208 SCRIPTMODE scriptmode;
209 struct list script_hosts;
211 HTMLOptionElementFactory *option_factory;
212 HTMLLocation *location;
214 global_prop_t *global_props;
215 DWORD global_prop_cnt;
216 DWORD global_prop_size;
228 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
230 ConnectionPoint *cp_list;
232 } ConnectionPointContainer;
234 struct ConnectionPoint {
235 const IConnectionPointVtbl *lpConnectionPointVtbl;
237 IConnectionPointContainer *container;
242 IPropertyNotifySink *propnotif;
248 ConnectionPoint *next;
251 struct HTMLDocument {
252 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
253 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
254 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
255 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
256 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
257 const IPersistFileVtbl *lpPersistFileVtbl;
258 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
259 const IMonikerPropVtbl *lpMonikerPropVtbl;
260 const IOleObjectVtbl *lpOleObjectVtbl;
261 const IOleDocumentVtbl *lpOleDocumentVtbl;
262 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
263 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
264 const IViewObject2Vtbl *lpViewObject2Vtbl;
265 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
266 const IServiceProviderVtbl *lpServiceProviderVtbl;
267 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
268 const IOleControlVtbl *lpOleControlVtbl;
269 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
270 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
271 const IDispatchExVtbl *lpIDispatchExVtbl;
272 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
277 HTMLDocumentObj *doc_obj;
278 HTMLDocumentNode *doc_node;
281 nsIDOMHTMLDocument *nsdoc;
283 ConnectionPointContainer cp_container;
284 ConnectionPoint cp_htmldocevents;
285 ConnectionPoint cp_htmldocevents2;
286 ConnectionPoint cp_propnotif;
289 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
291 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
294 static inline ULONG htmldoc_addref(HTMLDocument *This)
296 return IUnknown_AddRef(This->unk_impl);
299 static inline ULONG htmldoc_release(HTMLDocument *This)
301 return IUnknown_Release(This->unk_impl);
304 struct HTMLDocumentObj {
305 HTMLDocument basedoc;
307 const ICustomDocVtbl *lpCustomDocVtbl;
311 NSContainer *nscontainer;
313 IOleClientSite *client;
314 IDocHostUIHandler *hostui;
315 IOleInPlaceSite *ipsite;
316 IOleInPlaceFrame *frame;
317 IOleInPlaceUIWindow *ip_window;
319 DOCHOSTUIINFO hostinfo;
321 IOleUndoManager *undomgr;
326 BOOL in_place_active;
330 BOOL container_locked;
334 READYSTATE readystate;
339 /* FIXME: probably should be in document node object */
340 nsChannelBSC *bscallback;
343 struct list bindings;
347 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
351 typedef struct _mutation_queue_t {
353 nsISupports *nsiface;
355 struct _mutation_queue_t *next;
359 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
360 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
361 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
362 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
363 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
364 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
365 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
366 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
368 const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
370 const nsIRunnableVtbl *lpRunnableVtbl;
372 nsEventListener blur_listener;
373 nsEventListener focus_listener;
374 nsEventListener keypress_listener;
375 nsEventListener load_listener;
376 nsEventListener htmlevent_listener;
378 nsIWebBrowser *webbrowser;
379 nsIWebNavigation *navigation;
380 nsIBaseWindow *window;
381 nsIWebBrowserFocus *focus;
384 nsIController *editor_controller;
389 HTMLDocumentObj *doc;
391 nsIURIContentListener *content_listener;
395 mutation_queue_t *mutation_queue;
396 mutation_queue_t *mutation_queue_tail;
398 nsChannelBSC *bscallback; /* hack */
399 HWND reset_focus; /* hack */
403 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
404 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
405 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
410 nsIHttpChannel *http_channel;
411 nsIHttpChannelInternal *http_channel_internal;
413 nsIInputStream *post_data_stream;
414 nsILoadGroup *load_group;
415 nsIInterfaceRequestor *notif_callback;
417 nsLoadFlags load_flags;
418 nsIURI *original_uri;
421 PRUint32 response_status;
425 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
426 void (*destructor)(HTMLDOMNode*);
427 event_target_t **(*get_event_target)(HTMLDOMNode*);
428 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
429 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
434 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
435 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
436 const NodeImplVtbl *vtbl;
441 HTMLDocumentNode *doc;
442 event_target_t *event_target;
449 ConnectionPointContainer cp_container;
451 const IHTMLElementVtbl *lpHTMLElementVtbl;
452 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
453 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
455 nsIDOMHTMLElement *nselem;
461 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
466 struct HTMLDocumentNode {
468 HTMLDocument basedoc;
470 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
476 IInternetSecurityManager *secmgr;
478 struct list selection_list;
479 struct list range_list;
482 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
483 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
485 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
486 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
487 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
488 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
489 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
490 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
491 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
492 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
493 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
494 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
495 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
496 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
497 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
498 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
499 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
500 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
501 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
502 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
503 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
504 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
505 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
506 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
507 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
508 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
509 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
511 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
512 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
513 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
514 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
515 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
516 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
517 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
518 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
519 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
521 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
523 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
525 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
526 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
527 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
528 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
530 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
531 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
532 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
534 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
535 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
536 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
537 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
538 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
540 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
542 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
543 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
545 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
547 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
549 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
551 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
552 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
554 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
555 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
556 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
558 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow**);
559 void window_set_docnode(HTMLWindow*,HTMLDocumentNode*);
560 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
561 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
562 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
563 IOmNavigator *OmNavigator_Create(void);
565 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
566 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
567 void HTMLDocument_Persist_Init(HTMLDocument*);
568 void HTMLDocument_OleCmd_Init(HTMLDocument*);
569 void HTMLDocument_OleObj_Init(HTMLDocument*);
570 void HTMLDocument_View_Init(HTMLDocument*);
571 void HTMLDocument_Window_Init(HTMLDocument*);
572 void HTMLDocument_Service_Init(HTMLDocument*);
573 void HTMLDocument_Hlink_Init(HTMLDocument*);
575 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
577 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
579 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
580 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
581 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
583 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
584 void NSContainer_Release(NSContainer*);
586 void init_mutation(NSContainer*);
587 void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
588 void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
590 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
591 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
592 void notif_focus(HTMLDocumentObj*);
594 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
595 void hide_tooltip(HTMLDocumentObj*);
596 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
598 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
600 BOOL load_gecko(BOOL);
601 void close_gecko(void);
602 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
603 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
604 void release_nsio(void);
605 BOOL install_wine_gecko(BOOL);
607 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
609 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
611 void call_property_onchanged(ConnectionPoint*,DISPID);
612 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
614 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
617 void nsACString_Init(nsACString*,const char*);
618 void nsACString_SetData(nsACString*,const char*);
619 PRUint32 nsACString_GetData(const nsACString*,const char**);
620 void nsACString_Finish(nsACString*);
622 void nsAString_Init(nsAString*,const PRUnichar*);
623 void nsAString_SetData(nsAString*,const PRUnichar*);
624 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
625 void nsAString_Finish(nsAString*);
627 nsICommandParams *create_nscommand_params(void);
628 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
629 void get_editor_controller(NSContainer*);
630 void init_nsevents(NSContainer*);
631 void add_nsevent_listener(HTMLWindow*,LPCWSTR);
632 nsresult get_nsinterface(nsISupports*,REFIID,void**);
633 void update_nsdocument(HTMLDocumentObj*);
635 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
636 void set_current_mon(HTMLDocument*,IMoniker*);
637 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
639 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
641 nsChannelBSC *create_channelbsc(IMoniker*);
642 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
643 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
644 IMoniker *get_channelbsc_mon(nsChannelBSC*);
646 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
647 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
648 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
649 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
650 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
652 void detach_selection(HTMLDocumentNode*);
653 void detach_ranges(HTMLDocumentNode*);
654 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
656 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
658 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
659 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
660 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
661 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
662 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
663 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
664 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
665 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
666 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
667 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
668 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
669 HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
670 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
671 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
673 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
674 void HTMLElement_Init(HTMLElement*,dispex_static_data_t*);
675 void HTMLElement2_Init(HTMLElement*);
676 void HTMLElement3_Init(HTMLElement*);
677 void HTMLTextContainer_Init(HTMLTextContainer*,dispex_static_data_t*);
679 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
680 void HTMLDOMNode_destructor(HTMLDOMNode*);
682 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
683 void HTMLElement_destructor(HTMLDOMNode*);
685 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
686 void release_nodes(HTMLDocumentNode*);
688 void release_script_hosts(HTMLWindow*);
689 void connect_scripts(HTMLWindow*);
690 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
691 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
692 void set_script_mode(HTMLWindow*,SCRIPTMODE);
693 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
694 IDispatch *get_script_disp(ScriptHost*);
696 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
697 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
698 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
703 HRESULT (*query)(HTMLDocument*,OLECMD*);
704 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
707 extern const cmdtable_t editmode_cmds[];
709 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
712 #define UPDATE_UI 0x0001
713 #define UPDATE_TITLE 0x0002
715 void update_doc(HTMLDocument*,DWORD);
716 void update_title(HTMLDocumentObj*);
719 void init_editor(HTMLDocument*);
720 void set_ns_editmode(NSContainer*);
721 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
722 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
723 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
724 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
725 void handle_edit_load(HTMLDocument*);
726 HRESULT editor_is_dirty(HTMLDocument*);
727 void set_dirty(HTMLDocument*,VARIANT_BOOL);
729 extern DWORD mshtml_tls;
731 typedef struct task_t {
735 TASK_SETDOWNLOADSTATE,
741 nsChannelBSC *bscallback;
748 task_t *task_queue_head;
749 task_t *task_queue_tail;
750 struct list timer_list;
753 thread_data_t *get_thread_data(BOOL);
754 HWND get_thread_hwnd(void);
755 void push_task(task_t*);
756 void remove_doc_tasks(const HTMLDocument*);
757 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
758 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
760 void release_typelib(void);
761 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
763 const char *debugstr_variant(const VARIANT*);
765 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
766 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
767 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
768 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
769 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
771 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
773 /* memory allocation functions */
775 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
777 return HeapAlloc(GetProcessHeap(), 0, len);
780 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
782 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
785 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
787 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
790 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
792 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
795 static inline BOOL heap_free(void *mem)
797 return HeapFree(GetProcessHeap(), 0, mem);
800 static inline LPWSTR heap_strdupW(LPCWSTR str)
807 size = (strlenW(str)+1)*sizeof(WCHAR);
808 ret = heap_alloc(size);
809 memcpy(ret, str, size);
815 static inline char *heap_strdupA(const char *str)
822 size = strlen(str)+1;
823 ret = heap_alloc(size);
824 memcpy(ret, str, size);
830 static inline WCHAR *heap_strdupAtoW(const char *str)
837 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
838 ret = heap_alloc(len*sizeof(WCHAR));
839 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
845 static inline char *heap_strdupWtoA(LPCWSTR str)
850 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
851 ret = heap_alloc(size);
852 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
858 HINSTANCE get_shdoclc(void);
860 extern HINSTANCE hInst;