[PATCH v3 2/3] riched20: Fetch extent from object if REOBJECT::sizel is unset.
Jinoh Kang
wine at gitlab.winehq.org
Sat Jun 11 06:00:53 CDT 2022
From: Jinoh Kang <jinoh.kang.kr at gmail.com>
Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
dlls/riched20/caret.c | 13 +++++++++++++
dlls/riched20/tests/richole.c | 2 --
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 09ec0ffc735..01cc5d49310 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -464,6 +464,7 @@ HRESULT editor_insert_oleobj(ME_TextEditor *editor, const REOBJECT *reo)
ME_Cursor *cursor, cursor_from_ofs;
ME_Style *style;
HRESULT hr;
+ SIZEL extent;
if (editor->lpOleCallback)
{
@@ -472,6 +473,17 @@ HRESULT editor_insert_oleobj(ME_TextEditor *editor, const REOBJECT *reo)
return hr;
}
+ extent = reo->sizel;
+ if (!extent.cx && !extent.cy && reo->poleobj)
+ {
+ IOleObject_GetExtent( reo->poleobj, DVASPECT_CONTENT, &extent );
+ if (FAILED(hr))
+ {
+ extent.cx = 0;
+ extent.cy = 0;
+ }
+ }
+
if (reo->cp == REO_CP_SELECTION)
cursor = editor->pCursors;
else
@@ -487,6 +499,7 @@ HRESULT editor_insert_oleobj(ME_TextEditor *editor, const REOBJECT *reo)
run = run_insert( editor, cursor, style, &space, 1, MERF_GRAPHICS );
run->reobj = create_re_object( reo, run );
+ run->reobj->obj.sizel = extent;
prev = run;
while ((prev = run_prev_all_paras( prev )))
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 1e6d23907eb..52aa4deade4 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -4217,9 +4217,7 @@ static void subtest_InsertObject(struct reolecb_obj *callback)
reobj.cbStruct = sizeof(reobj);
hr = IRichEditOle_GetObject(reole, 0, &reobj, REO_GETOBJ_NO_INTERFACES);
ok(hr == S_OK, "IRichEditOle_GetObject got hr %#lx.\n", hr);
- todo_wine
ok(reobj.sizel.cx == 800, "expected reobj.sizel.cx to be %ld, got %ld\n", 800L, reobj.sizel.cx);
- todo_wine
ok(reobj.sizel.cy == 400, "expected reobj.sizel.cy to be %ld, got %ld\n", 400L, reobj.sizel.cy);
IOleClientSite_Release(clientsite);
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/227
More information about the wine-devel
mailing list