forked from Mirrors/wine-wine
mshtml: Added IHTMLStyle::[get|put]_zIndex implementation.
parent
712c4d9af2
commit
844d1cfc15
|
@ -81,6 +81,8 @@ static const WCHAR attrVisibility[] =
|
|||
{'v','i','s','i','b','i','l','i','t','y',0};
|
||||
static const WCHAR attrWidth[] =
|
||||
{'w','i','d','t','h',0};
|
||||
static const WCHAR attrZIndex[] =
|
||||
{'z','-','i','n','d','e','x',0};
|
||||
|
||||
static const LPCWSTR style_strings[] = {
|
||||
attrBackground,
|
||||
|
@ -107,6 +109,7 @@ static const LPCWSTR style_strings[] = {
|
|||
attrVerticalAlign,
|
||||
attrVisibility,
|
||||
attrWidth,
|
||||
attrZIndex
|
||||
};
|
||||
|
||||
static const WCHAR valLineThrough[] =
|
||||
|
@ -172,8 +175,9 @@ static LPWSTR fix_url_value(LPCWSTR val)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#define ATTR_FIX_PX 1
|
||||
#define ATTR_FIX_URL 2
|
||||
#define ATTR_FIX_PX 1
|
||||
#define ATTR_FIX_URL 2
|
||||
#define ATTR_STR_TO_INT 4
|
||||
|
||||
HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
|
||||
{
|
||||
|
@ -245,6 +249,57 @@ HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags)
|
||||
{
|
||||
nsAString str_value;
|
||||
const PRUnichar *value;
|
||||
BOOL set = FALSE;
|
||||
|
||||
nsAString_Init(&str_value, NULL);
|
||||
|
||||
get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
|
||||
|
||||
nsAString_GetData(&str_value, &value);
|
||||
|
||||
if(flags & ATTR_STR_TO_INT) {
|
||||
const PRUnichar *ptr = value;
|
||||
BOOL neg = FALSE;
|
||||
INT i = 0;
|
||||
|
||||
if(*ptr == '-') {
|
||||
neg = TRUE;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
while(isdigitW(*ptr))
|
||||
i = i*10 + (*ptr++ - '0');
|
||||
|
||||
if(!*ptr) {
|
||||
V_VT(p) = VT_I4;
|
||||
V_I4(p) = neg ? -i : i;
|
||||
set = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if(!set) {
|
||||
BSTR str = NULL;
|
||||
|
||||
if(*value) {
|
||||
str = SysAllocString(value);
|
||||
if(!str)
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
V_VT(p) = VT_BSTR;
|
||||
V_BSTR(p) = str;
|
||||
}
|
||||
|
||||
nsAString_Finish(&str_value);
|
||||
|
||||
TRACE("%s -> %s\n", debugstr_w(style_strings[sid]), debugstr_variant(p));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
|
||||
{
|
||||
return get_nsstyle_attr(This->nsstyle, sid, p);
|
||||
|
@ -1581,15 +1636,27 @@ static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p)
|
|||
static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE_THIS(iface);
|
||||
FIXME("(%p)->(v%d)\n", This, V_VT(&v));
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
|
||||
switch(V_VT(&v)) {
|
||||
case VT_BSTR:
|
||||
return set_style_attr(This, STYLEID_Z_INDEX, V_BSTR(&v), 0);
|
||||
default:
|
||||
FIXME("unimplemented vt %d\n", V_VT(&v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle_get_zIndex(IHTMLStyle *iface, VARIANT *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE_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_Z_INDEX, p, ATTR_STR_TO_INT);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle_put_overflow(IHTMLStyle *iface, BSTR v)
|
||||
|
|
|
@ -54,7 +54,8 @@ typedef enum {
|
|||
STYLEID_TOP,
|
||||
STYLEID_VERTICAL_ALIGN,
|
||||
STYLEID_VISIBILITY,
|
||||
STYLEID_WIDTH
|
||||
STYLEID_WIDTH,
|
||||
STYLEID_Z_INDEX
|
||||
} styleid_t;
|
||||
|
||||
void HTMLStyle2_Init(HTMLStyle*);
|
||||
|
|
|
@ -2250,6 +2250,26 @@ static void test_default_style(IHTMLStyle *style)
|
|||
ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", dbgstr_w(V_BSTR(&v)));
|
||||
VariantClear(&v);
|
||||
|
||||
V_VT(&v) = VT_EMPTY;
|
||||
hres = IHTMLStyle_get_zIndex(style, &v);
|
||||
ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
|
||||
ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
|
||||
ok(!V_I4(&v), "V_I4(v) != 0\n");
|
||||
VariantClear(&v);
|
||||
|
||||
V_VT(&v) = VT_BSTR;
|
||||
V_BSTR(&v) = a2bstr("1");
|
||||
hres = IHTMLStyle_put_zIndex(style, v);
|
||||
ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
|
||||
VariantClear(&v);
|
||||
|
||||
V_VT(&v) = VT_EMPTY;
|
||||
hres = IHTMLStyle_get_zIndex(style, &v);
|
||||
ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
|
||||
ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
|
||||
ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
|
||||
VariantClear(&v);
|
||||
|
||||
hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
|
||||
ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
|
||||
if(SUCCEEDED(hres)) {
|
||||
|
|
Loading…
Reference in New Issue