mshtml: Added IDispatchEx support to HTMLStyle.

This commit is contained in:
Jacek Caban 2008-04-30 18:20:58 +02:00 committed by Alexandre Julliard
parent cecb265248
commit 9483760b35
4 changed files with 23 additions and 1 deletions

View File

@ -58,6 +58,7 @@ static REFIID tid_ids[] = {
&DIID_DispHTMLElementCollection,
&DIID_DispHTMLInputElement,
&DIID_DispHTMLOptionElement,
&DIID_DispHTMLStyle,
&DIID_DispHTMLUnknownElement,
&DIID_DispHTMLWindow2,
&IID_IHTMLCommentElement,
@ -74,6 +75,7 @@ static REFIID tid_ids[] = {
&IID_IHTMLElementCollection,
&IID_IHTMLInputElement,
&IID_IHTMLOptionElement,
&IID_IHTMLStyle,
&IID_IHTMLWindow2,
&IID_IHTMLWindow3,
&IID_IOmNavigator

View File

@ -33,6 +33,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef struct {
DispatchEx dispex;
const IHTMLStyleVtbl *lpHTMLStyleVtbl;
LONG ref;
@ -40,7 +41,7 @@ typedef struct {
nsIDOMCSSStyleDeclaration *nsstyle;
} HTMLStyle;
#define HTMLSTYLE(x) ((IHTMLStyle*) &(x)->lpHTMLStyleVtbl);
#define HTMLSTYLE(x) ((IHTMLStyle*) &(x)->lpHTMLStyleVtbl)
static const WCHAR attrBackgroundColor[] =
{'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0};
@ -213,6 +214,9 @@ static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, v
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = HTMLSTYLE(This);
}else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
*ppv = DISPATCHEX(&This->dispex);
}else if(IsEqualGUID(&IID_IHTMLStyle, riid)) {
TRACE("(%p)->(IID_IHTMLStyle %p)\n", This, ppv);
*ppv = HTMLSTYLE(This);
@ -1841,6 +1845,16 @@ static const IHTMLStyleVtbl HTMLStyleVtbl = {
HTMLStyle_toString
};
static dispex_static_data_t HTMLStyle_dispex = {
NULL,
DispHTMLStyle_tid,
NULL,
{
IHTMLStyle_tid,
0
}
};
IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle)
{
HTMLStyle *ret = heap_alloc(sizeof(HTMLStyle));
@ -1851,5 +1865,7 @@ IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration *nsstyle)
nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
init_dispex(&ret->dispex, (IUnknown*)HTMLSTYLE(ret), &HTMLStyle_dispex);
return HTMLSTYLE(ret);
}

View File

@ -68,6 +68,7 @@ typedef enum {
DispHTMLElementCollection_tid,
DispHTMLInputElement_tid,
DispHTMLOptionElement_tid,
DispHTMLStyle_tid,
DispHTMLUnknownElement_tid,
DispHTMLWindow2_tid,
IHTMLCommentElement_tid,
@ -84,6 +85,7 @@ typedef enum {
IHTMLElementCollection_tid,
IHTMLInputElement_tid,
IHTMLOptionElement_tid,
IHTMLStyle_tid,
IHTMLWindow2_tid,
IHTMLWindow3_tid,
IOmNavigator_tid,

View File

@ -1290,6 +1290,8 @@ static void test_default_style(IHTMLStyle *style)
BSTR str;
HRESULT hres;
test_disp((IUnknown*)style, &DIID_DispHTMLStyle);
str = (void*)0xdeadbeef;
hres = IHTMLStyle_get_fontFamily(style, &str);
ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);