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,
106 IHTMLGenericElement_tid,
108 IHTMLInputElement_tid,
110 IHTMLOptionElement_tid,
111 IHTMLSelectElement_tid,
118 IHTMLTextContainer_tid,
126 typedef struct dispex_data_t dispex_data_t;
127 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
129 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
130 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
133 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
134 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
135 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
136 } dispex_static_data_vtbl_t;
139 const dispex_static_data_vtbl_t *vtbl;
140 const tid_t disp_tid;
142 const tid_t* const iface_tids;
143 } dispex_static_data_t;
146 const IDispatchExVtbl *lpIDispatchExVtbl;
150 dispex_static_data_t *data;
151 dispex_dynamic_data_t *dynamic_data;
154 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
155 void release_dispex(DispatchEx*);
156 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
157 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
159 typedef struct HTMLWindow HTMLWindow;
160 typedef struct HTMLDocumentNode HTMLDocumentNode;
161 typedef struct HTMLDocumentObj HTMLDocumentObj;
165 SCRIPTMODE_ACTIVESCRIPT
168 typedef struct ScriptHost ScriptHost;
172 ScriptHost *script_host;
177 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
182 } HTMLOptionElementFactory;
184 struct HTMLLocation {
186 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
195 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
196 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
197 const IDispatchExVtbl *lpIDispatchExVtbl;
201 HTMLDocumentNode *doc;
202 HTMLDocumentObj *doc_obj;
203 nsIDOMWindow *nswindow;
205 event_target_t *event_target;
206 IHTMLEventObj *event;
209 SCRIPTMODE scriptmode;
210 struct list script_hosts;
212 HTMLOptionElementFactory *option_factory;
213 HTMLLocation *location;
215 global_prop_t *global_props;
216 DWORD global_prop_cnt;
217 DWORD global_prop_size;
229 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
231 ConnectionPoint *cp_list;
233 } ConnectionPointContainer;
235 struct ConnectionPoint {
236 const IConnectionPointVtbl *lpConnectionPointVtbl;
238 IConnectionPointContainer *container;
243 IPropertyNotifySink *propnotif;
249 ConnectionPoint *next;
252 struct HTMLDocument {
253 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
254 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
255 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
256 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
257 const IHTMLDocument6Vtbl *lpHTMLDocument6Vtbl;
258 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
259 const IPersistFileVtbl *lpPersistFileVtbl;
260 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
261 const IMonikerPropVtbl *lpMonikerPropVtbl;
262 const IOleObjectVtbl *lpOleObjectVtbl;
263 const IOleDocumentVtbl *lpOleDocumentVtbl;
264 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
265 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
266 const IViewObject2Vtbl *lpViewObject2Vtbl;
267 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
268 const IServiceProviderVtbl *lpServiceProviderVtbl;
269 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
270 const IOleControlVtbl *lpOleControlVtbl;
271 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
272 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
273 const IDispatchExVtbl *lpIDispatchExVtbl;
274 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
279 HTMLDocumentObj *doc_obj;
280 HTMLDocumentNode *doc_node;
283 nsIDOMHTMLDocument *nsdoc;
285 ConnectionPointContainer cp_container;
286 ConnectionPoint cp_htmldocevents;
287 ConnectionPoint cp_htmldocevents2;
288 ConnectionPoint cp_propnotif;
291 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
293 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
296 static inline ULONG htmldoc_addref(HTMLDocument *This)
298 return IUnknown_AddRef(This->unk_impl);
301 static inline ULONG htmldoc_release(HTMLDocument *This)
303 return IUnknown_Release(This->unk_impl);
306 struct HTMLDocumentObj {
307 HTMLDocument basedoc;
309 const ICustomDocVtbl *lpCustomDocVtbl;
313 NSContainer *nscontainer;
315 IOleClientSite *client;
316 IDocHostUIHandler *hostui;
317 IOleInPlaceSite *ipsite;
318 IOleInPlaceFrame *frame;
319 IOleInPlaceUIWindow *ip_window;
321 DOCHOSTUIINFO hostinfo;
323 IOleUndoManager *undomgr;
328 BOOL in_place_active;
332 BOOL container_locked;
336 READYSTATE readystate;
341 /* FIXME: probably should be in document node object */
342 nsChannelBSC *bscallback;
345 struct list bindings;
349 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
353 typedef struct _mutation_queue_t {
355 nsISupports *nsiface;
357 struct _mutation_queue_t *next;
361 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
362 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
363 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
364 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
365 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
366 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
367 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
368 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
370 const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
372 const nsIRunnableVtbl *lpRunnableVtbl;
374 nsEventListener blur_listener;
375 nsEventListener focus_listener;
376 nsEventListener keypress_listener;
377 nsEventListener load_listener;
378 nsEventListener htmlevent_listener;
380 nsIWebBrowser *webbrowser;
381 nsIWebNavigation *navigation;
382 nsIBaseWindow *window;
383 nsIWebBrowserFocus *focus;
386 nsIController *editor_controller;
391 HTMLDocumentObj *doc;
393 nsIURIContentListener *content_listener;
397 mutation_queue_t *mutation_queue;
398 mutation_queue_t *mutation_queue_tail;
400 nsChannelBSC *bscallback; /* hack */
401 HWND reset_focus; /* hack */
405 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
406 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
407 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
412 nsIHttpChannel *http_channel;
413 nsIHttpChannelInternal *http_channel_internal;
415 nsIInputStream *post_data_stream;
416 nsILoadGroup *load_group;
417 nsIInterfaceRequestor *notif_callback;
419 nsLoadFlags load_flags;
420 nsIURI *original_uri;
423 PRUint32 response_status;
427 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
428 void (*destructor)(HTMLDOMNode*);
429 event_target_t **(*get_event_target)(HTMLDOMNode*);
430 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
431 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
432 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
437 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
438 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
439 const NodeImplVtbl *vtbl;
444 HTMLDocumentNode *doc;
445 event_target_t *event_target;
452 ConnectionPointContainer cp_container;
454 const IHTMLElementVtbl *lpHTMLElementVtbl;
455 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
456 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
458 nsIDOMHTMLElement *nselem;
464 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
469 struct HTMLDocumentNode {
471 HTMLDocument basedoc;
473 const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
480 IInternetSecurityManager *secmgr;
482 struct list selection_list;
483 struct list range_list;
486 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
487 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
489 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
490 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
491 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
492 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
493 #define HTMLDOC6(x) ((IHTMLDocument6*) &(x)->lpHTMLDocument6Vtbl)
494 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
495 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
496 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
497 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
498 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
499 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
500 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
501 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
502 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
503 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
504 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
505 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
506 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
507 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
508 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
509 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
510 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
511 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
512 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
513 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
514 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
516 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
517 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
518 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
519 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
520 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
521 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
522 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
523 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
524 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
526 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
528 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
530 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
531 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
532 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
533 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
535 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
536 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
537 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
539 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
540 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
541 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
542 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
543 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
545 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
547 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
548 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
550 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
552 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
554 #define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl)
556 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
557 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
559 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
560 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
561 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
563 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow**);
564 void window_set_docnode(HTMLWindow*,HTMLDocumentNode*);
565 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
566 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
567 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
568 IOmNavigator *OmNavigator_Create(void);
570 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
571 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
572 void HTMLDocument_Persist_Init(HTMLDocument*);
573 void HTMLDocument_OleCmd_Init(HTMLDocument*);
574 void HTMLDocument_OleObj_Init(HTMLDocument*);
575 void HTMLDocument_View_Init(HTMLDocument*);
576 void HTMLDocument_Window_Init(HTMLDocument*);
577 void HTMLDocument_Service_Init(HTMLDocument*);
578 void HTMLDocument_Hlink_Init(HTMLDocument*);
580 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
582 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
584 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
585 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
586 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
588 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
589 void NSContainer_Release(NSContainer*);
591 void init_mutation(NSContainer*);
592 void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
593 void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
595 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
596 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
597 void notif_focus(HTMLDocumentObj*);
599 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
600 void hide_tooltip(HTMLDocumentObj*);
601 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
603 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
605 BOOL load_gecko(BOOL);
606 void close_gecko(void);
607 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
608 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
609 void release_nsio(void);
610 BOOL install_wine_gecko(BOOL);
612 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
614 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD);
615 HRESULT navigate_url(HTMLDocumentNode*,OLECHAR*);
617 void call_property_onchanged(ConnectionPoint*,DISPID);
618 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
620 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
623 void nsACString_Init(nsACString*,const char*);
624 void nsACString_SetData(nsACString*,const char*);
625 PRUint32 nsACString_GetData(const nsACString*,const char**);
626 void nsACString_Finish(nsACString*);
628 void nsAString_Init(nsAString*,const PRUnichar*);
629 void nsAString_SetData(nsAString*,const PRUnichar*);
630 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
631 void nsAString_Finish(nsAString*);
633 nsICommandParams *create_nscommand_params(void);
634 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
635 void get_editor_controller(NSContainer*);
636 void init_nsevents(NSContainer*);
637 void add_nsevent_listener(HTMLWindow*,LPCWSTR);
638 nsresult get_nsinterface(nsISupports*,REFIID,void**);
639 void update_nsdocument(HTMLDocumentObj*);
641 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
642 void set_current_mon(HTMLDocument*,IMoniker*);
643 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
645 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
647 nsChannelBSC *create_channelbsc(IMoniker*);
648 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
649 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
650 IMoniker *get_channelbsc_mon(nsChannelBSC*);
652 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
653 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
654 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
655 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
656 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
658 void detach_selection(HTMLDocumentNode*);
659 void detach_ranges(HTMLDocumentNode*);
660 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
662 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
664 HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
665 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
666 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
667 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
668 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
669 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
670 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
671 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
672 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
673 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
674 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
675 HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
676 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
677 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
679 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
680 void HTMLElement_Init(HTMLElement*,dispex_static_data_t*);
681 void HTMLElement2_Init(HTMLElement*);
682 void HTMLElement3_Init(HTMLElement*);
683 void HTMLTextContainer_Init(HTMLTextContainer*,dispex_static_data_t*);
685 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
686 void HTMLDOMNode_destructor(HTMLDOMNode*);
688 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
689 void HTMLElement_destructor(HTMLDOMNode*);
691 HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
692 void release_nodes(HTMLDocumentNode*);
694 void release_script_hosts(HTMLWindow*);
695 void connect_scripts(HTMLWindow*);
696 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
697 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
698 void set_script_mode(HTMLWindow*,SCRIPTMODE);
699 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
700 IDispatch *get_script_disp(ScriptHost*);
702 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
703 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
704 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
709 HRESULT (*query)(HTMLDocument*,OLECMD*);
710 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
713 extern const cmdtable_t editmode_cmds[];
715 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
718 #define UPDATE_UI 0x0001
719 #define UPDATE_TITLE 0x0002
721 void update_doc(HTMLDocument*,DWORD);
722 void update_title(HTMLDocumentObj*);
725 void init_editor(HTMLDocument*);
726 void set_ns_editmode(NSContainer*);
727 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
728 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
729 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
730 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
731 void handle_edit_load(HTMLDocument*);
732 HRESULT editor_is_dirty(HTMLDocument*);
733 void set_dirty(HTMLDocument*,VARIANT_BOOL);
735 extern DWORD mshtml_tls;
737 typedef struct task_t {
741 TASK_SETDOWNLOADSTATE,
747 nsChannelBSC *bscallback;
754 task_t *task_queue_head;
755 task_t *task_queue_tail;
756 struct list timer_list;
759 thread_data_t *get_thread_data(BOOL);
760 HWND get_thread_hwnd(void);
761 void push_task(task_t*);
762 void remove_doc_tasks(const HTMLDocument*);
763 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
764 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
766 void release_typelib(void);
767 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
769 const char *debugstr_variant(const VARIANT*);
771 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
772 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
773 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
774 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
775 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
777 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
779 /* memory allocation functions */
781 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
783 return HeapAlloc(GetProcessHeap(), 0, len);
786 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
788 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
791 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
793 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
796 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
798 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
801 static inline BOOL heap_free(void *mem)
803 return HeapFree(GetProcessHeap(), 0, mem);
806 static inline LPWSTR heap_strdupW(LPCWSTR str)
813 size = (strlenW(str)+1)*sizeof(WCHAR);
814 ret = heap_alloc(size);
815 memcpy(ret, str, size);
821 static inline char *heap_strdupA(const char *str)
828 size = strlen(str)+1;
829 ret = heap_alloc(size);
830 memcpy(ret, str, size);
836 static inline WCHAR *heap_strdupAtoW(const char *str)
843 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
844 ret = heap_alloc(len*sizeof(WCHAR));
845 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
851 static inline char *heap_strdupWtoA(LPCWSTR str)
856 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
857 ret = heap_alloc(size);
858 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
864 HINSTANCE get_shdoclc(void);
866 extern HINSTANCE hInst;