Commit 85368869 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLStyle::get_pixelLeft implementation.

parent c5f15727
......@@ -180,6 +180,9 @@ static const WCHAR attrWordWrap[] =
static const WCHAR attrZIndex[] =
{'z','-','i','n','d','e','x',0};
static const WCHAR pxW[] = {'p','x',0};
typedef struct {
const WCHAR *name;
DISPID dispid;
......@@ -612,7 +615,6 @@ static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
{
nsAString str_value;
HRESULT hres;
WCHAR pxW[] = {'p','x',0};
TRACE("%p %d %p\n", This, sid, p);
......@@ -647,6 +649,36 @@ static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
return hres;
}
static HRESULT get_nsstyle_pixel_val(HTMLStyle *This, styleid_t sid, LONG *p)
{
nsAString str_value;
HRESULT hres;
nsAString_Init(&str_value, NULL);
hres = get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
if(hres == S_OK) {
WCHAR *ptr;
const PRUnichar *value;
nsAString_GetData(&str_value, &value);
if(value) {
*p = strtolW(value, &ptr, 10);
if(*ptr && strcmpW(ptr, pxW)) {
nsAString_Finish(&str_value);
FIXME("only px values are currently supported\n");
hres = E_NOTIMPL;
}
}else {
*p = 0;
}
}
nsAString_Finish(&str_value);
return hres;
}
static BOOL is_valid_border_style(BSTR v)
{
static const WCHAR styleDotted[] = {'d','o','t','t','e','d',0};
......@@ -2387,8 +2419,10 @@ static HRESULT WINAPI HTMLStyle_put_pixelLeft(IHTMLStyle *iface, LONG v)
static HRESULT WINAPI HTMLStyle_get_pixelLeft(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_LEFT, p);
}
static HRESULT WINAPI HTMLStyle_put_pixelWidth(IHTMLStyle *iface, LONG v)
......
......@@ -465,6 +465,7 @@ static void test_body_style(IHTMLStyle *style)
float f;
BSTR sOverflowDefault;
BSTR sDefault;
LONG l;
VARIANT vDefault;
test_style_csstext(style, NULL);
......@@ -904,6 +905,11 @@ static void test_body_style(IHTMLStyle *style)
ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
VariantClear(&v);
l = 0xdeadbeef;
hres = IHTMLStyle_get_pixelLeft(style, &l);
ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
ok(!l, "pixelLeft = %d\n", l);
/* Test posLeft */
hres = IHTMLStyle_get_posLeft(style, NULL);
ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
......@@ -943,6 +949,11 @@ static void test_body_style(IHTMLStyle *style)
ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
ok(f == 3.0, "expected 3.0 got %f\n", f);
l = 0xdeadbeef;
hres = IHTMLStyle_get_pixelLeft(style, &l);
ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
ok(l == 3, "pixelLeft = %d\n", l);
V_VT(&v) = VT_EMPTY;
hres = IHTMLStyle_get_left(style, &v);
ok(hres == S_OK, "get_left failed: %08x\n", hres);
......@@ -968,6 +979,11 @@ static void test_body_style(IHTMLStyle *style)
ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
VariantClear(&v);
l = 0xdeadbeef;
hres = IHTMLStyle_get_pixelLeft(style, &l);
ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
ok(!l, "pixelLeft = %d\n", l);
/* Test posTop */
hres = IHTMLStyle_get_posTop(style, NULL);
ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment