Alistair Leslie-Hughes : mshtml: Implement IHTMLStyle get/put overflow.
Alexandre Julliard
julliard at winehq.org
Thu Dec 4 09:02:55 CST 2008
Module: wine
Branch: master
Commit: 9305cb3cfe64051e8ea71dc8fb3579bc6a8adccf
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9305cb3cfe64051e8ea71dc8fb3579bc6a8adccf
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Tue Nov 25 21:04:11 2008 +1100
mshtml: Implement IHTMLStyle get/put overflow.
---
dlls/mshtml/htmlstyle.c | 30 ++++++++++++++++++++++++++----
dlls/mshtml/htmlstyle.h | 1 +
dlls/mshtml/tests/dom.c | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 70 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index ee14bb9..d81fdb5 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -73,6 +73,8 @@ static const WCHAR attrMarginLeft[] =
{'m','a','r','g','i','n','-','l','e','f','t',0};
static const WCHAR attrMarginRight[] =
{'m','a','r','g','i','n','-','r','i','g','h','t',0};
+static const WCHAR attrOverflow[] =
+ {'o','v','e','r','f','l','o','w',0};
static const WCHAR attrPaddingLeft[] =
{'p','a','d','d','i','n','g','-','l','e','f','t',0};
static const WCHAR attrPosition[] =
@@ -115,6 +117,7 @@ static const struct{
{attrMargin, DISPID_IHTMLSTYLE_MARGIN},
{attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT},
{attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT},
+ {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW},
{attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT},
{attrPosition, DISPID_IHTMLSTYLE2_POSITION},
{attrTextAlign, DISPID_IHTMLSTYLE_TEXTALIGN},
@@ -1733,15 +1736,34 @@ static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
{
HTMLStyle *This = HTMLSTYLE_THIS(iface);
- FIXME("(%p)->(%s)\n", This, debugstr_w(v));
- return E_NOTIMPL;
+ static const WCHAR szVisible[] = {'v','i','s','i','b','l','e',0};
+ static const WCHAR szScroll[] = {'s','c','r','o','l','l',0};
+ static const WCHAR szHidden[] = {'h','i','d','d','e','n',0};
+ static const WCHAR szAuto[] = {'a','u','t','o',0};
+
+ TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+ /* overflow can only be one of the follow values. */
+ if(!v || strcmpiW(szVisible, v) == 0 || strcmpiW(szScroll, v) == 0 ||
+ strcmpiW(szHidden, v) == 0 || strcmpiW(szAuto, v) == 0)
+ {
+ return set_nsstyle_attr(This->nsstyle, STYLEID_OVERFLOW, v, 0);
+ }
+
+ return E_INVALIDARG;
}
+
static HRESULT WINAPI HTMLStyle_get_overflow(IHTMLStyle *iface, BSTR *p)
{
HTMLStyle *This = HTMLSTYLE_THIS(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ if(!p)
+ return E_INVALIDARG;
+
+ return get_style_attr(This, STYLEID_OVERFLOW, p);
}
static HRESULT WINAPI HTMLStyle_put_pageBreakBefore(IHTMLStyle *iface, BSTR v)
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index a6cc5e8..6c45553 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -50,6 +50,7 @@ typedef enum {
STYLEID_MARGIN,
STYLEID_MARGIN_LEFT,
STYLEID_MARGIN_RIGHT,
+ STYLEID_OVERFLOW,
STYLEID_PADDING_LEFT,
STYLEID_POSITION,
STYLEID_TEXT_ALIGN,
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 49b21ad..c7fcc74 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2293,6 +2293,7 @@ static void test_default_style(IHTMLStyle *style)
BSTR str;
HRESULT hres;
float f;
+ BSTR sOverflowDefault;
test_disp((IUnknown*)style, &DIID_DispHTMLStyle);
test_ifaces((IUnknown*)style, style_iids);
@@ -2601,6 +2602,48 @@ static void test_default_style(IHTMLStyle *style)
ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
VariantClear(&v);
+ /* overflow */
+ hres = IHTMLStyle_get_overflow(style, NULL);
+ ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
+
+ hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
+ ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
+
+ str = a2bstr("test");
+ hres = IHTMLStyle_put_overflow(style, str);
+ ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("visible");
+ hres = IHTMLStyle_put_overflow(style, str);
+ ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("scroll");
+ hres = IHTMLStyle_put_overflow(style, str);
+ ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("hidden");
+ hres = IHTMLStyle_put_overflow(style, str);
+ ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("auto");
+ hres = IHTMLStyle_put_overflow(style, str);
+ ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_get_overflow(style, &str);
+ ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "auto"), "str=%s\n", dbgstr_w(str));
+ SysFreeString(str);
+
+ /* restore overflow default */
+ hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
+ ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
+ SysFreeString(sOverflowDefault);
+
hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
if(SUCCEEDED(hres)) {
More information about the wine-cvs
mailing list