Commit 7725acd3 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Get rid of the custom qi for CSS Styles.

parent 9339317e
......@@ -72,20 +72,6 @@ static inline HTMLCurrentStyle *impl_from_IHTMLCurrentStyle4(IHTMLCurrentStyle4
return CONTAINING_RECORD(iface, HTMLCurrentStyle, IHTMLCurrentStyle4_iface);
}
static void *HTMLCurrentStyle_QI(CSSStyle *css_style, REFIID riid)
{
HTMLCurrentStyle *This = CONTAINING_RECORD(css_style, HTMLCurrentStyle, css_style);
if(IsEqualGUID(&IID_IHTMLCurrentStyle, riid))
return &This->IHTMLCurrentStyle_iface;
if(IsEqualGUID(&IID_IHTMLCurrentStyle2, riid))
return &This->IHTMLCurrentStyle2_iface;
if(IsEqualGUID(&IID_IHTMLCurrentStyle3, riid))
return &This->IHTMLCurrentStyle3_iface;
if(IsEqualGUID(&IID_IHTMLCurrentStyle4, riid))
return &This->IHTMLCurrentStyle4_iface;
return NULL;
}
static HRESULT WINAPI HTMLCurrentStyle_QueryInterface(IHTMLCurrentStyle *iface, REFIID riid, void **ppv)
{
HTMLCurrentStyle *This = impl_from_IHTMLCurrentStyle(iface);
......@@ -1292,6 +1278,26 @@ static const IHTMLCurrentStyle4Vtbl HTMLCurrentStyle4Vtbl = {
HTMLCurrentStyle4_get_maxWidth
};
static void *HTMLCurrentStyle_query_interface(DispatchEx *dispex, REFIID riid)
{
HTMLCurrentStyle *This = CONTAINING_RECORD(dispex, HTMLCurrentStyle, css_style.dispex);
if(IsEqualGUID(&IID_IHTMLCurrentStyle, riid))
return &This->IHTMLCurrentStyle_iface;
if(IsEqualGUID(&IID_IHTMLCurrentStyle2, riid))
return &This->IHTMLCurrentStyle2_iface;
if(IsEqualGUID(&IID_IHTMLCurrentStyle3, riid))
return &This->IHTMLCurrentStyle3_iface;
if(IsEqualGUID(&IID_IHTMLCurrentStyle4, riid))
return &This->IHTMLCurrentStyle4_iface;
return CSSStyle_query_interface(&This->css_style.dispex, riid);
}
static const dispex_static_data_vtbl_t HTMLCurrentStyle_dispex_vtbl = {
CSSSTYLE_DISPEX_VTBL_ENTRIES,
.query_interface = HTMLCurrentStyle_query_interface
};
static const tid_t HTMLCurrentStyle_iface_tids[] = {
IHTMLCurrentStyle_tid,
IHTMLCurrentStyle2_tid,
......@@ -1301,7 +1307,7 @@ static const tid_t HTMLCurrentStyle_iface_tids[] = {
};
static dispex_static_data_t HTMLCurrentStyle_dispex = {
"MSCurrentStyleCSSProperties",
&CSSStyle_dispex_vtbl,
&HTMLCurrentStyle_dispex_vtbl,
DispHTMLCurrentStyle_tid,
HTMLCurrentStyle_iface_tids,
CSSStyle_init_dispex_info
......@@ -1356,8 +1362,7 @@ HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)
ret->IHTMLCurrentStyle3_iface.lpVtbl = &HTMLCurrentStyle3Vtbl;
ret->IHTMLCurrentStyle4_iface.lpVtbl = &HTMLCurrentStyle4Vtbl;
init_css_style(&ret->css_style, nsstyle, HTMLCurrentStyle_QI, &HTMLCurrentStyle_dispex,
dispex_compat_mode(&elem->node.event_target.dispex));
init_css_style(&ret->css_style, nsstyle, &HTMLCurrentStyle_dispex, dispex_compat_mode(&elem->node.event_target.dispex));
nsIDOMCSSStyleDeclaration_Release(nsstyle);
IHTMLElement_AddRef(&elem->IHTMLElement_iface);
......
......@@ -1115,25 +1115,6 @@ static BOOL is_valid_border_style(BSTR v)
wcsicmp(v, L"outset") == 0;
}
static void *HTMLStyle_QI(CSSStyle *css_style, REFIID riid)
{
HTMLStyle *This = CONTAINING_RECORD(css_style, HTMLStyle, css_style);
if(IsEqualGUID(&IID_IHTMLStyle, riid))
return &This->IHTMLStyle_iface;
if(IsEqualGUID(&IID_IHTMLStyle2, riid))
return &This->IHTMLStyle2_iface;
if(IsEqualGUID(&IID_IHTMLStyle3, riid))
return &This->IHTMLStyle3_iface;
if(IsEqualGUID(&IID_IHTMLStyle4, riid))
return &This->IHTMLStyle4_iface;
if(IsEqualGUID(&IID_IHTMLStyle5, riid))
return &This->IHTMLStyle5_iface;
if(IsEqualGUID(&IID_IHTMLStyle6, riid))
return &This->IHTMLStyle6_iface;
return NULL;
}
static inline HTMLStyle *impl_from_IHTMLStyle(IHTMLStyle *iface)
{
return CONTAINING_RECORD(iface, HTMLStyle, IHTMLStyle_iface);
......@@ -9936,7 +9917,7 @@ static inline CSSStyle *impl_from_DispatchEx(DispatchEx *dispex)
return CONTAINING_RECORD(dispex, CSSStyle, dispex);
}
static void *CSSStyle_query_interface(DispatchEx *dispex, REFIID riid)
void *CSSStyle_query_interface(DispatchEx *dispex, REFIID riid)
{
CSSStyle *This = impl_from_DispatchEx(dispex);
......@@ -9944,32 +9925,30 @@ static void *CSSStyle_query_interface(DispatchEx *dispex, REFIID riid)
return &This->IHTMLCSSStyleDeclaration_iface;
if(IsEqualGUID(&IID_IHTMLCSSStyleDeclaration2, riid))
return &This->IHTMLCSSStyleDeclaration2_iface;
if(This->qi)
return This->qi(This, riid);
return NULL;
}
static void CSSStyle_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb)
void CSSStyle_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback *cb)
{
CSSStyle *This = impl_from_DispatchEx(dispex);
if(This->nsstyle)
note_cc_edge((nsISupports*)This->nsstyle, "nsstyle", cb);
}
static void CSSStyle_unlink(DispatchEx *dispex)
void CSSStyle_unlink(DispatchEx *dispex)
{
CSSStyle *This = impl_from_DispatchEx(dispex);
unlink_ref(&This->nsstyle);
}
static void CSSStyle_destructor(DispatchEx *dispex)
void CSSStyle_destructor(DispatchEx *dispex)
{
CSSStyle *This = impl_from_DispatchEx(dispex);
free(This);
}
static HRESULT CSSStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
HRESULT CSSStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
{
CSSStyle *This = impl_from_DispatchEx(dispex);
const style_tbl_entry_t *style_entry;
......@@ -9988,6 +9967,25 @@ static HRESULT CSSStyle_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, D
return DISP_E_UNKNOWNNAME;
}
static void *HTMLStyle_query_interface(DispatchEx *dispex, REFIID riid)
{
HTMLStyle *This = CONTAINING_RECORD(dispex, HTMLStyle, css_style.dispex);
if(IsEqualGUID(&IID_IHTMLStyle, riid))
return &This->IHTMLStyle_iface;
if(IsEqualGUID(&IID_IHTMLStyle2, riid))
return &This->IHTMLStyle2_iface;
if(IsEqualGUID(&IID_IHTMLStyle3, riid))
return &This->IHTMLStyle3_iface;
if(IsEqualGUID(&IID_IHTMLStyle4, riid))
return &This->IHTMLStyle4_iface;
if(IsEqualGUID(&IID_IHTMLStyle5, riid))
return &This->IHTMLStyle5_iface;
if(IsEqualGUID(&IID_IHTMLStyle6, riid))
return &This->IHTMLStyle6_iface;
return CSSStyle_query_interface(&This->css_style.dispex, riid);
}
void CSSStyle_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
{
if(mode >= COMPAT_MODE_IE9)
......@@ -9996,12 +9994,9 @@ void CSSStyle_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
dispex_info_add_interface(info, IHTMLCSSStyleDeclaration2_tid, NULL);
}
const dispex_static_data_vtbl_t CSSStyle_dispex_vtbl = {
.query_interface = CSSStyle_query_interface,
.destructor = CSSStyle_destructor,
.traverse = CSSStyle_traverse,
.unlink = CSSStyle_unlink,
.get_dispid = CSSStyle_get_dispid,
static const dispex_static_data_vtbl_t CSSStyle_dispex_vtbl = {
CSSSTYLE_DISPEX_VTBL_ENTRIES,
.query_interface = HTMLStyle_query_interface
};
static const tid_t HTMLStyle_iface_tids[] = {
......@@ -10059,12 +10054,10 @@ static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration
return E_NOTIMPL;
}
void init_css_style(CSSStyle *style, nsIDOMCSSStyleDeclaration *nsstyle, style_qi_t qi,
dispex_static_data_t *dispex_info, compat_mode_t compat_mode)
void init_css_style(CSSStyle *style, nsIDOMCSSStyleDeclaration *nsstyle, dispex_static_data_t *dispex_info, compat_mode_t compat_mode)
{
style->IHTMLCSSStyleDeclaration_iface.lpVtbl = &HTMLCSSStyleDeclarationVtbl;
style->IHTMLCSSStyleDeclaration2_iface.lpVtbl = &HTMLCSSStyleDeclaration2Vtbl;
style->qi = qi;
style->nsstyle = nsstyle;
nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
......@@ -10096,20 +10089,24 @@ HRESULT HTMLStyle_Create(HTMLElement *elem, HTMLStyle **ret)
style->elem = elem;
init_css_style(&style->css_style, nsstyle, HTMLStyle_QI, &HTMLStyle_dispex,
dispex_compat_mode(&elem->node.event_target.dispex));
init_css_style(&style->css_style, nsstyle, &HTMLStyle_dispex, dispex_compat_mode(&elem->node.event_target.dispex));
nsIDOMCSSStyleDeclaration_Release(nsstyle);
*ret = style;
return S_OK;
}
static const dispex_static_data_vtbl_t HTMLW3CComputedStyle_dispex_vtbl = {
CSSSTYLE_DISPEX_VTBL_ENTRIES,
.query_interface = CSSStyle_query_interface
};
static const tid_t HTMLW3CComputedStyle_iface_tids[] = {
0
};
static dispex_static_data_t HTMLW3CComputedStyle_dispex = {
"CSSStyleDeclaration",
&CSSStyle_dispex_vtbl,
&HTMLW3CComputedStyle_dispex_vtbl,
DispHTMLW3CComputedStyle_tid,
HTMLW3CComputedStyle_iface_tids,
CSSStyle_init_dispex_info
......@@ -10122,7 +10119,7 @@ HRESULT create_computed_style(nsIDOMCSSStyleDeclaration *nsstyle, compat_mode_t
if(!(style = calloc(1, sizeof(*style))))
return E_OUTOFMEMORY;
init_css_style(style, nsstyle, NULL, &HTMLW3CComputedStyle_dispex, compat_mode);
init_css_style(style, nsstyle, &HTMLW3CComputedStyle_dispex, compat_mode);
*p = &style->IHTMLCSSStyleDeclaration_iface;
return S_OK;
}
......
......@@ -17,13 +17,11 @@
*/
typedef struct CSSStyle CSSStyle;
typedef void *(*style_qi_t)(CSSStyle*,REFIID);
struct CSSStyle {
DispatchEx dispex;
IHTMLCSSStyleDeclaration IHTMLCSSStyleDeclaration_iface;
IHTMLCSSStyleDeclaration2 IHTMLCSSStyleDeclaration2_iface;
style_qi_t qi;
nsIDOMCSSStyleDeclaration *nsstyle;
};
......@@ -151,14 +149,23 @@ typedef enum {
HRESULT HTMLStyle_Create(HTMLElement*,HTMLStyle**);
HRESULT create_computed_style(nsIDOMCSSStyleDeclaration*,compat_mode_t,IHTMLCSSStyleDeclaration**);
void init_css_style(CSSStyle*,nsIDOMCSSStyleDeclaration*,style_qi_t,
dispex_static_data_t*,compat_mode_t);
void init_css_style(CSSStyle*,nsIDOMCSSStyleDeclaration*,dispex_static_data_t*,compat_mode_t);
void *CSSStyle_query_interface(DispatchEx*,REFIID);
void CSSStyle_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*);
void CSSStyle_unlink(DispatchEx*);
void CSSStyle_destructor(DispatchEx*);
HRESULT CSSStyle_get_dispid(DispatchEx*,BSTR,DWORD,DISPID*);
void CSSStyle_init_dispex_info(dispex_data_t *info, compat_mode_t mode);
extern const dispex_static_data_vtbl_t CSSStyle_dispex_vtbl;
HRESULT get_style_property(CSSStyle*,styleid_t,BSTR*);
HRESULT get_style_property_var(CSSStyle*,styleid_t,VARIANT*);
HRESULT get_elem_style(HTMLElement*,styleid_t,BSTR*);
HRESULT set_elem_style(HTMLElement*,styleid_t,const WCHAR*);
#define CSSSTYLE_DISPEX_VTBL_ENTRIES \
.destructor = CSSStyle_destructor, \
.traverse = CSSStyle_traverse, \
.unlink = CSSStyle_unlink, \
.get_dispid = CSSStyle_get_dispid
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