mshtml: Added IHTMLStyle::clip property implementation.

This commit is contained in:
Jacek Caban 2011-07-15 15:38:08 +02:00 committed by Alexandre Julliard
parent e063198046
commit b7934f0ad1
2 changed files with 47 additions and 9 deletions

View File

@ -91,6 +91,8 @@ static const WCHAR attrBorderWidth[] =
{'b','o','r','d','e','r','-','w','i','d','t','h',0}; {'b','o','r','d','e','r','-','w','i','d','t','h',0};
static const WCHAR attrBottom[] = static const WCHAR attrBottom[] =
{'b','o','t','t','o','m',0}; {'b','o','t','t','o','m',0};
static const WCHAR attrClip[] =
{'c','l','i','p',0};
static const WCHAR attrColor[] = static const WCHAR attrColor[] =
{'c','o','l','o','r',0}; {'c','o','l','o','r',0};
static const WCHAR attrCursor[] = static const WCHAR attrCursor[] =
@ -198,6 +200,7 @@ static const struct{
{attrBorderTopWidth, DISPID_IHTMLSTYLE_BORDERTOPWIDTH}, {attrBorderTopWidth, DISPID_IHTMLSTYLE_BORDERTOPWIDTH},
{attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH}, {attrBorderWidth, DISPID_IHTMLSTYLE_BORDERWIDTH},
{attrBottom, DISPID_IHTMLSTYLE2_BOTTOM}, {attrBottom, DISPID_IHTMLSTYLE2_BOTTOM},
{attrClip, DISPID_IHTMLSTYLE_CLIP},
{attrColor, DISPID_IHTMLSTYLE_COLOR}, {attrColor, DISPID_IHTMLSTYLE_COLOR},
{attrCursor, DISPID_IHTMLSTYLE_CURSOR}, {attrCursor, DISPID_IHTMLSTYLE_CURSOR},
{attrDisplay, DISPID_IHTMLSTYLE_DISPLAY}, {attrDisplay, DISPID_IHTMLSTYLE_DISPLAY},
@ -410,6 +413,7 @@ static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, stylei
static HRESULT nsstyle_to_bstr(const WCHAR *val, DWORD flags, BSTR *p) static HRESULT nsstyle_to_bstr(const WCHAR *val, DWORD flags, BSTR *p)
{ {
BSTR ret; BSTR ret;
DWORD len;
if(!*val) { if(!*val) {
*p = NULL; *p = NULL;
@ -420,6 +424,34 @@ static HRESULT nsstyle_to_bstr(const WCHAR *val, DWORD flags, BSTR *p)
if(!ret) if(!ret)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
len = SysStringLen(ret);
if(flags & ATTR_REMOVE_COMMA) {
DWORD new_len = len;
WCHAR *ptr, *ptr2;
for(ptr = ret; (ptr = strchrW(ptr, ',')); ptr++)
new_len--;
if(new_len != len) {
BSTR new_ret;
new_ret = SysAllocStringLen(NULL, new_len);
if(!new_ret) {
SysFreeString(ret);
return E_OUTOFMEMORY;
}
for(ptr2 = new_ret, ptr = ret; *ptr; ptr++) {
if(*ptr != ',')
*ptr2++ = *ptr;
}
SysFreeString(ret);
ret = new_ret;
}
}
*p = ret; *p = ret;
return S_OK; return S_OK;
} }
@ -488,7 +520,7 @@ HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid,
nsAString_Finish(&str_value); nsAString_Finish(&str_value);
TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_variant(p)); TRACE("%s -> %s\n", debugstr_w(style_tbl[sid].name), debugstr_variant(p));
return hres; return S_OK;
} }
static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p) static inline HRESULT get_style_attr(HTMLStyle *This, styleid_t sid, BSTR *p)
@ -2549,15 +2581,19 @@ static HRESULT WINAPI HTMLStyle_get_cursor(IHTMLStyle *iface, BSTR *p)
static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v) static HRESULT WINAPI HTMLStyle_put_clip(IHTMLStyle *iface, BSTR v)
{ {
HTMLStyle *This = impl_from_IHTMLStyle(iface); HTMLStyle *This = impl_from_IHTMLStyle(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL; TRACE("(%p)->(%s)\n", This, debugstr_w(v));
return set_style_attr(This, STYLEID_CLIP, v, 0);
} }
static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p) static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
{ {
HTMLStyle *This = impl_from_IHTMLStyle(iface); HTMLStyle *This = impl_from_IHTMLStyle(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL; TRACE("(%p)->(%p)\n", This, p);
return get_nsstyle_attr(This->nsstyle, STYLEID_CLIP, p, ATTR_REMOVE_COMMA);
} }
static void set_opacity(HTMLStyle *This, const WCHAR *val) static void set_opacity(HTMLStyle *This, const WCHAR *val)

View File

@ -59,6 +59,7 @@ typedef enum {
STYLEID_BORDER_TOP_WIDTH, STYLEID_BORDER_TOP_WIDTH,
STYLEID_BORDER_WIDTH, STYLEID_BORDER_WIDTH,
STYLEID_BOTTOM, STYLEID_BOTTOM,
STYLEID_CLIP,
STYLEID_COLOR, STYLEID_COLOR,
STYLEID_CURSOR, STYLEID_CURSOR,
STYLEID_DISPLAY, STYLEID_DISPLAY,
@ -107,7 +108,8 @@ HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,LPCWSTR,DWORD) DEC
HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags) DECLSPEC_HIDDEN; HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags) DECLSPEC_HIDDEN;
HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags) DECLSPEC_HIDDEN; HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags) DECLSPEC_HIDDEN;
#define ATTR_FIX_PX 1 #define ATTR_FIX_PX 0x0001
#define ATTR_FIX_URL 2 #define ATTR_FIX_URL 0x0002
#define ATTR_STR_TO_INT 4 #define ATTR_STR_TO_INT 0x0004
#define ATTR_HEX_INT 8 #define ATTR_HEX_INT 0x0008
#define ATTR_REMOVE_COMMA 0x0010