Commit 2710d14c authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

mshtml: Implement IHTMLFrameBase::{get,put}_scrolling.

parent 6e3e7c9f
......@@ -31,6 +31,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static const WCHAR autoW[] = {'a','u','t','o',0};
static const WCHAR yesW[] = {'y','e','s',0};
static const WCHAR noW[] = {'n','o',0};
HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc)
{
nsIDOMWindow *nswindow;
......@@ -236,15 +240,70 @@ static HRESULT WINAPI HTMLFrameBase_get_noResize(IHTMLFrameBase *iface, VARIANT_
static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
{
HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
nsAString nsstr;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(!(!strcmpiW(v, yesW) || !strcmpiW(v, noW) || !strcmpiW(v, autoW)))
return E_INVALIDARG;
if(This->nsframe) {
nsAString_Init(&nsstr, v);
nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
}else if(This->nsiframe) {
nsAString_Init(&nsstr, v);
nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
}else {
ERR("No attached ns frame object\n");
return E_UNEXPECTED;
}
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres)) {
ERR("SetScrolling failed: 0x%08x\n", nsres);
return E_FAIL;
}
return S_OK;
}
static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p)
{
HTMLFrameBase *This = HTMLFRAMEBASE_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsAString nsstr;
const PRUnichar *strdata;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
if(This->nsframe) {
nsAString_Init(&nsstr, NULL);
nsres = nsIDOMHTMLFrameElement_GetScrolling(This->nsframe, &nsstr);
}else if(This->nsiframe) {
nsAString_Init(&nsstr, NULL);
nsres = nsIDOMHTMLIFrameElement_GetScrolling(This->nsiframe, &nsstr);
}else {
ERR("No attached ns frame object\n");
return E_UNEXPECTED;
}
if(NS_FAILED(nsres)) {
ERR("GetScrolling failed: 0x%08x\n", nsres);
nsAString_Finish(&nsstr);
return E_FAIL;
}
nsAString_GetData(&nsstr, &strdata);
if(*strdata)
*p = SysAllocString(strdata);
else
*p = SysAllocString(autoW);
nsAString_Finish(&nsstr);
return *p ? S_OK : E_OUTOFMEMORY;
}
static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl = {
......
......@@ -5899,8 +5899,10 @@ static void test_frameset(IHTMLDocument2 *doc)
IHTMLWindow2 *window;
IHTMLFramesCollection2 *frames;
IHTMLElement *elem;
IHTMLFrameBase *fbase;
LONG length;
VARIANT index_var, result_var;
BSTR str;
HRESULT hres;
window = get_doc_window(doc);
......@@ -6026,6 +6028,38 @@ static void test_frameset(IHTMLDocument2 *doc)
/* getElementById with node name attributes */
elem = get_doc_elem_by_id(doc, "nm1");
test_elem_id((IUnknown*)elem, "fr1");
/* get/put scrolling */
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLFrameBase, (void**)&fbase);
ok(hres == S_OK, "Could not get IHTMLFrameBase interface: 0x%08x\n", hres);
hres = IHTMLFrameBase_get_scrolling(fbase, &str);
ok(hres == S_OK, "IHTMLFrameBase_get_scrolling failed: 0x%08x\n", hres);
ok(!strcmp_wa(str, "auto"), "get_scrolling should have given 'auto', gave: %s\n", wine_dbgstr_w(str));
SysFreeString(str);
str = a2bstr("no");
hres = IHTMLFrameBase_put_scrolling(fbase, str);
ok(hres == S_OK, "IHTMLFrameBase_put_scrolling failed: 0x%08x\n", hres);
SysFreeString(str);
hres = IHTMLFrameBase_get_scrolling(fbase, &str);
ok(hres == S_OK, "IHTMLFrameBase_get_scrolling failed: 0x%08x\n", hres);
ok(!strcmp_wa(str, "no"), "get_scrolling should have given 'no', gave: %s\n", wine_dbgstr_w(str));
SysFreeString(str);
str = a2bstr("junk");
hres = IHTMLFrameBase_put_scrolling(fbase, str);
ok(hres == E_INVALIDARG, "IHTMLFrameBase_put_scrolling should have failed "
"with E_INVALIDARG, instead: 0x%08x\n", hres);
SysFreeString(str);
hres = IHTMLFrameBase_get_scrolling(fbase, &str);
ok(hres == S_OK, "IHTMLFrameBase_get_scrolling failed: 0x%08x\n", hres);
ok(!strcmp_wa(str, "no"), "get_scrolling should have given 'no', gave: %s\n", wine_dbgstr_w(str));
SysFreeString(str);
IHTMLFrameBase_Release(fbase);
IHTMLElement_Release(elem);
}
......
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