Jacek Caban : mshtml: Implement IOleInPlaceObjectWindowless:: SetObjectRects.

Alexandre Julliard julliard at winehq.org
Tue May 21 16:45:23 CDT 2019


Module: wine
Branch: master
Commit: 11616033845ef795449dbd45f9131a06ef423295
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=11616033845ef795449dbd45f9131a06ef423295

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue May 21 16:36:18 2019 +0200

mshtml: Implement IOleInPlaceObjectWindowless::SetObjectRects.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/oleobj.c        | 13 ++++++++---
 dlls/mshtml/tests/htmldoc.c | 56 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c
index 9397a60..87147df 100644
--- a/dlls/mshtml/oleobj.c
+++ b/dlls/mshtml/oleobj.c
@@ -1171,11 +1171,18 @@ static HRESULT WINAPI OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectW
 }
 
 static HRESULT WINAPI OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless *iface,
-        LPCRECT lprcPosRect, LPCRECT lprcClipRect)
+        const RECT *pos, const RECT *clip)
 {
     HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
-    FIXME("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
-    return E_NOTIMPL;
+    RECT r;
+
+    TRACE("(%p)->(%p %p)\n", This, wine_dbgstr_rect(pos), wine_dbgstr_rect(clip));
+
+    if(clip && !EqualRect(clip, pos))
+        FIXME("Ignoring clip rect %s\n", wine_dbgstr_rect(clip));
+
+    r = *pos;
+    return IOleDocumentView_SetRect(&This->doc_obj->IOleDocumentView_iface, &r);
 }
 
 static HRESULT WINAPI OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless *iface)
diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c
index 52e6fe7..f8ae785 100644
--- a/dlls/mshtml/tests/htmldoc.c
+++ b/dlls/mshtml/tests/htmldoc.c
@@ -7088,6 +7088,61 @@ static void test_OnFrameWindowActivate(IUnknown *unk)
     IOleInPlaceActiveObject_Release(inplaceact);
 }
 
+static void test_object_rects(IHTMLDocument2 *doc)
+{
+    IOleInPlaceObjectWindowless *windowlessobj;
+    IOleDocumentView *view;
+    RECT r, doc_rect;
+    HRESULT hres;
+
+    hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleInPlaceObjectWindowless,
+            (void**)&windowlessobj);
+    ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
+
+    hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleDocumentView,
+            (void**)&view);
+    ok(hres == S_OK, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres);
+
+    r.top = 1;
+    r.left = 2;
+    r.bottom = 200;
+    r.right = 201;
+    hres = IOleInPlaceObjectWindowless_SetObjectRects(windowlessobj, &r, NULL);
+    ok(hres == S_OK, "SetObjectRects failed: %08x\n", hres);
+
+    GetWindowRect(doc_hwnd, &doc_rect);
+    MapWindowPoints(HWND_DESKTOP, container_hwnd, (POINT*)&doc_rect, 2);
+    ok(EqualRect(&r, &doc_rect), "unexpected doc rect %s expected %s\n",
+       wine_dbgstr_rect(&doc_rect), wine_dbgstr_rect(&r));
+
+    memset(&doc_rect, 0xc0, sizeof(doc_rect));
+    hres = IOleDocumentView_GetRect(view, &doc_rect);
+    ok(hres == S_OK, "GetRect failed: %08x\n", hres);
+    ok(EqualRect(&r, &doc_rect), "unexpected doc rect %s expected %s\n",
+       wine_dbgstr_rect(&doc_rect), wine_dbgstr_rect(&r));
+
+    r.top = 3;
+    r.left = 4;
+    r.bottom = 205;
+    r.right = 206;
+    hres = IOleDocumentView_SetRect(view, &r);
+    ok(hres == S_OK, "SetObjectRects failed: %08x\n", hres);
+
+    GetWindowRect(doc_hwnd, &doc_rect);
+    MapWindowPoints(HWND_DESKTOP, container_hwnd, (POINT*)&doc_rect, 2);
+    ok(EqualRect(&r, &doc_rect), "unexpected doc rect %s expected %s\n",
+       wine_dbgstr_rect(&doc_rect), wine_dbgstr_rect(&r));
+
+    memset(&doc_rect, 0xc0, sizeof(doc_rect));
+    hres = IOleDocumentView_GetRect(view, &doc_rect);
+    ok(hres == S_OK, "GetRect failed: %08x\n", hres);
+    ok(EqualRect(&r, &doc_rect), "unexpected doc rect %s expected %s\n",
+       wine_dbgstr_rect(&doc_rect), wine_dbgstr_rect(&r));
+
+    IOleInPlaceObjectWindowless_Release(windowlessobj);
+    IOleDocumentView_Release(view);
+}
+
 static void test_InPlaceDeactivate(IHTMLDocument2 *doc, BOOL expect_call)
 {
     IOleInPlaceObjectWindowless *windowlessobj = NULL;
@@ -7609,6 +7664,7 @@ static void test_HTMLDocument(BOOL do_load, BOOL mime)
     test_Window(doc, TRUE);
     test_external(doc, TRUE);
     test_target_container(doc);
+    test_object_rects(doc);
 
     test_UIDeactivate();
     test_OleCommandTarget(doc);




More information about the wine-cvs mailing list