Jacek Caban : shdocvw: Added SetExtent and GetExtent implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 31 10:39:00 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 3d1627f673f453e95550f66c9dff2fd9555bbd8a
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=3d1627f673f453e95550f66c9dff2fd9555bbd8a

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jul 31 13:22:32 2006 +0200

shdocvw: Added SetExtent and GetExtent implementation.

---

 dlls/shdocvw/oleobject.c        |   19 +++++++++--
 dlls/shdocvw/shdocvw.h          |    1 +
 dlls/shdocvw/tests/webbrowser.c |   65 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 81 insertions(+), 4 deletions(-)

diff --git a/dlls/shdocvw/oleobject.c b/dlls/shdocvw/oleobject.c
index c50b302..cddf6bb 100644
--- a/dlls/shdocvw/oleobject.c
+++ b/dlls/shdocvw/oleobject.c
@@ -395,15 +395,23 @@ static HRESULT WINAPI OleObject_GetUserT
 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
 {
     WebBrowser *This = OLEOBJ_THIS(iface);
-    FIXME("(%p)->(%lx %p)\n", This, dwDrawAspect, psizel);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%lx %p)\n", This, dwDrawAspect, psizel);
+
+    /* Tests show that dwDrawAspect is ignored */
+    memcpy(&This->extent, psizel, sizeof(SIZEL));
+    return S_OK;
 }
 
 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
 {
     WebBrowser *This = OLEOBJ_THIS(iface);
-    FIXME("(%p)->(%lx, %p)\n", This, dwDrawAspect, psizel);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%lx, %p)\n", This, dwDrawAspect, psizel);
+
+    /* Tests show that dwDrawAspect is ignored */
+    memcpy(psizel, &This->extent, sizeof(SIZEL));
+    return S_OK;
 }
 
 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink,
@@ -808,6 +816,9 @@ void WebBrowser_OleObject_Init(WebBrowse
     memset(&This->pos_rect, 0, sizeof(RECT));
     memset(&This->clip_rect, 0, sizeof(RECT));
     memset(&This->frameinfo, 0, sizeof(OLEINPLACEFRAMEINFO));
+
+    This->extent.cx = 1323;
+    This->extent.cy = 529;
 }
 
 void WebBrowser_OleObject_Destroy(WebBrowser *This)
diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h
index 4b07323..17ac8e7 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -119,6 +119,7 @@ typedef struct {
     RECT pos_rect;
     RECT clip_rect;
     OLEINPLACEFRAMEINFO frameinfo;
+    SIZEL extent;
 
     HWND shell_embedding_hwnd;
 
diff --git a/dlls/shdocvw/tests/webbrowser.c b/dlls/shdocvw/tests/webbrowser.c
index ce9cae4..2897857 100644
--- a/dlls/shdocvw/tests/webbrowser.c
+++ b/dlls/shdocvw/tests/webbrowser.c
@@ -828,6 +828,70 @@ static void test_GetControlInfo(IUnknown
     IOleControl_Release(control);
 }
 
+static void test_Extent(IUnknown *unk)
+{
+    IOleObject *oleobj;
+    SIZE size;
+    HRESULT hres;
+
+    hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
+    ok(hres == S_OK, "Could not get IOleObkect: %08lx\n", hres);
+    if(FAILED(hres))
+        return;
+
+    size.cx = size.cy = 0xdeadbeef;
+    hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
+    ok(hres == S_OK, "GetExtent failed: %08lx\n", hres);
+    ok(size.cx == 1323 && size.cy == 529, "size = {%ld %ld}\n", size.cx, size.cy);
+
+    size.cx = 800;
+    size.cy = 700;
+    hres = IOleObject_SetExtent(oleobj, DVASPECT_CONTENT, &size);
+    ok(hres == S_OK, "SetExtent failed: %08lx\n", hres);
+
+    size.cx = size.cy = 0xdeadbeef;
+    hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
+    ok(hres == S_OK, "GetExtent failed: %08lx\n", hres);
+    ok(size.cx == 800 && size.cy == 700, "size = {%ld %ld}\n", size.cx, size.cy);
+
+    size.cx = size.cy = 0xdeadbeef;
+    hres = IOleObject_GetExtent(oleobj, 0, &size);
+    ok(hres == S_OK, "GetExtent failed: %08lx\n", hres);
+    ok(size.cx == 800 && size.cy == 700, "size = {%ld %ld}\n", size.cx, size.cy);
+
+    size.cx = 900;
+    size.cy = 800;
+    hres = IOleObject_SetExtent(oleobj, 0, &size);
+    ok(hres == S_OK, "SetExtent failed: %08lx\n", hres);
+
+    size.cx = size.cy = 0xdeadbeef;
+    hres = IOleObject_GetExtent(oleobj, 0, &size);
+    ok(hres == S_OK, "GetExtent failed: %08lx\n", hres);
+    ok(size.cx == 900 && size.cy == 800, "size = {%ld %ld}\n", size.cx, size.cy);
+
+    size.cx = size.cy = 0xdeadbeef;
+    hres = IOleObject_GetExtent(oleobj, 0xdeadbeef, &size);
+    ok(hres == S_OK, "GetExtent failed: %08lx\n", hres);
+    ok(size.cx == 900 && size.cy == 800, "size = {%ld %ld}\n", size.cx, size.cy);
+
+    size.cx = 1000;
+    size.cy = 900;
+    hres = IOleObject_SetExtent(oleobj, 0xdeadbeef, &size);
+    ok(hres == S_OK, "SetExtent failed: %08lx\n", hres);
+
+    size.cx = size.cy = 0xdeadbeef;
+    hres = IOleObject_GetExtent(oleobj, 0xdeadbeef, &size);
+    ok(hres == S_OK, "GetExtent failed: %08lx\n", hres);
+    ok(size.cx == 1000 && size.cy == 900, "size = {%ld %ld}\n", size.cx, size.cy);
+
+    size.cx = size.cy = 0xdeadbeef;
+    hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
+    ok(hres == S_OK, "GetExtent failed: %08lx\n", hres);
+    ok(size.cx == 1000 && size.cy == 900, "size = {%ld %ld}\n", size.cx, size.cy);
+
+    IOleObject_Release(oleobj);
+}
+
 static void test_WebBrowser(void)
 {
     IUnknown *unk = NULL;
@@ -842,6 +906,7 @@ static void test_WebBrowser(void)
 
     test_ClassInfo(unk);
     test_ClientSite(unk, &ClientSite);
+    test_Extent(unk);
     test_DoVerb(unk);
     test_ClientSite(unk, NULL);
     test_ie_funcs(unk);




More information about the wine-cvs mailing list