Commit 9a665ec2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLCurrentStyle::get_display implementation.

parent 72fc799d
......@@ -25,10 +25,10 @@
#include "winuser.h"
#include "ole2.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "mshtml_private.h"
#include "htmlstyle.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
......@@ -376,8 +376,10 @@ static HRESULT WINAPI HTMLCurrentStyle_get_textDecoration(IHTMLCurrentStyle *ifa
static HRESULT WINAPI HTMLCurrentStyle_get_display(IHTMLCurrentStyle *iface, BSTR *p)
{
HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
return get_nsstyle_attr(This->nsstyle, STYLEID_DISPLAY, p);
}
static HRESULT WINAPI HTMLCurrentStyle_get_visibility(IHTMLCurrentStyle *iface, BSTR *p)
......
......@@ -185,14 +185,14 @@ static HRESULT set_style_attr(HTMLStyle *This, styleid_t sid, LPCWSTR value, DWO
return S_OK;
}
static HRESULT get_style_attr_nsval(HTMLStyle *This, styleid_t sid, nsAString *value)
static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, nsAString *value)
{
nsAString str_name;
nsresult nsres;
nsAString_Init(&str_name, style_strings[sid]);
nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(This->nsstyle, &str_name, value);
nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
if(NS_FAILED(nsres)) {
ERR("SetProperty failed: %08x\n", nsres);
return E_FAIL;
......@@ -203,14 +203,14 @@ static HRESULT get_style_attr_nsval(HTMLStyle *This, styleid_t sid, nsAString *v
return NS_OK;
}
static HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR *p)
{
nsAString str_value;
const PRUnichar *value;
nsAString_Init(&str_value, NULL);
get_style_attr_nsval(This, sid, &str_value);
get_nsstyle_attr_nsval(nsstyle, sid, &str_value);
nsAString_GetData(&str_value, &value);
*p = *value ? SysAllocString(value) : NULL;
......@@ -221,6 +221,11 @@ static HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *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);
}
static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR exval, VARIANT_BOOL *p)
{
nsAString str_value;
......@@ -228,7 +233,7 @@ static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR ex
nsAString_Init(&str_value, NULL);
get_style_attr_nsval(This, sid, &str_value);
get_nsstyle_attr_nsval(This->nsstyle, sid, &str_value);
nsAString_GetData(&str_value, &value);
*p = strcmpW(value, exval) ? VARIANT_FALSE : VARIANT_TRUE;
......
......@@ -51,3 +51,5 @@ typedef enum {
} styleid_t;
void HTMLStyle2_Init(HTMLStyle*);
HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,BSTR*);
......@@ -1986,8 +1986,16 @@ static void test_navigator(IHTMLDocument2 *doc)
static void test_current_style(IHTMLCurrentStyle *current_style)
{
BSTR str;
HRESULT hres;
test_disp((IUnknown*)current_style, &DIID_DispHTMLCurrentStyle);
test_ifaces((IUnknown*)current_style, cstyle_iids);
hres = IHTMLCurrentStyle_get_display(current_style, &str);
ok(hres == S_OK, "get_display failed: %08x\n", hres);
ok(!strcmp_wa(str, "block"), "get_display returned %s\n", dbgstr_w(str));
SysFreeString(str);
}
static void test_default_style(IHTMLStyle *style)
......
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