Andrew Eikum : mshtml: Implement IHTMLFrameBase::{get, put}_scrolling.
Alexandre Julliard
julliard at winehq.org
Tue Dec 8 11:10:40 CST 2009
Module: wine
Branch: master
Commit: 2710d14c40f30dc442efd58cd4dae9b7b377a36d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2710d14c40f30dc442efd58cd4dae9b7b377a36d
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Mon Dec 7 16:28:07 2009 -0600
mshtml: Implement IHTMLFrameBase::{get,put}_scrolling.
---
dlls/mshtml/htmlframebase.c | 67 ++++++++++++++++++++++++++++++++++++++++--
dlls/mshtml/tests/dom.c | 34 ++++++++++++++++++++++
2 files changed, 97 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmlframebase.c b/dlls/mshtml/htmlframebase.c
index dc2ea08..47aa9fb 100644
--- a/dlls/mshtml/htmlframebase.c
+++ b/dlls/mshtml/htmlframebase.c
@@ -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 = {
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 367bbee..0ede169 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -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);
}
More information about the wine-cvs
mailing list