mshtml: Added support for non-pixel style values in IHTMLStyle::get_pixel* functions.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-10-07 18:13:59 +02:00 committed by Alexandre Julliard
parent 2f0de6a1bc
commit 1dedd90e8c
2 changed files with 31 additions and 9 deletions

View File

@ -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,16 +711,11 @@ 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 {
if(!ptr || (*ptr && strcmpW(ptr, pxW)))
*p = 0;
}
}
nsAString_Finish(&str_value);
return hres;

View File

@ -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);