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
27 #include "wine/list.h"
28 #include "wine/unicode.h"
36 #define GENERATE_MSHTML_NS_FAILURE(code) \
37 ((nsresult) ((PRUint32)(1<<31) | ((PRUint32)(0x45+6)<<16) | (PRUint32)(code)))
39 #define NS_OK ((nsresult)0x00000000L)
40 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
41 #define NS_NOINTERFACE ((nsresult)0x80004002L)
42 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
43 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
44 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
45 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
47 #define WINE_NS_LOAD_FROM_MONIKER GENERATE_MSHTML_NS_FAILURE(0)
49 #define NS_FAILED(res) ((res) & 0x80000000)
50 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
54 #define MSHTML_E_NODOC 0x800a025c
56 typedef struct HTMLDOMNode HTMLDOMNode;
57 typedef struct ConnectionPoint ConnectionPoint;
58 typedef struct BSCallback BSCallback;
59 typedef struct nsChannelBSC nsChannelBSC;
60 typedef struct event_target_t event_target_t;
62 /* NOTE: make sure to keep in sync with dispex.c */
66 DispDOMChildrenCollection_tid,
68 DispHTMLCommentElement_tid,
69 DispHTMLCurrentStyle_tid,
71 DispHTMLDOMTextNode_tid,
72 DispHTMLElementCollection_tid,
73 DispHTMLGenericElement_tid,
76 DispHTMLInputElement_tid,
78 DispHTMLNavigator_tid,
79 DispHTMLOptionElement_tid,
80 DispHTMLSelectElement_tid,
84 DispHTMLUnknownElement_tid,
87 IHTMLBodyElement2_tid,
88 IHTMLCommentElement_tid,
89 IHTMLCurrentStyle_tid,
90 IHTMLCurrentStyle2_tid,
91 IHTMLCurrentStyle3_tid,
92 IHTMLCurrentStyle4_tid,
97 IHTMLDOMChildrenCollection_tid,
100 IHTMLDOMTextNode_tid,
105 IHTMLElementCollection_tid,
108 IHTMLGenericElement_tid,
110 IHTMLInputElement_tid,
112 IHTMLOptionElement_tid,
113 IHTMLSelectElement_tid,
120 IHTMLTextContainer_tid,
128 typedef struct dispex_data_t dispex_data_t;
129 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
131 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
132 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
135 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
136 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
137 } dispex_static_data_vtbl_t;
140 const dispex_static_data_vtbl_t *vtbl;
141 const tid_t disp_tid;
143 const tid_t* const iface_tids;
144 } dispex_static_data_t;
147 const IDispatchExVtbl *lpIDispatchExVtbl;
151 dispex_static_data_t *data;
152 dispex_dynamic_data_t *dynamic_data;
155 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
156 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
157 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
161 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
162 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
163 const IDispatchExVtbl *lpIDispatchExVtbl;
168 nsIDOMWindow *nswindow;
170 IHTMLEventObj *event;
183 SCRIPTMODE_ACTIVESCRIPT
187 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
189 ConnectionPoint *cp_list;
191 } ConnectionPointContainer;
193 struct ConnectionPoint {
194 const IConnectionPointVtbl *lpConnectionPointVtbl;
196 IConnectionPointContainer *container;
201 IPropertyNotifySink *propnotif;
207 ConnectionPoint *next;
210 struct HTMLLocation {
212 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
220 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
225 } HTMLOptionElementFactory;
227 struct HTMLDocument {
229 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
230 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
231 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
232 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
233 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
234 const IPersistFileVtbl *lpPersistFileVtbl;
235 const IPersistHistoryVtbl *lpPersistHistoryVtbl;
236 const IMonikerPropVtbl *lpMonikerPropVtbl;
237 const IOleObjectVtbl *lpOleObjectVtbl;
238 const IOleDocumentVtbl *lpOleDocumentVtbl;
239 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
240 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
241 const IViewObject2Vtbl *lpViewObject2Vtbl;
242 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
243 const IServiceProviderVtbl *lpServiceProviderVtbl;
244 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
245 const IOleControlVtbl *lpOleControlVtbl;
246 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
247 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
248 const ICustomDocVtbl *lpCustomDocVtbl;
249 const IDispatchExVtbl *lpIDispatchExVtbl;
250 const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl;
253 NSContainer *nscontainer;
255 nsIDOMHTMLDocument *nsdoc;
257 IOleClientSite *client;
258 IDocHostUIHandler *hostui;
259 IOleInPlaceSite *ipsite;
260 IOleInPlaceFrame *frame;
261 IOleInPlaceUIWindow *ip_window;
263 IOleUndoManager *undomgr;
265 nsChannelBSC *bscallback;
268 struct list bindings;
270 struct list script_hosts;
275 DOCHOSTUIINFO hostinfo;
278 SCRIPTMODE scriptmode;
279 READYSTATE readystate;
280 BOOL in_place_active;
284 BOOL container_locked;
290 event_target_t *event_target;
291 ConnectionPointContainer cp_container;
292 ConnectionPoint cp_htmldocevents;
293 ConnectionPoint cp_htmldocevents2;
294 ConnectionPoint cp_propnotif;
296 HTMLOptionElementFactory *option_factory;
297 HTMLLocation *location;
299 struct list selection_list;
300 struct list range_list;
306 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
310 typedef struct _mutation_queue_t {
312 nsISupports *nsiface;
314 struct _mutation_queue_t *next;
318 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
319 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
320 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
321 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
322 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
323 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
324 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
325 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
327 const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
329 const nsIRunnableVtbl *lpRunnableVtbl;
331 nsEventListener blur_listener;
332 nsEventListener focus_listener;
333 nsEventListener keypress_listener;
334 nsEventListener load_listener;
335 nsEventListener htmlevent_listener;
337 nsIWebBrowser *webbrowser;
338 nsIWebNavigation *navigation;
339 nsIBaseWindow *window;
340 nsIWebBrowserFocus *focus;
343 nsIController *editor_controller;
350 nsIURIContentListener *content_listener;
354 mutation_queue_t *mutation_queue;
355 mutation_queue_t *mutation_queue_tail;
357 nsChannelBSC *bscallback; /* hack */
358 HWND reset_focus; /* hack */
364 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
365 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
366 const nsIHttpChannelInternalVtbl *lpIHttpChannelInternalVtbl;
371 nsIHttpChannel *http_channel;
372 nsIHttpChannelInternal *http_channel_internal;
374 nsIInputStream *post_data_stream;
375 nsILoadGroup *load_group;
376 nsIInterfaceRequestor *notif_callback;
378 nsLoadFlags load_flags;
379 nsIURI *original_uri;
382 PRUint32 response_status;
386 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
387 void (*destructor)(HTMLDOMNode*);
388 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
389 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
394 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
395 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
396 const NodeImplVtbl *vtbl;
402 event_target_t *event_target;
409 ConnectionPointContainer cp_container;
411 const IHTMLElementVtbl *lpHTMLElementVtbl;
412 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
413 const IHTMLElement3Vtbl *lpHTMLElement3Vtbl;
415 nsIDOMHTMLElement *nselem;
421 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
426 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
427 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
429 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
430 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
431 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
432 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
433 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
434 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
435 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
436 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
437 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
438 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
439 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
440 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
441 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
442 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
443 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
444 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
445 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
446 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
447 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
448 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
449 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
450 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
451 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
452 #define PERSISTHIST(x) ((IPersistHistory*) &(x)->lpPersistHistoryVtbl)
453 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
455 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
456 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
457 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
458 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
459 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
460 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
461 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
462 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
463 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
465 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
467 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
469 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
470 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
471 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
472 #define NSHTTPINTERNAL(x) ((nsIHttpChannelInternal*) &(x)->lpIHttpChannelInternalVtbl)
474 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
475 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
476 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
478 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
479 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
480 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
481 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
482 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
484 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
486 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
487 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
489 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
491 #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl)
493 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
494 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
496 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
497 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
498 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocument**);
500 HRESULT HTMLWindow_Create(HTMLDocument*,nsIDOMWindow*,HTMLWindow**);
501 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
502 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
503 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
504 IOmNavigator *OmNavigator_Create(void);
506 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
507 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
508 void HTMLDocument_Persist_Init(HTMLDocument*);
509 void HTMLDocument_OleCmd_Init(HTMLDocument*);
510 void HTMLDocument_OleObj_Init(HTMLDocument*);
511 void HTMLDocument_View_Init(HTMLDocument*);
512 void HTMLDocument_Window_Init(HTMLDocument*);
513 void HTMLDocument_Service_Init(HTMLDocument*);
514 void HTMLDocument_Hlink_Init(HTMLDocument*);
516 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
518 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
519 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
520 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
522 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
523 void NSContainer_Release(NSContainer*);
525 void init_mutation(NSContainer*);
526 void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
527 void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
529 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
530 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
531 void notif_focus(HTMLDocument*);
533 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
534 void hide_tooltip(HTMLDocument*);
535 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
537 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
539 BOOL load_gecko(BOOL);
540 void close_gecko(void);
541 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
542 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
543 void release_nsio(void);
544 BOOL install_wine_gecko(BOOL);
546 HRESULT nsuri_to_url(LPCWSTR,BSTR*);
548 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
550 void call_property_onchanged(ConnectionPoint*,DISPID);
551 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
553 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
556 void nsACString_Init(nsACString*,const char*);
557 void nsACString_SetData(nsACString*,const char*);
558 PRUint32 nsACString_GetData(const nsACString*,const char**);
559 void nsACString_Finish(nsACString*);
561 void nsAString_Init(nsAString*,const PRUnichar*);
562 void nsAString_SetData(nsAString*,const PRUnichar*);
563 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
564 void nsAString_Finish(nsAString*);
566 nsIInputStream *create_nsstream(const char*,PRInt32);
567 nsICommandParams *create_nscommand_params(void);
568 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
569 void get_editor_controller(NSContainer*);
570 void init_nsevents(NSContainer*);
571 void add_nsevent_listener(NSContainer*,LPCWSTR);
572 nsresult get_nsinterface(nsISupports*,REFIID,void**);
573 void update_nsdocument(HTMLDocument*);
575 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
576 void set_current_mon(HTMLDocument*,IMoniker*);
577 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
579 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
581 nsChannelBSC *create_channelbsc(IMoniker*);
582 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
583 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
584 IMoniker *get_channelbsc_mon(nsChannelBSC*);
586 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
587 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
588 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
589 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
590 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
592 void detach_selection(HTMLDocument*);
593 void detach_ranges(HTMLDocument*);
594 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
596 HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
598 HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
599 HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
600 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
601 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
602 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
603 HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement*);
604 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
605 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
606 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
607 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
608 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
609 HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
610 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
611 HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
613 void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*);
614 void HTMLElement_Init(HTMLElement*);
615 void HTMLElement2_Init(HTMLElement*);
616 void HTMLElement3_Init(HTMLElement*);
617 void HTMLTextContainer_Init(HTMLTextContainer*);
619 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
620 void HTMLDOMNode_destructor(HTMLDOMNode*);
622 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
623 void HTMLElement_destructor(HTMLDOMNode*);
625 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
626 void release_nodes(HTMLDocument*);
628 void release_script_hosts(HTMLDocument*);
629 void connect_scripts(HTMLDocument*);
630 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
631 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
632 void set_script_mode(HTMLDocument*,SCRIPTMODE);
634 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
635 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument*,IUnknown*,nsIDOMNodeList*);
636 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocument*,IUnknown*,nsIDOMHTMLCollection*);
641 HRESULT (*query)(HTMLDocument*,OLECMD*);
642 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
645 extern const cmdtable_t editmode_cmds[];
647 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
650 #define UPDATE_UI 0x0001
651 #define UPDATE_TITLE 0x0002
653 void update_doc(HTMLDocument *This, DWORD flags);
654 void update_title(HTMLDocument*);
657 void init_editor(HTMLDocument*);
658 void set_ns_editmode(NSContainer*);
659 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
660 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
661 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
662 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
663 void handle_edit_load(HTMLDocument*);
664 HRESULT editor_is_dirty(HTMLDocument*);
665 void set_dirty(HTMLDocument*,VARIANT_BOOL);
667 extern DWORD mshtml_tls;
669 typedef struct task_t {
673 TASK_SETDOWNLOADSTATE,
679 nsChannelBSC *bscallback;
686 task_t *task_queue_head;
687 task_t *task_queue_tail;
688 struct list timer_list;
691 thread_data_t *get_thread_data(BOOL);
692 HWND get_thread_hwnd(void);
693 void push_task(task_t*);
694 void remove_doc_tasks(const HTMLDocument*);
695 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
696 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
698 void release_typelib(void);
699 void call_disp_func(HTMLDocument*,IDispatch*,IDispatch*);
701 const char *debugstr_variant(const VARIANT*);
703 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
704 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
705 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
706 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
707 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
709 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
711 /* memory allocation functions */
713 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
715 return HeapAlloc(GetProcessHeap(), 0, len);
718 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
720 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
723 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
725 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
728 static inline BOOL heap_free(void *mem)
730 return HeapFree(GetProcessHeap(), 0, mem);
733 static inline LPWSTR heap_strdupW(LPCWSTR str)
740 size = (strlenW(str)+1)*sizeof(WCHAR);
741 ret = heap_alloc(size);
742 memcpy(ret, str, size);
748 static inline char *heap_strdupA(const char *str)
755 size = strlen(str)+1;
756 ret = heap_alloc(size);
757 memcpy(ret, str, size);
763 static inline WCHAR *heap_strdupAtoW(const char *str)
770 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
771 ret = heap_alloc(len*sizeof(WCHAR));
772 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
778 static inline char *heap_strdupWtoA(LPCWSTR str)
783 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
784 ret = heap_alloc(size);
785 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
791 HINSTANCE get_shdoclc(void);
793 extern HINSTANCE hInst;