Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45797 Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/mshtml/mshtml_private.h | 2 + dlls/mshtml/oleobj.c | 22 ++++++-- dlls/mshtml/tests/htmldoc.c | 99 ++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 2c14ec0bec..0b24f1a390 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -642,6 +642,8 @@ struct HTMLDocument { HTMLOuterWindow *window;
ConnectionPointContainer cp_container; + + SIZEL extent; };
static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv) diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index 1d8d62669e..7499a2f88d 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -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->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->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->extent.cx = 1; + This->extent.cy = 1; } diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index dee448144e..89311c5d8c 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -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);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=79150
Your paranoid android.
=== w8 (32 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS htmldoc.c:350: Test failed: expected Exec_SETTITLE htmldoc.c:2859: Test failed: unexpected call Exec_SETTITLE
=== w8adm (32 bit report) ===
mshtml: htmldoc.c:3084: Test failed: Incorrect error code: -2146697211 htmldoc.c:3089: Test failed: Page address: L"http://test.winehq.org/tests/winehq_snapshot/" htmldoc.c:5861: Test failed: expected OnChanged_1012 htmldoc.c:5862: Test failed: expected Exec_HTTPEQUIV htmldoc.c:5864: Test failed: expected Exec_SETTITLE htmldoc.c:5905: Test failed: expected FireNavigateComplete2
=== w10pro64_zh_CN (32 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS
=== w10pro64_he (64 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS
=== debiant (build log) ===
Task: WineTest did not produce the wow32 report
On 22.09.2020 18:33, Gijs Vermeulen wrote:
--- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -642,6 +642,8 @@ struct HTMLDocument { HTMLOuterWindow *window;
ConnectionPointContainer cp_container;
- SIZEL extent; };
Please move that to HTMLDocumentObj. Long term plan is to remove HTMLDocument struct (at least in its current form). Other than that, the patch looks good.
Thanks,
Jacek