mshtml: Improved IHTMLElement2::doScroll stub.

This commit is contained in:
Jacek Caban 2009-10-11 21:10:47 +02:00 committed by Alexandre Julliard
parent 5763637e9b
commit ae6fed5c4f
4 changed files with 77 additions and 2 deletions

View File

@ -130,8 +130,15 @@ static HRESULT WINAPI HTMLElement2_componentFromPoint(IHTMLElement2 *iface,
static HRESULT WINAPI HTMLElement2_doScroll(IHTMLElement2 *iface, VARIANT component)
{
HTMLElement *This = HTMLELEM2_THIS(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
TRACE("(%p)->(%s)\n", This, debugstr_variant(&component));
if(!This->node.doc->content_ready
|| !This->node.doc->basedoc.doc_obj->in_place_active)
return E_PENDING;
WARN("stub\n");
return S_OK;
}
static HRESULT WINAPI HTMLElement2_put_onscroll(IHTMLElement2 *iface, VARIANT v)

View File

@ -472,6 +472,7 @@ struct HTMLDocumentNode {
LONG ref;
HTMLDOMNode *nodes;
BOOL content_ready;
IInternetSecurityManager *secmgr;

View File

@ -466,6 +466,8 @@ static void NSAPI nsDocumentObserver_EndLoad(nsIDocumentObserver *iface, nsIDocu
TRACE("\n");
This->doc->basedoc.doc_node->content_ready = TRUE;
task = heap_alloc(sizeof(task_t));
task->doc = &This->doc->basedoc;

View File

@ -157,6 +157,7 @@ static BOOL ipsex;
static BOOL set_clientsite = FALSE, container_locked = FALSE;
static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
static BOOL editmode = FALSE, show_failed;
static BOOL inplace_deactivated;
static int stream_read, protocol_read;
static enum load_state_t {
LD_DOLOAD,
@ -211,6 +212,18 @@ static int strcmp_wa(LPCWSTR strw, const char *stra)
return lstrcmpA(stra, buf);
}
static BSTR a2bstr(const char *str)
{
BSTR ret;
int len;
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
ret = SysAllocStringLen(NULL, len);
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
return ret;
}
static BOOL is_english(void)
{
return PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_ENGLISH
@ -1493,6 +1506,7 @@ static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx *iface)
static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx *iface)
{
CHECK_EXPECT(OnInPlaceActivate);
inplace_deactivated = FALSE;
return S_OK;
}
@ -1550,6 +1564,7 @@ static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx *iface, BOOL
static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx *iface)
{
CHECK_EXPECT(OnInPlaceDeactivate);
inplace_deactivated = TRUE;
return S_OK;
}
@ -2565,6 +2580,53 @@ static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
return DefWindowProc(hwnd, msg, wParam, lParam);
}
static void test_doscroll(IUnknown *unk)
{
IHTMLDocument3 *doc;
IHTMLElement2 *elem2;
IHTMLElement *elem;
VARIANT v;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc);
ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
if(FAILED(hres))
return;
hres = IHTMLDocument3_get_documentElement(doc, &elem);
IHTMLDocument3_Release(doc);
ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
switch(load_state) {
case LD_DOLOAD:
case LD_NO:
ok(!elem, "elem != NULL\n");
default:
break;
case LD_INTERACTIVE:
case LD_COMPLETE:
ok(elem != NULL, "elem == NULL\n");
}
if(!elem)
return;
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
IHTMLElement_Release(elem);
ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = a2bstr("left");
hres = IHTMLElement2_doScroll(elem2, v);
SysFreeString(V_BSTR(&v));
IHTMLElement2_Release(elem2);
if(inplace_deactivated)
ok(hres == E_PENDING, "doScroll failed: %08x\n", hres);
else if(load_state == LD_COMPLETE)
ok(hres == S_OK, "doScroll failed: %08x\n", hres);
else
ok(hres == E_PENDING || hres == S_OK, "doScroll failed: %08x\n", hres);
}
static void _test_readyState(unsigned line, IUnknown *unk)
{
IHTMLDocument2 *htmldoc;
@ -2618,6 +2680,8 @@ static void _test_readyState(unsigned line, IUnknown *unk)
ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
test_doscroll((IUnknown*)htmldoc);
IHTMLDocument2_Release(htmldoc);
}
@ -3868,6 +3932,7 @@ static void init_test(enum load_state_t ls) {
stream_read = 0;
protocol_read = 0;
ipsex = FALSE;
inplace_deactivated = FALSE;
}
static void test_HTMLDocument(BOOL do_load)