1 /* 2 * Copyright 2005-2009 Jacek Caban for CodeWeavers 3 * 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. 8 * 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. 13 * 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 17 */ 18 19 #ifndef _MSHTML_PRIVATE_H_ 20 #define _MSHTML_PRIVATE_H_ 21 22 #include <wine/config.h> 23 24 #include <assert.h> 25 #include <stdarg.h> 26 #include <stdio.h> 27 #include <math.h> 28 29 #define WIN32_NO_STATUS 30 #define _INC_WINDOWS 31 32 #define COBJMACROS 33 #define NONAMELESSUNION 34 #define NONAMELESSSTRUCT 35 36 #include <windef.h> 37 #include <winbase.h> 38 #include <winreg.h> 39 #include <wingdi.h> 40 #include <ole2.h> 41 #include <docobjectservice.h> 42 #include <mshtmhst.h> 43 #include <mshtmcid.h> 44 #include <mshtmdid.h> 45 #include <perhist.h> 46 #include <objsafe.h> 47 #include <htiframe.h> 48 #include <tlogstg.h> 49 #include <shdeprecated.h> 50 #include <shlguid.h> 51 #define NO_SHLWAPI_REG 52 #include <shlwapi.h> 53 #include <optary.h> 54 #include <idispids.h> 55 #include <wininet.h> 56 #include <nsiface.h> 57 58 #include <wine/debug.h> 59 #include <wine/list.h> 60 #include <wine/unicode.h> 61 62 WINE_DEFAULT_DEBUG_CHANNEL(mshtml); 63 64 #define NS_ERROR_GENERATE_FAILURE(module,code) \ 65 ((nsresult) (((UINT32)(1u<<31)) | ((UINT32)(module+0x45)<<16) | ((UINT32)(code)))) 66 67 #define NS_OK ((nsresult)0x00000000L) 68 #define NS_ERROR_FAILURE ((nsresult)0x80004005L) 69 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL) 70 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L) 71 #define NS_NOINTERFACE ((nsresult)0x80004002L) 72 #define NS_ERROR_INVALID_POINTER ((nsresult)0x80004003L) 73 #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER 74 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L) 75 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L) 76 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL) 77 78 #define NS_ERROR_MODULE_NETWORK 6 79 80 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2) 81 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18) 82 83 #define NS_FAILED(res) ((res) & 0x80000000) 84 #define NS_SUCCEEDED(res) (!NS_FAILED(res)) 85 86 #define NSAPI WINAPI 87 88 #define MSHTML_E_NODOC 0x800a025c 89 90 typedef struct HTMLDOMNode HTMLDOMNode; 91 typedef struct ConnectionPoint ConnectionPoint; 92 typedef struct BSCallback BSCallback; 93 typedef struct event_target_t event_target_t; 94 95 #define TID_LIST \ 96 XIID(NULL) \ 97 XDIID(DispCEventObj) \ 98 XDIID(DispCPlugins) \ 99 XDIID(DispDOMChildrenCollection) \ 100 XDIID(DispHTMLAnchorElement) \ 101 XDIID(DispHTMLAreaElement) \ 102 XDIID(DispHTMLAttributeCollection) \ 103 XDIID(DispHTMLBody) \ 104 XDIID(DispHTMLButtonElement) \ 105 XDIID(DispHTMLCommentElement) \ 106 XDIID(DispHTMLCurrentStyle) \ 107 XDIID(DispHTMLDocument) \ 108 XDIID(DispHTMLDOMAttribute) \ 109 XDIID(DispHTMLDOMTextNode) \ 110 XDIID(DispHTMLElementCollection) \ 111 XDIID(DispHTMLEmbed) \ 112 XDIID(DispHTMLFormElement) \ 113 XDIID(DispHTMLGenericElement) \ 114 XDIID(DispHTMLFrameElement) \ 115 XDIID(DispHTMLHeadElement) \ 116 XDIID(DispHTMLHistory) \ 117 XDIID(DispHTMLIFrame) \ 118 XDIID(DispHTMLImg) \ 119 XDIID(DispHTMLInputElement) \ 120 XDIID(DispHTMLLabelElement) \ 121 XDIID(DispHTMLLinkElement) \ 122 XDIID(DispHTMLLocation) \ 123 XDIID(DispHTMLMetaElement) \ 124 XDIID(DispHTMLNavigator) \ 125 XDIID(DispHTMLObjectElement) \ 126 XDIID(DispHTMLOptionElement) \ 127 XDIID(DispHTMLScreen) \ 128 XDIID(DispHTMLScriptElement) \ 129 XDIID(DispHTMLSelectElement) \ 130 XDIID(DispHTMLStyle) \ 131 XDIID(DispHTMLStyleElement) \ 132 XDIID(DispHTMLStyleSheet) \ 133 XDIID(DispHTMLStyleSheetRulesCollection) \ 134 XDIID(DispHTMLStyleSheetsCollection) \ 135 XDIID(DispHTMLTable) \ 136 XDIID(DispHTMLTableCell) \ 137 XDIID(DispHTMLTableRow) \ 138 XDIID(DispHTMLTextAreaElement) \ 139 XDIID(DispHTMLTitleElement) \ 140 XDIID(DispHTMLUnknownElement) \ 141 XDIID(DispHTMLWindow2) \ 142 XDIID(DispHTMLXMLHttpRequest) \ 143 XDIID(HTMLDocumentEvents) \ 144 XDIID(HTMLElementEvents2) \ 145 XIID(IHTMLAnchorElement) \ 146 XIID(IHTMLAreaElement) \ 147 XIID(IHTMLAttributeCollection) \ 148 XIID(IHTMLAttributeCollection2) \ 149 XIID(IHTMLAttributeCollection3) \ 150 XIID(IHTMLBodyElement) \ 151 XIID(IHTMLBodyElement2) \ 152 XIID(IHTMLButtonElement) \ 153 XIID(IHTMLCommentElement) \ 154 XIID(IHTMLCurrentStyle) \ 155 XIID(IHTMLCurrentStyle2) \ 156 XIID(IHTMLCurrentStyle3) \ 157 XIID(IHTMLCurrentStyle4) \ 158 XIID(IHTMLDocument2) \ 159 XIID(IHTMLDocument3) \ 160 XIID(IHTMLDocument4) \ 161 XIID(IHTMLDocument5) \ 162 XIID(IHTMLDOMAttribute) \ 163 XIID(IHTMLDOMAttribute2) \ 164 XIID(IHTMLDOMChildrenCollection) \ 165 XIID(IHTMLDOMImplementation) \ 166 XIID(IHTMLDOMNode) \ 167 XIID(IHTMLDOMNode2) \ 168 XIID(IHTMLDOMTextNode) \ 169 XIID(IHTMLDOMTextNode2) \ 170 XIID(IHTMLElement) \ 171 XIID(IHTMLElement2) \ 172 XIID(IHTMLElement3) \ 173 XIID(IHTMLElement4) \ 174 XIID(IHTMLElementCollection) \ 175 XIID(IHTMLEmbedElement) \ 176 XIID(IHTMLEventObj) \ 177 XIID(IHTMLFiltersCollection) \ 178 XIID(IHTMLFormElement) \ 179 XIID(IHTMLFrameBase) \ 180 XIID(IHTMLFrameBase2) \ 181 XIID(IHTMLFrameElement3) \ 182 XIID(IHTMLGenericElement) \ 183 XIID(IHTMLHeadElement) \ 184 XIID(IHTMLIFrameElement) \ 185 XIID(IHTMLIFrameElement2) \ 186 XIID(IHTMLIFrameElement3) \ 187 XIID(IHTMLImageElementFactory) \ 188 XIID(IHTMLImgElement) \ 189 XIID(IHTMLInputElement) \ 190 XIID(IHTMLLabelElement) \ 191 XIID(IHTMLLinkElement) \ 192 XIID(IHTMLLocation) \ 193 XIID(IHTMLMetaElement) \ 194 XIID(IHTMLMimeTypesCollection) \ 195 XIID(IHTMLObjectElement) \ 196 XIID(IHTMLObjectElement2) \ 197 XIID(IHTMLOptionElement) \ 198 XIID(IHTMLOptionElementFactory) \ 199 XIID(IHTMLPluginsCollection) \ 200 XIID(IHTMLRect) \ 201 XIID(IHTMLScreen) \ 202 XIID(IHTMLScriptElement) \ 203 XIID(IHTMLSelectElement) \ 204 XIID(IHTMLSelectionObject) \ 205 XIID(IHTMLSelectionObject2) \ 206 XIID(IHTMLStorage) \ 207 XIID(IHTMLStyle) \ 208 XIID(IHTMLStyle2) \ 209 XIID(IHTMLStyle3) \ 210 XIID(IHTMLStyle4) \ 211 XIID(IHTMLStyle5) \ 212 XIID(IHTMLStyle6) \ 213 XIID(IHTMLStyleElement) \ 214 XIID(IHTMLStyleSheet) \ 215 XIID(IHTMLStyleSheetRulesCollection) \ 216 XIID(IHTMLStyleSheetsCollection) \ 217 XIID(IHTMLTable) \ 218 XIID(IHTMLTable2) \ 219 XIID(IHTMLTable3) \ 220 XIID(IHTMLTableCell) \ 221 XIID(IHTMLTableRow) \ 222 XIID(IHTMLTextAreaElement) \ 223 XIID(IHTMLTextContainer) \ 224 XIID(IHTMLTitleElement) \ 225 XIID(IHTMLTxtRange) \ 226 XIID(IHTMLUniqueName) \ 227 XIID(IHTMLWindow2) \ 228 XIID(IHTMLWindow3) \ 229 XIID(IHTMLWindow4) \ 230 XIID(IHTMLWindow5) \ 231 XIID(IHTMLWindow6) \ 232 XIID(IHTMLXMLHttpRequest) \ 233 XIID(IHTMLXMLHttpRequestFactory) \ 234 XIID(IOmHistory) \ 235 XIID(IOmNavigator) 236 237 typedef enum { 238 #define XIID(iface) iface ## _tid, 239 #define XDIID(iface) iface ## _tid, 240 TID_LIST 241 #undef XIID 242 #undef XDIID 243 LAST_tid 244 } tid_t; 245 246 typedef struct dispex_data_t dispex_data_t; 247 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t; 248 249 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000 250 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff 251 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN) 252 253 typedef struct DispatchEx DispatchEx; 254 255 typedef struct { 256 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); 257 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*); 258 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); 259 HRESULT (*populate_props)(DispatchEx*); 260 /* We abuse this vtbl for EventTarget functions to avoid separated vtbl. */ 261 event_target_t **(*get_event_target_ptr)(DispatchEx*); 262 void (*bind_event)(DispatchEx*,int); 263 } dispex_static_data_vtbl_t; 264 265 typedef struct { 266 const dispex_static_data_vtbl_t *vtbl; 267 const tid_t disp_tid; 268 dispex_data_t *data; 269 const tid_t* const iface_tids; 270 } dispex_static_data_t; 271 272 struct DispatchEx { 273 IDispatchEx IDispatchEx_iface; 274 275 IUnknown *outer; 276 277 dispex_static_data_t *data; 278 dispex_dynamic_data_t *dynamic_data; 279 }; 280 281 typedef struct { 282 UINT_PTR x; 283 } nsCycleCollectingAutoRefCnt; 284 285 typedef struct { 286 void *vtbl; 287 int ref_flags; 288 void *callbacks; 289 } ExternalCycleCollectionParticipant; 290 291 typedef struct nsCycleCollectionTraversalCallback nsCycleCollectionTraversalCallback; 292 293 typedef struct { 294 nsresult (NSAPI *traverse)(void*,void*,nsCycleCollectionTraversalCallback*); 295 nsresult (NSAPI *unlink)(void*); 296 void (NSAPI *delete_cycle_collectable)(void*); 297 } CCObjCallback; 298 299 DEFINE_GUID(IID_nsXPCOMCycleCollectionParticipant, 0x9674489b,0x1f6f,0x4550,0xa7,0x30, 0xcc,0xae,0xdd,0x10,0x4c,0xf9); 300 301 nsrefcnt (__cdecl *ccref_incr)(nsCycleCollectingAutoRefCnt*,nsISupports*) DECLSPEC_HIDDEN; 302 nsrefcnt (__cdecl *ccref_decr)(nsCycleCollectingAutoRefCnt*,nsISupports*,ExternalCycleCollectionParticipant*) DECLSPEC_HIDDEN; 303 void (__cdecl *ccref_init)(nsCycleCollectingAutoRefCnt*,nsrefcnt) DECLSPEC_HIDDEN; 304 void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback*) DECLSPEC_HIDDEN; 305 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN; 306 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN; 307 308 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN; 309 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN; 310 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN; 311 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN; 312 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN; 313 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN; 314 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN; 315 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN; 316 void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN; 317 void release_typelib(void) DECLSPEC_HIDDEN; 318 HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN; 319 320 typedef enum { 321 DISPEXPROP_CUSTOM, 322 DISPEXPROP_DYNAMIC, 323 DISPEXPROP_BUILTIN 324 } dispex_prop_type_t; 325 326 dispex_prop_type_t get_dispid_type(DISPID) DECLSPEC_HIDDEN; 327 328 typedef struct HTMLWindow HTMLWindow; 329 typedef struct HTMLInnerWindow HTMLInnerWindow; 330 typedef struct HTMLOuterWindow HTMLOuterWindow; 331 typedef struct HTMLDocumentNode HTMLDocumentNode; 332 typedef struct HTMLDocumentObj HTMLDocumentObj; 333 typedef struct HTMLFrameBase HTMLFrameBase; 334 typedef struct NSContainer NSContainer; 335 typedef struct HTMLAttributeCollection HTMLAttributeCollection; 336 337 typedef enum { 338 SCRIPTMODE_GECKO, 339 SCRIPTMODE_ACTIVESCRIPT 340 } SCRIPTMODE; 341 342 typedef struct ScriptHost ScriptHost; 343 344 typedef enum { 345 GLOBAL_SCRIPTVAR, 346 GLOBAL_ELEMENTVAR, 347 GLOBAL_DISPEXVAR, 348 GLOBAL_FRAMEVAR 349 } global_prop_type_t; 350 351 typedef struct { 352 global_prop_type_t type; 353 WCHAR *name; 354 ScriptHost *script_host; 355 DISPID id; 356 } global_prop_t; 357 358 typedef struct { 359 DispatchEx dispex; 360 event_target_t *ptr; 361 } EventTarget; 362 363 typedef struct { 364 DispatchEx dispex; 365 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface; 366 367 LONG ref; 368 369 HTMLInnerWindow *window; 370 } HTMLOptionElementFactory; 371 372 typedef struct { 373 DispatchEx dispex; 374 IHTMLImageElementFactory IHTMLImageElementFactory_iface; 375 376 LONG ref; 377 378 HTMLInnerWindow *window; 379 } HTMLImageElementFactory; 380 381 typedef struct { 382 DispatchEx dispex; 383 IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface; 384 385 LONG ref; 386 387 HTMLInnerWindow *window; 388 } HTMLXMLHttpRequestFactory; 389 390 struct HTMLLocation { 391 DispatchEx dispex; 392 IHTMLLocation IHTMLLocation_iface; 393 394 LONG ref; 395 396 HTMLInnerWindow *window; 397 }; 398 399 typedef struct { 400 DispatchEx dispex; 401 IOmHistory IOmHistory_iface; 402 403 LONG ref; 404 405 HTMLInnerWindow *window; 406 } OmHistory; 407 408 typedef struct { 409 HTMLOuterWindow *window; 410 LONG ref; 411 } windowref_t; 412 413 typedef struct nsChannelBSC nsChannelBSC; 414 415 struct HTMLWindow { 416 IHTMLWindow2 IHTMLWindow2_iface; 417 IHTMLWindow3 IHTMLWindow3_iface; 418 IHTMLWindow4 IHTMLWindow4_iface; 419 IHTMLWindow5 IHTMLWindow5_iface; 420 IHTMLWindow6 IHTMLWindow6_iface; 421 IHTMLPrivateWindow IHTMLPrivateWindow_iface; 422 IDispatchEx IDispatchEx_iface; 423 IServiceProvider IServiceProvider_iface; 424 ITravelLogClient ITravelLogClient_iface; 425 IObjectIdentity IObjectIdentity_iface; 426 427 LONG ref; 428 429 HTMLInnerWindow *inner_window; 430 HTMLOuterWindow *outer_window; 431 }; 432 433 struct HTMLOuterWindow { 434 HTMLWindow base; 435 436 windowref_t *window_ref; 437 LONG task_magic; 438 439 HTMLDocumentObj *doc_obj; 440 nsIDOMWindow *nswindow; 441 HTMLOuterWindow *parent; 442 HTMLFrameBase *frame_element; 443 444 READYSTATE readystate; 445 BOOL readystate_locked; 446 unsigned readystate_pending; 447 448 HTMLInnerWindow *pending_window; 449 IMoniker *mon; 450 IUri *uri; 451 IUri *uri_nofrag; 452 BSTR url; 453 DWORD load_flags; 454 455 SCRIPTMODE scriptmode; 456 457 IInternetSecurityManager *secmgr; 458 459 struct list children; 460 struct list sibling_entry; 461 struct list entry; 462 }; 463 464 struct HTMLInnerWindow { 465 HTMLWindow base; 466 EventTarget event_target; 467 468 HTMLDocumentNode *doc; 469 470 struct list script_hosts; 471 472 IHTMLEventObj *event; 473 474 HTMLImageElementFactory *image_factory; 475 HTMLOptionElementFactory *option_factory; 476 HTMLXMLHttpRequestFactory *xhr_factory; 477 IHTMLScreen *screen; 478 OmHistory *history; 479 IHTMLStorage *session_storage; 480 481 unsigned parser_callback_cnt; 482 struct list script_queue; 483 484 global_prop_t *global_props; 485 DWORD global_prop_cnt; 486 DWORD global_prop_size; 487 488 LONG task_magic; 489 490 HTMLLocation *location; 491 492 IMoniker *mon; 493 nsChannelBSC *bscallback; 494 struct list bindings; 495 }; 496 497 typedef enum { 498 UNKNOWN_USERMODE, 499 BROWSEMODE, 500 EDITMODE 501 } USERMODE; 502 503 typedef struct _cp_static_data_t { 504 tid_t tid; 505 void (*on_advise)(IUnknown*,struct _cp_static_data_t*); 506 BOOL pass_event_arg; 507 DWORD id_cnt; 508 DISPID *ids; 509 } cp_static_data_t; 510 511 typedef struct { 512 const IID *riid; 513 cp_static_data_t *desc; 514 } cpc_entry_t; 515 516 typedef struct ConnectionPointContainer { 517 IConnectionPointContainer IConnectionPointContainer_iface; 518 519 ConnectionPoint *cps; 520 const cpc_entry_t *cp_entries; 521 IUnknown *outer; 522 struct ConnectionPointContainer *forward_container; 523 } ConnectionPointContainer; 524 525 struct ConnectionPoint { 526 IConnectionPoint IConnectionPoint_iface; 527 528 ConnectionPointContainer *container; 529 530 union { 531 IUnknown *unk; 532 IDispatch *disp; 533 IPropertyNotifySink *propnotif; 534 } *sinks; 535 DWORD sinks_size; 536 537 const IID *iid; 538 cp_static_data_t *data; 539 }; 540 541 struct HTMLDocument { 542 IHTMLDocument2 IHTMLDocument2_iface; 543 IHTMLDocument3 IHTMLDocument3_iface; 544 IHTMLDocument4 IHTMLDocument4_iface; 545 IHTMLDocument5 IHTMLDocument5_iface; 546 IHTMLDocument6 IHTMLDocument6_iface; 547 IHTMLDocument7 IHTMLDocument7_iface; 548 IPersistMoniker IPersistMoniker_iface; 549 IPersistFile IPersistFile_iface; 550 IPersistHistory IPersistHistory_iface; 551 IMonikerProp IMonikerProp_iface; 552 IOleObject IOleObject_iface; 553 IOleDocument IOleDocument_iface; 554 IOleDocumentView IOleDocumentView_iface; 555 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface; 556 IViewObjectEx IViewObjectEx_iface; 557 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface; 558 IServiceProvider IServiceProvider_iface; 559 IOleCommandTarget IOleCommandTarget_iface; 560 IOleControl IOleControl_iface; 561 IHlinkTarget IHlinkTarget_iface; 562 IPersistStreamInit IPersistStreamInit_iface; 563 IDispatchEx IDispatchEx_iface; 564 ISupportErrorInfo ISupportErrorInfo_iface; 565 IObjectWithSite IObjectWithSite_iface; 566 IOleContainer IOleContainer_iface; 567 IObjectSafety IObjectSafety_iface; 568 IProvideClassInfo IProvideClassInfo_iface; 569 570 IUnknown *unk_impl; 571 IDispatchEx *dispex; 572 573 HTMLDocumentObj *doc_obj; 574 HTMLDocumentNode *doc_node; 575 576 HTMLOuterWindow *window; 577 578 LONG task_magic; 579 580 ConnectionPointContainer cp_container; 581 IOleAdviseHolder *advise_holder; 582 }; 583 584 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv) 585 { 586 return IUnknown_QueryInterface(This->unk_impl, riid, ppv); 587 } 588 589 static inline ULONG htmldoc_addref(HTMLDocument *This) 590 { 591 return IUnknown_AddRef(This->unk_impl); 592 } 593 594 static inline ULONG htmldoc_release(HTMLDocument *This) 595 { 596 return IUnknown_Release(This->unk_impl); 597 } 598 599 struct HTMLDocumentObj { 600 HTMLDocument basedoc; 601 DispatchEx dispex; 602 ICustomDoc ICustomDoc_iface; 603 ITargetContainer ITargetContainer_iface; 604 605 IWindowForBindingUI IWindowForBindingUI_iface; 606 607 LONG ref; 608 609 NSContainer *nscontainer; 610 611 IOleClientSite *client; 612 IDocHostUIHandler *hostui; 613 IOleCommandTarget *client_cmdtrg; 614 BOOL custom_hostui; 615 IOleInPlaceSite *ipsite; 616 IOleInPlaceFrame *frame; 617 IOleInPlaceUIWindow *ip_window; 618 IAdviseSink *view_sink; 619 IDocObjectService *doc_object_service; 620 IUnknown *webbrowser; 621 ITravelLog *travel_log; 622 IUnknown *browser_service; 623 624 DOCHOSTUIINFO hostinfo; 625 626 IOleUndoManager *undomgr; 627 IHTMLEditServices *editsvcs; 628 629 HWND hwnd; 630 HWND tooltips_hwnd; 631 632 BOOL request_uiactivate; 633 BOOL in_place_active; 634 BOOL ui_active; 635 BOOL window_active; 636 BOOL hostui_setup; 637 BOOL container_locked; 638 BOOL focus; 639 BOOL has_popup; 640 INT download_state; 641 642 USERMODE usermode; 643 LPWSTR mime; 644 645 DWORD update; 646 }; 647 648 typedef struct nsWeakReference nsWeakReference; 649 650 struct NSContainer { 651 nsIWebBrowserChrome nsIWebBrowserChrome_iface; 652 nsIContextMenuListener nsIContextMenuListener_iface; 653 nsIURIContentListener nsIURIContentListener_iface; 654 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface; 655 nsITooltipListener nsITooltipListener_iface; 656 nsIInterfaceRequestor nsIInterfaceRequestor_iface; 657 nsISupportsWeakReference nsISupportsWeakReference_iface; 658 659 nsIWebBrowser *webbrowser; 660 nsIWebNavigation *navigation; 661 nsIBaseWindow *window; 662 nsIWebBrowserFocus *focus; 663 664 nsIEditor *editor; 665 nsIController *editor_controller; 666 667 LONG ref; 668 669 nsWeakReference *weak_reference; 670 671 NSContainer *parent; 672 HTMLDocumentObj *doc; 673 674 nsIURIContentListener *content_listener; 675 676 HWND hwnd; 677 }; 678 679 typedef struct { 680 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**); 681 void (*destructor)(HTMLDOMNode*); 682 const cpc_entry_t *cpc_entries; 683 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**); 684 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*); 685 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**); 686 event_target_t **(*get_event_target_ptr)(HTMLDOMNode*); 687 HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*); 688 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL); 689 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*); 690 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**); 691 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*); 692 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*); 693 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); 694 HRESULT (*bind_to_tree)(HTMLDOMNode*); 695 void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*); 696 void (*unlink)(HTMLDOMNode*); 697 BOOL (*is_text_edit)(HTMLDOMNode*); 698 } NodeImplVtbl; 699 700 struct HTMLDOMNode { 701 EventTarget event_target; 702 IHTMLDOMNode IHTMLDOMNode_iface; 703 IHTMLDOMNode2 IHTMLDOMNode2_iface; 704 const NodeImplVtbl *vtbl; 705 706 nsCycleCollectingAutoRefCnt ccref; 707 708 nsIDOMNode *nsnode; 709 HTMLDocumentNode *doc; 710 ConnectionPointContainer *cp_container; 711 }; 712 713 static inline void node_addref(HTMLDOMNode *node) 714 { 715 IHTMLDOMNode_AddRef(&node->IHTMLDOMNode_iface); 716 } 717 718 static inline void node_release(HTMLDOMNode *node) 719 { 720 IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface); 721 } 722 723 typedef struct { 724 HTMLDOMNode node; 725 ConnectionPointContainer cp_container; 726 727 IHTMLElement IHTMLElement_iface; 728 IHTMLElement2 IHTMLElement2_iface; 729 IHTMLElement3 IHTMLElement3_iface; 730 IHTMLElement4 IHTMLElement4_iface; 731 732 nsIDOMHTMLElement *nselem; 733 HTMLStyle *style; 734 HTMLStyle *runtime_style; 735 HTMLAttributeCollection *attrs; 736 WCHAR *filter; 737 } HTMLElement; 738 739 #define HTMLELEMENT_TIDS \ 740 IHTMLDOMNode_tid, \ 741 IHTMLDOMNode2_tid, \ 742 IHTMLElement_tid, \ 743 IHTMLElement2_tid, \ 744 IHTMLElement3_tid, \ 745 IHTMLElement4_tid 746 747 extern cp_static_data_t HTMLElementEvents2_data DECLSPEC_HIDDEN; 748 #define HTMLELEMENT_CPC {&DIID_HTMLElementEvents2, &HTMLElementEvents2_data} 749 extern const cpc_entry_t HTMLElement_cpc[] DECLSPEC_HIDDEN; 750 751 typedef struct { 752 HTMLElement element; 753 754 IHTMLTextContainer IHTMLTextContainer_iface; 755 } HTMLTextContainer; 756 757 struct HTMLFrameBase { 758 HTMLElement element; 759 760 IHTMLFrameBase IHTMLFrameBase_iface; 761 IHTMLFrameBase2 IHTMLFrameBase2_iface; 762 763 HTMLOuterWindow *content_window; 764 765 nsIDOMHTMLFrameElement *nsframe; 766 nsIDOMHTMLIFrameElement *nsiframe; 767 }; 768 769 typedef struct nsDocumentEventListener nsDocumentEventListener; 770 771 struct HTMLDocumentNode { 772 HTMLDOMNode node; 773 HTMLDocument basedoc; 774 775 IInternetHostSecurityManager IInternetHostSecurityManager_iface; 776 777 nsIDocumentObserver nsIDocumentObserver_iface; 778 779 LONG ref; 780 781 HTMLInnerWindow *window; 782 783 nsIDOMHTMLDocument *nsdoc; 784 BOOL content_ready; 785 event_target_t *body_event_target; 786 787 IHTMLDOMImplementation *dom_implementation; 788 789 ICatInformation *catmgr; 790 nsDocumentEventListener *nsevent_listener; 791 BOOL *event_vector; 792 793 WCHAR **elem_vars; 794 unsigned elem_vars_size; 795 unsigned elem_vars_cnt; 796 797 BOOL skip_mutation_notif; 798 799 UINT charset; 800 801 struct list selection_list; 802 struct list range_list; 803 struct list plugin_hosts; 804 }; 805 806 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; 807 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; 808 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLInnerWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN; 809 810 HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN; 811 HRESULT update_window_doc(HTMLInnerWindow*) DECLSPEC_HIDDEN; 812 HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN; 813 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN; 814 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN; 815 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN; 816 HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN; 817 HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN; 818 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN; 819 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN; 820 HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN; 821 HRESULT create_dom_implementation(IHTMLDOMImplementation**) DECLSPEC_HIDDEN; 822 823 HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN; 824 825 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN; 826 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN; 827 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN; 828 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN; 829 void HTMLDocument_Window_Init(HTMLDocument*) DECLSPEC_HIDDEN; 830 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN; 831 void HTMLDocument_Hlink_Init(HTMLDocument*) DECLSPEC_HIDDEN; 832 833 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN; 834 void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN; 835 836 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN; 837 838 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN; 839 840 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN; 841 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN; 842 843 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN; 844 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN; 845 846 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN; 847 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN; 848 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN; 849 JSContext *get_context_from_document(nsIDOMHTMLDocument*) DECLSPEC_HIDDEN; 850 851 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN; 852 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN; 853 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN; 854 855 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN; 856 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN; 857 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN; 858 859 UINT get_document_charset(HTMLDocumentNode*) DECLSPEC_HIDDEN; 860 861 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN; 862 863 BOOL load_gecko(void) DECLSPEC_HIDDEN; 864 void close_gecko(void) DECLSPEC_HIDDEN; 865 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN; 866 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*) DECLSPEC_HIDDEN; 867 void release_nsio(void) DECLSPEC_HIDDEN; 868 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN; 869 void set_viewer_zoom(NSContainer*,float) DECLSPEC_HIDDEN; 870 871 void init_node_cc(void) DECLSPEC_HIDDEN; 872 873 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN; 874 875 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN; 876 877 void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN; 878 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN; 879 880 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN; 881 void nsfree(void*) DECLSPEC_HIDDEN; 882 883 BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN; 884 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN; 885 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN; 886 UINT32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN; 887 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN; 888 889 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN; 890 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN; 891 UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN; 892 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN; 893 894 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN; 895 896 static inline HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p) 897 { 898 V_VT(p) = VT_BSTR; 899 return return_nsstr(nsres, nsstr, &V_BSTR(p)); 900 } 901 902 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN; 903 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN; 904 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN; 905 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN; 906 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN; 907 nsIXMLHttpRequest *create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN; 908 nsresult create_nsfile(const PRUnichar*,nsIFile**) DECLSPEC_HIDDEN; 909 char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN; 910 911 HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN; 912 HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN; 913 HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN; 914 void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN; 915 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN; 916 void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN; 917 918 void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN; 919 HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN; 920 921 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN; 922 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN; 923 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN; 924 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN; 925 926 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN; 927 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN; 928 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN; 929 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN; 930 931 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN; 932 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN; 933 934 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN; 935 936 BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN; 937 HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN; 938 939 940 struct HTMLAttributeCollection { 941 DispatchEx dispex; 942 IHTMLAttributeCollection IHTMLAttributeCollection_iface; 943 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface; 944 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface; 945 946 LONG ref; 947 948 HTMLElement *elem; 949 struct list attrs; 950 }; 951 952 typedef struct { 953 DispatchEx dispex; 954 IHTMLDOMAttribute IHTMLDOMAttribute_iface; 955 IHTMLDOMAttribute2 IHTMLDOMAttribute2_iface; 956 957 LONG ref; 958 959 WCHAR *name; 960 961 HTMLElement *elem; 962 DISPID dispid; 963 struct list entry; 964 } HTMLDOMAttribute; 965 966 HRESULT HTMLDOMAttribute_Create(const WCHAR*,HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN; 967 968 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN; 969 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN; 970 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 971 HRESULT HTMLAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 972 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 973 HRESULT HTMLButtonElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 974 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 975 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 976 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 977 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 978 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 979 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 980 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 981 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 982 HRESULT HTMLLabelElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 983 HRESULT HTMLLinkElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 984 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 985 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 986 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 987 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 988 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 989 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 990 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 991 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 992 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 993 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 994 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN; 995 996 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*) DECLSPEC_HIDDEN; 997 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN; 998 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN; 999 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN; 1000 1001 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN; 1002 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN; 1003 1004 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN; 1005 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN; 1006 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN; 1007 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN; 1008 HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN; 1009 1010 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN; 1011 void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN; 1012 1013 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN; 1014 HRESULT get_elem(HTMLDocumentNode*,nsIDOMElement*,HTMLElement**) DECLSPEC_HIDDEN; 1015 1016 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN; 1017 1018 HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN; 1019 HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN; 1020 HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN; 1021 HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN; 1022 HRESULT handle_link_click_event(HTMLElement*,nsAString*,nsAString*,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN; 1023 1024 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN; 1025 1026 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN; 1027 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,nsIDOMNodeList*) DECLSPEC_HIDDEN; 1028 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN; 1029 1030 #define ATTRFLAG_CASESENSITIVE 0x0001 1031 #define ATTRFLAG_ASSTRING 0x0002 1032 #define ATTRFLAG_EXPANDURL 0x0004 1033 1034 HRESULT get_elem_attr_value_by_dispid(HTMLElement*,DISPID,DWORD,VARIANT*) DECLSPEC_HIDDEN; 1035 HRESULT get_elem_source_index(HTMLElement*,LONG*) DECLSPEC_HIDDEN; 1036 1037 nsresult get_elem_attr_value(nsIDOMHTMLElement*,const WCHAR*,nsAString*,const PRUnichar**) DECLSPEC_HIDDEN; 1038 HRESULT elem_string_attr_getter(HTMLElement*,const WCHAR*,BOOL,BSTR*) DECLSPEC_HIDDEN; 1039 HRESULT elem_string_attr_setter(HTMLElement*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN; 1040 1041 /* commands */ 1042 typedef struct { 1043 DWORD id; 1044 HRESULT (*query)(HTMLDocument*,OLECMD*); 1045 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*); 1046 } cmdtable_t; 1047 1048 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN; 1049 1050 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN; 1051 1052 /* timer */ 1053 #define UPDATE_UI 0x0001 1054 #define UPDATE_TITLE 0x0002 1055 1056 void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN; 1057 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN; 1058 void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN; 1059 1060 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN; 1061 1062 /* editor */ 1063 HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN; 1064 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN; 1065 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN; 1066 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN; 1067 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN; 1068 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN; 1069 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN; 1070 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN; 1071 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN; 1072 1073 extern DWORD mshtml_tls DECLSPEC_HIDDEN; 1074 1075 typedef struct task_t task_t; 1076 typedef void (*task_proc_t)(task_t*); 1077 1078 struct task_t { 1079 LONG target_magic; 1080 task_proc_t proc; 1081 task_proc_t destr; 1082 struct list entry; 1083 }; 1084 1085 typedef struct { 1086 task_t header; 1087 HTMLDocumentObj *doc; 1088 } docobj_task_t; 1089 1090 typedef struct { 1091 HWND thread_hwnd; 1092 struct list task_list; 1093 struct list timer_list; 1094 } thread_data_t; 1095 1096 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN; 1097 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN; 1098 1099 LONG get_task_target_magic(void) DECLSPEC_HIDDEN; 1100 HRESULT push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN; 1101 void remove_target_tasks(LONG) DECLSPEC_HIDDEN; 1102 void flush_pending_tasks(LONG) DECLSPEC_HIDDEN; 1103 1104 HRESULT set_task_timer(HTMLInnerWindow*,DWORD,BOOL,IDispatch*,LONG*) DECLSPEC_HIDDEN; 1105 HRESULT clear_task_timer(HTMLInnerWindow*,BOOL,DWORD) DECLSPEC_HIDDEN; 1106 1107 const char *debugstr_mshtml_guid(const GUID*) DECLSPEC_HIDDEN; 1108 1109 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B); 1110 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B); 1111 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B); 1112 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B); 1113 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82); 1114 1115 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b); 1116 1117 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0); 1118 1119 DEFINE_GUID(CLSID_JScript, 0xf414c260,0x6ac0,0x11cf, 0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58); 1120 DEFINE_GUID(CLSID_VBScript, 0xb54f3741,0x5b07,0x11cf, 0xa4,0xb0,0x00,0xaa,0x00,0x4a,0x55,0xe8); 1121 1122 DEFINE_GUID(IID_UndocumentedScriptIface,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0); 1123 DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6); 1124 1125 /* memory allocation functions */ 1126 1127 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len) 1128 { 1129 return HeapAlloc(GetProcessHeap(), 0, len); 1130 } 1131 1132 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len) 1133 { 1134 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); 1135 } 1136 1137 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len) 1138 { 1139 return HeapReAlloc(GetProcessHeap(), 0, mem, len); 1140 } 1141 1142 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len) 1143 { 1144 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len); 1145 } 1146 1147 static inline BOOL heap_free(void *mem) 1148 { 1149 return HeapFree(GetProcessHeap(), 0, mem); 1150 } 1151 1152 static inline LPWSTR heap_strdupW(LPCWSTR str) 1153 { 1154 LPWSTR ret = NULL; 1155 1156 if(str) { 1157 DWORD size; 1158 1159 size = (strlenW(str)+1)*sizeof(WCHAR); 1160 ret = heap_alloc(size); 1161 if(ret) 1162 memcpy(ret, str, size); 1163 } 1164 1165 return ret; 1166 } 1167 1168 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len) 1169 { 1170 LPWSTR ret = NULL; 1171 1172 if(str) { 1173 ret = heap_alloc((len+1)*sizeof(WCHAR)); 1174 if(ret) 1175 { 1176 memcpy(ret, str, len*sizeof(WCHAR)); 1177 ret[len] = 0; 1178 } 1179 } 1180 1181 return ret; 1182 } 1183 1184 static inline char *heap_strdupA(const char *str) 1185 { 1186 char *ret = NULL; 1187 1188 if(str) { 1189 DWORD size; 1190 1191 size = strlen(str)+1; 1192 ret = heap_alloc(size); 1193 if(ret) 1194 memcpy(ret, str, size); 1195 } 1196 1197 return ret; 1198 } 1199 1200 static inline WCHAR *heap_strdupAtoW(const char *str) 1201 { 1202 LPWSTR ret = NULL; 1203 1204 if(str) { 1205 DWORD len; 1206 1207 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); 1208 ret = heap_alloc(len*sizeof(WCHAR)); 1209 if(ret) 1210 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); 1211 } 1212 1213 return ret; 1214 } 1215 1216 static inline char *heap_strdupWtoA(LPCWSTR str) 1217 { 1218 char *ret = NULL; 1219 1220 if(str) { 1221 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL); 1222 ret = heap_alloc(size); 1223 if(ret) 1224 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL); 1225 } 1226 1227 return ret; 1228 } 1229 1230 static inline WCHAR *heap_strdupUtoW(const char *str) 1231 { 1232 WCHAR *ret = NULL; 1233 1234 if(str) { 1235 size_t len; 1236 1237 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); 1238 ret = heap_alloc(len*sizeof(WCHAR)); 1239 if(ret) 1240 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len); 1241 } 1242 1243 return ret; 1244 } 1245 1246 static inline char *heap_strdupWtoU(const WCHAR *str) 1247 { 1248 char *ret = NULL; 1249 1250 if(str) { 1251 size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL); 1252 ret = heap_alloc(size); 1253 if(ret) 1254 WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL); 1255 } 1256 1257 return ret; 1258 } 1259 1260 static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len) 1261 { 1262 char *ret = NULL; 1263 DWORD size; 1264 1265 if(str && len) { 1266 size = WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL); 1267 ret = heap_alloc(size + 1); 1268 if(ret) { 1269 WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL); 1270 ret[size] = '\0'; 1271 } 1272 } 1273 1274 return ret; 1275 } 1276 1277 static inline void windowref_addref(windowref_t *ref) 1278 { 1279 InterlockedIncrement(&ref->ref); 1280 } 1281 1282 static inline void windowref_release(windowref_t *ref) 1283 { 1284 if(!InterlockedDecrement(&ref->ref)) 1285 heap_free(ref); 1286 } 1287 1288 UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN; 1289 HDC get_display_dc(void) DECLSPEC_HIDDEN; 1290 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN; 1291 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN; 1292 1293 extern HINSTANCE hInst DECLSPEC_HIDDEN; 1294 1295 #include "binding.h" 1296 #include "htmlevent.h" 1297 #include "htmlscript.h" 1298 #include "htmlstyle.h" 1299 #include "pluginhost.h" 1300 #include "resource.h" 1301 1302 #endif /* _MSHTML_PRIVATE_H_ */ 1303