From e402bb5642ba384238586df5dd6e8b4909f9686e Mon Sep 17 00:00:00 2001 From: Jactry Zeng Date: Tue, 9 Sep 2014 18:50:54 +0800 Subject: [PATCH] mshtml: Add IHTMLStyle::pixelTop property implementation. --- dlls/mshtml/htmlstyle.c | 12 ++++++++---- dlls/mshtml/tests/style.c | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 7f82905e2dc..52d15f9c2c4 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -2460,15 +2460,19 @@ static HRESULT WINAPI HTMLStyle_get_cssText(IHTMLStyle *iface, BSTR *p) static HRESULT WINAPI HTMLStyle_put_pixelTop(IHTMLStyle *iface, LONG v) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; + + TRACE("(%p)->(%d)\n", This, v); + + return set_style_pxattr(This->nsstyle, STYLEID_TOP, v); } static HRESULT WINAPI HTMLStyle_get_pixelTop(IHTMLStyle *iface, LONG *p) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_nsstyle_pixel_val(This, STYLEID_TOP, p); } static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v) diff --git a/dlls/mshtml/tests/style.c b/dlls/mshtml/tests/style.c index eda62efd5ac..40552a429ab 100644 --- a/dlls/mshtml/tests/style.c +++ b/dlls/mshtml/tests/style.c @@ -1210,6 +1210,17 @@ static void test_body_style(IHTMLStyle *style) f == 4.9f, /* IE8 */ "expected 4.0 or 4.9 (IE8) got %f\n", f); + hres = IHTMLStyle_put_pixelTop(style, 6); + ok(hres == S_OK, "put_pixelTop failed: %08x\n", hres); + + l = 0xdeadbeef; + hres = IHTMLStyle_get_pixelTop(style, &l); + ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres); + ok(l == 6, "pixelTop = %d\n", l); + + hres = IHTMLStyle_get_pixelTop(style, NULL); + ok(hres == E_POINTER, "get_pixelTop failed: %08x\n", hres); + V_VT(&v) = VT_BSTR; V_BSTR(&v) = a2bstr("3px"); hres = IHTMLStyle_put_top(style, v); @@ -1227,6 +1238,11 @@ static void test_body_style(IHTMLStyle *style) ok(hres == S_OK, "get_posTop failed: %08x\n", hres); ok(f == 3.0, "expected 3.0 got %f\n", f); + l = 0xdeadbeef; + hres = IHTMLStyle_get_pixelTop(style, &l); + ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres); + ok(l == 3, "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); @@ -1238,6 +1254,11 @@ static void test_body_style(IHTMLStyle *style) ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n"); 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); + /* Test posHeight */ hres = IHTMLStyle_get_posHeight(style, NULL); ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres); -- 2.11.4.GIT