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*);
208 typedef struct HTMLWindow HTMLWindow;
209 typedef struct HTMLDocumentNode HTMLDocumentNode;
210 typedef struct HTMLDocumentObj HTMLDocumentObj;
211 typedef struct HTMLFrameBase HTMLFrameBase;
212 typedef struct NSContainer NSContainer;
216 SCRIPTMODE_ACTIVESCRIPT
219 typedef struct ScriptHost ScriptHost;
224 } global_prop_type_t;
227 global_prop_type_t type;
229 ScriptHost *script_host;
234 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
239 } HTMLOptionElementFactory;
243 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
248 } HTMLImageElementFactory;
250 struct HTMLLocation {
252 IHTMLLocation IHTMLLocation_iface;
264 typedef struct nsChannelBSC nsChannelBSC;
268 IHTMLWindow2 IHTMLWindow2_iface;
269 IHTMLWindow3 IHTMLWindow3_iface;
270 IHTMLWindow4 IHTMLWindow4_iface;
271 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
272 IDispatchEx IDispatchEx_iface;
273 IServiceProvider IServiceProvider_iface;
277 windowref_t *window_ref;
280 HTMLDocumentNode *doc;
281 HTMLDocumentObj *doc_obj;
282 nsIDOMWindow *nswindow;
284 HTMLFrameBase *frame_element;
285 READYSTATE readystate;
287 nsChannelBSC *bscallback;
291 IHTMLEventObj *event;
293 SCRIPTMODE scriptmode;
294 struct list script_hosts;
296 HTMLOptionElementFactory *option_factory;
297 HTMLImageElementFactory *image_factory;
298 HTMLLocation *location;
301 global_prop_t *global_props;
302 DWORD global_prop_cnt;
303 DWORD global_prop_size;
305 struct list children;
306 struct list sibling_entry;
316 typedef struct _cp_static_data_t {
318 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
323 typedef struct ConnectionPointContainer {
324 IConnectionPointContainer IConnectionPointContainer_iface;
326 ConnectionPoint *cp_list;
328 struct ConnectionPointContainer *forward_container;
329 } ConnectionPointContainer;
331 struct ConnectionPoint {
332 IConnectionPoint IConnectionPoint_iface;
334 ConnectionPointContainer *container;
339 IPropertyNotifySink *propnotif;
344 cp_static_data_t *data;
346 ConnectionPoint *next;
349 struct HTMLDocument {
350 IHTMLDocument2 IHTMLDocument2_iface;
351 IHTMLDocument3 IHTMLDocument3_iface;
352 IHTMLDocument4 IHTMLDocument4_iface;
353 IHTMLDocument5 IHTMLDocument5_iface;
354 IHTMLDocument6 IHTMLDocument6_iface;
355 IPersistMoniker IPersistMoniker_iface;
356 IPersistFile IPersistFile_iface;
357 IPersistHistory IPersistHistory_iface;
358 IMonikerProp IMonikerProp_iface;
359 IOleObject IOleObject_iface;
360 IOleDocument IOleDocument_iface;
361 IOleDocumentView IOleDocumentView_iface;
362 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
363 IViewObjectEx IViewObjectEx_iface;
364 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
365 IServiceProvider IServiceProvider_iface;
366 IOleCommandTarget IOleCommandTarget_iface;
367 IOleControl IOleControl_iface;
368 IHlinkTarget IHlinkTarget_iface;
369 IPersistStreamInit IPersistStreamInit_iface;
370 IDispatchEx IDispatchEx_iface;
371 ISupportErrorInfo ISupportErrorInfo_iface;
372 IObjectWithSite IObjectWithSite_iface;
373 IOleContainer IOleContainer_iface;
374 IObjectSafety IObjectSafety_iface;
379 HTMLDocumentObj *doc_obj;
380 HTMLDocumentNode *doc_node;
386 ConnectionPointContainer cp_container;
387 ConnectionPoint cp_htmldocevents;
388 ConnectionPoint cp_htmldocevents2;
389 ConnectionPoint cp_propnotif;
390 ConnectionPoint cp_dispatch;
392 IOleAdviseHolder *advise_holder;
395 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
397 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
400 static inline ULONG htmldoc_addref(HTMLDocument *This)
402 return IUnknown_AddRef(This->unk_impl);
405 static inline ULONG htmldoc_release(HTMLDocument *This)
407 return IUnknown_Release(This->unk_impl);
410 struct HTMLDocumentObj {
411 HTMLDocument basedoc;
413 ICustomDoc ICustomDoc_iface;
417 NSContainer *nscontainer;
419 IOleClientSite *client;
420 IDocHostUIHandler *hostui;
422 IOleInPlaceSite *ipsite;
423 IOleInPlaceFrame *frame;
424 IOleInPlaceUIWindow *ip_window;
425 IAdviseSink *view_sink;
427 DOCHOSTUIINFO hostinfo;
429 IOleUndoManager *undomgr;
434 BOOL request_uiactivate;
435 BOOL in_place_active;
439 BOOL container_locked;
450 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
451 nsIContextMenuListener nsIContextMenuListener_iface;
452 nsIURIContentListener nsIURIContentListener_iface;
453 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
454 nsITooltipListener nsITooltipListener_iface;
455 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
456 nsIWeakReference nsIWeakReference_iface;
457 nsISupportsWeakReference nsISupportsWeakReference_iface;
459 nsIWebBrowser *webbrowser;
460 nsIWebNavigation *navigation;
461 nsIBaseWindow *window;
462 nsIWebBrowserFocus *focus;
465 nsIController *editor_controller;
470 HTMLDocumentObj *doc;
472 nsIURIContentListener *content_listener;
477 typedef struct nsWineURI nsWineURI;
479 HRESULT set_wine_url(nsWineURI*,LPCWSTR);
480 nsresult on_start_uri_open(NSContainer*,nsIURI*,PRBool*);
482 /* Keep sync with request_method_strings in nsio.c */
490 nsIHttpChannel nsIHttpChannel_iface;
491 nsIUploadChannel nsIUploadChannel_iface;
492 nsIHttpChannelInternal nsIHttpChannelInternal_iface;
497 nsIInputStream *post_data_stream;
498 nsILoadGroup *load_group;
499 nsIInterfaceRequestor *notif_callback;
501 nsLoadFlags load_flags;
502 nsIURI *original_uri;
506 PRUint32 response_status;
507 REQUEST_METHOD request_method;
508 struct list response_headers;
509 struct list request_headers;
519 HRESULT set_http_header(struct list*,const WCHAR*,int,const WCHAR*,int);
522 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
523 void (*destructor)(HTMLDOMNode*);
524 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
525 event_target_t **(*get_event_target)(HTMLDOMNode*);
526 HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
527 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
528 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
529 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
530 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
531 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
532 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
533 HRESULT (*bind_to_tree)(HTMLDOMNode*);
538 IHTMLDOMNode IHTMLDOMNode_iface;
539 IHTMLDOMNode2 IHTMLDOMNode2_iface;
540 const NodeImplVtbl *vtbl;
545 HTMLDocumentNode *doc;
546 event_target_t *event_target;
547 ConnectionPointContainer *cp_container;
554 ConnectionPointContainer cp_container;
556 IHTMLElement IHTMLElement_iface;
557 IHTMLElement2 IHTMLElement2_iface;
558 IHTMLElement3 IHTMLElement3_iface;
559 IHTMLElement4 IHTMLElement4_iface;
561 nsIDOMHTMLElement *nselem;
564 #define HTMLELEMENT_TIDS \
575 IHTMLTextContainer IHTMLTextContainer_iface;
580 struct HTMLFrameBase {
583 IHTMLFrameBase IHTMLFrameBase_iface;
584 IHTMLFrameBase2 IHTMLFrameBase2_iface;
586 HTMLWindow *content_window;
588 nsIDOMHTMLFrameElement *nsframe;
589 nsIDOMHTMLIFrameElement *nsiframe;
592 typedef struct nsDocumentEventListener nsDocumentEventListener;
594 struct HTMLDocumentNode {
596 HTMLDocument basedoc;
598 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
600 nsIDocumentObserver nsIDocumentObserver_iface;
604 nsIDOMHTMLDocument *nsdoc;
607 event_target_t *body_event_target;
609 IInternetSecurityManager *secmgr;
610 ICatInformation *catmgr;
611 nsDocumentEventListener *nsevent_listener;
614 BOOL skip_mutation_notif;
616 struct list bindings;
617 struct list selection_list;
618 struct list range_list;
619 struct list plugin_hosts;
622 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
623 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
624 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**);
625 HRESULT create_document_fragment(nsIDOMNode*,HTMLDocumentNode*,HTMLDocumentNode**);
627 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**);
628 void update_window_doc(HTMLWindow*);
629 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
630 nsIDOMWindow *get_nsdoc_window(nsIDOMDocument*);
631 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
632 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*);
633 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
634 IOmNavigator *OmNavigator_Create(void);
635 HRESULT HTMLScreen_Create(IHTMLScreen**);
637 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
638 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
639 void HTMLDocument_Persist_Init(HTMLDocument*);
640 void HTMLDocument_OleCmd_Init(HTMLDocument*);
641 void HTMLDocument_OleObj_Init(HTMLDocument*);
642 void HTMLDocument_View_Init(HTMLDocument*);
643 void HTMLDocument_Window_Init(HTMLDocument*);
644 void HTMLDocument_Service_Init(HTMLDocument*);
645 void HTMLDocument_Hlink_Init(HTMLDocument*);
647 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*);
649 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**);
651 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*);
652 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
653 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
655 NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
656 void NSContainer_Release(NSContainer*);
657 nsresult create_chrome_window(nsIWebBrowserChrome*,nsIWebBrowserChrome**);
659 void init_mutation(HTMLDocumentNode*);
660 void release_mutation(HTMLDocumentNode*);
662 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
663 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
664 void notif_focus(HTMLDocumentObj*);
666 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR);
667 void hide_tooltip(HTMLDocumentObj*);
668 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
670 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
672 BOOL load_gecko(BOOL);
673 void close_gecko(void);
674 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
675 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
676 void release_nsio(void);
677 BOOL is_gecko_path(const char*);
679 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
680 HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**);
681 HRESULT load_nsuri(HTMLWindow*,nsWineURI*,nsChannelBSC*,DWORD);
683 HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD,BOOL*);
684 HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);
685 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*);
686 HRESULT set_moniker(HTMLDocument*,IMoniker*,IBindCtx*,nsChannelBSC*,BOOL);
688 void call_property_onchanged(ConnectionPoint*,DISPID);
689 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
691 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
694 void nsACString_InitDepend(nsACString*,const char*);
695 void nsACString_SetData(nsACString*,const char*);
696 PRUint32 nsACString_GetData(const nsACString*,const char**);
697 void nsACString_Finish(nsACString*);
699 BOOL nsAString_Init(nsAString*,const PRUnichar*);
700 void nsAString_InitDepend(nsAString*,const PRUnichar*);
701 void nsAString_SetData(nsAString*,const PRUnichar*);
702 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
703 void nsAString_Finish(nsAString*);
704 HRESULT return_nsstr(nsresult,nsAString*,BSTR*);
706 nsICommandParams *create_nscommand_params(void);
707 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
708 void get_editor_controller(NSContainer*);
709 nsresult get_nsinterface(nsISupports*,REFIID,void**);
711 void init_nsevents(HTMLDocumentNode*);
712 void release_nsevents(HTMLDocumentNode*);
713 void add_nsevent_listener(HTMLDocumentNode*,nsIDOMNode*,LPCWSTR);
715 void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
716 void set_current_mon(HTMLWindow*,IMoniker*);
717 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*);
718 HRESULT async_start_doc_binding(HTMLWindow*,nsChannelBSC*);
719 void abort_document_bindings(HTMLDocumentNode*);
721 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*);
723 HRESULT create_channelbsc(IMoniker*,WCHAR*,BYTE*,DWORD,nsChannelBSC**);
724 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
725 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
726 IMoniker *get_channelbsc_mon(nsChannelBSC*);
728 void set_ready_state(HTMLWindow*,READYSTATE);
730 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
731 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**);
732 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
733 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
734 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
736 void detach_selection(HTMLDocumentNode*);
737 void detach_ranges(HTMLDocumentNode*);
738 HRESULT get_node_text(HTMLDOMNode*,BSTR*);
740 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
742 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**);
746 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
752 HRESULT HTMLDOMAttribute_Create(HTMLDocumentNode*,nsIDOMAttr*,HTMLDOMAttribute**);
754 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**);
755 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**);
756 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
757 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
758 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
759 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
760 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
761 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
762 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
763 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
764 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
765 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
766 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
767 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
768 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
769 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
770 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
771 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
772 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
774 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
775 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
776 void HTMLElement2_Init(HTMLElement*);
777 void HTMLElement3_Init(HTMLElement*);
778 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
779 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
781 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
782 void HTMLDOMNode_destructor(HTMLDOMNode*);
784 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
785 void HTMLElement_destructor(HTMLDOMNode*);
786 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
788 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
789 void HTMLFrameBase_destructor(HTMLFrameBase*);
791 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**);
792 void release_nodes(HTMLDocumentNode*);
794 void release_script_hosts(HTMLWindow*);
795 void connect_scripts(HTMLWindow*);
796 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*);
797 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR);
798 HRESULT exec_script(HTMLWindow*,const WCHAR*,const WCHAR*,VARIANT*);
799 void set_script_mode(HTMLWindow*,SCRIPTMODE);
800 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
801 IDispatch *get_script_disp(ScriptHost*);
802 HRESULT search_window_props(HTMLWindow*,BSTR,DWORD,DISPID*);
804 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
805 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
806 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
811 HRESULT (*query)(HTMLDocument*,OLECMD*);
812 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
815 extern const cmdtable_t editmode_cmds[];
817 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*);
820 #define UPDATE_UI 0x0001
821 #define UPDATE_TITLE 0x0002
823 void update_doc(HTMLDocument*,DWORD);
824 void update_title(HTMLDocumentObj*);
827 void init_editor(HTMLDocument*);
828 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
829 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
830 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
831 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
832 void handle_edit_load(HTMLDocument*);
833 HRESULT editor_is_dirty(HTMLDocument*);
834 void set_dirty(HTMLDocument*,VARIANT_BOOL);
836 extern DWORD mshtml_tls;
838 typedef struct task_t task_t;
839 typedef void (*task_proc_t)(task_t*);
849 HTMLDocumentObj *doc;
854 task_t *task_queue_head;
855 task_t *task_queue_tail;
856 struct list timer_list;
859 thread_data_t *get_thread_data(BOOL);
860 HWND get_thread_hwnd(void);
862 LONG get_task_target_magic(void);
863 void push_task(task_t*,task_proc_t,LONG);
864 void remove_target_tasks(LONG);
866 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*);
867 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD);
869 void release_typelib(void);
870 HRESULT call_disp_func(IDispatch*,DISPPARAMS*);
872 const char *debugstr_variant(const VARIANT*);
874 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
875 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
876 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
877 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
878 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
880 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
882 /* memory allocation functions */
884 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
886 return HeapAlloc(GetProcessHeap(), 0, len);
889 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
891 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
894 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
896 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
899 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
901 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
904 static inline BOOL heap_free(void *mem)
906 return HeapFree(GetProcessHeap(), 0, mem);
909 static inline LPWSTR heap_strdupW(LPCWSTR str)
916 size = (strlenW(str)+1)*sizeof(WCHAR);
917 ret = heap_alloc(size);
918 memcpy(ret, str, size);
924 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
929 ret = heap_alloc((len+1)*sizeof(WCHAR));
930 memcpy(ret, str, len*sizeof(WCHAR));
937 static inline char *heap_strdupA(const char *str)
944 size = strlen(str)+1;
945 ret = heap_alloc(size);
946 memcpy(ret, str, size);
952 static inline WCHAR *heap_strdupAtoW(const char *str)
959 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
960 ret = heap_alloc(len*sizeof(WCHAR));
961 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
967 static inline char *heap_strdupWtoA(LPCWSTR str)
972 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
973 ret = heap_alloc(size);
974 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
980 static inline void windowref_addref(windowref_t *ref)
982 InterlockedIncrement(&ref->ref);
985 static inline void windowref_release(windowref_t *ref)
987 if(!InterlockedDecrement(&ref->ref))
991 HDC get_display_dc(void);
992 HINSTANCE get_shdoclc(void);
993 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR);
995 extern HINSTANCE hInst;