mshtml: Initialize HTMLStyleSheetsCollection object with compat mode.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-03-15 16:18:24 +01:00 committed by Alexandre Julliard
parent f35737a088
commit 23ce468b2a
3 changed files with 20 additions and 13 deletions

View File

@ -1647,6 +1647,7 @@ static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
HTMLDocument *This = impl_from_IHTMLDocument2(iface); HTMLDocument *This = impl_from_IHTMLDocument2(iface);
nsIDOMStyleSheetList *nsstylelist; nsIDOMStyleSheetList *nsstylelist;
nsresult nsres; nsresult nsres;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, p); TRACE("(%p)->(%p)\n", This, p);
@ -1660,13 +1661,13 @@ static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
nsres = nsIDOMHTMLDocument_GetStyleSheets(This->doc_node->nsdoc, &nsstylelist); nsres = nsIDOMHTMLDocument_GetStyleSheets(This->doc_node->nsdoc, &nsstylelist);
if(NS_FAILED(nsres)) { if(NS_FAILED(nsres)) {
ERR("GetStyleSheets failed: %08x\n", nsres); ERR("GetStyleSheets failed: %08x\n", nsres);
return E_FAIL; return map_nsresult(nsres);
} }
*p = HTMLStyleSheetsCollection_Create(nsstylelist); hres = create_style_sheet_collection(nsstylelist,
dispex_compat_mode(&This->doc_node->node.event_target.dispex), p);
nsIDOMStyleSheetList_Release(nsstylelist); nsIDOMStyleSheetList_Release(nsstylelist);
return hres;
return S_OK;
} }
static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v) static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v)

View File

@ -573,21 +573,26 @@ static dispex_static_data_t HTMLStyleSheetsCollection_dispex = {
HTMLStyleSheetsCollection_iface_tids HTMLStyleSheetsCollection_iface_tids
}; };
IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList *nslist) HRESULT create_style_sheet_collection(nsIDOMStyleSheetList *nslist, compat_mode_t compat_mode,
IHTMLStyleSheetsCollection **ret)
{ {
HTMLStyleSheetsCollection *ret = heap_alloc(sizeof(HTMLStyleSheetsCollection)); HTMLStyleSheetsCollection *collection;
ret->IHTMLStyleSheetsCollection_iface.lpVtbl = &HTMLStyleSheetsCollectionVtbl; if(!(collection = heap_alloc(sizeof(HTMLStyleSheetsCollection))))
ret->ref = 1; return E_OUTOFMEMORY;
collection->IHTMLStyleSheetsCollection_iface.lpVtbl = &HTMLStyleSheetsCollectionVtbl;
collection->ref = 1;
if(nslist) if(nslist)
nsIDOMStyleSheetList_AddRef(nslist); nsIDOMStyleSheetList_AddRef(nslist);
ret->nslist = nslist; collection->nslist = nslist;
init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLStyleSheetsCollection_iface, init_dispex_with_compat_mode(&collection->dispex, (IUnknown*)&collection->IHTMLStyleSheetsCollection_iface,
&HTMLStyleSheetsCollection_dispex); &HTMLStyleSheetsCollection_dispex, compat_mode);
return &ret->IHTMLStyleSheetsCollection_iface; *ret = &collection->IHTMLStyleSheetsCollection_iface;
return S_OK;
} }
static inline HTMLStyleSheet *impl_from_IHTMLStyleSheet(IHTMLStyleSheet *iface) static inline HTMLStyleSheet *impl_from_IHTMLStyleSheet(IHTMLStyleSheet *iface)

View File

@ -1020,7 +1020,8 @@ HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN;
HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN; HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN; HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
HRESULT create_style_sheet(nsIDOMStyleSheet*,compat_mode_t,IHTMLStyleSheet**) DECLSPEC_HIDDEN; HRESULT create_style_sheet(nsIDOMStyleSheet*,compat_mode_t,IHTMLStyleSheet**) DECLSPEC_HIDDEN;
IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN; HRESULT create_style_sheet_collection(nsIDOMStyleSheetList*,compat_mode_t,
IHTMLStyleSheetsCollection**) DECLSPEC_HIDDEN;
HRESULT HTMLDOMRange_Create(nsIDOMRange*,IHTMLDOMRange**) DECLSPEC_HIDDEN; HRESULT HTMLDOMRange_Create(nsIDOMRange*,IHTMLDOMRange**) DECLSPEC_HIDDEN;
HRESULT create_markup_pointer(IMarkupPointer**) DECLSPEC_HIDDEN; HRESULT create_markup_pointer(IMarkupPointer**) DECLSPEC_HIDDEN;