riched20: Fetch extent from object if REOBJECT::sizel is unset.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
This commit is contained in:
Jinoh Kang 2022-06-11 19:46:40 +09:00 committed by Alexandre Julliard
parent a7d29d1625
commit 164897e6c9
2 changed files with 13 additions and 2 deletions

View file

@ -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)
{
hr = 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 )))

View file

@ -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);