From 9bf516a8131391757576456c2d21190b9a87c3d3 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 14 Dec 2009 17:38:53 -0600 Subject: [PATCH] mshtml: Search content_window's properties in HTML[I]FrameBase::get_dispid. --- dlls/mshtml/htmlframebase.c | 28 ++++++++++++++++++++++++++-- dlls/mshtml/htmliframe.c | 28 ++++++++++++++++++++++++++-- dlls/mshtml/htmlwindow.c | 22 ++++++++++++++++------ dlls/mshtml/mshtml_private.h | 1 + 4 files changed, 69 insertions(+), 10 deletions(-) diff --git a/dlls/mshtml/htmlframebase.c b/dlls/mshtml/htmlframebase.c index 717429882c4..e94c8010f9e 100644 --- a/dlls/mshtml/htmlframebase.c +++ b/dlls/mshtml/htmlframebase.c @@ -597,6 +597,30 @@ static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p) return S_OK; } +static HRESULT HTMLFrameElement_get_dispid(HTMLDOMNode *iface, BSTR name, + DWORD grfdex, DISPID *pid) +{ + HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface); + + if(!This->framebase.content_window) + return DISP_E_UNKNOWNNAME; + + return search_window_props(This->framebase.content_window, name, grfdex, pid); +} + +static HRESULT HTMLFrameElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid, + WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface); + + if(!This->framebase.content_window) { + ERR("no content window to invoke on\n"); + return E_FAIL; + } + + return IDispatchEx_InvokeEx(DISPATCHEX(This->framebase.content_window), id, lcid, flags, params, res, ei, caller); +} + static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface) { HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface); @@ -626,8 +650,8 @@ static const NodeImplVtbl HTMLFrameElementImplVtbl = { NULL, HTMLFrameElement_get_document, NULL, - NULL, - NULL, + HTMLFrameElement_get_dispid, + HTMLFrameElement_invoke, HTMLFrameElement_bind_to_tree }; diff --git a/dlls/mshtml/htmliframe.c b/dlls/mshtml/htmliframe.c index ed86dd0394b..ddb32c80ab2 100644 --- a/dlls/mshtml/htmliframe.c +++ b/dlls/mshtml/htmliframe.c @@ -65,6 +65,30 @@ static HRESULT HTMLIFrame_get_document(HTMLDOMNode *iface, IDispatch **p) return S_OK; } +static HRESULT HTMLIFrame_get_dispid(HTMLDOMNode *iface, BSTR name, + DWORD grfdex, DISPID *pid) +{ + HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface); + + if(!This->framebase.content_window) + return DISP_E_UNKNOWNNAME; + + return search_window_props(This->framebase.content_window, name, grfdex, pid); +} + +static HRESULT HTMLIFrame_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid, + WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) +{ + HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface); + + if(!This->framebase.content_window) { + ERR("no content window to invoke on\n"); + return E_FAIL; + } + + return IDispatchEx_InvokeEx(DISPATCHEX(This->framebase.content_window), id, lcid, flags, params, res, ei, caller); +} + static HRESULT HTMLIFrame_get_readystate(HTMLDOMNode *iface, BSTR *p) { HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface); @@ -101,8 +125,8 @@ static const NodeImplVtbl HTMLIFrameImplVtbl = { NULL, HTMLIFrame_get_document, HTMLIFrame_get_readystate, - NULL, - NULL, + HTMLIFrame_get_dispid, + HTMLIFrame_invoke, HTMLIFrame_bind_to_tree }; diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 6bc971c917f..6db314883bd 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -1721,15 +1721,11 @@ static inline DWORD prop_to_dispid(HTMLWindow *This, global_prop_t *prop) return MSHTML_DISPID_CUSTOM_MIN + (prop-This->global_props); } -static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) +HRESULT search_window_props(HTMLWindow *This, BSTR bstrName, DWORD grfdex, DISPID *pid) { - HTMLWindow *This = DISPEX_THIS(iface); + DWORD i; ScriptHost *script_host; DISPID id; - DWORD i; - HRESULT hres; - - TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); for(i=0; i < This->global_prop_cnt; i++) { /* FIXME: case sensitivity */ @@ -1753,6 +1749,20 @@ static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, return S_OK; } + return DISP_E_UNKNOWNNAME; +} + +static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) +{ + HTMLWindow *This = DISPEX_THIS(iface); + HRESULT hres; + + TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); + + hres = search_window_props(This, bstrName, grfdex, pid); + if(hres != DISP_E_UNKNOWNNAME) + return hres; + hres = IDispatchEx_GetDispID(DISPATCHEX(&This->dispex), bstrName, grfdex, pid); if(hres != DISP_E_UNKNOWNNAME) return hres; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 1beaf550ac6..4fb4c89f6c2 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -779,6 +779,7 @@ IDispatch *script_parse_event(HTMLWindow*,LPCWSTR); void set_script_mode(HTMLWindow*,SCRIPTMODE); BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*); IDispatch *get_script_disp(ScriptHost*); +HRESULT search_window_props(HTMLWindow*,BSTR,DWORD,DISPID*); IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL); IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*); -- 2.11.4.GIT