ieframe: Send command state change notifications from history navigation handlers.

Hans Leidekker hans at codeweavers.com
Mon Oct 13 06:56:50 CDT 2014


---
 dlls/ieframe/navigate.c         | 37 +++++++++++++++++++++++++++++++++++--
 dlls/ieframe/tests/webbrowser.c |  4 ++--
 2 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/dlls/ieframe/navigate.c b/dlls/ieframe/navigate.c
index f3e0d0d..ee35e0e 100644
--- a/dlls/ieframe/navigate.c
+++ b/dlls/ieframe/navigate.c
@@ -1087,24 +1087,57 @@ static HRESULT navigate_history(DocHost *This, unsigned travellog_pos)
     return hres;
 }
 
+void on_commandstate_change(DocHost *doc_host, LONG command, VARIANT_BOOL enable)
+{
+    DISPPARAMS dispparams;
+    VARIANTARG params[2];
+
+    TRACE("command=%d enable=%d\n", command, enable);
+
+    dispparams.cArgs = 2;
+    dispparams.cNamedArgs = 0;
+    dispparams.rgdispidNamedArgs = NULL;
+    dispparams.rgvarg = params;
+
+    V_VT(params) = VT_BOOL;
+    V_BOOL(params) = enable;
+
+    V_VT(params+1) = VT_I4;
+    V_I4(params+1) = command;
+
+    call_sink(doc_host->cps.wbe2, DISPID_COMMANDSTATECHANGE, &dispparams);
+}
+
 HRESULT go_back(DocHost *This)
 {
+    HRESULT hres;
+
     if(!This->travellog.position) {
         WARN("No history available\n");
         return E_FAIL;
     }
 
-    return navigate_history(This, This->travellog.position-1);
+    hres = navigate_history(This, This->travellog.position-1);
+    if(SUCCEEDED(hres))
+        on_commandstate_change(This, CSC_NAVIGATEFORWARD, VARIANT_TRUE);
+
+    return hres;
 }
 
 HRESULT go_forward(DocHost *This)
 {
+    HRESULT hres;
+
     if(This->travellog.position >= This->travellog.length) {
         WARN("No history available\n");
         return E_FAIL;
     }
 
-    return navigate_history(This, This->travellog.position+1);
+    hres = navigate_history(This, This->travellog.position+1);
+    if(SUCCEEDED(hres))
+        on_commandstate_change(This, CSC_NAVIGATEBACK, VARIANT_TRUE);
+
+    return hres;
 }
 
 HRESULT get_location_url(DocHost *This, BSTR *ret)
diff --git a/dlls/ieframe/tests/webbrowser.c b/dlls/ieframe/tests/webbrowser.c
index fa37169..238b6de 100644
--- a/dlls/ieframe/tests/webbrowser.c
+++ b/dlls/ieframe/tests/webbrowser.c
@@ -3022,7 +3022,7 @@ static void test_go_back(IWebBrowser2 *wb, const char *back_url)
     hres = IWebBrowser2_GoBack(wb);
     ok(hres == S_OK, "GoBack failed: %08x\n", hres);
     CHECK_CALLED(Invoke_BEFORENAVIGATE2);
-    todo_wine CHECK_CALLED(Invoke_COMMANDSTATECHANGE);
+    CHECK_CALLED(Invoke_COMMANDSTATECHANGE);
     CLEAR_CALLED(Invoke_PROPERTYCHANGE); /* called by IE11 */
 }
 
@@ -3038,7 +3038,7 @@ static void test_go_forward(IWebBrowser2 *wb, const char *forward_url)
     hres = IWebBrowser2_GoForward(wb);
     ok(hres == S_OK, "GoForward failed: %08x\n", hres);
     CHECK_CALLED(Invoke_BEFORENAVIGATE2);
-    todo_wine CHECK_CALLED(Invoke_COMMANDSTATECHANGE);
+    CHECK_CALLED(Invoke_COMMANDSTATECHANGE);
 }
 
 static void test_QueryInterface(IWebBrowser2 *wb)
-- 
2.1.1





More information about the wine-patches mailing list