Module: wine Branch: master Commit: 593e897655d8085846180537cafbf0c032886d43 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=593e897655d8085846180537...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Aug 22 16:15:09 2006 +0200
mshtml: Use IPropertyNotifySink connection point.
---
dlls/mshtml/conpoint.c | 10 +++++++ dlls/mshtml/mshtml_private.h | 2 + dlls/mshtml/olecmd.c | 2 + dlls/mshtml/persist.c | 2 + dlls/mshtml/tests/htmldoc.c | 64 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 0 deletions(-)
diff --git a/dlls/mshtml/conpoint.c b/dlls/mshtml/conpoint.c index db66160..9b82051 100644 --- a/dlls/mshtml/conpoint.c +++ b/dlls/mshtml/conpoint.c @@ -51,6 +51,16 @@ struct ConnectionPoint { IID iid; };
+void call_property_onchanged(ConnectionPoint *This, DISPID dispid) +{ + DWORD i; + + for(i=0; i<This->sinks_size; i++) { + if(This->sinks[i].propnotif) + IPropertyNotifySink_OnChanged(This->sinks[i].propnotif, dispid); + } +} + #define CONPOINT_THIS(iface) DEFINE_THIS(ConnectionPoint, ConnectionPoint, iface)
static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 7abcf7e..99de822 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -298,6 +298,8 @@ void init_nsio(nsIComponentManager*,nsIC
void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
+void call_property_onchanged(ConnectionPoint*,DISPID); + void *nsalloc(size_t); void nsfree(void*);
diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c index ef0de64..72d6d98 100644 --- a/dlls/mshtml/olecmd.c +++ b/dlls/mshtml/olecmd.c @@ -397,6 +397,8 @@ static HRESULT exec_editmode(HTMLDocumen if(This->nscontainer) setup_ns_editing(This->nscontainer);
+ call_property_onchanged(This->cp_propnotif, DISPID_READYSTATE); + return S_OK; }
diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index d6a49f5..15af135 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -191,6 +191,8 @@ static HRESULT WINAPI PersistMoniker_Loa } }
+ call_property_onchanged(This->cp_propnotif, DISPID_READYSTATE); + HTMLDocument_LockContainer(This, TRUE);
hres = IMoniker_GetDisplayName(pimkName, pibc, NULL, &url); diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index 9f814bd..227ca42 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -103,6 +103,7 @@ DEFINE_EXPECT(GetDropTarget); DEFINE_EXPECT(UpdateUI); DEFINE_EXPECT(Navigate); DEFINE_EXPECT(OnFrameWindowActivate); +DEFINE_EXPECT(OnChanged_READYSTATE);
static BOOL expect_LockContainer_fLock; static BOOL expect_SetActiveObject_active; @@ -212,6 +213,56 @@ static const IHlinkFrameVtbl HlinkFrameV
static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
+static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface, + REFIID riid, void**ppv) +{ + if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) { + *ppv = iface; + return S_OK; + } + + ok(0, "unexpected call\n"); + return E_NOINTERFACE; +} + +static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface) +{ + return 2; +} + +static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface) +{ + return 1; +} + +static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID) +{ + switch(dispID) { + case DISPID_READYSTATE: + CHECK_EXPECT(OnChanged_READYSTATE); + return S_OK; + } + + ok(0, "unexpected id %ld\n", dispID); + return E_NOTIMPL; +} + +static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = { + PropertyNotifySink_QueryInterface, + PropertyNotifySink_AddRef, + PropertyNotifySink_Release, + PropertyNotifySink_OnChanged, + PropertyNotifySink_OnRequestEdit +}; + +static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl }; + static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv) { return QueryInterface(riid, ppv); @@ -1293,6 +1344,13 @@ static void test_ConnectionPoint(IConnec hres = IConnectionPoint_GetConnectionPointContainer(cp, NULL); ok(hres == E_POINTER, "GetConnectionPointContainer failed: %08lx, expected E_POINTER\n", hres);
+ if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) { + DWORD cookie; + + hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, &cookie); + ok(hres == S_OK, "Advise failed: %08lx\n", hres); + } + IConnectionPoint_Release(cp); }
@@ -1344,6 +1402,7 @@ static void test_Load(IPersistMoniker *p SET_EXPECT(Invoke_AMBIENT_SILENT); SET_EXPECT(Invoke_AMBIENT_USERAGENT); SET_EXPECT(Invoke_AMBIENT_PALETTE); + SET_EXPECT(OnChanged_READYSTATE); SET_EXPECT(GetContainer); SET_EXPECT(LockContainer); SET_EXPECT(Exec_ShellDocView_37); @@ -1367,6 +1426,7 @@ #endif CHECK_CALLED(Invoke_AMBIENT_SILENT); CHECK_CALLED(Invoke_AMBIENT_USERAGENT); CHECK_CALLED(Invoke_AMBIENT_PALETTE); + CHECK_CALLED(OnChanged_READYSTATE); CHECK_CALLED(GetContainer); CHECK_CALLED(LockContainer); CHECK_CALLED(Exec_ShellDocView_37); @@ -1624,6 +1684,7 @@ static void test_exec_editmode(IUnknown SET_EXPECT(GetHostInfo); SET_EXPECT(Invoke_AMBIENT_SILENT); SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED); + SET_EXPECT(OnChanged_READYSTATE); expect_status_text = NULL;
hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE, @@ -1635,6 +1696,7 @@ static void test_exec_editmode(IUnknown CHECK_CALLED(GetHostInfo); CHECK_CALLED(Invoke_AMBIENT_SILENT); CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED); + CHECK_CALLED(OnChanged_READYSTATE);
IOleCommandTarget_Release(cmdtrg); } @@ -2149,6 +2211,7 @@ static void test_HTMLDocument_hlink(void if(FAILED(hres)) return;
+ test_ConnectionPointContainer(unk); test_Persist(unk); test_Navigate(unk);
@@ -2185,6 +2248,7 @@ static void test_editing_mode(void) hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj); ok(hres == S_OK, "Could not get IOleObject: %08lx\n", hres);
+ test_ConnectionPointContainer(unk); test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH); test_DoVerb(oleobj);