mshtml: Added IHTMLStyle2::[get|put]_position.
This commit is contained in:
parent
7a8043d399
commit
c8b3a164c6
|
@ -69,6 +69,8 @@ static const WCHAR attrMarginRight[] =
|
|||
{'m','a','r','g','i','n','-','r','i','g','h','t',0};
|
||||
static const WCHAR attrPaddingLeft[] =
|
||||
{'p','a','d','d','i','n','g','-','l','e','f','t',0};
|
||||
static const WCHAR attrPosition[] =
|
||||
{'p','o','s','i','t','i','o','n',0};
|
||||
static const WCHAR attrTextDecoration[] =
|
||||
{'t','e','x','t','-','d','e','c','o','r','a','t','i','o','n',0};
|
||||
static const WCHAR attrTop[] =
|
||||
|
@ -99,6 +101,7 @@ static const LPCWSTR style_strings[] = {
|
|||
attrMarginLeft,
|
||||
attrMarginRight,
|
||||
attrPaddingLeft,
|
||||
attrPosition,
|
||||
attrTextDecoration,
|
||||
attrTop,
|
||||
attrVerticalAlign,
|
||||
|
@ -172,7 +175,7 @@ static LPWSTR fix_url_value(LPCWSTR val)
|
|||
#define ATTR_FIX_PX 1
|
||||
#define ATTR_FIX_URL 2
|
||||
|
||||
static HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWORD flags)
|
||||
HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags)
|
||||
{
|
||||
nsAString str_name, str_value, str_empty;
|
||||
LPWSTR val = NULL;
|
||||
|
@ -180,8 +183,6 @@ static HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWO
|
|||
|
||||
static const PRUnichar wszEmpty[] = {0};
|
||||
|
||||
TRACE("(%p)->(%s %s)\n", This, debugstr_w(style_strings[sid]), debugstr_w(value));
|
||||
|
||||
if(flags & ATTR_FIX_PX)
|
||||
val = fix_px_value(value);
|
||||
if(flags & ATTR_FIX_URL)
|
||||
|
@ -192,7 +193,7 @@ static HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWO
|
|||
nsAString_Init(&str_empty, wszEmpty);
|
||||
heap_free(val);
|
||||
|
||||
nsres = nsIDOMCSSStyleDeclaration_SetProperty(This->nsstyle, &str_name, &str_value, &str_empty);
|
||||
nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, &str_value, &str_empty);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("SetProperty failed: %08x\n", nsres);
|
||||
|
||||
|
@ -203,6 +204,11 @@ static HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWO
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static inline HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWORD flags)
|
||||
{
|
||||
return set_nsstyle_attr(This->nsstyle, sid, value, flags);
|
||||
}
|
||||
|
||||
static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
|
||||
{
|
||||
nsAString str_name;
|
||||
|
|
|
@ -49,6 +49,7 @@ typedef enum {
|
|||
STYLEID_MARGIN_LEFT,
|
||||
STYLEID_MARGIN_RIGHT,
|
||||
STYLEID_PADDING_LEFT,
|
||||
STYLEID_POSITION,
|
||||
STYLEID_TEXT_DECORATION,
|
||||
STYLEID_TOP,
|
||||
STYLEID_VERTICAL_ALIGN,
|
||||
|
@ -59,3 +60,4 @@ typedef enum {
|
|||
void HTMLStyle2_Init(HTMLStyle*);
|
||||
|
||||
HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,BSTR*);
|
||||
HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,LPCWSTR,DWORD);
|
||||
|
|
|
@ -166,15 +166,19 @@ static HRESULT WINAPI HTMLStyle2_removeExpression(IHTMLStyle2 *iface, BSTR propn
|
|||
static HRESULT WINAPI HTMLStyle2_put_position(IHTMLStyle2 *iface, BSTR v)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE2_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
|
||||
return set_nsstyle_attr(This->nsstyle, STYLEID_POSITION, v, 0);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle2_get_position(IHTMLStyle2 *iface, BSTR *p)
|
||||
{
|
||||
HTMLStyle *This = HTMLSTYLE2_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
return get_nsstyle_attr(This->nsstyle, STYLEID_POSITION, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLStyle2_put_unicodeBidi(IHTMLStyle2 *iface, BSTR v)
|
||||
|
|
|
@ -1998,8 +1998,31 @@ static void test_current_style(IHTMLCurrentStyle *current_style)
|
|||
SysFreeString(str);
|
||||
}
|
||||
|
||||
static void test_style2(IHTMLStyle2 *style2)
|
||||
{
|
||||
BSTR str;
|
||||
HRESULT hres;
|
||||
|
||||
str = (void*)0xdeadbeef;
|
||||
hres = IHTMLStyle2_get_position(style2, &str);
|
||||
ok(hres == S_OK, "get_position failed: %08x\n", hres);
|
||||
ok(!str, "str != NULL\n");
|
||||
|
||||
str = a2bstr("absolute");
|
||||
hres = IHTMLStyle2_put_position(style2, str);
|
||||
ok(hres == S_OK, "get_position failed: %08x\n", hres);
|
||||
SysFreeString(str);
|
||||
|
||||
str = NULL;
|
||||
hres = IHTMLStyle2_get_position(style2, &str);
|
||||
ok(hres == S_OK, "get_position failed: %08x\n", hres);
|
||||
ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", dbgstr_w(str));
|
||||
SysFreeString(str);
|
||||
}
|
||||
|
||||
static void test_default_style(IHTMLStyle *style)
|
||||
{
|
||||
IHTMLStyle2 *style2;
|
||||
VARIANT_BOOL b;
|
||||
VARIANT v;
|
||||
BSTR str;
|
||||
|
@ -2195,6 +2218,12 @@ 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);
|
||||
|
||||
hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
|
||||
ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
|
||||
if(SUCCEEDED(hres)) {
|
||||
test_style2(style2);
|
||||
IHTMLStyle2_Release(style2);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_default_selection(IHTMLDocument2 *doc)
|
||||
|
|
Loading…
Reference in New Issue