2 * Copyright 2005-2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wine/list.h"
27 #include "wine/unicode.h"
35 #define GENERATE_MSHTML_NS_FAILURE(code) \
36 ((nsresult) ((PRUint32)(1<<31) | ((PRUint32)(0x45+6)<<16) | (PRUint32)(code)))
38 #define NS_OK ((nsresult)0x00000000L)
39 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
40 #define NS_NOINTERFACE ((nsresult)0x80004002L)
41 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
42 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
43 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
44 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
46 #define WINE_NS_LOAD_FROM_MONIKER GENERATE_MSHTML_NS_FAILURE(0)
48 #define NS_FAILED(res) ((res) & 0x80000000)
49 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
53 #define MSHTML_E_NODOC 0x800a025c
55 typedef struct HTMLDOMNode HTMLDOMNode
;
56 typedef struct ConnectionPoint ConnectionPoint
;
57 typedef struct BSCallback BSCallback
;
58 typedef struct nsChannelBSC nsChannelBSC
;
59 typedef struct event_target_t event_target_t
;
61 /* NOTE: make sure to keep in sync with dispex.c */
65 DispDOMChildrenCollection_tid
,
67 DispHTMLCommentElement_tid
,
68 DispHTMLCurrentStyle_tid
,
70 DispHTMLDOMTextNode_tid
,
71 DispHTMLElementCollection_tid
,
72 DispHTMLGenericElement_tid
,
75 DispHTMLInputElement_tid
,
76 DispHTMLOptionElement_tid
,
77 DispHTMLSelectElement_tid
,
81 DispHTMLUnknownElement_tid
,
84 IHTMLBodyElement2_tid
,
85 IHTMLCommentElement_tid
,
86 IHTMLCurrentStyle_tid
,
91 IHTMLDOMChildrenCollection_tid
,
99 IHTMLElementCollection_tid
,
102 IHTMLGenericElement_tid
,
104 IHTMLInputElement_tid
,
105 IHTMLOptionElement_tid
,
106 IHTMLSelectElement_tid
,
111 IHTMLTextContainer_tid
,
119 typedef struct dispex_data_t dispex_data_t
;
120 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t
;
122 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
123 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
126 HRESULT (*get_dispid
)(IUnknown
*,BSTR
,DWORD
,DISPID
*);
127 HRESULT (*invoke
)(IUnknown
*,DISPID
,LCID
,WORD
,DISPPARAMS
*,VARIANT
*,EXCEPINFO
*,IServiceProvider
*);
128 } dispex_static_data_vtbl_t
;
131 const dispex_static_data_vtbl_t
*vtbl
;
132 const tid_t disp_tid
;
134 const tid_t
* const iface_tids
;
135 } dispex_static_data_t
;
138 const IDispatchExVtbl
*lpIDispatchExVtbl
;
142 dispex_static_data_t
*data
;
143 dispex_dynamic_data_t
*dynamic_data
;
146 void init_dispex(DispatchEx
*,IUnknown
*,dispex_static_data_t
*);
147 BOOL
dispex_query_interface(DispatchEx
*,REFIID
,void**);
148 HRESULT
dispex_get_dprop_ref(DispatchEx
*,const WCHAR
*,BOOL
,VARIANT
**);
152 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
153 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
154 const IDispatchExVtbl
*lpIDispatchExVtbl
;
159 nsIDOMWindow
*nswindow
;
161 IHTMLEventObj
*event
;
174 SCRIPTMODE_ACTIVESCRIPT
178 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
180 ConnectionPoint
*cp_list
;
182 } ConnectionPointContainer
;
184 struct ConnectionPoint
{
185 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
187 IConnectionPointContainer
*container
;
192 IPropertyNotifySink
*propnotif
;
198 ConnectionPoint
*next
;
202 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
210 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
215 } HTMLOptionElementFactory
;
217 struct HTMLDocument
{
219 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
220 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
221 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
222 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
223 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
224 const IPersistFileVtbl
*lpPersistFileVtbl
;
225 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
226 const IOleObjectVtbl
*lpOleObjectVtbl
;
227 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
228 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
229 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
230 const IViewObject2Vtbl
*lpViewObject2Vtbl
;
231 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
232 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
233 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
234 const IOleControlVtbl
*lpOleControlVtbl
;
235 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
236 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
237 const ICustomDocVtbl
*lpCustomDocVtbl
;
238 const IDispatchExVtbl
*lpIDispatchExVtbl
;
242 NSContainer
*nscontainer
;
244 nsIDOMHTMLDocument
*nsdoc
;
246 IOleClientSite
*client
;
247 IDocHostUIHandler
*hostui
;
248 IOleInPlaceSite
*ipsite
;
249 IOleInPlaceFrame
*frame
;
250 IOleInPlaceUIWindow
*ip_window
;
252 IOleUndoManager
*undomgr
;
254 nsChannelBSC
*bscallback
;
257 struct list bindings
;
259 struct list script_hosts
;
264 DOCHOSTUIINFO hostinfo
;
267 SCRIPTMODE scriptmode
;
268 READYSTATE readystate
;
269 BOOL in_place_active
;
273 BOOL container_locked
;
279 event_target_t
*event_target
;
280 ConnectionPointContainer cp_container
;
281 ConnectionPoint cp_htmldocevents
;
282 ConnectionPoint cp_htmldocevents2
;
283 ConnectionPoint cp_propnotif
;
285 HTMLOptionElementFactory
*option_factory
;
286 HTMLLocation
*location
;
288 struct list selection_list
;
289 struct list range_list
;
295 const nsIDOMEventListenerVtbl
*lpDOMEventListenerVtbl
;
299 typedef struct _mutation_queue_t
{
301 nsISupports
*nsiface
;
303 struct _mutation_queue_t
*next
;
307 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
308 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
309 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
310 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
311 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
312 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
313 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
314 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
316 const nsIDocumentObserverVtbl
*lpDocumentObserverVtbl
;
318 const nsIRunnableVtbl
*lpRunnableVtbl
;
320 nsEventListener blur_listener
;
321 nsEventListener focus_listener
;
322 nsEventListener keypress_listener
;
323 nsEventListener load_listener
;
324 nsEventListener htmlevent_listener
;
326 nsIWebBrowser
*webbrowser
;
327 nsIWebNavigation
*navigation
;
328 nsIBaseWindow
*window
;
329 nsIWebBrowserFocus
*focus
;
332 nsIController
*editor_controller
;
339 nsIURIContentListener
*content_listener
;
343 mutation_queue_t
*mutation_queue
;
344 mutation_queue_t
*mutation_queue_tail
;
346 nsChannelBSC
*bscallback
; /* hack */
347 HWND reset_focus
; /* hack */
353 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
354 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
359 nsIHttpChannel
*http_channel
;
361 nsIInputStream
*post_data_stream
;
362 nsILoadGroup
*load_group
;
363 nsIInterfaceRequestor
*notif_callback
;
365 nsLoadFlags load_flags
;
366 nsIURI
*original_uri
;
372 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
373 void (*destructor
)(HTMLDOMNode
*);
374 HRESULT (*put_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
);
375 HRESULT (*get_disabled
)(HTMLDOMNode
*,VARIANT_BOOL
*);
380 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
381 const IHTMLDOMNode2Vtbl
*lpHTMLDOMNode2Vtbl
;
382 const NodeImplVtbl
*vtbl
;
388 event_target_t
*event_target
;
395 ConnectionPointContainer cp_container
;
397 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
398 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
399 const IHTMLElement3Vtbl
*lpHTMLElement3Vtbl
;
401 nsIDOMHTMLElement
*nselem
;
407 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
412 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
413 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
415 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
416 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
417 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
418 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
419 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
420 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
421 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
422 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
423 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
424 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
425 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
426 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
427 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
428 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
429 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
430 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
431 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
432 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
433 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
434 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
435 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
436 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
437 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
438 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
440 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
441 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
442 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
443 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
444 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
445 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
446 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
447 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
448 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
450 #define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
452 #define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
454 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
455 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
456 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
458 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
459 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
460 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
462 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
463 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
464 #define HTMLELEM3(x) ((IHTMLElement3*) &(x)->lpHTMLElement3Vtbl)
465 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
466 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
468 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
470 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
471 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
473 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
475 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
476 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
478 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
479 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
480 HRESULT
create_doc_from_nsdoc(nsIDOMHTMLDocument
*,HTMLDocument
**);
482 HRESULT
HTMLWindow_Create(HTMLDocument
*,nsIDOMWindow
*,HTMLWindow
**);
483 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
484 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLDocument
*);
485 HTMLLocation
*HTMLLocation_Create(HTMLDocument
*);
486 IOmNavigator
*OmNavigator_Create(void);
488 void HTMLDocument_HTMLDocument3_Init(HTMLDocument
*);
489 void HTMLDocument_HTMLDocument5_Init(HTMLDocument
*);
490 void HTMLDocument_Persist_Init(HTMLDocument
*);
491 void HTMLDocument_OleCmd_Init(HTMLDocument
*);
492 void HTMLDocument_OleObj_Init(HTMLDocument
*);
493 void HTMLDocument_View_Init(HTMLDocument
*);
494 void HTMLDocument_Window_Init(HTMLDocument
*);
495 void HTMLDocument_Service_Init(HTMLDocument
*);
496 void HTMLDocument_Hlink_Init(HTMLDocument
*);
498 HRESULT
HTMLCurrentStyle_Create(HTMLElement
*,IHTMLCurrentStyle
**);
500 void ConnectionPoint_Init(ConnectionPoint
*,ConnectionPointContainer
*,REFIID
);
501 void ConnectionPointContainer_Init(ConnectionPointContainer
*,IUnknown
*);
502 void ConnectionPointContainer_Destroy(ConnectionPointContainer
*);
504 NSContainer
*NSContainer_Create(HTMLDocument
*,NSContainer
*);
505 void NSContainer_Release(NSContainer
*);
507 void init_mutation(NSContainer
*);
508 void set_mutation_observer(NSContainer
*,nsIDOMHTMLDocument
*);
510 void HTMLDocument_LockContainer(HTMLDocument
*,BOOL
);
511 void show_context_menu(HTMLDocument
*,DWORD
,POINT
*,IDispatch
*);
512 void notif_focus(HTMLDocument
*);
514 void show_tooltip(HTMLDocument
*,DWORD
,DWORD
,LPCWSTR
);
515 void hide_tooltip(HTMLDocument
*);
516 HRESULT
get_client_disp_property(IOleClientSite
*,DISPID
,VARIANT
*);
518 HRESULT
ProtocolFactory_Create(REFCLSID
,REFIID
,void**);
520 BOOL
load_gecko(BOOL
);
521 void close_gecko(void);
522 void register_nsservice(nsIComponentRegistrar
*,nsIServiceManager
*);
523 void init_nsio(nsIComponentManager
*,nsIComponentRegistrar
*);
524 void release_nsio(void);
525 BOOL
install_wine_gecko(BOOL
);
527 HRESULT
nsuri_to_url(LPCWSTR
,BSTR
*);
529 void hlink_frame_navigate(HTMLDocument
*,IHlinkFrame
*,LPCWSTR
,nsIInputStream
*,DWORD
);
531 void call_property_onchanged(ConnectionPoint
*,DISPID
);
532 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*,IOleInPlaceActiveObject
*);
534 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1);
537 void nsACString_Init(nsACString
*,const char*);
538 void nsACString_SetData(nsACString
*,const char*);
539 PRUint32
nsACString_GetData(const nsACString
*,const char**);
540 void nsACString_Finish(nsACString
*);
542 void nsAString_Init(nsAString
*,const PRUnichar
*);
543 void nsAString_SetData(nsAString
*,const PRUnichar
*);
544 PRUint32
nsAString_GetData(const nsAString
*,const PRUnichar
**);
545 void nsAString_Finish(nsAString
*);
547 nsIInputStream
*create_nsstream(const char*,PRInt32
);
548 nsICommandParams
*create_nscommand_params(void);
549 void nsnode_to_nsstring(nsIDOMNode
*,nsAString
*);
550 void get_editor_controller(NSContainer
*);
551 void init_nsevents(NSContainer
*);
552 void add_nsevent_listener(NSContainer
*,LPCWSTR
);
553 nsresult
get_nsinterface(nsISupports
*,REFIID
,void**);
554 void update_nsdocument(HTMLDocument
*);
556 void set_document_bscallback(HTMLDocument
*,nsChannelBSC
*);
557 void set_current_mon(HTMLDocument
*,IMoniker
*);
558 HRESULT
start_binding(HTMLDocument
*,BSCallback
*,IBindCtx
*);
560 HRESULT
bind_mon_to_buffer(HTMLDocument
*,IMoniker
*,void**,DWORD
*);
562 nsChannelBSC
*create_channelbsc(IMoniker
*);
563 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
564 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
565 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
567 IHTMLSelectionObject
*HTMLSelectionObject_Create(HTMLDocument
*,nsISelection
*);
568 IHTMLTxtRange
*HTMLTxtRange_Create(HTMLDocument
*,nsIDOMRange
*);
569 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
570 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
571 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
573 void detach_selection(HTMLDocument
*);
574 void detach_ranges(HTMLDocument
*);
575 HRESULT
get_node_text(HTMLDOMNode
*,BSTR
*);
577 HTMLDOMNode
*HTMLDOMTextNode_Create(HTMLDocument
*,nsIDOMNode
*);
579 HTMLElement
*HTMLElement_Create(HTMLDocument
*,nsIDOMNode
*,BOOL
);
580 HTMLElement
*HTMLCommentElement_Create(HTMLDocument
*,nsIDOMNode
*);
581 HTMLElement
*HTMLAnchorElement_Create(nsIDOMHTMLElement
*);
582 HTMLElement
*HTMLBodyElement_Create(nsIDOMHTMLElement
*);
583 HTMLElement
*HTMLIFrame_Create(nsIDOMHTMLElement
*);
584 HTMLElement
*HTMLImgElement_Create(nsIDOMHTMLElement
*);
585 HTMLElement
*HTMLInputElement_Create(nsIDOMHTMLElement
*);
586 HTMLElement
*HTMLOptionElement_Create(nsIDOMHTMLElement
*);
587 HTMLElement
*HTMLScriptElement_Create(nsIDOMHTMLElement
*);
588 HTMLElement
*HTMLSelectElement_Create(nsIDOMHTMLElement
*);
589 HTMLElement
*HTMLTable_Create(nsIDOMHTMLElement
*);
590 HTMLElement
*HTMLTableRow_Create(nsIDOMHTMLElement
*);
591 HTMLElement
*HTMLTextAreaElement_Create(nsIDOMHTMLElement
*);
592 HTMLElement
*HTMLGenericElement_Create(nsIDOMHTMLElement
*);
594 void HTMLDOMNode_Init(HTMLDocument
*,HTMLDOMNode
*,nsIDOMNode
*);
595 void HTMLElement_Init(HTMLElement
*);
596 void HTMLElement2_Init(HTMLElement
*);
597 void HTMLElement3_Init(HTMLElement
*);
598 void HTMLTextContainer_Init(HTMLTextContainer
*);
600 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
601 void HTMLDOMNode_destructor(HTMLDOMNode
*);
603 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
604 void HTMLElement_destructor(HTMLDOMNode
*);
606 HTMLDOMNode
*get_node(HTMLDocument
*,nsIDOMNode
*,BOOL
);
607 void release_nodes(HTMLDocument
*);
609 void release_script_hosts(HTMLDocument
*);
610 void connect_scripts(HTMLDocument
*);
611 void doc_insert_script(HTMLDocument
*,nsIDOMHTMLScriptElement
*);
612 IDispatch
*script_parse_event(HTMLDocument
*,LPCWSTR
);
613 void set_script_mode(HTMLDocument
*,SCRIPTMODE
);
615 IHTMLElementCollection
*HTMLElementCollection_Create(IUnknown
*,HTMLElement
**,DWORD
);
616 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*,BOOL
);
617 IHTMLElementCollection
*create_collection_from_nodelist(HTMLDocument
*,IUnknown
*,nsIDOMNodeList
*);
618 IHTMLElementCollection
*create_collection_from_htmlcol(HTMLDocument
*,IUnknown
*,nsIDOMHTMLCollection
*);
623 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
624 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
627 extern const cmdtable_t editmode_cmds
[];
629 void do_ns_command(NSContainer
*,const char*,nsICommandParams
*);
632 #define UPDATE_UI 0x0001
633 #define UPDATE_TITLE 0x0002
635 void update_doc(HTMLDocument
*This
, DWORD flags
);
636 void update_title(HTMLDocument
*);
639 void init_editor(HTMLDocument
*);
640 void set_ns_editmode(NSContainer
*);
641 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
642 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
643 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
644 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
645 void handle_edit_load(HTMLDocument
*);
646 HRESULT
editor_is_dirty(HTMLDocument
*);
647 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
649 extern DWORD mshtml_tls
;
651 typedef struct task_t
{
655 TASK_SETDOWNLOADSTATE
,
661 nsChannelBSC
*bscallback
;
668 task_t
*task_queue_head
;
669 task_t
*task_queue_tail
;
670 struct list timer_list
;
673 thread_data_t
*get_thread_data(BOOL
);
674 HWND
get_thread_hwnd(void);
675 void push_task(task_t
*);
676 void remove_doc_tasks(const HTMLDocument
*);
677 DWORD
set_task_timer(HTMLDocument
*,DWORD
,BOOL
,IDispatch
*);
678 HRESULT
clear_task_timer(HTMLDocument
*,BOOL
,DWORD
);
680 void release_typelib(void);
681 void call_disp_func(HTMLDocument
*,IDispatch
*,IDispatch
*);
683 const char *debugstr_variant(const VARIANT
*);
685 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
686 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
687 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
688 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
689 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
691 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
693 /* memory allocation functions */
695 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
697 return HeapAlloc(GetProcessHeap(), 0, len
);
700 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
702 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
705 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
707 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
710 static inline BOOL
heap_free(void *mem
)
712 return HeapFree(GetProcessHeap(), 0, mem
);
715 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
722 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
723 ret
= heap_alloc(size
);
724 memcpy(ret
, str
, size
);
730 static inline char *heap_strdupA(const char *str
)
737 size
= strlen(str
)+1;
738 ret
= heap_alloc(size
);
739 memcpy(ret
, str
, size
);
745 static inline WCHAR
*heap_strdupAtoW(const char *str
)
752 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
753 ret
= heap_alloc(len
*sizeof(WCHAR
));
754 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
760 static inline char *heap_strdupWtoA(LPCWSTR str
)
765 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
766 ret
= heap_alloc(size
);
767 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
773 HINSTANCE
get_shdoclc(void);
775 extern HINSTANCE hInst
;