Commit 86dfc6ad authored by Gijs Vermeulen's avatar Gijs Vermeulen Committed by Alexandre Julliard

mshtml: Implement IOleObject::[Get|Set]Extent.

parent fe59d1a5
......@@ -6014,10 +6014,11 @@ static HRESULT create_document_object(BOOL is_mhtml, IUnknown *outer, REFIID rii
doc->IUnknown_inner.lpVtbl = &HTMLDocumentObjVtbl;
doc->ICustomDoc_iface.lpVtbl = &CustomDocVtbl;
doc->basedoc.doc_obj = doc;
init_dispex(&doc->dispex, (IUnknown*)&doc->ICustomDoc_iface, &HTMLDocumentObj_dispex);
init_doc(&doc->basedoc, outer ? outer : &doc->IUnknown_inner, &doc->dispex.IDispatchEx_iface);
TargetContainer_Init(doc);
doc->basedoc.doc_obj = doc;
doc->is_mhtml = is_mhtml;
doc->task_magic = get_task_target_magic();
......
......@@ -711,6 +711,7 @@ struct HTMLDocumentObj {
DWORD update;
LONG task_magic;
SIZEL extent;
};
typedef struct nsWeakReference nsWeakReference;
......
......@@ -606,15 +606,27 @@ static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfTyp
static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
{
HTMLDocument *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
return E_NOTIMPL;
TRACE("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
if (dwDrawAspect != DVASPECT_CONTENT)
return E_INVALIDARG;
This->doc_obj->extent = *psizel;
return S_OK;
}
static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
{
HTMLDocument *This = impl_from_IOleObject(iface);
FIXME("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
return E_NOTIMPL;
TRACE("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
if (dwDrawAspect != DVASPECT_CONTENT)
return E_INVALIDARG;
*psizel = This->doc_obj->extent;
return S_OK;
}
static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink, DWORD *pdwConnection)
......@@ -1473,4 +1485,6 @@ void HTMLDocument_OleObj_Init(HTMLDocument *This)
This->IObjectWithSite_iface.lpVtbl = &ObjectWithSiteVtbl;
This->IOleContainer_iface.lpVtbl = &OleContainerVtbl;
This->IObjectSafety_iface.lpVtbl = &ObjectSafetyVtbl;
This->doc_obj->extent.cx = 1;
This->doc_obj->extent.cy = 1;
}
......@@ -6922,6 +6922,104 @@ static void test_OnAmbientPropertyChange(IHTMLDocument2 *doc)
static void test_GetSetExtent(IHTMLDocument2 *doc)
{
IOleObject *oleobj = NULL;
HRESULT hres;
SIZE extent;
hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
if(FAILED(hres))
return;
extent.cx = extent.cy = 0xdeadbeef;
hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
ok(extent.cx == 1 && extent.cy == 1, "size = {%d %d} (expected {1 1})\n",
extent.cx, extent.cy);
extent.cx = extent.cy = 0xdeadbeef;
hres = IOleObject_GetExtent(oleobj, 0, &extent);
ok(hres == E_INVALIDARG, "GetExtent failed: %08x\n", hres);
ok(extent.cx == 0xdeadbeef && extent.cy == 0xdeadbeef, "size = {%d %d}\n", extent.cx, extent.cy);
extent.cx = extent.cy = 0xdeadbeef;
hres = IOleObject_GetExtent(oleobj, 7, &extent);
ok(hres == E_INVALIDARG, "GetExtent failed: %08x\n", hres);
ok(extent.cx == 0xdeadbeef && extent.cy == 0xdeadbeef, "size = {%d %d}\n", extent.cx, extent.cy);
extent.cx = 800;
extent.cy = 700;
hres = IOleObject_SetExtent(oleobj, 0, &extent);
ok(hres == E_INVALIDARG, "SetExtent failed: %08x\n", hres);
extent.cx = extent.cy = 0xdeadbeef;
hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
ok(extent.cx == 1 && extent.cy == 1, "size = {%d %d} (expected {1 1})\n",
extent.cx, extent.cy);
extent.cx = 800;
extent.cy = 700;
hres = IOleObject_SetExtent(oleobj, 7, &extent);
ok(hres == E_INVALIDARG, "SetExtent failed: %08x\n", hres);
extent.cx = extent.cy = 0xdeadbeef;
hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
ok(extent.cx == 1 && extent.cy == 1, "size = {%d %d} (expected {1 1})\n",
extent.cx, extent.cy);
extent.cx = extent.cy = 0xdeadbeef;
hres = IOleObject_SetExtent(oleobj, 0, &extent);
todo_wine ok(hres == E_FAIL, "SetExtent failed: %08x\n", hres);
extent.cx = extent.cy = 0xdeadbeef;
hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
ok(extent.cx == 1 && extent.cy == 1, "size = {%d %d} (expected {1 1})\n",
extent.cx, extent.cy);
extent.cx = extent.cy = 0xdeadbeef;
hres = IOleObject_SetExtent(oleobj, 7, &extent);
todo_wine ok(hres == E_FAIL, "SetExtent failed: %08x\n", hres);
extent.cx = extent.cy = 0xdeadbeef;
hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
ok(extent.cx == 1 && extent.cy == 1, "size = {%d %d} (expected {1 1})\n",
extent.cx, extent.cy);
extent.cx = extent.cy = 0xdeadbeef;
hres = IOleObject_SetExtent(oleobj, DVASPECT_CONTENT, &extent);
todo_wine ok(hres == E_FAIL, "SetExtent failed: %08x\n", hres);
extent.cx = extent.cy = 0xdeadbeef;
hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
todo_wine ok(extent.cx == 1 && extent.cy == 1, "size = {%d %d} (expected {1 1})\n",
extent.cx, extent.cy);
extent.cx = 800;
extent.cy = 700;
hres = IOleObject_SetExtent(oleobj, DVASPECT_CONTENT, &extent);
ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
extent.cx = extent.cy = 0xdeadbeef;
hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
ok(extent.cx == 800 && extent.cy == 700, "size = {%d %d} (expected {800 700})\n",
extent.cx, extent.cy );
extent.cx = 1;
extent.cy = 1;
hres = IOleObject_SetExtent(oleobj, DVASPECT_CONTENT, &extent);
ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
IOleObject_Release(oleobj);
}
static void test_OnAmbientPropertyChange2(IHTMLDocument2 *doc)
{
IOleControl *control = NULL;
......@@ -7605,6 +7703,7 @@ static void test_HTMLDocument(BOOL do_load, BOOL mime)
doc_unk = (IUnknown*)doc;
test_QueryInterface(doc);
test_GetSetExtent(doc);
test_Advise(doc);
test_IsDirty(doc, S_FALSE);
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment