Module: wine Branch: master Commit: 51479d560ca53856f8b20dcb334ea61161fafdb9 URL: https://source.winehq.org/git/wine.git/?a=commit;h=51479d560ca53856f8b20dcb3... Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Mar 16 19:57:17 2021 +0100 mshtml: Initialize HTMLFiltersCollection object with compat mode. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mshtml/htmlelem.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 8e79da70571..8d2d8626047 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -230,7 +230,7 @@ static inline HTMLFiltersCollection *impl_from_IHTMLFiltersCollection(IHTMLFilte return CONTAINING_RECORD(iface, HTMLFiltersCollection, IHTMLFiltersCollection_iface); } -static IHTMLFiltersCollection *HTMLFiltersCollection_Create(void); +static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFiltersCollection **ret); static inline HTMLElement *impl_from_IHTMLElement(IHTMLElement *iface) { @@ -2011,18 +2011,16 @@ static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface) return S_OK; } -static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface, - IHTMLFiltersCollection **p) +static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface, IHTMLFiltersCollection **p) { HTMLElement *This = impl_from_IHTMLElement(iface); + TRACE("(%p)->(%p)\n", This, p); if(!p) return E_POINTER; - *p = HTMLFiltersCollection_Create(); - - return S_OK; + return create_filters_collection(dispex_compat_mode(&This->node.event_target.dispex), p); } static HRESULT WINAPI HTMLElement_put_ondragstart(IHTMLElement *iface, VARIANT v) @@ -6606,17 +6604,21 @@ static dispex_static_data_t HTMLFiltersCollection_dispex = { HTMLFiltersCollection_iface_tids }; -static IHTMLFiltersCollection *HTMLFiltersCollection_Create(void) +static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFiltersCollection **ret) { - HTMLFiltersCollection *ret = heap_alloc(sizeof(HTMLFiltersCollection)); + HTMLFiltersCollection *collection; - ret->IHTMLFiltersCollection_iface.lpVtbl = &HTMLFiltersCollectionVtbl; - ret->ref = 1; + if(!(collection = heap_alloc(sizeof(HTMLFiltersCollection)))) + return E_OUTOFMEMORY; + + collection->IHTMLFiltersCollection_iface.lpVtbl = &HTMLFiltersCollectionVtbl; + collection->ref = 1; - init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLFiltersCollection_iface, - &HTMLFiltersCollection_dispex); + init_dispex_with_compat_mode(&collection->dispex, (IUnknown*)&collection->IHTMLFiltersCollection_iface, + &HTMLFiltersCollection_dispex, compat_mode); - return &ret->IHTMLFiltersCollection_iface; + *ret = &collection->IHTMLFiltersCollection_iface; + return S_OK; } /* interface IHTMLAttributeCollection */