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,
63 DispHTMLCommentElement_tid,
64 DispHTMLCurrentStyle_tid,
66 DispHTMLDOMTextNode_tid,
67 DispHTMLElementCollection_tid,
68 DispHTMLGenericElement_tid,
71 DispHTMLInputElement_tid,
73 DispHTMLNavigator_tid,
74 DispHTMLOptionElement_tid,
75 DispHTMLSelectElement_tid,
79 DispHTMLUnknownElement_tid,
82 IHTMLBodyElement2_tid,
83 IHTMLCommentElement_tid,
84 IHTMLCurrentStyle_tid,
85 IHTMLCurrentStyle2_tid,
86 IHTMLCurrentStyle3_tid,
87 IHTMLCurrentStyle4_tid,
92 IHTMLDOMChildrenCollection_tid,
100 IHTMLElementCollection_tid,
103 IHTMLGenericElement_tid,
105 IHTMLInputElement_tid,
107 IHTMLOptionElement_tid,
108 IHTMLSelectElement_tid,
115 IHTMLTextContainer_tid,
123 typedef struct dispex_data_t dispex_data_t;
124 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
126 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
127 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
130 HRESULT (*value)(IUnknown*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
131 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
132 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
133 } dispex_static_data_vtbl_t;
136 const dispex_static_data_vtbl_t *vtbl;
137 const tid_t disp_tid;
139 const tid_t* const iface_tids;
140 } dispex_static_data_t;
143 const IDispatchExVtbl *lpIDispatchExVtbl;
147 dispex_static_data_t *data;
148 dispex_dynamic_data_t *dynamic_data;
151 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
152 void release_dispex(DispatchEx*);
153 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
154 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
156 typedef struct HTMLWindow HTMLWindow;
160 SCRIPTMODE_ACTIVESCRIPT
163 typedef struct ScriptHost ScriptHost;
167 ScriptHost *script_host;
172 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
177 } HTMLOptionElementFactory;
179 struct HTMLLocation {
181 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
190 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
191 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
192 const IDispatchExVtbl *lpIDispatchExVtbl;
197 nsIDOMWindow *nswindow;
199 event_target_t *event_target;
200 IHTMLEventObj *event;
202 SCRIPTMODE scriptmode;
203 struct list script_hosts;
205 HTMLOptionElementFactory *option_factory;
206 HTMLLocation *location;
208 global_prop_t *global_props;
209 DWORD global_prop_cnt;
210 DWORD global_prop_size;
222 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
224 ConnectionPoint *cp_list;
226 } ConnectionPointContainer;
228 struct ConnectionPoint {
229 const IConnectionPointVtbl *lpConnectionPointVtbl;
231 IConnectionPointContainer *container;
236 IPropertyNotifySink *propnotif;
242 ConnectionPoint *next;
245 struct HTMLDocument {
247 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
248 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
249 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
250 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
251 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
252 const IPersistFileVtbl *lpPersistFileVtbl;
253 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
254 const IMonikerPropVtbl *lpMonikerPropVtbl;
255 const IOleObjectVtbl *lpOleObjectVtbl;
256 const IOleDocumentVtbl *lpOleDocumentVtbl;
257 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
258 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
259 const IViewObject2Vtbl *lpViewObject2Vtbl;
260 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
261 const IServiceProviderVtbl *lpServiceProviderVtbl;
262 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
263 const IOleControlVtbl *lpOleControlVtbl;
264 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
265 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
266 const ICustomDocVtbl *lpCustomDocVtbl;
267 const IDispatchExVtbl *lpIDispatchExVtbl;
268 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
271 NSContainer *nscontainer;
273 nsIDOMHTMLDocument *nsdoc;
275 IOleClientSite *client;
276 IDocHostUIHandler *hostui;
277 IOleInPlaceSite *ipsite;
278 IOleInPlaceFrame *frame;
279 IOleInPlaceUIWindow *ip_window;
281 IOleUndoManager *undomgr;
283 nsChannelBSC *bscallback;
286 struct list bindings;
291 DOCHOSTUIINFO hostinfo;
294 READYSTATE readystate;
295 BOOL in_place_active;
299 BOOL container_locked;
305 event_target_t *event_target;
306 ConnectionPointContainer cp_container;
307 ConnectionPoint cp_htmldocevents;
308 ConnectionPoint cp_htmldocevents2;
309 ConnectionPoint cp_propnotif;
311 struct list selection_list;
312 struct list range_list;
318 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
322 typedef struct _mutation_queue_t {
324 nsISupports *nsiface;
326 struct _mutation_queue_t *next;
330 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
331 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
332 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
333 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
334 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
335 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
336 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
337 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
339 const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
341 const nsIRunnableVtbl *lpRunnableVtbl;
343 nsEventListener blur_listener;
344 nsEventListener focus_listener;
345 nsEventListener keypress_listener;
346 nsEventListener load_listener;
347 nsEventListener htmlevent_listener;
349 nsIWebBrowser *webbrowser;
350 nsIWebNavigation *navigation;
351 nsIBaseWindow *window;
352 nsIWebBrowserFocus *focus;
355 nsIController *editor_controller;
362 nsIURIContentListener *content_listener;
366 mutation_queue_t *mutation_queue;
367 mutation_queue_t *mutation_queue_tail;
369 nsChannelBSC *bscallback; /* hack */
370 HWND reset_focus; /* hack */
376 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
377 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
378 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
383 nsIHttpChannel *http_channel;
384 nsIHttpChannelInternal *http_channel_internal;
386 nsIInputStream *post_data_stream;
387 nsILoadGroup *load_group;
388 nsIInterfaceRequestor *notif_callback;
390 nsLoadFlags load_flags;
391 nsIURI *original_uri;
394 PRUint32 response_status;
398 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
399 void (*destructor)(HTMLDOMNode*);
400 event_target_t **(*get_event_target)(HTMLDOMNode*);
401 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
402 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
407 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
408 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
409 const NodeImplVtbl *vtbl;
415 event_target_t *event_target;
422 ConnectionPointContainer cp_container;
424 const IHTMLElementVtbl *lpHTMLElementVtbl;
425 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
426 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
428 nsIDOMHTMLElement *nselem;
434 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
439 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
440 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
442 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
443 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
444 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
445 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
446 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
447 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
448 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
449 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
450 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
451 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
452 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
453 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
454 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
455 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
456 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
457 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
458 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
459 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
460 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
461 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
462 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
463 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
464 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
465 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
466 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
468 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
469 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
470 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
471 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
472 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
473 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
474 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
475 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
476 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
478 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
480 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
482 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
483 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
484 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
485 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
487 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
488 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
489 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
491 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
492 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
493 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
494 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
495 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
497 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
499 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
500 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
502 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
504 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
506 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
507 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
509 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
510 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
511 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocument**);
513 HRESULT HTMLWindow_Create(HTMLDocument*,nsIDOMWindow*,HTMLWindow**);
514 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
515 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
516 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
517 IOmNavigator *OmNavigator_Create(void);
519 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
520 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
521 void HTMLDocument_Persist_Init(HTMLDocument*);
522 void HTMLDocument_OleCmd_Init(HTMLDocument*);
523 void HTMLDocument_OleObj_Init(HTMLDocument*);
524 void HTMLDocument_View_Init(HTMLDocument*);
525 void HTMLDocument_Window_Init(HTMLDocument*);
526 void HTMLDocument_Service_Init(HTMLDocument*);
527 void HTMLDocument_Hlink_Init(HTMLDocument*);
529 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
531 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
532 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
533 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
535 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
536 void NSContainer_Release(NSContainer*);
538 void init_mutation(NSContainer*);
539 void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
540 void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
542 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
543 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
544 void notif_focus(HTMLDocument*);
546 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
547 void hide_tooltip(HTMLDocument*);
548 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
550 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
552 BOOL load_gecko(BOOL);
553 void close_gecko(void);
554 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
555 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
556 void release_nsio(void);
557 BOOL install_wine_gecko(BOOL);
559 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
561 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
563 void call_property_onchanged(ConnectionPoint*,DISPID);
564 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
566 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
569 void nsACString_Init(nsACString*,const char*);
570 void nsACString_SetData(nsACString*,const char*);
571 PRUint32 nsACString_GetData(const nsACString*,const char**);
572 void nsACString_Finish(nsACString*);
574 void nsAString_Init(nsAString*,const PRUnichar*);
575 void nsAString_SetData(nsAString*,const PRUnichar*);
576 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
577 void nsAString_Finish(nsAString*);
579 nsICommandParams *create_nscommand_params(void);
580 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
581 void get_editor_controller(NSContainer*);
582 void init_nsevents(NSContainer*);
583 void add_nsevent_listener(NSContainer*,LPCWSTR);
584 nsresult get_nsinterface(nsISupports*,REFIID,void**);
585 void update_nsdocument(HTMLDocument*);
587 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
588 void set_current_mon(HTMLDocument*,IMoniker*);
589 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
591 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
593 nsChannelBSC *create_channelbsc(IMoniker*);
594 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
595 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
596 IMoniker *get_channelbsc_mon(nsChannelBSC*);
598 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
599 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
600 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
601 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
602 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
604 void detach_selection(HTMLDocument*);
605 void detach_ranges(HTMLDocument*);
606 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
608 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
610 HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
611 HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
612 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
613 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
614 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
615 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
616 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
617 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
618 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
619 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
620 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
621 HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
622 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
623 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
625 void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*);
626 void HTMLElement_Init(HTMLElement*);
627 void HTMLElement2_Init(HTMLElement*);
628 void HTMLElement3_Init(HTMLElement*);
629 void HTMLTextContainer_Init(HTMLTextContainer*);
631 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
632 void HTMLDOMNode_destructor(HTMLDOMNode*);
634 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
635 void HTMLElement_destructor(HTMLDOMNode*);
637 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
638 void release_nodes(HTMLDocument*);
640 void release_script_hosts(HTMLWindow*);
641 void connect_scripts(HTMLWindow*);
642 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
643 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
644 void set_script_mode(HTMLWindow*,SCRIPTMODE);
645 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
646 IDispatch *get_script_disp(ScriptHost*);
648 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
649 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument*,IUnknown*,nsIDOMNodeList*);
650 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocument*,IUnknown*,nsIDOMHTMLCollection*);
655 HRESULT (*query)(HTMLDocument*,OLECMD*);
656 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
659 extern const cmdtable_t editmode_cmds[];
661 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
664 #define UPDATE_UI 0x0001
665 #define UPDATE_TITLE 0x0002
667 void update_doc(HTMLDocument *This, DWORD flags);
668 void update_title(HTMLDocument*);
671 void init_editor(HTMLDocument*);
672 void set_ns_editmode(NSContainer*);
673 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
674 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
675 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
676 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
677 void handle_edit_load(HTMLDocument*);
678 HRESULT editor_is_dirty(HTMLDocument*);
679 void set_dirty(HTMLDocument*,VARIANT_BOOL);
681 extern DWORD mshtml_tls;
683 typedef struct task_t {
687 TASK_SETDOWNLOADSTATE,
693 nsChannelBSC *bscallback;
700 task_t *task_queue_head;
701 task_t *task_queue_tail;
702 struct list timer_list;
705 thread_data_t *get_thread_data(BOOL);
706 HWND get_thread_hwnd(void);
707 void push_task(task_t*);
708 void remove_doc_tasks(const HTMLDocument*);
709 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
710 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
712 void release_typelib(void);
713 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
715 const char *debugstr_variant(const VARIANT*);
717 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
718 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
719 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
720 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
721 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
723 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
725 /* memory allocation functions */
727 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
729 return HeapAlloc(GetProcessHeap(), 0, len);
732 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
734 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
737 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
739 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
742 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
744 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
747 static inline BOOL heap_free(void *mem)
749 return HeapFree(GetProcessHeap(), 0, mem);
752 static inline LPWSTR heap_strdupW(LPCWSTR str)
759 size = (strlenW(str)+1)*sizeof(WCHAR);
760 ret = heap_alloc(size);
761 memcpy(ret, str, size);
767 static inline char *heap_strdupA(const char *str)
774 size = strlen(str)+1;
775 ret = heap_alloc(size);
776 memcpy(ret, str, size);
782 static inline WCHAR *heap_strdupAtoW(const char *str)
789 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
790 ret = heap_alloc(len*sizeof(WCHAR));
791 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
797 static inline char *heap_strdupWtoA(LPCWSTR str)
802 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
803 ret = heap_alloc(size);
804 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
810 HINSTANCE get_shdoclc(void);
812 extern HINSTANCE hInst;