Jacek Caban : mshtml: Open targeted anchors in existing frames if available .
Alexandre Julliard
julliard at winehq.org
Mon Sep 3 13:19:14 CDT 2012
Module: wine
Branch: master
Commit: a5354174437aca0fc4c11da8d411bd7e710c44c6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a5354174437aca0fc4c11da8d411bd7e710c44c6
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Sep 3 12:52:15 2012 +0200
mshtml: Open targeted anchors in existing frames if available.
---
dlls/mshtml/htmlanchor.c | 13 +++++++++++--
dlls/mshtml/htmlwindow.c | 7 +++++--
dlls/mshtml/mshtml_private.h | 1 +
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c
index 4575d14..d9b9417 100644
--- a/dlls/mshtml/htmlanchor.c
+++ b/dlls/mshtml/htmlanchor.c
@@ -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;
}
}
}
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index a95425a..1a12acc 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -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:
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 39b491e..2fecc12 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -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;
More information about the wine-cvs
mailing list