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
29 #include "wine/list.h"
30 #include "wine/unicode.h"
38 #define NS_ERROR_GENERATE_FAILURE(module,code) \
39 ((nsresult) (((PRUint32)(1<<31)) | ((PRUint32)(module+0x45)<<16) | ((PRUint32)(code))))
41 #define NS_OK ((nsresult)0x00000000L)
42 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
43 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
44 #define NS_NOINTERFACE ((nsresult)0x80004002L)
45 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
46 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
47 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
48 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
50 #define NS_ERROR_MODULE_NETWORK 6
52 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
53 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
55 #define NS_FAILED(res) ((res) & 0x80000000)
56 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
60 #define MSHTML_E_NODOC 0x800a025c
62 typedef struct HTMLDOMNode HTMLDOMNode;
63 typedef struct ConnectionPoint ConnectionPoint;
64 typedef struct BSCallback BSCallback;
65 typedef struct event_target_t event_target_t;
69 XDIID(DispCEventObj) \
71 XDIID(DispDOMChildrenCollection) \
72 XDIID(DispHTMLAnchorElement) \
74 XDIID(DispHTMLCommentElement) \
75 XDIID(DispHTMLCurrentStyle) \
76 XDIID(DispHTMLDocument) \
77 XDIID(DispHTMLDOMAttribute) \
78 XDIID(DispHTMLDOMTextNode) \
79 XDIID(DispHTMLElementCollection) \
80 XDIID(DispHTMLEmbed) \
81 XDIID(DispHTMLFormElement) \
82 XDIID(DispHTMLGenericElement) \
83 XDIID(DispHTMLFrameElement) \
84 XDIID(DispHTMLIFrame) \
86 XDIID(DispHTMLInputElement) \
87 XDIID(DispHTMLLocation) \
88 XDIID(DispHTMLNavigator) \
89 XDIID(DispHTMLObjectElement) \
90 XDIID(DispHTMLOptionElement) \
91 XDIID(DispHTMLScreen) \
92 XDIID(DispHTMLScriptElement) \
93 XDIID(DispHTMLSelectElement) \
94 XDIID(DispHTMLStyle) \
95 XDIID(DispHTMLStyleElement) \
96 XDIID(DispHTMLStyleSheetsCollection) \
97 XDIID(DispHTMLTable) \
98 XDIID(DispHTMLTableRow) \
99 XDIID(DispHTMLTextAreaElement) \
100 XDIID(DispHTMLUnknownElement) \
101 XDIID(DispHTMLWindow2) \
102 XDIID(HTMLDocumentEvents) \
103 XIID(IHTMLAnchorElement) \
104 XIID(IHTMLBodyElement) \
105 XIID(IHTMLBodyElement2) \
106 XIID(IHTMLCommentElement) \
107 XIID(IHTMLCurrentStyle) \
108 XIID(IHTMLCurrentStyle2) \
109 XIID(IHTMLCurrentStyle3) \
110 XIID(IHTMLCurrentStyle4) \
111 XIID(IHTMLDocument2) \
112 XIID(IHTMLDocument3) \
113 XIID(IHTMLDocument4) \
114 XIID(IHTMLDocument5) \
115 XIID(IHTMLDOMAttribute) \
116 XIID(IHTMLDOMChildrenCollection) \
118 XIID(IHTMLDOMNode2) \
119 XIID(IHTMLDOMTextNode) \
121 XIID(IHTMLElement2) \
122 XIID(IHTMLElement3) \
123 XIID(IHTMLElement4) \
124 XIID(IHTMLElementCollection) \
125 XIID(IHTMLEmbedElement) \
126 XIID(IHTMLEventObj) \
127 XIID(IHTMLFiltersCollection) \
128 XIID(IHTMLFormElement) \
129 XIID(IHTMLFrameBase) \
130 XIID(IHTMLFrameBase2) \
131 XIID(IHTMLFrameElement3) \
132 XIID(IHTMLGenericElement) \
133 XIID(IHTMLIFrameElement) \
134 XIID(IHTMLImageElementFactory) \
135 XIID(IHTMLImgElement) \
136 XIID(IHTMLInputElement) \
137 XIID(IHTMLLocation) \
138 XIID(IHTMLObjectElement) \
139 XIID(IHTMLOptionElement) \
140 XIID(IHTMLPluginsCollection) \
143 XIID(IHTMLScriptElement) \
144 XIID(IHTMLSelectElement) \
149 XIID(IHTMLStyleElement) \
150 XIID(IHTMLStyleSheetsCollection) \
152 XIID(IHTMLTableRow) \
153 XIID(IHTMLTextAreaElement) \
154 XIID(IHTMLTextContainer) \
155 XIID(IHTMLUniqueName) \
162 #define XIID(iface) iface ## _tid,
163 #define XDIID(iface) iface ## _tid,
170 typedef struct dispex_data_t dispex_data_t;
171 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
173 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
174 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
175 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
177 typedef struct DispatchEx DispatchEx;
180 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
181 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
182 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
183 } dispex_static_data_vtbl_t;
186 const dispex_static_data_vtbl_t *vtbl;
187 const tid_t disp_tid;
189 const tid_t* const iface_tids;
190 } dispex_static_data_t;
193 IDispatchEx IDispatchEx_iface;
197 dispex_static_data_t *data;
198 dispex_dynamic_data_t *dynamic_data;
201 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
202 void release_dispex(DispatchEx*);
203 BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
204 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
205 HRESULT get_dispids(tid_t,DWORD*,DISPID**);
206 HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*);
207 void release_typelib(void);
209 typedef struct HTMLWindow HTMLWindow;
210 typedef struct HTMLDocumentNode HTMLDocumentNode;
211 typedef struct HTMLDocumentObj HTMLDocumentObj;
212 typedef struct HTMLFrameBase HTMLFrameBase;
213 typedef struct NSContainer NSContainer;
217 SCRIPTMODE_ACTIVESCRIPT
220 typedef struct ScriptHost ScriptHost;
225 } global_prop_type_t;
228 global_prop_type_t type;
230 ScriptHost *script_host;
235 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
240 } HTMLOptionElementFactory;
244 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
249 } HTMLImageElementFactory;
251 struct HTMLLocation {
253 IHTMLLocation IHTMLLocation_iface;
265 typedef struct nsChannelBSC nsChannelBSC;
269 IHTMLWindow2 IHTMLWindow2_iface;
270 IHTMLWindow3 IHTMLWindow3_iface;
271 IHTMLWindow4 IHTMLWindow4_iface;
272 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
273 IDispatchEx IDispatchEx_iface;
274 IServiceProvider IServiceProvider_iface;
278 windowref_t *window_ref;
281 HTMLDocumentNode *doc;
282 HTMLDocumentObj *doc_obj;
283 nsIDOMWindow *nswindow;
285 HTMLFrameBase *frame_element;
286 READYSTATE readystate;
288 nsChannelBSC *bscallback;
292 IHTMLEventObj *event;
294 SCRIPTMODE scriptmode;
295 struct list script_hosts;
297 HTMLOptionElementFactory *option_factory;
298 HTMLImageElementFactory *image_factory;
299 HTMLLocation *location;
302 global_prop_t *global_props;
303 DWORD global_prop_cnt;
304 DWORD global_prop_size;
306 struct list children;
307 struct list sibling_entry;
317 typedef struct _cp_static_data_t {
319 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
324 typedef struct ConnectionPointContainer {
325 IConnectionPointContainer IConnectionPointContainer_iface;
327 ConnectionPoint *cp_list;
329 struct ConnectionPointContainer *forward_container;
330 } ConnectionPointContainer;
332 struct ConnectionPoint {
333 IConnectionPoint IConnectionPoint_iface;
335 ConnectionPointContainer *container;
340 IPropertyNotifySink *propnotif;
345 cp_static_data_t *data;
347 ConnectionPoint *next;
350 struct HTMLDocument {
351 IHTMLDocument2 IHTMLDocument2_iface;
352 IHTMLDocument3 IHTMLDocument3_iface;
353 IHTMLDocument4 IHTMLDocument4_iface;
354 IHTMLDocument5 IHTMLDocument5_iface;
355 IHTMLDocument6 IHTMLDocument6_iface;
356 IPersistMoniker IPersistMoniker_iface;
357 IPersistFile IPersistFile_iface;
358 IPersistHistory IPersistHistory_iface;
359 IMonikerProp IMonikerProp_iface;
360 IOleObject IOleObject_iface;
361 IOleDocument IOleDocument_iface;
362 IOleDocumentView IOleDocumentView_iface;
363 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
364 IViewObjectEx IViewObjectEx_iface;
365 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
366 IServiceProvider IServiceProvider_iface;
367 IOleCommandTarget IOleCommandTarget_iface;
368 IOleControl IOleControl_iface;
369 IHlinkTarget IHlinkTarget_iface;
370 IPersistStreamInit IPersistStreamInit_iface;
371 IDispatchEx IDispatchEx_iface;
372 ISupportErrorInfo ISupportErrorInfo_iface;
373 IObjectWithSite IObjectWithSite_iface;
374 IOleContainer IOleContainer_iface;
375 IObjectSafety IObjectSafety_iface;
380 HTMLDocumentObj *doc_obj;
381 HTMLDocumentNode *doc_node;
387 ConnectionPointContainer cp_container;
388 ConnectionPoint cp_htmldocevents;
389 ConnectionPoint cp_htmldocevents2;
390 ConnectionPoint cp_propnotif;
391 ConnectionPoint cp_dispatch;
393 IOleAdviseHolder *advise_holder;
396 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
398 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
401 static inline ULONG htmldoc_addref(HTMLDocument *This)
403 return IUnknown_AddRef(This->unk_impl);
406 static inline ULONG htmldoc_release(HTMLDocument *This)
408 return IUnknown_Release(This->unk_impl);
411 struct HTMLDocumentObj {
412 HTMLDocument basedoc;
414 ICustomDoc ICustomDoc_iface;
418 NSContainer *nscontainer;
420 IOleClientSite *client;
421 IDocHostUIHandler *hostui;
423 IOleInPlaceSite *ipsite;
424 IOleInPlaceFrame *frame;
425 IOleInPlaceUIWindow *ip_window;
426 IAdviseSink *view_sink;
428 DOCHOSTUIINFO hostinfo;
430 IOleUndoManager *undomgr;
435 BOOL request_uiactivate;
436 BOOL in_place_active;
440 BOOL container_locked;
451 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
452 nsIContextMenuListener nsIContextMenuListener_iface;
453 nsIURIContentListener nsIURIContentListener_iface;
454 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
455 nsITooltipListener nsITooltipListener_iface;
456 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
457 nsIWeakReference nsIWeakReference_iface;
458 nsISupportsWeakReference nsISupportsWeakReference_iface;
460 nsIWebBrowser *webbrowser;
461 nsIWebNavigation *navigation;
462 nsIBaseWindow *window;
463 nsIWebBrowserFocus *focus;
466 nsIController *editor_controller;
471 HTMLDocumentObj *doc;
473 nsIURIContentListener *content_listener;
478 typedef struct nsWineURI nsWineURI;
480 HRESULT set_wine_url(nsWineURI*,LPCWSTR);
481 nsresult on_start_uri_open(NSContainer*,nsIURI*,PRBool*);
483 /* Keep sync with request_method_strings in nsio.c */
491 nsIHttpChannel nsIHttpChannel_iface;
492 nsIUploadChannel nsIUploadChannel_iface;
493 nsIHttpChannelInternal nsIHttpChannelInternal_iface;
498 nsIInputStream *post_data_stream;
499 nsILoadGroup *load_group;
500 nsIInterfaceRequestor *notif_callback;
502 nsLoadFlags load_flags;
503 nsIURI *original_uri;
507 PRUint32 response_status;
508 REQUEST_METHOD request_method;
509 struct list response_headers;
510 struct list request_headers;
520 HRESULT set_http_header(struct list*,const WCHAR*,int,const WCHAR*,int);
523 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
524 void (*destructor)(HTMLDOMNode*);
525 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
526 event_target_t **(*get_event_target)(HTMLDOMNode*);
527 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
528 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
529 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
530 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
531 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
532 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
533 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
534 HRESULT (*bind_to_tree)(HTMLDOMNode*);
539 IHTMLDOMNode IHTMLDOMNode_iface;
540 IHTMLDOMNode2 IHTMLDOMNode2_iface;
541 const NodeImplVtbl *vtbl;
546 HTMLDocumentNode *doc;
547 event_target_t *event_target;
548 ConnectionPointContainer *cp_container;
555 ConnectionPointContainer cp_container;
557 IHTMLElement IHTMLElement_iface;
558 IHTMLElement2 IHTMLElement2_iface;
559 IHTMLElement3 IHTMLElement3_iface;
560 IHTMLElement4 IHTMLElement4_iface;
562 nsIDOMHTMLElement *nselem;
565 #define HTMLELEMENT_TIDS \
576 IHTMLTextContainer IHTMLTextContainer_iface;
581 struct HTMLFrameBase {
584 IHTMLFrameBase IHTMLFrameBase_iface;
585 IHTMLFrameBase2 IHTMLFrameBase2_iface;
587 HTMLWindow *content_window;
589 nsIDOMHTMLFrameElement *nsframe;
590 nsIDOMHTMLIFrameElement *nsiframe;
593 typedef struct nsDocumentEventListener nsDocumentEventListener;
595 struct HTMLDocumentNode {
597 HTMLDocument basedoc;
599 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
601 nsIDocumentObserver nsIDocumentObserver_iface;
605 nsIDOMHTMLDocument *nsdoc;
608 event_target_t *body_event_target;
610 IInternetSecurityManager *secmgr;
611 ICatInformation *catmgr;
612 nsDocumentEventListener *nsevent_listener;
615 BOOL skip_mutation_notif;
617 struct list bindings;
618 struct list selection_list;
619 struct list range_list;
620 struct list plugin_hosts;
623 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
624 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
625 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
626 HRESULT create_document_fragment(nsIDOMNode*,HTMLDocumentNode*,HTMLDocumentNode**);
628 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**);
629 void update_window_doc(HTMLWindow*);
630 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
631 nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*);
632 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
633 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*);
634 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
635 IOmNavigator *OmNavigator_Create(void);
636 HRESULT HTMLScreen_Create(IHTMLScreen**);
638 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
639 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
640 void HTMLDocument_Persist_Init(HTMLDocument*);
641 void HTMLDocument_OleCmd_Init(HTMLDocument*);
642 void HTMLDocument_OleObj_Init(HTMLDocument*);
643 void HTMLDocument_View_Init(HTMLDocument*);
644 void HTMLDocument_Window_Init(HTMLDocument*);
645 void HTMLDocument_Service_Init(HTMLDocument*);
646 void HTMLDocument_Hlink_Init(HTMLDocument*);
648 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
650 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
652 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*);
653 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
654 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
656 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
657 void NSContainer_Release(NSContainer*);
658 nsresult create_chrome_window(nsIWebBrowserChrome*,nsIWebBrowserChrome**);
660 void init_mutation(HTMLDocumentNode*);
661 void release_mutation(HTMLDocumentNode*);
663 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
664 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
665 void notif_focus(HTMLDocumentObj*);
667 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
668 void hide_tooltip(HTMLDocumentObj*);
669 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
671 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
673 BOOL load_gecko(BOOL);
674 void close_gecko(void);
675 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
676 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
677 void release_nsio(void);
678 BOOL is_gecko_path(const char*);
680 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
681 HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**);
682 HRESULT load_nsuri(HTMLWindow*,nsWineURI*,nsChannelBSC*,DWORD);
684 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD,BOOL*);
685 HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);
686 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*);
687 HRESULT set_moniker(HTMLDocument*,IMoniker*,IBindCtx*,nsChannelBSC*,BOOL);
689 void call_property_onchanged(ConnectionPoint*,DISPID);
690 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
692 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
695 void nsACString_InitDepend(nsACString*,const char*);
696 void nsACString_SetData(nsACString*,const char*);
697 PRUint32 nsACString_GetData(const nsACString*,const char**);
698 void nsACString_Finish(nsACString*);
700 BOOL nsAString_Init(nsAString*,const PRUnichar*);
701 void nsAString_InitDepend(nsAString*,const PRUnichar*);
702 void nsAString_SetData(nsAString*,const PRUnichar*);
703 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
704 void nsAString_Finish(nsAString*);
705 HRESULT return_nsstr(nsresult,nsAString*,BSTR*);
707 nsICommandParams *create_nscommand_params(void);
708 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
709 void get_editor_controller(NSContainer*);
710 nsresult get_nsinterface(nsISupports*,REFIID,void**);
712 void init_nsevents(HTMLDocumentNode*);
713 void release_nsevents(HTMLDocumentNode*);
714 void add_nsevent_listener(HTMLDocumentNode*,nsIDOMNode*,LPCWSTR);
716 void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
717 void set_current_mon(HTMLWindow*,IMoniker*);
718 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
719 HRESULT async_start_doc_binding(HTMLWindow*,nsChannelBSC*);
720 void abort_document_bindings(HTMLDocumentNode*);
722 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);
724 HRESULT create_channelbsc(IMoniker*,WCHAR*,BYTE*,DWORD,nsChannelBSC**);
725 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
726 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
727 IMoniker *get_channelbsc_mon(nsChannelBSC*);
729 void set_ready_state(HTMLWindow*,READYSTATE);
731 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
732 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
733 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
734 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
735 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
737 void detach_selection(HTMLDocumentNode*);
738 void detach_ranges(HTMLDocumentNode*);
739 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
741 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
743 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**);
747 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
753 HRESULT HTMLDOMAttribute_Create(HTMLDocumentNode*,nsIDOMAttr*,HTMLDOMAttribute**);
755 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**);
756 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**);
757 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
758 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
759 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
760 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
761 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
762 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
763 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
764 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
765 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
766 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
767 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
768 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
769 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
770 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
771 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
772 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
773 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
775 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
776 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
777 void HTMLElement2_Init(HTMLElement*);
778 void HTMLElement3_Init(HTMLElement*);
779 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
780 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
782 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
783 void HTMLDOMNode_destructor(HTMLDOMNode*);
785 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
786 void HTMLElement_destructor(HTMLDOMNode*);
787 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
789 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
790 void HTMLFrameBase_destructor(HTMLFrameBase*);
792 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**);
793 void release_nodes(HTMLDocumentNode*);
795 void release_script_hosts(HTMLWindow*);
796 void connect_scripts(HTMLWindow*);
797 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
798 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
799 HRESULT exec_script(HTMLWindow*,const WCHAR*,const WCHAR*,VARIANT*);
800 void set_script_mode(HTMLWindow*,SCRIPTMODE);
801 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
802 IDispatch *get_script_disp(ScriptHost*);
803 HRESULT search_window_props(HTMLWindow*,BSTR,DWORD,DISPID*);
805 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
806 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
807 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
812 HRESULT (*query)(HTMLDocument*,OLECMD*);
813 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
816 extern const cmdtable_t editmode_cmds[];
818 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
821 #define UPDATE_UI 0x0001
822 #define UPDATE_TITLE 0x0002
824 void update_doc(HTMLDocument*,DWORD);
825 void update_title(HTMLDocumentObj*);
828 void init_editor(HTMLDocument*);
829 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
830 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
831 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
832 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
833 void handle_edit_load(HTMLDocument*);
834 HRESULT editor_is_dirty(HTMLDocument*);
835 void set_dirty(HTMLDocument*,VARIANT_BOOL);
837 extern DWORD mshtml_tls;
839 typedef struct task_t task_t;
840 typedef void (*task_proc_t)(task_t*);
850 HTMLDocumentObj *doc;
855 task_t *task_queue_head;
856 task_t *task_queue_tail;
857 struct list timer_list;
860 thread_data_t *get_thread_data(BOOL);
861 HWND get_thread_hwnd(void);
863 LONG get_task_target_magic(void);
864 void push_task(task_t*,task_proc_t,LONG);
865 void remove_target_tasks(LONG);
867 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
868 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
870 const char *debugstr_variant(const VARIANT*);
872 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
873 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
874 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
875 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
876 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
878 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
880 /* memory allocation functions */
882 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
884 return HeapAlloc(GetProcessHeap(), 0, len);
887 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
889 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
892 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
894 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
897 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
899 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
902 static inline BOOL heap_free(void *mem)
904 return HeapFree(GetProcessHeap(), 0, mem);
907 static inline LPWSTR heap_strdupW(LPCWSTR str)
914 size = (strlenW(str)+1)*sizeof(WCHAR);
915 ret = heap_alloc(size);
916 memcpy(ret, str, size);
922 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
927 ret = heap_alloc((len+1)*sizeof(WCHAR));
928 memcpy(ret, str, len*sizeof(WCHAR));
935 static inline char *heap_strdupA(const char *str)
942 size = strlen(str)+1;
943 ret = heap_alloc(size);
944 memcpy(ret, str, size);
950 static inline WCHAR *heap_strdupAtoW(const char *str)
957 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
958 ret = heap_alloc(len*sizeof(WCHAR));
959 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
965 static inline char *heap_strdupWtoA(LPCWSTR str)
970 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
971 ret = heap_alloc(size);
972 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
978 static inline void windowref_addref(windowref_t *ref)
980 InterlockedIncrement(&ref->ref);
983 static inline void windowref_release(windowref_t *ref)
985 if(!InterlockedDecrement(&ref->ref))
989 HDC get_display_dc(void);
990 HINSTANCE get_shdoclc(void);
991 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR);
993 extern HINSTANCE hInst;