2 * Copyright 2005-2008 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
26 #include "wine/list.h"
27 #include "wine/unicode.h"
35 #define GENERATE_MSHTML_NS_FAILURE(code) \
36 ((nsresult) ((PRUint32)(1<<31) | ((PRUint32)(0x45+6)<<16) | (PRUint32)(code)))
38 #define NS_OK ((nsresult)0x00000000L)
39 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
40 #define NS_NOINTERFACE ((nsresult)0x80004002L)
41 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
42 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
43 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
44 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
46 #define WINE_NS_LOAD_FROM_MONIKER GENERATE_MSHTML_NS_FAILURE(0)
48 #define NS_FAILED(res) ((res) & 0x80000000)
49 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
53 #define MSHTML_E_NODOC 0x800a025c
55 typedef struct HTMLDOMNode HTMLDOMNode;
56 typedef struct ConnectionPoint ConnectionPoint;
57 typedef struct BSCallback BSCallback;
58 typedef struct nsChannelBSC nsChannelBSC;
59 typedef struct event_target_t event_target_t;
61 /* NOTE: make sure to keep in sync with dispex.c */
65 DispDOMChildrenCollection_tid,
67 DispHTMLCommentElement_tid,
68 DispHTMLCurrentStyle_tid,
70 DispHTMLDOMTextNode_tid,
71 DispHTMLElementCollection_tid,
72 DispHTMLGenericElement_tid,
75 DispHTMLInputElement_tid,
76 DispHTMLOptionElement_tid,
77 DispHTMLSelectElement_tid,
81 DispHTMLUnknownElement_tid,
84 IHTMLBodyElement2_tid,
85 IHTMLCommentElement_tid,
86 IHTMLCurrentStyle_tid,
91 IHTMLDOMChildrenCollection_tid,
99 IHTMLElementCollection_tid,
102 IHTMLGenericElement_tid,
104 IHTMLInputElement_tid,
106 IHTMLOptionElement_tid,
107 IHTMLSelectElement_tid,
112 IHTMLTextContainer_tid,
120 typedef struct dispex_data_t dispex_data_t;
121 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
123 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
124 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
127 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
128 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
129 } dispex_static_data_vtbl_t;
132 const dispex_static_data_vtbl_t *vtbl;
133 const tid_t disp_tid;
135 const tid_t* const iface_tids;
136 } dispex_static_data_t;
139 const IDispatchExVtbl *lpIDispatchExVtbl;
143 dispex_static_data_t *data;
144 dispex_dynamic_data_t *dynamic_data;
147 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
148 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
149 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
153 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
154 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
155 const IDispatchExVtbl *lpIDispatchExVtbl;
160 nsIDOMWindow *nswindow;
162 IHTMLEventObj *event;
175 SCRIPTMODE_ACTIVESCRIPT
179 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
181 ConnectionPoint *cp_list;
183 } ConnectionPointContainer;
185 struct ConnectionPoint {
186 const IConnectionPointVtbl *lpConnectionPointVtbl;
188 IConnectionPointContainer *container;
193 IPropertyNotifySink *propnotif;
199 ConnectionPoint *next;
204 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
212 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
217 } HTMLOptionElementFactory;
219 struct HTMLDocument {
221 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
222 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
223 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
224 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
225 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
226 const IPersistFileVtbl *lpPersistFileVtbl;
227 const IMonikerPropVtbl *lpMonikerPropVtbl;
228 const IOleObjectVtbl *lpOleObjectVtbl;
229 const IOleDocumentVtbl *lpOleDocumentVtbl;
230 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
231 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
232 const IViewObject2Vtbl *lpViewObject2Vtbl;
233 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
234 const IServiceProviderVtbl *lpServiceProviderVtbl;
235 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
236 const IOleControlVtbl *lpOleControlVtbl;
237 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
238 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
239 const ICustomDocVtbl *lpCustomDocVtbl;
240 const IDispatchExVtbl *lpIDispatchExVtbl;
244 NSContainer *nscontainer;
246 nsIDOMHTMLDocument *nsdoc;
248 IOleClientSite *client;
249 IDocHostUIHandler *hostui;
250 IOleInPlaceSite *ipsite;
251 IOleInPlaceFrame *frame;
252 IOleInPlaceUIWindow *ip_window;
254 IOleUndoManager *undomgr;
256 nsChannelBSC *bscallback;
259 struct list bindings;
261 struct list script_hosts;
266 DOCHOSTUIINFO hostinfo;
269 SCRIPTMODE scriptmode;
270 READYSTATE readystate;
271 BOOL in_place_active;
275 BOOL container_locked;
281 event_target_t *event_target;
282 ConnectionPointContainer cp_container;
283 ConnectionPoint cp_htmldocevents;
284 ConnectionPoint cp_htmldocevents2;
285 ConnectionPoint cp_propnotif;
287 HTMLOptionElementFactory *option_factory;
288 HTMLLocation *location;
290 struct list selection_list;
291 struct list range_list;
297 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
301 typedef struct _mutation_queue_t {
303 nsISupports *nsiface;
305 struct _mutation_queue_t *next;
309 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
310 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
311 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
312 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
313 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
314 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
315 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
316 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
318 const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
320 const nsIRunnableVtbl *lpRunnableVtbl;
322 nsEventListener blur_listener;
323 nsEventListener focus_listener;
324 nsEventListener keypress_listener;
325 nsEventListener load_listener;
326 nsEventListener htmlevent_listener;
328 nsIWebBrowser *webbrowser;
329 nsIWebNavigation *navigation;
330 nsIBaseWindow *window;
331 nsIWebBrowserFocus *focus;
334 nsIController *editor_controller;
341 nsIURIContentListener *content_listener;
345 mutation_queue_t *mutation_queue;
346 mutation_queue_t *mutation_queue_tail;
348 nsChannelBSC *bscallback; /* hack */
349 HWND reset_focus; /* hack */
355 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
356 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
361 nsIHttpChannel *http_channel;
363 nsIInputStream *post_data_stream;
364 nsILoadGroup *load_group;
365 nsIInterfaceRequestor *notif_callback;
367 nsLoadFlags load_flags;
368 nsIURI *original_uri;
374 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
375 void (*destructor)(HTMLDOMNode*);
376 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
377 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
382 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
383 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
384 const NodeImplVtbl *vtbl;
390 event_target_t *event_target;
397 ConnectionPointContainer cp_container;
399 const IHTMLElementVtbl *lpHTMLElementVtbl;
400 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
401 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
403 nsIDOMHTMLElement *nselem;
409 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
414 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
415 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
417 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
418 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
419 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
420 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
421 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
422 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
423 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
424 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
425 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
426 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
427 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
428 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
429 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
430 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
431 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
432 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
433 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
434 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
435 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
436 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
437 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
438 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
439 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
440 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
442 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
443 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
444 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
445 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
446 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
447 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
448 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
449 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
450 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
452 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
454 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
456 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
457 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
458 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
460 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
461 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
462 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
464 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
465 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
466 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
467 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
468 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
470 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
472 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
473 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
475 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
477 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
478 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
480 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
481 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
482 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocument**);
484 HRESULT HTMLWindow_Create(HTMLDocument*,nsIDOMWindow*,HTMLWindow**);
485 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
486 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
487 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
488 IOmNavigator *OmNavigator_Create(void);
490 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
491 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
492 void HTMLDocument_Persist_Init(HTMLDocument*);
493 void HTMLDocument_OleCmd_Init(HTMLDocument*);
494 void HTMLDocument_OleObj_Init(HTMLDocument*);
495 void HTMLDocument_View_Init(HTMLDocument*);
496 void HTMLDocument_Window_Init(HTMLDocument*);
497 void HTMLDocument_Service_Init(HTMLDocument*);
498 void HTMLDocument_Hlink_Init(HTMLDocument*);
500 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
502 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
503 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
504 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
506 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
507 void NSContainer_Release(NSContainer*);
509 void init_mutation(NSContainer*);
510 void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
512 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
513 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
514 void notif_focus(HTMLDocument*);
516 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
517 void hide_tooltip(HTMLDocument*);
518 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
520 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
522 BOOL load_gecko(BOOL);
523 void close_gecko(void);
524 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
525 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
526 void release_nsio(void);
527 BOOL install_wine_gecko(BOOL);
529 HRESULT nsuri_to_url(LPCWSTR,BSTR*);
531 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
533 void call_property_onchanged(ConnectionPoint*,DISPID);
534 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
536 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
539 void nsACString_Init(nsACString*,const char*);
540 void nsACString_SetData(nsACString*,const char*);
541 PRUint32 nsACString_GetData(const nsACString*,const char**);
542 void nsACString_Finish(nsACString*);
544 void nsAString_Init(nsAString*,const PRUnichar*);
545 void nsAString_SetData(nsAString*,const PRUnichar*);
546 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
547 void nsAString_Finish(nsAString*);
549 nsIInputStream *create_nsstream(const char*,PRInt32);
550 nsICommandParams *create_nscommand_params(void);
551 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
552 void get_editor_controller(NSContainer*);
553 void init_nsevents(NSContainer*);
554 void add_nsevent_listener(NSContainer*,LPCWSTR);
555 nsresult get_nsinterface(nsISupports*,REFIID,void**);
556 void update_nsdocument(HTMLDocument*);
558 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
559 void set_current_mon(HTMLDocument*,IMoniker*);
560 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
562 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
564 nsChannelBSC *create_channelbsc(IMoniker*);
565 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
566 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
567 IMoniker *get_channelbsc_mon(nsChannelBSC*);
569 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
570 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
571 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
572 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
573 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
575 void detach_selection(HTMLDocument*);
576 void detach_ranges(HTMLDocument*);
577 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
579 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
581 HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
582 HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
583 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
584 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
585 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
586 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
587 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
588 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
589 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
590 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
591 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
592 HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
593 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
594 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
596 void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*);
597 void HTMLElement_Init(HTMLElement*);
598 void HTMLElement2_Init(HTMLElement*);
599 void HTMLElement3_Init(HTMLElement*);
600 void HTMLTextContainer_Init(HTMLTextContainer*);
602 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
603 void HTMLDOMNode_destructor(HTMLDOMNode*);
605 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
606 void HTMLElement_destructor(HTMLDOMNode*);
608 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
609 void release_nodes(HTMLDocument*);
611 void release_script_hosts(HTMLDocument*);
612 void connect_scripts(HTMLDocument*);
613 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
614 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
615 void set_script_mode(HTMLDocument*,SCRIPTMODE);
617 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
618 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument*,IUnknown*,nsIDOMNodeList*);
619 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocument*,IUnknown*,nsIDOMHTMLCollection*);
624 HRESULT (*query)(HTMLDocument*,OLECMD*);
625 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
628 extern const cmdtable_t editmode_cmds[];
630 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
633 #define UPDATE_UI 0x0001
634 #define UPDATE_TITLE 0x0002
636 void update_doc(HTMLDocument *This, DWORD flags);
637 void update_title(HTMLDocument*);
640 void init_editor(HTMLDocument*);
641 void set_ns_editmode(NSContainer*);
642 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
643 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
644 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
645 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
646 void handle_edit_load(HTMLDocument*);
647 HRESULT editor_is_dirty(HTMLDocument*);
648 void set_dirty(HTMLDocument*,VARIANT_BOOL);
650 extern DWORD mshtml_tls;
652 typedef struct task_t {
656 TASK_SETDOWNLOADSTATE,
662 nsChannelBSC *bscallback;
669 task_t *task_queue_head;
670 task_t *task_queue_tail;
671 struct list timer_list;
674 thread_data_t *get_thread_data(BOOL);
675 HWND get_thread_hwnd(void);
676 void push_task(task_t*);
677 void remove_doc_tasks(const HTMLDocument*);
678 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
679 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
681 void release_typelib(void);
682 void call_disp_func(HTMLDocument*,IDispatch*,IDispatch*);
684 const char *debugstr_variant(const VARIANT*);
686 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
687 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
688 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
689 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
690 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
692 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
694 /* memory allocation functions */
696 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
698 return HeapAlloc(GetProcessHeap(), 0, len);
701 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
703 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
706 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
708 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
711 static inline BOOL heap_free(void *mem)
713 return HeapFree(GetProcessHeap(), 0, mem);
716 static inline LPWSTR heap_strdupW(LPCWSTR str)
723 size = (strlenW(str)+1)*sizeof(WCHAR);
724 ret = heap_alloc(size);
725 memcpy(ret, str, size);
731 static inline char *heap_strdupA(const char *str)
738 size = strlen(str)+1;
739 ret = heap_alloc(size);
740 memcpy(ret, str, size);
746 static inline WCHAR *heap_strdupAtoW(const char *str)
753 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
754 ret = heap_alloc(len*sizeof(WCHAR));
755 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
761 static inline char *heap_strdupWtoA(LPCWSTR str)
766 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
767 ret = heap_alloc(size);
768 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
774 HINSTANCE get_shdoclc(void);
776 extern HINSTANCE hInst;