mshtml: Open targeted anchors in existing frames if available.

This commit is contained in:
Jacek Caban 2012-09-03 12:52:15 +02:00 committed by Alexandre Julliard
parent d3b77c4507
commit a535417443
3 changed files with 17 additions and 4 deletions

View File

@ -96,9 +96,18 @@ static HRESULT navigate_anchor(HTMLAnchorElement *This)
nsAString_Finish(&target_str);
return S_OK;
}else {
hres = navigate_anchor_window(This, target);
HTMLOuterWindow *top_window;
get_top_window(This->element.node.doc->basedoc.window, &top_window);
hres = get_frame_by_name(top_window, target, TRUE, &window);
if(FAILED(hres) || !window) {
hres = navigate_anchor_window(This, target);
nsAString_Finish(&target_str);
return hres;
}
nsAString_Finish(&target_str);
return hres;
}
}
}

View File

@ -356,7 +356,7 @@ static HRESULT get_frame_by_index(HTMLOuterWindow *This, PRUint32 index, HTMLOut
return S_OK;
}
static HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, HTMLOuterWindow **ret)
HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, BOOL deep, HTMLOuterWindow **ret)
{
nsIDOMWindowCollection *nsframes;
HTMLOuterWindow *window = NULL;
@ -399,6 +399,9 @@ static HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, HTMLO
window = window_iter;
SysFreeString(id);
if(!window && deep)
get_frame_by_name(window_iter, name, TRUE, &window);
}
nsIDOMWindowCollection_Release(nsframes);
@ -435,7 +438,7 @@ static HRESULT WINAPI HTMLWindow2_item(IHTMLWindow2 *iface, VARIANT *pvarIndex,
case VT_BSTR: {
BSTR str = V_BSTR(pvarIndex);
TRACE("Getting name %s\n", wine_dbgstr_w(str));
hres = get_frame_by_name(This->outer_window, str, &window);
hres = get_frame_by_name(This->outer_window, str, FALSE, &window);
break;
}
default:

View File

@ -906,6 +906,7 @@ void set_script_mode(HTMLOuterWindow*,SCRIPTMODE) DECLSPEC_HIDDEN;
BOOL find_global_prop(HTMLInnerWindow*,BSTR,DWORD,ScriptHost**,DISPID*) DECLSPEC_HIDDEN;
IDispatch *get_script_disp(ScriptHost*) DECLSPEC_HIDDEN;
HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN;
HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;