mshtml: Add IHTMLStyleElement2 implementation.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ecf9c499ec
commit
5962a0ea26
|
@ -37,6 +37,7 @@ struct HTMLStyleElement {
|
||||||
HTMLElement element;
|
HTMLElement element;
|
||||||
|
|
||||||
IHTMLStyleElement IHTMLStyleElement_iface;
|
IHTMLStyleElement IHTMLStyleElement_iface;
|
||||||
|
IHTMLStyleElement2 IHTMLStyleElement2_iface;
|
||||||
|
|
||||||
nsIDOMHTMLStyleElement *nsstyle;
|
nsIDOMHTMLStyleElement *nsstyle;
|
||||||
IHTMLStyleSheet *style_sheet;
|
IHTMLStyleSheet *style_sheet;
|
||||||
|
@ -282,6 +283,82 @@ static const IHTMLStyleElementVtbl HTMLStyleElementVtbl = {
|
||||||
HTMLStyleElement_get_media
|
HTMLStyleElement_get_media
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline HTMLStyleElement *impl_from_IHTMLStyleElement2(IHTMLStyleElement2 *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, HTMLStyleElement, IHTMLStyleElement2_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI HTMLStyleElement2_QueryInterface(IHTMLStyleElement2 *iface,
|
||||||
|
REFIID riid, void **ppv)
|
||||||
|
{
|
||||||
|
HTMLStyleElement *This = impl_from_IHTMLStyleElement2(iface);
|
||||||
|
|
||||||
|
return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI HTMLStyleElement2_AddRef(IHTMLStyleElement2 *iface)
|
||||||
|
{
|
||||||
|
HTMLStyleElement *This = impl_from_IHTMLStyleElement2(iface);
|
||||||
|
|
||||||
|
return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI HTMLStyleElement2_Release(IHTMLStyleElement2 *iface)
|
||||||
|
{
|
||||||
|
HTMLStyleElement *This = impl_from_IHTMLStyleElement2(iface);
|
||||||
|
|
||||||
|
return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI HTMLStyleElement2_GetTypeInfoCount(IHTMLStyleElement2 *iface, UINT *pctinfo)
|
||||||
|
{
|
||||||
|
HTMLStyleElement *This = impl_from_IHTMLStyleElement2(iface);
|
||||||
|
return IDispatchEx_GetTypeInfoCount(&This->element.node.event_target.dispex.IDispatchEx_iface, pctinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI HTMLStyleElement2_GetTypeInfo(IHTMLStyleElement2 *iface, UINT iTInfo,
|
||||||
|
LCID lcid, ITypeInfo **ppTInfo)
|
||||||
|
{
|
||||||
|
HTMLStyleElement *This = impl_from_IHTMLStyleElement2(iface);
|
||||||
|
return IDispatchEx_GetTypeInfo(&This->element.node.event_target.dispex.IDispatchEx_iface, iTInfo, lcid,
|
||||||
|
ppTInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI HTMLStyleElement2_GetIDsOfNames(IHTMLStyleElement2 *iface, REFIID riid,
|
||||||
|
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
|
||||||
|
{
|
||||||
|
HTMLStyleElement *This = impl_from_IHTMLStyleElement2(iface);
|
||||||
|
return IDispatchEx_GetIDsOfNames(&This->element.node.event_target.dispex.IDispatchEx_iface, riid, rgszNames,
|
||||||
|
cNames, lcid, rgDispId);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI HTMLStyleElement2_Invoke(IHTMLStyleElement2 *iface, DISPID dispIdMember,
|
||||||
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
||||||
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||||
|
{
|
||||||
|
HTMLStyleElement *This = impl_from_IHTMLStyleElement2(iface);
|
||||||
|
return IDispatchEx_Invoke(&This->element.node.event_target.dispex.IDispatchEx_iface, dispIdMember, riid,
|
||||||
|
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI HTMLStyleElement2_get_sheet(IHTMLStyleElement2 *iface, IHTMLStyleSheet **p)
|
||||||
|
{
|
||||||
|
HTMLStyleElement *This = impl_from_IHTMLStyleElement2(iface);
|
||||||
|
TRACE("(%p)->(%p)\n", This, p);
|
||||||
|
return IHTMLStyleElement_get_styleSheet(&This->IHTMLStyleElement_iface, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const IHTMLStyleElement2Vtbl HTMLStyleElement2Vtbl = {
|
||||||
|
HTMLStyleElement2_QueryInterface,
|
||||||
|
HTMLStyleElement2_AddRef,
|
||||||
|
HTMLStyleElement2_Release,
|
||||||
|
HTMLStyleElement2_GetTypeInfoCount,
|
||||||
|
HTMLStyleElement2_GetTypeInfo,
|
||||||
|
HTMLStyleElement2_GetIDsOfNames,
|
||||||
|
HTMLStyleElement2_Invoke,
|
||||||
|
HTMLStyleElement2_get_sheet
|
||||||
|
};
|
||||||
|
|
||||||
static inline HTMLStyleElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
|
static inline HTMLStyleElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD(iface, HTMLStyleElement, element.node);
|
return CONTAINING_RECORD(iface, HTMLStyleElement, element.node);
|
||||||
|
@ -300,6 +377,9 @@ static HRESULT HTMLStyleElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
||||||
}else if(IsEqualGUID(&IID_IHTMLStyleElement, riid)) {
|
}else if(IsEqualGUID(&IID_IHTMLStyleElement, riid)) {
|
||||||
TRACE("(%p)->(IID_IHTMLStyleElement %p)\n", This, ppv);
|
TRACE("(%p)->(IID_IHTMLStyleElement %p)\n", This, ppv);
|
||||||
*ppv = &This->IHTMLStyleElement_iface;
|
*ppv = &This->IHTMLStyleElement_iface;
|
||||||
|
}else if(IsEqualGUID(&IID_IHTMLStyleElement2, riid)) {
|
||||||
|
TRACE("(%p)->(IID_IHTMLStyleElement2 %p)\n", This, ppv);
|
||||||
|
*ppv = &This->IHTMLStyleElement2_iface;
|
||||||
}else {
|
}else {
|
||||||
return HTMLElement_QI(&This->element.node, riid, ppv);
|
return HTMLElement_QI(&This->element.node, riid, ppv);
|
||||||
}
|
}
|
||||||
|
@ -382,6 +462,7 @@ HRESULT HTMLStyleElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HT
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
ret->IHTMLStyleElement_iface.lpVtbl = &HTMLStyleElementVtbl;
|
ret->IHTMLStyleElement_iface.lpVtbl = &HTMLStyleElementVtbl;
|
||||||
|
ret->IHTMLStyleElement2_iface.lpVtbl = &HTMLStyleElement2Vtbl;
|
||||||
ret->element.node.vtbl = &HTMLStyleElementImplVtbl;
|
ret->element.node.vtbl = &HTMLStyleElementImplVtbl;
|
||||||
|
|
||||||
HTMLElement_Init(&ret->element, doc, nselem, &HTMLStyleElement_dispex);
|
HTMLElement_Init(&ret->element, doc, nselem, &HTMLStyleElement_dispex);
|
||||||
|
|
|
@ -236,6 +236,7 @@ typedef struct EventTarget EventTarget;
|
||||||
XIID(IHTMLStyle5) \
|
XIID(IHTMLStyle5) \
|
||||||
XIID(IHTMLStyle6) \
|
XIID(IHTMLStyle6) \
|
||||||
XIID(IHTMLStyleElement) \
|
XIID(IHTMLStyleElement) \
|
||||||
|
XIID(IHTMLStyleElement2) \
|
||||||
XIID(IHTMLStyleSheet) \
|
XIID(IHTMLStyleSheet) \
|
||||||
XIID(IHTMLStyleSheetRule) \
|
XIID(IHTMLStyleSheetRule) \
|
||||||
XIID(IHTMLStyleSheetRulesCollection) \
|
XIID(IHTMLStyleSheetRulesCollection) \
|
||||||
|
|
|
@ -10100,6 +10100,7 @@ static void test_null_write(IHTMLDocument2 *doc)
|
||||||
static void test_create_stylesheet(IHTMLDocument2 *doc)
|
static void test_create_stylesheet(IHTMLDocument2 *doc)
|
||||||
{
|
{
|
||||||
IHTMLStyleSheet *stylesheet, *stylesheet2;
|
IHTMLStyleSheet *stylesheet, *stylesheet2;
|
||||||
|
IHTMLStyleElement2 *style_elem2;
|
||||||
IHTMLStyleElement *style_elem;
|
IHTMLStyleElement *style_elem;
|
||||||
IHTMLElement *doc_elem, *elem;
|
IHTMLElement *doc_elem, *elem;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
@ -10142,8 +10143,18 @@ static void test_create_stylesheet(IHTMLDocument2 *doc)
|
||||||
ok(hres == S_OK, "get_styleSheet failed: %08x\n", hres);
|
ok(hres == S_OK, "get_styleSheet failed: %08x\n", hres);
|
||||||
ok(stylesheet2 != NULL, "stylesheet2 == NULL\n");
|
ok(stylesheet2 != NULL, "stylesheet2 == NULL\n");
|
||||||
ok(iface_cmp((IUnknown*)stylesheet, (IUnknown*)stylesheet2), "stylesheet != stylesheet2\n");
|
ok(iface_cmp((IUnknown*)stylesheet, (IUnknown*)stylesheet2), "stylesheet != stylesheet2\n");
|
||||||
|
|
||||||
IHTMLStyleSheet_Release(stylesheet2);
|
IHTMLStyleSheet_Release(stylesheet2);
|
||||||
|
|
||||||
|
hres = IHTMLStyleElement_QueryInterface(style_elem, &IID_IHTMLStyleElement2, (void**)&style_elem2);
|
||||||
|
ok(hres == S_OK, "Could not get IHTMLStyleElement2: %08x\n", hres);
|
||||||
|
|
||||||
|
hres = IHTMLStyleElement2_get_sheet(style_elem2, &stylesheet2);
|
||||||
|
ok(hres == S_OK, "get_styleSheet failed: %08x\n", hres);
|
||||||
|
ok(stylesheet2 != NULL, "stylesheet2 == NULL\n");
|
||||||
|
ok(iface_cmp((IUnknown*)stylesheet, (IUnknown*)stylesheet2), "stylesheet != stylesheet2\n");
|
||||||
|
IHTMLStyleSheet_Release(stylesheet2);
|
||||||
|
|
||||||
|
IHTMLStyleElement2_Release(style_elem2);
|
||||||
IHTMLStyleSheet_Release(stylesheet);
|
IHTMLStyleSheet_Release(stylesheet);
|
||||||
|
|
||||||
IHTMLStyleElement_Release(style_elem);
|
IHTMLStyleElement_Release(style_elem);
|
||||||
|
|
Loading…
Reference in New Issue