mshtml: Added get_styleSheets implementation.

This commit is contained in:
Jacek Caban 2007-09-19 13:09:35 +02:00 committed by Alexandre Julliard
parent 5071f124ab
commit ebd918eb48
4 changed files with 207 additions and 4 deletions

View File

@ -951,10 +951,40 @@ static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTML
}
static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
IHTMLStyleSheetsCollection **p)
IHTMLStyleSheetsCollection **p)
{
FIXME("(%p)->(%p)\n", iface, p);
return E_NOTIMPL;
HTMLDocument *This = HTMLDOC_THIS(iface);
nsIDOMStyleSheetList *nsstylelist;
nsIDOMDocumentStyle *nsdocstyle;
nsIDOMDocument *nsdoc;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
*p = NULL;
if(!This->nscontainer)
return S_OK;
nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
if(NS_FAILED(nsres)) {
ERR("GetDocument failed: %08x\n", nsres);
return S_OK;
}
if(NS_FAILED(nsres) || !nsdoc)
return S_OK;
nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMDocumentStyle, (void**)&nsdocstyle);
nsIDOMDocument_Release(nsdoc);
nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle, &nsstylelist);
nsIDOMDocumentStyle_Release(nsdocstyle);
*p = HTMLStyleSheetsCollection_Create(nsstylelist);
nsIDOMDocumentStyle_Release(nsstylelist);
return S_OK;
}
static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v)

View File

@ -41,7 +41,157 @@ typedef struct {
LONG ref;
} HTMLStyleSheet;
#define HTMLSTYLESHEET(x) ((IHTMLStyleSheet*) &(x)->lpHTMLStyleSheetVtbl);
typedef struct {
const IHTMLStyleSheetsCollectionVtbl *lpHTMLStyleSheetsCollectionVtbl;
LONG ref;
nsIDOMStyleSheetList *nslist;
} HTMLStyleSheetsCollection;
#define HTMLSTYLESHEET(x) ((IHTMLStyleSheet*) &(x)->lpHTMLStyleSheetVtbl);
#define HTMLSTYLESHEETSCOL(x) ((IHTMLStyleSheetsCollection*) &(x)->lpHTMLStyleSheetsCollectionVtbl);
#define HTMLSTYLESHEETSCOL_THIS(iface) \
DEFINE_THIS(HTMLStyleSheetsCollection, HTMLStyleSheetsCollection, iface)
static HRESULT WINAPI HTMLStyleSheetsCollection_QueryInterface(IHTMLStyleSheetsCollection *iface,
REFIID riid, void **ppv)
{
HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
*ppv = NULL;
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = HTMLSTYLESHEETSCOL(This);
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = HTMLSTYLESHEETSCOL(This);
}else if(IsEqualGUID(&IID_IHTMLStyleSheetsCollection, riid)) {
TRACE("(%p)->(IID_IHTMLStyleSheetsCollection %p)\n", This, ppv);
*ppv = HTMLSTYLESHEETSCOL(This);
}
if(*ppv) {
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
WARN("unsupported %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
static ULONG WINAPI HTMLStyleSheetsCollection_AddRef(IHTMLStyleSheetsCollection *iface)
{
HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
}
static ULONG WINAPI HTMLStyleSheetsCollection_Release(IHTMLStyleSheetsCollection *iface)
{
HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
if(!ref)
mshtml_free(This);
return ref;
}
static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfoCount(IHTMLStyleSheetsCollection *iface,
UINT *pctinfo)
{
HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
FIXME("(%p)->(%p)\n", This, pctinfo);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLStyleSheetsCollection_GetTypeInfo(IHTMLStyleSheetsCollection *iface,
UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
{
HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLStyleSheetsCollection_GetIDsOfNames(IHTMLStyleSheetsCollection *iface,
REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
{
HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLStyleSheetsCollection_Invoke(IHTMLStyleSheetsCollection *iface,
DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLStyleSheetsCollection_get_length(IHTMLStyleSheetsCollection *iface,
long *p)
{
HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLStyleSheetsCollection_get__newEnum(IHTMLStyleSheetsCollection *iface,
IUnknown **p)
{
HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLStyleSheetsCollection_item(IHTMLStyleSheetsCollection *iface,
VARIANT *pvarIndex, VARIANT *pvarResult)
{
HTMLStyleSheetsCollection *This = HTMLSTYLESHEETSCOL_THIS(iface);
FIXME("(%p)->(%p %p)\n", This, pvarIndex, pvarResult);
return E_NOTIMPL;
}
#undef HTMLSTYLESHEETSCOL_THIS
static const IHTMLStyleSheetsCollectionVtbl HTMLStyleSheetsCollectionVtbl = {
HTMLStyleSheetsCollection_QueryInterface,
HTMLStyleSheetsCollection_AddRef,
HTMLStyleSheetsCollection_Release,
HTMLStyleSheetsCollection_GetTypeInfoCount,
HTMLStyleSheetsCollection_GetTypeInfo,
HTMLStyleSheetsCollection_GetIDsOfNames,
HTMLStyleSheetsCollection_Invoke,
HTMLStyleSheetsCollection_get_length,
HTMLStyleSheetsCollection_get__newEnum,
HTMLStyleSheetsCollection_item
};
IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList *nslist)
{
HTMLStyleSheetsCollection *ret = mshtml_alloc(sizeof(HTMLStyleSheetsCollection));
ret->lpHTMLStyleSheetsCollectionVtbl = &HTMLStyleSheetsCollectionVtbl;
ret->ref = 1;
if(nslist)
nsIDOMStyleSheetList_AddRef(nslist);
ret->nslist = nslist;
return HTMLSTYLESHEETSCOL(ret);
}
#define HTMLSTYLESHEET_THIS(iface) DEFINE_THIS(HTMLStyleSheet, HTMLStyleSheet, iface)

View File

@ -406,6 +406,7 @@ IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
IHTMLStyleSheet *HTMLStyleSheet_Create(void);
IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
void detach_selection(HTMLDocument*);
void detach_ranges(HTMLDocument*);

View File

@ -123,6 +123,7 @@ typedef nsISupports nsIPrincipal;
typedef nsISupports nsIAtom;
typedef nsISupports nsISupportsArray;
typedef nsISupports nsIContentFilter;
typedef nsISupports nsIDOMStyleSheet;
[
object,
@ -569,6 +570,17 @@ interface nsIDOMCSSStyleDeclaration : nsISupports
nsresult GetParentRule(nsIDOMCSSRule **aParentRule);
}
[
object,
uuid(a6cf9081-15b3-11d2-932e-00805f8add32)
/* FROZEN */
]
interface nsIDOMStyleSheetList : nsISupports
{
nsresult GetLength(PRUint32 *aLength);
nsresult Item(PRUint32 index, nsIDOMStyleSheet **_retval);
}
[
object,
uuid(a6cf907d-15b3-11d2-932e-00805f8add32)
@ -822,6 +834,16 @@ interface nsIDOMHTMLDocument : nsIDOMDocument
nsresult GetElementsByName(const nsAString *elementName, nsIDOMNodeList **_retval);
}
[
object,
uuid(3d9f4973-dd2e-48f5-b5f7-2634e09eadd9)
/* FROZEN */
]
interface nsIDOMDocumentStyle : nsISupports
{
nsresult GetStyleSheets(nsIDOMStyleSheetList **aStyleSheets);
}
[
object,
uuid(a6cf90ce-15b3-11d2-932e-00805f8add32)