From 6937ddca8e3e0c2135632dd0117c51f80e780a8a Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 5 Mar 2009 20:24:24 +1100 Subject: [PATCH] mshtml: Implement IHTMLStyle get/put backgroundPositionX. --- dlls/mshtml/htmlstyle.c | 11 +++++++---- dlls/mshtml/htmlstyle.h | 1 + dlls/mshtml/tests/dom.c | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 96ab9a45b72..82d48690761 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 attrBackgroundPositionX[] = + {'b','a','c','k','g','r','o','u','n','d','-','p','o','s','i','t','i','o','n','-','x',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[] = @@ -119,6 +121,7 @@ static const struct{ {attrBackground, DISPID_IHTMLSTYLE_BACKGROUND}, {attrBackgroundColor, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR}, {attrBackgroundImage, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE}, + {attrBackgroundPositionX, DISPID_IHTMLSTYLE_BACKGROUNDPOSITIONX}, {attrBackgroundRepeat, DISPID_IHTMLSTYLE_BACKGROUNDREPEAT}, {attrBorder, DISPID_IHTMLSTYLE_BORDER}, {attrBorderBottomStyle, DISPID_IHTMLSTYLE_BORDERBOTTOMSTYLE}, @@ -874,15 +877,15 @@ static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR * static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v) { HTMLStyle *This = HTMLSTYLE_THIS(iface); - FIXME("(%p)->(v%d)\n", This, V_VT(&v)); - return E_NOTIMPL; + TRACE("(%p)->(v%d)\n", This, V_VT(&v)); + return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, &v, 0); } static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p) { HTMLStyle *This = HTMLSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, p, 0); } static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v) diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index a275c3ac4d1..407a4abdc48 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_POSITION_X, STYLEID_BACKGROUND_REPEAT, STYLEID_BORDER, STYLEID_BORDER_BOTTOM_STYLE, diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index f09a78b5079..2a6758531d5 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -3429,6 +3429,25 @@ static void test_default_style(IHTMLStyle *style) ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres); SysFreeString(sDefault); + /* backgroundPositionX */ + hres = IHTMLStyle_get_backgroundPositionX(style, &vDefault); + ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr("10px"); + hres = IHTMLStyle_put_backgroundPositionX(style, v); + ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres); + VariantClear(&v); + + hres = IHTMLStyle_get_backgroundPositionX(style, &v); + ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v)); + VariantClear(&v); + + hres = IHTMLStyle_put_backgroundPositionX(style, vDefault); + ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres); + VariantClear(&vDefault); + hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2); ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres); if(SUCCEEDED(hres)) {