Alistair Leslie-Hughes : mshtml: Implement IHTMLStyle get/put borderStyle.
Alexandre Julliard
julliard at winehq.org
Wed Mar 4 09:00:54 CST 2009
Module: wine
Branch: master
Commit: d804631e34fe8a42fc63a8ecab08ca0689833d63
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d804631e34fe8a42fc63a8ecab08ca0689833d63
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Mon Mar 2 21:58:55 2009 +1100
mshtml: Implement IHTMLStyle get/put borderStyle.
---
dlls/mshtml/htmlstyle.c | 48 +++++++++++++++++++++++++++++++++++++++++---
dlls/mshtml/htmlstyle.h | 1 +
dlls/mshtml/tests/dom.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 95 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index e571ac9..7817d9b 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -55,6 +55,8 @@ static const WCHAR attrBorderLeftStyle[] =
{'b','o','r','d','e','r','-','l','e','f','t','-','s','t','y','l','e',0};
static const WCHAR attrBorderRightStyle[] =
{'b','o','r','d','e','r','-','r','i','g','h','t','-','s','t','y','l','e',0};
+static const WCHAR attrBorderStyle[] =
+ {'b','o','r','d','e','r','-','s','t','y','l','e',0};
static const WCHAR attrBorderTopStyle[] =
{'b','o','r','d','e','r','-','t','o','p','-','s','t','y','l','e',0};
static const WCHAR attrBorderWidth[] =
@@ -124,6 +126,7 @@ static const struct{
{attrBorderLeft, DISPID_IHTMLSTYLE_BORDERLEFT},
{attrBorderLeftStyle, DISPID_IHTMLSTYLE_BORDERLEFTSTYLE},
{attrBorderRightStyle, DISPID_IHTMLSTYLE_BORDERRIGHTSTYLE},
+ {attrBorderStyle, DISPID_IHTMLSTYLE_BORDERSTYLE},
{attrBorderTopStyle, DISPID_IHTMLSTYLE_BORDERTOPSTYLE},
{attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH},
{attrColor, DISPID_IHTMLSTYLE_COLOR},
@@ -1562,15 +1565,52 @@ static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *
static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
{
HTMLStyle *This = HTMLSTYLE_THIS(iface);
- FIXME("(%p)->(%s)\n", This, debugstr_w(v));
- return E_NOTIMPL;
+ static const WCHAR styleWindowInset[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
+ HRESULT hres = S_OK;
+ BSTR pstyle;
+ int i=0;
+ int last = 0;
+
+ TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+ while(v[i] && hres == S_OK)
+ {
+ if(v[i] == (WCHAR)' ')
+ {
+ pstyle = SysAllocStringLen(&v[last], (i-last));
+ if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
+ {
+ TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
+ hres = E_INVALIDARG;
+ }
+ SysFreeString(pstyle);
+ last = i+1;
+ }
+ i++;
+ }
+
+ if(hres == S_OK)
+ {
+ pstyle = SysAllocStringLen(&v[last], i-last);
+ if( !(is_valid_border_style(pstyle) || strcmpiW(styleWindowInset, pstyle) == 0))
+ {
+ TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
+ hres = E_INVALIDARG;
+ }
+ SysFreeString(pstyle);
+ }
+
+ if(hres == S_OK)
+ hres = set_nsstyle_attr(This->nsstyle, STYLEID_BORDER_STYLE, v, 0);
+
+ return hres;
}
static HRESULT WINAPI HTMLStyle_get_borderStyle(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_BORDER_STYLE, p);
}
static HRESULT WINAPI HTMLStyle_put_borderTopStyle(IHTMLStyle *iface, BSTR v)
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index 8922448..a275c3a 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -45,6 +45,7 @@ typedef enum {
STYLEID_BORDER_LEFT,
STYLEID_BORDER_LEFT_STYLE,
STYLEID_BORDER_RIGHT_STYLE,
+ STYLEID_BORDER_STYLE,
STYLEID_BORDER_TOP_STYLE,
STYLEID_BORDER_WIDTH,
STYLEID_COLOR,
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index a00aa78..dca4215 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -3262,6 +3262,56 @@ static void test_default_style(IHTMLStyle *style)
test_border_styles(style, str);
SysFreeString(str);
+ hres = IHTMLStyle_get_borderStyle(style, &sDefault);
+ ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
+
+ str = a2bstr("none dotted dashed solid");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("none dotted dashed solid");
+ hres = IHTMLStyle_get_borderStyle(style, &str);
+ ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
+ ok(!strcmp_wa(str, "none dotted dashed solid"),
+ "expected (none dotted dashed solid) = (%s)\n", dbgstr_w(V_BSTR(&v)));
+ SysFreeString(str);
+
+ str = a2bstr("double groove ridge inset");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("window-inset outset ridge inset");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("window-inset");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("none none none none none");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("invalid none none none");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ str = a2bstr("none invalid none none");
+ hres = IHTMLStyle_put_borderStyle(style, str);
+ ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(str);
+
+ hres = IHTMLStyle_put_borderStyle(style, sDefault);
+ ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
+ SysFreeString(sDefault);
+
+ /* backgoundColor */
hres = IHTMLStyle_get_backgroundColor(style, &v);
ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
More information about the wine-cvs
mailing list