From 1dedd90e8c56ff61772915d575a43ad6c95813cd Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 7 Oct 2016 18:13:59 +0200 Subject: [PATCH] mshtml: Added support for non-pixel style values in IHTMLStyle::get_pixel* functions. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/mshtml/htmlstyle.c | 13 ++++--------- dlls/mshtml/tests/style.c | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index a445bc2c130..72fc1d37975 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -700,7 +700,7 @@ static HRESULT get_nsstyle_pixel_val(HTMLStyle *This, styleid_t sid, LONG *p) hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value); if(hres == S_OK) { - WCHAR *ptr; + WCHAR *ptr = NULL; const PRUnichar *value; nsAString_GetData(&str_value, &value); @@ -711,15 +711,10 @@ static HRESULT get_nsstyle_pixel_val(HTMLStyle *This, styleid_t sid, LONG *p) /* Skip all digits. We have tests showing that we should not round the value. */ while(isdigitW(*++ptr)); } - - if(*ptr && strcmpW(ptr, pxW)) { - nsAString_Finish(&str_value); - FIXME("%s: only px values are currently supported\n", debugstr_w(value)); - hres = E_NOTIMPL; - } - }else { - *p = 0; } + + if(!ptr || (*ptr && strcmpW(ptr, pxW))) + *p = 0; } nsAString_Finish(&str_value); diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c index 7053a0921d3..57207dec38a 100644 --- a/dlls/mshtml/tests/style.c +++ b/dlls/mshtml/tests/style.c @@ -1099,6 +1099,11 @@ static void test_body_style(IHTMLStyle *style) ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v))); VariantClear(&v); + l = 0xdeadbeef; + hres = IHTMLStyle_get_pixelWidth(style, &l); + ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres); + ok(!l, "pixelWidth = %d\n", l); + V_VT(&v) = VT_I4; V_I4(&v) = 100; hres = IHTMLStyle_put_width(style, v); @@ -1361,6 +1366,17 @@ static void test_body_style(IHTMLStyle *style) ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres); ok(l == 3, "pixelTop = %d\n", l); + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr("100%"); + hres = IHTMLStyle_put_top(style, v); + ok(hres == S_OK, "put_top failed: %08x\n", hres); + VariantClear(&v); + + l = 0xdeadbeef; + hres = IHTMLStyle_get_pixelTop(style, &l); + ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres); + ok(!l, "pixelTop = %d\n", l); + V_VT(&v) = VT_NULL; hres = IHTMLStyle_put_top(style, v); ok(hres == S_OK, "put_top failed: %08x\n", hres); @@ -1432,6 +1448,17 @@ static void test_body_style(IHTMLStyle *style) ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres); ok(l == 70, "pixelHeight = %d\n", l); + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr("50%"); + hres = IHTMLStyle_put_height(style, v); + ok(hres == S_OK, "put_height failed: %08x\n", hres); + VariantClear(&v); + + l = 0xdeadbeef; + hres = IHTMLStyle_get_pixelHeight(style, &l); + ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres); + ok(!l, "pixelHeight = %d\n", l); + V_VT(&v) = VT_BSTR; V_BSTR(&v) = NULL; hres = IHTMLStyle_put_height(style, v);