Alistair Leslie-Hughes : mshtml: Implement IHTMLStyle get/ put backgroundRepeat.
Alexandre Julliard
julliard at winehq.org
Wed Feb 25 09:22:51 CST 2009
Module: wine
Branch: master
Commit: 63c8939cdd2f6814cf8382e2f32e0c52ef551c9c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=63c8939cdd2f6814cf8382e2f32e0c52ef551c9c
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Wed Feb 25 15:50:33 2009 +1100
mshtml: Implement IHTMLStyle get/put backgroundRepeat.
---
dlls/mshtml/htmlstyle.c | 26 ++++++++++++++++++++++----
dlls/mshtml/htmlstyle.h | 1 +
dlls/mshtml/tests/dom.c | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 61 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 769e14e..ce5dba2 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -41,6 +41,8 @@ static const WCHAR attrBackgroundColor[] =
{'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
static const WCHAR attrBackgroundImage[] =
{'b','a','c','k','g','r','o','u','n','d','-','i','m','a','g','e',0};
+static const WCHAR attrBackgroundRepeat[] =
+ {'b','a','c','k','g','r','o','u','n','d','-','r','e','p','e','a','t',0};
static const WCHAR attrBorder[] =
{'b','o','r','d','e','r',0};
static const WCHAR attrBorderBottomStyle[] =
@@ -113,6 +115,7 @@ static const struct{
{attrBackground, DISPID_IHTMLSTYLE_BACKGROUND},
{attrBackgroundColor, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR},
{attrBackgroundImage, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE},
+ {attrBackgroundRepeat, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT},
{attrBorder, DISPID_IHTMLSTYLE_BORDER},
{attrBorderBottomStyle, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE},
{attrBorderLeft, DISPID_IHTMLSTYLE_BORDERLEFT},
@@ -803,15 +806,30 @@ static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p)
static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v)
{
HTMLStyle *This = HTMLSTYLE_THIS(iface);
- FIXME("(%p)->(%s)\n", This, debugstr_w(v));
- return E_NOTIMPL;
+ static const WCHAR styleRepeat[] = {'r','e','p','e','a','t',0};
+ static const WCHAR styleNoRepeat[] = {'n','o','-','r','e','p','e','a','t',0};
+ static const WCHAR styleRepeatX[] = {'r','e','p','e','a','t','-','x',0};
+ static const WCHAR styleRepeatY[] = {'r','e','p','e','a','t','-','y',0};
+
+ TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+ /* fontWeight can only be one of the following */
+ if(!v || strcmpiW(styleRepeat, v) == 0 || strcmpiW(styleNoRepeat, v) == 0 ||
+ strcmpiW(styleRepeatX, v) == 0 || strcmpiW(styleRepeatY, v) == 0 )
+ {
+ return set_style_attr(This, STYLEID_BACKGROUND_REPEAT , v, 0);
+ }
+
+ return E_INVALIDARG;
}
static HRESULT WINAPI HTMLStyle_get_backgroundRepeat(IHTMLStyle *iface, BSTR *p)
{
HTMLStyle *This = HTMLSTYLE_THIS(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ return get_style_attr(This, STYLEID_BACKGROUND_REPEAT, p);
}
static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v)
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index 8db28df..73c7c7d 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -38,6 +38,7 @@ typedef enum {
STYLEID_BACKGROUND,
STYLEID_BACKGROUND_COLOR,
STYLEID_BACKGROUND_IMAGE,
+ STYLEID_BACKGROUND_REPEAT,
STYLEID_BORDER,
STYLEID_BORDER_BOTTOM_STYLE,
STYLEID_BORDER_LEFT,
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index d39fdec..607816a 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -3184,6 +3184,44 @@ static void test_default_style(IHTMLStyle *style)
hres = IHTMLStyle_put_paddingLeft(style, vDefault);
ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
+ /* BackgroundRepeat */
+ hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
+ ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
+
+ str = a2bstr("invalid");
+ hres = IHTMLStyle_put_backgroundRepeat(style, str);
+ ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("repeat");
+ hres = IHTMLStyle_put_backgroundRepeat(style, str);
+ ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("no-repeat");
+ hres = IHTMLStyle_put_backgroundRepeat(style, str);
+ ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("repeat-x");
+ hres = IHTMLStyle_put_backgroundRepeat(style, str);
+ ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("repeat-y");
+ hres = IHTMLStyle_put_backgroundRepeat(style, str);
+ ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_get_backgroundRepeat(style, &str);
+ ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", dbgstr_w(str));
+ SysFreeString(str);
+
+ hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
+ ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
+ SysFreeString(str);
+
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