Module: wine Branch: master Commit: 8c47530070b112eb45ca2d25299983bde668e2d9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8c47530070b112eb45ca2d2529...
Author: Alistair Leslie-Hughes leslie_alistair@hotmail.com Date: Tue Feb 17 20:29:58 2009 +1100
mshtml: Implement IHTMLStyle get/put minHeight.
---
dlls/mshtml/htmlstyle.c | 7 +++++-- dlls/mshtml/htmlstyle.h | 4 ++++ dlls/mshtml/htmlstyle3.c | 12 ++++++++---- dlls/mshtml/tests/dom.c | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 6 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index b9d33f0..abe8a3f 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -83,6 +83,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 attrMinHeight[] = + {'m','i','n','-','h','e','i','g','h','t',0}; static const WCHAR attrOverflow[] = {'o','v','e','r','f','l','o','w',0}; static const WCHAR attrPaddingLeft[] = @@ -132,6 +134,7 @@ static const struct{ {attrMargin, DISPID_IHTMLSTYLE_MARGIN}, {attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT}, {attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT}, + {attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT}, {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW}, {attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT}, {attrPosition, DISPID_IHTMLSTYLE2_POSITION}, @@ -242,7 +245,7 @@ HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCW return S_OK; }
-static HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags) +HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags) { switch(V_VT(value)) { case VT_NULL: @@ -308,7 +311,7 @@ HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR return S_OK; }
-static HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags) +HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags) { nsAString str_value; const PRUnichar *value; diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index a9ff535..7cf135a 100644 --- a/dlls/mshtml/htmlstyle.h +++ b/dlls/mshtml/htmlstyle.h @@ -59,6 +59,7 @@ typedef enum { STYLEID_MARGIN, STYLEID_MARGIN_LEFT, STYLEID_MARGIN_RIGHT, + STYLEID_MIN_HEIGHT, STYLEID_OVERFLOW, STYLEID_PADDING_LEFT, STYLEID_POSITION, @@ -76,3 +77,6 @@ void HTMLStyle3_Init(HTMLStyle*);
HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,BSTR*); HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,LPCWSTR,DWORD); + +HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags); +HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags); diff --git a/dlls/mshtml/htmlstyle3.c b/dlls/mshtml/htmlstyle3.c index f5ed8b5..ce1d56e 100644 --- a/dlls/mshtml/htmlstyle3.c +++ b/dlls/mshtml/htmlstyle3.c @@ -409,15 +409,19 @@ static HRESULT WINAPI HTMLStyle4_get_textOverflow(IHTMLStyle4 *iface, BSTR *p) static HRESULT WINAPI HTMLStyle4_put_minHeight(IHTMLStyle4 *iface, VARIANT v) { HTMLStyle *This = HTMLSTYLE4_THIS(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + return set_nsstyle_attr_var(This->nsstyle, STYLEID_MIN_HEIGHT, &v, 0); }
static HRESULT WINAPI HTMLStyle4_get_minHeight(IHTMLStyle4 *iface, VARIANT *p) { HTMLStyle *This = HTMLSTYLE4_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_MIN_HEIGHT, p, 0); }
static const IHTMLStyle4Vtbl HTMLStyle4Vtbl = { diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index e52e33e..90148ea 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -2403,9 +2403,35 @@ static void test_style2(IHTMLStyle2 *style2) SysFreeString(str); }
+static void test_style4(IHTMLStyle4 *style4) +{ + HRESULT hres; + VARIANT v; + VARIANT vdefault; + + hres = IHTMLStyle4_get_minHeight(style4, &vdefault); + ok(hres == S_OK, "get_minHeight failed: %08x\n", hres); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr("10px"); + hres = IHTMLStyle4_put_minHeight(style4, v); + ok(hres == S_OK, "put_minHeight failed: %08x\n", hres); + VariantClear(&v); + + hres = IHTMLStyle4_get_minHeight(style4, &v); + ok(hres == S_OK, "get_minHeight failed: %08x\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v)); + ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", dbgstr_w(V_BSTR(&v))); + + hres = IHTMLStyle4_put_minHeight(style4, vdefault); + ok(hres == S_OK, "put_minHeight failed: %08x\n", hres); + VariantClear(&vdefault); +} + static void test_default_style(IHTMLStyle *style) { IHTMLStyle2 *style2; + IHTMLStyle4 *style4; VARIANT_BOOL b; VARIANT v; BSTR str; @@ -3034,6 +3060,13 @@ static void test_default_style(IHTMLStyle *style) test_style2(style2); IHTMLStyle2_Release(style2); } + + hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4); + ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres); + if(SUCCEEDED(hres)) { + test_style4(style4); + IHTMLStyle4_Release(style4); + } }
static void test_default_selection(IHTMLDocument2 *doc)