Alexandre Julliard : shdocvw: Fix the computation of the default extents.

Alexandre Julliard julliard at winehq.org
Fri Nov 21 10:26:26 CST 2008


Module: wine
Branch: master
Commit: e37f8f23f123f34cf2369ab5d5acb4395e57efbc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e37f8f23f123f34cf2369ab5d5acb4395e57efbc

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Nov 21 17:07:21 2008 +0100

shdocvw: Fix the computation of the default extents.

---

 dlls/shdocvw/oleobject.c        |    6 +++---
 dlls/shdocvw/tests/webbrowser.c |   11 ++++++-----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/dlls/shdocvw/oleobject.c b/dlls/shdocvw/oleobject.c
index 9a38cf0..198ff2a 100644
--- a/dlls/shdocvw/oleobject.c
+++ b/dlls/shdocvw/oleobject.c
@@ -917,9 +917,9 @@ void WebBrowser_OleObject_Init(WebBrowser *This)
     memset(&This->clip_rect, 0, sizeof(RECT));
     memset(&This->frameinfo, 0, sizeof(OLEINPLACEFRAMEINFO));
 
-    /* The size is dpi dependent */
-    This->extent.cx = 127000 / dpi_x;
-    This->extent.cy =  50800 / dpi_y;
+    /* Default size is 50x20 pixels, in himetric units */
+    This->extent.cx = MulDiv( 50, 2540, dpi_x );
+    This->extent.cy = MulDiv( 20, 2540, dpi_y );
 }
 
 void WebBrowser_OleObject_Destroy(WebBrowser *This)
diff --git a/dlls/shdocvw/tests/webbrowser.c b/dlls/shdocvw/tests/webbrowser.c
index ec036c5..76dfbf7 100644
--- a/dlls/shdocvw/tests/webbrowser.c
+++ b/dlls/shdocvw/tests/webbrowser.c
@@ -1814,7 +1814,7 @@ static void test_GetControlInfo(IUnknown *unk)
 static void test_Extent(IUnknown *unk)
 {
     IOleObject *oleobj;
-    SIZE size;
+    SIZE size, expected;
     HRESULT hres;
     DWORD dpi_x;
     DWORD dpi_y;
@@ -1836,10 +1836,11 @@ static void test_Extent(IUnknown *unk)
     size.cx = size.cy = 0xdeadbeef;
     hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
     ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
-    /* The default size is dpi dependent (96:1323x529 / 120:1058x423) */
-    ok(size.cx == (127000 / dpi_x) &&
-        size.cy == (50800 / dpi_y), "size = {%d %d} (expected %d %d)\n",
-        size.cx, size.cy, 127000 / dpi_x, 50800 / dpi_y);
+    /* Default size is 50x20 pixels, in himetric units */
+    expected.cx = MulDiv( 50, 2540, dpi_x );
+    expected.cy = MulDiv( 20, 2540, dpi_y );
+    ok(size.cx == expected.cx && size.cy == expected.cy, "size = {%d %d} (expected %d %d)\n",
+       size.cx, size.cy, expected.cx, expected.cy );
 
     size.cx = 800;
     size.cy = 700;




More information about the wine-cvs mailing list